summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2003-12-09 19:03:26 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2003-12-09 19:03:26 +0000
commit7ddf40b538fbcc90a6a50974c92800d031b857a8 (patch)
tree1a82dbc9ca3cef6f2292bfb36e3350434e788aba
parent73bb184abc978f6d7f16006312340fb1bb96e02e (diff)
downloadATCD-7ddf40b538fbcc90a6a50974c92800d031b857a8.tar.gz
ChangeLogTag: Tue Dec 9 13:00:30 2003 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog22
-rw-r--r--bin/DependencyGenerator/DependencyEditor.pm29
-rw-r--r--bin/DependencyGenerator/DependencyGenerator.pm17
-rw-r--r--bin/DependencyGenerator/DependencyWriter.pm11
-rw-r--r--bin/DependencyGenerator/DependencyWriterFactory.pm8
-rw-r--r--bin/DependencyGenerator/GNUDependencyWriter.pm5
-rw-r--r--bin/DependencyGenerator/GNUObjectGenerator.pm4
-rw-r--r--bin/DependencyGenerator/NMakeDependencyWriter.pm5
-rw-r--r--bin/DependencyGenerator/NMakeObjectGenerator.pm4
-rw-r--r--bin/DependencyGenerator/ObjectGenerator.pm9
-rw-r--r--bin/DependencyGenerator/ObjectGeneratorFactory.pm8
-rw-r--r--bin/DependencyGenerator/Preprocessor.pm65
-rwxr-xr-xbin/depgen.pl8
13 files changed, 97 insertions, 98 deletions
diff --git a/ChangeLog b/ChangeLog
index a55bde87170..bafee77ab5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,25 @@
+Tue Dec 9 13:00:30 2003 Chad Elliott <elliott_c@ociweb.com>
+
+ * bin/DependencyGenerator/DependencyEditor.pm:
+ * bin/DependencyGenerator/DependencyGenerator.pm:
+ * bin/DependencyGenerator/DependencyWriter.pm:
+ * bin/DependencyGenerator/DependencyWriterFactory.pm:
+ * bin/DependencyGenerator/GNUDependencyWriter.pm:
+ * bin/DependencyGenerator/GNUObjectGenerator.pm:
+ * bin/DependencyGenerator/NMakeDependencyWriter.pm:
+ * bin/DependencyGenerator/NMakeObjectGenerator.pm:
+ * bin/DependencyGenerator/ObjectGenerator.pm:
+ * bin/DependencyGenerator/ObjectGeneratorFactory.pm:
+ * bin/DependencyGenerator/Preprocessor.pm:
+ * bin/depgen.pl:
+
+ Performance optimizations that decrease dependency generation
+ times by up to 10%.
+
Tue Dec 9 17:49:12 UTC 2003 Don Hinton <dhinton@dresystems.com>
- * ACEXML/apps/svcconf/Svcconf_Handler.cpp:
- Added #include of ace/OS_NS_strings.h to get ACE_OS::strcasecmp
+ * ACEXML/apps/svcconf/Svcconf_Handler.cpp:
+ Added #include of ace/OS_NS_strings.h to get ACE_OS::strcasecmp
Tue Dec 9 16:33:43 UTC 2003 Don Hinton <dhinton@dresystems.com>
diff --git a/bin/DependencyGenerator/DependencyEditor.pm b/bin/DependencyGenerator/DependencyEditor.pm
index 6147b96373f..79dfcb1fed4 100644
--- a/bin/DependencyGenerator/DependencyEditor.pm
+++ b/bin/DependencyGenerator/DependencyEditor.pm
@@ -23,9 +23,8 @@ use ObjectGeneratorFactory;
sub new {
my($class) = shift;
- my($self) = bless {
- }, $class;
- return $self;
+ return bless {
+ }, $class;
}
@@ -38,13 +37,12 @@ sub process {
my($ipaths) = shift;
my($replace) = shift;
my($files) = shift;
- my($status) = 0;
- my(@options) = ();
## Back up the original file and receive the contents
- my(@contents) = ();
+ my($contents) = undef;
if (-s $output) {
- if (!$self->backup($output, \@contents)) {
+ $contents = [];
+ if (!$self->backup($output, $contents)) {
print STDERR "ERROR: Unable to backup $output\n";
return 1;
}
@@ -53,17 +51,19 @@ sub process {
## Write out the new file
my($fh) = new FileHandle();
if (open($fh, ">$output")) {
- foreach my $line (@contents) {
- if ($line =~ /DO NOT DELETE/) {
- last;
+ if (defined $contents) {
+ foreach my $line (@$contents) {
+ if ($line =~ /DO NOT DELETE/) {
+ last;
+ }
+ print $fh $line;
}
- print $fh $line;
}
print $fh "# DO NOT DELETE THIS LINE -- " . basename($0) . " uses it.\n" .
"# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.\n\n";
- my($dep) = new DependencyGenerator($macros, \@options, $ipaths,
+ my($dep) = new DependencyGenerator($macros, $ipaths,
$replace, $type, $noinline);
my($objgen) = ObjectGeneratorFactory::create($type);
## Sort the files so the dependencies are reproducible
@@ -77,9 +77,10 @@ sub process {
}
else {
print STDERR "ERROR: Unable to open $output for output\n";
- $status++;
+ return 1;
}
- return $status;
+
+ return 0;
}
diff --git a/bin/DependencyGenerator/DependencyGenerator.pm b/bin/DependencyGenerator/DependencyGenerator.pm
index 3c1299d2bff..084bf68c31b 100644
--- a/bin/DependencyGenerator/DependencyGenerator.pm
+++ b/bin/DependencyGenerator/DependencyGenerator.pm
@@ -22,36 +22,25 @@ use DependencyWriterFactory;
sub new {
my($class) = shift;
my($macros) = shift;
- my($options) = shift;
my($ipaths) = shift;
my($replace) = shift;
my($type) = shift;
my($noinline) = shift;
- my($self) = bless {'pre' => new Preprocessor($macros,
- $options, $ipaths),
+ my($self) = bless {'pre' => new Preprocessor($macros, $ipaths),
'replace' => $replace,
'dwrite' => DependencyWriterFactory::create($type),
'noinline' => $noinline,
- 'cwd' => undef,
}, $class;
## Set the current working directory, but
## escape regular expression special characters
- $self->{'cwd'} = $self->escape_regex_special(Cwd::getcwd()) . '/';
+ $self->{'cwd'} = Cwd::getcwd() . '/';
+ $self->{'cwd'} =~ s/([\+\-\\\$\[\]\(\)\.])/\\$1/g;
return $self;
}
-sub escape_regex_special {
- my($self) = shift;
- my($name) = shift;
-
- $name =~ s/([\+\-\\\$\[\]\(\)\.])/\\$1/g;
- return $name;
-}
-
-
sub process {
my($self) = shift;
my($file) = shift;
diff --git a/bin/DependencyGenerator/DependencyWriter.pm b/bin/DependencyGenerator/DependencyWriter.pm
index df3dded0451..d5ff2929618 100644
--- a/bin/DependencyGenerator/DependencyWriter.pm
+++ b/bin/DependencyGenerator/DependencyWriter.pm
@@ -18,16 +18,15 @@ use strict;
sub new {
my($class) = shift;
- my($self) = bless {
- }, $class;
- return $self;
+ return bless {
+ }, $class;
}
sub process {
- my($self) = shift;
- my($objects) = shift;
- my($files) = shift;
+ #my($self) = shift;
+ #my($objects) = shift;
+ #my($files) = shift;
return '';
}
diff --git a/bin/DependencyGenerator/DependencyWriterFactory.pm b/bin/DependencyGenerator/DependencyWriterFactory.pm
index b95d1a1d81a..d791dc3fc42 100644
--- a/bin/DependencyGenerator/DependencyWriterFactory.pm
+++ b/bin/DependencyGenerator/DependencyWriterFactory.pm
@@ -20,12 +20,10 @@ use NMakeDependencyWriter;
# ************************************************************
sub create {
- my($type) = shift;
-
switch: {
- $type eq 'gnu' && do { return new GNUDependencyWriter(); };
- $type eq 'nmake' && do { return new NMakeDependencyWriter(); };
- print STDERR "WARNING: Invalid dependency writer type: $type\n";
+ $_[0] eq 'gnu' && do { return new GNUDependencyWriter(); };
+ $_[0] eq 'nmake' && do { return new NMakeDependencyWriter(); };
+ print STDERR "WARNING: Invalid dependency writer type: $_[0]\n";
}
return new DependencyWriter();
diff --git a/bin/DependencyGenerator/GNUDependencyWriter.pm b/bin/DependencyGenerator/GNUDependencyWriter.pm
index 894f019f2e4..bf10ead7da4 100644
--- a/bin/DependencyGenerator/GNUDependencyWriter.pm
+++ b/bin/DependencyGenerator/GNUDependencyWriter.pm
@@ -21,9 +21,8 @@ use vars qw(@ISA);
# ************************************************************
sub process {
- my($self) = shift;
- my($objects) = shift;
- my($files) = shift;
+ my($objects) = $_[1];
+ my($files) = $_[2];
my($dep) = "@$objects: \\\n";
## Sort the dependencies to make them reproducible
diff --git a/bin/DependencyGenerator/GNUObjectGenerator.pm b/bin/DependencyGenerator/GNUObjectGenerator.pm
index 8276c5a7098..e12872482ed 100644
--- a/bin/DependencyGenerator/GNUObjectGenerator.pm
+++ b/bin/DependencyGenerator/GNUObjectGenerator.pm
@@ -21,12 +21,10 @@ use vars qw(@ISA);
# ************************************************************
sub process {
- my($self) = shift;
- my($file) = shift;
+ my($noext) = $_[1];
my(@objects) = ();
my(@exts) = ('o');
my(@dirs) = (defined $ENV{VDIR} ? $ENV{VDIR} : '');
- my($noext) = $file;
$noext =~ s/\.[^\.]+$//;
if (defined $ENV{SOEXT}) {
diff --git a/bin/DependencyGenerator/NMakeDependencyWriter.pm b/bin/DependencyGenerator/NMakeDependencyWriter.pm
index bd0d781819c..903406562ac 100644
--- a/bin/DependencyGenerator/NMakeDependencyWriter.pm
+++ b/bin/DependencyGenerator/NMakeDependencyWriter.pm
@@ -21,9 +21,8 @@ use vars qw(@ISA);
# ************************************************************
sub process {
- my($self) = shift;
- my($sources) = shift;
- my($files) = shift;
+ my($sources) = $_[1];
+ my($files) = $_[2];
my($total) = 0;
$$sources[0] =~ s/\//\\/g;
diff --git a/bin/DependencyGenerator/NMakeObjectGenerator.pm b/bin/DependencyGenerator/NMakeObjectGenerator.pm
index 9a66f9a5f09..6d81f1447b0 100644
--- a/bin/DependencyGenerator/NMakeObjectGenerator.pm
+++ b/bin/DependencyGenerator/NMakeObjectGenerator.pm
@@ -21,9 +21,7 @@ use vars qw(@ISA);
# ************************************************************
sub process {
- my($self) = shift;
- my($file) = shift;
- return $file;
+ return $_[1];
}
diff --git a/bin/DependencyGenerator/ObjectGenerator.pm b/bin/DependencyGenerator/ObjectGenerator.pm
index a1b65f76ad7..c185a0ccda5 100644
--- a/bin/DependencyGenerator/ObjectGenerator.pm
+++ b/bin/DependencyGenerator/ObjectGenerator.pm
@@ -18,15 +18,14 @@ use strict;
sub new {
my($class) = shift;
- my($self) = bless {
- }, $class;
- return $self;
+ return bless {
+ }, $class;
}
sub process {
- my($self) = shift;
- my($file) = shift;
+ #my($self) = shift;
+ #my($file) = shift;
return ();
}
diff --git a/bin/DependencyGenerator/ObjectGeneratorFactory.pm b/bin/DependencyGenerator/ObjectGeneratorFactory.pm
index 2dd7d175130..2b4072010e7 100644
--- a/bin/DependencyGenerator/ObjectGeneratorFactory.pm
+++ b/bin/DependencyGenerator/ObjectGeneratorFactory.pm
@@ -20,12 +20,10 @@ use NMakeObjectGenerator;
# ************************************************************
sub create {
- my($type) = shift;
-
switch: {
- $type eq 'gnu' && do { return new GNUObjectGenerator(); };
- $type eq 'nmake' && do { return new NMakeObjectGenerator(); };
- print STDERR "WARNING: Invalid object generator type: $type\n";
+ $_[0] eq 'gnu' && do { return new GNUObjectGenerator(); };
+ $_[0] eq 'nmake' && do { return new NMakeObjectGenerator(); };
+ print STDERR "WARNING: Invalid object generator type: $_[0]\n";
}
return new ObjectGenerator();
diff --git a/bin/DependencyGenerator/Preprocessor.pm b/bin/DependencyGenerator/Preprocessor.pm
index a2be91b8ff2..89067f7e344 100644
--- a/bin/DependencyGenerator/Preprocessor.pm
+++ b/bin/DependencyGenerator/Preprocessor.pm
@@ -20,15 +20,13 @@ use FileHandle;
sub new {
my($class) = shift;
my($macros) = shift;
- my($options) = shift;
my($ipaths) = shift;
- my($self) = bless {'macros' => $macros,
- 'options' => $options,
- 'ipaths' => $ipaths,
- 'files' => {},
- 'recurse' => 0,
- }, $class;
- return $self;
+ return bless {'macros' => $macros,
+ 'ipaths' => $ipaths,
+ 'files' => {},
+ 'ifound' => {},
+ 'recurse' => 0,
+ }, $class;
}
@@ -36,27 +34,35 @@ sub locateFile {
my($self) = shift;
my($file) = shift;
- foreach my $dir ('.', @{$self->{'ipaths'}}) {
- if (-r "$dir/$file") {
- return "$dir/$file";
+ if (defined $self->{'ifound'}->{$file}) {
+ return $self->{'ifound'}->{$file};
+ }
+ else {
+ foreach my $dir ('.', @{$self->{'ipaths'}}) {
+ if (-r "$dir/$file") {
+ $self->{'ifound'}->{$file} = "$dir/$file";
+ return $self->{'ifound'}->{$file};
+ }
}
}
-
return undef;
}
sub getFiles {
- my($self) = shift;
- my($file) = shift;
- my($ifiles) = $self->{'ifiles'};
-
- foreach my $inc (@{$self->{'files'}->{$file}}) {
- if (!defined $$ifiles{$inc}) {
- $$ifiles{$inc} = 1;
- $self->getFiles($inc);
+ 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;
}
@@ -87,22 +93,22 @@ sub process {
$_ =~ s/\/\/.*//;
$_ =~ s/\/\*.*\*\///;
- if (/#\s*if\s+0/) {
+ if (/#\s*endif/) {
+ --$ifcount;
+ if (defined $zero[0] && $ifcount == $zero[$#zero]) {
+ pop(@zero);
+ }
+ }
+ elsif (/#\s*if\s+0/) {
push(@zero, $ifcount);
++$ifcount;
}
elsif (/#\s*if/) {
++$ifcount;
}
- elsif (/#\s*endif/) {
- --$ifcount;
- if (defined $zero[0] && $ifcount == $zero[$#zero]) {
- pop(@zero);
- }
- }
elsif (!defined $zero[0] &&
- /#\s*include\s+(\/\*\*\/\s*)?[<"]([^">]+)[">]/) {
- my($inc) = $self->locateFile($2);
+ /#\s*include\s+[<"]([^">]+)[">]/) {
+ my($inc) = $self->locateFile($1);
if (defined $inc) {
$inc =~ s/\\/\//g;
if (!$noinline ||
@@ -126,7 +132,6 @@ 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->{'ifiles'} = {};
$self->getFiles($file);
my(@incs) = keys %{$self->{'ifiles'}};
return \@incs;
diff --git a/bin/depgen.pl b/bin/depgen.pl
index d6b1202e0e2..25ab3162790 100755
--- a/bin/depgen.pl
+++ b/bin/depgen.pl
@@ -14,8 +14,6 @@ eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}'
# ************************************************************
use strict;
-use Cwd;
-use FileHandle;
use File::Basename;
my($execPath) = getExecutePath($0);
@@ -27,7 +25,7 @@ require DependencyEditor;
# Data Section
# ************************************************************
-my($version) = '0.6';
+my($version) = '0.7';
my($os) = ($^O eq 'MSWin32' || $^O eq 'cygwin' ? 'Windows' : 'UNIX');
my(%types) = ('gnu' => 1,
'nmake' => 1,
@@ -70,7 +68,7 @@ sub getExecutePath {
$loc = dirname($prog);
}
else {
- $loc = getcwd() . '/' . dirname($prog);
+ $loc = Cwd::getcwd() . '/' . dirname($prog);
}
}
else {
@@ -78,7 +76,7 @@ sub getExecutePath {
}
if ($loc eq '.') {
- $loc = getcwd();
+ $loc = Cwd::getcwd();
}
if ($loc ne '') {