home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume08 / thack.p4 < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  7.1 KB

  1. From decwrl!ucbvax!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!allbery Mon Aug 28 19:42:13 PDT 1989
  2. Article 1062 of comp.sources.misc:
  3. Path: decwrl!ucbvax!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v08i022: Offical Patch #4 to thack (troff -> ps filter)
  7. Message-ID: <65600@uunet.UU.NET>
  8. Date: 29 Aug 89 00:12:13 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: everson%compsci.bristol.ac.uk@NSFnet-Relay.AC.UK
  11. Lines: 305
  12. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  13.  
  14. Posting-number: Volume 8, Issue 22
  15. Submitted-by: everson%compsci.bristol.ac.uk@NSFnet-Relay.AC.UK
  16. Archive-name: thack.p4
  17.  
  18. [ Also posted to comp.bugs.misc ]
  19.  
  20. Lots of improvements to the look of the output this time. It can now
  21. print the Csh manual page pretty much perfectly. Also, the postscript
  22. generated is now faster. If you've missed some patches (or the original
  23. posting) they are in your local comp.sources.misc archive or I have them
  24. here.
  25.  
  26. Phill Everson
  27. Medical Imaging
  28. Dept Comp Sci
  29. University of Bristol, UK
  30.  
  31. *** README.orig    Sat Aug  5 17:14:54 1989
  32. --- README    Mon Aug 28 17:51:38 1989
  33. ***************
  34. *** 2,8 ****
  35.   Enclosed please find thack, a Troff C/A/T to Postscript filter, written
  36.   by a colleague of mine, Gareth Waddell. Attempt to make output 
  37.   Adobe-conformant Postscript by David R. Kaelbling (drk@twinkie.Rational.COM).
  38. ! Thanks to Paul Eggert <eggert@twinsun.com> for fixing a number of bugs.
  39.   
  40.   Sample usage of thack is, say:
  41.   
  42. --- 2,12 ----
  43.   Enclosed please find thack, a Troff C/A/T to Postscript filter, written
  44.   by a colleague of mine, Gareth Waddell. Attempt to make output 
  45.   Adobe-conformant Postscript by David R. Kaelbling (drk@twinkie.Rational.COM).
  46. ! Thanks to Paul Eggert <eggert@twinsun.com> and Tarjei T. Jensen 
  47. ! <jensen@uninett.hsr> for fixing a number of bugs. Thanks also to Paul Eggert
  48. ! for speeding up the Postscript generated. Please send me any modifications
  49. ! you make to thack (in patch format if possible - (use diff -c)) and I'll 
  50. ! post them to the net.
  51.   
  52.   Sample usage of thack is, say:
  53.   
  54. ***************
  55. *** 22,28 ****
  56.   be previewed under Sunview with the Rutherford Postscript Interpreter.
  57.   
  58.   If you're using US paper check you have -DUSPAPERLENGTH set in the
  59. ! Makefile, then just make.
  60.   
  61.   Phill Everson
  62.   Computer Science Dept.,
  63. --- 26,32 ----
  64.   be previewed under Sunview with the Rutherford Postscript Interpreter.
  65.   
  66.   If you're using US paper check you have -DUSPAPERLENGTH set in the
  67. ! Makefile, then just make. (It's set up for European A4 paper).
  68.   
  69.   Phill Everson
  70.   Computer Science Dept.,
  71. *** thack.c.orig    Sat Aug  5 17:14:56 1989
  72. --- thack.c    Mon Aug 28 17:50:21 1989
  73. ***************
  74. *** 9,15 ****
  75.   #ifndef PAGELENGTH
  76.   #ifdef USPAGELENGTH
  77.   #ifdef sun
  78. ! #define PAGELENGTH 11.1875
  79.   #else
  80.   #define PAGELENGTH 11
  81.   #endif
  82. --- 9,15 ----
  83.   #ifndef PAGELENGTH
  84.   #ifdef USPAGELENGTH
  85.   #ifdef sun
  86. ! #define PAGELENGTH 11.375
  87.   #else
  88.   #define PAGELENGTH 11
  89.   #endif
  90. ***************
  91. *** 22,28 ****
  92.   
  93.   main()
  94.   {
  95. !     int c;
  96.       int sflag;
  97.       int hdist, vdist;
  98.       int esc, lead;
  99. --- 22,28 ----
  100.   
  101.   main()
  102.   {
  103. !     int c, i;
  104.       int sflag;
  105.       int hdist, vdist;
  106.       int esc, lead;
  107. ***************
  108. *** 266,273 ****
  109.                               fontps(0, size, "\\301");
  110.                               break;    /* grave */
  111.                           case 30:
  112. !                             fontps(0, size, "^");
  113. !                             break;    /* ^ */
  114.                           case 32:
  115.                               pstr = "\\334";
  116.                               break;    /* left hand */
  117. --- 266,273 ----
  118.                               fontps(0, size, "\\301");
  119.                               break;    /* grave */
  120.                           case 30:
  121. !                             fontps(0, size, "\\303");
  122. !                             break;    /* tilde */
  123.                           case 32:
  124.                               pstr = "\\334";
  125.                               break;    /* left hand */
  126. ***************
  127. *** 412,418 ****
  128.                   font &= 27;
  129.                   break;
  130.               default:
  131. !                 fprintf(stderr, "ILLEGAL\n");
  132.                   break;
  133.               }
  134.               tfont = font;
  135. --- 412,418 ----
  136.                   font &= 27;
  137.                   break;
  138.               default:
  139. !                 fputs( "ILLEGAL\n", stderr );
  140.                   break;
  141.               }
  142.               tfont = font;
  143. ***************
  144. *** 421,426 ****
  145. --- 421,427 ----
  146.       if (sflag)
  147.           endpage();
  148.       epilog();
  149. +     return 0;
  150.   }
  151.   
  152.   tprint()
  153. ***************
  154. *** 429,485 ****
  155.           printf("%d ", size * 6);
  156.           switch (font) {
  157.           case 0:
  158. !             printf("TR");
  159.               break;
  160.           case 1:
  161. !             printf("TI");
  162.               break;
  163.           case 2:
  164. !             printf("TB");
  165.               break;
  166.           case 3:
  167. !             printf("S");
  168.               break;
  169.           case 8:
  170. !             printf("H");
  171.               break;
  172.           case 9:
  173. !             printf("HO");
  174.               break;
  175.           case 10:
  176. !             printf("HB");
  177.               break;
  178.           case 11:
  179. !             printf("S");
  180.               break;
  181.           case 16:
  182. !             printf("C");
  183.               break;
  184.           case 17:
  185. !             printf("CO");
  186.               break;
  187.           case 18:
  188. !             printf("CB");
  189.               break;
  190.           case 19:
  191. !             printf("S");
  192.               break;
  193.           case 24:
  194. !             printf("TBI");
  195.               break;
  196.           case 25:
  197. !             printf("HBO");
  198.               break;
  199.           case 26:
  200. !             printf("CBO");
  201.               break;
  202.           case 27:
  203. !             printf("S");
  204.               break;
  205.           default:
  206.               fprintf(stderr, "Illegal Font %d\n", font);
  207.           }
  208. !         printf(" F\n");
  209.           cfont = font;
  210.           csize = size;
  211.       }
  212. --- 430,486 ----
  213.           printf("%d ", size * 6);
  214.           switch (font) {
  215.           case 0:
  216. !             fputs("TR", stdout);
  217.               break;
  218.           case 1:
  219. !             fputs("TI", stdout);
  220.               break;
  221.           case 2:
  222. !             fputs("TB", stdout);
  223.               break;
  224.           case 3:
  225. !             fputs("S", stdout);
  226.               break;
  227.           case 8:
  228. !             fputs("H", stdout);
  229.               break;
  230.           case 9:
  231. !             fputs("HO", stdout);
  232.               break;
  233.           case 10:
  234. !             fputs("HB", stdout);
  235.               break;
  236.           case 11:
  237. !             fputs("S", stdout);
  238.               break;
  239.           case 16:
  240. !             fputs("C", stdout);
  241.               break;
  242.           case 17:
  243. !             fputs("CO", stdout);
  244.               break;
  245.           case 18:
  246. !             fputs("CB", stdout);
  247.               break;
  248.           case 19:
  249. !             fputs("S", stdout);
  250.               break;
  251.           case 24:
  252. !             fputs("TBI", stdout);
  253.               break;
  254.           case 25:
  255. !             fputs("HBO", stdout);
  256.               break;
  257.           case 26:
  258. !             fputs("CBO", stdout);
  259.               break;
  260.           case 27:
  261. !             fputs("S", stdout);
  262.               break;
  263.           default:
  264.               fprintf(stderr, "Illegal Font %d\n", font);
  265.           }
  266. !         fputs(" F\n", stdout);
  267.           cfont = font;
  268.           csize = size;
  269.       }
  270. ***************
  271. *** 494,501 ****
  272.   fontps(f1, ps, str)
  273.   char *str;
  274.   {
  275. -     tfont = font;
  276. -     tsize = size;
  277.       pstr = str;
  278.       size = ps;
  279.       font = f1;
  280. --- 495,500 ----
  281. ***************
  282. *** 504,510 ****
  283.   illegal(s)
  284.   char *s;
  285.   {
  286. !     fprintf(stderr, "Sequence %s is not allowed\n", s);
  287.   }
  288.   
  289.   crsize(old, new)
  290. --- 503,509 ----
  291.   illegal(s)
  292.   char *s;
  293.   {
  294. !     fprintf(stderr, "Sequence \\(%s is not allowed\n", s);
  295.   }
  296.   
  297.   crsize(old, new)
  298. ***************
  299. *** 547,555 ****
  300.   Courier-BoldOblique\n");
  301.       printf("%%%%EndComments\n");
  302.   
  303. !     printf("/P {moveto show} def\n");
  304. !     printf("/X {currentpoint exch pop moveto show} def\n");
  305. !     printf("/F {findfont exch scalefont setfont} def\n");
  306.       printf("/TR /Times-Roman def\n");
  307.       printf("/TI /Times-Italic def\n");
  308.       printf("/TB /Times-Bold def\n");
  309. --- 546,554 ----
  310.   Courier-BoldOblique\n");
  311.       printf("%%%%EndComments\n");
  312.   
  313. !     printf("/P {moveto show} bind def\n");
  314. !     printf("/X {currentpoint exch pop moveto show} bind def\n");
  315. !     printf("/F {findfont exch scalefont setfont} bind def\n");
  316.       printf("/TR /Times-Roman def\n");
  317.       printf("/TI /Times-Italic def\n");
  318.       printf("/TB /Times-Bold def\n");
  319.  
  320.  
  321.