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