summaryrefslogtreecommitdiff
path: root/build/make_nw_export.awk
diff options
context:
space:
mode:
authorgstein <gstein@13f79535-47bb-0310-9956-ffa450edef68>2011-05-09 05:28:45 +0000
committergstein <gstein@13f79535-47bb-0310-9956-ffa450edef68>2011-05-09 05:28:45 +0000
commitb6c95c67641d8f4536181308bc6d7e3db50d8667 (patch)
tree641db983719306838b127152c89e01d3d04f472b /build/make_nw_export.awk
parent5d95dbe2f400b6db1e1bc6e616a1db8e849b630b (diff)
downloadlibapr-b6c95c67641d8f4536181308bc6d7e3db50d8667.tar.gz
Catch my branch up to the latest 1.3.x branch.gstein-pocore
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/gstein-pocore@1100891 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'build/make_nw_export.awk')
-rw-r--r--build/make_nw_export.awk75
1 files changed, 51 insertions, 24 deletions
diff --git a/build/make_nw_export.awk b/build/make_nw_export.awk
index cf44e5b07..b3e948344 100644
--- a/build/make_nw_export.awk
+++ b/build/make_nw_export.awk
@@ -1,33 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
# Based on apr's make_export.awk, which is
# based on Ryan Bloom's make_export.pl
+#
BEGIN {
- printf(" ("EXPPREFIX")\n")
+ add_symbol("apr_wait_for_io_or_timeout")
+}
+
+function add_symbol(sym_name) {
+ sub(" ", "", sym_name)
+ exports[++idx] = sym_name
}
# List of functions that we don't support, yet??
#/apr_##name##_set_inherit/{next}
#/apr_##name##_unset_inherit/{next}
-
-function add_symbol (sym_name) {
- if (count) {
- found++
- }
- gsub (/ /, "", sym_name)
- line = line sym_name ",\n"
-
- if (count == 0) {
- printf(" %s", line)
- line = ""
- }
-}
-
/^[ \t]*AP[RUI]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
sub("[ \t]*AP[RUI]?_DECLARE[^(]*[(][^)]*[)][ \t]*", "")
sub("[(].*", "")
sub("([^ ]* (^([ \t]*[(])))+", "")
-
add_symbol($0)
next
}
@@ -37,7 +43,6 @@ function add_symbol (sym_name) {
symbol = args[2]
sub("^[ \t]+", "", symbol)
sub("[ \t]+$", "", symbol)
-
add_symbol("ap_hook_" symbol)
add_symbol("ap_hook_get_" symbol)
add_symbol("ap_run_" symbol)
@@ -65,15 +70,37 @@ function add_symbol (sym_name) {
next
}
-/^[ \t]*AP[RUI]?_DECLARE_DATA .*;$/ {
- varname = $NF;
- gsub( /[*;]/, "", varname);
- gsub( /\[.*\]/, "", varname);
- add_symbol(varname);
+/^[ \t]*AP[RUI]?_DECLARE_DATA .*;/ {
+ gsub(/[*;\n\r]/, "", $NF)
+ gsub(/\[.*\]/, "", $NF)
+ add_symbol($NF)
}
END {
- add_symbol("apr_wait_for_io_or_timeout");
-# printf(" %s", line)
+ printf("Added %d symbols to export list.\n", idx) > "/dev/stderr"
+ # sort symbols with shell sort
+ increment = int(idx / 2)
+ while (increment > 0) {
+ for (i = increment+1; i <= idx; i++) {
+ j = i
+ temp = exports[i]
+ while ((j >= increment+1) && (exports[j-increment] > temp)) {
+ exports[j] = exports[j-increment]
+ j -= increment
+ }
+ exports[j] = temp
+ }
+ if (increment == 2)
+ increment = 1
+ else
+ increment = int(increment*5/11)
+ }
+ # print the array
+ printf(" (%s)\n", EXPPREFIX)
+ while (x < idx - 1) {
+ printf(" %s,\n", exports[++x])
+ }
+ printf(" %s\n", exports[++x])
}
+