summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorRyan Bloom <rbb@apache.org>2000-11-30 23:46:32 +0000
committerRyan Bloom <rbb@apache.org>2000-11-30 23:46:32 +0000
commitaf6459fb0332ece4e404fc9bbed219a1cad452b2 (patch)
treee24bbf61c652170625aa4f8a0ad6c927f5de19a2 /helpers
parent749873c0513d3555412218821d095f890fcf8416 (diff)
downloadapr-af6459fb0332ece4e404fc9bbed219a1cad452b2.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@60822 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'helpers')
-rwxr-xr-xhelpers/make_export.pl73
1 files changed, 73 insertions, 0 deletions
diff --git a/helpers/make_export.pl b/helpers/make_export.pl
new file mode 100755
index 000000000..d9ef5500d
--- /dev/null
+++ b/helpers/make_export.pl
@@ -0,0 +1,73 @@
+#!/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 = "";
+ }
+ }
+}
+