db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# Licensed to the Apache Software Foundation (ASF) under one or more
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# contributor license agreements. See the NOTICE file distributed with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# this work for additional information regarding copyright ownership.
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# The ASF licenses this file to You under the Apache License, Version 2.0
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# (the "License"); you may not use this file except in compliance with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# the License. You may obtain a copy of the License at
240b85022b73af58a6d971cd3d05d54037d8f682nd#
240b85022b73af58a6d971cd3d05d54037d8f682nd# http://www.apache.org/licenses/LICENSE-2.0
240b85022b73af58a6d971cd3d05d54037d8f682nd#
240b85022b73af58a6d971cd3d05d54037d8f682nd# Unless required by applicable law or agreed to in writing, software
240b85022b73af58a6d971cd3d05d54037d8f682nd# distributed under the License is distributed on an "AS IS" BASIS,
240b85022b73af58a6d971cd3d05d54037d8f682nd# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
240b85022b73af58a6d971cd3d05d54037d8f682nd# See the License for the specific language governing permissions and
240b85022b73af58a6d971cd3d05d54037d8f682nd# limitations under the License.
240b85022b73af58a6d971cd3d05d54037d8f682nd#
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes# Based on apr's make_export.awk, which is
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes# based on Ryan Bloom's make_export.pl
9b761068843e8072da6d00a5d59972bdba793426fuankg#
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes
eb3171a063fe502d50dd335c2d99c84eb7053935bnicholesBEGIN {
9b761068843e8072da6d00a5d59972bdba793426fuankg}
9b761068843e8072da6d00a5d59972bdba793426fuankg
9b761068843e8072da6d00a5d59972bdba793426fuankgfunction add_symbol(sym_name) {
9b761068843e8072da6d00a5d59972bdba793426fuankg sub(" ", "", sym_name)
9b761068843e8072da6d00a5d59972bdba793426fuankg exports[++idx] = sym_name
eb3171a063fe502d50dd335c2d99c84eb7053935bnicholes}
eb3171a063fe502d50dd335c2d99c84eb7053935bnicholes
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes# List of functions that we don't support, yet??
ccc708e8694746878551e07afab3b9a4f14cee84bnicholes#/ap_some_name/{next}
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes
72a9c5f539fe583767651852c0b53ce81a9054b5fuankg/^[ \t]*(AP|DAV|CACHE)([RU]|REQ|_CORE)?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
72a9c5f539fe583767651852c0b53ce81a9054b5fuankg sub("[ \t]*(AP|DAV|CACHE)([RU]|REQ|_CORE)?_DECLARE[^(]*[(][^)]*[)][ \t]*", "")
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes sub("[(].*", "")
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes sub("([^ ]* (^([ \t]*[(])))+", "")
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes add_symbol($0)
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes next
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes}
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes
aa158cddda558cd394ca22c3838bd4927bbe8971bnicholes/^[ \t]*AP_DECLARE_HOOK[^(]*[(][^)]*/ {
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes split($0, args, ",")
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes symbol = args[2]
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes sub("^[ \t]+", "", symbol)
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes sub("[ \t]+$", "", symbol)
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg add_symbol("ap_hook_" symbol)
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg add_symbol("ap_hook_get_" symbol)
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg add_symbol("ap_run_" symbol)
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg next
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg}
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg/^[ \t]*AP[RU]?_DECLARE_EXTERNAL_HOOK[^(]*[(][^)]*/ {
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg split($0, args, ",")
943fe3052a481f6980c5a489ff767c6effb581e2fuankg prefix = args[1]
943fe3052a481f6980c5a489ff767c6effb581e2fuankg sub("^.*[(]", "", prefix)
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg symbol = args[4]
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg sub("^[ \t]+", "", symbol)
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg sub("[ \t]+$", "", symbol)
943fe3052a481f6980c5a489ff767c6effb581e2fuankg add_symbol(prefix "_hook_" symbol)
943fe3052a481f6980c5a489ff767c6effb581e2fuankg add_symbol(prefix "_hook_get_" symbol)
943fe3052a481f6980c5a489ff767c6effb581e2fuankg add_symbol(prefix "_run_" symbol)
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes next
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes}
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes/^[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(][^)]*[)]/ {
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes sub("[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(]", "", $0)
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes sub("[)].*$", "", $0)
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes add_symbol("apr_" $0 "_pool_get")
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes next
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes}
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes/^[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(][^)]*[)]/ {
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes sub("[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(]", "", $0)
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes sub("[)].*$", "", $0)
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes add_symbol("apr_" $0 "_inherit_set")
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes next
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes}
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes/^[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(][^)]*[)]/ {
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes sub("[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(]", "", $0)
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes sub("[)].*$", "", $0)
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes add_symbol("apr_" $0 "_inherit_unset")
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes next
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes}
7640ae77eade5ef41bb3bf964a9d437e64c55da3bnicholes
2a3d4464b68bcf6173f675479b4ec681a83f4bd9fuankg/^[ \t]*(extern[ \t]+)?AP[RU]?_DECLARE_DATA .*;/ {
d69ce32f322a3a3958fa2f91ff490744724d05f5fuankg gsub(/[*;\n\r]/, "")
d69ce32f322a3a3958fa2f91ff490744724d05f5fuankg gsub(/\[.*\]/, "")
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg add_symbol($NF)
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes}
43aea3e7c517d422b84242bd4474d94802d3b4e3bnicholes
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg
9b761068843e8072da6d00a5d59972bdba793426fuankgEND {
9b761068843e8072da6d00a5d59972bdba793426fuankg printf("Added %d symbols to export list.\n", idx) > "/dev/stderr"
9b761068843e8072da6d00a5d59972bdba793426fuankg # sort symbols with shell sort
9b761068843e8072da6d00a5d59972bdba793426fuankg increment = int(idx / 2)
9b761068843e8072da6d00a5d59972bdba793426fuankg while (increment > 0) {
9b761068843e8072da6d00a5d59972bdba793426fuankg for (i = increment+1; i <= idx; i++) {
9b761068843e8072da6d00a5d59972bdba793426fuankg j = i
9b761068843e8072da6d00a5d59972bdba793426fuankg temp = exports[i]
9b761068843e8072da6d00a5d59972bdba793426fuankg while ((j >= increment+1) && (exports[j-increment] > temp)) {
9b761068843e8072da6d00a5d59972bdba793426fuankg exports[j] = exports[j-increment]
9b761068843e8072da6d00a5d59972bdba793426fuankg j -= increment
9b761068843e8072da6d00a5d59972bdba793426fuankg }
9b761068843e8072da6d00a5d59972bdba793426fuankg exports[j] = temp
9b761068843e8072da6d00a5d59972bdba793426fuankg }
9b761068843e8072da6d00a5d59972bdba793426fuankg if (increment == 2)
9b761068843e8072da6d00a5d59972bdba793426fuankg increment = 1
9b761068843e8072da6d00a5d59972bdba793426fuankg else
9b761068843e8072da6d00a5d59972bdba793426fuankg increment = int(increment*5/11)
9b761068843e8072da6d00a5d59972bdba793426fuankg }
9b761068843e8072da6d00a5d59972bdba793426fuankg # print the array
9b761068843e8072da6d00a5d59972bdba793426fuankg printf(" (%s)\n", EXPPREFIX)
9b761068843e8072da6d00a5d59972bdba793426fuankg while (x < idx - 1) {
9b761068843e8072da6d00a5d59972bdba793426fuankg printf(" %s,\n", exports[++x])
9b761068843e8072da6d00a5d59972bdba793426fuankg }
9b761068843e8072da6d00a5d59972bdba793426fuankg printf(" %s\n", exports[++x])
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg}
b972d6954acbeafb8e1d6e7020e1e907cb884d0cfuankg