2 # Written by Greg J. Badros, <gjb@cs.washington.edu>
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
12 printf "" > dot_doc_file
;
15 /^
[ \t]*%%%
/ { copy = $
0;
16 gsub(/[ \t]*%%%
/, "", copy
);
17 gsub(/\$\$\$.
*$
/, "", copy
);
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
);
28 numargs =
gsub(/\
([ \t]*void
[ \t]*\
)/,"()", copy
);
30 numargs =
gsub(/SCM
/,"", copy
);
31 numcommas =
gsub(/,/,"", copy
);
32 numactuals = $
2 + $
3 + $
4;
34 gsub(/\"/,"",location
);
35 sub(/^
[ \t]*/,"",location
);
36 sub(/[ \t]*$
/,"",location
);
37 sub(/: /,":",location
);
38 gsub(/[ \t]*\
|.
*$
/,"",copy
);
40 if (numargs
!= numactuals
&& !registering
)
41 { print location
":*** `" copy
"' is improperly registered as having " numactuals
" arguments" > /dev
/stderr
; }
42 print "\f\n" copy
(registering?
")":"") > dot_doc_file
; }
44 /@@@
/,/@!!!.
*$
/ { copy = $
0;
45 gsub(/.
*@@@
/,"",copy
);
46 sub(/^
[ \t]*"?/,"", copy);
47 sub(/\"?[ \t]*@!!!.*$/,"", copy);
48 gsub(/\\\"/,"\"",copy);
49 gsub(/[ \t]*$/,"", copy);
50 if (copy != "") { print copy > dot_doc_file } }
51 /@!!![ \t]/ { print "\ 1[" location "]" >> dot_doc_file; }