perl patches: fix spaces errors in patch 0001
[msysgit.git] / build / make_exports.awk
blob1d12fc65abeb274423a2097b7e724cdd7527b682
2 BEGIN {
3 printf("/*\n")
4 printf(" * THIS FILE WAS AUTOGENERATED BY make_exports.awk\n")
5 printf(" *\n")
6 printf(" * This is an ugly hack that needs to be here, so\n")
7 printf(" * that libtool will link all of the APR functions\n")
8 printf(" * into server regardless of whether the base server\n")
9 printf(" * uses them.\n")
10 printf(" */\n")
11 printf("\n")
12 printf("#define CORE_PRIVATE\n")
13 printf("\n")
15 for (i = 1; i < ARGC; i++) {
16 file = ARGV[i]
17 sub("([^/]*[/])*", "", file)
18 printf("#include \"%s\"\n", file)
21 printf("\n")
22 printf("const void *ap_ugly_hack = NULL;\n")
23 printf("\n")
25 TYPE_NORMAL = 0
26 TYPE_HEADER = 1
28 stackptr = 0
31 function push(line) {
32 stack[stackptr] = line
33 stackptr++
36 function do_output() {
37 printf("/*\n")
38 printf(" * %s\n", FILENAME)
39 printf(" */\n")
41 for (i = 0; i < stackptr; i++) {
42 printf("%s\n", stack[i])
45 stackptr = 0
47 printf("\n");
50 function enter_scope(type) {
51 scope++
52 scope_type[scope] = type
53 scope_stack[scope] = stackptr
54 delete scope_used[scope]
57 function leave_scope() {
58 used = scope_used[scope]
60 if (!used)
61 stackptr = scope_stack[scope]
63 scope--
64 if (used) {
65 scope_used[scope] = 1
67 if (!scope)
68 do_output()
72 function add_symbol(symbol) {
73 if (!index(symbol, "#")) {
74 push("const void *ap_hack_" symbol " = (const void *)" symbol ";")
75 scope_used[scope] = 1
79 /^[ \t]*AP[RUI]?_(CORE_)?DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
80 sub("[ \t]*AP[RUI]?_(CORE_)?DECLARE[^(]*[(][^)]*[)][ \t]*", "")
81 sub("[(].*", "")
82 sub("([^ ]* (^([ \t]*[(])))+", "")
84 add_symbol($0)
85 next
88 /^[ \t]*AP_DECLARE_HOOK[^(]*[(][^)]*/ {
89 split($0, args, ",")
90 symbol = args[2]
91 sub("^[ \t]+", "", symbol)
92 sub("[ \t]+$", "", symbol)
94 add_symbol("ap_hook_" symbol)
95 add_symbol("ap_hook_get_" symbol)
96 add_symbol("ap_run_" symbol)
97 next
100 /^[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(][^)]*[)]/ {
101 sub("[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(]", "", $0)
102 sub("[)].*$", "", $0)
103 add_symbol("apr_" $0 "_pool_get")
104 next
107 /^[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(][^)]*[)]/ {
108 sub("[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(]", "", $0)
109 sub("[)].*$", "", $0)
110 add_symbol("apr_" $0 "_inherit_set")
111 next
114 /^[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(][^)]*[)]/ {
115 sub("[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(]", "", $0)
116 sub("[)].*$", "", $0)
117 add_symbol("apr_" $0 "_inherit_unset")
118 next
121 /^#[ \t]*if(ndef| !defined[(])([^_]*_)*H/ {
122 enter_scope(TYPE_HEADER)
123 next
126 /^#[ \t]*if([n]?def)? / {
127 enter_scope(TYPE_NORMAL)
128 push($0)
129 next
132 /^#[ \t]*endif/ {
133 if (scope_type[scope] == TYPE_NORMAL)
134 push($0)
136 leave_scope()
137 next
140 /^#[ \t]*else/ {
141 push($0)
142 next
145 /^#[ \t]*elif/ {
146 push($0)
147 next