/[libconf]/libconf/perl-Libconf/templates/XF86Config_template.pm
ViewVC logotype

Diff of /libconf/perl-Libconf/templates/XF86Config_template.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by dams, Sun Mar 16 22:11:46 2003 UTC revision 1.7 by dams, Sat Apr 5 20:09:23 2003 UTC
# Line 34  $templates{XF86Config} = { Line 34  $templates{XF86Config} = {
34                                         if ($in =~ s/^\s*Section\s+\"([^\"]+)\"\s*$//) {                                         if ($in =~ s/^\s*Section\s+\"([^\"]+)\"\s*$//) {
35                                             $atom->{type} = 'SECTION';                                             $atom->{type} = 'SECTION';
36                                             $atom->{section_name} = $1;                                             $atom->{section_name} = $1;
37                                               $atom->{sections} = [ @{$out->{current_sections}} ];
38                                             push @{$out->{current_sections}}, { name => $1 };                                             push @{$out->{current_sections}}, { name => $1 };
39                                             $matched = 1;                                             $matched = 1;
40                                         }                                         }
# Line 42  $templates{XF86Config} = { Line 43  $templates{XF86Config} = {
43                                         if ($in =~ s/^\s*Sub[s|S]ection\s+\"([^\"]+)\"\s*$//) {                                         if ($in =~ s/^\s*Sub[s|S]ection\s+\"([^\"]+)\"\s*$//) {
44                                             $atom->{type} = 'SECTION';                                             $atom->{type} = 'SECTION';
45                                             $atom->{section_name} = $1;                                             $atom->{section_name} = $1;
46                                               $atom->{sections} = [ @{$out->{current_sections}} ];
47                                             push @{$out->{current_sections}}, { name => $1 };                                             push @{$out->{current_sections}}, { name => $1 };
48                                             $matched = 1;                                             $matched = 1;
49                                         }                                         }
# Line 49  $templates{XF86Config} = { Line 51  $templates{XF86Config} = {
51                                       q(                                       q(
52                                         if ($in =~ s/^\s*EndSub[s|S]ection\s*$//) {                                         if ($in =~ s/^\s*EndSub[s|S]ection\s*$//) {
53                                             $atom->{type} = 'ENDSECTION';                                             $atom->{type} = 'ENDSECTION';
54                                               $atom->{sections} = [ @{$out->{current_sections}} ];
55                                             pop @{$out->{current_sections}};                                             pop @{$out->{current_sections}};
56                                             $matched = 1;                                             $matched = 1;
57                                         }                                         }
# Line 56  $templates{XF86Config} = { Line 59  $templates{XF86Config} = {
59                                       q(                                       q(
60                                         if ($in =~ s/^\s*EndSection\s*$//) {                                         if ($in =~ s/^\s*EndSection\s*$//) {
61                                             $atom->{type} = 'ENDSECTION';                                             $atom->{type} = 'ENDSECTION';
62                                               $atom->{sections} = [ @{$out->{current_sections}} ];
63                                             pop @{$out->{current_sections}};                                             pop @{$out->{current_sections}};
64                                             $matched = 1;                                             $matched = 1;
65                                         }                                         }
# Line 68  $templates{XF86Config} = { Line 72  $templates{XF86Config} = {
72                                             $tmp =~ s/^\s*"([^"]*)"// and $atom->{key} = $1;                                             $tmp =~ s/^\s*"([^"]*)"// and $atom->{key} = $1;
73                                             $tmp =~ s/^\s*"([^"]*)"// and $atom->{value} = $1;                                             $tmp =~ s/^\s*"([^"]*)"// and $atom->{value} = $1;
74                                             $in = $tmp; #to allow the engine to check if some stuff were not interpreted                                             $in = $tmp; #to allow the engine to check if some stuff were not interpreted
75                                             $out->{current_sections} and $atom->{sections} = [ @{$out->{current_sections}} ];                                             $atom->{sections} = [ @{$out->{current_sections}} ];
76                                             $matched = 1;                                             $matched = 1;
77                                         }                                         }
78                                       ),                                       ),
# Line 77  $templates{XF86Config} = { Line 81  $templates{XF86Config} = {
81                                             $atom->{type} = 'KEY_VALUE';                                             $atom->{type} = 'KEY_VALUE';
82                                             $atom->{key} = $1;                                             $atom->{key} = $1;
83                                             $atom->{value} = $2;                                             $atom->{value} = $2;
84                                             $out->{current_sections} and $atom->{sections} = [ @{$out->{current_sections}} ];                                             $atom->{sections} = [ @{$out->{current_sections}} ];
85                                             $matched = 1;                                             $matched = 1;
86                                         }                                         }
87                                       ),                                       ),
# Line 111  $templates{XF86Config} = { Line 115  $templates{XF86Config} = {
115                                               $index = (findAtomPos($out, \%args_search))[-1];                                               $index = (findAtomPos($out, \%args_search))[-1];
116                                               $index or return -2;                                               $index or return -2;
117                                           }                                           }
118                                           $args{section_name} and @{$out->{atoms}}[$index]->{section_names} = $args{section_name};                                           exists $args{section_name} and @{$out->{atoms}}[$index]->{section_names} = $args{section_name};
119                                           $args{type} and @{$out->{atoms}}[$index]->{type} = $args{type};                                           exists $args{type} and @{$out->{atoms}}[$index]->{type} = $args{type};
120                                           $args{key} and @{$out->{atoms}}[$index]->{key} = $args{key};                                           exists $args{key} and @{$out->{atoms}}[$index]->{key} = $args{key};
121                                           $args{value} and @{$out->{atoms}}[$index]->{value} = $args{value};                                           exists $args{value} and @{$out->{atoms}}[$index]->{value} = $args{value};
122                                           $args{list} and @{$out->{atoms}}[$index]->{list} = [ @{$args{list}} ];                                           exists $args{list} and @{$out->{atoms}}[$index]->{list} = [ @{$args{list}} ];
123                                             exists $args{sections} and @{$out->{atoms}}[$index]->{sections} [ @{$args{sections}} ];
124                                             @{$out->{atoms}}[$index]->{sections} ||= [ ];
125                                             return $index;
126                                         ),                                         ),
127                            find_atom_pos => q(                            find_atom_pos => q(
128                                               my $i = 0;                                               my $i = 0;
# Line 129  $templates{XF86Config} = { Line 136  $templates{XF86Config} = {
136                                                   $flag or next;                                                   $flag or next;
137                                                   if (exists $args{sections}) {                                                   if (exists $args{sections}) {
138                                                       exists $atom->{sections} or next;                                                       exists $atom->{sections} or next;
139                                                       @{$args{sections}} == @{$atom->{sections}} or next;                                                       $flag = compare_depth($args{sections}, $atom->{sections});
                                                      foreach my $i (0..@{$args{sections}}-1) {  
                                                          @{$atom->{sections}}[$i]->{name} eq @{$args{sections}}[$i]->{name} or $flag = 0;  
                                                      }  
140                                                   }                                                   }
141                                                   $flag or next;                                                             $flag or next;
142                                                   if (exists $args{list}) {                                                   if (exists $args{list}) {
143                                                       exists $atom->{list} or next;                                                       exists $atom->{list} or next;
144                                                       @{$args{list}} == @{$atom->{list}} or next;                                                       @{$args{list}} == @{$atom->{list}} or next;

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26