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 = "";
}
}
}