[comp.bugs.misc] Official Patches to thack

everson@CompSci.Bristol.AC.UK (Phill Everson ) (07/29/89)

*** README.orig	Fri Jul 28 13:48:51 1989
--- README	Fri Jul 28 13:50:02 1989
***************
*** 1,6 ****
  
  Enclosed please find thack, a Troff C/A/T to Postscript filter, written
! by a colleague of mine, Gareth Waddell.
  
  Sample usage of thack is, say:
  
--- 1,7 ----
  
  Enclosed please find thack, a Troff C/A/T to Postscript filter, written
! by a colleague of mine, Gareth Waddell. Attempt to make output 
! Adobe-conformant Postscript by David R. Kaelbling (drk@twinkie.Rational.COM)
  
  Sample usage of thack is, say:
  
*** thack.c.orig	Fri Jul 28 13:30:01 1989
--- thack.c	Fri Jul 28 13:48:26 1989
***************
*** 1,5 ****
--- 1,6 ----
  #include "th.h"
  
+ int npages;
  int xpos, ypos, cx, cy;
  int font, cfont, size, csize, tfont, tsize;
  char *pstr, *cstr();
***************
*** 408,413 ****
--- 409,415 ----
  	}
  	if (sflag)
  		endpage();
+ 	epilog();
  }
  
  tprint()
***************
*** 514,524 ****
--- 516,540 ----
  
  newpage()
  {
+ 	printf("%%%%Page: %d %d\n", npages, ++npages);
  	printf("save\n");
  }
  
  prolog()
  {
+ 	long clock = time(0);
+ 	  
+ 	printf("%%!PS-Adobe-\n");
+ 	printf("%%%%Creator: (thack - contact <everson@cs.bris.ac.uk>)\n");
+ 	printf("%%%%Title: unknown\n");
+ 	printf("%%%%CreationDate: %s", asctime (localtime (&clock)));
+ 	printf("%%%%Pages: (atend)\n");
+ 	printf("%%%%DocumentFonts: Times-Roman Times-Italic Times-Bold \
+ 	            Symbol Helvetica Helvetica-Oblique Helvetica-Bold Courier \
+ 		    Courier-Oblique Courier-Bold Times-BoldItalic Helvetica-BoldOblique \
+ 		    Courier-BoldOblique\n");
+ 	printf("%%%%EndComments\n");
+ 
  	printf("/P {moveto show} def\n");
  	printf("/X {currentpoint exch pop moveto show} def\n");
  	printf("/F {findfont exch scalefont setfont} def\n");
***************
*** 536,541 ****
--- 552,560 ----
  	printf("/HBO /Helvetica-BoldOblique def\n");
  	printf("/CBO /Courier-BoldOblique def\n");
  	printf("1 6 div dup scale\n");
+ 
+ 	printf("%%%%EndProlog\n");
+         npages = 0;
  }
  
  endpage()
***************
*** 543,546 ****
--- 562,571 ----
  	printf("showpage\n");
  	printf("restore\n");
  	cfont = csize = -1;	/* Doing this will cause a new font message */
+ }
+ 
+ epilog()
+ {
+   printf("%%%%Trailer\n");
+   printf("%%%%Pages: %d\n", npages);
  }

everson@CompSci.Bristol.AC.UK (Phill Everson ) (08/05/89)

*** README.orig	Sat Aug  5 17:02:43 1989
--- README	Sat Aug  5 17:06:15 1989
***************
*** 1,7 ****
  
  Enclosed please find thack, a Troff C/A/T to Postscript filter, written
  by a colleague of mine, Gareth Waddell. Attempt to make output 
! Adobe-conformant Postscript by David R. Kaelbling (drk@twinkie.Rational.COM)
  
  Sample usage of thack is, say:
  
--- 1,8 ----
  
  Enclosed please find thack, a Troff C/A/T to Postscript filter, written
  by a colleague of mine, Gareth Waddell. Attempt to make output 
! Adobe-conformant Postscript by David R. Kaelbling (drk@twinkie.Rational.COM).
! Thanks to Paul Eggert <eggert@twinsun.com> for fixing a number of bugs.
  
  Sample usage of thack is, say:
  
***************
*** 20,26 ****
  on an Apple Laserwriter I and an Apple Laserwriter IINTX. It can also
  be previewed under Sunview with the Rutherford Postscript Interpreter.
  
! If you're using US paper check you have -GUSPAPERLENGTH set in the
  Makefile, then just make.
  
  Phill Everson
--- 21,27 ----
  on an Apple Laserwriter I and an Apple Laserwriter IINTX. It can also
  be previewed under Sunview with the Rutherford Postscript Interpreter.
  
! If you're using US paper check you have -DUSPAPERLENGTH set in the
  Makefile, then just make.
  
  Phill Everson
*** th.h.orig	Sat Aug  5 16:57:13 1989
--- th.h	Sat Aug  5 16:57:17 1989
***************
*** 1,4 ****
--- 1,9 ----
  #include <stdio.h>
+ #include <sys/types.h>
+ #include <time.h>
+ 
+ time_t time();
+ 
  char *table[2][2]=
  	{ /* FONT 0,1,2,4,5,6,7 */
  	 " htnmlizsdbxfjuk p ; a_c`e'o r v-wq/.g ,&y % QTOHNMLRGIPCVEZDBSY",
*** thack.c.orig	Sat Aug  5 16:57:07 1989
--- thack.c	Sat Aug  5 17:01:56 1989
***************
*** 5,13 ****
  int font, cfont, size, csize, tfont, tsize;
  char *pstr, *cstr();
  
  main()
  {
! 	int c, i;
  	int sflag;
  	int hdist, vdist;
  	int esc, lead;
--- 5,28 ----
  int font, cfont, size, csize, tfont, tsize;
  char *pstr, *cstr();
  
+ #ifndef Y_INITIAL
+ #ifndef PAGELENGTH
+ #ifdef USPAGELENGTH
+ #ifdef sun
+ #define PAGELENGTH 11.1875
+ #else
+ #define PAGELENGTH 11
+ #endif
+ #else
+ #define PAGELENGTH 11.75
+ #endif
+ #endif
+ #define Y_INITIAL ((int)(PAGELENGTH*144 + 0.5))
+ #endif
+ 
  main()
  {
! 	int c;
  	int sflag;
  	int hdist, vdist;
  	int esc, lead;
***************
*** 18,28 ****
  	tfont = font = 0;
  	tsize = size = 12;
  	esc = lead = 1;
! #ifdef USPAGELENGTH
! 	cy = ypos = 1584; /* represents 11 inches in troff vertical units */
! #else
! 	cy = ypos = 1692; /* represents 11.5 inches in troff vertical units */
! #endif
  	cx = xpos = 0;
  	sflag = 0;
  	prolog();
--- 33,39 ----
  	tfont = font = 0;
  	tsize = size = 12;
  	esc = lead = 1;
! 	cy = ypos = Y_INITIAL;
  	cx = xpos = 0;
  	sflag = 0;
  	prolog();
***************
*** 71,77 ****
  						else
  							switch (c & 0x3f) {
  							case 19:
! 								pstr = "\\320";
  								break;	/* \- */
  							case 20:
  								pstr = "\\256";
--- 82,88 ----
  						else
  							switch (c & 0x3f) {
  							case 19:
! 								pstr = "\\261";
  								break;	/* \- */
  							case 20:
  								pstr = "\\256";
***************
*** 483,490 ****
  fontps(f1, ps, str)
  char *str;
  {
! 	tfont = cfont;
! 	tsize = csize;
  	pstr = str;
  	size = ps;
  	font = f1;
--- 494,501 ----
  fontps(f1, ps, str)
  char *str;
  {
! 	tfont = font;
! 	tsize = size;
  	pstr = str;
  	size = ps;
  	font = f1;
***************
*** 516,528 ****
  
  newpage()
  {
! 	printf("%%%%Page: %d %d\n", npages, ++npages);
  	printf("save\n");
  }
  
  prolog()
  {
! 	long clock = time(0);
  	  
  	printf("%%!PS-Adobe-\n");
  	printf("%%%%Creator: (thack - contact <everson@cs.bris.ac.uk>)\n");
--- 527,540 ----
  
  newpage()
  {
! 	++npages;
! 	printf("%%%%Page: %d %d\n", npages, npages);
  	printf("save\n");
  }
  
  prolog()
  {
! 	time_t clock = time((time_t *)0);
  	  
  	printf("%%!PS-Adobe-\n");
  	printf("%%%%Creator: (thack - contact <everson@cs.bris.ac.uk>)\n");
***************
*** 530,538 ****
  	printf("%%%%CreationDate: %s", asctime (localtime (&clock)));
  	printf("%%%%Pages: (atend)\n");
  	printf("%%%%DocumentFonts: Times-Roman Times-Italic Times-Bold \
! 	            Symbol Helvetica Helvetica-Oblique Helvetica-Bold Courier \
! 		    Courier-Oblique Courier-Bold Times-BoldItalic Helvetica-BoldOblique \
! 		    Courier-BoldOblique\n");
  	printf("%%%%EndComments\n");
  
  	printf("/P {moveto show} def\n");
--- 542,550 ----
  	printf("%%%%CreationDate: %s", asctime (localtime (&clock)));
  	printf("%%%%Pages: (atend)\n");
  	printf("%%%%DocumentFonts: Times-Roman Times-Italic Times-Bold \
! Symbol Helvetica Helvetica-Oblique Helvetica-Bold Courier \
! Courier-Oblique Courier-Bold Times-BoldItalic Helvetica-BoldOblique \
! Courier-BoldOblique\n");
  	printf("%%%%EndComments\n");
  
  	printf("/P {moveto show} def\n");