From 7c69a43f50caf5df79c2265bd0fe1bd5fd341cf0 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 6 Dec 2011 15:12:43 +0000 Subject: 2011-12-06 Joel Sherrill PR 1793/doc * Makefile.am, configure.ac, bmenu/bmenu2.c: Convert from texi2www to texi2html. * texi2www/ChangeLog, texi2www/Makefile.am, texi2www/dir-arrow.gif, texi2www/missing-arrow.gif, texi2www/next-arrow.gif, texi2www/prev-arrow.gif, texi2www/texi2dvi, texi2www/texi2www, texi2www/texi2www.texi, texi2www/up-arrow.gif: Removed. --- doc/tools/ChangeLog | 10 + doc/tools/Makefile.am | 3 +- doc/tools/bmenu/bmenu2.c | 6 +- doc/tools/configure.ac | 2 +- doc/tools/texi2www/ChangeLog | 27 - doc/tools/texi2www/Makefile.am | 17 - doc/tools/texi2www/dir-arrow.gif | Bin 2609 -> 0 bytes doc/tools/texi2www/missing-arrow.gif | Bin 166 -> 0 bytes doc/tools/texi2www/next-arrow.gif | Bin 275 -> 0 bytes doc/tools/texi2www/prev-arrow.gif | Bin 279 -> 0 bytes doc/tools/texi2www/texi2dvi | 218 ------ doc/tools/texi2www/texi2www | 1316 ---------------------------------- doc/tools/texi2www/texi2www.texi | 708 ------------------ doc/tools/texi2www/up-arrow.gif | Bin 264 -> 0 bytes 14 files changed, 16 insertions(+), 2291 deletions(-) delete mode 100644 doc/tools/texi2www/ChangeLog delete mode 100644 doc/tools/texi2www/Makefile.am delete mode 100644 doc/tools/texi2www/dir-arrow.gif delete mode 100644 doc/tools/texi2www/missing-arrow.gif delete mode 100644 doc/tools/texi2www/next-arrow.gif delete mode 100644 doc/tools/texi2www/prev-arrow.gif delete mode 100644 doc/tools/texi2www/texi2dvi delete mode 100755 doc/tools/texi2www/texi2www delete mode 100644 doc/tools/texi2www/texi2www.texi delete mode 100644 doc/tools/texi2www/up-arrow.gif diff --git a/doc/tools/ChangeLog b/doc/tools/ChangeLog index 8fb689f3ea..3952a6cc6f 100644 --- a/doc/tools/ChangeLog +++ b/doc/tools/ChangeLog @@ -1,3 +1,13 @@ +2011-12-06 Joel Sherrill + + PR 1793/doc + * Makefile.am, configure.ac, bmenu/bmenu2.c: Convert from texi2www to + texi2html. + * texi2www/ChangeLog, texi2www/Makefile.am, texi2www/dir-arrow.gif, + texi2www/missing-arrow.gif, texi2www/next-arrow.gif, + texi2www/prev-arrow.gif, texi2www/texi2dvi, texi2www/texi2www, + texi2www/texi2www.texi, texi2www/up-arrow.gif: Removed. + 2011-02-02 Ralf Corsépius * configure.ac: Require autoconf-2.68, automake-1.11.1. diff --git a/doc/tools/Makefile.am b/doc/tools/Makefile.am index 88d9e30265..09fc48a109 100644 --- a/doc/tools/Makefile.am +++ b/doc/tools/Makefile.am @@ -3,4 +3,5 @@ ACLOCAL_AMFLAGS = -I ../../aclocal EXTRA_DIST = word-replace2 -SUBDIRS = bmenu texi2www +SUBDIRS = bmenu +#texi2www diff --git a/doc/tools/bmenu/bmenu2.c b/doc/tools/bmenu/bmenu2.c index edd9311a8e..01ffe893ae 100644 --- a/doc/tools/bmenu/bmenu2.c +++ b/doc/tools/bmenu/bmenu2.c @@ -12,7 +12,7 @@ * + previous of the first node * + next of the last node * - * COPYRIGHT (c) 1988-2002. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * All rights reserved. * @@ -777,7 +777,7 @@ void BuildTexinfoNodes( void ) if ( menu_items == 0 ) { new_line = AllocateLine(); - strcpy( new_line->Contents, "@ifinfo" ); + strcpy( new_line->Contents, "" ); /* "@ifinfo" ); */ _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); @@ -808,7 +808,7 @@ continue_menu_loop: _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); - strcpy( new_line->Contents, "@end ifinfo" ); + strcpy( new_line->Contents, "" ); /* "@end ifinfo" ); */ _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } diff --git a/doc/tools/configure.ac b/doc/tools/configure.ac index 39bdaa2673..4ea8b21dc0 100644 --- a/doc/tools/configure.ac +++ b/doc/tools/configure.ac @@ -21,8 +21,8 @@ dnl Checks for typedefs, structures, and compiler characteristics. dnl Checks for library functions. AC_CHECK_FUNCS(strdup strstr) +# texi2www/Makefile AC_CONFIG_FILES([Makefile bmenu/Makefile -texi2www/Makefile ]) AC_OUTPUT diff --git a/doc/tools/texi2www/ChangeLog b/doc/tools/texi2www/ChangeLog deleted file mode 100644 index 3154785d01..0000000000 --- a/doc/tools/texi2www/ChangeLog +++ /dev/null @@ -1,27 +0,0 @@ -2006-01-20 Ralf Corsepius - - * texi2www: Add provisory support for @image. - -2003-12-12 Ralf Corsepius - - * Makefile.am: Cosmetics. - -2003-09-22 Ralf Corsepius - - * Makefile.am: Merger from rtems-4-6-branch. - -2003-05-21 Ralf Corsepius - - * texi2www: Add support for @ifnottex. - -2002-03-27 Ralf Corsepius - - * Makefile.am: Remove AUTOMAKE_OPTIONS. - -2002-01-18 Ralf Corsepius - - * Makefile.am: require automake-1.5. - -2000-08-10 Joel Sherrill - - * ChangeLog: New file. diff --git a/doc/tools/texi2www/Makefile.am b/doc/tools/texi2www/Makefile.am deleted file mode 100644 index 4ebdd53e46..0000000000 --- a/doc/tools/texi2www/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -# -# COPYRIGHT (c) 1988-2002. -# On-Line Applications Research Corporation (OAR). -# All rights reserved. -# -# $Id$ -# - -noinst_SCRIPTS = texi2www texi2dvi - -EXTRA_DIST = $(noinst_SCRIPTS) dir-arrow.gif prev-arrow.gif \ - missing-arrow.gif up-arrow.gif next-arrow.gif texi2www.texi - -PROJECT = texi2www - -# TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex -# info_TEXINFOS = texi2www.texi diff --git a/doc/tools/texi2www/dir-arrow.gif b/doc/tools/texi2www/dir-arrow.gif deleted file mode 100644 index 5d661527cc..0000000000 Binary files a/doc/tools/texi2www/dir-arrow.gif and /dev/null differ diff --git a/doc/tools/texi2www/missing-arrow.gif b/doc/tools/texi2www/missing-arrow.gif deleted file mode 100644 index c686c80b5f..0000000000 Binary files a/doc/tools/texi2www/missing-arrow.gif and /dev/null differ diff --git a/doc/tools/texi2www/next-arrow.gif b/doc/tools/texi2www/next-arrow.gif deleted file mode 100644 index 57f5cddb81..0000000000 Binary files a/doc/tools/texi2www/next-arrow.gif and /dev/null differ diff --git a/doc/tools/texi2www/prev-arrow.gif b/doc/tools/texi2www/prev-arrow.gif deleted file mode 100644 index 350785be10..0000000000 Binary files a/doc/tools/texi2www/prev-arrow.gif and /dev/null differ diff --git a/doc/tools/texi2www/texi2dvi b/doc/tools/texi2www/texi2dvi deleted file mode 100644 index 913904a921..0000000000 --- a/doc/tools/texi2www/texi2dvi +++ /dev/null @@ -1,218 +0,0 @@ -#!/usr/bin/perl -# -# $Id$ -# - -$version = < 2) { - $font_prefix = "aa"; - } -} - -$unique_base = "_" . $$ . "a-"; -while (&prefix_in_use($unique_base)) {++$unique_base;} - -print "Generated files will begin with \`$unique_base\'\n" if $verbose; - -$arg_index = 'a'; -foreach $raw_texi (@ARGV) { - $base = $unique_base . $arg_index; - ++$arg_index; - - # $tawtexifile is a texinfo file; suffix must be either `.texi' or - # `.texinfo'. If arg is in a different directory, adjust - # TEXINPUTS environment variable to include that (and the current) - # directory. - unless ($raw_texi =~ /(.*).texi(nfo)?$/) { - print "skipping $raw_texi -- has unknown extension!\n"; - next; - } - $raw_texi_base = $1; - if ($raw_texi_base =~ m|^(.*)/([^/]*)$|) { - $raw_texi_base = $2; - $ENV{TEXINPUTS} = ".:$1:$texinputs"; - } else { - $ENV{TEXINPUTS} = ".:$texinputs"; - } - - unless (-r $raw_texi) { - print "skipping $raw_texi -- not readable or doesn't exist!\n"; - next; - } - - # Preprocesses the $rawtexifile (because of @gif{} and other extensions) - $processed_texi = "$base.texi"; - print "Preprocessing $raw_texi into $processed_texi:\n" if $verbose; - &preprocess_texinfo($raw_texi,$processed_texi,$base); - - print "$tex $processed_texi\n" if $verbose; - if (system("$tex $processed_texi") == 0) { - - # @possible_index_file = <$base.??>; only works for the - # first value of $base ... so, - opendir(DIR,".") || die "Couldn't read current directory -- $!\n"; - @possible_index_files = (); - while ($_ = readdir(DIR)) { - if (/^$base\...$/) { - push(@possible_index_files,$_); - } - } - closedir(DIR); - - @index_files = (); - foreach $possible_index_file (@possible_index_files) { - print "DEBUG: possible_index_file $possible_index_file\n" - if ($verbose > 1); - next unless (-s $possible_index_file); - push(@index_files,$possible_index_file); - } - - if (@index_files > 0) { - $texindex_cmd = "$texindex " . join(' ',@index_files); - print "$texindex_cmd\n" if $verbose; - if (system($texindex_cmd) == 0) { - print "$tex $processed_texi\n" if $verbose; - system("$tex $processed_texi"); - } - } - } - - # At this point, $base.dvi should exist -- rename it - # to $raw_texi_base.dvi - if (-e "$base.dvi") { - rename("$base.dvi","$raw_texi_base.dvi") - || die "rename $base.dvi $raw_texi_base.dvi -- $!\n"; - } -} -if ($cleanup) {unlink(<$base*>);} - -sub preprocess_texinfo -{ - local ($infile,$outfile,$b) = @_; - - open(IN,"<$infile") || die "Couldn't open $infile -- $!\n"; - open(OUT,">$outfile") || die "Couldn't open $outfile -- $!\n"; - - $gif_index = 'a'; - while () { - - # @gif{gif} or @gif{html_gif, tex_gif} - if (/(.*)\@gif\{([^{]*)\}(.*)/) { - $prefix = $1; - $arg = $2; - $suffix = $3; - print OUT "$prefix\n" if $prefix; - - while (1) { - $gif_base = $b . $gif_index; - last unless (-e $gif_base . ".gif"); - ++$gif_index; - } - - $gif_file = ''; - if ($arg =~ /.*,(..*\.gif)/) { - $gif_file = $1; - $font_base = $gif_file; - } else { - $font_base = $arg; - $gif_file = $gif_base . ".gif"; - print "Scaling $arg into $gif_file:\n" if $verbose; - $scale_cmd = "giftopnm $arg | pnmscale 2 | pnmnlfilt 2 1 " - . "| ppmquant 255 | ppmtogif > $gif_file"; - print "$scale_cmd\n" if $verbose; - if (system($scale_cmd) != 0) { - print "$scale_cmd failed\n"; - $gif_file = ''; - } - } - - if ($gif_file =~ /.*\.gif/) { - - - $font_base =~ s|.*/||; - $font_base =~ s|\..*||; - - # $font_base, due to bm2font requirements, can't be more - # than six characters long and must consist entirely of - # lower case letters. - $font_base =~ s/[^a-z]//g; - $font_base = $font_prefix . substr($font_base,0,5); - while (&prefix_in_use($font_base)) {++$font_base;} - - $bm2font_cmd = "bm2font -f$font_base $gif_file"; - print "$bm2font_cmd\n" if $verbose; - if (system($bm2font_cmd) != 0) { - print "$bm2font_cmd failed\n"; - } else { - print OUT "\@tex\n"; - print OUT "\\input $font_base.tex\n"; - print OUT "\\set$font_base\n"; - print OUT "\@end tex\n"; - } - } - - print OUT "$suffix \n" if $suffix; - } else { - print OUT "$_"; - } - } - close OUT; - close IN; -} - -sub prefix_in_use -{ - local ($p) = @_; - - # Returns true or false; returns true if any file in the current - # directory begins with $p. This function is here because - # `<$p*>' only works for the first value of $p! - - opendir(DIR,".") || die "Couldn't read current directory -- $!\n"; - while ($_ = readdir(DIR)) { - last if /^$p/; - } - closedir(DIR); - $rc = /^$p/; -} diff --git a/doc/tools/texi2www/texi2www b/doc/tools/texi2www/texi2www deleted file mode 100755 index 18e0ce3390..0000000000 --- a/doc/tools/texi2www/texi2www +++ /dev/null @@ -1,1316 +0,0 @@ -#!/usr/bin/perl -# (Works with both perl 4 and perl 5) -# -# $Id$ -# - -$version = 'Jan 2 1996'; -$copyright = < `$$' - $n =~ s/_/\$_/g; # `_' -> `$_' - $n =~ s/\s+/_/g; # whitespace -> `_' - - # anything else that's funky get - # translated to `$xx' where `xx' - # are hex digits. - while ($n =~ /(.*)([^-a-zA-Z0-9\$_.])(.*)/) { - $n = $1 . sprintf("\$%02x",ord($2)) . $3; - } - - if ($uselongnames) { - return "$p$n.html" if ($n); - } else { - if ($n eq 'Top') { - $lookup{"$p$n"}= "index.html"; - return $lookup{"$p$n"}; - } elsif ($n) { - if (! $lookup{"$p$n"}) { - $outcount = $outcount + 1; - #$lookup{"$p$n"}= "$base$outcount.html"; - $lookup{"$p$n"} = sprintf "%s%05d.html", $base, $outcount; - } - return $lookup{"$p$n"}; - } - } - return ""; -} # canonical - -######################################################################## -sub deduce_node_links -# -# On entry, $_ is a node line and $start_index is the index (in @texinfo) -# the node line. -# -# &deduce_node_links() sets $next, $prev, and $up. -{ - local ($level,$i,$node,$j); - - # First, search down from this node to the next sectioning command. - $level = &determine_node_level($start_index+1); - - # Next, look for the `next' node (i.e., the next node at the - # same or a higher level). - undef($next); - for ($i=$start_index+1; $i < $ntexinfo; ++$i) { - $_ = $texinfo[$i]; - next unless /^\@node +([^,]+).*\n/; - $j = &determine_node_level($i+1); - if ($j <= $level) { - if ($j == $level) {$next = $1;} - last; - } - } - - # Look for the `prev' and `up' nodes - undef($prev); - undef($up); - for ($i=$start_index-1; $i > 1; --$i) { - $_ = $texinfo[$i]; - next unless /^\@node\s+([^,]+).*\n/; - $j = &determine_node_level($i+1); - if ($j == $level) { - unless ($prev) {$prev = $1;} - } elsif ($j < $level) { - $up = $1; - last; - } - } - unless (defined($up)) {$up = "(dir)";} - - $xthis = $this; - $xthis =~ s/\n//; - -} # deduce_node_links - -######################################################################## -sub determine_node_level -{ - local ($i) = @_; - local ($level); - - $level = 0; - while ($i < $ntexinfo) { - $_ = $texinfo[$i]; - ++$i; - next if /^\s+$/; - last if (/\@node/); - last unless (/\@(\w+)/); - if ($directive_section{$1}) { - $level = $directive_section{$1}; - last; - } - } - - return $level; -} # determine_node_level - - -######################################################################## -sub expand_xref -{ - local ($cmd,$arg) = @_; - local ($node,$xrefname,$topic,$infofile,$manual,$url,$x); - - if ($cmd eq 'inforef') { - ($node,$xrefname,$infofile) = split(/,/,$arg); - $topic = $manual = ''; - } elsif ($cmd eq 'href') { - ($xrefname,$node,$infofile,$url) = split(/,/,$arg); - } elsif ($cmd eq 'email') { - ($xrefname,$node,$infofile,$url) = split(/,/,$arg); - $xrefname = "mailto:$xrefname"; - $url = $xrefname - } elsif ($cmd eq 'uref') { - ($url,$xrefname,$node,$infofile) = split(/,/,$arg); - } else { - ($node,$xrefname,$topic,$infofile,$manual) = split(/,/,$arg); - } - $xrefname =~ s/^\s+//; $infofile =~ s/^\s+//; - $xrefname =~ s/\s+$//; $infofile =~ s/\s+$//; - $xrefname =~ s/\s+/ /; $infofile =~ s/\s+/ /; - $infofile =~ s/\.texi$//; - $infofile =~ s/\.texinfo$//; - - if ($xrefname =~ /^$/) {$xrefname = $node;} - - $node = &canonical($node); - unless ($url) { - unless ($infofile =~ /^$/) {$url = "../$infofile/";} - $url = $url . $node; - } - $x = "$xrefname"; -} # expand_xref - -######################################################################## -sub get_more_stuff_to_parse -{ - $start_index = $texinfo_index; - - $_ = ''; - do { - if ($texinfo_index >= @texinfo) { - print "Unclosed \@x{y} in chunk beginning at " - . "$origin[$start_index]\n"; - return; - } - s/\n$/ /; - $more = $texinfo[$texinfo_index++]; - $more =~ s/\@\*/
\n/g; - $more =~ s/\@\./\./g; - $more =~ s/\@\://g; - $more =~ s/\@refill//g; - - $_ .= $more; - - # Expand all @a{b} in line - while (/\@(\w+)\{([^{}]*)\}/) { - $atcmd = $1; - $atarg = $2; - - if ($z = $atxy_2_zyz{$atcmd}) { - if ($z =~ /(.+),(.+),(.+)/) { - $left = $1; $z = $2; $right = $3; - } else { - $left = ''; $right = ''; - } - if ($z =~ s/^\^//) {$atarg =~ tr/a-z/A-Z/;} - $x = "$left<$z>$atarg$right"; - } elsif ($atxy_2_y{$atcmd}) { - $x = $atarg; - } elsif ($z = $atxy_2_z{$atcmd}) { - $x = $z; - } elsif ($z = $atxy_2_ref{$atcmd}) { - $x = $z . &expand_xref($atcmd,$atarg); - $x =~ s/^X//; # works because $z must start with 'X'! - } elsif ($atcmd eq 'value') { - $x = $texinfo_variable{$atarg}; - } elsif ($atcmd eq 'today') { - $x = &today(); - } elsif ($atcmd eq 'footnote') { - $footnote[$nfootnotes++] = $atarg; - $x = "\[$nfootnotes\]"; - } elsif ($atcmd eq 'gif') { - $atarg =~ s/,.*//; - ©_to_destdir($atarg); - $atarg =~ s|.*/||; - $x = ""; - } elsif ($atcmd eq 'image') { - my ($f,$w,$h,$a) = split(',',$atarg); - $f .= '.png'; - ©_to_destdir($f); - $x = "\"$a\""; $x\n" - if $debug{expansions}; - - s/\@\w+\{[^{}]*\}/$x/; - } - } while (/\@\w+\{[^}]*$/); - print "$origin[$start_index]: $_" if $debug{chunks}; -} # get_more_stuff_to_parse - -######################################################################## -sub parse -# On entry: -# $_ -- the line(s) to parse. -# $start_index -- where, in $texinfo, $_ begins. -{ - local ($x); - - if (/^\@(\w+)/) { - if ($x=$directive_block{$1}) { # @example, @quotation, etc. - &parse_block($1,$x); - } elsif ($directive_section{$1}) { # @chapter, @subsection, etc. - &process_section(); - } elsif ($1 eq 'bye') { - if ($nfootnotes > 0) { - &printHTML("


\n"); - for ($n=0; $n < $nfootnotes; ++$n) { - &printHTML("

\[" . ($n+1) . "\] $footnote[$n]

\n"); - } - } - &printHTML("


\n"); - &print_arrows; - &printHTML("

\n"); - &print_footer if $footer; - &printHTML("\n"); - close (HTML); - return; - } elsif ($1 eq 'center') { - /^\@center\s+(.*)/; - &printHTML("$paragraph_end") if $in_paragraph; - &printHTML("

$1

\n"); - $in_paragraph = 0; - } elsif ($1 eq 'clear') { - /^\@clear\s+(\S+)/; - undef($texinfo_variable{$1}); - } elsif ($1 =~ /^def(code)?index/) { - /^\@(def|defcode)index\s+(\w+)/; - $index_name{$2} = $2 . "index"; - $index_style{$2} = 'CODE' if ($1 eq "defcode"); - } elsif ($1 =~ /^(def.*)/) { # @defn, @defun, ... @deftp - &parse_def($1); - } elsif ($1 eq 'enumerate') { - &parse_enumerate(); - } elsif ($1 eq 'exdent') { - /^\@exdent\s+(.*)/; - &printHTML("$paragraph_end") if $in_paragraph; - # A bug -- doesn't exdent the line! - &printHTML("

$1

\n"); - $in_paragraph = 0; - } elsif ($1 eq 'flushleft' || $1 eq 'flushright') { - &parse_flush(); - } elsif ($1 eq 'html') { - while ($texinfo_index < @texinfo) { - &get_more_stuff_to_parse(); - last if (/^\@end\s+html/); - s/\"/\"/g; s/\>/\>/g; s/\</\\n"); - $in_paragraph = 1; - $paragraph_end = "

\n"; - } - } - &printHTML("$_"); - } - } -} # parse - -######################################################################## -sub parse_block -# -# Handles @example, @display, etc. -# -# > @example >
-#    > a + b = c     ==>   > a + b = c
-#    > @end example        > 
-{ - local ($block,$pre) = @_; - local ($started_at); - - $started_at = $start_index; - - &printHTML("$paragraph_end") if $in_paragraph; - $in_paragraph = 0; - - if ($pre eq '>PRE') { - &printHTML("
\n
\n");
-    } else {
-	&printHTML("<$pre>\n") unless ($pre eq '-');
-    }
-    $in_preformatted = $block;
-    while ($texinfo_index < @texinfo) {
-	&get_more_stuff_to_parse();
-	if (/^\@end\s+$block/) {
-	    if ($pre eq 'HR') {
-		&printHTML("\n");
-	    } elsif ($pre eq '>PRE') {
-		&printHTML("
\n
\n"); - } else { - &printHTML("\n") unless ($pre eq '-'); - } - $in_preformatted = 0; - return; - } - &parse(); - } - print "**ERROR** reached EOF while searching for end of the \@$block " - . "block that started on $origin[$started_at]\n"; -} # parse_block - -######################################################################## -sub parse_def -# $_ contains a @def* command -{ - local ($def) = @_; - local ($started_at,$in_dd); - - $started_at = $start_index; - - &printHTML("$paragraph_end") if $in_paragraph; - $in_paragraph = 0; - - &printHTML("
\n"); - - &printdef(); - - while ($texinfo_index < @texinfo) { - &get_more_stuff_to_parse(); - if (/^\@end\s+$def/) { - &printHTML("
\n"); - $in_paragraph = 0; - return; - } - if (s/^(\@def\w+)x\s/$1 /) {&printdef();} - else { - unless ($in_dd) { - &printHTML("
\n"); - ++$in_dd; - $in_paragraph = 1; - $paragraph_end = "\n"; - } - &parse(); - } - } - print "**ERROR** reached EOF while searching for end of the $def " - . "definition that started on $origin[$started_at]\n"; - -} # parse_def -sub printdef -{ - - s/\@defun(x?)\s/\@deffn Function / - || s/\@defmac(x?)\s/\@deffn Macro / - || s/\@defspec(x?)\s/\@deffn \{Special Form\} / - || s/\@defvar(x?)\s/\@defvr Variable / - || s/\@defopt(x?)\s/\@defvr \{User Option\} / - || s/\@deftypefun(x?)\s/\@deftypefn Function / - || s/\@deftypevar(x?)\s/\@deftypefn Variable / - || s/\@defivar(x?)\s/\@defcv \{Instance Variable\} / - || s/\@defmethod(x?)\s/\@defop Method /; - s/(\@\w+)x\s/$1 /; - - @words = split; - - $i = 1; - $category = $words[$i++]; - while ($i < @words && $category =~ /^\{[^}]*$/) { - $category .= ' ' . $words[$i++]; - } - if ($i>=@words) { - print "def error at $origin{$started_at}\n"; - } - $category =~ s/^\{//; - $category =~ s/\}$//; - - &printHTML("
$category: "); - - if ($words[0] eq '@deftypefn' || $words[0] eq '@deftypevr' - || $words[0] eq '@defcv' || $words[0] eq '@defop') { - if ($words[$i] =~ s/^\{//) { - &printHTML(""); - until ($words[$i] =~ s/\}$//) {&printHTML("$words[$i++]");} - &printHTML("$words[$i++] "); - } else { - &printHTML("$words[$i++] "); - } - $words[0] =~ /.*([a-z][a-z])/; - $_ = "\@" . $1 . "index " . $words[$i]; - &process_index; - } - &printHTML("$words[$i++]\n"); - - while ($i < @words) {&printHTML(" $words[$i++]");} - &printHTML("\n"); - -} # printdef - -######################################################################## -sub parse_enumerate -# $_ is `@enumerate'. Note that @enumerate with an arg (`@enumerate 3', -# for example) is kinda funky due to HTML limitations. -{ - local ($count,$started_at); - - $started_at = $start_index; - - &printHTML("$paragraph_end") if $in_paragraph; - $in_paragraph = 0; - - if (/^\@enumerate\s*(\S+)/) {$count = $1;} - - &printHTML("<" . ($count ? "UL" : "OL") . ">\n"); - - while ($texinfo_index < @texinfo) { - &get_more_stuff_to_parse(); - if (/^\@end\s+enumerate/) { - &printHTML("\n"); - return; - } - if (/^\@item\s+(.*)/ || /^\@item()$/) { - if ($count) { - &printHTML("
  • $count: $1\n"); - ++$count; - } else { - &printHTML("
  • $1\n"); - } - $in_paragraph = 1; - $paragraph_end = "\n"; - } else { - &parse(); - } - } - print "**ERROR** reached EOF while searching for end of the \@enumerate " - . "that started on $origin[$started_at]\n"; -} # parse_enumerate - -######################################################################## -sub parse_flush -{ - local ($started_at,$flush); - - /^\@(\w+)\s/; - $flush = $1; - $started_at = $start_index; - - &printHTML("$paragraph_end") if $in_paragraph; - $in_paragraph = 0; - - while ($texinfo_index < @texinfo) { - &get_more_stuff_to_parse(); - if (/^\@end\s+$flush/) { - return; - } - &parse(); - } - print "**ERROR** reached EOF while searching for end of the $flush " - . "that started on $origin[$started_at]\n"; - - -} # parse_flush - -######################################################################## -sub parse_itemize -# $_ is `@itemize'. Due to HTML limitation, `@itemize @bullet' comes -# out the same as `@itemize @minus'. -{ - local ($started_at); - - $started_at = $start_index; - - &printHTML("$paragraph_end") if $in_paragraph; - $in_paragraph = 0; - - &printHTML("
      \n"); - - - while ($texinfo_index < @texinfo) { - &get_more_stuff_to_parse(); - if (/^\@end\s+itemize/) { - &printHTML("
    \n"); - return; - } - if (/^\@item\s+(.*)/ || /^\@item()$/) { - &printHTML("
  • $1\n"); - $in_paragraph = 1; - $paragraph_end = "\n"; - } else { - &parse(); - } - } - print "**ERROR** reached EOF while searching for end of the itemize " - . "that started on $origin[$started_at]\n"; -} # parse_itemize - -######################################################################## -sub parse_menu -{ - local ($started_at); - - $started_at = $start_index; - - &printHTML("$paragraph_end") if $in_paragraph; - $in_paragraph = 0; - - &printHTML("\n"); - - while ($texinfo_index < @texinfo) { - &get_more_stuff_to_parse(); - if (/^\@end\s+menu/) { - &printHTML("\n"); - return; - } - - # Like ` * menu-item:: description of item' - if (/^\s*\*\s*([^:]*)\s*::\s*(.*)$/) { - &printHTML("$paragraph_end") if $in_paragraph; - $in_paragraph = 0; - $node = &canonical($1); - &printHTML("
  • $1\n"); - &printHTML("$2\n") if $2; - # Like ` * menu-item: cross-reference. description of item' - } elsif (/^\s*\*\s*([^:]*)\s*:([^.]*)\.\s*(.*)$/) { - &printHTML("$paragraph_end") if $in_paragraph; - $in_paragraph = 0; - $node = &canonical($2); - &printHTML("
  • $1\n"); - &printHTML("$3\n"); - } elsif (/^\@/) { - print "**WARNING** Don\'t know how to process \`$_\' inside " - . "a menu!\n"; - } else { - if (/^\s*$/ && !$in_paragraph) { - &printHTML("

    "); - $in_paragraph = "1"; - $paragraph_end = "

    \n"; - } - &printHTML("$_"); - } - } - print "**ERROR** reached EOF while searching for end of the menu " - . "that started on $origin[$started_at]\n"; -} # parse_menu - -######################################################################## -sub parse_table -# $_ is `@itemize'. Due to HTML limitation, `@itemize @bullet' comes -# out the same as `@itemize @minus'. -{ - local ($table,$ttype,$after_DT,$started_at,$first_para); - ($table,$ttype) = @_; - - $started_at = $start_index; - - &printHTML("$paragraph_end") if $in_paragraph; - $in_paragraph = 0; - - &printHTML("
    \n"); - - while ($texinfo_index < @texinfo) { - &get_more_stuff_to_parse(); - if (/^\@end\s+$table/) { - &printHTML("
    \n"); - return; - } - if (/^\@item(x?)\s+(.*)/ || /^\@item(x?)()$/) { - $atarg = $2; - if ($ttype) { - if ($ttype =~ /(.+),(.+),(.+)/) { - $left = $1; $z = $2; $right = $3; - } else { - $left = ''; $z = $ttype; $right = ''; - } - if ($z =~ s/^\^//) {$atarg =~ tr/a-z/A-Z/;} - &printHTML("
    $left<$z>$atarg$right\n"); - } else { - &printHTML("
    $2\n"); - } - $item = $2; - if ($item && $table =~ /([fv])table/) { - $_ = "\@" . $1 . "index " . $item; - &process_index; - } - $after_DT = 1; - } else { - if ($after_DT) { - &printHTML("
    \n"); - $in_paragraph = 1; - $paragraph_end = "\n"; - $after_DT = 0; - $first_para = 1; - } - unless ($first_para && /^\s*$/) { - $first_para = 0; - &parse(); - } - } - } - print "**ERROR** reached EOF while searching for end of the table " - . "that started on $origin[$started_at]\n"; -} # parse_table - -######################################################################## -sub print_index -{ - local ($index) = @_; - $index = $index_name{$index}; - - eval "\@keys = keys \%$index"; - - &printHTML("\n"); - foreach $item (sort texinfo_sort @keys) { - eval "\$val = \$$index\{\$item\}"; - &printHTML("
  • $val\n"); - } - &printHTML("
  • \n"); -} # print_index - -sub texinfo_sort -{ - $x = $a; $x =~ s/<[^>]*>//g; $x =~ tr/A-Z/a-z/; - $y = $b; $y =~ s/<[^>]*>//g; $y =~ tr/A-Z/a-z/; - $x cmp $y; -} # texinfo_sort - -######################################################################## -sub process_index -# -# For example, `@cindex whatever' generates an entry in %cpindex -# -{ - s/\@cindex/\@cpindex/ || s/\@findex/\@fnindex/ - || s/\@vindex/\@vrindex/ || s/\@kindex/\@kyindex/ - || s/\@pindex/\@pgindex/ || s/\@tindex/\@tpindex/; - - /\@(..)index\s+(.*)/; - - if ($x=$index_style{$1}) { - $entry = "<$x>$2"; - } else { - $entry = "$2"; - } - - print "*** \$$index_name{$1}\{$2\} = $entry\n" if $debug{'index'}; - eval "\$$index_name{$1}\{\$2\} = \$entry"; -} # process_index - -######################################################################## -sub print_arrows -{ - &printHTML("\n") if $next; - &printHTML("\n") if $prev; - &printHTML("\n") if $up; - &printHTML("\n") if $dirfile; - &printHTML("

    \n"); - if ($cprev) { - &printHTML("\"PREV\"\n"); - } else { - &printHTML("\"prev\"\n"); - } - if ($cup) { - &printHTML(" \"UP\"\n"); - } else { - &printHTML("\"up\"\n"); - } - if ($cnext) { - &printHTML("\"NEXT\"\n"); - } else { - &printHTML("\"next\"\n"); - } - if ($dirfile) { -# XXX need new graphic for this one - &printHTML(" \"Bookshelf\"\n"); - } else { - &printHTML("\"Bookshelf\"\n"); - } - &printHTML("$title") if $title; -} - -######################################################################## -sub process_node -# On entry, $_ is an @node line. -{ - s/^\@node\s+//; - ($this,$next,$prev,$up) = split(/,/); - - &deduce_node_links() unless ($next || $prev || $up); - - &terminate_node(); - - $cthis = &canonical($this); - $cnext = &canonical($next); - $cprev = &canonical($prev); - $cup = &canonical($up); - - print "... opening $dir$cthis ...\n" if $debug{nodes}; - open(HTML,">$dir/$cthis") || die "Couldn't open $dir$cthis -- $!\n"; - - $nfootnotes = 0; - - &printHTML("\n"); - &printHTML("\n"); - &print_header if $header; - &printHTML("\n$this\n"); - &print_arrows; - &printHTML("

    \n"); - -} # process_node - -sub terminate_node -{ - if ($nfootnotes) { - &printHTML("


    \n"); - for ($n=0; $n < $nfootnotes; ++$n) { - &printHTML("

    \[" . ($n+1) . "\] $footnote[$n]

    \n"); - } - } - - - &printHTML("


    \n"); - &print_arrows; - &printHTML("

    \n"); - &print_footer if $footer; - &printHTML("\n"); - close (HTML); -} - -######################################################################## -sub process_section -# -# On entry: -# $_ is the section command (I.e. `@chapter Overview') -# $i is the index to $_ in @lines -{ - &printHTML("$paragraph_end") if $in_paragraph; - $in_paragraph = 0; - - /^\@(\w+)\s+(.*)/; - - $section_number = ''; - if ($1 eq 'chapter') { - ++$chapter; $section=$subsection=$subsubsection=0; - $section_number = "Chapter $chapter: "; - } elsif ($1 eq 'section') { - ++$section; $subsection=$subsubsection=0; - $section_number = "$chapter.$section: "; - } elsif ($1 eq 'subsection') { - ++$subsection; $subsubsection=0; - $section_number = "$chapter.$section.$subsection: "; - } elsif ($1 eq 'subsubsection') { - ++$subsubsection; - $section_number = "$chapter.$section.$subsection.$subsubsection: "; - } elsif ($1 eq 'appendix') { - ++$appendix; $section=$subsection=$subsubsection=0; - $x = ('A'..'Z')[$appendix-1]; - $section_number = "Appendix $x: "; - } elsif ($1 eq 'appendixsec') { - ++$section; $subsection=$subsubsection=0; - $x = ('A'..'Z')[$appendix-1]; - $section_number = "$x.$section: "; - } elsif ($1 eq 'appendixsubsec') { - ++$subsection; $subsubsection=0; - $x = ('A'..'Z')[$appendix-1]; - $section_number = "$x.$section.$subsection: "; - } elsif ($1 eq 'appendixsubsubsec') { - ++$subsubsection; - $x = ('A'..'Z')[$appendix-1]; - $section_number = "$x.$section.$subsection.$subsubsection: "; - } - - $x = $directive_section{$1}; - &printHTML("$section_number$2\n"); -} # process_section - -######################################################################## -sub process_synindex -# -# There's perhaps a bug here -- this presumes the @synindex comes before -# any @?index directives; anything already in doesn't get merged -# into ! -# -{ - local ($code) = @_; # Either 0 or 1; 1 means @syncodeindex - - /\@syn\w*index\s+(\w+)\s+(\w+)/; - - print "*** synindex $1 $2\n" if $debug{'index'}; - - $index_name{$1} = $2 . "index"; - $index_style{$1} = 'CODE' if $code; -} # process_synindex - -######################################################################## -sub printHTML -{ - local ($line) = @_; - $line =~ s/\$R/\}/g; - $line =~ s/\$L/\{/g; - $line =~ s/\$A/\@/g; - $line =~ s/\$D/\$/g; - if ($debug{printHTML}) { - print $line; - } else { - print HTML $line; - } -} # printHTML - -######################################################################## -sub print_header -{ - unless (open(HEADER,$header)) { - print "WARNING -- couldn't open header file \"$header\" -- $!\n"; - $header = 0; - return; - } - while (
    ) { - &printHTML($_); - } - close(HEADER); -} - -######################################################################## -sub print_footer -{ - unless (open(FOOTER,$footer)) { - print "WARNING -- couldn't open footer file \"$footer\" -- $!\n"; - $footer = 0; - return; - } - while (