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.p5 < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  4.1 KB

  1. From decwrl!ucbvax!ucsd!swrinde!cs.utexas.edu!uunet!allbery Fri Sep  8 21:39:57 PDT 1989
  2. Article 1070 of comp.sources.misc:
  3. Path: decwrl!ucbvax!ucsd!swrinde!cs.utexas.edu!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v08i028: Official Patch #5 for thack (troff -> ps)
  7. Message-ID: <66798@uunet.UU.NET>
  8. Date: 7 Sep 89 02:01:30 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: everson%compsci.bristol.ac.uk@NSFnet-Relay.AC.UK
  11. Lines: 169
  12. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  13.  
  14. Posting-number: Volume 8, Issue 28
  15. Submitted-by: everson%compsci.bristol.ac.uk@NSFnet-Relay.AC.UK
  16. Archive-name: thack.p5
  17.  
  18. [ Also posted to comp.bugs.misc ]
  19.  
  20. Here are some more patches to thack. Thanks to Paul Eggert 
  21. <eggert@twinsun.com> for these.
  22.  
  23. `pstr' is sometimes not set when it should be, putting garbage into the
  24. output, or if pstr has never been set, dereferencing NULL and dumping core.
  25.  
  26. The partialdiff \(pd character should be \266, not \256.
  27.  
  28. An illegal font causes illegal PostScript to be output ("F" with no operand).
  29.  
  30. lint: `i' is defined but never used.  `cx' is defined and set but never used.
  31.  
  32. Phill Everson
  33. Medical Imaging
  34. Dept Comp Sci
  35. University of Bristol, UK
  36.  
  37. ===================================================================
  38. RCS file: RCS/thack.c,v
  39. retrieving revision 1.8
  40. diff -c -r1.8 thack.c
  41. *** /tmp/,RCSt1a22303    Tue Aug 29 11:52:27 1989
  42. --- thack.c    Tue Aug 29 11:37:27 1989
  43. ***************
  44. *** 1,7 ****
  45.   #include "th.h"
  46.   
  47.   int npages;
  48. ! int xpos, ypos, cx, cy;
  49.   int font, cfont, size, csize, tfont, tsize;
  50.   char *pstr, *cstr();
  51.   
  52. --- 1,7 ----
  53.   #include "th.h"
  54.   
  55.   int npages;
  56. ! int xpos, ypos, cy;
  57.   int font, cfont, size, csize, tfont, tsize;
  58.   char *pstr, *cstr();
  59.   
  60. ***************
  61. *** 22,28 ****
  62.   
  63.   main()
  64.   {
  65. !     int c, i;
  66.       int sflag;
  67.       int hdist, vdist;
  68.       int esc, lead;
  69. --- 22,28 ----
  70.   
  71.   main()
  72.   {
  73. !     int c;
  74.       int sflag;
  75.       int hdist, vdist;
  76.       int esc, lead;
  77. ***************
  78. *** 34,40 ****
  79.       tsize = size = 12;
  80.       esc = lead = 1;
  81.       cy = ypos = Y_INITIAL;
  82. !     cx = xpos = 0;
  83.       sflag = 0;
  84.       prolog();
  85.       newpage();
  86. --- 34,40 ----
  87.       tsize = size = 12;
  88.       esc = lead = 1;
  89.       cy = ypos = Y_INITIAL;
  90. !     xpos = 0;
  91.       sflag = 0;
  92.       prolog();
  93.       newpage();
  94. ***************
  95. *** 78,83 ****
  96. --- 78,84 ----
  97.                                   break;    /* \(34 */
  98.                               default:
  99.                                   fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
  100. +                                 pstr = "?";
  101.                               }
  102.                           else
  103.                               switch (c & 0x3f) {
  104. ***************
  105. *** 125,130 ****
  106. --- 126,132 ----
  107.                                   break;    /* square ? */
  108.                               default:
  109.                                   fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
  110. +                                 pstr = "?";
  111.                               }
  112.                       else if (fh == 0)
  113.                           switch (c & 0x3f) {
  114. ***************
  115. *** 186,192 ****
  116.                               pstr = cstr('~');
  117.                               break;    /* approximate */
  118.                           case 59:
  119. !                             pstr = "\\256";
  120.                               break;    /* partial */
  121.                           case 61:
  122.                               pstr = "\\326";
  123. --- 188,194 ----
  124.                               pstr = cstr('~');
  125.                               break;    /* approximate */
  126.                           case 59:
  127. !                             pstr = "\\266";
  128.                               break;    /* partial */
  129.                           case 61:
  130.                               pstr = "\\326";
  131. ***************
  132. *** 196,201 ****
  133. --- 198,204 ----
  134.                               break;    /* ~= */
  135.                           default:
  136.                               fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
  137. +                             pstr = "?";
  138.                           }
  139.                       else
  140.                           switch (c & 0x3f) {
  141. ***************
  142. *** 297,302 ****
  143. --- 300,306 ----
  144.                               break;    /* section */
  145.                           default:
  146.                               fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
  147. +                             pstr = "?";
  148.                           }
  149.                   }
  150.                   else {
  151. ***************
  152. *** 479,484 ****
  153. --- 483,489 ----
  154.               break;
  155.           default:
  156.               fprintf(stderr, "Illegal Font %d\n", font);
  157. +             fputs("TR", stdout);
  158.           }
  159.           fputs(" F\n", stdout);
  160.           cfont = font;
  161. ***************
  162. *** 488,494 ****
  163.           printf("(%s)%d X\n", pstr, xpos);
  164.       else
  165.           printf("(%s)%d %d P\n", pstr, xpos, 3 * ypos);
  166. -     cx = xpos;
  167.       cy = ypos;
  168.   }
  169.   
  170. --- 493,498 ----
  171. ***************
  172. *** 503,508 ****
  173. --- 507,513 ----
  174.   illegal(s)
  175.   char *s;
  176.   {
  177. +     pstr = s;
  178.       fprintf(stderr, "Sequence \\(%s is not allowed\n", s);
  179.   }
  180.   
  181.  
  182. Keywords: 
  183.  
  184.  
  185.