home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume10 / thack.p6 < prev    next >
Encoding:
Text File  |  1990-01-08  |  18.6 KB  |  789 lines

  1. Newsgroups: comp.sources.misc
  2. from: everson%compsci.bristol.ac.uk@NSFnet-Relay.AC.UK
  3. subject: v10i004: Official Patch #6 to thack (troff->ps filter)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 10, Issue 4
  7. Submitted-by: everson%compsci.bristol.ac.uk@NSFnet-Relay.AC.UK
  8. Archive-name: thack.p6
  9.  
  10. This is to introduce official patch #6 (it might be #7 by now, I seem
  11. to have lost count) to thack, a troff to postscript filter.
  12. [It's #6.  ++bsa]
  13.  
  14. I would appreicate it if anyone who makes modifications to this or any other 
  15. program would send me the output of a 'diff -c' with a known version of the 
  16. software rather a full copy from which I have to extract your modifications
  17. myself. We can reduce network traffic and also make official patch creation
  18. easier when there is more than one group working on the code at the same time. 
  19.  
  20. Here are the changes:
  21.  
  22. --------------------------------------------------------------------------
  23.  
  24. I got thack to work under OpenWindows 1.0 as part of a manual page previewer.
  25. Here are some changes to thack that I found needed or helpful.
  26.  
  27.     Permit 'thack filename'; this is required if we want to use thack in
  28.     Sun's 'man -t' command by setting the environment variable TCAT to
  29.     'thack'.
  30.  
  31.     Upgrade to (my limited understanding of) PS-Adobe-2.0 EPSF-2.0 format.
  32.  
  33.     Put 'thack: ' in the front of error messages.
  34.     (It isolates them better in a pipeline.)
  35.  
  36.     Keep better track of errors for thack's exit status.
  37.  
  38.     Fix minor spacing and font problems in man page.
  39.  
  40. -- Paul Eggert <eggert@twinsun.com>
  41.  
  42. --------------------------------------------------------------------------
  43.  
  44. The main fix is to generate smaller output; on a large computer science paper
  45. ("Eli: A Complete, Flexible Compiler Construction System") the new output is
  46. 28% smaller than the old.  On the thack man page itself, the savings is only
  47. 21% because the output is so small.  The savings comes from outputting smaller
  48. numbers, and from eliminating some unneeded newlines, turning some blanks into
  49. newlines so that no long lines are generated.  For example, where the old thack
  50. generated
  51.  
  52.     60 TR F
  53.     (T)270 4533 P
  54.     (H)307 X
  55.     (A)350 X
  56.     (C)393 X
  57.     (K)433 X
  58.  
  59. the new thack generates
  60.  
  61.     60 TR(T)270 1511
  62.     P(H)37
  63.     X(A)43
  64.     X(C)43
  65.     X(K)40
  66.     X
  67.  
  68. A minor fix: npages is now unsigned.
  69.  
  70. -- Paul Eggert <eggert@twinsun.com>
  71.  
  72. ----------------------------------------------------------------------------
  73.  
  74. Here is a patch to thack that adds support for the characters circle, 1/4, 1/2,
  75. 3/4, and Bell System logo.  For the logo, I use the same character that Adobe
  76. TranScript uses; it displays as an Apple logo on our LaserWriter (and on Sun's
  77. OpenWindows 1.0).  Also, the square is patched to look more like a square.
  78. While I was at it I put the prolog text into a table; this should make things a
  79. tad smaller and/or faster.
  80.  
  81. -- Paul Eggert <eggert@twinsun.com>
  82.  
  83.  
  84.  
  85. Thanks
  86.  
  87. Phillip G. Everson
  88. ----------------------------------------------------------------------------
  89. Medical Imaging                      Senior Software Engineer
  90. Dept Comp Sci                        Philips Radiotherapy Systems
  91. University of Bristol, UK            Horfield Road, Bristol, UK
  92.  
  93. *** README    Mon Jan  8 08:49:53 1990
  94. --- README.orig    Mon Jan  8 08:35:08 1990
  95. ***************
  96. *** 14,21 ****
  97.   
  98.   It does not claim to be perfect, but I personally have used it for
  99.   printing many documents in the past, especially manual pages and found
  100. ! it very useful. It has also been used under OpenWindows1.0 aspart of a 
  101. ! manual page previewer.
  102.   
  103.   It was written under SunOS3.5, but has been run on a 3B2 running System V
  104.   and produces particularly nice output under SunOS4.0 or later as Sun
  105. --- 14,20 ----
  106.   
  107.   It does not claim to be perfect, but I personally have used it for
  108.   printing many documents in the past, especially manual pages and found
  109. ! it very useful.
  110.   
  111.   It was written under SunOS3.5, but has been run on a 3B2 running System V
  112.   and produces particularly nice output under SunOS4.0 or later as Sun
  113. *** thack.1    Mon Jan  8 08:45:52 1990
  114. --- thack.1.orig    Mon Jan  8 08:35:08 1990
  115. ***************
  116. *** 1,5 ****
  117.   .\" .TH name section cent-foot
  118. ! .TH THACK 1 "8 January 1990"
  119.   .SH NAME
  120.   .\" name \- function
  121.   thack \- hack about with TROFF output
  122. --- 1,5 ----
  123.   .\" .TH name section cent-foot
  124. ! .TH THACK 1 "28 August 1987"
  125.   .SH NAME
  126.   .\" name \- function
  127.   thack \- hack about with TROFF output
  128. ***************
  129. *** 6,14 ****
  130.   .SH SYNOPSIS
  131.   .\" Bold keywords, Italic variables, [] options, | alternatives.
  132.   .B thack
  133. - [
  134. - .IR filename .\|.\|.
  135. - ]
  136.   .SH DESCRIPTION
  137.   .\" Italic files, commands, IR manual-entry (manual-section)
  138.   .I Thack
  139. --- 6,11 ----
  140. ***************
  141. *** 15,21 ****
  142.   is a hack to
  143.   convert
  144.   .IR troff (1)
  145. ! output into
  146.   postscript.
  147.   The postscript it
  148.   produces is not highly
  149. --- 12,18 ----
  150.   is a hack to
  151.   convert
  152.   .IR troff (1)
  153. ! output into 
  154.   postscript.
  155.   The postscript it
  156.   produces is not highly
  157. ***************
  158. *** 37,45 ****
  159.   that an uncatered for code has been
  160.   sent (24 have yet to be identified).
  161.   More interesting messages such
  162. ! as `Sequence Bell Logo is not allowed'
  163. ! are also printed.  There are five of these
  164. ! cases.  However, some illegal sequences are
  165.   intercepted and used
  166.   as additional font information.
  167.   .SH BUGS
  168. --- 34,42 ----
  169.   that an uncatered for code has been
  170.   sent (24 have yet to be identified).
  171.   More interesting messages such
  172. ! as 'Sequence Bell Logo is not allowed'
  173. ! are also printed. There are five of these
  174. ! cases. However, some illegal sequences are 
  175.   intercepted and used
  176.   as additional font information.
  177.   .SH BUGS
  178. ***************
  179. *** 50,56 ****
  180.   .br
  181.   Many Special characters are Wrong.
  182.   .br
  183. ! .IR Eqn (1)
  184. ! and
  185. ! .IR tbl (1)
  186. ! are not 100% compatible.
  187. --- 47,50 ----
  188.   .br
  189.   Many Special characters are Wrong.
  190.   .br
  191. ! Eqn(1) & Tbl(1) are not 100% compatible.
  192. *** thack.c    Mon Jan  8 08:37:29 1990
  193. --- thack.c.orig    Mon Jan  8 08:35:08 1990
  194. ***************
  195. *** 1,8 ****
  196.   #include "th.h"
  197.   
  198. ! int error;
  199. ! unsigned npages;
  200. ! int xpos, ypos, cx, cy;
  201.   int font, cfont, size, csize, tfont, tsize;
  202.   char *pstr, *cstr();
  203.   
  204. --- 1,7 ----
  205.   #include "th.h"
  206.   
  207. ! int npages;
  208. ! int xpos, ypos, cy;
  209.   int font, cfont, size, csize, tfont, tsize;
  210.   char *pstr, *cstr();
  211.   
  212. ***************
  213. *** 21,50 ****
  214.   #define Y_INITIAL ((int)(PAGELENGTH*144 + 0.5))
  215.   #endif
  216.   
  217. ! #define POINTS_PER_INCH 72
  218. ! int
  219. ! main(argc, argv)
  220. ! int argc;
  221. ! char **argv;
  222.   {
  223. -     if (argc <= 1)
  224. -         thack();
  225. -     else {
  226. -         char **a = argv;
  227. -         while (*++a)
  228. -             if (freopen(*a, "r", stdin))
  229. -                 thack();
  230. -             else {
  231. -                 fprintf(stderr, "thack: %s: cannot open\n", *a);
  232. -                 error = 1;
  233. -             }
  234. -     }
  235. -     return error || ferror(stdout);
  236. - }
  237. - thack()
  238. - {
  239.       int c;
  240.       int sflag;
  241.       int hdist, vdist;
  242. --- 20,27 ----
  243.   #define Y_INITIAL ((int)(PAGELENGTH*144 + 0.5))
  244.   #endif
  245.   
  246. ! main()
  247.   {
  248.       int c;
  249.       int sflag;
  250.       int hdist, vdist;
  251. ***************
  252. *** 57,63 ****
  253.       tsize = size = 12;
  254.       esc = lead = 1;
  255.       cy = ypos = Y_INITIAL;
  256. !     cx = xpos = 0;
  257.       sflag = 0;
  258.       prolog();
  259.       newpage();
  260. --- 34,40 ----
  261.       tsize = size = 12;
  262.       esc = lead = 1;
  263.       cy = ypos = Y_INITIAL;
  264. !     xpos = 0;
  265.       sflag = 0;
  266.       prolog();
  267.       newpage();
  268. ***************
  269. *** 91,108 ****
  270.                                   pstr = "\\320";
  271.                                   break;    /* \(em */
  272.                               case 28:
  273. !                                 pstr = " (1)(4)R";
  274.                                   break;    /* \(14 */
  275.                               case 30:
  276. !                                 pstr = " (1)(2)R";
  277.                                   break;    /* \(12 */
  278.                               case 38:
  279. !                                 pstr = " (3)(4)R";
  280.                                   break;    /* \(34 */
  281.                               default:
  282. !                                 fprintf(stderr, "thack: >>>>> L%d/%d\n", font, c & 0x3f);
  283.                                   pstr = "?";
  284. -                                 error = 1;
  285.                               }
  286.                           else
  287.                               switch (c & 0x3f) {
  288. --- 68,84 ----
  289.                                   pstr = "\\320";
  290.                                   break;    /* \(em */
  291.                               case 28:
  292. !                                 illegal("1/4");
  293.                                   break;    /* \(14 */
  294.                               case 30:
  295. !                                 illegal("1/2");
  296.                                   break;    /* \(12 */
  297.                               case 38:
  298. !                                 illegal("3/4");
  299.                                   break;    /* \(34 */
  300.                               default:
  301. !                                 fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
  302.                                   pstr = "?";
  303.                               }
  304.                           else
  305.                               switch (c & 0x3f) {
  306. ***************
  307. *** 146,157 ****
  308.                                   fontps(3, size, "\\323");
  309.                                   break;    /* c'right */
  310.                               case 44:
  311. !                                 pstr = "  SQ";
  312. !                                 break;    /* square */
  313.                               default:
  314. !                                 fprintf(stderr, "thack: >>>>> U%d/%d\n", font, c & 0x3f);
  315.                                   pstr = "?";
  316. -                                 error = 1;
  317.                               }
  318.                       else if (fh == 0)
  319.                           switch (c & 0x3f) {
  320. --- 122,132 ----
  321.                                   fontps(3, size, "\\323");
  322.                                   break;    /* c'right */
  323.                               case 44:
  324. !                                 pstr = "\\250";
  325. !                                 break;    /* square ? */
  326.                               default:
  327. !                                 fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
  328.                                   pstr = "?";
  329.                               }
  330.                       else if (fh == 0)
  331.                           switch (c & 0x3f) {
  332. ***************
  333. *** 177,183 ****
  334.                               fontps(0, size, "\\\\");
  335.                               break;    /* Backslash ! */
  336.                           case 35:
  337. !                             pstr = "\\360";
  338.                               break;    /* Bell Logo */
  339.                           case 36:
  340.                               pstr = "\\245";
  341. --- 152,158 ----
  342.                               fontps(0, size, "\\\\");
  343.                               break;    /* Backslash ! */
  344.                           case 35:
  345. !                             illegal("Bell Logo");
  346.                               break;    /* Bell Logo */
  347.                           case 36:
  348.                               pstr = "\\245";
  349. ***************
  350. *** 222,230 ****
  351.                               pstr = "\\273";
  352.                               break;    /* ~= */
  353.                           default:
  354. !                             fprintf(stderr, "thack: >>>>> L%d/%d\n", font, c & 0x3f);
  355.                               pstr = "?";
  356. -                             error = 1;
  357.                           }
  358.                       else
  359.                           switch (c & 0x3f) {
  360. --- 197,204 ----
  361.                               pstr = "\\273";
  362.                               break;    /* ~= */
  363.                           default:
  364. !                             fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
  365.                               pstr = "?";
  366.                           }
  367.                       else
  368.                           switch (c & 0x3f) {
  369. ***************
  370. *** 316,322 ****
  371.                               pstr = "\\315";
  372.                               break;    /* impr. subset */
  373.                           case 41:
  374. !                             pstr = "  O";
  375.                               break;    /* circle */
  376.                           case 44:
  377.                               pstr = "\\256";
  378. --- 290,296 ----
  379.                               pstr = "\\315";
  380.                               break;    /* impr. subset */
  381.                           case 41:
  382. !                             illegal("circle");
  383.                               break;    /* circle */
  384.                           case 44:
  385.                               pstr = "\\256";
  386. ***************
  387. *** 325,333 ****
  388.                               fontps(0, size, "\\247");
  389.                               break;    /* section */
  390.                           default:
  391. !                             fprintf(stderr, "thack: >>>>> U%d/%d\n", font, c & 0x3f);
  392.                               pstr = "?";
  393. -                             error = 1;
  394.                           }
  395.                   }
  396.                   else {
  397. --- 299,306 ----
  398.                               fontps(0, size, "\\247");
  399.                               break;    /* section */
  400.                           default:
  401. !                             fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
  402.                               pstr = "?";
  403.                           }
  404.                   }
  405.                   else {
  406. ***************
  407. *** 394,401 ****
  408.                   size = 36;
  409.                   break;
  410.               default:
  411. !                 fprintf(stderr, "thack: Size: %x\n", c & 0x0f);
  412. !                 error = 1;
  413.               }
  414.               crsize(csize, size);
  415.               tsize = size;
  416. --- 367,373 ----
  417.                   size = 36;
  418.                   break;
  419.               default:
  420. !                 fprintf(stderr, "Size: %x\n", c & 0x0f);
  421.               }
  422.               crsize(csize, size);
  423.               tsize = size;
  424. ***************
  425. *** 403,409 ****
  426.           else if ((c & 0xf0) == 0x40) {
  427.               c &= 0xf;
  428.               switch (c) {
  429. !             case 0:/* fputs("thack: INIT\n", stderr); error = 1; */
  430.                   break;
  431.               case 1:
  432.                   font &= 30;
  433. --- 375,381 ----
  434.           else if ((c & 0xf0) == 0x40) {
  435.               c &= 0xf;
  436.               switch (c) {
  437. !             case 0:/* fprintf(stderr,"INIT\n"); */
  438.                   break;
  439.               case 1:
  440.                   font &= 30;
  441. ***************
  442. *** 429,435 ****
  443.               case 8:
  444.                   esc = -1;
  445.                   break;
  446. !             case 9:/* fputs("thack: STOP\n", stderr); error = 1; */
  447.                   break;
  448.               case 10:
  449.                   lead = 1;
  450. --- 401,407 ----
  451.               case 8:
  452.                   esc = -1;
  453.                   break;
  454. !             case 9:/* fprintf(stderr,"STOP\n"); */
  455.                   break;
  456.               case 10:
  457.                   lead = 1;
  458. ***************
  459. *** 444,451 ****
  460.                   font &= 27;
  461.                   break;
  462.               default:
  463. !                 fputs( "thack: ILLEGAL\n", stderr );
  464. !                 error = 1;
  465.                   break;
  466.               }
  467.               tfont = font;
  468. --- 416,422 ----
  469.                   font &= 27;
  470.                   break;
  471.               default:
  472. !                 fputs( "ILLEGAL\n", stderr );
  473.                   break;
  474.               }
  475.               tfont = font;
  476. ***************
  477. *** 454,535 ****
  478.       if (sflag)
  479.           endpage();
  480.       epilog();
  481.   }
  482.   
  483.   tprint()
  484.   {
  485.       if (font != cfont || size != csize) {
  486. !         char *fontname;
  487.           switch (font) {
  488.           case 0:
  489. !             fontname = "TR";
  490.               break;
  491.           case 1:
  492. !             fontname = "TI";
  493.               break;
  494.           case 2:
  495. !             fontname = "TB";
  496.               break;
  497.           case 3:
  498. !             fontname = "S";
  499.               break;
  500.           case 8:
  501. !             fontname = "H";
  502.               break;
  503.           case 9:
  504. !             fontname = "HO";
  505.               break;
  506.           case 10:
  507. !             fontname = "HB";
  508.               break;
  509.           case 11:
  510. !             fontname = "S";
  511.               break;
  512.           case 16:
  513. !             fontname = "C";
  514.               break;
  515.           case 17:
  516. !             fontname = "CO";
  517.               break;
  518.           case 18:
  519. !             fontname = "CB";
  520.               break;
  521.           case 19:
  522. !             fontname = "S";
  523.               break;
  524.           case 24:
  525. !             fontname = "TBI";
  526.               break;
  527.           case 25:
  528. !             fontname = "HBO";
  529.               break;
  530.           case 26:
  531. !             fontname = "CBO";
  532.               break;
  533.           case 27:
  534. !             fontname = "S";
  535.               break;
  536.           default:
  537. !             fprintf(stderr, "thack: Illegal Font %d\n", font);
  538. !             error = 1;
  539. !             fontname = "TR";
  540.           }
  541. !         printf("\n%d %s", size * 6, fontname);
  542.           cfont = font;
  543.           csize = size;
  544.       }
  545. !     if (*pstr == ' ')
  546. !         printf(" %d %d\nM%s", xpos, ypos, pstr+1);
  547. !     else if (ypos != cy)
  548. !         printf("(%s)%d %d\nP", pstr, xpos, ypos);
  549. !     else {
  550. !         int dx = xpos - cx;
  551. !         if (dx < 0)
  552. !             printf("(%s)%d\nx", pstr, -dx);
  553. !         else
  554. !             printf("(%s)%d\nX", pstr, dx);
  555. !     }
  556. !     cx = xpos;
  557.       cy = ypos;
  558.   }
  559.   
  560. --- 425,498 ----
  561.       if (sflag)
  562.           endpage();
  563.       epilog();
  564. +     return 0;
  565.   }
  566.   
  567.   tprint()
  568.   {
  569.       if (font != cfont || size != csize) {
  570. !         printf("%d ", size * 6);
  571.           switch (font) {
  572.           case 0:
  573. !             fputs("TR", stdout);
  574.               break;
  575.           case 1:
  576. !             fputs("TI", stdout);
  577.               break;
  578.           case 2:
  579. !             fputs("TB", stdout);
  580.               break;
  581.           case 3:
  582. !             fputs("S", stdout);
  583.               break;
  584.           case 8:
  585. !             fputs("H", stdout);
  586.               break;
  587.           case 9:
  588. !             fputs("HO", stdout);
  589.               break;
  590.           case 10:
  591. !             fputs("HB", stdout);
  592.               break;
  593.           case 11:
  594. !             fputs("S", stdout);
  595.               break;
  596.           case 16:
  597. !             fputs("C", stdout);
  598.               break;
  599.           case 17:
  600. !             fputs("CO", stdout);
  601.               break;
  602.           case 18:
  603. !             fputs("CB", stdout);
  604.               break;
  605.           case 19:
  606. !             fputs("S", stdout);
  607.               break;
  608.           case 24:
  609. !             fputs("TBI", stdout);
  610.               break;
  611.           case 25:
  612. !             fputs("HBO", stdout);
  613.               break;
  614.           case 26:
  615. !             fputs("CBO", stdout);
  616.               break;
  617.           case 27:
  618. !             fputs("S", stdout);
  619.               break;
  620.           default:
  621. !             fprintf(stderr, "Illegal Font %d\n", font);
  622. !             fputs("TR", stdout);
  623.           }
  624. !         fputs(" F\n", stdout);
  625.           cfont = font;
  626.           csize = size;
  627.       }
  628. !     if (ypos == cy)
  629. !         printf("(%s)%d X\n", pstr, xpos);
  630. !     else
  631. !         printf("(%s)%d %d P\n", pstr, xpos, 3 * ypos);
  632.       cy = ypos;
  633.   }
  634.   
  635. ***************
  636. *** 541,546 ****
  637. --- 504,516 ----
  638.       font = f1;
  639.   }
  640.   
  641. + illegal(s)
  642. + char *s;
  643. + {
  644. +     pstr = s;
  645. +     fprintf(stderr, "Sequence \\(%s is not allowed\n", s);
  646. + }
  647.   crsize(old, new)
  648.   {
  649.       if ((old == 16 || old >= 20) && (new != 16 && new < 20))
  650. ***************
  651. *** 562,637 ****
  652.   newpage()
  653.   {
  654.       ++npages;
  655. !     printf("\n%%%%Page: %u %u\nsave", npages, npages);
  656.   }
  657.   
  658. - static char *prolog_text[] = {
  659. -     "%%Title: troff output",
  660. -     "%%Creator: (thack - contact <everson@cs.bris.ac.uk>)",
  661. -     "%%Pages: (atend)",
  662. -     "%%DocumentFonts: Times-Roman Times-Italic Times-Bold \
  663. - Symbol Helvetica Helvetica-Oblique Helvetica-Bold Courier \
  664. - Courier-Oblique Courier-Bold Times-BoldItalic Helvetica-BoldOblique \
  665. - Courier-BoldOblique",
  666. -     "%%EndComments",
  667. -     "/M{3 mul moveto}bind def",
  668. -     "/P{M gsave show grestore}bind def",
  669. -     "/X{0 rmoveto gsave show grestore}bind def",
  670. -     "/x{neg X}bind def",
  671. -     "/F{findfont exch scalefont setfont}bind def",
  672. -     "/TR{/Times-Roman F}bind def",
  673. -     "/TI{/Times-Italic F}bind def",
  674. -     "/TB{/Times-Bold F}bind def",
  675. -     "/S{/Symbol F}bind def",
  676. -     "/H{/Helvetica F}bind def",
  677. -     "/HO{/Helvetica-Oblique F}bind def",
  678. -     "/HB{/Helvetica-Bold F}bind def",
  679. -     "/C{/Courier F}bind def",
  680. -     "/CO{/Courier-Oblique F}bind def",
  681. -     "/CB{/Courier-Bold F}bind def",
  682. -     "/TBI{/Times-BoldItalic F}bind def",
  683. -     "/HBO{/Helvetica-BoldOblique F}bind def",
  684. -     "/CBO{/Courier-BoldOblique F}bind def",
  685. -     "/MR[.65 0 0 .6 0 0]def",
  686. -     "/1H{gsave newpath 0 0 moveto(1)true charpath flattenpath pathbbox",
  687. -     " 4 1 roll pop pop pop grestore}bind def",
  688. -     "/DR{gsave 1H 18 div setlinewidth currentpoint translate}bind def",
  689. -     "/Z{0 0 transform exch round exch round itransform moveto}bind def",
  690. -     "/O{DR newpath 1H 2 div dup dup 0 360 arc stroke grestore}bind def",
  691. -     "/SQ{DR Z newpath 0 0 moveto 1H 0 rlineto 0 1H rlineto 1H neg 0 rlineto",
  692. -     " closepath stroke grestore}bind def",
  693. -     "/R{gsave 0 1H .4 mul 2 copy rmoveto currentfont dup MR makefont dup",
  694. -     " setfont exch 6 -1 roll show setfont 3 1 roll neg rmoveto(\\244)show",
  695. -     " setfont show grestore}bind def",
  696. -     "1 6 div dup scale",
  697. -     "%%EndProlog",
  698. -     0
  699. - };
  700.   prolog()
  701.   {
  702.       time_t clock = time((time_t *)0);
  703. !     char **p;
  704.   
  705. !     printf("%s%s%s%g\n",
  706. !         "%!PS-Adobe-2.0 EPSF-2.0\n%%CreationDate: ", asctime(localtime(&clock)),
  707. !         "%%BoundingBox: 0 0 542.88 ", PAGELENGTH*POINTS_PER_INCH
  708. !     );
  709.   
  710. !     for (p = prolog_text;  *p;  p++)
  711. !         puts(*p);
  712. !     npages = 0;
  713.   }
  714.   
  715.   endpage()
  716.   {
  717. !     printf("\nshowpage\nrestore");
  718.       cfont = csize = -1;    /* Doing this will cause a new font message */
  719.   }
  720.   
  721.   epilog()
  722.   {
  723. !     printf("\n%%%%Trailer\n%%%%Pages: %u\n", npages);
  724.   }
  725. --- 532,587 ----
  726.   newpage()
  727.   {
  728.       ++npages;
  729. !     printf("%%%%Page: %d %d\n", npages, npages);
  730. !     printf("save\n");
  731.   }
  732.   
  733.   prolog()
  734.   {
  735.       time_t clock = time((time_t *)0);
  736. !       
  737. !     printf("%%!PS-Adobe-\n");
  738. !     printf("%%%%Creator: (thack - contact <everson@cs.bris.ac.uk>)\n");
  739. !     printf("%%%%Title: unknown\n");
  740. !     printf("%%%%CreationDate: %s", asctime (localtime (&clock)));
  741. !     printf("%%%%Pages: (atend)\n");
  742. !     printf("%%%%DocumentFonts: Times-Roman Times-Italic Times-Bold \
  743. ! Symbol Helvetica Helvetica-Oblique Helvetica-Bold Courier \
  744. ! Courier-Oblique Courier-Bold Times-BoldItalic Helvetica-BoldOblique \
  745. ! Courier-BoldOblique\n");
  746. !     printf("%%%%EndComments\n");
  747.   
  748. !     printf("/P {moveto show} bind def\n");
  749. !     printf("/X {currentpoint exch pop moveto show} bind def\n");
  750. !     printf("/F {findfont exch scalefont setfont} bind def\n");
  751. !     printf("/TR /Times-Roman def\n");
  752. !     printf("/TI /Times-Italic def\n");
  753. !     printf("/TB /Times-Bold def\n");
  754. !     printf("/S /Symbol def\n");
  755. !     printf("/H /Helvetica def\n");
  756. !     printf("/HO /Helvetica-Oblique def\n");
  757. !     printf("/HB /Helvetica-Bold def\n");
  758. !     printf("/C /Courier def\n");
  759. !     printf("/CO /Courier-Oblique def\n");
  760. !     printf("/CB /Courier-Bold def\n");
  761. !     printf("/TBI /Times-BoldItalic def\n");
  762. !     printf("/HBO /Helvetica-BoldOblique def\n");
  763. !     printf("/CBO /Courier-BoldOblique def\n");
  764. !     printf("1 6 div dup scale\n");
  765.   
  766. !     printf("%%%%EndProlog\n");
  767. !         npages = 0;
  768.   }
  769.   
  770.   endpage()
  771.   {
  772. !     printf("showpage\n");
  773. !     printf("restore\n");
  774.       cfont = csize = -1;    /* Doing this will cause a new font message */
  775.   }
  776.   
  777.   epilog()
  778.   {
  779. !   printf("%%%%Trailer\n");
  780. !   printf("%%%%Pages: %d\n", npages);
  781.   }
  782.  
  783.