[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS shishi/doc
From: |
shishi-commit |
Subject: |
CVS shishi/doc |
Date: |
Thu, 28 Oct 2004 13:43:51 +0200 |
Update of /home/cvs/shishi/doc
In directory dopio:/tmp/cvs-serv31633
Modified Files:
gdoc
Log Message:
Sync with libidn.
--- /home/cvs/shishi/doc/gdoc 2003/11/01 03:15:48 1.7
+++ /home/cvs/shishi/doc/gdoc 2004/10/28 11:43:51 1.8
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-## Copyright (c) 2002, 2003 Simon Josefsson ##
+## Copyright (c) 2002, 2003, 2004 Simon Josefsson ##
## added -texinfo, -listfunc ##
## man page revamp ##
## various improvements ##
@@ -21,7 +21,8 @@
# usage:
# gdoc [ -docbook | -html | -text | -man | -tex | -texinfo | -listfunc ]
-# [ -sourceversion verno ] [ -includefuncprefix ] [ -bugsto address ]
+# [ -sourceversion verno ] [ -include file | -includefuncprefix ]
+# [ -bugsto address ]
# [ -seeinfo infonode ] [ -copyright notice ] [ -verbatimcopying ]
# [ -function funcname [ -function funcname ...] ] c file(s)s > outputfile
#
@@ -32,10 +33,14 @@
# Version number for source code, e.g. '1.0.4'. Used in 'man' headers.
# Defaults to using current date.
#
+# -include FILE
+# For man pages, mention #include <FILE.h> in the synopsis.
+#
# -includefuncprefix
-# For man pages, generate a #include <FILE.h> based on the function
-# prefix. For example, a function gss_init_sec_context will generate
-# an include statement of #include <gss.h>.
+# For man pages, mention a #include <FILE.h> in the synopsis.
+# The FILE derived from the function prefix. For example, a
+# function gss_init_sec_context will generate an include
+# statement of #include <gss.h>.
#
# -bugsto address
# For man pages, include a section about reporting bugs and mention
@@ -103,8 +108,8 @@
# patterns, which are highlighted appropriately.
#
# 'funcname()' - function
-# '$ENVVAR' - environmental variable
-# '&struct_name' - name of a structure
+# '$ENVVAR' - environmental variable OBSOLETE (?)
+# '#struct_name' - name of a structure
# '@parameter' - name of a parameter
# '%CONST' - name of a constant.
@@ -120,10 +125,8 @@
# match expressions used to find embedded type information
$type_constant = "\\\%(\\w+)";
$type_func = "(\\w+\\(\\))";
-#$type_func = "((\\w|\\\\)+\\(\\))";
-#$type_func = "(\\(w||\\\\)+\\(\\))";
$type_param = "\\\@(\\w+)";
-$type_struct = "\\\&(\\w+)";
+$type_struct = "\\\#(\\w+)";
$type_env = "(\\\$\\w+)";
@@ -137,7 +140,7 @@
$type_param, "<tt><b>\$1</b></tt>" );
$blankline_html = "<p>";
-%highlights_texinfo = ( $type_constant, "address@hidden",
+%highlights_texinfo = ( $type_constant, "address@hidden",
$type_func, "address@hidden",
$type_struct, "address@hidden",
$type_param, "address@hidden" );
@@ -147,7 +150,7 @@
$type_func, "{\\\\bf \$1}",
$type_struct, "{\\\\it \$1}",
$type_param, "{\\\\bf \$1}" );
-$blankline_tex = "\\";
+$blankline_tex = "\\\\";
# sgml, docbook format
%highlights_sgml = ( $type_constant, "<replaceable
class=\"option\">\$1</replaceable>",
@@ -158,9 +161,9 @@
$blankline_sgml = "</para><para>\n";
# these are pretty rough
-%highlights_man = ( $type_constant, "\\n.I \\\"\$1\\\"\\n",
- $type_func, "\\n.B \\\"\$1\\\"\\n",
- $type_struct, "\\n.I \\\"\$1\\\"\\n",
+%highlights_man = ( "\\s*" .$type_constant . "\\s*", "\\n.I \\\"\$1\\\"\\n",
+ $type_func . "\\s*", "\\n.B \\\"\$1\\\"\\n",
+ $type_struct . "\\s*", "\\n.I \\\"\$1\\\"\\n",
$type_param."([\.\, ]*)\n?", "\\n.I \\\"\$1\$2\\\"\\n" );
$blankline_man = "";
@@ -174,7 +177,7 @@
sub usage {
print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -tex |
-texinfo -listfunc ]\n";
- print " [ -sourceversion verno ] [ -includefuncprefix ]\n";
+ print " [ -sourceversion verno ] [ -include file |
-includefuncprefix ]\n";
print " [ -bugsto address ] [ -seeinfo infonode ] [ -copyright
notice]\n";
print " [ -verbatimcopying ]\n";
print " [ -function funcname [ -function funcname ...] ]\n";
@@ -226,6 +229,8 @@
$modulename = shift @ARGV;
} elsif ($cmd eq "-sourceversion") {
$sourceversion = shift @ARGV;
+ } elsif ($cmd eq "-include") {
+ $include = shift @ARGV;
} elsif ($cmd eq "-includefuncprefix") {
$includefuncprefix = 1;
} elsif ($cmd eq "-bugsto") {
@@ -319,6 +324,27 @@
}
}
+sub just_highlight {
+ my $contents = join "\n", @_;
+ my $line;
+ my $ret = "";
+
+ foreach $pattern (keys %highlights) {
+# print "scanning pattern $pattern ($highlights{$pattern})\n";
+ $contents =~ s:$pattern:repstr($pattern, $highlights{$pattern}, $1, $2,
$3, $4):gse;
+ }
+ foreach $line (split "\n", $contents) {
+ if ($line eq ""){
+ $ret = $ret . $lineprefix . $blankline;
+ } else {
+ $ret = $ret . $lineprefix . $line;
+ }
+ $ret = $ret . "\n";
+ }
+
+ return $ret;
+}
+
# output in texinfo
sub output_texinfo {
my %args = %{$_[0]};
@@ -410,7 +436,7 @@
print "{\\it ".$type."}\n";
print "{\\bf ".$func."}\n";
- print "(\n";
+ print "(";
$count = 0;
foreach $parameter (@{$args{'parameterlist'}}) {
$param = $args{'parametertypes'}{$parameter};
@@ -418,7 +444,7 @@
$param =~ s/_/\\_/g;
$param2 =~ s/_/\\_/g;
- print "{\\it ".$param."} {\\bf ".$param2."}\n";
+ print "{\\it ".$param."} {\\bf ".$param2."}";
if ($count != $#{$args{'parameterlist'}}) {
$count++;
print ", ";
@@ -441,10 +467,11 @@
# print "\n";
$param3 = $args{'parameters'}{$parameter};
- $param3 =~ s/_/\\_/g;
- $param3 =~ s/&([a-zA-Z\_]+)/{\\it \1}/g;
+ $param3 =~ s/#([a-zA-Z\_]+)/{\\it \1}/g;
- output_highlight($param3);
+ $out = just_highlight($param3);
+ $out =~ s/_/\\_/g;
+ print $out;
}
if ($check==0) {
print "\\item void\n";
@@ -454,19 +481,21 @@
foreach $section (@{$args{'sectionlist'}}) {
$sec = $section;
$sec =~ s/_/\\_/g;
- $sec =~ s/&([a-zA-Z\_]+)/{\\it \1}/g;
+ $sec =~ s/#([a-zA-Z\_]+)/{\\it \1}/g;
- print "\n\\par{\\large{$sec}}\\par\n";
+ print "\n{\\large{$sec}}\\\\\n";
print "\\begin{rmfamily}\n";
$sec = $args{'sections'}{$section};
- $sec =~ s/_/\\_/g;
$sec =~ s/\\:/:/g;
- $sec =~ s/&([a-zA-Z\_]+)/{\\it \1}/g;
+ $sec =~ s/#([a-zA-Z\_]+)/{\\it \1}/g;
$sec =~ s/->/\$\\rightarrow\$/g;
$sec =~ s/([0-9]+)\^([0-9]+)/\$\{\1\}\^\{\2\}\$/g;
- output_highlight($sec);
+ $out = just_highlight($sec);
+ $out =~ s/_/\\_/g;
+
+ print $out;
print "\\end{rmfamily}\n";
}
print "\n";
@@ -572,6 +601,8 @@
print $args{'function'}."\n";
print ".SH SYNOPSIS\n";
+ print ".B #include <". $args{'include'} . ">\n"
+ if $args{'include'};
print ".B #include <". lc((split /_/, $args{'function'})[0]) . ".h>\n"
if $args{'includefuncprefix'};
print ".sp\n";
@@ -718,6 +749,7 @@
output_function({'function' => $function_name,
'module' => $modulename,
'sourceversion' => $sourceversion,
+ 'include' => $include,
'includefuncprefix' => $includefuncprefix,
'bugsto' => $bugsto,
'copyright' => $copyright,
@@ -744,13 +776,13 @@
$state = 0;
$section = "";
-$doc_special = "address@hidden&";
+$doc_special = "address@hidden";
$doc_start = "^/\\*\\*\$";
$doc_end = "\\*/";
$doc_com = "\\s*\\*\\s*";
$doc_func = $doc_com."(\\w+):?";
-$doc_sect = $doc_com."([".$doc_special."[:upper:]][\\w ]+):(.*)";
+$doc_sect = $doc_com."([".$doc_special."[:upper:]][\\w ]+):\\s*(.*)";
$doc_content = $doc_com."(.*)";
%constants = ();
- CVS shishi/doc, shishi-commit, 2004/10/14
- CVS shishi/doc,
shishi-commit <=