You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rb...@locus.apache.org on 2000/12/01 00:46:32 UTC
cvs commit: apr/helpers make_export.pl
rbb 00/11/30 15:46:32
Added: helpers make_export.pl
Log:
Add a helper script to generate a list of all of the functions exported
from APR. This script is probably not fully correct, but it seems to
work for APR. It generates a file with the format:
apr_create_process
apr_wait_proc
apr_wait_all_procs
apr_detach
APR_HAS_OTHER_CHILD
apr_register_other_child
apr_unregister_other_child
apr_reap_other_child
apr_check_other_child
apr_probe_writable_fds
\APR_HAS_OTHER_CHILD
Anything that is indented is dependany on the macro defined above it.
Anything that is not indented does not depend on any macros.
This script is meant to generate a single .exports file for all platforms,
that .exports file can then be used to generate the correct .def .exp, or
exports.c file as appropriate.
Revision Changes Path
1.1 apr/helpers/make_export.pl
Index: make_export.pl
===================================================================
#!/usr/bin/perl
require "getopts.pl";
&Getopts( 'o:' );
if ($#ARGV < 0) {
die "Usage: -o <output_file> <input_files>";
}
if (!defined $opt_o) {
$opt_o = "apr.exports";
}
open (OUTFILE, ">$opt_o") || die "Can't open $opt_o $!\n";
while ($srcfile = shift(@ARGV)) {
my $line;
my $count;
my $found;
open (FILE, $srcfile) || die "Can't open $srcfile\n";
print STDERR "Reading \"$srcfile\"\n";
$count = 0;
$found = 0;
$line = "";
# print OUTFILE "____$srcfile\n";
while (<FILE>) {
chomp;
s/^\s*//;
if (/\#if (APR_HAS.*)/) {
$count++;
$found++;
$macro = $1;
$line = "$macro\n";
next;
}
elsif (/^(APR_DECLARE[^\(]*\()?[a-z_]+\)?\s+([A-Za-z0-9_]+)\(/) {
# We only want to increase this if we are in the middle of a
# #if ... #endif block.
if ($found) {
$found++;
}
for (my $i=0; $i < $count; $i++) {
$line .= "\t";
}
$line .= "$2\n";
next;
}
elsif (/\#endif/) {
if ($count > 0) {
$count--;
$line .= "\\$macro\n";
}
if ($found == 1) {
$found = 0;
$line = "";
next;
}
elsif ($found > 1) {
$found = 0;
}
}
if ($line && !$found) {
print OUTFILE "$line";
$line = "";
}
}
}
Re: cvs commit: apr/helpers make_export.pl
Posted by rb...@covalent.net.
> By the way... I found another little exports.c problem today:
>
> On OS/390, the symbols generated by the C compiler are (effectively)
> tagged as variables or functions. In exports.c, we lie about
> apr_month_snames and apr_day_snames, claiming that they are functions
> like everything else. On OS/390, this breaks at link time because
> there is a mismatch in the symbol tag -- variable (as implemented by
> APR) vs. function (as requested by exports.c).
>
> It would seem that the table(s) from which exports.c are generated
> will need to encode whether the symbol is a variable or function.
>
> OTOH, if we know the feature test macro to use, we can go back to
> including all the APR header files and thus generated exports.c can
> avoid hard-coding a declaration for symbols. This would avoid the
> invalid declarations for apr_*_snames.
Fixing this is trivial once I finish modifying buildexports.sh. This is
turning out to be a VERY extensible way to solve the problem.
Ryan
_______________________________________________________________________________
Ryan Bloom rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------
Re: cvs commit: apr/helpers make_export.pl
Posted by Jeff Trawick <tr...@bellsouth.net>.
rbb@locus.apache.org writes:
> rbb 00/11/30 15:46:32
>
> Added: helpers make_export.pl
> Log:
> Add a helper script to generate a list of all of the functions exported
> from APR. This script is probably not fully correct, but it seems to
> work for APR. It generates a file with the format:
By the way... I found another little exports.c problem today:
On OS/390, the symbols generated by the C compiler are (effectively)
tagged as variables or functions. In exports.c, we lie about
apr_month_snames and apr_day_snames, claiming that they are functions
like everything else. On OS/390, this breaks at link time because
there is a mismatch in the symbol tag -- variable (as implemented by
APR) vs. function (as requested by exports.c).
It would seem that the table(s) from which exports.c are generated
will need to encode whether the symbol is a variable or function.
OTOH, if we know the feature test macro to use, we can go back to
including all the APR header files and thus generated exports.c can
avoid hard-coding a declaration for symbols. This would avoid the
invalid declarations for apr_*_snames.
--
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...