* eval.c (scm_ceval, scm_deval): Check for wrong number of args
[bpt/guile.git] / libguile / guile-func-name-check.in
CommitLineData
0f981281
GB
1#!/usr/bin/awk -f
2# Written by Greg J. Badros, <gjb@cs.washington.edu>
3# 11-Jan-2000
4
5BEGIN {
6 filename = ARGV[1];
77cd7f80 7 in_a_func = 0;
0f981281
GB
8}
9
10/^SCM_DEFINE/ {
11 func_name = $0;
12 sub(/^[^\(\n]*\([ \t]*/,"", func_name);
13 sub(/[ \t]*,.*/,"", func_name);
14# print func_name; # GJB:FIXME:: flag to do this to list primitives?
15 in_a_func = 1;
16}
17
77cd7f80 18/^\{/ && in_a_func {
0f981281
GB
19 if (!match(last_line,/^#define[ \t]+FUNC_NAME[ \t]+/)) {
20 printf filename ":" NR ":***" > "/dev/stderr";
21 print "Missing or erroneous `#define FUNC_NAME s_" func_name "'" > "/dev/stderr";
22 } else {
23 sub(/^#define[ \t]+FUNC_NAME[ \t]+s_/, "", last_line);
24 sub(/[ \t]*$/,"",last_line);
25 if (last_line != func_name) {
26 printf filename ":" NR ":***" > "/dev/stderr";
27 print "Mismatching FUNC_NAME. Should be: `#define FUNC_NAME s_" func_name "'" > "/dev/stderr";
28 }
29 }
30}
31
321 == next_line_better_be_undef {
33 if (!match($0,/^#undef FUNC_NAME[ \t]*$/)) {
34 printf filename ":" NR ":***" > "/dev/stderr";
35 print "Missing or erroneous #undef for " func_name ": "
36 "Got `" $0 "' instead." > "/dev/stderr";
37 }
38 in_a_func = "";
39 func_name = "";
40 next_line_better_be_undef = 0;
41}
42
77cd7f80 43/^\}/ && in_a_func {
0f981281
GB
44 next_line_better_be_undef = 1;
45}
46
47{ last_line = $0; }