… | |
… | |
99 | |
99 | |
100 | if ($arch->{type} =~ s/^(bitmask)_(.*)/$1/) { |
100 | if ($arch->{type} =~ s/^(bitmask)_(.*)/$1/) { |
101 | $arch->{value} = $bitmask{$2} ||= {}; |
101 | $arch->{value} = $bitmask{$2} ||= {}; |
102 | } elsif ($arch->{type} =~ s/^(list)_(.*)/$1/) { |
102 | } elsif ($arch->{type} =~ s/^(list)_(.*)/$1/) { |
103 | $arch->{value} = $list{$2} ||= {}; |
103 | $arch->{value} = $list{$2} ||= {}; |
|
|
104 | } elsif ($arch->{type} eq "fixed") { |
|
|
105 | $arch->{value} = $e->attr ("value"); |
104 | } elsif ($arch->{type} =~ s/^bool_special$/bool/) { |
106 | } elsif ($arch->{type} =~ s/^bool_special$/bool/) { |
105 | $arch->{value} = [$e->attr ("false"), $e->attr ("true")]; |
107 | $arch->{value} = [$e->attr ("false"), $e->attr ("true")]; |
106 | } |
108 | } |
107 | |
109 | |
108 | $sect->{$e->attr ("arch") || $e->attr("arch_begin")} = $arch; |
110 | push @$sect, [$e->attr ("arch") || $e->attr("arch_begin"), $arch]; |
109 | } |
111 | } |
110 | |
112 | |
111 | sub parse_type { |
113 | sub parse_type { |
112 | my ($e, $type) = @_; |
114 | my ($e, $type) = @_; |
113 | |
115 | |
… | |
… | |
117 | if ($e->name eq "required") { |
119 | if ($e->name eq "required") { |
118 | for my $i (grep ref, @{$e->contents}) { |
120 | for my $i (grep ref, @{$e->contents}) { |
119 | $type->{required}{$i->attr ("arch")} = $i->attr ("value"); |
121 | $type->{required}{$i->attr ("arch")} = $i->attr ("value"); |
120 | } |
122 | } |
121 | } elsif ($e->name eq "attribute") { |
123 | } elsif ($e->name eq "attribute") { |
122 | parse_attr $e, $type->{attr} ||= {}; |
124 | parse_attr $e, $type->{attr} ||= []; |
123 | } elsif ($e->name eq "ignore") { |
125 | } elsif ($e->name eq "ignore") { |
124 | for my $i (grep ref, @{$e->contents}) { |
126 | for my $i (grep ref, @{$e->contents}) { |
125 | if ($i->name eq "ignore_list") { |
127 | if ($i->name eq "ignore_list") { |
126 | push @{$type->{ignore}}, $ignore_list{$i->attr ("name")} ||= []; |
128 | push @{$type->{ignore}}, $ignore_list{$i->attr ("name")} ||= []; |
127 | } elsif ($i->name eq "attribute") { |
129 | } elsif ($i->name eq "attribute") { |
… | |
… | |
133 | } elsif ($e->name eq "use") { |
135 | } elsif ($e->name eq "use") { |
134 | $type->{use} = string $e; |
136 | $type->{use} = string $e; |
135 | } elsif ($e->name eq "description") { |
137 | } elsif ($e->name eq "description") { |
136 | $type->{desc} = string $e; |
138 | $type->{desc} = string $e; |
137 | } elsif ($e->name eq "section") { |
139 | } elsif ($e->name eq "section") { |
138 | my %attr; |
140 | my @attr; |
139 | for my $i (grep ref, @{$e->contents}) { |
141 | for my $i (grep ref, @{$e->contents}) { |
140 | parse_attr $i, \%attr; |
142 | parse_attr $i, \@attr; |
141 | } |
143 | } |
142 | push @{ $type->{section} }, [$e->attr ("name") => \%attr]; |
144 | push @{ $type->{section} }, [$e->attr ("name") => \@attr]; |
143 | } else { |
145 | } else { |
144 | warn "unknown types subelement ", $e->name; |
146 | warn "unknown types subelement ", $e->name; |
145 | } |
147 | } |
146 | } |
148 | } |
147 | |
149 | |
… | |
… | |
170 | my $type = $type{$e->attr ("name")} ||= {}; |
172 | my $type = $type{$e->attr ("name")} ||= {}; |
171 | |
173 | |
172 | $type->{name} = $e->attr ("name"); |
174 | $type->{name} = $e->attr ("name"); |
173 | |
175 | |
174 | parse_type $e, $type; |
176 | parse_type $e, $type; |
175 | #unshift @{$type->{import}}, \%default_attr; |
|
|
176 | |
177 | |
177 | if ($e->attr ("number") > 0) { |
178 | if ($e->attr ("number") > 0) { |
178 | $attr{$e->attr ("number")} = $type; |
179 | $attr{$e->attr ("number")} = $type; |
179 | } elsif ($e->attr ("name") eq "Misc") { |
180 | } elsif ($e->attr ("name") eq "Misc") { |
180 | delete $type->{required}; |
181 | delete $type->{required}; |