1 # Written by Greg J. Badros, <gjb@cs.washington.edu>
5 dot_doc_file =
ARGV[1]; ARGV[1] =
"";
7 std_err =
"/dev/stderr";
8 # be sure to put something in the files to help make out
10 printf "" > dot_doc_file
;
13 /^
[ \t]*%%%
/ { copy = $
0;
14 gsub(/[ \t]*%%%
/, "", copy
);
15 gsub(/\$\$\$.
*$
/, "", copy
);
18 /\$\$\$
/,/@@@
/ { copy = $
0;
19 if (match(copy
,/\$\$\$R
/)) { registering =
1; }
20 else {registering =
0; }
21 gsub(/.
*\$\$\$.
/,"", copy
);
22 gsub(/@@@.
*/,"",copy
);
23 gsub(/[ \t]+/," ", copy
);
24 sub(/^
[ \t]*/,"(", copy
);
26 sub(/\
([ \t]*void
[ \t]*\
)/,"()", copy
);
28 numargs =
gsub(/SCM
/,"", copy
);
29 numcommas =
gsub(/,/,"", copy
);
30 numactuals = $
2 + $
3 + $
4;
32 gsub(/\"/,"",location
);
33 sub(/^
[ \t]*/,"",location
);
34 sub(/[ \t]*$
/,"",location
);
35 sub(/: /,":",location
);
36 # Now whittle copy down to just the $1 field
37 # (but do not use $1, since it hasn't been
38 # altered by the above regexps)
39 gsub(/[ \t]*\
|.
*$
/,"",copy
);
41 # Now `copy' contains the nice scheme proc "prototype", e.g.
42 # (set-car! pair value)
43 # print copy > "/dev/stderr"; # for debugging
45 curr_function_proto = copy
;
46 sub(/[^
\n]* /,"",proc_and_args
);
47 sub(/\
)[ \t]*/,"",proc_and_args
);
48 split(proc_and_args
,args
," ");
49 # now args is an array of the arguments
50 # args[1] is the formal name of the first argument, etc.
51 if (numargs
!= numactuals
&& !registering
)
52 { print location
":*** `" copy
"' is improperly registered as having " numactuals
" arguments" > std_err
; }
53 print "\f\n" copy
(registering?
")":"") > dot_doc_file
; }
55 /@@@
/,/@!!!.
*$
/ { copy = $
0;
56 gsub(/.
*@@@
/,"",copy
);
57 sub(/^
[ \t]*"?/,"", copy);
58 sub(/\"?[ \t]*@!!!.*$/,"", copy);
59 gsub(/\\\"/,"\"",copy);
60 gsub(/[ \t]*$/,"", copy);
61 if (copy != "") { print copy > dot_doc_file }
64 /@!!![ \t]/ { print "\ 1[" location "]" >> dot_doc_file; }
66 /\*&\*&\*&\*SCM_ARG_BETTER_BE_IN_POSITION/ { copy = $0;
67 sub(/.*\*&\*&\*&\*SCM_ARG_BETTER_BE_IN_POSITION\([ \t]*/,"",copy);
68 if (copy ~ /\"/) { next }
69 gsub(/[ \t]*,[ \t]*/,":",copy);
70 sub(/[ \t]*\).*/,"",copy);
71 split(copy,argpos,":");
74 if (pos ~ /[A-Za-z]/) { next }
75 if (pos ~ /^[ \t]*$/) { next }
76 if (argname ~ / /) { next }
78 # print pos " " args[pos] " vs.
" argname > "/dev
/stderr
";
79 if (args[pos] != argname) { print filename ":" line ":*** Argument name
/number mismatch in `
" curr_function_proto "' -- " argname " is not formal #" pos > "/dev/stderr"; }