3 ## Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson
4 ## added -texinfo, -listfunc, -pkg-name
6 ## various improvements
7 ## Copyright (c) 2001, 2002 Nikos Mavrogiannopoulos
9 ## Copyright (c) 1998 Michael Zucchi
11 # This program is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # This will read a C source code file and scan for embedded comments
25 # in the style of gnome comments (+minor extensions - see below).
28 # gdoc [ -docbook | -html | -text | -man | -tex | -texinfo | -listfunc ]
29 # [ -sourceversion verno ] [ -include file | -includefuncprefix ]
30 # [ -bugsto address ] [ -pkg-name packagename ]
31 # [ -seeinfo infonode ] [ -copyright notice ] [ -verbatimcopying ]
32 # [ -function funcname [ -function funcname ...] ] c file(s)s > outputfile
34 # Set output format using one of -docbook, -html, -text, -man, -tex,
35 # -texinfo, or -listfunc. Default is man.
38 # Version number for source code, e.g. '1.0.4'. Used in 'man' headers.
39 # Defaults to using current date.
42 # For man pages, mention #include <FILE.h> in the synopsis.
45 # For man pages, mention a #include <FILE.h> in the synopsis.
46 # The FILE derived from the function prefix. For example, a
47 # function gss_init_sec_context will generate an include
48 # statement of #include <gss.h>.
51 # For man pages, include a section about reporting bugs and mention
52 # the given e-mail address, e.g 'bug-libidn@gnu.org'.
54 # -pkg-name packagename
55 # For man pages when -bugsto is used, also include help URLs to the
56 # the project's home page. For example, "GNU Libidn".
59 # For man pages, include a section that point to an info manual
60 # for more information.
63 # For man pages, include a copyright section with the given
64 # notice after a preamble. Use, e.g., '2002, 2003 Simon Josefsson'.
67 # For man pages, and when the -copyright parameter is used,
68 # add a licensing statement that say verbatim copying is permitted.
71 # If set, then only generate documentation for the given function(s). All
72 # other functions are ignored.
74 # c files - list of 'c' files to process
76 # All output goes to stdout, with errors to stderr.
80 # In the following table, (...)? signifies optional structure.
81 # (...)* signifies 0 or more structure elements
83 # * function_name(:)? (- short description)?
84 # (* @parameterx: (description of parameter x)?)*
86 # * (Description:)? (Description of function)?
87 # * (Section header: (section description)? )*
90 # So .. the trivial example would be:
96 # If the Description: header tag is ommitted, then there must be a blank line
97 # after the last parameter specification.
100 # * my_function - does my stuff
101 # * @my_arg: its mine damnit
103 # * Does my stuff explained.
106 # or, could also use:
108 # * my_function - does my stuff
109 # * @my_arg: its mine damnit
110 # * Description: Does my stuff explained.
114 # All descriptions can be multiline, apart from the short function description.
116 # All descriptive text is further processed, scanning for the following special
117 # patterns, which are highlighted appropriately.
119 # 'funcname()' - function
120 # '$ENVVAR' - environmental variable OBSOLETE (?)
121 # '#struct_name' - name of a structure
122 # '@parameter' - name of a parameter
123 # '%CONST' - name of a constant.
126 # Extensions for LaTeX:
128 # 1. the symbol '->' will be replaced with a rightarrow
129 # 2. x^y with ${x}^{y}$.
132 use POSIX qw(strftime);
134 # match expressions used to find embedded type information
135 $type_constant = "((?<!\")\\\%(\\w+))";
136 $type_func = "(\\w+\\(\\))";
137 $type_param = "\\\@(\\w+)";
138 $type_struct = "\\\#(\\w+)";
139 $type_env = "(\\\$\\w+)";
142 # Output conversion substitutions.
143 # One for each output format
145 # these work fairly well
146 %highlights_html = ( $type_constant, "<i>\$2</i>",
147 $type_func, "<b>\$1</b>",
148 $type_struct, "<i>\$1</i>",
149 $type_param, "<tt><b>\$1</b></tt>" );
150 $blankline_html = "<p>";
152 %highlights_texinfo = ( $type_constant, "\\\@code{\$2}",
153 $type_func, "\\\@code{\$1}",
154 $type_struct, "\\\@code{\$1}",
155 $type_param, "\\\@code{\$1}" );
156 $blankline_texinfo = "";
158 %highlights_tex = ( $type_constant, "{\\\\it \$2}",
159 $type_func, "{\\\\bf \$1}",
160 $type_struct, "{\\\\it \$1}",
161 $type_param, "{\\\\bf \$1}" );
162 $blankline_tex = "\\\\";
164 # sgml, docbook format
165 %highlights_sgml = ( $type_constant, "<replaceable class=\"option\">\$2</replaceable>",
166 $type_func, "<function>\$1</function>",
167 $type_struct, "<structname>\$1</structname>",
168 $type_env, "<envar>\$1</envar>",
169 $type_param, "<parameter>\$1</parameter>" );
170 $blankline_sgml = "</para><para>\n";
172 # these are pretty rough
173 %highlights_man = ( $type_constant, "\\\\fB\$2\\\\fP",
174 $type_func, "\\\\fB\$1\\\\fP",
175 $type_struct, "\\\\fB\$1\\\\fP",
176 $type_param, "\\\\fI\$1\\\\fP" );
180 %highlights_text = ( $type_constant, "\$2",
183 $type_param, "\$1" );
184 $blankline_text = "";
188 print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -tex | -texinfo -listfunc ]\n";
189 print " [ -sourceversion verno ] [ -include file | -includefuncprefix ]\n";
190 print " [ -bugsto address ] [ -seeinfo infonode ] [ -copyright notice]\n";
191 print " [ -verbatimcopying ] [ -pkg-name packagename ]\n";
192 print " [ -function funcname [ -function funcname ...] ]\n";
193 print " c source file(s) > outputfile\n";
203 $output_mode = "man";
204 %highlights = %highlights_man;
205 $blankline = $blankline_man;
206 $modulename = "API Documentation";
207 $sourceversion = strftime "%Y-%m-%d", localtime;
209 while ($ARGV[0] =~ m/^-(.*)/) {
211 if ($cmd eq "-html") {
212 $output_mode = "html";
213 %highlights = %highlights_html;
214 $blankline = $blankline_html;
215 } elsif ($cmd eq "-man") {
216 $output_mode = "man";
217 %highlights = %highlights_man;
218 $blankline = $blankline_man;
219 } elsif ($cmd eq "-tex") {
220 $output_mode = "tex";
221 %highlights = %highlights_tex;
222 $blankline = $blankline_tex;
223 } elsif ($cmd eq "-texinfo") {
224 $output_mode = "texinfo";
225 %highlights = %highlights_texinfo;
226 $blankline = $blankline_texinfo;
227 } elsif ($cmd eq "-text") {
228 $output_mode = "text";
229 %highlights = %highlights_text;
230 $blankline = $blankline_text;
231 } elsif ($cmd eq "-docbook") {
232 $output_mode = "sgml";
233 %highlights = %highlights_sgml;
234 $blankline = $blankline_sgml;
235 } elsif ($cmd eq "-listfunc") {
236 $output_mode = "listfunc";
237 } elsif ($cmd eq "-module") { # not needed for sgml, inherits from calling document
238 $modulename = shift @ARGV;
239 } elsif ($cmd eq "-sourceversion") {
240 $sourceversion = shift @ARGV;
241 } elsif ($cmd eq "-include") {
242 $include = shift @ARGV;
243 } elsif ($cmd eq "-includefuncprefix") {
244 $includefuncprefix = 1;
245 } elsif ($cmd eq "-bugsto") {
246 $bugsto = shift @ARGV;
247 } elsif ($cmd eq "-pkg-name") {
248 $pkgname = shift @ARGV;
249 } elsif ($cmd eq "-copyright") {
250 $copyright = shift @ARGV;
251 } elsif ($cmd eq "-verbatimcopying") {
252 $verbatimcopying = 1;
253 } elsif ($cmd eq "-seeinfo") {
254 $seeinfo = shift @ARGV;
255 } elsif ($cmd eq "-function") { # to only output specific functions
257 $function = shift @ARGV;
258 $function_table{$function} = 1;
259 } elsif ($cmd eq "-v") {
261 } elsif (($cmd eq "-h") || ($cmd eq "--help")) {
267 # dumps section contents to arrays/hashes intended for that purpose.
271 my $contents = join "\n", @_;
273 if ($name =~ m/$type_constant/) {
275 # print STDERR "constant section '$1' = '$contents'\n";
276 $constants{$name} = $contents;
277 } elsif ($name =~ m/$type_param/) {
278 # print STDERR "parameter def '$1' = '$contents'\n";
280 $parameters{$name} = $contents;
282 # print STDERR "other section '$name' = '$contents'\n";
283 $sections{$name} = $contents;
284 push @sectionlist, $name;
291 # parameters, a hash.
292 # function => "function name"
293 # parameterlist => @list of parameters
294 # parameters => %parameter descriptions
295 # sectionlist => @list of sections
296 # sections => %descriont descriptions
308 $output =~ s,\$1,$match1,g;
309 $output =~ s,\$2,$match2,g;
310 $output =~ s,\$3,$match3,g;
311 $output =~ s,\$4,$match4,g;
313 eval "\$return = qq/$output/";
315 # print "pattern $pattern matched 1=$match1 2=$match2 3=$match3 4=$match4 replace $repl yielded $output interpolated $return\n";
321 my $contents = join "\n", @_;
325 foreach $pattern (keys %highlights) {
326 # print "scanning pattern $pattern ($highlights{$pattern})\n";
327 $contents =~ s:$pattern:repstr($pattern, $highlights{$pattern}, $1, $2, $3, $4):gse;
329 foreach $line (split "\n", $contents) {
331 $ret = $ret . $lineprefix . $blankline;
333 $ret = $ret . $lineprefix . $line;
341 sub output_highlight {
342 print (just_highlight (@_));
348 my ($parameter, $section);
351 print "\@subheading ".$args{'function'}."\n";
352 print "\@anchor{".$args{'function'}."}\n";
353 print "\@deftypefun {" . $args{'functiontype'} . "} ";
354 print "{".$args{'function'}."} ";
357 foreach $parameter (@{$args{'parameterlist'}}) {
358 print $args{'parametertypes'}{$parameter}." \@var{".$parameter."}";
359 if ($count != $#{$args{'parameterlist'}}) {
365 foreach $parameter (@{$args{'parameterlist'}}) {
366 if ($args{'parameters'}{$parameter}) {
367 print "\@var{".$parameter."}: ";
368 output_highlight($args{'parameters'}{$parameter});
372 foreach $section (@{$args{'sectionlist'}}) {
373 print "\n\@strong{$section:} " if $section ne $section_default;
374 $args{'sections'}{$section} =~ s:([{}]):\@\1:gs;
375 output_highlight($args{'sections'}{$section});
377 print "\@end deftypefun\n\n";
383 my ($parameter, $section);
385 print "\n\n<a name=\"". $args{'function'} . "\"> </a><h2>Function</h2>\n";
387 print "<i>".$args{'functiontype'}."</i>\n";
388 print "<b>".$args{'function'}."</b>\n";
391 foreach $parameter (@{$args{'parameterlist'}}) {
392 print "<i>".$args{'parametertypes'}{$parameter}."</i> <b>".$parameter."</b>\n";
393 if ($count != $#{$args{'parameterlist'}}) {
400 print "<h3>Arguments</h3>\n";
402 foreach $parameter (@{$args{'parameterlist'}}) {
403 print "<dt><i>".$args{'parametertypes'}{$parameter}."</i> <b>".$parameter."</b>\n";
405 output_highlight($args{'parameters'}{$parameter});
408 foreach $section (@{$args{'sectionlist'}}) {
409 print "<h3>$section</h3>\n";
411 output_highlight($args{'sections'}{$section});
420 my ($parameter, $section);
422 my $func = $args{'function'};
431 print "\n\n\\subsection{". $func . "}\n\\label{" . $args{'function'} . "}\n";
433 $type = $args{'functiontype'};
436 print "{\\it ".$type."}\n";
437 print "{\\bf ".$func."}\n";
440 foreach $parameter (@{$args{'parameterlist'}}) {
441 $param = $args{'parametertypes'}{$parameter};
442 $param2 = $parameter;
444 $param2 =~ s/_/\\_/g;
446 print "{\\it ".$param."} {\\bf ".$param2."}";
447 if ($count != $#{$args{'parameterlist'}}) {
454 print "\n{\\large{Arguments}}\n";
456 print "\\begin{itemize}\n";
458 foreach $parameter (@{$args{'parameterlist'}}) {
459 $param1 = $args{'parametertypes'}{$parameter};
460 $param1 =~ s/_/\\_/g;
461 $param2 = $parameter;
462 $param2 =~ s/_/\\_/g;
465 print "\\item {\\it ".$param1."} {\\bf ".$param2."}: \n";
468 $param3 = $args{'parameters'}{$parameter};
469 $param3 =~ s/#([a-zA-Z\_]+)/{\\it \1}/g;
471 $out = just_highlight($param3);
476 print "\\item void\n";
478 print "\\end{itemize}\n";
480 foreach $section (@{$args{'sectionlist'}}) {
483 $sec =~ s/#([a-zA-Z\_]+)/{\\it \1}/g;
485 print "\n{\\large{$sec}}\\\\\n";
486 print "\\begin{rmfamily}\n";
488 $sec = $args{'sections'}{$section};
490 $sec =~ s/#([a-zA-Z\_]+)/{\\it \1}/g;
491 $sec =~ s/->/\$\\rightarrow\$/g;
492 $sec =~ s/([0-9]+)\^([0-9]+)/\$\{\1\}\^\{\2\}\$/g;
494 $out = just_highlight($sec);
498 print "\\end{rmfamily}\n";
504 # output in sgml DocBook
507 my ($parameter, $section);
511 $id = $args{'module'}."-".$args{'function'};
512 $id =~ s/[^A-Za-z0-9]/-/g;
514 print "<refentry>\n";
516 print "<refentrytitle><phrase id=\"$id\">".$args{'function'}."</phrase></refentrytitle>\n";
517 print "</refmeta>\n";
518 print "<refnamediv>\n";
519 print " <refname>".$args{'function'}."</refname>\n";
520 print " <refpurpose>\n";
521 print " ".$args{'purpose'}."\n";
522 print " </refpurpose>\n";
523 print "</refnamediv>\n";
525 print "<refsynopsisdiv>\n";
526 print " <title>Synopsis</title>\n";
527 print " <funcsynopsis>\n";
528 print " <funcdef>".$args{'functiontype'}." ";
529 print "<function>".$args{'function'}." ";
530 print "</function></funcdef>\n";
532 # print "<refsect1>\n";
533 # print " <title>Synopsis</title>\n";
534 # print " <funcsynopsis>\n";
535 # print " <funcdef>".$args{'functiontype'}." ";
536 # print "<function>".$args{'function'}." ";
537 # print "</function></funcdef>\n";
540 if ($#{$args{'parameterlist'}} >= 0) {
541 foreach $parameter (@{$args{'parameterlist'}}) {
542 print " <paramdef>".$args{'parametertypes'}{$parameter};
543 print " <parameter>$parameter</parameter></paramdef>\n";
548 print " </funcsynopsis>\n";
549 print "</refsynopsisdiv>\n";
550 # print "</refsect1>\n";
553 print "<refsect1>\n <title>Arguments</title>\n";
554 # print "<para>\nArguments\n";
555 if ($#{$args{'parameterlist'}} >= 0) {
556 print " <variablelist>\n";
557 foreach $parameter (@{$args{'parameterlist'}}) {
558 print " <varlistentry>\n <term><parameter>$parameter</parameter></term>\n";
559 print " <listitem>\n <para>\n";
561 output_highlight($args{'parameters'}{$parameter});
562 print " </para>\n </listitem>\n </varlistentry>\n";
564 print " </variablelist>\n";
566 print " <para>\n None\n </para>\n";
568 print "</refsect1>\n";
570 # print out each section
572 foreach $section (@{$args{'sectionlist'}}) {
573 print "<refsect1>\n <title>$section</title>\n <para>\n";
574 # print "<para>\n$section\n";
575 if ($section =~ m/EXAMPLE/i) {
576 print "<example><para>\n";
578 output_highlight($args{'sections'}{$section});
580 if ($section =~ m/EXAMPLE/i) {
581 print "</para></example>\n";
583 print " </para>\n</refsect1>\n";
593 my ($parameter, $section);
596 print ".\\\" DO NOT MODIFY THIS FILE! It was generated by gdoc.\n";
597 print ".TH \"$args{'function'}\" 3 \"$args{'sourceversion'}\" \"". $args{'module'} . "\" \"". $args{'module'} . "\"\n";
601 print $args{'function'};
602 if ($args{'purpose'}) {
603 print " \\- " . $args{'purpose'} . "\n";
605 print " \\- API function\n";
608 print ".SH SYNOPSIS\n";
609 print ".B #include <". $args{'include'} . ">\n"
611 print ".B #include <". lc((split /_/, $args{'function'})[0]) . ".h>\n"
612 if $args{'includefuncprefix'};
614 print ".BI \"".$args{'functiontype'}." ".$args{'function'}."(";
616 foreach $parameter (@{$args{'parameterlist'}}) {
617 print $args{'parametertypes'}{$parameter}." \" ".$parameter." \"";
618 if ($count != $#{$args{'parameterlist'}}) {
625 print ".SH ARGUMENTS\n";
626 foreach $parameter (@{$args{'parameterlist'}}) {
627 print ".IP \"".$args{'parametertypes'}{$parameter}." ".$parameter."\" 12\n";
628 $param = $args{'parameters'}{$parameter};
630 output_highlight($param);
632 foreach $section (@{$args{'sectionlist'}}) {
633 print ".SH \"" . uc($section) . "\"\n";
634 $sec = $args{'sections'}{$section};
636 output_highlight($sec);
639 if ($args{'bugsto'}) {
640 print ".SH \"REPORTING BUGS\"\n";
641 print "Report bugs to <". $args{'bugsto'} . ">.\n";
642 if ($args{'pkgname'}) {
643 print $args{'pkgname'} . " home page: " .
644 "http://www.gnu.org/software/" . $args{'module'} . "/\n";
646 print "General help using GNU software: http://www.gnu.org/gethelp/\n";
649 if ($args{'copyright'}) {
650 print ".SH COPYRIGHT\n";
651 print "Copyright \\(co ". $args{'copyright'} . ".\n";
652 if ($args{'verbatimcopying'}) {
654 print "Copying and distribution of this file, with or without modification,\n";
655 print "are permitted in any medium without royalty provided the copyright\n";
656 print "notice and this notice are preserved.\n";
660 if ($args{'seeinfo'}) {
661 print ".SH \"SEE ALSO\"\n";
662 print "The full documentation for\n";
663 print ".B " . $args{'module'} . "\n";
664 print "is maintained as a Texinfo manual. If the\n";
667 print ".B " . $args{'module'} . "\n";
668 print "programs are properly installed at your site, the command\n";
670 print ".B info " . $args{'seeinfo'} . "\n";
672 print "should give you access to the complete manual.\n";
676 sub output_listfunc {
678 print $args{'function'} . "\n";
685 my ($parameter, $section);
687 print "Function = ".$args{'function'}."\n";
688 print " return type: ".$args{'functiontype'}."\n\n";
689 foreach $parameter (@{$args{'parameterlist'}}) {
690 print " ".$args{'parametertypes'}{$parameter}." ".$parameter."\n";
691 print " -> ".$args{'parameters'}{$parameter}."\n";
693 foreach $section (@{$args{'sectionlist'}}) {
694 print " $section:\n";
696 output_highlight($args{'sections'}{$section});
701 # generic output function - calls the right one based
702 # on current output mode.
703 sub output_function {
705 eval "output_".$output_mode."(\@_);";
710 # takes a function prototype and spits out all the details
711 # stored in the global arrays/hsahes.
713 my $prototype = shift @_;
715 if ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\)]*)\)/ ||
716 $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\)]*)\)/ ||
717 $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\)]*)\)/ ||
718 $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\)]*)\)/ ||
719 $prototype =~ m/^(\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\)]*)\)/) {
724 # print STDERR "ARGS = '$args'\n";
726 foreach $arg (split ',', $args) {
727 # strip leading/trailing spaces
730 # print STDERR "SCAN ARG: '$arg'\n";
731 @args = split('\s', $arg);
733 # print STDERR " -> @args\n";
735 # print STDERR " -> @args\n";
736 if ($param =~ m/^(\*+)(.*)/) {
740 if ($param =~ m/^(.*)(\[\])$/) {
744 # print STDERR " :> @args\n";
745 $type = join " ", @args;
747 if ($parameters{$param} eq "" && $param != "void") {
748 $parameters{$param} = "-- undescribed --";
749 print STDERR "warning: $lineno: Function parameter '$param' not described in '$function_name'\n";
752 push @parameterlist, $param;
753 $parametertypes{$param} = $type;
755 # print STDERR "param = '$param', type = '$type'\n";
758 print STDERR "warning: $lineno: Cannot understand prototype: '$prototype'\n";
762 if ($function_only==0 || defined($function_table{$function_name})) {
763 output_function({'function' => $function_name,
764 'module' => $modulename,
765 'sourceversion' => $sourceversion,
766 'include' => $include,
767 'includefuncprefix' => $includefuncprefix,
769 'pkgname' => $pkgname,
770 'copyright' => $copyright,
771 'verbatimcopying' => $verbatimcopying,
772 'seeinfo' => $seeinfo,
773 'functiontype' => $return_type,
774 'parameterlist' => \@parameterlist,
775 'parameters' => \%parameters,
776 'parametertypes' => \%parametertypes,
777 'sectionlist' => \@sectionlist,
778 'sections' => \%sections,
779 'purpose' => $function_purpose
784 ######################################################################
788 # 1 - looking for function name
789 # 2 - scanning field start.
790 # 3 - scanning prototype.
794 $doc_special = "\@\%\$\#";
796 $doc_start = "^/\\*\\*\$";
798 $doc_com = "\\s*\\*\\s*";
799 $doc_func = $doc_com."(\\w+):?";
800 $doc_sect = $doc_com."([".$doc_special."[:upper:]][\\w ]+):\\s*(.*)";
801 $doc_content = $doc_com."(.*)";
810 $section_default = "Description"; # default section
811 $section = $section_default;
814 foreach $file (@ARGV) {
815 if (!open(IN,"<$file")) {
816 print STDERR "Error: Cannot open file $file\n";
824 $state = 1; # next line is always the function name
826 } elsif ($state == 1) { # this line is the function name (always)
831 $function_purpose = $1;
833 $function_purpose = "";
836 print STDERR "Info($lineno): Scanning doc for $function\n";
839 print STDERR "warning: $lineno: Cannot understand $_ on line $lineno",
840 " - I thought it was a doc line\n";
843 } elsif ($state == 2) { # look for head: lines, and include content
848 if ($contents ne "") {
849 dump_section($section, $contents);
850 $section = $section_default;
853 $contents = $newcontents;
854 if ($contents ne "") {
857 $section = $newsection;
858 } elsif (/$doc_end/) {
860 if ($contents ne "") {
861 dump_section($section, $contents);
862 $section = $section_default;
866 # print STDERR "end of doc comment, looking for prototype\n";
869 } elsif (/$doc_content/) {
870 # miguel-style comment kludge, look for blank lines after
871 # @parameter line to signify start of description
872 if ($1 eq "" && $section =~ m/^@/) {
873 dump_section($section, $contents);
874 $section = $section_default;
877 $contents .= $1."\n";
880 # i dont know - bad line? ignore.
881 print STDERR "warning: $lineno: Bad line: $_";
883 } elsif ($state == 3) { # scanning for function { (end of prototype)
884 if (m#\s*/\*\s+MACDOC\s*#io) {
891 $prototype =~ s@/\*.*?\*/@@gos; # strip comments.
892 $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
893 $prototype =~ s@^ +@@gos; # strip leading spaces
894 dump_function($prototype);
899 %parametertypes = ();