Rip out the old PostScript backend and make the new one official.
authorH. Peter Anvin <hpa@zytor.com>
Thu, 16 May 2002 18:15:31 +0000 (18:15 +0000)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 16 May 2002 18:15:31 +0000 (18:15 +0000)
doc/Makefile.in
doc/rdsrc.pl

index 8a07b28..b5b90bd 100644 (file)
@@ -34,19 +34,14 @@ nasmdoc.dip: nasmdoc.src rdsrc.pl
        $(PERL) $(srcdir)/rdsrc.pl < $<
        mv -f *.html html
 
-nasmdoc.ps: nasmdoc.dip
-       : Generated by side effect
-
 nasmdoc.texi: nasmdoc.dip
        : Generated by side effect
 
-new: nasmdocx.ps nasmdocx.pdf
+nasmdoc.ps: nasmdoc.dip nasmlogo.eps genps.pl psfonts.ph pswidth.ph head.ps
+       $(PERL) $(srcdir)/genps.pl nasmdoc.dip > nasmdoc.ps
 
-nasmdocx.ps: nasmdoc.dip nasmlogo.eps genps.pl psfonts.ph pswidth.ph head.ps
-       $(PERL) $(srcdir)/genps.pl nasmdoc.dip > nasmdocx.ps
-
-nasmdocx.pdf: nasmdocx.ps
-       $(PS2PDF) nasmdocx.ps nasmdocx.pdf
+nasmdoc.pdf: nasmdoc.ps
+       $(PS2PDF) nasmdoc.ps nasmdoc.pdf
 
 nasm.info: info/nasm.info
 
@@ -59,10 +54,6 @@ info/nasm.info: nasmdoc.texi
 nasmdoc.dvi: nasmdoc.texi
        $(TEXI2DVI) nasmdoc.texi
 
-# PDF output
-nasmdoc.pdf: nasmdoc.ps
-       $(PS2PDF) nasmdoc.ps nasmdoc.pdf
-
 # Rules for building an OS/2 book
 nasmdoc.ipf: nasmdoc.texi
        texi2ipf $< >$@
@@ -77,7 +68,7 @@ clean:
 spotless: clean
        -rm -rf html info
        -rm -f *.hlp *.txt *.inf *.pdf *.dvi
-       -rm -f nasmdoc.ps nasmdocx.ps
+       -rm -f nasmdoc*.ps
 
 install: all
        $(INSTALL_DATA) info/* $(INSTALLROOT)$(infodir)
index e2ee82c..7775d43 100644 (file)
@@ -133,9 +133,6 @@ print "done.\n";
 print "Producing HTML output: ";
 &write_html;
 print "done.\n";
-print "Producing PostScript output: ";
-&write_ps;
-print "done.\n";
 print "Producing Texinfo output: ";
 &write_texi;
 print "done.\n";
@@ -872,842 +869,6 @@ sub word_html {
   }
 }
 
-sub ref_ps {
-    my($r) = @_;
-    $r =~ s/\./_/g;
-    return 'n'.$r;
-}
-
-sub ps_write_bookmarks {
-    my $para;
-    my %nchildren = ();
-    my %titles = ();
-    my @reflist = ();
-    my $ref, $pref, $i, $title;
-
-    for ($para = 0; $para <= $#pnames; $para++) {
-       my $pname = $pnames[$para];
-       my $pflags = $pflags[$para];
-       my $ptype = substr($pflags,0,4);
-       
-       if ($ptype eq "chap" || $ptype eq "appn") {
-           # Chapter/appendix heading. "Chapter N: Title" followed by a line of
-           # minus signs.
-           
-           $pflags =~ /(chap|appn) (.*) :(.*)/;
-           $ref = &ref_ps($2);
-           $title = '';
-           foreach $i (@$pname) {
-               $title .= &word_ps_title($i);
-           }
-           $titles{$ref} = $title;
-           push @reflist, $ref;
-       } elsif ($ptype eq "head" || $ptype eq "subh") {
-           # Heading/subheading.  Just a number and some text.
-           $pflags =~ /.... (.*) :(.*)/;
-           $ref = &ref_ps($1);
-           $ref =~ /^(n[0-9A-Za-z_]+)\_[0-9A-Za-z]+$/;
-           $pref = $1;
-
-           $title = '';
-           foreach $i (@$pname) {
-               $title .= &word_ps_title($i);
-           }
-           $titles{$ref} = $title;
-           push @reflist, $ref;
-           $nchildren{$pref}++;
-       }
-    }
-
-    # Now we should have enough data to generate the bookmarks
-    print "[/Title (Contents) /Dest /nContents /OUT pdfmark";
-    foreach $i ( @reflist ) {
-       print '[/Title (', $titles{$i}, ")\n";
-       print '/Count -', $nchildren{$i}, ' ' if ( $nchildren{$i} );
-       print "/Dest /$i /OUT pdfmark\n";
-    }
-    print "[/Title (Index) /Dest /nIndex /OUT pdfmark\n";
-}
-
-sub write_ps {
-  # This is called from the top level, so I won't bother using
-  # my or local.
-
-  # First, set up the font metric arrays.
-  &font_metrics;
-
-  # First stage: reprocess the source arrays into a list of
-  # lines, each of which is a list of word-strings, each of
-  # which has a single-letter font code followed by text.
-  # Each line also has an associated type, which will be
-  # used for final alignment and font selection and things.
-  #
-  # Font codes are:
-  #   n == Normal
-  #   e == Emphasised
-  #   c == Code
-  #  ' ' == space (no following text required)
-  #  '-' == dash (no following text required)
-  #
-  # Line types are:
-  #   chap == Chapter or appendix heading.
-  #   head == Major heading.
-  #   subh == Sub-heading.
-  #   Ccha == Contents entry for a chapter.
-  #   Chea == Contents entry for a heading.
-  #   Csub == Contents entry for a subheading.
-  #   cone == Code paragraph with just this one line on it.
-  #   cbeg == First line of multi-line code paragraph.
-  #   cbdy == Interior line of multi-line code paragraph.
-  #   cend == Final line of multi-line code paragraph.
-  #   none == Normal paragraph with just this one line on it.
-  #   nbeg == First line of multi-line normal paragraph.
-  #   nbdy == Interior line of multi-line normal paragraph.
-  #   nend == Final line of multi-line normal paragraph.
-  #   bone == Bulleted paragraph with just this one line on it.
-  #   bbeg == First line of multi-line bulleted paragraph.
-  #   bbdy == Interior line of multi-line bulleted paragraph.
-  #   bend == Final line of multi-line bulleted paragraph.
-  print "line-breaks...";
-  $lname = "psline000000";
-  $lnamei = "idx" . $lname;
-  @lnames = @ltypes = ();
-
-  $linewidth = 468;            # ADJUSTABLE: width of a normal text line
-  $bulletadj = 12;             # ADJUSTABLE: space for a bullet
-
-  for ($para = 0; $para <= $#pnames; $para++) {
-    $pname = $pnames[$para];
-    $pflags = $pflags[$para];
-    $ptype = substr($pflags,0,4);
-
-    # New paragraph _ergo_ new line.
-    @line = ();
-    @lindex = (); # list of index tags referenced to this line
-
-    if ($ptype eq "chap") {
-      # Chapter heading. "Chapter N: Title" followed by a line of
-      # minus signs.
-      $pflags =~ /chap (.*) :(.*)/;
-      push @line, "B".&ref_ps($1), "nChapter", " ", "n$1:", " ";
-      foreach $i (@$pname) {
-        $ww = &word_ps($i);
-        push @line, $ww unless $ww eq "x";
-      }
-      @$lname = @line; @$lnamei = @lindex;
-      push @lnames, $lname++;
-      $lnamei = "idx" . $lname;
-      push @ltypes, "chap";
-    } elsif ($ptype eq "appn") {
-      # Appendix heading. "Appendix N: Title" followed by a line of
-      # minus signs.
-      $pflags =~ /appn (.*) :(.*)/;
-      push @line, "B".&ref_ps($1), "nAppendix", " ", "n$1:", " ";
-      foreach $i (@$pname) {
-        $ww = &word_ps($i);
-        push @line, $ww unless $ww eq "x";
-      }
-      @$lname = @line; @$lnamei = @lindex;
-      push @lnames, $lname++;
-      $lnamei = "idx" . $lname;
-      push @ltypes, "chap";
-    } elsif ($ptype eq "head") {
-      # Heading. Just a number and some text.
-      $pflags =~ /.... (.*) :(.*)/;
-      push @line, "B".&ref_ps($1), "n$1";
-      foreach $i (@$pname) {
-        $ww = &word_ps($i);
-        push @line, $ww unless $ww eq "x";
-      }
-      @$lname = @line; @$lnamei = @lindex;
-      push @lnames, $lname++;
-      $lnamei = "idx" . $lname;
-      push @ltypes, $ptype;
-    } elsif ($ptype eq "subh") {
-      # Subheading. Just a number and some text.
-      $pflags =~ /subh (.*) :(.*)/;
-      push @line, "B".&ref_ps($1), "n$1";
-      foreach $i (@$pname) {
-        push @line, &word_ps($i);
-      }
-      @$lname = @line; @$lnamei = @lindex;
-      push @lnames, $lname++;
-      $lnamei = "idx" . $lname;
-      push @ltypes, "subh";
-    } elsif ($ptype eq "code") {
-      # Code paragraph. Emit lines one at a time.
-      $type = "cbeg";
-      foreach $i (@$pname) {
-        @$lname = ("c$i");
-       push @lnames, $lname++;
-       $lnamei = "idx" . $lname;
-       push @ltypes, $type;
-       $type = "cbdy";
-      }
-      $ltypes[$#ltypes] = ($ltypes[$#ltypes] eq "cbeg" ? "cone" : "cend");
-    } elsif ($ptype eq "bull" || $ptype eq "norm") {
-      # Ordinary paragraph, optionally bulleted. We wrap, with ragged
-      # 75-char right margin and either 7 or 11 char left margin
-      # depending on bullets.
-      if ($ptype eq "bull") {
-       $width = $linewidth - $bulletadj;
-       $type = $begtype = "bbeg";
-       $bodytype = "bbdy";
-       $onetype = "bone";
-       $endtype = "bend";
-      } else {
-       $width = $linewidth;
-       $type = $begtype = "nbeg";
-       $bodytype = "nbdy";
-       $onetype = "none";
-       $endtype = "nend";
-      }
-      @a = @$pname;
-      @line = @wd = ();
-      $linelen = 0;
-      $wprev = undef;
-      do {
-        do { $w = &word_ps(shift @a) } while ($w eq "x");
-       push @wd, $wprev if $wprev;
-       if ($wprev =~ /^n.*-$/ || $w eq ' ' || $w eq '' || $w eq undef) {
-         $wdlen = &len_ps(@wd);
-         if ($linelen + $wdlen > $width) {
-           pop @line while $line[$#line] eq ' '; # trim trailing spaces
-           @$lname = @line; @$lnamei = @lindex;
-           push @lnames, $lname++;
-           $lnamei = "idx" . $lname;
-           push @ltypes, $type;
-           $type = $bodytype;
-           @line = @lindex = ();
-           $linelen = 0;
-           shift @wd while $wd[0] eq ' '; # trim leading spaces
-         }
-         push @line, @wd;
-         $linelen += $wdlen;
-         @wd = ();
-       }
-       $wprev = $w;
-      } while ($w ne '' && $w ne undef);
-      if (@line) {
-        pop @line while $line[$#line] eq ' '; # trim trailing spaces
-       @$lname = @line; @$lnamei = @lindex;
-       push @lnames, $lname++;
-       $lnamei = "idx" . $lname;
-       push @ltypes, $type;
-       $type = $bodytype;
-      }
-      $ltypes[$#ltypes] =
-        ($ltypes[$#ltypes] eq $begtype ? $onetype : $endtype);
-    }
-  }
-
-  # We've now processed the document source into lines. Before we
-  # go on and do the page breaking, we'll fabricate a table of contents,
-  # line by line, and then after doing page breaks we'll go back and
-  # insert the page numbers into the contents entries.
-  print "building contents...";
-  @clnames = @cltypes = ();
-  $clname = "pscont000000";
-  @$clname = ("BnContents", "nContents"); # "chapter heading" for TOC
-  push @clnames,$clname++;
-  push @cltypes,"chap";
-  for ($i=0; $i<=$#lnames; $i++) {
-    $lname = $lnames[$i];
-    if ($ltypes[$i] =~ /^(chap|head|subh)/) {
-      @$clname = @$lname;
-      splice @$clname,2,0," " if ($ltypes[$i] !~ /chap/);
-      push @$clname,$i; # placeholder for page number
-      push @clnames,$clname++;
-      push @cltypes,"C" . substr($ltypes[$i],0,3);
-    }
-  }
-  @$clname = ("BnIndex", "nIndex"); # contents entry for Index
-  push @$clname,$i;      # placeholder for page number
-  $idx_clname = $clname;
-  push @clnames,$clname++;
-  push @cltypes,"Ccha";
-  $contlen = $#clnames + 1;
-  unshift @lnames,@clnames;
-  unshift @ltypes,@cltypes;
-
-  # Second stage: now we have a list of lines, break them into pages.
-  # We do this by means of adding a third array in parallel with
-  # @lnames and @ltypes, called @lpages, in which we store the page
-  # number that each line resides on. We also add @ycoord which
-  # stores the vertical position of each line on the page.
-  #
-  # Page breaks may not come after line-types:
-  #   chap head subh cbeg nbeg bbeg
-  # and may not come before line-types:
-  #   cend nend bend
-  # They are forced before line-types:
-  #   chap
-  print "page-breaks...";
-  $pmax = 600; # ADJUSTABLE: maximum length of a page in points
-  $textht = 11; # ADJUSTABLE: height of a normal line in points
-  $spacing = 6; # ADJUSTABLE: space between paragraphs, in points
-  $headht = 14; # ADJUSTABLE: height of a major heading in points
-  $subht = 12; # ADJUSTABLE: height of a sub-heading in points
-  $pstart = 0; # start line of current page
-  $plen = 0; # current length of current page
-  $pnum = 1; # number of current page
-  $bpt = -1; # last feasible break point
-  $i = 0; # line number
-  while ($i <= $#lnames) {
-    $lname = $lnames[$i];
-    # Add the height of this line (computed the last time we went round
-    # the loop, unless we're a chapter heading in which case we do it
-    # now) to the length of the current page. Also, _put_ this line on
-    # the current page, and allocate it a y-coordinate.
-    if ($ltypes[$i] =~ /^chap$/) {
-      $pnum += 1 - ($pnum & 1);  # advance to odd numbered page if necessary
-      $plen = 100; # ADJUSTABLE: space taken up by a chapter heading
-      $ycoord[$i] = 0; # chapter heading: y-coord doesn't matter
-    } else {
-      $ycoord[$i] = $plen + $space;
-      $plen += $space + $ht;
-    }
-    # See if we can break after this line.
-    $bpt = $i if $ltypes[$i] !~ /^chap|head|subh|cbeg|nbeg|bbeg$/ &&
-                $ltypes[$i+1] !~ /^cend|nend|bend$/;
-    # Assume, to start with, that we don't break after this line.
-    $break = 0;
-    # See if a break is forced.
-    $break = 1, $bpt = $i if $ltypes[$i+1] eq "chap" || !$ltypes[$i+1];
-    # Otherwise, compute the height of the next line, and break if
-    # it would make this page too long.
-    $ht = $textht, $space = 0 if $ltypes[$i+1] =~ /^[nbc](bdy|end)$/;
-    $ht = $textht, $space = $spacing if $ltypes[$i+1] =~ /^[nbc](one|beg)$/;
-    $ht = $textht, $space = $spacing if $ltypes[$i+1] =~ /^C/;
-    $ht = $subht, $space = $spacing if $ltypes[$i+1] eq "subh";
-    $ht = $headht, $space = $spacing if $ltypes[$i+1] eq "head";
-    $break = 1 if $plen + $space + $ht > $pmax;
-    # Now, if we're breaking, assign page number $pnum to all lines up
-    # to $bpt, set $i == $bpt+1, and zero $space since we are at the
-    # start of a new page and don't want leading space.
-    if ($break) {
-      die "no feasible break point at all on page $pnum\n" if $bpt == -1;
-      for ($j = $pstart; $j <= $bpt; $j++) {
-       $lnamei = "idx" . $lnames[$j];
-       foreach $k (@$lnamei) {
-         ${$psidxpp{$k}}{$pnum} = 1;
-       }
-        $lpages[$j] = $pnum;
-      }
-      $pnum++;
-      $i = $bpt;
-      $bpt = -1;
-      $pstart = $i+1;
-      $plen = 0;
-      $space = 0;
-    }
-    $i++;
-  }
-
-  # Now fix up the TOC with page numbers.
-  print "\n   fixing up contents...";
-  for ($i=0; $i<=$#lnames; $i++) {
-    $lname = $lnames[$i];
-    if ($ltypes[$i] =~ /^C/) {
-      $j = pop @$lname;
-      push @$lname, "n" . $lpages[$j+$contlen];
-    }
-  }
-
-  # Having got page numbers for most stuff, generate an index.
-  print "building index...";
-  $iwid = 222;
-  $sep = 12;
-  $commaindent = 32;
-  foreach $k (@itags) {
-    @line = ();
-    $cmd = "index";
-    @idxentry = @{$idxmap{$k}};
-    if ($commaafter{$k} and !$commanext{$k}) {
-      # This line is a null line beginning a multiple entry. We must
-      # output the prefix on a line by itself.
-
-      @idxhead = splice @idxentry,0,$commapos{$k};
-      @line = ();
-      foreach $i (@idxhead) {
-        $ww = &word_ps($i);
-       push @line, $ww unless $ww eq "x";
-      }
-      &ps_idxout("index",\@line,[]);
-      $cmd = "iindex";
-      @line = ();
-    }
-    $cmd = "iindex", splice @idxentry,0,$commapos{$k} if $commanext{$k};
-    foreach $i (@idxentry) {
-      $ww = &word_ps($i);
-      push @line, $ww unless $ww eq "x";
-    }
-    $len = $iwid - $sep - &len_ps(@line);
-    warn "text for index tag `%s' is longer than one index line!\n"
-      if $len < -$sep;
-    @pp = ();
-    $inums = join(',',sort { $a <=> $b } keys %{$psidxpp{$k}});
-    while (length $inums) {
-      $inums =~ /^([^,]+)(,?)(.*)$/;
-      $inums = $3, $inumc = $2; $inum = $1;
-      @pnum = (" ", "Bp$inum", "n$inum", "E");
-      push(@pnum, "n$inumc") if ( $inumc ne '' );
-      $pnumlen = &len_ps(@pnum);
-      if ($pnumlen > $len) {
-        &ps_idxout($cmd,\@line,\@pp);
-       @pp = ();
-       @line = ();
-       $cmd = "index";
-       $len = $iwid - $sep;
-      }
-      push @pp, @pnum;
-      $len -= $pnumlen;
-    }
-    &ps_idxout($cmd,\@line,\@pp) if (length @pp);
-    $l1 = &len_ps(@line);
-    $l2 = &len_ps($pp);
-  }
-  $$idx_clname[$#$idx_clname] = "n" . $pnum; # fix up TOC entry for index
-
-  print "writing file...";
-  open PS,">nasmdoc.ps";
-  select PS;
-  $page = $lpages[0];
-  &ps_header;
-  &ps_write_bookmarks;
-  for ($i=0; $i<=$#lnames; $i++) {
-    &ps_throw_pg($page,$lpages[$i]) if $page != $lpages[$i];
-    $page = $lpages[$i];
-    &ps_out_line($ycoord[$i],$ltypes[$i],$lnames[$i]);
-  }
-  $i = 0;
-  while ($i <= $#psindex) {
-    &ps_throw_pg($page, $pnum) if $page != $pnum;
-    $page = $pnum++;
-    $ypos = 0;
-    $ypos = 100, &ps_out_line(0, "chap", ["BnIndex", "nIndex"]) if !$i;
-    $lines = ($pmax - $ypos) / $textht;
-    my $col; # ps_out_line hits this variable
-    PAGE:for ($col = 1; $col <= 2; $col++) {
-      $y = $ypos; $l = $lines;
-      COL: while ($l > 0) {
-        $j = $i+1;
-       $j++ while $psindex[$j] and ($psindex[$j][3] == 0); # find next break
-       last COL if $j-$i > $l or $i > $#psindex;
-       while ($i < $j) {
-         &ps_out_line($y, $psindex[$i][0] eq "index" ? "idl$col" : "ldl$col",
-                      $psindex[$i][1]);
-         &ps_out_line($y,"idr$col",$psindex[$i][2]);
-         $i++;
-         $y += $textht;
-         $l--;
-       }
-      }
-      last PAGE if $i > $#psindex;
-    }
-  }
-  &ps_trailer($page);
-  close PS;
-  select STDOUT;
-}
-
-sub ps_idxout {
-  my ($cmd, $left, $right) = @_;
-  my $break = 1;
-  $break = 0
-      if ($#psindex >= 0) and ( ($#$left < 0) or ($cmd eq "iindex") );
-  push @psindex,[$cmd,[@$left],[@$right],$break];
-}
-
-sub ps_header {
-    $pshdr = <<'EOF';
-/sp (n ) def
-/nf /Times-Roman findfont 11 scalefont def
-/ef /Times-Italic findfont 11 scalefont def
-/cf /Courier findfont 11 scalefont def
-/nc /Helvetica-Bold findfont 18 scalefont def
-/ec /Helvetica-Oblique findfont 18 scalefont def
-/cc /Courier-Bold findfont 18 scalefont def
-/nh /Helvetica-Bold findfont 14 scalefont def
-/eh /Helvetica-Oblique findfont 14 scalefont def
-/ch /Courier-Bold findfont 14 scalefont def
-/ns /Helvetica-Bold findfont 12 scalefont def
-/es /Helvetica-Oblique findfont 12 scalefont def
-/cs /Courier-Bold findfont 12 scalefont def
-/n 16#6E def /e 16#65 def /c 16#63 def
-/B 16#42 def /E 16#45 def /D 16#44 def
-/min { 2 copy gt { exch } if pop } def
-/max { 2 copy lt { exch } if pop } def
-/lkbegun 0 def
-/lkury 0 def
-/lkurx 0 def
-/lklly 0 def
-/lkllx 0 def
-/lktarget () def
-/linkbegin {
-  /lkbegun 1 def
-  /lktarget exch cvn def
-} def
-/linkshow {
-  lkbegun 0 ne {
-    gsave dup true charpath pathbbox grestore
-    lkbegun 1 eq {
-      /lkury exch def
-      /lkurx exch def
-      /lklly exch def
-      /lkllx exch def
-      /lkbegun 2 def
-    } {
-      lkury max /lkury exch def
-      lkurx max /lkurx exch def
-      lklly min /lklly exch def
-      lkllx min /lkllx exch def
-    } ifelse
-  } if
-  show
-} def
-/linkend {
-  [/Rect [ lkllx lklly lkurx lkury ]
-    /Color [ 1.0 0.0 0.0 ]
-    /Border [0 0 0]
-    /Dest lktarget
-    /Subtype /Link
-    /ANN pdfmark
-  /lkbegun 0 def
-} def
-/linkdest {
-  /lkdest exch cvn def
-  [ /Dest lkdest
-    /View [ /XYZ currentpoint 0 ]
-    /DEST pdfmark
-} def
-/handlelink {
-  dup 0 get
-  dup B eq {
-    pop dup length 1 sub 1 exch getinterval linkbegin
-  } {
-    E eq {
-      pop linkend
-    } {
-      dup length 1 sub 1 exch getinterval linkdest
-    } ifelse
-  } ifelse
-} def
-/pageodd {
-   550 50 moveto ns setfont dup stringwidth pop neg 0 rmoveto show
-} def
-/pageeven { 50 50 moveto ns setfont show } def
-/destmark {
-  dup length 1 sub 1 exch getinterval linkdest
-} def
-/chapter {
-  100 620 moveto
-  dup 0 get destmark
-  dup length 1 sub 1 exch getinterval
-  {
-    dup 0 get
-    dup n eq {pop nc setfont} {
-      e eq {ec setfont} {cc setfont} ifelse
-    } ifelse
-    dup length 1 sub 1 exch getinterval show
-  } forall
-  0 setlinecap 3 setlinewidth
-  newpath 100 610 moveto 468 0 rlineto stroke
-} def
-/heading {
-  686 exch sub /y exch def /a exch def
-  90 y moveto
-  a 0 get destmark
-  a 1 get dup length 1 sub 1 exch getinterval
-  nh setfont dup stringwidth pop neg 0 rmoveto show
-  100 y moveto
-  a dup length 2 sub 2 exch getinterval {
-    /s exch def
-    s 0 get
-    dup n eq {pop nh setfont} {
-      e eq {eh setfont} {ch setfont} ifelse
-    } ifelse
-    s s length 1 sub 1 exch getinterval show
-  } forall
-} def
-/subhead {
-  688 exch sub /y exch def /a exch def
-  90 y moveto
-  a 0 get destmark
-  a 1 get dup length 1 sub 1 exch getinterval
-  ns setfont dup stringwidth pop neg 0 rmoveto show
-  100 y moveto
-  a dup length 2 sub 2 exch getinterval {
-    /s exch def
-    s 0 get
-    dup n eq {pop ns setfont} {
-      e eq {es setfont} {cs setfont} ifelse
-    } ifelse
-    s s length 1 sub 1 exch getinterval show
-  } forall
-} def
-/disp { /j exch def
-  568 exch sub exch 689 exch sub moveto
-  {
-    /s exch def
-    s 0 get
-    dup E le {
-      pop s handlelink
-    } {
-      dup n eq {pop nf setfont} {
-        e eq {ef setfont} {cf setfont} ifelse
-      } ifelse
-      s s length 1 sub 1 exch getinterval linkshow
-      s sp eq {j 0 rmoveto} if
-    } ifelse
-  } forall
-} def
-/contents { /w exch def /y exch def /a exch def
-  /yy 689 y sub def
-  a a length 1 sub get dup length 1 sub 1 exch getinterval
-  /ss exch def
-  nf setfont 568 ss stringwidth pop sub /ex exch def
-  a 0 a length 1 sub getinterval y w 0 disp
-  /sx currentpoint pop def nf setfont
-  100 10 568 { /i exch def
-    i 5 sub sx gt i 5 add ex lt and {
-      i yy moveto (.) linkshow
-    } if
-  } for
-  ex yy moveto ss linkshow
-  linkend
-} def
-/just { /w exch def /y exch def /a exch def
-  /jj w def /spaces 0 def
-  a {
-    /s exch def
-    s 0 get
-    dup n eq {pop nf setfont} {
-      e eq {ef setfont} {cf setfont} ifelse
-    } ifelse
-    s s length 1 sub 1 exch getinterval stringwidth pop
-    jj exch sub /jj exch def
-    s sp eq {/spaces spaces 1 add def} if
-  } forall
-  a y w jj spaces spaces 0 eq {pop pop 0} {div} ifelse disp
-} def
-/idl { 468 exch sub 0 disp } def
-/ldl { 436 exch sub 0 disp } def
-/idr { 222 add 468 exch sub /x exch def /y exch def /a exch def
-  a {
-    /s exch def
-    s 0 get
-    dup E le {
-      pop
-    } {
-      dup n eq {pop nf setfont} {
-        e eq {ef setfont} {cf setfont} ifelse
-      } ifelse
-      s s length 1 sub 1 exch getinterval stringwidth pop
-      x add /x exch def
-    } ifelse
-  } forall
-  a y x 0 disp
-} def
-/left {0 disp} def
-/bullet {
-  nf setfont dup 100 exch 689 exch sub moveto (\267) show
-} def
-[/PageMode /UseOutlines /DOCVIEW pdfmark
-EOF
-  print "%!PS-Adobe-3.0\n";
-  print "%%BoundingBox: 95 95 590 705\n";
-  print "%%Creator: a nasty Perl script\n";
-  print "%%DocumentData: Clean7Bit\n";
-  print "%%Orientation: Portrait\n";
-  print "%%Pages: $lpages[$#lpages]\n";
-  print "%%DocumentNeededResources: font Times-Roman Times-Italic\n";
-  print "%%+ font Helvetica-Bold Courier Courier-Bold\n";
-  print "%%EndComments\n";
-  print "%%BeginProlog\n";
-  # This makes sure non-PDF PostScript interpreters don't choke on
-  # pdfmarks in the output
-  print "/pdfmark where\n";
-  print "{pop} {userdict /pdfmark /cleartomark load put} ifelse\n";
-  print "%%EndProlog\n";
-  print "%%BeginSetup\n";
-  print "save\n";
-  $pshdr =~ s/\s+/ /g;
-  while ($pshdr =~ /\S/) {
-    last if length($pshdr) < 72 || $pshdr !~ /^(.{0,72}\S)\s(.*)$/;
-    $pshdr = $2;
-    print "$1\n";
-  }
-  print "$pshdr\n" if $pshdr =~ /\S/;
-  print "%%EndSetup\n";
-  &ps_initpg($lpages[0]);
-}
-
-sub ps_trailer {
-  my ($oldpg) = @_;
-  &ps_donepg($oldpg);
-  print "%%Trailer\nrestore\n%%EOF\n";
-}
-
-sub ps_throw_pg {
-  my ($oldpg, $newpg) = @_;
-  while ($oldpg < $newpg) {
-    &ps_donepg($oldpg);
-    $oldpg++;
-    &ps_initpg($oldpg);
-  }
-}
-
-sub ps_initpg {
-  my ($pgnum) = @_;
-  print "%%Page: $pgnum $pgnum\n";
-  print "%%BeginPageSetup\nsave\n%%EndPageSetup\n";
-  print "95 705 moveto (p$pgnum) linkdest\n";
-}
-
-sub ps_donepg {
-  my ($pgnum) = @_;
-  if ($pgnum & 1) {
-    print "%%PageTrailer\n($pgnum)pageodd restore showpage\n";
-  } else {
-    print "%%PageTrailer\n($pgnum)pageeven restore showpage\n";
-  }
-}
-
-sub ps_out_line {
-  my ($ypos,$ltype,$lname) = @_;
-  my $c,$d,$wid;
-
-  print "[";
-  $col = 1;
-  foreach $c (@$lname) {#
-    $c= "n " if $c eq " ";
-    $c = "n\261" if $c eq "-";
-    $d = '';
-    while (length $c) {
-      $d .= $1, $c = $2 while $c =~ /^([ -\'\*-\[\]-~]+)(.*)$/;
-      while (1) {
-        $d .= "\\$1", $c = $2, next if $c =~ /^([\\\(\)])(.*)$/;
-       ($d .= sprintf "\\%3o",unpack("C",$1)), $c = $2, next
-         if $c =~ /^([^ -~])(.*)$/;
-       last;
-      }
-    }
-    $d = "($d)";
-    $col = 0, print "\n" if $col>0 && $col+length $d > 77;
-    print $d;
-    $col += length $d;
-  }
-  print "\n" if $col > 60;
-  print "]";
-  if ($ltype =~ /^[nb](beg|bdy)$/) {
-    printf "%d %s%d just\n",
-      $ypos, ($ltype eq "bbeg" ? "bullet " : ""),
-      ($ltype =~ /^b/ ? 456 : 468);
-  } elsif ($ltype =~ /^[nb](one|end)$/) {
-    printf "%d %s%d left\n",
-      $ypos, ($ltype eq "bone" ? "bullet " : ""),
-      ($ltype =~ /^b/ ? 456 : 468);
-  } elsif ($ltype =~ /^c(one|beg|bdy|end)$/) {
-    printf "$ypos 468 left\n";
-  } elsif ($ltype =~ /^C/) {
-    $wid = 468;
-    $wid = 456 if $ltype eq "Chea";
-    $wid = 444 if $ltype eq "Csub";
-    printf "$ypos $wid contents\n";
-  } elsif ($ltype eq "chap") {
-    printf "chapter\n";
-  } elsif ($ltype eq "head") {
-    printf "$ypos heading\n";
-  } elsif ($ltype eq "subh") {
-    printf "$ypos subhead\n";
-  } elsif ($ltype =~ /([il]d[lr])([12])/) {
-    $left = ($2 eq "2" ? 468-222 : 0);
-    printf "$ypos $left $1\n";
-  }
-}
-
-sub word_ps {
-  my ($w) = @_;
-  my $wtype, $wmajt;
-
-  return undef if $w eq '' || $w eq undef;
-
-  $wtype = substr($w,0,2);
-  $wmajt = substr($wtype,0,1);
-  $w = substr($w,2);
-  $w =~ s/<.*>// if $wmajt eq "w"; # remove web links
-  if ($wmajt eq "n" || $wtype eq "w ") {
-    return "n$w";
-  } elsif ($wtype eq "sp") {
-    return ' ';
-  } elsif ($wtype eq "da") {
-    return '-';
-  } elsif ($wmajt eq "c" || $wtype eq "wc") {
-    return "c$w";
-  } elsif ($wmajt eq "e") {
-    return "e$w";
-  } elsif ($wmajt eq "x") {
-    return "x";
-  } elsif ($wtype eq "i ") {
-    push @lindex, $w;
-    return "x";
-  } else {
-    die "panic in word_ps: $wtype$w\n";
-  }
-}
-
-sub word_ps_title {
-  my ($w) = @_;
-  my $wtype, $wmajt;
-
-  return undef if $w eq '' || $w eq undef;
-
-  $wtype = substr($w,0,2);
-  $wmajt = substr($wtype,0,1);
-  $w = substr($w,2);
-  $w =~ s/<.*>// if $wmajt eq "w"; # remove web links
-  if ($wmajt eq "n" || $wtype eq "w ") {
-    return $w;
-  } elsif ($wtype eq "sp") {
-    return ' ';
-  } elsif ($wtype eq "da") {
-    return '-';
-  } elsif ($wmajt eq "c" || $wtype eq "wc") {
-    return $w;
-  } elsif ($wmajt eq "e") {
-    return $w;
-  } elsif ($wmajt eq "x") {
-    return '';
-  } elsif ($wtype eq "i ") {
-    return '';
-  } else {
-    die "panic in word_ps_title: $wtype$w\n";
-  }
-}
-
-sub len_ps {
-  my (@line) = @_;
-  my $l = 0;
-  my $w, $size;
-
-  $size = 11/1000; # used only for length calculations
-  while ($w = shift @line) {
-    $w = "n " if $w eq " ";
-    $w = "n\261" if $w eq "-";
-    $f = substr($w,0,1);
-    if ( $f !~ /^[BDE]$/ ) {
-       $f = "timesr" if $f eq "n";
-       $f = "timesi" if $f eq "e";
-       $f = "courr" if $f eq "c";
-       foreach $c (unpack 'C*',substr($w,1)) {
-           $l += $size * $$f[$c];
-       }
-    }
-  }
-  return $l;
-}
-
 sub write_texi {
   # This is called from the top level, so I won't bother using
   # my or local.
@@ -2235,112 +1396,6 @@ sub add_item {
   push @nodes, $item;
 }
 
-# PostScript font metric data. Used for line breaking.
-sub font_metrics {
-  @timesr = (
-     250,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-     250, 333, 408, 500, 500, 833, 778, 333,
-     333, 333, 500, 564, 250, 333, 250, 278,
-     500, 500, 500, 500, 500, 500, 500, 500,
-     500, 500, 278, 278, 564, 564, 564, 444,
-     921, 722, 667, 667, 722, 611, 556, 722,
-     722, 333, 389, 722, 611, 889, 722, 722,
-     556, 722, 667, 556, 611, 722, 722, 944,
-     722, 722, 611, 333, 278, 333, 469, 500,
-     333, 444, 500, 444, 500, 444, 333, 500,
-     500, 278, 278, 500, 278, 778, 500, 500,
-     500, 500, 333, 389, 278, 500, 500, 722,
-     500, 500, 444, 480, 200, 480, 541,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0, 333, 500, 500, 167, 500, 500, 500,
-     500, 180, 444, 500, 333, 333, 556, 556,
-       0, 500, 500, 500, 250,   0, 453, 350,
-     333, 444, 444, 500,1000,1000,   0, 444,
-       0, 333, 333, 333, 333, 333, 333, 333,
-     333,   0, 333, 333,   0, 333, 333, 333,
-    1000,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0, 889,   0, 276,   0,   0,   0,   0,
-     611, 722, 889, 310,   0,   0,   0,   0,
-       0, 667,   0,   0,   0, 278,   0,   0,
-     278, 500, 722, 500,   0,   0,   0,   0
-  );
-  @timesi = (
-     250,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-     250, 333, 420, 500, 500, 833, 778, 333,
-     333, 333, 500, 675, 250, 333, 250, 278,
-     500, 500, 500, 500, 500, 500, 500, 500,
-     500, 500, 333, 333, 675, 675, 675, 500,
-     920, 611, 611, 667, 722, 611, 611, 722,
-     722, 333, 444, 667, 556, 833, 667, 722,
-     611, 722, 611, 500, 556, 722, 611, 833,
-     611, 556, 556, 389, 278, 389, 422, 500,
-     333, 500, 500, 444, 500, 444, 278, 500,
-     500, 278, 278, 444, 278, 722, 500, 500,
-     500, 500, 389, 389, 278, 500, 444, 667,
-     444, 444, 389, 400, 275, 400, 541,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0, 389, 500, 500, 167, 500, 500, 500,
-     500, 214, 556, 500, 333, 333, 500, 500,
-       0, 500, 500, 500, 250,   0, 523, 350,
-     333, 556, 556, 500, 889,1000,   0, 500,
-       0, 333, 333, 333, 333, 333, 333, 333,
-     333,   0, 333, 333,   0, 333, 333, 333,
-     889,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0, 889,   0, 276,   0,   0,   0,   0,
-     556, 722, 944, 310,   0,   0,   0,   0,
-       0, 667,   0,   0,   0, 278,   0,   0,
-     278, 500, 667, 500,   0,   0,   0,   0
-  );
-  @courr = (
-     600,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-     600, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0, 600, 600, 600, 600, 600, 600, 600,
-     600, 600, 600, 600, 600, 600, 600, 600,
-       0, 600, 600, 600, 600,   0, 600, 600,
-     600, 600, 600, 600, 600, 600,   0, 600,
-       0, 600, 600, 600, 600, 600, 600, 600,
-     600,   0, 600, 600,   0, 600, 600, 600,
-     600,   0,   0,   0,   0,   0,   0,   0,
-       0,   0,   0,   0,   0,   0,   0,   0,
-       0, 600,   0, 600,   0,   0,   0,   0,
-     600, 600, 600, 600,   0,   0,   0,   0,
-       0, 600,   0,   0,   0, 600,   0,   0,
-     600, 600, 600, 600,   0,   0,   0,   0
-  );
-}
-
 #
 # This produces documentation intermediate paragraph format; this is
 # basically the digested output of the front end.  Intended for use