perl patches: fix spaces errors in patch 0001
[msysgit.git] / build / make_var_export.awk
blob59922758d58bf4fd148dccb352eec782b6b508f9
1 # Based on apr's make_export.awk, which is
2 # based on Ryan Bloom's make_export.pl
4 /^#[ \t]*if(def)? (AP[RUI]?_|!?defined).*/ {
5 if (old_filename != FILENAME) {
6 if (old_filename != "") printf("%s", line)
7 macro_no = 0
8 found = 0
9 count = 0
10 old_filename = FILENAME
11 line = ""
13 macro_stack[macro_no++] = macro
14 macro = substr($0, length($1)+2)
15 count++
16 line = line "#ifdef " macro "\n"
17 next
20 /^#[ \t]*endif/ {
21 if (count > 0) {
22 count--
23 line = line "#endif /* " macro " */\n"
24 macro = macro_stack[--macro_no]
26 if (count == 0) {
27 if (found != 0) {
28 printf("%s", line)
30 line = ""
32 next
35 function add_symbol (sym_name) {
36 if (count) {
37 found++
39 for (i = 0; i < count; i++) {
40 line = line "\t"
42 line = line sym_name "\n"
44 if (count == 0) {
45 printf("%s", line)
46 line = ""
50 /^[ \t]*(extern[ \t]+)?AP[RUI]?_DECLARE_DATA .*;$/ {
51 varname = $NF;
52 gsub( /[*;]/, "", varname);
53 gsub( /\[.*\]/, "", varname);
54 add_symbol(varname);
57 END {
58 printf("%s", line)