diff options
-rw-r--r-- | contrib/ChangeLog | 5 | ||||
-rwxr-xr-x | contrib/texi2pod.pl | 63 | ||||
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/Makefile.in | 12 |
4 files changed, 69 insertions, 16 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog index c6fedf91f70..5ea9651a2e6 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,8 @@ +2002-03-11 Zack Weinberg <zack@codesourcery.com> + + * texi2pod.pl: Handle @include, @ftable, @vtable. + Reformat some code for clarity. + 2002-02-24 Christian Jönsson <c.christian.joensson@telia.com> * test_summary: Additional to XPASS and FAIL, add UNRESOLVED, diff --git a/contrib/texi2pod.pl b/contrib/texi2pod.pl index 770671a17b5..0cae122a788 100755 --- a/contrib/texi2pod.pl +++ b/contrib/texi2pod.pl @@ -30,9 +30,12 @@ $section = ""; @icstack = (); @endwstack = (); @skstack = (); +@instack = (); $shift = ""; %defs = (); $fnno = 1; +$inf = ""; +$ibase = ""; while ($_ = shift) { if (/^-D(.*)$/) { @@ -58,14 +61,19 @@ while ($_ = shift) { } if (defined $in) { - open(STDIN, $in) or die "opening \"$in\": $!\n"; + $inf = gensym(); + open($inf, "<$in") or die "opening \"$in\": $!\n"; + $ibase = $1 if $in =~ m|^(.+)/[^/]+$|; +} else { + $inf = \*STDIN; } + if (defined $out) { open(STDOUT, ">$out") or die "opening \"$out\": $!\n"; } -while(<STDIN>) -{ +while(defined $inf) { +while(<$inf>) { # Certain commands are discarded without further processing. /^\@(?: [a-z]+index # @*index: useful only in complete manual @@ -109,8 +117,14 @@ while(<STDIN>) }; # handle variables - /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and $defs{$1} = $2, next; - /^\@clear\s+([a-zA-Z0-9_-]+)/ and delete $defs{$1}, next; + /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do { + $defs{$1} = $2; + next; + }; + /^\@clear\s+([a-zA-Z0-9_-]+)/ and do { + delete $defs{$1}; + next; + }; next unless $output; @@ -210,8 +224,21 @@ while(<STDIN>) # Single line command handlers. - /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/ and $_ = "\n=head2 $1\n"; - /^\@subsection\s+(.+)$/ and $_ = "\n=head3 $1\n"; + /^\@include\s+(.+)$/ and do { + push @instack, $inf; + $inf = gensym(); + + # Try cwd and $ibase. + open($inf, "<" . $1) + or open($inf, "<" . $ibase . "/" . $1) + or die "cannot open $1 or $ibase/$1: $!\n"; + next; + }; + + /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/ + and $_ = "\n=head2 $1\n"; + /^\@subsection\s+(.+)$/ + and $_ = "\n=head3 $1\n"; # Block command handlers: /^\@itemize\s+(\@[a-z]+|\*|-)/ and do { @@ -234,16 +261,16 @@ while(<STDIN>) $endw = "enumerate"; }; - /^\@table\s+(\@[a-z]+)/ and do { + /^\@([fv]?table)\s+(\@[a-z]+)/ and do { push @endwstack, $endw; push @icstack, $ic; - $ic = $1; + $endw = $1; + $ic = $2; $ic =~ s/\@(?:samp|strong|key|gcctabopt|env)/B/; $ic =~ s/\@(?:code|kbd)/C/; $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; $ic =~ s/\@(?:file)/F/; $_ = "\n=over 4\n"; - $endw = "table"; }; /^\@((?:small)?example|display)/ and do { @@ -266,6 +293,10 @@ while(<STDIN>) $section .= $shift.$_."\n"; } +# End of current file. +close($inf); +$inf = pop @instack; +} die "No filename or title\n" unless defined $fn && defined $tl; @@ -382,3 +413,15 @@ sub add_footnote $sects{FOOTNOTES} .= $_[0]; $sects{FOOTNOTES} .= "\n\n"; } + +# stolen from Symbol.pm +{ + my $genseq = 0; + sub gensym + { + my $name = "GEN" . $genseq++; + my $ref = \*{$name}; + delete $::{$name}; + return $ref; + } +} diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9a9478bfa32..31b03ba310f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-03-11 Zack Weinberg <zack@codesourcery.com> + + * Makefile.in: Give texi2pod its input file as a command line + argument, not on stdin. + 2002-03-11 Dan Nicolaescu <dann@ics.uci.edu> Daniel Berlin <dan@dberlin.org> diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 2aabcdb5c3e..46561c16852 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2333,7 +2333,7 @@ generated-manpages: $(docdir)/gcov.1 $(docdir)/cpp.1 $(docdir)/gcc.1 \ $(docdir)/gcov.1: $(docdir)/gcov.texi $(STAMP) $(docdir)/gcov.1 - -$(TEXI2POD) < $(docdir)/gcov.texi > gcov.pod + -$(TEXI2POD) $(docdir)/gcov.texi > gcov.pod -($(POD2MAN) --section=1 gcov.pod > $(docdir)/gcov.1.T$$$$ && \ mv -f $(docdir)/gcov.1.T$$$$ $(docdir)/gcov.1) || \ (rm -f $(docdir)/gcov.1.T$$$$ && exit 1) @@ -2341,7 +2341,7 @@ $(docdir)/gcov.1: $(docdir)/gcov.texi $(docdir)/cpp.1: $(docdir)/cpp.texi $(STAMP) $(docdir)/cpp.1 - -$(TEXI2POD) < $(docdir)/cpp.texi > cpp.pod + -$(TEXI2POD) $(docdir)/cpp.texi > cpp.pod -($(POD2MAN) --section=1 cpp.pod > $(docdir)/cpp.1.T$$$$ && \ mv -f $(docdir)/cpp.1.T$$$$ $(docdir)/cpp.1) || \ (rm -f $(docdir)/cpp.1.T$$$$ && exit 1) @@ -2349,7 +2349,7 @@ $(docdir)/cpp.1: $(docdir)/cpp.texi $(docdir)/gcc.1: $(docdir)/invoke.texi $(STAMP) $(docdir)/gcc.1 - -$(TEXI2POD) < $(docdir)/invoke.texi > gcc.pod + -$(TEXI2POD) $(docdir)/invoke.texi > gcc.pod -($(POD2MAN) --section=1 gcc.pod > $(docdir)/gcc.1.T$$$$ && \ mv -f $(docdir)/gcc.1.T$$$$ $(docdir)/gcc.1) || \ (rm -f $(docdir)/gcc.1.T$$$$ && exit 1) @@ -2357,7 +2357,7 @@ $(docdir)/gcc.1: $(docdir)/invoke.texi $(docdir)/gfdl.7: $(docdir)/include/fdl.texi $(STAMP) $(docdir)/gfdl.7 - -$(TEXI2POD) < $(docdir)/include/fdl.texi > gfdl.pod + -$(TEXI2POD) $(docdir)/include/fdl.texi > gfdl.pod -($(POD2MAN) --section=7 gfdl.pod > $(docdir)/gfdl.7.T$$$$ && \ mv -f $(docdir)/gfdl.7.T$$$$ $(docdir)/gfdl.7) || \ (rm -f $(docdir)/gfdl.7.T$$$$ && exit 1) @@ -2365,7 +2365,7 @@ $(docdir)/gfdl.7: $(docdir)/include/fdl.texi $(docdir)/gpl.7: $(docdir)/include/gpl.texi $(STAMP) $(docdir)/gpl.7 - -$(TEXI2POD) < $(docdir)/include/gpl.texi > gpl.pod + -$(TEXI2POD) $(docdir)/include/gpl.texi > gpl.pod -($(POD2MAN) --section=7 gpl.pod > $(docdir)/gpl.7.T$$$$ && \ mv -f $(docdir)/gpl.7.T$$$$ $(docdir)/gpl.7) || \ (rm -f $(docdir)/gpl.7.T$$$$ && exit 1) @@ -2373,7 +2373,7 @@ $(docdir)/gpl.7: $(docdir)/include/gpl.texi $(docdir)/fsf-funding.7: $(docdir)/include/funding.texi $(STAMP) $(docdir)/fsf-funding.7 - -$(TEXI2POD) < $(docdir)/include/funding.texi > fsf-funding.pod + -$(TEXI2POD) $(docdir)/include/funding.texi > fsf-funding.pod -($(POD2MAN) --section=7 fsf-funding.pod \ > $(docdir)/fsf-funding.7.T$$$$ && \ mv -f $(docdir)/fsf-funding.7.T$$$$ $(docdir)/fsf-funding.7) || \ |