175584SruThese are patches to makes psfig work with groff.  They apply to the
275584Sruversion of psfig in comp.sources.unix/Volume11.  After applying them,
375584Srupsfig should be recompiled with -DGROFF.  The resulting psfig will
475584Sruwork only with groff, so you might want to install it under a
575584Srudifferent name.  The output of this psfig must be processed using the
675584Srumacros in the file ../tmac/tmac.psfig.  These will automatically add
775584Sruthe necessary PostScript code to the prologue output by grops.  Use of
875584Sruthe `global' feature in psfig will result in non-conformant PostScript
975584Sruwhich will fail if processed by a page reversal program.  Note that
1075584Srupsfig is unsupported by me (I'm not interested in hearing about psfig
1175584Sruproblems.)  For new documents, I recommend using the PostScript
1275584Sruinclusion features provided by grops.
1375584Sru
1475584SruJames Clark
1575584Srujjc@jclark.com
1675584Sru
1775584Sru*** cmds.c.~1~	Thu Feb 14 16:09:45 1991
1875584Sru--- cmds.c	Mon Mar  4 12:49:26 1991
1975584Sru***************
2075584Sru*** 245,253 ****
2175584Sru--- 245,261 ----
2275584Sru  		(void) sprintf(x, "%.2fp", fx);
2375584Sru  		(void) sprintf(y, "%.2fp", fy);
2475584Sru  	} else if (!*x) {
2575584Sru+ #ifndef GROFF
2675584Sru  		(void) sprintf(x,"(%.2fp*%s/%.2fp)", fx, y, fy);
2775584Sru+ #else /* GROFF */
2875584Sru+ 		(void) sprintf(x,"(%.0fu*%s/%.0fu)", fx, y, fy);
2975584Sru+ #endif /* GROFF */
3075584Sru  	} else if (!*y) {
3175584Sru+ #ifndef GROFF
3275584Sru  		(void) sprintf(y,"(%.2fp*%s/%.2fp)", fy, x, fx);
3375584Sru+ #else /* GROFF */
3475584Sru+ 		(void) sprintf(y,"(%.0fu*%s/%.0fu)", fy, x, fx);
3575584Sru+ #endif /* GROFF */
3675584Sru  	}
3775584Sru  
3875584Sru  	/* 
3975584Sru*** troff.c.~1~	Thu Feb 14 16:09:48 1991
4075584Sru--- troff.c	Mon Mar  4 12:48:46 1991
4175584Sru***************
4275584Sru*** 26,32 ****
4375584Sru--- 26,36 ----
4475584Sru  }
4575584Sru  
4675584Sru  
4775584Sru+ #ifndef GROFF
4875584Sru  char incl_file_s[] = "\\X'f%s'";
4975584Sru+ #else /* GROFF */
5075584Sru+ char incl_file_s[] = "\\X'ps: file %s'";
5175584Sru+ #endif /* GROFF */
5275584Sru  includeFile(filenm)
5375584Sru  char *filenm; {
5475584Sru  	printf(incl_file_s, filenm);
5575584Sru***************
5675584Sru*** 40,52 ****
5775584Sru--- 44,64 ----
5875584Sru  		error("buffer overflow");
5975584Sru  }
6075584Sru  
6175584Sru+ #ifndef GROFF
6275584Sru  char endfig_s[] = "\\X'pendFig'";
6375584Sru+ #else /* GROFF */
6475584Sru+ char endfig_s[] = "\\X'ps: exec psfigend'";
6575584Sru+ #endif /* GROFF */
6675584Sru  endfig() {
6775584Sru  	printf(endfig_s);
6875584Sru  }
6975584Sru  
7075584Sru  char startfig_s[] =
7175584Sru+ #ifndef GROFF
7275584Sru  "\\X'p\\w@\\h@%s@@'\\X'p\\w@\\h@%s@@'\\X'p%.2f'\\X'p%.2f'\\X'p%.2f'\\X'p%.2f'\\X'pstartFig'";
7375584Sru+ #else /* GROFF */
7475584Sru+ "\\X'ps: exec \\w@\\h@%s@@ \\w@\\h@%s@@ %.2f %.2f %.2f %.2f psfigstart'";
7575584Sru+ #endif /* GROFF */
7675584Sru  
7775584Sru  startfig(x, y, llx, lly, urx, ury)
7875584Sru  char	*x, *y;
7975584Sru***************
8075584Sru*** 57,63 ****
8175584Sru--- 69,79 ----
8275584Sru  }
8375584Sru  
8475584Sru  emitDoClip() {
8575584Sru+ #ifndef GROFF
8675584Sru  	printf("\\X'pdoclip'");
8775584Sru+ #else /* GROFF */
8875584Sru+ 	printf("\\X'ps: exec psfigclip'");
8975584Sru+ #endif /* GROFF */
9075584Sru  }
9175584Sru  
9275584Sru  flushX()
9375584Sru***************
9475584Sru*** 116,122 ****
9575584Sru--- 132,142 ----
9675584Sru  
9775584Sru  #define isWhite(ch) ((ch) == ' ' || (ch) == '\t' || (ch) == '\n')
9875584Sru  
9975584Sru+ #ifndef GROFF
10075584Sru  char literal_s[] = "\\X'p%s'";
10175584Sru+ #else /* GROFF */
10275584Sru+ char literal_s[] = "\\X'ps: exec %s'";
10375584Sru+ #endif /* GROFF */
10475584Sru  emitLiteral(text)
10575584Sru  char *text; {
10675584Sru  	static char litbuf[BUFSZ];
107