OSDN Git Service

2005-10-28 Andrew Pinski <pinskia@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / contrib / texi2pod.pl
index d383945..9696a12 100755 (executable)
@@ -1,23 +1,23 @@
 #! /usr/bin/perl -w
 
-#   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+#   Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
 
-# This file is part of GNU CC.
+# This file is part of GCC.
 
-# GNU CC is free software; you can redistribute it and/or modify
+# GCC is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2, or (at your option)
 # any later version.
 
-# GNU CC is distributed in the hope that it will be useful,
+# GCC is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with GNU CC; see the file COPYING.  If not, write to
-# the Free Software Foundation, 59 Temple Place - Suite 330,
-# Boston MA 02111-1307, USA.
+# along with GCC; see the file COPYING.  If not, write to
+# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+# Boston MA 02110-1301, USA.
 
 # This does trivial (and I mean _trivial_) conversion of Texinfo
 # markup to Perl POD format.  It's intended to be used to extract
@@ -227,11 +227,12 @@ while(<$inf>) {
     /^\@include\s+(.+)$/ and do {
        push @instack, $inf;
        $inf = gensym();
+       $file = postprocess($1);
 
        # Try cwd and $ibase.
-       open($inf, "<" . $1
-           or open($inf, "<" . $ibase . "/" . $1)
-               or die "cannot open $1 or $ibase/$1: $!\n";
+       open($inf, "<" . $file
+           or open($inf, "<" . $ibase . "/" . $file)
+               or die "cannot open $file or $ibase/$file: $!\n";
        next;
     };
 
@@ -241,10 +242,14 @@ while(<$inf>) {
        and $_ = "\n=head3 $1\n";
 
     # Block command handlers:
-    /^\@itemize\s+(\@[a-z]+|\*|-)/ and do {
+    /^\@itemize(?:\s+(\@[a-z]+|\*|-))?/ and do {
        push @endwstack, $endw;
        push @icstack, $ic;
-       $ic = $1;
+       if (defined $1) {
+           $ic = $1;
+       } else {
+           $ic = '@bullet';
+       }
        $_ = "\n=over 4\n";
        $endw = "itemize";
     };
@@ -345,6 +350,13 @@ sub postprocess
     s/\@w\{([^\}]*)\}/S<$1>/g;
     s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;
 
+    # keep references of the form @ref{...}, print them bold
+    s/\@(?:ref)\{([^\}]*)\}/B<$1>/g;
+
+    # Change double single quotes to double quotes.
+    s/''/"/g;
+    s/``/"/g;
+
     # Cross references are thrown away, as are @noindent and @refill.
     # (@noindent is impossible in .pod, and @refill is unnecessary.)
     # @* is also impossible in .pod; we discard it and any newline that