home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume7 / thack.p3 < prev    next >
Encoding:
Text File  |  1989-08-05  |  5.4 KB  |  220 lines

  1. Newsgroups: comp.sources.misc
  2. from: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  3. subject: v07i119: Official patch to thack (troff -> ps) #3
  4. Reply-To: everson%compsci.bristol.ac.uk@NSFnet-Relay.AC.UK
  5.  
  6. Posting-number: Volume 7, Issue 119
  7. Submitted-by: everson%compsci.bristol.ac.uk@NSFnet-Relay.AC.UK
  8. Archive-name: thack.p3
  9.  
  10. [Also posted to comp.bugs.misc]
  11.  
  12. Most of the following patches are due to Paul Eggert
  13. <eggert@twinsun.com> and should help with using thack on non-Sun
  14. machines, also a font handling bugfix and a couple of font fixes,
  15. notably the long dashes which looked so bad in manual pages.
  16.  
  17. Phill Everson
  18. Medical Imaging
  19. Dept Comp Sci
  20. University of Bristol, UK
  21.  
  22. *** README.orig    Sat Aug  5 17:02:43 1989
  23. --- README    Sat Aug  5 17:06:15 1989
  24. ***************
  25. *** 1,7 ****
  26.   
  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.   
  31.   Sample usage of thack is, say:
  32.   
  33. --- 1,8 ----
  34.   
  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. ***************
  43. *** 20,26 ****
  44.   on an Apple Laserwriter I and an Apple Laserwriter IINTX. It can also
  45.   be previewed under Sunview with the Rutherford Postscript Interpreter.
  46.   
  47. ! If you're using US paper check you have -GUSPAPERLENGTH set in the
  48.   Makefile, then just make.
  49.   
  50.   Phill Everson
  51. --- 21,27 ----
  52.   on an Apple Laserwriter I and an Apple Laserwriter IINTX. It can also
  53.   be previewed under Sunview with the Rutherford Postscript Interpreter.
  54.   
  55. ! If you're using US paper check you have -DUSPAPERLENGTH set in the
  56.   Makefile, then just make.
  57.   
  58.   Phill Everson
  59. *** th.h.orig    Sat Aug  5 16:57:13 1989
  60. --- th.h    Sat Aug  5 16:57:17 1989
  61. ***************
  62. *** 1,4 ****
  63. --- 1,9 ----
  64.   #include <stdio.h>
  65. + #include <sys/types.h>
  66. + #include <time.h>
  67. + time_t time();
  68.   char *table[2][2]=
  69.       { /* FONT 0,1,2,4,5,6,7 */
  70.        " htnmlizsdbxfjuk p ; a_c`e'o r v-wq/.g ,&y % QTOHNMLRGIPCVEZDBSY",
  71. *** thack.c.orig    Sat Aug  5 16:57:07 1989
  72. --- thack.c    Sat Aug  5 17:01:56 1989
  73. ***************
  74. *** 5,13 ****
  75.   int font, cfont, size, csize, tfont, tsize;
  76.   char *pstr, *cstr();
  77.   
  78.   main()
  79.   {
  80. !     int c, i;
  81.       int sflag;
  82.       int hdist, vdist;
  83.       int esc, lead;
  84. --- 5,28 ----
  85.   int font, cfont, size, csize, tfont, tsize;
  86.   char *pstr, *cstr();
  87.   
  88. + #ifndef Y_INITIAL
  89. + #ifndef PAGELENGTH
  90. + #ifdef USPAGELENGTH
  91. + #ifdef sun
  92. + #define PAGELENGTH 11.1875
  93. + #else
  94. + #define PAGELENGTH 11
  95. + #endif
  96. + #else
  97. + #define PAGELENGTH 11.75
  98. + #endif
  99. + #endif
  100. + #define Y_INITIAL ((int)(PAGELENGTH*144 + 0.5))
  101. + #endif
  102.   main()
  103.   {
  104. !     int c;
  105.       int sflag;
  106.       int hdist, vdist;
  107.       int esc, lead;
  108. ***************
  109. *** 18,28 ****
  110.       tfont = font = 0;
  111.       tsize = size = 12;
  112.       esc = lead = 1;
  113. ! #ifdef USPAGELENGTH
  114. !     cy = ypos = 1584; /* represents 11 inches in troff vertical units */
  115. ! #else
  116. !     cy = ypos = 1692; /* represents 11.5 inches in troff vertical units */
  117. ! #endif
  118.       cx = xpos = 0;
  119.       sflag = 0;
  120.       prolog();
  121. --- 33,39 ----
  122.       tfont = font = 0;
  123.       tsize = size = 12;
  124.       esc = lead = 1;
  125. !     cy = ypos = Y_INITIAL;
  126.       cx = xpos = 0;
  127.       sflag = 0;
  128.       prolog();
  129. ***************
  130. *** 71,77 ****
  131.                           else
  132.                               switch (c & 0x3f) {
  133.                               case 19:
  134. !                                 pstr = "\\320";
  135.                                   break;    /* \- */
  136.                               case 20:
  137.                                   pstr = "\\256";
  138. --- 82,88 ----
  139.                           else
  140.                               switch (c & 0x3f) {
  141.                               case 19:
  142. !                                 pstr = "\\261";
  143.                                   break;    /* \- */
  144.                               case 20:
  145.                                   pstr = "\\256";
  146. ***************
  147. *** 483,490 ****
  148.   fontps(f1, ps, str)
  149.   char *str;
  150.   {
  151. !     tfont = cfont;
  152. !     tsize = csize;
  153.       pstr = str;
  154.       size = ps;
  155.       font = f1;
  156. --- 494,501 ----
  157.   fontps(f1, ps, str)
  158.   char *str;
  159.   {
  160. !     tfont = font;
  161. !     tsize = size;
  162.       pstr = str;
  163.       size = ps;
  164.       font = f1;
  165. ***************
  166. *** 516,528 ****
  167.   
  168.   newpage()
  169.   {
  170. !     printf("%%%%Page: %d %d\n", npages, ++npages);
  171.       printf("save\n");
  172.   }
  173.   
  174.   prolog()
  175.   {
  176. !     long clock = time(0);
  177.         
  178.       printf("%%!PS-Adobe-\n");
  179.       printf("%%%%Creator: (thack - contact <everson@cs.bris.ac.uk>)\n");
  180. --- 527,540 ----
  181.   
  182.   newpage()
  183.   {
  184. !     ++npages;
  185. !     printf("%%%%Page: %d %d\n", npages, npages);
  186.       printf("save\n");
  187.   }
  188.   
  189.   prolog()
  190.   {
  191. !     time_t clock = time((time_t *)0);
  192.         
  193.       printf("%%!PS-Adobe-\n");
  194.       printf("%%%%Creator: (thack - contact <everson@cs.bris.ac.uk>)\n");
  195. ***************
  196. *** 530,538 ****
  197.       printf("%%%%CreationDate: %s", asctime (localtime (&clock)));
  198.       printf("%%%%Pages: (atend)\n");
  199.       printf("%%%%DocumentFonts: Times-Roman Times-Italic Times-Bold \
  200. !                 Symbol Helvetica Helvetica-Oblique Helvetica-Bold Courier \
  201. !             Courier-Oblique Courier-Bold Times-BoldItalic Helvetica-BoldOblique \
  202. !             Courier-BoldOblique\n");
  203.       printf("%%%%EndComments\n");
  204.   
  205.       printf("/P {moveto show} def\n");
  206. --- 542,550 ----
  207.       printf("%%%%CreationDate: %s", asctime (localtime (&clock)));
  208.       printf("%%%%Pages: (atend)\n");
  209.       printf("%%%%DocumentFonts: Times-Roman Times-Italic Times-Bold \
  210. ! Symbol Helvetica Helvetica-Oblique Helvetica-Bold Courier \
  211. ! Courier-Oblique Courier-Bold Times-BoldItalic Helvetica-BoldOblique \
  212. ! Courier-BoldOblique\n");
  213.       printf("%%%%EndComments\n");
  214.   
  215.       printf("/P {moveto show} def\n");
  216.  
  217.