I had too much free time today, so I created make_export.awk.
    During that I noticed that I either lack some awk knowledge
    or that the awk's expression mechanism lacks a useful feature
    (backreferencing). I've worked around that by using two sub's
    in the respective block.

    The script is a direct port of the Perl script, we just leave
    the file handling to awk. I've tested it with gawk and mawk
    and it behaves fine.

    Are these functions supposed to be exported?

--- apr.exports.perl    Fri Dec 15 17:52:38 2000
+++ apr.exports Sat Dec 16 18:45:44 2000
@@ -96,2 +96,9 @@
 apr_MD5Encode
+apr_MD5Init
+APR_HAS_XLATE
+       apr_MD5SetXlate
+/APR_HAS_XLATE
+apr_MD5Update
+apr_MD5Final
+apr_MD5Encode
 APR_HAS_MMAP
@@ -260,2 +267,6 @@
 apr_strftime
+apr_get_home_directory
+apr_get_uuid
+apr_format_uuid
+apr_parse_uuid
 apr_get_home_directory

    - Sascha
Index: configure.in
===================================================================
RCS file: /home/cvs/apr/configure.in,v
retrieving revision 1.189
diff -u -r1.189 configure.in
--- configure.in        2000/12/15 16:56:51     1.189
+++ configure.in        2000/12/16 17:46:05
@@ -44,6 +44,7 @@
 AC_PROG_CC
 AC_PROG_RANLIB_NC
 AC_PROG_MAKE_SET
+AC_PROG_AWK
 AC_CHECK_PROG(RM, rm, rm)
 AC_CHECK_TOOL(AR, ar, ar)
 
Index: Makefile.in
===================================================================
RCS file: /home/cvs/apr/Makefile.in,v
retrieving revision 1.34
diff -u -r1.34 Makefile.in
--- Makefile.in 2000/12/15 16:56:50     1.34
+++ Makefile.in 2000/12/16 17:46:06
@@ -10,6 +10,7 @@
 MFLAGS_STATIC=
 [EMAIL PROTECTED]@
 [EMAIL PROTECTED]@
[EMAIL PROTECTED]@
 [EMAIL PROTECTED]@ @OPTIM@
 [EMAIL PROTECTED]@
 [EMAIL PROTECTED]@ $(LIBS)
@@ -117,9 +118,9 @@
 
 $(TARGET_EXPORTS):
        if test -z "$(srcdir)"; then \
-               perl $(srcdir)helpers/make_export.pl -o $@ include/*.h; \
+               $(AWK) -f $(srcdir)helpers/make_export.awk include/*.h > $@ ; \
        else \
-               perl $(srcdir)helpers/make_export.pl -o $@ include/*.h 
$(srcdir)include/*.h; \
+               $(AWK) -f $(srcdir)helpers/make_export.awk include/*.h 
$(srcdir)include/*.h > $@ ; \
        fi
 
 docs:
/^#[ \t]*if(def)? APR_.*/ {
        if (old_filename != FILENAME) {
                if (old_filename != "") printf("%s", line)
                macro_no = 0
                found = 0
                count = 0
                old_filename = FILENAME
        }
        macro_stack[macro_no++] = macro
        macro = $2
        found++
        count++
        line = line macro "\n"
        next
}

/^#[ \t]*endif/ {
        if (count > 0) {
                count--
                line = line "/" macro "\n"
                macro = macro_stack[--macro_no]
        }
        if (found == count + 1) {
                found--
                line = ""
                next
        } else if (found > count + 1) {
                found = 0
        }
        next
}

/^[ \t]*(APR_DECLARE[^(]*\()?(const[ \t])?[a-z_]+[)]?[ 
\t]+\*?([A-Za-z0-9_]+)\(/ {
        if (found) {
                found++
        }
        for (i = 0; i < count; i++) {
                line = line "\t"
        }
        sub("^[ \t]*(APR_DECLARE[^(]*[(])?(const[ \t])?[a-z_]+[)]?[ \t]+\*?", 
"");
        sub("[(].*", "");
        line = line $0 "\n"
        next
}

END {
        printf("%s", line)
}

Reply via email to