groff before CVS: release 1.07
[s-roff.git] / grops / psfig.diff
blob77217742dcd90e423dc349b727d27e91a820e89c
1 These are patches to makes psfig work with groff. They apply to the
2 version of psfig in comp.sources.unix/Volume11. After applying them,
3 psfig should be recompiled with -DGROFF. The resulting psfig will
4 work only with groff, so you might want to install it under a
5 different name. The output of this psfig must be processed using the
6 macros in the file ../macros/tmac.psfig. These will automatically add
7 the necessary PostScript code to the prologue output by grops. Use of
8 the `global' feature in psfig will result in non-conformant PostScript
9 which will fail if processed by a page reversal program. Note that
10 psfig is unsupported by me (I'm not interested in hearing about psfig
11 problems.) For new documents, I recommend using the PostScript
12 inclusion features provided by grops.
14 James Clark
15 jjc@jclark.com
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 */
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 ----
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");
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);
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 */
77 startfig(x, y, llx, lly, urx, ury)
78 char *x, *y;
79 ***************
80 *** 57,63 ****
81 --- 69,79 ----
84 emitDoClip() {
85 + #ifndef GROFF
86 printf("\\X'pdoclip'");
87 + #else /* GROFF */
88 + printf("\\X'ps: exec psfigclip'");
89 + #endif /* GROFF */
92 flushX()
93 ***************
94 *** 116,122 ****
95 --- 132,142 ----
97 #define isWhite(ch) ((ch) == ' ' || (ch) == '\t' || (ch) == '\n')
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];