diff options
Diffstat (limited to 'libguile/guile-func-name-check.in')
-rw-r--r-- | libguile/guile-func-name-check.in | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/libguile/guile-func-name-check.in b/libguile/guile-func-name-check.in new file mode 100644 index 000000000..fcd29b17c --- /dev/null +++ b/libguile/guile-func-name-check.in @@ -0,0 +1,46 @@ +#!/usr/bin/awk -f +# Written by Greg J. Badros, <gjb@cs.washington.edu> +# 11-Jan-2000 + +BEGIN { + filename = ARGV[1]; +} + +/^SCM_DEFINE/ { + func_name = $0; + sub(/^[^\(\n]*\([ \t]*/,"", func_name); + sub(/[ \t]*,.*/,"", func_name); +# print func_name; # GJB:FIXME:: flag to do this to list primitives? + in_a_func = 1; +} + +in_a_func && /^\{/ { + if (!match(last_line,/^#define[ \t]+FUNC_NAME[ \t]+/)) { + printf filename ":" NR ":***" > "/dev/stderr"; + print "Missing or erroneous `#define FUNC_NAME s_" func_name "'" > "/dev/stderr"; + } else { + sub(/^#define[ \t]+FUNC_NAME[ \t]+s_/, "", last_line); + sub(/[ \t]*$/,"",last_line); + if (last_line != func_name) { + printf filename ":" NR ":***" > "/dev/stderr"; + print "Mismatching FUNC_NAME. Should be: `#define FUNC_NAME s_" func_name "'" > "/dev/stderr"; + } + } +} + +1 == next_line_better_be_undef { + if (!match($0,/^#undef FUNC_NAME[ \t]*$/)) { + printf filename ":" NR ":***" > "/dev/stderr"; + print "Missing or erroneous #undef for " func_name ": " + "Got `" $0 "' instead." > "/dev/stderr"; + } + in_a_func = ""; + func_name = ""; + next_line_better_be_undef = 0; +} + +in_a_func && /^\}/ { + next_line_better_be_undef = 1; +} + +{ last_line = $0; } |