v07i119: Official patch to thack (troff -> ps) #3

Brandon S. Allbery - comp.sources.misc allbery at uunet.UU.NET
Sun Aug 6 12:20:06 AEST 1989


Posting-number: Volume 7, Issue 119
Submitted-by: everson%compsci.bristol.ac.uk at NSFnet-Relay.AC.UK
Archive-name: thack.p3

[Also posted to comp.bugs.misc]

Most of the following patches are due to Paul Eggert
<eggert at twinsun.com> and should help with using thack on non-Sun
machines, also a font handling bugfix and a couple of font fixes,
notably the long dashes which looked so bad in manual pages.

Phill Everson
Medical Imaging
Dept Comp Sci
University of Bristol, UK

*** 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 at 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 at twinkie.Rational.COM).
! Thanks to Paul Eggert <eggert at 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 at 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 at 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");



More information about the Comp.sources.misc mailing list