summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2003-12-12 14:56:51 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2003-12-12 14:56:51 +0000
commit70e6e0a270b8566af2e37aaff18123267855f2b8 (patch)
tree666d19ac58856a6cf4a25792b62af60b07c57f7a
parentd32bd9c242552a214f0515e140f61fcf9c24d9f4 (diff)
downloadATCD-70e6e0a270b8566af2e37aaff18123267855f2b8.tar.gz
ChangeLogTag: Fri Dec 12 08:53:50 2003 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog18
-rw-r--r--bin/DependencyGenerator/DependencyEditor.pm3
-rw-r--r--bin/DependencyGenerator/DependencyGenerator.pm17
-rw-r--r--bin/DependencyGenerator/DependencyWriter.pm3
-rw-r--r--bin/DependencyGenerator/GNUObjectGenerator.pm2
-rw-r--r--bin/DependencyGenerator/ObjectGenerator.pm3
-rw-r--r--bin/DependencyGenerator/Preprocessor.pm47
-rwxr-xr-xbin/depgen.pl16
8 files changed, 59 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog
index b0d609d7ab1..50a5a180073 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+Fri Dec 12 08:53:50 2003 Chad Elliott <elliott_c@ociweb.com>
+
+ * bin/DependencyGenerator/DependencyEditor.pm:
+ * bin/DependencyGenerator/DependencyWriter.pm:
+ * bin/DependencyGenerator/GNUObjectGenerator.pm:
+ * bin/DependencyGenerator/ObjectGenerator.pm:
+ * bin/DependencyGenerator/Preprocessor.pm:
+ * bin/depgen.pl:
+
+ More optimizations to decrease dependency generation times.
+
+ * bin/DependencyGenerator/DependencyGenerator.pm:
+
+ Fixed a bug where when replacing paths (using the -A option), it
+ wouldn't replace as much of the path as it could depending on the
+ replacement values. Now they are sorted by length so that the
+ longest values are checked first.
+
Fri Dec 12 08:37:45 2003 Chad Elliott <elliott_c@ociweb.com>
* bin/create_ace_build.pl:
diff --git a/bin/DependencyGenerator/DependencyEditor.pm b/bin/DependencyGenerator/DependencyEditor.pm
index 79dfcb1fed4..df0ee99bc72 100644
--- a/bin/DependencyGenerator/DependencyEditor.pm
+++ b/bin/DependencyGenerator/DependencyEditor.pm
@@ -22,9 +22,8 @@ use ObjectGeneratorFactory;
# ************************************************************
sub new {
- my($class) = shift;
return bless {
- }, $class;
+ }, $_[0];
}
diff --git a/bin/DependencyGenerator/DependencyGenerator.pm b/bin/DependencyGenerator/DependencyGenerator.pm
index 084bf68c31b..423d2c8b8da 100644
--- a/bin/DependencyGenerator/DependencyGenerator.pm
+++ b/bin/DependencyGenerator/DependencyGenerator.pm
@@ -37,6 +37,12 @@ sub new {
$self->{'cwd'} = Cwd::getcwd() . '/';
$self->{'cwd'} =~ s/([\+\-\\\$\[\]\(\)\.])/\\$1/g;
+ ## Sort the replace keys to get the longest key first. This way
+ ## when we are replacing portions of the file path, we replace the
+ ## most we can.
+ my(@repkeys) = sort { length($b) <=> length($a) } keys %$replace;
+ $self->{'repkeys'} = \@repkeys;
+
return $self;
}
@@ -46,7 +52,6 @@ sub process {
my($file) = shift;
my($objects) = shift;
my($replace) = $self->{'replace'};
- my(@repkeys) = keys %$replace;
my($cwd) = $self->{'cwd'};
my($files) = $self->{'pre'}->process($file, $self->{'noinline'});
@@ -55,16 +60,12 @@ sub process {
## If we can remove the current working directory fromm the file
## then we do not need to check the repkeys array and that cuts
## the processing time for the ace directory almost in half.
- if ($finc =~ /^$cwd/) {
- ## Remove the current working directory from the front of the
- ## file. This will help reduce the size of the dependency file.
- $finc =~ s/^$cwd//;
+ if ($finc =~ s/^$cwd//o) {
}
else {
## Modify those that have elements for replacement
- foreach my $rep (@repkeys) {
- if ($finc =~ /^$rep/) {
- $finc =~ s/^$rep/$$replace{$rep}/;
+ foreach my $rep (@{$self->{'repkeys'}}) {
+ if ($finc =~ s/^$rep/$$replace{$rep}/) {
last;
}
}
diff --git a/bin/DependencyGenerator/DependencyWriter.pm b/bin/DependencyGenerator/DependencyWriter.pm
index d5ff2929618..c0c8243004f 100644
--- a/bin/DependencyGenerator/DependencyWriter.pm
+++ b/bin/DependencyGenerator/DependencyWriter.pm
@@ -17,9 +17,8 @@ use strict;
# ************************************************************
sub new {
- my($class) = shift;
return bless {
- }, $class;
+ }, $_[0];
}
diff --git a/bin/DependencyGenerator/GNUObjectGenerator.pm b/bin/DependencyGenerator/GNUObjectGenerator.pm
index e12872482ed..2060d33479e 100644
--- a/bin/DependencyGenerator/GNUObjectGenerator.pm
+++ b/bin/DependencyGenerator/GNUObjectGenerator.pm
@@ -25,7 +25,7 @@ sub process {
my(@objects) = ();
my(@exts) = ('o');
my(@dirs) = (defined $ENV{VDIR} ? $ENV{VDIR} : '');
- $noext =~ s/\.[^\.]+$//;
+ $noext =~ s/\.[^\.]+$//o;
if (defined $ENV{SOEXT}) {
push(@exts, $ENV{SOEXT});
diff --git a/bin/DependencyGenerator/ObjectGenerator.pm b/bin/DependencyGenerator/ObjectGenerator.pm
index c185a0ccda5..64af1d5ffaf 100644
--- a/bin/DependencyGenerator/ObjectGenerator.pm
+++ b/bin/DependencyGenerator/ObjectGenerator.pm
@@ -17,9 +17,8 @@ use strict;
# ************************************************************
sub new {
- my($class) = shift;
return bless {
- }, $class;
+ }, $_[0];
}
diff --git a/bin/DependencyGenerator/Preprocessor.pm b/bin/DependencyGenerator/Preprocessor.pm
index 89067f7e344..2cd6941b8dc 100644
--- a/bin/DependencyGenerator/Preprocessor.pm
+++ b/bin/DependencyGenerator/Preprocessor.pm
@@ -34,7 +34,7 @@ sub locateFile {
my($self) = shift;
my($file) = shift;
- if (defined $self->{'ifound'}->{$file}) {
+ if (exists $self->{'ifound'}->{$file}) {
return $self->{'ifound'}->{$file};
}
else {
@@ -45,24 +45,9 @@ sub locateFile {
}
}
}
- return undef;
-}
-
-sub getFiles {
- my($self) = $_[0];
- my(@files) = ($_[1]);
- my(%ifiles) = ();
-
- for(my $i = 0; $i <= $#files; ++$i) {
- foreach my $inc (@{$self->{'files'}->{$files[$i]}}) {
- if (!defined $ifiles{$inc}) {
- $ifiles{$inc} = 1;
- push(@files, $inc);
- }
- }
- }
- $self->{'ifiles'} = \%ifiles;
+ $self->{'ifound'}->{$file} = undef;
+ return undef;
}
@@ -90,8 +75,8 @@ sub process {
## This saves about 5% off of processing the ace directory
## and we only need to strip comments if we are actually
## going to look at the string.
- $_ =~ s/\/\/.*//;
- $_ =~ s/\/\*.*\*\///;
+ $_ =~ s/\/\/.*//o;
+ $_ =~ s/\/\*.*\*\///o;
if (/#\s*endif/) {
--$ifcount;
@@ -107,12 +92,12 @@ sub process {
++$ifcount;
}
elsif (!defined $zero[0] &&
- /#\s*include\s+[<"]([^">]+)[">]/) {
+ /#\s*include\s+[<"]([^">]+)[">]/o) {
my($inc) = $self->locateFile($1);
if (defined $inc) {
- $inc =~ s/\\/\//g;
+ $inc =~ s/\\/\//go;
if (!$noinline ||
- ($recurse == 1 || $inc !~ /\.i(nl)?$/)) {
+ ($recurse == 1 || $inc !~ /\.i(nl)?$/o)) {
push(@{$$files{$file}}, $inc);
if (!defined $$files{$inc}) {
## Process this file, but do not return the include files
@@ -132,9 +117,19 @@ sub process {
## If the last file to be processed isn't accessable then
## we still need to return the array reference of includes.
if (!$noincs) {
- $self->getFiles($file);
- my(@incs) = keys %{$self->{'ifiles'}};
- return \@incs;
+ my(@files) = ($file);
+ my(%ifiles) = ();
+
+ for(my $i = 0; $i <= $#files; ++$i) {
+ foreach my $inc (@{$self->{'files'}->{$files[$i]}}) {
+ if (!defined $ifiles{$inc}) {
+ $ifiles{$inc} = 1;
+ push(@files, $inc);
+ }
+ }
+ }
+ shift(@files);
+ return \@files;
}
}
diff --git a/bin/depgen.pl b/bin/depgen.pl
index 3506ec10162..dc8d2dd5234 100755
--- a/bin/depgen.pl
+++ b/bin/depgen.pl
@@ -26,7 +26,7 @@ require DependencyEditor;
# Data Section
# ************************************************************
-my($version) = '0.7';
+my($version) = '0.8';
my($os) = ($^O eq 'MSWin32' || $^O eq 'cygwin' ? 'Windows' : 'UNIX');
my(%types) = ('gnu' => 1,
'nmake' => 1,
@@ -40,13 +40,12 @@ my(%defaults) = ('UNIX' => ['gnu'],
# ************************************************************
sub which {
- my($prog) = shift;
- my($exec) = $prog;
- my($part) = '';
- my($envSep) = ($^O eq 'MSWin32' ? ';' : ':');
+ my($prog) = shift;
+ my($exec) = $prog;
if (defined $ENV{'PATH'}) {
- foreach $part (split(/$envSep/, $ENV{'PATH'})) {
+ my($envSep) = ($^O eq 'MSWin32' ? ';' : ':');
+ foreach my $part (split(/$envSep/, $ENV{'PATH'})) {
$part .= "/$prog";
if ( -x $part ) {
$exec = $part;
@@ -225,6 +224,5 @@ if (!defined $files[0]) {
}
my($editor) = new DependencyEditor();
-my($status) = $editor->process($output, $type, $noinline,
- \%macros, \@ipaths, \%replace, \@files);
-exit($status);
+exit($editor->process($output, $type, $noinline,
+ \%macros, \@ipaths, \%replace, \@files));