summaryrefslogtreecommitdiff
path: root/libguile/guile-snarf.awk.in
diff options
context:
space:
mode:
authorGreg J. Badros <gjb@cs.washington.edu>2000-01-05 18:48:07 +0000
committerGreg J. Badros <gjb@cs.washington.edu>2000-01-05 18:48:07 +0000
commitc751e5e3c31588f8b32c628519efa2c515c1a617 (patch)
tree50ab86fea5acbdf1dc699174ef2d4f122b1b8986 /libguile/guile-snarf.awk.in
parent5a237c9d5d7cbe592b0ba7f133dadc0cf18bb4e3 (diff)
downloadguile-c751e5e3c31588f8b32c628519efa2c515c1a617.tar.gz
* guile-snarf.awk.in: Do argument/number mismatch checking and
print warnings in an Emacs compile-mode parseable format. * struct.c: Use SCM_ASSERT_RANGE instead of SCM_ASSERT w/ SCM_OUTOFRANGE as 3rd argument. * random.c: Fix argument/number mismatch (that I introduced :-( ). * __scm.h: Do not #define SCM_ARG* when snarfing; lets us distinguish between 1 and SCM_ARG1 when snarfing as only the former (using the number) requires the argument to match the formal in the current argument snarfing check. * ramap.c: Remove extraneous #undef FUNC_NAME.
Diffstat (limited to 'libguile/guile-snarf.awk.in')
-rw-r--r--libguile/guile-snarf.awk.in34
1 files changed, 32 insertions, 2 deletions
diff --git a/libguile/guile-snarf.awk.in b/libguile/guile-snarf.awk.in
index cb3ed40b2..da20af493 100644
--- a/libguile/guile-snarf.awk.in
+++ b/libguile/guile-snarf.awk.in
@@ -25,7 +25,7 @@ BEGIN { FS="|";
gsub(/[ \t]+/," ", copy);
sub(/^[ \t]*/,"(", copy);
gsub(/\"/,"",copy);
- numargs = gsub(/\([ \t]*void[ \t]*\)/,"()", copy);
+ sub(/\([ \t]*void[ \t]*\)/,"()", copy);
sub(/ \(/," ",copy);
numargs = gsub(/SCM /,"", copy);
numcommas = gsub(/,/,"", copy);
@@ -35,8 +35,21 @@ BEGIN { FS="|";
sub(/^[ \t]*/,"",location);
sub(/[ \t]*$/,"",location);
sub(/: /,":",location);
+ # Now whittle copy down to just the $1 field
+ # (but do not use $1, since it hasn't been
+ # altered by the above regexps)
gsub(/[ \t]*\|.*$/,"",copy);
sub(/ \)/,")",copy);
+ # Now `copy' contains the nice scheme proc "prototype", e.g.
+ # (set-car! pair value)
+ # print copy > "/dev/stderr"; # for debugging
+ proc_and_args = copy;
+ curr_function_proto = copy;
+ sub(/[^ \n]* /,"",proc_and_args);
+ sub(/\)[ \t]*/,"",proc_and_args);
+ split(proc_and_args,args," ");
+ # now args is an array of the arguments
+ # args[1] is the formal name of the first argument, etc.
if (numargs != numactuals && !registering)
{ print location ":*** `" copy "' is improperly registered as having " numactuals " arguments" > /dev/stderr; }
print " \n" copy (registering?")":"") > dot_doc_file ; }
@@ -47,6 +60,23 @@ BEGIN { FS="|";
sub(/\"?[ \t]*@!!!.*$/,"", copy);
gsub(/\\\"/,"\"",copy);
gsub(/[ \t]*$/,"", copy);
- if (copy != "") { print copy > dot_doc_file } }
+ if (copy != "") { print copy > dot_doc_file }
+ }
+
/@!!![ \t]/ { print "[" location "]" >> dot_doc_file; }
+/\*&\*&\*&\*SCM_ARG_BETTER_BE_IN_POSITION/ { copy = $0;
+ sub(/.*\*&\*&\*&\*SCM_ARG_BETTER_BE_IN_POSITION\([ \t]*/,"",copy);
+ if (copy ~ /\"/) { next }
+ gsub(/[ \t]*,[ \t]*/,":",copy);
+ sub(/[ \t]*\).*/,"",copy);
+ split(copy,argpos,":");
+ argname = argpos[1];
+ pos = argpos[2];
+ if (pos ~ /[A-Za-z]/) { next }
+ if (pos ~ /^[ \t]*$/) { next }
+ if (argname ~ / /) { next }
+ line = argpos[3];
+# print pos " " args[pos] " vs. " argname > "/dev/stderr";
+ if (args[pos] != argname) { print filename ":" line ":*** Argument name/number mismatch in `" curr_function_proto "' -- " argname " is not formal #" pos > "/dev/stderr"; }
+ }