## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
## hacked to allow -tex option --nmav ##
+## hacked to allow -texinfo option --jas ##
## ##
## This software falls under the GNU Public License. Please read ##
## the COPYING file for more information ##
# Note: This only supports 'c'.
# usage:
-# gdoc [ -docbook | -html | -text | -man | -tex ]
+# gdoc [ -docbook | -html | -text | -man | -tex | -texinfo ]
# [ -function funcname [ -function funcname ...] ] c file(s)s > outputfile
#
# Set output format using one of -docbook -html -text or -man. Default is man.
$type_param, "<tt><b>\$1</b></tt>" );
$blankline_html = "<p>";
+%highlights_texinfo = ( $type_constant, "@var{\$1}",
+ $type_func, "@code{\$1}",
+ $type_struct, "@code{\$1}",
+ $type_param, "@code{\$1}" );
+$blankline_texinfo = "";
+
%highlights_tex = ( $type_constant, "{\\\\it \$1}",
$type_func, "{\\\\bf \$1}",
$type_struct, "{\\\\it \$1}",
sub usage {
- print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -tex ]\n";
+ print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -tex | -texinfo ]\n";
print " [ -function funcname [ -function funcname ...] ]\n";
print " c source file(s) > outputfile\n";
exit 1;
$output_mode = "tex";
%highlights = %highlights_tex;
$blankline = $blankline_tex;
+ } elsif ($cmd eq "-texinfo") {
+ $output_mode = "texinfo";
+ %highlights = %highlights_texinfo;
+ $blankline = $blankline_texinfo;
} elsif ($cmd eq "-text") {
$output_mode = "text";
%highlights = %highlights_text;
}
}
+# output in texinfo
+sub output_texinfo {
+ my %args = %{$_[0]};
+ my ($parameter, $section);
+ my $count;
+ print "\n\n";
+
+ print "\@deftypefun ";
+
+ print $args{'functiontype'};
+ print "\@code{".$args{'function'}."} ";
+ print "(";
+ $count = 0;
+ foreach $parameter (@{$args{'parameterlist'}}) {
+ print $args{'parametertypes'}{$parameter}." \@var{".$parameter."}";
+ if ($count != $#{$args{'parameterlist'}}) {
+ $count++;
+ print ", ";
+ }
+ }
+ print ")\n";
+ foreach $parameter (@{$args{'parameterlist'}}) {
+ if ($args{'parameters'}{$parameter}) {
+ print "\@var{".$parameter."}: ";
+ output_highlight($args{'parameters'}{$parameter});
+ print "\n";
+ }
+ }
+ foreach $section (@{$args{'sectionlist'}}) {
+ output_highlight($args{'sections'}{$section});
+ }
+ print "\@end deftypefun\n";
+}
# output in html
sub output_html {