1 /* tg.c: process included text blocks */
5 gettext(char *sp
, int ilin
, int icol
, char *fn
, char *sz
)
7 /* get a section of text */
14 error("Too many text block diversions");
16 fprintf(tabout
, ".nr %d \\n(.lu\n", SL
); /* remember old line length */
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
);
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)
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
);
38 fprintf(tabout
, ".ll %sn\n", cll
[icol
]);
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
),
43 if (ctype(ilin
, icol
) == 'a')
44 fprintf(tabout
, ".ll -2n\n");
45 fprintf(tabout
, ".in 0\n");
47 if (gets1(line
, sizeof(line
)) == nil
) {
49 error("missing closing T}");
51 if (line
[0] == 'T' && line
[1] == '}' && line
[2] == tab
)
53 if (match("T}", line
))
55 fprintf(tabout
, "%s\n", line
);
58 fprintf(tabout
, ".ft \\n(%d\n", S1
);
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 */
73 texname
= texstr
[++texct
];
82 fprintf(tabout
, ".nf\n");
83 fprintf(tabout
, ".ll \\n(%du\n", SL
);