psfig.diff revision 296373
1These are patches to makes psfig work with groff. They apply to the 2version of psfig in comp.sources.unix/Volume11. After applying them, 3psfig should be recompiled with -DGROFF. The resulting psfig will 4work only with groff, so you might want to install it under a 5different name. The output of this psfig must be processed using the 6macros in the file ../tmac/tmac.psfig. These will automatically add 7the necessary PostScript code to the prologue output by grops. Use of 8the `global' feature in psfig will result in non-conformant PostScript 9which will fail if processed by a page reversal program. Note that 10psfig is unsupported by me (I'm not interested in hearing about psfig 11problems.) For new documents, I recommend using the PostScript 12inclusion features provided by grops. 13 14James Clark 15jjc@jclark.com 16 17*** cmds.c.~1~ Thu Feb 14 16:09:45 1991 18--- cmds.c Mon Mar 4 12:49:26 1991 19*************** 20*** 245,253 **** 21--- 245,261 ---- 22 (void) sprintf(x, "%.2fp", fx); 23 (void) sprintf(y, "%.2fp", fy); 24 } else if (!*x) { 25+ #ifndef GROFF 26 (void) sprintf(x,"(%.2fp*%s/%.2fp)", fx, y, fy); 27+ #else /* GROFF */ 28+ (void) sprintf(x,"(%.0fu*%s/%.0fu)", fx, y, fy); 29+ #endif /* GROFF */ 30 } else if (!*y) { 31+ #ifndef GROFF 32 (void) sprintf(y,"(%.2fp*%s/%.2fp)", fy, x, fx); 33+ #else /* GROFF */ 34+ (void) sprintf(y,"(%.0fu*%s/%.0fu)", fy, x, fx); 35+ #endif /* GROFF */ 36 } 37 38 /* 39*** troff.c.~1~ Thu Feb 14 16:09:48 1991 40--- troff.c Mon Mar 4 12:48:46 1991 41*************** 42*** 26,32 **** 43--- 26,36 ---- 44 } 45 46 47+ #ifndef GROFF 48 char incl_file_s[] = "\\X'f%s'"; 49+ #else /* GROFF */ 50+ char incl_file_s[] = "\\X'ps: file %s'"; 51+ #endif /* GROFF */ 52 includeFile(filenm) 53 char *filenm; { 54 printf(incl_file_s, filenm); 55*************** 56*** 40,52 **** 57--- 44,64 ---- 58 error("buffer overflow"); 59 } 60 61+ #ifndef GROFF 62 char endfig_s[] = "\\X'pendFig'"; 63+ #else /* GROFF */ 64+ char endfig_s[] = "\\X'ps: exec psfigend'"; 65+ #endif /* GROFF */ 66 endfig() { 67 printf(endfig_s); 68 } 69 70 char startfig_s[] = 71+ #ifndef GROFF 72 "\\X'p\\w@\\h@%s@@'\\X'p\\w@\\h@%s@@'\\X'p%.2f'\\X'p%.2f'\\X'p%.2f'\\X'p%.2f'\\X'pstartFig'"; 73+ #else /* GROFF */ 74+ "\\X'ps: exec \\w@\\h@%s@@ \\w@\\h@%s@@ %.2f %.2f %.2f %.2f psfigstart'"; 75+ #endif /* GROFF */ 76 77 startfig(x, y, llx, lly, urx, ury) 78 char *x, *y; 79*************** 80*** 57,63 **** 81--- 69,79 ---- 82 } 83 84 emitDoClip() { 85+ #ifndef GROFF 86 printf("\\X'pdoclip'"); 87+ #else /* GROFF */ 88+ printf("\\X'ps: exec psfigclip'"); 89+ #endif /* GROFF */ 90 } 91 92 flushX() 93*************** 94*** 116,122 **** 95--- 132,142 ---- 96 97 #define isWhite(ch) ((ch) == ' ' || (ch) == '\t' || (ch) == '\n') 98 99+ #ifndef GROFF 100 char literal_s[] = "\\X'p%s'"; 101+ #else /* GROFF */ 102+ char literal_s[] = "\\X'ps: exec %s'"; 103+ #endif /* GROFF */ 104 emitLiteral(text) 105 char *text; { 106 static char litbuf[BUFSZ]; 107