diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2005-01-17 14:01:54 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2005-01-17 14:01:54 +0000 |
commit | 73660911a5de8029b697e190a2b984fe0581a8d1 (patch) | |
tree | 278adfe5b915237a952fcbf8675bb405404cfd97 | |
parent | 60de646acc44857c790401e222fb2888a91bb87b (diff) | |
download | MPC-73660911a5de8029b697e190a2b984fe0581a8d1.tar.gz |
ChangeLogTag: Mon Jan 17 07:54:36 2005 Chad Elliott <elliott_c@ociweb.com>
36 files changed, 245 insertions, 130 deletions
@@ -1,3 +1,60 @@ +Mon Jan 17 07:54:36 2005 Chad Elliott <elliott_c@ociweb.com> + + * modules/Options.pm: + * modules/ProjectCreator.pm: + + Allow multiple modifications of the same template variable. Also, + fixed a bug where not having an inputext would cause generated + files not to be added. + + * modules/TemplateInputReader.pm: + + Allow redefintion of template input variables. + + * templates/automakedll.mpt: + * templates/automakeexe.mpt: + * templates/bmakedll.mpt: + * templates/bmakedllexe.mpt: + * templates/bmakelib.mpt: + * templates/bmakelibexe.mpt: + * templates/cbxdll.mpt: + * templates/cbxexe.mpt: + * templates/em3vcpdll.mpt: + * templates/em3vcpdllexe.mpt: + * templates/em3vcplib.mpt: + * templates/em3vcplibexe.mpt: + * templates/ghsdll.mpt: + * templates/ghsdllexe.mpt: + * templates/ghslib.mpt: + * templates/ghslibexe.mpt: + * templates/makedll.mpt: + * templates/makeexe.mpt: + * templates/nmakedll.mpt: + * templates/nmakeexe.mpt: + * templates/sledll.mpt: + * templates/sleexe.mpt: + * templates/vc6dspdll.mpt: + * templates/vc6dspdllexe.mpt: + * templates/vc6dsplib.mpt: + * templates/vc6dsplibexe.mpt: + * templates/vc7csharp.mpt: + * templates/vc7dll.mpt: + * templates/vc7exe.mpt: + * templates/vc7lib.mpt: + * templates/vc7libexe.mpt: + * templates/vc7vb.mpt: + + Added a conditional include to each mpt file in of the following + form: + + conditional_include "user_XXXXXX" + + where XXXXXX is the name of the current mpt file (without the + extension). This will allow a user to place custom configurations + in an mpt file that will automatically be included during project + generation, assuming that the file is located through the -include + specification. + Mon Jan 10 13:58:37 2005 Chad Elliott <elliott_c@ociweb.com> * modules/ProjectCreator.pm: diff --git a/modules/Options.pm b/modules/Options.pm index a3a2942c..c250c0d1 100644 --- a/modules/Options.pm +++ b/modules/Options.pm @@ -429,7 +429,10 @@ sub options { else { $op = 0; } - $addtemp{$name} = [$op, $val]; + if (!defined $addtemp{$name}) { + $addtemp{$name} = []; + } + push(@{$addtemp{$name}}, [$op, $val]); } else { $self->optionError('Invalid argument to -value_template'); diff --git a/modules/ProjectCreator.pm b/modules/ProjectCreator.pm index 070b5f83..af34db1f 100644 --- a/modules/ProjectCreator.pm +++ b/modules/ProjectCreator.pm @@ -795,32 +795,28 @@ sub handle_unknown_assignment { ## If $type is not defined, then we are skipping this section if (defined $type) { - ## If the template override has already been set, then - ## we will ignore this and keep the original value. - if (!defined $self->get_addtemp()->{$values[1]}) { - ## Save the addtemp state if we haven't done so before - if (!defined $self->{'addtemp_state'}) { - my(%state) = $self->save_state('addtemp'); - $self->{'addtemp_state'} = \%state; - } + ## Save the addtemp state if we haven't done so before + if (!defined $self->{'addtemp_state'}) { + my(%state) = $self->save_state('addtemp'); + $self->{'addtemp_state'} = \%state; + } - ## Now modify the addtemp values - $self->information("'$values[1]' was used as a template modifier."); - if ($values[0] eq 'assign_add') { - $values[0] = 1; - } - elsif ($values[0] eq 'assign_sub') { - $values[0] = -1; - } - else { - $values[0] = 0; - } - $self->get_addtemp()->{$values[1]} = [$values[0], $values[2]]; + ## Now modify the addtemp values + $self->information("'$values[1]' was used as a template modifier."); + if ($values[0] eq 'assign_add') { + $values[0] = 1; + } + elsif ($values[0] eq 'assign_sub') { + $values[0] = -1; } else { - $self->information("'$values[1]' was used as a template modifier. " . - "It has been set previously and will be ignored."); + $values[0] = 0; } + + if (!defined $self->get_addtemp()->{$values[1]}) { + $self->get_addtemp()->{$values[1]} = []; + } + push(@{$self->get_addtemp()->{$values[1]}}, [$values[0], $values[2]]); } return 1, undef; @@ -1779,86 +1775,89 @@ sub add_generated_files { ## input file (ex. input = car.y and first ext is .yy). The extension ## is immediately removed in generated_filename_arrays. $wanted =~ s/\\//g; + } + else { + $wanted = ''; + } - ## Get the generated filenames - my(@added) = (); - foreach my $file (@$arr) { - foreach my $gen ($self->generated_filenames($file, $gentype, $tag, - "$file$wanted", 1, 1)) { - $self->list_generated_file($gentype, $tag, \@added, $gen, $file); - } + ## Get the generated filenames + my(@added) = (); + foreach my $file (@$arr) { + foreach my $gen ($self->generated_filenames($file, $gentype, $tag, + "$file$wanted", 1, 1)) { + $self->list_generated_file($gentype, $tag, \@added, $gen, $file); } + } - if ($#added >= 0) { - my($names) = $self->{$tag}; + if ($#added >= 0) { + my($names) = $self->{$tag}; - ## Get all files in one list and save the directory - ## and component group in a hashed array. - my(@all) = (); - my(%dircomp) = (); - foreach my $name (keys %$names) { - foreach my $key (keys %{$$names{$name}}) { - push(@all, @{$$names{$name}->{$key}}); - foreach my $file (@{$$names{$name}->{$key}}) { - $dircomp{$self->mpc_dirname($file)} = $key; - } + ## Get all files in one list and save the directory + ## and component group in a hashed array. + my(@all) = (); + my(%dircomp) = (); + foreach my $name (keys %$names) { + foreach my $key (keys %{$$names{$name}}) { + push(@all, @{$$names{$name}->{$key}}); + foreach my $file (@{$$names{$name}->{$key}}) { + $dircomp{$self->mpc_dirname($file)} = $key; } } + } - ## Create a small array of only the files we want to add. - ## We put them all together so we can keep them in order when - ## we put them at the front of the main file list. - my(@oktoadd) = (); - foreach my $file (@added) { - if (!$self->already_added(\@all, $file)) { - push(@oktoadd, $file); - } + ## Create a small array of only the files we want to add. + ## We put them all together so we can keep them in order when + ## we put them at the front of the main file list. + my(@oktoadd) = (); + foreach my $file (@added) { + if (!$self->already_added(\@all, $file)) { + push(@oktoadd, $file); } + } - ## If we have files to add, make sure we add them to a group - ## that has the same directory location as the files we're adding. - if ($#oktoadd >= 0) { - my($key) = $dircomp{$self->mpc_dirname($oktoadd[0])}; - if (!defined $key) { - my($defel) = $self->get_default_element_name(); - my($check) = $oktoadd[0]; - foreach my $regext (@{$self->{'valid_components'}->{$tag}}) { - if ($check =~ s/\.inl$//) { - last; - } + ## If we have files to add, make sure we add them to a group + ## that has the same directory location as the files we're adding. + if ($#oktoadd >= 0) { + my($key) = $dircomp{$self->mpc_dirname($oktoadd[0])}; + if (!defined $key) { + my($defel) = $self->get_default_element_name(); + my($check) = $oktoadd[0]; + foreach my $regext (@{$self->{'valid_components'}->{$tag}}) { + if ($check =~ s/\.inl$//) { + last; } - foreach my $vc (keys %{$self->{'valid_components'}}) { - if ($vc ne $tag) { - foreach my $name (keys %{$self->{$vc}}) { - foreach my $ckey (keys %{$self->{$vc}->{$name}}) { - if ($ckey ne $defel) { - foreach my $ofile (@{$self->{$vc}->{$name}->{$ckey}}) { - my($file) = $ofile; - foreach my $regext (@{$self->{'valid_components'}->{$vc}}) { - if ($file =~ s/$regext//) { - last; - } - } - if ($file eq $check) { - $key = $ckey; + } + foreach my $vc (keys %{$self->{'valid_components'}}) { + if ($vc ne $tag) { + foreach my $name (keys %{$self->{$vc}}) { + foreach my $ckey (keys %{$self->{$vc}->{$name}}) { + if ($ckey ne $defel) { + foreach my $ofile (@{$self->{$vc}->{$name}->{$ckey}}) { + my($file) = $ofile; + foreach my $regext (@{$self->{'valid_components'}->{$vc}}) { + if ($file =~ s/$regext//) { last; } } + if ($file eq $check) { + $key = $ckey; + last; + } } - last if (defined $key); } + last if (defined $key); } - last if (defined $key); } - } - if (!defined $key) { - $key = $defel; + last if (defined $key); } } - foreach my $name (keys %$names) { - unshift(@{$$names{$name}->{$key}}, @oktoadd); + if (!defined $key) { + $key = $defel; } } + foreach my $name (keys %$names) { + unshift(@{$$names{$name}->{$key}}, @oktoadd); + } } } } @@ -2391,6 +2390,15 @@ sub list_default_generated { last; } } + + ## If the user provided file does not match any of the + ## extensions specified by the custom definition, we need + ## to remove the extension or else this file will not be + ## added to the project. + if ($f eq $val) { + $f =~ s/\.[^\.]+$//; + } + push(@arr, $f); } } @@ -2469,6 +2477,14 @@ sub list_generated_file { } } + ## If the user provided file does not match any of the + ## extensions specified by the custom definition, we need + ## to remove the extension or else this file will not be + ## added to the project. + if ($gen eq $input) { + $gen =~ s/\.[^\.]+$//; + } + ## See if we need to add the file foreach my $re ($self->generated_filenames($gen, $gentype, $tag, $input, 1)) { if ($re =~ /$file(.*)?$/) { @@ -3642,46 +3658,48 @@ sub adjust_value { ## Perform any additions, subtractions ## or overrides for the template values. if (defined $self->get_addtemp()->{lc($name)}) { - my($val) = $self->get_addtemp()->{lc($name)}; - my($arr) = $self->create_array($$val[1]); - if ($$val[0] > 0) { - if (UNIVERSAL::isa($value, 'ARRAY')) { - ## We need to make $value a new array reference ($arr) - ## to avoid modifying the array reference pointed to by $value - unshift(@$arr, @$value); - $value = $arr; - } - else { - $value .= " $$val[1]"; - } - } - elsif ($$val[0] < 0) { - my($parts) = undef; - if (UNIVERSAL::isa($value, 'ARRAY')) { - $parts = $value; - } - else { - $parts = $self->create_array($value); + my($addtemparr) = $self->get_addtemp()->{lc($name)}; + foreach my $val (@$addtemparr) { + my($arr) = $self->create_array($$val[1]); + if ($$val[0] > 0) { + if (UNIVERSAL::isa($value, 'ARRAY')) { + ## We need to make $value a new array reference ($arr) + ## to avoid modifying the array reference pointed to by $value + unshift(@$arr, @$value); + $value = $arr; + } + else { + $value .= " $$val[1]"; + } } + elsif ($$val[0] < 0) { + my($parts) = undef; + if (UNIVERSAL::isa($value, 'ARRAY')) { + $parts = $value; + } + else { + $parts = $self->create_array($value); + } - $value = []; - foreach my $part (@$parts) { - if ($part ne '') { - my($found) = 0; - foreach my $ae (@$arr) { - if ($part eq $ae) { - $found = 1; - last; + $value = []; + foreach my $part (@$parts) { + if ($part ne '') { + my($found) = 0; + foreach my $ae (@$arr) { + if ($part eq $ae) { + $found = 1; + last; + } + } + if (!$found) { + push(@$value, $part); } - } - if (!$found) { - push(@$value, $part); } } } - } - else { - $value = $arr; + else { + $value = $arr; + } } } diff --git a/modules/TemplateInputReader.pm b/modules/TemplateInputReader.pm index c4fbd9f1..074f06e1 100644 --- a/modules/TemplateInputReader.pm +++ b/modules/TemplateInputReader.pm @@ -91,13 +91,7 @@ sub parse_line { } } else { - if (!$$current[$self->{'cindex'}]->{$name}) { - $$current[$self->{'cindex'}]->{$name} = $value; - } - else { - $status = 0; - $errorString = "Redifinition of '$name'"; - } + $$current[$self->{'cindex'}]->{$name} = $value; } } elsif ($line =~ /^conditional_include\s+"([\w\s\-\+\/\\\.]+)"$/) { diff --git a/templates/automakedll.mpt b/templates/automakedll.mpt index 29dd5ce4..817901e7 100644 --- a/templates/automakedll.mpt +++ b/templates/automakedll.mpt @@ -5,3 +5,5 @@ conditional_include "common" linkflags = includedir = + +conditional_include "user_automakedll" diff --git a/templates/automakeexe.mpt b/templates/automakeexe.mpt index 0978dac9..b053d04c 100644 --- a/templates/automakeexe.mpt +++ b/templates/automakeexe.mpt @@ -2,3 +2,4 @@ // $Id$ conditional_include "automakedll" +conditional_include "user_automakeexe" diff --git a/templates/bmakedll.mpt b/templates/bmakedll.mpt index b92abb7a..2efef913 100644 --- a/templates/bmakedll.mpt +++ b/templates/bmakedll.mpt @@ -20,3 +20,5 @@ Debug { lib_modifier = d postlinkrmext = .tds } + +conditional_include "user_bmakedll" diff --git a/templates/bmakedllexe.mpt b/templates/bmakedllexe.mpt index d102b556..c5f4495e 100644 --- a/templates/bmakedllexe.mpt +++ b/templates/bmakedllexe.mpt @@ -23,3 +23,5 @@ Debug { lib_modifier = d postlinkrmext = .tds } + +conditional_include "user_bmakedllexe" diff --git a/templates/bmakelib.mpt b/templates/bmakelib.mpt index 467661a1..1c1b57d9 100644 --- a/templates/bmakelib.mpt +++ b/templates/bmakelib.mpt @@ -18,3 +18,5 @@ Debug { intermediate_dir = Static_Debug lib_modifier = sd } + +conditional_include "user_bmakelib" diff --git a/templates/bmakelibexe.mpt b/templates/bmakelibexe.mpt index bfb9de80..ca5bc6ac 100644 --- a/templates/bmakelibexe.mpt +++ b/templates/bmakelibexe.mpt @@ -26,3 +26,4 @@ Debug { postlinkrmext = .tds } +conditional_include "user_bmakelibexe" diff --git a/templates/cbxdll.mpt b/templates/cbxdll.mpt index c6ff3fc9..92707c90 100644 --- a/templates/cbxdll.mpt +++ b/templates/cbxdll.mpt @@ -6,3 +6,5 @@ conditional_include "common" type_is_binary = 1 type_is_dynamic = 1 common_defines = WIN32 + +conditional_include "user_cbxdll" diff --git a/templates/cbxexe.mpt b/templates/cbxexe.mpt index da49b919..c8c04934 100644 --- a/templates/cbxexe.mpt +++ b/templates/cbxexe.mpt @@ -5,3 +5,5 @@ conditional_include "common" type_is_binary = 1 common_defines = WIN32 + +conditional_include "user_cbxexe" diff --git a/templates/em3vcpdll.mpt b/templates/em3vcpdll.mpt index cf7484c3..c2979bff 100644 --- a/templates/em3vcpdll.mpt +++ b/templates/em3vcpdll.mpt @@ -94,3 +94,4 @@ MFC Debug { } conditional_include "vcpartialmacros" +conditional_include "user_em3vcpdll" diff --git a/templates/em3vcpdllexe.mpt b/templates/em3vcpdllexe.mpt index d4620ad3..9784c175 100644 --- a/templates/em3vcpdllexe.mpt +++ b/templates/em3vcpdllexe.mpt @@ -95,3 +95,4 @@ MFC Debug { } conditional_include "vcpartialmacros" +conditional_include "user_em3vcpdllexe" diff --git a/templates/em3vcplib.mpt b/templates/em3vcplib.mpt index 1153b659..e282d823 100644 --- a/templates/em3vcplib.mpt +++ b/templates/em3vcplib.mpt @@ -97,4 +97,5 @@ MFC Debug { } conditional_include "vcpartialmacros" +conditional_include "user_em3vcplib" diff --git a/templates/em3vcplibexe.mpt b/templates/em3vcplibexe.mpt index decd6c3c..c810902e 100644 --- a/templates/em3vcplibexe.mpt +++ b/templates/em3vcplibexe.mpt @@ -97,4 +97,5 @@ MFC Debug { } conditional_include "vcpartialmacros" +conditional_include "user_em3vcplibexe" diff --git a/templates/ghsdll.mpt b/templates/ghsdll.mpt index 25eb6070..0d31fc04 100644 --- a/templates/ghsdll.mpt +++ b/templates/ghsdll.mpt @@ -5,3 +5,5 @@ conditional_include "ghscommon" need_dynamicflags = 1 libext = so + +conditional_include "user_ghsdll" diff --git a/templates/ghsdllexe.mpt b/templates/ghsdllexe.mpt index 050c257d..1993b4cd 100644 --- a/templates/ghsdllexe.mpt +++ b/templates/ghsdllexe.mpt @@ -2,4 +2,4 @@ // $Id$ conditional_include "ghscommon" - +conditional_include "user_ghsdllexe" diff --git a/templates/ghslib.mpt b/templates/ghslib.mpt index 69f79a4b..eb06f1c9 100644 --- a/templates/ghslib.mpt +++ b/templates/ghslib.mpt @@ -5,3 +5,5 @@ conditional_include "ghscommon" libext = a need_staticflags = 1 + +conditional_include "user_ghslib" diff --git a/templates/ghslibexe.mpt b/templates/ghslibexe.mpt index abaab27f..bc8fbe6f 100644 --- a/templates/ghslibexe.mpt +++ b/templates/ghslibexe.mpt @@ -4,3 +4,5 @@ conditional_include "ghscommon" need_staticflags = 1 + +conditional_include "user_ghslibexe" diff --git a/templates/makedll.mpt b/templates/makedll.mpt index e7c26af9..e1115c57 100644 --- a/templates/makedll.mpt +++ b/templates/makedll.mpt @@ -93,7 +93,7 @@ SGICC { clean = ii_files platforms = irix pchcreate = -LANG:create_pch= - pchuse = -LANG:use_pch= + pchuse = -diag_suppress 3056 -LANG:use_pch= } wrsppc { @@ -228,3 +228,4 @@ tandem { extracppflags = -D_REENTRANT } +conditional_include "user_makedll" diff --git a/templates/makeexe.mpt b/templates/makeexe.mpt index 60a9cf7e..dfe00e2e 100644 --- a/templates/makeexe.mpt +++ b/templates/makeexe.mpt @@ -2,4 +2,4 @@ // $Id$ conditional_include "makedll" - +conditional_include "user_makeexe" diff --git a/templates/nmakedll.mpt b/templates/nmakedll.mpt index a9eef310..402aa69a 100644 --- a/templates/nmakedll.mpt +++ b/templates/nmakedll.mpt @@ -144,3 +144,4 @@ Static MFC Debug { } conditional_include "vcfullmacros" +conditional_include "user_nmakedll" diff --git a/templates/nmakeexe.mpt b/templates/nmakeexe.mpt index 0cb7f501..7ee701df 100644 --- a/templates/nmakeexe.mpt +++ b/templates/nmakeexe.mpt @@ -126,3 +126,4 @@ Static MFC Debug { } conditional_include "vcfullmacros" +conditional_include "user_nmakeexe" diff --git a/templates/sledll.mpt b/templates/sledll.mpt index fd79ef51..b3e1be0d 100644 --- a/templates/sledll.mpt +++ b/templates/sledll.mpt @@ -5,3 +5,5 @@ conditional_include "common" type_is_binary = 1 type_is_dynamic = 1 + +conditional_include "user_sledll" diff --git a/templates/sleexe.mpt b/templates/sleexe.mpt index 3ba1b4e3..374d6bc8 100644 --- a/templates/sleexe.mpt +++ b/templates/sleexe.mpt @@ -4,3 +4,5 @@ conditional_include "common" type_is_binary = 1 + +conditional_include "user_sleexe" diff --git a/templates/vc6dspdll.mpt b/templates/vc6dspdll.mpt index 58074bf6..cbeafd00 100644 --- a/templates/vc6dspdll.mpt +++ b/templates/vc6dspdll.mpt @@ -57,3 +57,4 @@ MFC Debug { } conditional_include "vcpartialmacros" +conditional_include "user_vc6dspdll" diff --git a/templates/vc6dspdllexe.mpt b/templates/vc6dspdllexe.mpt index d6e8fb56..1cbf09e2 100644 --- a/templates/vc6dspdllexe.mpt +++ b/templates/vc6dspdllexe.mpt @@ -65,3 +65,4 @@ MFC Debug { } conditional_include "vcpartialmacros" +conditional_include "user_vc6dspdllexe" diff --git a/templates/vc6dsplib.mpt b/templates/vc6dsplib.mpt index b5b5d22f..6fd11e2f 100644 --- a/templates/vc6dsplib.mpt +++ b/templates/vc6dsplib.mpt @@ -63,3 +63,4 @@ MFC Debug { } conditional_include "vcpartialmacros" +conditional_include "user_vc6dsplib" diff --git a/templates/vc6dsplibexe.mpt b/templates/vc6dsplibexe.mpt index a1422cd7..e5e9d403 100644 --- a/templates/vc6dsplibexe.mpt +++ b/templates/vc6dsplibexe.mpt @@ -68,3 +68,4 @@ MFC Debug { } conditional_include "vcpartialmacros" +conditional_include "user_vc6dsplibexe" diff --git a/templates/vc7csharp.mpt b/templates/vc7csharp.mpt index 1162f9da..7bfd4f68 100644 --- a/templates/vc7csharp.mpt +++ b/templates/vc7csharp.mpt @@ -17,3 +17,5 @@ Debug { defines = DESIGN DEBUG output_dir = Debug } + +conditional_include "user_vc7csharp" diff --git a/templates/vc7dll.mpt b/templates/vc7dll.mpt index 44178c54..afe324e5 100644 --- a/templates/vc7dll.mpt +++ b/templates/vc7dll.mpt @@ -49,4 +49,5 @@ MFC Debug { use_mfc = 2 } -conditional_include "vcfullmacros" +conditional_include "vcpartialmacros" +conditional_include "user_vc7dll" diff --git a/templates/vc7exe.mpt b/templates/vc7exe.mpt index e8ad197e..93cb9d61 100644 --- a/templates/vc7exe.mpt +++ b/templates/vc7exe.mpt @@ -50,4 +50,5 @@ MFC Debug { use_mfc = 2 } -conditional_include "vcfullmacros" +conditional_include "vcpartialmacros" +conditional_include "user_vc7exe" diff --git a/templates/vc7lib.mpt b/templates/vc7lib.mpt index cec24fa5..00052f7a 100644 --- a/templates/vc7lib.mpt +++ b/templates/vc7lib.mpt @@ -50,4 +50,5 @@ MFC Debug { use_mfc = 2 } -conditional_include "vcfullmacros" +conditional_include "vcpartialmacros" +conditional_include "user_vc7lib" diff --git a/templates/vc7libexe.mpt b/templates/vc7libexe.mpt index 188a6049..9f2102c9 100644 --- a/templates/vc7libexe.mpt +++ b/templates/vc7libexe.mpt @@ -53,4 +53,5 @@ MFC Debug { use_mfc = 2 } -conditional_include "vcfullmacros" +conditional_include "vcpartialmacros" +conditional_include "user_vc7libexe" diff --git a/templates/vc7vb.mpt b/templates/vc7vb.mpt index 25f11324..06f80e23 100644 --- a/templates/vc7vb.mpt +++ b/templates/vc7vb.mpt @@ -15,3 +15,5 @@ Debug { optimize = output_dir = Debug } + +conditional_include "user_vc7vb" |