summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorSascha Schumann <sascha@apache.org>2000-12-18 00:17:18 +0000
committerSascha Schumann <sascha@apache.org>2000-12-18 00:17:18 +0000
commit609771861a214f9564401dd71476a42dd789cc8c (patch)
tree674c78977b6e7c4f78d57e5a764a177971e809c6 /helpers
parent68898efd083ae21d4f10ba4703798eaf8cd00e25 (diff)
downloadapr-609771861a214f9564401dd71476a42dd789cc8c.tar.gz
Drop the Perl dependency and use an awk script for creating apr.exports.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@60963 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'helpers')
-rw-r--r--helpers/make_export.awk50
1 files changed, 50 insertions, 0 deletions
diff --git a/helpers/make_export.awk b/helpers/make_export.awk
new file mode 100644
index 000000000..b58b657b3
--- /dev/null
+++ b/helpers/make_export.awk
@@ -0,0 +1,50 @@
+# Based on Ryan Bloom's make_export.pl
+
+/^#[ \t]*if(def)? APR_.*/ {
+ if (old_filename != FILENAME) {
+ if (old_filename != "") printf("%s", line)
+ macro_no = 0
+ found = 0
+ count = 0
+ old_filename = FILENAME
+ line = ""
+ }
+ 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 = ""
+ } 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)
+}