summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2003-06-06 14:32:36 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2003-06-06 14:32:36 +0000
commit19923004638add27768ae76eb3037d62d267cfb2 (patch)
tree2f5a8834637417046835bbd831f84c018247c363
parent5d370d1a3f0a6b4600e966d560fe39ed78d7b03c (diff)
downloadATCD-19923004638add27768ae76eb3037d62d267cfb2.tar.gz
ChangeLogTag: Fri Jun 6 09:31:21 2003 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog11
-rw-r--r--bin/MakeProjectCreator/modules/ProjectCreator.pm48
-rw-r--r--bin/MakeProjectCreator/modules/TemplateParser.pm13
3 files changed, 47 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index ed9f77eea43..5c10afe18fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Fri Jun 6 09:31:21 2003 Chad Elliott <elliott_c@ociweb.com>
+
+ * bin/MakeProjectCreator/modules/ProjectCreator.pm:
+
+ Fixed a bug introduced by yesterdays optimization.
+ Added code to detect cyclic inheritance.
+
+ * bin/MakeProjectCreator/modules/TemplateParser.pm:
+
+ Added more optimizations.
+
Fri Jun 6 06:37:33 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl>
* bin/MakeProjectCreator/templates/gnu.mpd:
diff --git a/bin/MakeProjectCreator/modules/ProjectCreator.pm b/bin/MakeProjectCreator/modules/ProjectCreator.pm
index 4cdfc798c39..e3f9a5b1fbe 100644
--- a/bin/MakeProjectCreator/modules/ProjectCreator.pm
+++ b/bin/MakeProjectCreator/modules/ProjectCreator.pm
@@ -298,12 +298,23 @@ sub parse_line {
}
if (defined $file) {
- push(@{$self->{'reading_parent'}}, 1);
- $status = $self->parse_file($file);
- pop(@{$self->{'reading_parent'}});
+ foreach my $currently (@{$self->{'reading_parent'}}) {
+ if ($currently eq $file) {
+ $status = 0;
+ $errorString = 'ERROR: Cyclic inheritance detected: ' .
+ $parent;
+ }
+ }
+
+ if ($status) {
+ ## Begin reading the parent
+ push(@{$self->{'reading_parent'}}, $file);
+ $status = $self->parse_file($file);
+ pop(@{$self->{'reading_parent'}});
- if (!$status) {
- $errorString = "ERROR: Invalid parent: $parent";
+ if (!$status) {
+ $errorString = "ERROR: Invalid parent: $parent";
+ }
}
}
else {
@@ -993,8 +1004,8 @@ sub generate_default_pch_filenames {
if (!defined $self->get_assignment('pch_header')) {
my($count) = 0;
my($matching) = undef;
- foreach my $ext (@{$self->{'valid_components'}->{'header_files'}}) {
- foreach my $file (@$files) {
+ foreach my $file (@$files) {
+ foreach my $ext (@{$self->{'valid_components'}->{'header_files'}}) {
if ($file =~ /(.*_pch$ext)/) {
$self->process_assignment('pch_header', $1);
++$count;
@@ -1013,8 +1024,8 @@ sub generate_default_pch_filenames {
if (!defined $self->get_assignment('pch_source')) {
my($count) = 0;
my($matching) = undef;
- foreach my $ext (@{$self->{'valid_components'}->{'source_files'}}) {
- foreach my $file (@$files) {
+ foreach my $file (@$files) {
+ foreach my $ext (@{$self->{'valid_components'}->{'source_files'}}) {
if ($file =~ /(.*_pch$ext)/) {
$self->process_assignment('pch_source', $1);
++$count;
@@ -1262,6 +1273,10 @@ sub remove_duplicated_files {
my($source) = shift;
my($names) = $self->{$dest};
my(@slist) = $self->get_component_list($source);
+ my(%shash) = ();
+
+ ## Convert the array into keys for a hash table
+ @shash{@slist} = ();
## Find out which source files are listed
foreach my $name (keys %$names) {
@@ -1270,15 +1285,12 @@ sub remove_duplicated_files {
my($array) = $$comps{$key};
my($count) = scalar(@$array);
for(my $i = 0; $i < $count; ++$i) {
- foreach my $sfile (@slist) {
- ## Is the source file in the component array?
- if ($$array[$i] eq $sfile) {
- ## Remove the element and fix the index and count
- splice(@$array, $i, 1);
- --$count;
- --$i;
- last;
- }
+ ## Is the source file in the component array?
+ if (exists $shash{$$array[$i]}) {
+ ## Remove the element and fix the index and count
+ splice(@$array, $i, 1);
+ --$count;
+ --$i;
}
}
}
diff --git a/bin/MakeProjectCreator/modules/TemplateParser.pm b/bin/MakeProjectCreator/modules/TemplateParser.pm
index ab3d3ea2da3..046d103d348 100644
--- a/bin/MakeProjectCreator/modules/TemplateParser.pm
+++ b/bin/MakeProjectCreator/modules/TemplateParser.pm
@@ -51,6 +51,8 @@ sub new {
$self->{'prjc'} = $prjc;
$self->{'ti'} = $prjc->get_template_input();
$self->{'cslashes'} = $prjc->convert_slashes();
+ $self->{'relative'} = $prjc->get_relative();
+ $self->{'addtemp'} = $prjc->get_addtemp();
$self->{'crlf'} = undef;
$self->{'values'} = {};
$self->{'defaults'} = {};
@@ -146,7 +148,7 @@ sub adjust_value {
## Perform any additions, subtractions
## or overrides for the template values.
- my($addtemp) = $self->{'prjc'}->get_addtemp();
+ my($addtemp) = $self->{'addtemp'};
foreach my $at (keys %$addtemp) {
if ($at eq $name) {
my($val) = $$addtemp{$at};
@@ -216,7 +218,7 @@ sub set_current_values {
sub relative {
my($self) = shift;
my($value) = shift;
- my($rel) = $self->{'prjc'}->get_relative();
+ my($rel) = $self->{'relative'};
my(@keys) = keys %$rel;
if (defined $value && defined $keys[0]) {
@@ -252,13 +254,10 @@ sub relative {
}
}
- ## Fix up the value for Windows (capitalize the drive and
- ## switch the \\'s to /
+ ## Fix up the value for Windows switch the \\'s to /
$val =~ s/\\/\//g;
- if ($val =~ /[a-z]:\//) {
- substr($val, 0, 1) = uc(substr($val, 0, 1));
- }
+ ## Lowercase everything if we are running on Windows
my($icwd) = ($^O eq 'MSWin32' || $^O eq 'cygwin' ? lc($cwd) : $cwd);
my($ival) = ($^O eq 'MSWin32' || $^O eq 'cygwin' ? lc($val) : $val);
if (index($icwd, $ival) == 0) {