dpost.ps: increase linewidth to match groff
[troff.git] / tbl / tg.c
blobf475aec4736f72741856d5b73511df2cc0edb07d
1 /* tg.c: process included text blocks */
2 # include "t.h"
4 int
5 gettext(char *sp, int ilin, int icol, char *fn, char *sz)
7 /* get a section of text */
8 char line[4096];
9 int oname, startline;
10 char *vs;
12 startline = iline;
13 if (texname == 0)
14 error("Too many text block diversions");
15 if (textflg == 0) {
16 fprintf(tabout, ".nr %d \\n(.lu\n", SL); /* remember old line length */
17 textflg = 1;
19 fprintf(tabout, ".eo\n");
20 fprintf(tabout, ".am %s\n", reg(icol, CRIGHT));
21 fprintf(tabout, ".br\n");
22 fprintf(tabout, ".di %c+\n", texname);
23 rstofill();
24 if (fn && *fn)
25 fprintf(tabout, ".nr %d \\n(.f\n.ft %s\n", S1, fn);
26 fprintf(tabout, ".ft \\n(.f\n"); /* protect font */
27 vs = vsize[icol][stynum[ilin]];
28 if ((sz && *sz) || (vs && *vs)) {
29 fprintf(tabout, ".nr %d \\n(.v\n", S9);
30 if (vs == 0 || *vs == 0)
31 vs = "\\n(.s+2";
32 if (sz && *sz)
33 fprintf(tabout, ".ps %s\n", sz);
34 fprintf(tabout, ".vs %s\n", vs);
35 fprintf(tabout, ".if \\n(%du>\\n(.vu .sp \\n(%du-\\n(.vu\n", S9, S9);
37 if (cll[icol][0])
38 fprintf(tabout, ".ll %sn\n", cll[icol]);
39 else
40 fprintf(tabout, ".ll \\n(%du*%du/%du\n", SL, ctspan(ilin, icol), ncol + 1);
41 fprintf(tabout, ".if \\n(.l<\\n(%2s .ll \\n(%2su\n", reg(icol, CRIGHT),
42 reg(icol, CRIGHT));
43 if (ctype(ilin, icol) == 'a')
44 fprintf(tabout, ".ll -2n\n");
45 fprintf(tabout, ".in 0\n");
46 for (;;) {
47 if (gets1(line, sizeof(line)) == nil) {
48 iline = startline;
49 error("missing closing T}");
51 if (line[0] == 'T' && line[1] == '}' && line[2] == tab)
52 break;
53 if (match("T}", line))
54 break;
55 fprintf(tabout, "%s\n", line);
57 if (fn && *fn)
58 fprintf(tabout, ".ft \\n(%d\n", S1);
59 if (sz && *sz)
60 fprintf(tabout, ".br\n.ps\n.vs\n");
61 fprintf(tabout, ".br\n");
62 fprintf(tabout, ".di\n");
63 fprintf(tabout, ".nr %c| \\n(dn\n", texname);
64 fprintf(tabout, ".nr %c- \\n(dl\n", texname);
65 fprintf(tabout, "..\n");
66 fprintf(tabout, ".ec \\\n");
67 /* copy remainder of line */
68 if (line[2])
69 tcopy (sp, line + 3);
70 else
71 *sp = 0;
72 oname = texname;
73 texname = texstr[++texct];
74 return(oname);
78 void
79 untext(void)
81 rstofill();
82 fprintf(tabout, ".nf\n");
83 fprintf(tabout, ".ll \\n(%du\n", SL);