home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume8 / thack.p4 < prev    next >
Text File  |  1989-08-28  |  7KB  |  312 lines

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