1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements. See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # Based on apr's make_export.awk, which is
17 # based on Ryan Bloom's make_export.pl
23 function add_symbol(sym_name) {
24 sub(" ", "", sym_name)
25 exports[++idx] = sym_name
28 # List of functions that we don't support, yet??
31 /^[ \t]*(AP|DAV|CACHE|PROXY)([RU]|REQ|_CORE)?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
32 sub("[ \t]*(AP|DAV|CACHE|PROXY)([RU]|REQ|_CORE)?_DECLARE[^(]*[(][^)]*[)][ \t]*", "")
34 sub("([^ ]* (^([ \t]*[(])))+", "")
39 /^[ \t]*AP_DECLARE_HOOK[^(]*[(][^)]*/ {
42 sub("^[ \t]+", "", symbol)
43 sub("[ \t]+$", "", symbol)
44 add_symbol("ap_hook_" symbol)
45 add_symbol("ap_hook_get_" symbol)
46 add_symbol("ap_run_" symbol)
50 /^[ \t]*AP[RU]?_DECLARE_EXTERNAL_HOOK[^(]*[(][^)]*/ {
53 sub("^.*[(]", "", prefix)
55 sub("^[ \t]+", "", symbol)
56 sub("[ \t]+$", "", symbol)
57 add_symbol(prefix "_hook_" symbol)
58 add_symbol(prefix "_hook_get_" symbol)
59 add_symbol(prefix "_run_" symbol)
63 /^[ \t]*PROXY_DECLARE_OPTIONAL_HOOK[^(]*[(][^)]*/ {
66 sub("^.*[(]", "", prefix)
68 sub("^[ \t]+", "", symbol)
69 sub("[ \t]+$", "", symbol)
70 add_symbol(prefix "_run_" symbol)
74 /^[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(][^)]*[)]/ {
75 sub("[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(]", "", $0)
77 add_symbol("apr_" $0 "_pool_get")
81 /^[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(][^)]*[)]/ {
82 sub("[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(]", "", $0)
84 add_symbol("apr_" $0 "_inherit_set")
88 /^[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(][^)]*[)]/ {
89 sub("[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(]", "", $0)
91 add_symbol("apr_" $0 "_inherit_unset")
95 /^[ \t]*(extern[ \t]+)?AP[RU]?_DECLARE_DATA .*;/ {
101 /^[ \t]*(extern[ \t]+(module[ \t]+)?)?PROXY_DECLARE_DATA .*;/ {
108 printf("Added %d symbols to export list.\n", idx) > "/dev/stderr"
109 # sort symbols with shell sort
110 increment = int(idx / 2)
111 while (increment > 0) {
112 for (i = increment+1; i <= idx; i++) {
115 while ((j >= increment+1) && (exports[j-increment] > temp)) {
116 exports[j] = exports[j-increment]
124 increment = int(increment*5/11)
127 printf(" (%s)\n", EXPPREFIX)
128 while (x < idx - 1) {
129 printf(" %s,\n", exports[++x])
131 printf(" %s\n", exports[++x])