| 1 |
#!/usr/bin/awk -f |
| 2 |
|
| 3 |
BEGIN { |
| 4 |
while ((getline i < "proto.h") > 0) old_protos = old_protos ? old_protos "\n" i : i |
| 5 |
close("proto.h") |
| 6 |
protos = "/* This file is automatically generated with \"make proto\". DO NOT EDIT */\n" |
| 7 |
} |
| 8 |
|
| 9 |
inheader { |
| 10 |
protos = protos "\n" ((inheader = /\)[ \t]*$/ ? 0 : 1) ? $0 : $0 ";") |
| 11 |
next |
| 12 |
} |
| 13 |
|
| 14 |
/^FN_(LOCAL|GLOBAL)_[^(]+\([^,()]+/ { |
| 15 |
local = /^FN_LOCAL/ |
| 16 |
gsub(/^FN_(LOC|GLOB)AL_|,.*$/, "") |
| 17 |
sub(/^BOOL\(/, "BOOL ") |
| 18 |
sub(/^CHAR\(/, "char ") |
| 19 |
sub(/^INTEGER\(/, "int ") |
| 20 |
sub(/^STRING\(/, "char *") |
| 21 |
sub(/^STRING_SHELL\(/, "char *") |
| 22 |
protos = protos "\n" $0 (local ? "(int module_id);" : "(void);") |
| 23 |
next |
| 24 |
} |
| 25 |
|
| 26 |
/^static|^extern|;/||!/^[A-Za-z][A-Za-z0-9_]* / { next } |
| 27 |
|
| 28 |
/\(.*\)[ \t]*$/ { |
| 29 |
protos = protos "\n" $0 ";" |
| 30 |
next |
| 31 |
} |
| 32 |
|
| 33 |
/\(/ { |
| 34 |
inheader = 1 |
| 35 |
protos = protos "\n" $0 |
| 36 |
} |
| 37 |
|
| 38 |
END { |
| 39 |
if (old_protos != protos) print protos > "proto.h" |
| 40 |
system("touch proto.h-tstamp") |
| 41 |
} |