]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Added Simon Josefsson's patch for gdoc. Now gdoc supports texinfo output.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 10 Sep 2002 16:29:32 +0000 (16:29 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 10 Sep 2002 16:29:32 +0000 (16:29 +0000)
doc/scripts/gdoc

index 9597148bb27270eebb7b48944682c42cb81715cd..f8a5b6b098235d12e17a38de1420b384bbec1768 100755 (executable)
@@ -2,6 +2,7 @@
 
 ## 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            ##
@@ -16,7 +17,7 @@
 # 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.
@@ -103,6 +104,12 @@ $type_env = "(\\\$\\w+)";
                     $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}",
@@ -133,7 +140,7 @@ $blankline_text = "";
 
 
 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;
@@ -164,6 +171,10 @@ while ($ARGV[0] =~ m/^-(.*)/) {
        $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;
@@ -242,6 +253,39 @@ sub output_highlight {
     }
 }
 
+# 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 {