make_exports.awk revision 612ea048caf897cb6e69dc296d2b143a08ba83a0
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb
d943f5870debf69f3186f2666221abefc22a2d6drbbBEGIN {
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb printf("/*\n")
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb printf(" * THIS FILE WAS AUTOGENERATED BY make_exports.awk\n")
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb printf(" *\n")
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb printf(" * This is an ugly hack that needs to be here, so\n")
d943f5870debf69f3186f2666221abefc22a2d6drbb printf(" * that libtool will link all of the APR functions\n")
d943f5870debf69f3186f2666221abefc22a2d6drbb printf(" * into server regardless of whether the base server\n")
d943f5870debf69f3186f2666221abefc22a2d6drbb printf(" * uses them.\n")
d943f5870debf69f3186f2666221abefc22a2d6drbb printf(" */\n")
d943f5870debf69f3186f2666221abefc22a2d6drbb printf("\n")
d943f5870debf69f3186f2666221abefc22a2d6drbb printf("#define CORE_PRIVATE\n")
d943f5870debf69f3186f2666221abefc22a2d6drbb printf("\n")
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb for (i = 1; i < ARGC; i++) {
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb file = ARGV[i]
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb sub("([^/]*[/])*", "", file)
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb printf("#include \"%s\"\n", file)
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb }
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb printf("\n")
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb printf("const void *ap_ugly_hack = NULL;\n")
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb printf("\n")
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb
d943f5870debf69f3186f2666221abefc22a2d6drbb TYPE_NORMAL = 0
d943f5870debf69f3186f2666221abefc22a2d6drbb TYPE_HEADER = 1
4e191199a0aeab09d78df8f5579e745572e8b7bcwsanchez
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb stackptr = 0
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb}
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb
8ddfe3a457c91c8e7d48134398fb178b091366d7rbbfunction push(line) {
6988b3c9a24f46e053cd8de93b010199fa470254jim stack[stackptr] = line
6988b3c9a24f46e053cd8de93b010199fa470254jim stackptr++
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb}
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb
8ddfe3a457c91c8e7d48134398fb178b091366d7rbbfunction do_output() {
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb printf("/*\n")
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb printf(" * %s\n", FILENAME)
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb printf(" */\n")
806f87e03cc4ddead00f23ce96c27e75f32f0744slive
806f87e03cc4ddead00f23ce96c27e75f32f0744slive for (i = 0; i < stackptr; i++) {
806f87e03cc4ddead00f23ce96c27e75f32f0744slive printf("%s\n", stack[i])
806f87e03cc4ddead00f23ce96c27e75f32f0744slive }
806f87e03cc4ddead00f23ce96c27e75f32f0744slive
806f87e03cc4ddead00f23ce96c27e75f32f0744slive stackptr = 0
8afa7897894d641cb8ec4f601b9869f9b509609efielding
806f87e03cc4ddead00f23ce96c27e75f32f0744slive printf("\n");
806f87e03cc4ddead00f23ce96c27e75f32f0744slive}
c6db3f5916ebd715971c3db837be9143394f8aa9slive
8afa7897894d641cb8ec4f601b9869f9b509609efieldingfunction enter_scope(type) {
8afa7897894d641cb8ec4f601b9869f9b509609efielding scope++
8afa7897894d641cb8ec4f601b9869f9b509609efielding scope_type[scope] = type
8afa7897894d641cb8ec4f601b9869f9b509609efielding scope_stack[scope] = stackptr
806f87e03cc4ddead00f23ce96c27e75f32f0744slive delete scope_used[scope]
8afa7897894d641cb8ec4f601b9869f9b509609efielding}
806f87e03cc4ddead00f23ce96c27e75f32f0744slive
806f87e03cc4ddead00f23ce96c27e75f32f0744slivefunction leave_scope() {
806f87e03cc4ddead00f23ce96c27e75f32f0744slive used = scope_used[scope]
8afa7897894d641cb8ec4f601b9869f9b509609efielding
806f87e03cc4ddead00f23ce96c27e75f32f0744slive if (!used)
806f87e03cc4ddead00f23ce96c27e75f32f0744slive stackptr = scope_stack[scope]
806f87e03cc4ddead00f23ce96c27e75f32f0744slive
8afa7897894d641cb8ec4f601b9869f9b509609efielding scope--
806f87e03cc4ddead00f23ce96c27e75f32f0744slive if (used) {
806f87e03cc4ddead00f23ce96c27e75f32f0744slive scope_used[scope] = 1
e60a4dc5bad9da4e835be390de54053c9d696918slive
8afa7897894d641cb8ec4f601b9869f9b509609efielding if (!scope)
806f87e03cc4ddead00f23ce96c27e75f32f0744slive do_output()
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb }
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb}
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb
8ddfe3a457c91c8e7d48134398fb178b091366d7rbbfunction add_symbol(symbol) {
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb idx = index(symbol, "#")
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb if (!idx) {
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb push("const void *ap_hack_" symbol " = (const void *)" symbol ";")
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb scope_used[scope] = 1
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb }
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb}
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb/^[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb sub("[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]", "");
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb sub("[(].*", "");
ac3641cde456dce75e7377c711a8c04d222dbed9fielding sub("^[ \t]+", "");
ac3641cde456dce75e7377c711a8c04d222dbed9fielding sub("([^ ]* ^([ \t]*[(]))*", "");
ac3641cde456dce75e7377c711a8c04d222dbed9fielding
a3c4d0c5de7166eb034635bd4ed7ec2280ee9c23fielding add_symbol($0)
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb next
4e191199a0aeab09d78df8f5579e745572e8b7bcwsanchez}
8ddfe3a457c91c8e7d48134398fb178b091366d7rbb
/^#[ \t]*if(ndef| !defined[(])([^_]*_)*H/ {
enter_scope(TYPE_HEADER)
next
}
/^#[ \t]*if([n]?def)? / {
enter_scope(TYPE_NORMAL)
push($0)
next
}
/^#[ \t]*endif/ {
if (scope_type[scope] == TYPE_NORMAL)
push($0)
leave_scope()
next
}
/^#[ \t]*else/ {
push($0)
next
}
/^#[ \t]*elif/ {
push($0)
next
}