~guilhem-fr/asterisk/menuselect

« back to all changes in this revision

Viewing changes to contrib/menuselect-dummy

  • Committer: tzafrir
  • Date: 2011-12-08 17:34:43 UTC
  • Revision ID: svn-v4:de84c67f-6f70-4c83-b0c2-62db8fd6e668:trunk:973
menuselect-dummy: fix support_level and more

* Parsing <support_level> requires adding '_' to the regex.
* Parse attribute in the main tag and treat them the same as sub-tags.
* ' */' can also terminate MODULEINFO. Be more strict about the end.
  (Make sure we don't get the terminating ' ***/' from the DOCUMENTATION
  in app_macro.c).

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
# Convert XML syntax to mail-header-like syntax:
111
111
# <var>value</var> --> Var: value
112
112
sub extract_xml_key($) {
 
113
        my %attr = ();
113
114
        my $xml_line = shift;
114
 
        if ($xml_line !~ m{^\s*<([a-zA-Z0-9]*)>([^<]*)</\1>}) {
 
115
        if ($xml_line !~ m{^\s*<([a-z_A-Z0-9]+)(\s+([^>]*))?>([^<]*)</\1>}) {
115
116
                warning "parsed empty value from XML line $xml_line";
116
117
                return ('', ''); # warn?
117
118
        }
118
 
        my ($var, $val) = ($1, $2);
 
119
        my ($var, $val) = ($1, $4);
119
120
        $var =~ s{^[a-z]}{\u$&};
120
 
        return ($var, $val);
 
121
        if (defined $3) {
 
122
                my $attr_text = $3;
 
123
                while ($attr_text =~ /^( *([^=]+)="([^"]+)")/) {
 
124
                        my ($var, $val) = ($2, $3);
 
125
                        $attr_text =~ s/^$1//;
 
126
                        $attr{$var} = $val;
 
127
                }
 
128
        }
 
129
        return ($var, $val, %attr);
121
130
}
122
131
 
123
132
# Get information embedded in source files from a subdirectory.
141
150
                );
142
151
 
143
152
                while (<SRC>) {
144
 
                        next unless (m|^/\*\*\* MODULEINFO| .. m|^ ?\*\*\*/|);
 
153
                        next unless (m|^/\*\*\* MODULEINFO| .. m|^ *[*]+/|);
145
154
                        next unless (m|^[A-Z]| || m|^\s*<|);
146
155
 
147
156
                        # At this point we can assume we're in the module 
148
157
                        # info section.
149
158
                        chomp;
150
 
                        my ($var, $val) = extract_xml_key($_);
151
 
 
 
159
                        my ($var, $val, %attr) = extract_xml_key($_);
 
160
                        foreach (keys %attr) {
 
161
                                push @{$data{$_}},($attr{$_});
 
162
                        }
152
163
                        if ($var =~ /^(Depend|Use)$/i) {
153
164
                                # use uppercase for dependency names;
154
165
                                $val = uc($val);