diff options
author | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-10-09 22:48:45 +0000 |
---|---|---|
committer | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-10-09 22:48:45 +0000 |
commit | 687ad5454f7be7f4269f99d7f564ecf409110588 (patch) | |
tree | 377164f5c6c1e6367f89d2eb4af20763fb3b9a82 | |
parent | 815b6ba625cbc9a9f07ea6248bc21167bbe87017 (diff) | |
download | ATCD-687ad5454f7be7f4269f99d7f564ecf409110588.tar.gz |
ChangeLogTag:Mon Oct 9 14:44:25 2000 Darrell Brunsch <brunsch@uci.edu>
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 11 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 11 | ||||
-rwxr-xr-x | bin/generate_export_file.pl | 144 | ||||
-rwxr-xr-x | bin/regenerate_exports.pl | 54 |
5 files changed, 181 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog index 0ff190010de..7cab9d889cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Mon Oct 9 14:44:25 2000 Darrell Brunsch <brunsch@uci.edu> + + * bin/generate_export_file.pl: + + Made some minor changes to make a bit more robust. + + * bin/regenerate_exports.pl: (added) + + This script should be able to recurse from the current directory + reupdating the export files. Use at your own risk. + Mon Oct 09 03:23:22 2000 Nanbor Wang <nanbor@cs.wustl.edu> * bin/generate_export_file.pl: Changed the script so we can define diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 0ff190010de..7cab9d889cb 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,14 @@ +Mon Oct 9 14:44:25 2000 Darrell Brunsch <brunsch@uci.edu> + + * bin/generate_export_file.pl: + + Made some minor changes to make a bit more robust. + + * bin/regenerate_exports.pl: (added) + + This script should be able to recurse from the current directory + reupdating the export files. Use at your own risk. + Mon Oct 09 03:23:22 2000 Nanbor Wang <nanbor@cs.wustl.edu> * bin/generate_export_file.pl: Changed the script so we can define diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 0ff190010de..7cab9d889cb 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,14 @@ +Mon Oct 9 14:44:25 2000 Darrell Brunsch <brunsch@uci.edu> + + * bin/generate_export_file.pl: + + Made some minor changes to make a bit more robust. + + * bin/regenerate_exports.pl: (added) + + This script should be able to recurse from the current directory + reupdating the export files. Use at your own risk. + Mon Oct 09 03:23:22 2000 Nanbor Wang <nanbor@cs.wustl.edu> * bin/generate_export_file.pl: Changed the script so we can define diff --git a/bin/generate_export_file.pl b/bin/generate_export_file.pl index b2d330214eb..f5bcaf08ba6 100755 --- a/bin/generate_export_file.pl +++ b/bin/generate_export_file.pl @@ -6,30 +6,59 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # Replacement for the old trusty GenExportH.bat # Creates the nice little *_export file which is used for # importing and exporting of symbols in DLLs. +# (they are soooo cute!) -die "Error: Missing command line argument" if ($#ARGV < 0); - -$depend = 0; -while ($#ARGV >= 0) { - if (!($ARGV[0] =~ m/-/)) { - $name = $ARGV[0]; - $ucname = uc $name; - shift; - } elsif ($ARGV[0] eq "-depends") { - $depend = 1; - shift; - $dependname = uc $ARGV[0]; - shift; - } +use Getopt::Std; + +############################################################################## +# Grab the options + +if (!getopts ('df:hs') || $opt_h) { + print "generate_export_file.pl [-d] [-f dependency] [-s] library_name\n"; + print "\n"; + print " -d Turn on debug mode\n"; + print " -f Adds a dependency to another *_HAS_DLL macro\n"; + print " -s Add in ACE_STATIC_LIBS check\n"; + print "\n"; + print "generate_export_file creates the *_export files that are used\n"; + print "in exporting of symbols for DLLs (and not exporting them when\n"; + print "the library is static). If library_name is something like\n"; + print "\"Foo\", then the file will contain definitions for Foo_Export\n"; + print "and FOO_SINGLETON_DECLARE, etc. which will be controlled by\n"; + print "FOO_HAS_DLL, etc.\n"; + exit (1); +} + +if (defined $opt_d) { + print "Debugging Turned on\n"; + + if (defined $opt_f) { + print "Dependency to $opt_f\n"; + } + + if (defined $opt_s) { + print "ACE_STATIC_LIBS turned on\n"; + } } -$prologue=" + +if ($#ARGV < 0) { + print STDERR "No library_name specified, use -h for help\n"; + exit (1); +} + +$name = shift @ARGV; +$ucname = uc $name; + +############################################################################## +# Prologue + +$prologue = ' // -*- C++ -*- // $Id$ // Definition for Win32 Export directives. -// This file is generated automatically by -// generate_export_file.pl -// ------------------------------ +// This file is generated automatically by generate_export_file.pl +// ------------------------------'." #ifndef -UC-_EXPORT_H #define -UC-_EXPORT_H @@ -37,58 +66,73 @@ $prologue=" "; -if ($depend == 1) +############################################################################## +# Static Stuff + +if (defined $opt_s) +{ + $static_stuff = " +#if defined (ACE_STATIC_LIBS) && !defined (-UC-_HAS_DLL) +# define -UC-_HAS_DLL 0 +#endif /* ACE_STATIC_LIBS && -UC-_HAS_DLL */ +"; +} + +############################################################################## +# Dependencies + +if (defined $opt_f) { - $has_dll=" -#if defined ($dependname) -# if !defined (-UC-_HAS_DLL) -# define -UC-_HAS_DLL 0 -# endif /* ! -UC-_HAS_DLL */ + $has_dll = " +#if defined ($opt_f) +# if !defined (-UC-_HAS_DLL) +# define -UC-_HAS_DLL 0 +# endif /* ! -UC-_HAS_DLL */ #else -# if !defined (-UC-_HAS_DLL) -# define -UC-_HAS_DLL 1 -# endif /* ! -UC-_HAS_DLL */ +# if !defined (-UC-_HAS_DLL) +# define -UC-_HAS_DLL 1 +# endif /* ! -UC-_HAS_DLL */ #endif "; } else { - $has_dll=" + $has_dll = " #if !defined (-UC-_HAS_DLL) -#define -UC-_HAS_DLL 1 +# define -UC-_HAS_DLL 1 #endif /* ! -UC-_HAS_DLL */ "; } -$epilogue=" -#if defined (-UC-_HAS_DLL) -# if (-UC-_HAS_DLL == 1) -# if defined (-UC-_BUILD_DLL) -# define -NC-_Export ACE_Proper_Export_Flag -# define -UC-_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define -UC-_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else -# define -NC-_Export ACE_Proper_Import_Flag -# define -UC-_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define -UC-_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* -UC-_BUILD_DLL */ -# else -# define -NC-_Export -# define -UC-_SINGLETON_DECLARATION(T) -# define -UC-_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ! -UC-_HAS_DLL == 1 */ -#else +############################################################################## +# Epilogue + +$epilogue = " +#if defined (-UC-_HAS_DLL) && (-UC-_HAS_DLL == 1) +# if defined (-UC-_BUILD_DLL) +# define -NC-_Export ACE_Proper_Export_Flag +# define -UC-_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define -UC-_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* -UC-_BUILD_DLL */ +# define -NC-_Export ACE_Proper_Import_Flag +# define -UC-_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define -UC-_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* -UC-_BUILD_DLL */ +#else /* -UC-_HAS_DLL == 1 */ # define -NC-_Export # define -UC-_SINGLETON_DECLARATION(T) # define -UC-_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* -UC-_HAS_DLL */ +#endif /* -UC-_HAS_DLL == 1 */ -#endif /* -UC-_EXPORT_H */ +#endif /* -UC-_EXPORT_H */ // End of auto generated file. "; -foreach $export ($prologue, $has_dll, $epilogue) +############################################################################## +# Print the stuff out + +foreach $export ($prologue, $static_stuff, $has_dll, $epilogue) { ## -NC- stands for normal case, the name as it is ## -UC- stands for the name all upper case diff --git a/bin/regenerate_exports.pl b/bin/regenerate_exports.pl new file mode 100755 index 00000000000..95e6bf67986 --- /dev/null +++ b/bin/regenerate_exports.pl @@ -0,0 +1,54 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# Goes through ACE/TAO and replaces + +use File::Find; +use Cwd; + +$args = ''; +$root = cwd.'/'; + +while ($#ARGV >= 0) { + $args = $args . ' ' . shift @ARGV; +} + +# wanted is only used for the File::Find +sub wanted +{ + my $file = $File::Find::name; + + $file =~ s/\.\//$root/; + + if ($File::Find::name =~ /\_export\.h$/i) { + my $flag = 0; + my $name = ''; + + if (!open (FILE, $file)) { + print STDERR "Error: Could not open $file\n"; + } + + while (<FILE>) { + $flag = 1 if ((/generate_export/ || /GenExportH/) && $flag == 0); + $name = $1 if (/define (\w*)_Export/); + } + + if ($flag == 1) { + print "Regenerating: $file\n"; + if ($OSNAME eq 'MSWIn32') { + $file =~ s/\//\\/g; + } + system ("perl -S generate_export_file.pl $args $name > $file"); + } + else { + print "Skipping: $file\n"; + } + close FILE; + } +} + + +find (\&wanted, "."); + |