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