Subversion Repositories gelsvn

Rev

Rev 107 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 107 Rev 198
Line 86... Line 86...
86
                      'template_pre_extension'      => 0x08,
86
                      'template_pre_extension'      => 0x08,
87
                      'header_pre_extension'        => 0x08,
87
                      'header_pre_extension'        => 0x08,
88
                      'inline_pre_extension'        => 0x08,
88
                      'inline_pre_extension'        => 0x08,
89
                      'documentation_pre_extension' => 0x08,
89
                      'documentation_pre_extension' => 0x08,
90
                      'resource_pre_extension'      => 0x08,
90
                      'resource_pre_extension'      => 0x08,
-
 
91
                      'generic_pre_extension'       => 0x08,
91
                      'pre_filename'                => 0x08,
92
                      'pre_filename'                => 0x08,
92
                      'source_pre_filename'         => 0x08,
93
                      'source_pre_filename'         => 0x08,
93
                      'template_pre_filename'       => 0x08,
94
                      'template_pre_filename'       => 0x08,
94
                      'header_pre_filename'         => 0x08,
95
                      'header_pre_filename'         => 0x08,
95
                      'inline_pre_filename'         => 0x08,
96
                      'inline_pre_filename'         => 0x08,
96
                      'documentation_pre_filename'  => 0x08,
97
                      'documentation_pre_filename'  => 0x08,
97
                      'resource_pre_filename'       => 0x08,
98
                      'resource_pre_filename'       => 0x08,
-
 
99
                      'generic_pre_filename'        => 0x08,
98
                      'source_outputext'            => 0x0a,
100
                      'source_outputext'            => 0x0a,
99
                      'template_outputext'          => 0x0a,
101
                      'template_outputext'          => 0x0a,
100
                      'header_outputext'            => 0x0a,
102
                      'header_outputext'            => 0x0a,
101
                      'inline_outputext'            => 0x0a,
103
                      'inline_outputext'            => 0x0a,
102
                      'documentation_outputext'     => 0x0a,
104
                      'documentation_outputext'     => 0x0a,
Line 268... Line 270...
268
  $self->{'defaulted'}             = {};
270
  $self->{'defaulted'}             = {};
269
  $self->{'custom_types'}          = {};
271
  $self->{'custom_types'}          = {};
270
  $self->{'parents_read'}          = {};
272
  $self->{'parents_read'}          = {};
271
  $self->{'inheritance_tree'}      = {};
273
  $self->{'inheritance_tree'}      = {};
272
  $self->{'remove_files'}          = {};
274
  $self->{'remove_files'}          = {};
-
 
275
  $self->{'expanded'}              = {};
273
 
276
 
274
  my($typefeaturef) = dirname($gfeature) . '/' .
277
  my($typefeaturef) = $self->mpc_dirname($gfeature) . '/' .
275
                      $self->{'pctype'} . '.features';
278
                      $self->{'pctype'} . '.features';
276
  $typefeaturef = undef if (! -r $typefeaturef);
279
  $typefeaturef = undef if (! -r $typefeaturef);
277
  $self->{'feature_parser'}        = new FeatureParser($features,
280
  $self->{'feature_parser'}        = new FeatureParser($features,
278
                                                       $gfeature,
281
                                                       $gfeature,
279
                                                       $typefeaturef,
282
                                                       $typefeaturef,
Line 627... Line 630...
627
            $self->{'parents_read'}          = {};
630
            $self->{'parents_read'}          = {};
628
            $self->{'inheritance_tree'}      = {};
631
            $self->{'inheritance_tree'}      = {};
629
            $self->{'remove_files'}          = {};
632
            $self->{'remove_files'}          = {};
630
            $self->{'custom_special_output'} = {};
633
            $self->{'custom_special_output'} = {};
631
            $self->{'custom_special_depend'} = {};
634
            $self->{'custom_special_depend'} = {};
-
 
635
            $self->{'expanded'}              = {};
632
            $self->reset_generating_types();
636
            $self->reset_generating_types();
633
          }
637
          }
634
        }
638
        }
635
        $self->{$typecheck} = 0;
639
        $self->{$typecheck} = 0;
636
      }
640
      }
Line 732... Line 736...
732
        elsif ($comp eq 'specific') {
736
        elsif ($comp eq 'specific') {
733
          my($type) = $self->get_process_project_type($name);
737
          my($type) = $self->get_process_project_type($name);
734
          if ($type eq $self->{'pctype'} ||
738
          if ($type eq $self->{'pctype'} ||
735
              $type eq $self->get_default_component_name()) {
739
              $type eq $self->get_default_component_name()) {
736
            ($status, $errorString) = $self->parse_scope(
740
            ($status, $errorString) = $self->parse_scope(
737
                                        $ih, $values[1], $type,
741
                                        $ih, $comp, $type,
738
                                        $self->{'valid_names'},
742
                                        $self->{'valid_names'},
739
                                        $self->get_assignment_hash(),
743
                                        $self->get_assignment_hash(),
740
                                        {});
744
                                        {});
741
          }
745
          }
742
          else {
746
          else {
743
            ## We still need to parse the scope, but we will be
747
            ## We still need to parse the scope, but we will be
744
            ## throwing away whatever is processed.  However, it
748
            ## throwing away whatever is processed.  However, it
745
            ## could still be invalid code that will cause an error.
749
            ## could still be invalid code that will cause an error.
746
            ($status, $errorString) = $self->parse_scope(
750
            ($status, $errorString) = $self->parse_scope(
747
                                        $ih, $values[1], undef,
751
                                        $ih, $comp, undef,
748
                                        $self->{'valid_names'},
752
                                        $self->{'valid_names'},
749
                                        undef,
753
                                        undef,
750
                                        $self->get_assignment_hash());
754
                                        $self->get_assignment_hash());
751
          }
755
          }
752
        }
756
        }
753
        elsif ($comp eq 'define_custom') {
757
        elsif ($comp eq 'define_custom') {
754
          ($status, $errorString) = $self->parse_define_custom($ih, $name);
758
          ($status, $errorString) = $self->parse_define_custom($ih, $name);
755
        }
759
        }
-
 
760
        elsif ($comp eq 'expand') {
-
 
761
          ($status, $errorString) = $self->parse_scope($ih, $comp, $name);
-
 
762
        }
756
        else {
763
        else {
757
          $errorString = "Invalid component name: $comp";
764
          $errorString = "Invalid component name: $comp";
758
          $status = 0;
765
          $status = 0;
759
        }
766
        }
760
      }
767
      }
Line 876... Line 883...
876
 
883
 
877
  return 1, undef;
884
  return 1, undef;
878
}
885
}
879
 
886
 
880
 
887
 
-
 
888
sub handle_scoped_unknown {
-
 
889
  my($self)  = shift;
-
 
890
  my($fh)    = shift;
-
 
891
  my($type)  = shift;
-
 
892
  my($flags) = shift;
-
 
893
  my($line)  = shift;
-
 
894
 
-
 
895
  if (defined $type) {
-
 
896
    if ($type eq $self->get_default_component_name()) {
-
 
897
      return 0, 'Can not set expansion in this context';
-
 
898
    }
-
 
899
    else {
-
 
900
      if (!defined $self->{'expanded'}->{$type}) {
-
 
901
        my($ok) = 1;
-
 
902
        while($line =~ /\$(\w+)/) {
-
 
903
          my($name) = $1;
-
 
904
          my($val)  = '';
-
 
905
          if ($name eq 'PWD') {
-
 
906
            $val = $self->getcwd();
-
 
907
          }
-
 
908
          elsif (defined $ENV{$name}) {
-
 
909
            $val = $ENV{$name};
-
 
910
          }
-
 
911
          else {
-
 
912
            $ok = undef;
-
 
913
            last;
-
 
914
          }
-
 
915
          $line =~ s/\$\w+/$val/;
-
 
916
        }
-
 
917
        $self->{'expanded'}->{$type} = $line if ($ok);
-
 
918
      }
-
 
919
      return 1, undef;
-
 
920
    }
-
 
921
  }
-
 
922
 
-
 
923
  ## If the type is not defined, then this is something other than an
-
 
924
  ## assignment in a 'specific' section and should be flagged as an error
-
 
925
  return 0, "Unrecognized line: $line";
-
 
926
}
-
 
927
 
881
sub process_component_line {
928
sub process_component_line {
882
  my($self)    = shift;
929
  my($self)    = shift;
883
  my($tag)     = shift;
930
  my($tag)     = shift;
884
  my($line)    = shift;
931
  my($line)    = shift;
885
  my($flags)   = shift;
932
  my($flags)   = shift;
Line 960... Line 1007...
960
    my(@files) = ();
1007
    my(@files) = ();
961
    if ($line =~ /^"([^"]+)"$/) {
1008
    if ($line =~ /^"([^"]+)"$/) {
962
      push(@files, $1);
1009
      push(@files, $1);
963
    }
1010
    }
964
    elsif ($line =~ /[\?\*\[\]]/) {
1011
    elsif ($line =~ /[\?\*\[\]]/) {
965
      @files = glob($line);
1012
      @files = $self->mpc_glob($line);
966
    }
1013
    }
967
    else {
1014
    else {
968
      push(@files, $line);
1015
      push(@files, $line);
969
    }
1016
    }
970
 
1017
 
Line 1200... Line 1247...
1200
  if ($status && $#exclude != -1 && defined $grname) {
1247
  if ($status && $#exclude != -1 && defined $grname) {
1201
    my($alldir)  = $self->get_assignment('recurse') || $flags{'recurse'};
1248
    my($alldir)  = $self->get_assignment('recurse') || $flags{'recurse'};
1202
    my(%checked) = ();
1249
    my(%checked) = ();
1203
    my(@files)   = ();
1250
    my(@files)   = ();
1204
    foreach my $exc (@exclude) {
1251
    foreach my $exc (@exclude) {
1205
      my($dname) = dirname($exc);
1252
      my($dname) = $self->mpc_dirname($exc);
1206
      if (!defined $checked{$dname}) {
1253
      if (!defined $checked{$dname}) {
1207
        $checked{$dname} = 1;
1254
        $checked{$dname} = 1;
1208
        push(@files, $self->generate_default_file_list($dname,
1255
        push(@files, $self->generate_default_file_list($dname,
1209
                                                       \@exclude, $alldir));
1256
                                                       \@exclude, $alldir));
1210
      }
1257
      }
Line 1612... Line 1659...
1612
      ## need to get the modified assignment value before we attempt to
1659
      ## need to get the modified assignment value before we attempt to
1613
      ## do so.
1660
      ## do so.
1614
      $value = $self->modify_assignment_value($name, $value);
1661
      $value = $self->modify_assignment_value($name, $value);
1615
      foreach my $val (@{$self->create_array($value)}) {
1662
      foreach my $val (@{$self->create_array($value)}) {
1616
        if (!exists $parts{$val}) {
1663
        if (!exists $parts{$val}) {
-
 
1664
          my($qt) = ($val =~ /\s/ ? '"' : '');
1617
          $allowed .= $val . ' ';
1665
          $allowed .= $qt . $val . $qt . ' ';
1618
        }
1666
        }
1619
      }
1667
      }
1620
      $allowed =~ s/\s+$//;
1668
      $allowed =~ s/\s+$//;
1621
      return $allowed;
1669
      return $allowed;
1622
    }
1670
    }
Line 2510... Line 2558...
2510
                  my(@front) = ();
2558
                  my(@front) = ();
2511
                  my(@copy)  = @$array;
2559
                  my(@copy)  = @$array;
2512
 
2560
 
2513
                  @$array = ();
2561
                  @$array = ();
2514
                  foreach my $input (@input) {
2562
                  foreach my $input (@input) {
2515
                    my($part) = $input;
2563
                    my($part) = $self->remove_wanted_extension(
2516
                    foreach my $wanted (@{$self->{'valid_components'}->{$gentype}}) {
-
 
2517
                      if ($part =~ s/$wanted$//) {
2564
                                   $input,
2518
                        last;
2565
                                   $self->{'valid_components'}->{$gentype});
2519
                      }
-
 
2520
                    }
-
 
-
 
2566
 
2521
                    $part = $self->escape_regex_special($part);
2567
                    $part = $self->escape_regex_special($part);
2522
                    my(@files) = $self->generated_filenames($part, $gentype,
2568
                    my(@files) = $self->generated_filenames($part, $gentype,
2523
                                                            $tag, $input, 1);
2569
                                                            $tag, $input, 1);
2524
                    if ($#copy != -1) {
2570
                    if ($#copy != -1) {
2525
                      my($found) = 0;
2571
                      my($found) = 0;
Line 2678... Line 2724...
2678
          if ($key ne $defgroup) {
2724
          if ($key ne $defgroup) {
2679
            $group = $key;
2725
            $group = $key;
2680
          }
2726
          }
2681
 
2727
 
2682
          foreach my $val (@$array) {
2728
          foreach my $val (@$array) {
2683
            my($f) = $val;
2729
            my($f) = $self->remove_wanted_extension(
2684
            foreach my $wanted (@{$self->{'valid_components'}->{$gentype}}) {
-
 
2685
              if ($f =~ s/$wanted$//) {
2730
                              $val,
2686
                last;
-
 
2687
              }
-
 
2688
            }
-
 
2689
 
-
 
2690
            ## If the user provided file does not match any of the
2731
                              $self->{'valid_components'}->{$gentype});
2691
            ## extensions specified by the custom definition, we need
-
 
2692
            ## to remove the extension or else this file will not be
-
 
2693
            ## added to the project.
-
 
2694
            if ($f eq $val) {
-
 
2695
              $f =~ s/\.[^\.]+$//;
-
 
2696
            }
-
 
2697
 
-
 
2698
            push(@arr, $f);
2732
            push(@arr, $f);
2699
          }
2733
          }
2700
        }
2734
        }
2701
      }
2735
      }
2702
 
2736
 
Line 4109... Line 4143...
4109
 
4143
 
4110
  return $value;
4144
  return $value;
4111
}
4145
}
4112
 
4146
 
4113
 
4147
 
-
 
4148
sub expand_variables {
-
 
4149
  my($self)            = shift;
-
 
4150
  my($value)           = shift;
-
 
4151
  my($keys)            = shift;
-
 
4152
  my($rel)             = shift;
-
 
4153
  my($expand_template) = shift;
-
 
4154
  my($scope)           = shift;
-
 
4155
  my($expand)          = shift;
-
 
4156
  my($warn)            = shift;
-
 
4157
  my($cwd)             = $self->getcwd();
-
 
4158
  my($start)           = 0;
-
 
4159
 
-
 
4160
  ## Fix up the value for Windows switch the \\'s to /
-
 
4161
  if ($self->{'convert_slashes'}) {
-
 
4162
    $cwd =~ s/\\/\//g;
-
 
4163
  }
-
 
4164
 
-
 
4165
  while(substr($value, $start) =~ /(\$\(([^)]+)\))/) {
-
 
4166
    my($whole)  = $1;
-
 
4167
    my($name)   = $2;
-
 
4168
    my($val)    = $$rel{$name};
-
 
4169
 
-
 
4170
    if (defined $val) {
-
 
4171
      if ($expand) {
-
 
4172
        if ($self->{'convert_slashes'}) {
-
 
4173
          $val = $self->slash_to_backslash($val);
-
 
4174
        }
-
 
4175
        substr($value, $start) =~ s/\$\([^)]+\)/$val/;
-
 
4176
        $whole = $val;
-
 
4177
      }
-
 
4178
      else {
-
 
4179
        ## Fix up the value for Windows switch the \\'s to /
-
 
4180
        if ($self->{'convert_slashes'}) {
-
 
4181
          $val =~ s/\\/\//g;
-
 
4182
        }
-
 
4183
 
-
 
4184
        ## Here we make an assumption that if we convert slashes to
-
 
4185
        ## back-slashes, we also have a case-insensitive file system.
-
 
4186
        my($icwd) = ($self->{'convert_slashes'} ? lc($cwd) : $cwd);
-
 
4187
        my($ival) = ($self->{'convert_slashes'} ? lc($val) : $val);
-
 
4188
        my($iclen) = length($icwd);
-
 
4189
        my($ivlen) = length($ival);
-
 
4190
 
-
 
4191
        ## If the relative value contains the current working
-
 
4192
        ## directory plus additional subdirectories, we must pull
-
 
4193
        ## off the additional directories into a temporary where
-
 
4194
        ## it can be put back after the relative replacement is done.
-
 
4195
        my($append) = undef;
-
 
4196
        if (index($ival, $icwd) == 0 && $iclen != $ivlen &&
-
 
4197
            substr($ival, $iclen, 1) eq '/') {
-
 
4198
          my($diff) = $ivlen - $iclen;
-
 
4199
          $append = substr($ival, $iclen);
-
 
4200
          substr($ival, $iclen, $diff) = '';
-
 
4201
          $ivlen -= $diff;
-
 
4202
        }
-
 
4203
 
-
 
4204
        if (index($icwd, $ival) == 0 &&
-
 
4205
            ($iclen == $ivlen || substr($icwd, $ivlen, 1) eq '/')) {
-
 
4206
          my($current) = $icwd;
-
 
4207
          substr($current, 0, $ivlen) = '';
-
 
4208
 
-
 
4209
          my($dircount) = ($current =~ tr/\///);
-
 
4210
          if ($dircount == 0) {
-
 
4211
            $ival = '.';
-
 
4212
          }
-
 
4213
          else {
-
 
4214
            $ival = '../' x $dircount;
-
 
4215
            $ival =~ s/\/$//;
-
 
4216
          }
-
 
4217
          if (defined $append) {
-
 
4218
            $ival .= $append;
-
 
4219
          }
-
 
4220
          if ($self->{'convert_slashes'}) {
-
 
4221
            $ival = $self->slash_to_backslash($ival);
-
 
4222
          }
-
 
4223
          substr($value, $start) =~ s/\$\([^)]+\)/$ival/;
-
 
4224
          $whole = $ival;
-
 
4225
        }
-
 
4226
      }
-
 
4227
    }
-
 
4228
    elsif ($expand_template ||
-
 
4229
           $self->expand_variables_from_template_values()) {
-
 
4230
      my($ti) = $self->get_template_input();
-
 
4231
      if (defined $ti) {
-
 
4232
        $val = $ti->get_value($name);
-
 
4233
      }
-
 
4234
      my($sname) = (defined $scope ? $scope . "::$name" : undef);
-
 
4235
      my($arr) = $self->adjust_value([$sname, $name],
-
 
4236
                                     (defined $val ? $val : []));
-
 
4237
      if (defined $$arr[0]) {
-
 
4238
        $val = "@$arr";
-
 
4239
        if ($self->{'convert_slashes'}) {
-
 
4240
          $val = $self->slash_to_backslash($val);
-
 
4241
        }
-
 
4242
        substr($value, $start) =~ s/\$\([^)]+\)/$val/;
-
 
4243
 
-
 
4244
        ## We have replaced the template value, but that template
-
 
4245
        ## value may contain a $() construct that may need to get
-
 
4246
        ## replaced too.
-
 
4247
        $whole = '';
-
 
4248
      }
-
 
4249
      else {
-
 
4250
        if ($expand && $warn) {
-
 
4251
          $self->warning("Unable to expand $name.");
-
 
4252
        }
-
 
4253
      }
-
 
4254
    }
-
 
4255
    $start += length($whole);
-
 
4256
  }
-
 
4257
 
-
 
4258
  return $value;
-
 
4259
}
-
 
4260
 
-
 
4261
 
4114
sub relative {
4262
sub relative {
4115
  my($self)            = shift;
4263
  my($self)            = shift;
4116
  my($value)           = shift;
4264
  my($value)           = shift;
4117
  my($expand_template) = shift;
4265
  my($expand_template) = shift;
4118
  my($scope)           = shift;
4266
  my($scope)           = shift;
4119
 
4267
 
4120
  if (defined $value) {
4268
  if (defined $value) {
4121
    if (UNIVERSAL::isa($value, 'ARRAY')) {
4269
    if (UNIVERSAL::isa($value, 'ARRAY')) {
4122
      my(@built) = ();
4270
      my(@built) = ();
4123
      foreach my $val (@$value) {
4271
      foreach my $val (@$value) {
4124
        push(@built, $self->relative($val, $expand_template, $scope));
4272
        my($rel) = $self->relative($val, $expand_template, $scope);
-
 
4273
        if (UNIVERSAL::isa($rel, 'ARRAY')) {
-
 
4274
          push(@built, @$rel);
-
 
4275
        }
-
 
4276
        else {
-
 
4277
          push(@built, $rel);
-
 
4278
        }
4125
      }
4279
      }
4126
      $value = \@built;
4280
      $value = \@built;
4127
    }
4281
    }
4128
    elsif ($value =~ /\$/) {
4282
    elsif ($value =~ /\$/) {
4129
      my($useenv) = $self->get_use_env();
4283
      my($ovalue) = $value;
4130
      my($rel)    = ($useenv ? \%ENV : $self->get_relative());
-
 
4131
      my(@keys)   = keys %$rel;
4284
      my(@keys) = keys %{$self->{'expanded'}};
4132
 
-
 
4133
      if (defined $keys[0]) {
4285
      if (defined $keys[0]) {
4134
        my($expand) = $self->get_expand_vars();
-
 
4135
        my($cwd)    = $self->getcwd();
-
 
4136
        my($start)  = 0;
-
 
4137
 
-
 
4138
        ## Fix up the value for Windows switch the \\'s to /
-
 
4139
        if ($self->{'convert_slashes'}) {
-
 
4140
          $cwd =~ s/\\/\//g;
-
 
4141
        }
-
 
4142
 
-
 
4143
        while(substr($value, $start) =~ /(\$\(([^)]+)\))/) {
-
 
4144
          my($whole)  = $1;
-
 
4145
          my($name)   = $2;
-
 
4146
          my($val)    = $$rel{$name};
-
 
4147
 
-
 
4148
          if (defined $val) {
-
 
4149
            if ($expand) {
-
 
4150
              if ($self->{'convert_slashes'}) {
-
 
4151
                $val = $self->slash_to_backslash($val);
-
 
4152
              }
-
 
4153
              substr($value, $start) =~ s/\$\([^)]+\)/$val/;
-
 
4154
              $whole = $val;
-
 
4155
            }
-
 
4156
            else {
-
 
4157
              ## Fix up the value for Windows switch the \\'s to /
-
 
4158
              if ($self->{'convert_slashes'}) {
-
 
4159
                $val =~ s/\\/\//g;
-
 
4160
              }
-
 
4161
 
-
 
4162
              ## Here we make an assumption that if we convert slashes to
-
 
4163
              ## back-slashes, we also have a case-insensitive file system.
-
 
4164
              my($icwd) = ($self->{'convert_slashes'} ? lc($cwd) : $cwd);
-
 
4165
              my($ival) = ($self->{'convert_slashes'} ? lc($val) : $val);
-
 
4166
              my($iclen) = length($icwd);
-
 
4167
              my($ivlen) = length($ival);
-
 
4168
 
-
 
4169
              ## If the relative value contains the current working
-
 
4170
              ## directory plus additional subdirectories, we must pull
-
 
4171
              ## off the additional directories into a temporary where
-
 
4172
              ## it can be put back after the relative replacement is done.
-
 
4173
              my($append) = undef;
-
 
4174
              if (index($ival, $icwd) == 0 && $iclen != $ivlen &&
-
 
4175
                  substr($ival, $iclen, 1) eq '/') {
-
 
4176
                my($diff) = $ivlen - $iclen;
-
 
4177
                $append = substr($ival, $iclen);
-
 
4178
                substr($ival, $iclen, $diff) = '';
-
 
4179
                $ivlen -= $diff;
-
 
4180
              }
-
 
4181
 
-
 
4182
              if (index($icwd, $ival) == 0 &&
-
 
4183
                  ($iclen == $ivlen || substr($icwd, $ivlen, 1) eq '/')) {
-
 
4184
                my($current) = $icwd;
-
 
4185
                substr($current, 0, $ivlen) = '';
-
 
4186
 
-
 
4187
                my($dircount) = ($current =~ tr/\///);
-
 
4188
                if ($dircount == 0) {
-
 
4189
                  $ival = '.';
-
 
4190
                }
-
 
4191
                else {
-
 
4192
                  $ival = '../' x $dircount;
-
 
4193
                  $ival =~ s/\/$//;
-
 
4194
                }
-
 
4195
                if (defined $append) {
-
 
4196
                  $ival .= $append;
-
 
4197
                }
-
 
4198
                if ($self->{'convert_slashes'}) {
-
 
4199
                  $ival = $self->slash_to_backslash($ival);
-
 
4200
                }
-
 
4201
                substr($value, $start) =~ s/\$\([^)]+\)/$ival/;
-
 
4202
                $whole = $ival;
-
 
4203
              }
-
 
4204
            }
-
 
4205
          }
-
 
4206
          elsif ($expand_template ||
-
 
4207
                 $self->expand_variables_from_template_values()) {
4286
        $value = $self->expand_variables($value, \@keys,
4208
            my($ti) = $self->get_template_input();
-
 
4209
            if (defined $ti) {
-
 
4210
              $val = $ti->get_value($name);
-
 
4211
            }
-
 
4212
            my($sname) = (defined $scope ? $scope . "::$name" : undef);
4287
                                         $self->{'expanded'},
4213
            my($arr) = $self->adjust_value([$sname, $name],
-
 
4214
                                           (defined $val ? $val : []));
4288
                                         $expand_template, $scope, 1);
4215
            if (defined $$arr[0]) {
-
 
4216
              $val = "@$arr";
-
 
4217
              if ($self->{'convert_slashes'}) {
-
 
4218
                $val = $self->slash_to_backslash($val);
-
 
4219
              }
4289
      }
4220
              substr($value, $start) =~ s/\$\([^)]+\)/$val/;
-
 
4221
 
4290
 
4222
              ## We have replaced the template value, but that template
4291
      if ($ovalue eq $value) {
4223
              ## value may contain a $() construct that may need to get
4292
        my($rel) = ($self->get_use_env() ? \%ENV : $self->get_relative());
4224
              ## replaced too.
-
 
4225
              $whole = '';
4293
        @keys = keys %$rel;
4226
            }
-
 
4227
            else {
4294
        if (defined $keys[0]) {
4228
              if ($expand) {
4295
          $value = $self->expand_variables($value, \@keys, $rel,
4229
                $self->warning("Unable to expand $name.");
4296
                                           $expand_template, $scope,
4230
              }
-
 
4231
            }
-
 
4232
          }
-
 
4233
          $start += length($whole);
4297
                                           $self->get_expand_vars(), 1);
4234
        }
4298
        }
4235
      }
4299
      }
4236
    }
4300
    }
4237
  }
4301
  }
4238
 
4302
 
-
 
4303
  ## Values that have strings enclosed in double quotes are to
-
 
4304
  ## be interpreted as elements of an array
-
 
4305
  if (defined $value && $value =~ /^"[^"]+"(\s+"[^"]+")+$/) {
-
 
4306
    $value = $self->create_array($value);
-
 
4307
  }
-
 
4308
 
4239
  return $value;
4309
  return $value;
4240
}
4310
}
4241
 
4311
 
4242
 
4312
 
4243
sub get_verbatim {
4313
sub get_verbatim {
Line 4401... Line 4471...
4401
  $self->process_assignment('exename',    undef);
4471
  $self->process_assignment('exename',    undef);
4402
  $self->process_assignment('sharedname', undef);
4472
  $self->process_assignment('sharedname', undef);
4403
  $self->process_assignment('staticname', undef);
4473
  $self->process_assignment('staticname', undef);
4404
}
4474
}
4405
 
4475
 
-
 
4476
 
-
 
4477
sub remove_wanted_extension {
-
 
4478
  my($self)  = shift;
-
 
4479
  my($name)  = shift;
-
 
4480
  my($array) = shift;
-
 
4481
  my($orig)  = $name;
-
 
4482
 
-
 
4483
  foreach my $wanted (@$array) {
-
 
4484
    if ($name =~ s/$wanted$//) {
-
 
4485
      last;
-
 
4486
    }
-
 
4487
  }
-
 
4488
 
-
 
4489
  ## If the user provided file does not match any of the
-
 
4490
  ## extensions specified by the custom definition, we need
-
 
4491
  ## to remove the extension or else this file will not be
-
 
4492
  ## added to the project.
-
 
4493
  if ($name eq $orig) {
-
 
4494
    $name =~ s/\.[^\.]+$//;
-
 
4495
  }
-
 
4496
 
-
 
4497
  return $name;
-
 
4498
}
-
 
4499
 
4406
# ************************************************************
4500
# ************************************************************
4407
# Virtual Methods To Be Overridden
4501
# Virtual Methods To Be Overridden
4408
# ************************************************************
4502
# ************************************************************
4409
 
4503
 
4410
sub escape_spaces {
4504
sub escape_spaces {