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

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