added call to "symbols_init", and fixed problem with argument
[unix-history] / usr / src / old / tbl / tg.c
CommitLineData
476fcd16
SL
1#ifndef lint
2static char sccsid[] = "@(#)tg.c 4.2 %G%";
3#endif
33b55b10
BS
4
5 /* tg.c: process included text blocks */
6# include "t..c"
7gettext(sp, ilin,icol, fn, sz)
8 char *sp, *fn, *sz;
9{
10/* get a section of text */
11char line[256];
12int oname;
13char *vs;
14if (texname==0) error("Too many text block diversions");
15if (textflg==0)
16 {
17 fprintf(tabout, ".nr %d \\n(.lu\n", SL); /* remember old line length */
18 textflg=1;
19 }
20fprintf(tabout, ".eo\n");
21fprintf(tabout, ".am %02d\n", icol+80);
22fprintf(tabout, ".br\n");
23fprintf(tabout, ".di %c+\n", texname);
24rstofill();
25if (fn && *fn) fprintf(tabout, ".nr %d \\n(.f\n.ft %s\n", S1, fn);
26fprintf(tabout, ".ft \\n(.f\n"); /* protect font */
27vs = vsize[stynum[ilin]][icol];
28if ((sz && *sz) || (vs && *vs))
29 {
30 fprintf(tabout, ".nr %d \\n(.v\n", S2);
31 if (vs==0 || *vs==0) 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", S2,S2);
36 }
37if (cll[icol][0])
38 fprintf(tabout, ".ll %sn\n", cll[icol]);
39else
40 fprintf(tabout, ".ll \\n(%du*%du/%du\n",SL,ctspan(ilin,icol),ncol+1);
41fprintf(tabout,".if \\n(.l<\\n(%d .ll \\n(%du\n", icol+CRIGHT, icol+CRIGHT);
42if (ctype(ilin,icol)=='a')
43 fprintf(tabout, ".ll -2n\n");
44fprintf(tabout, ".in 0\n");
45while (gets1(line))
46 {
47 if (line[0]=='T' && line[1]=='}' && line[2]== tab) break;
48 if (match("T}", line)) break;
49 fprintf(tabout, "%s\n", line);
50 }
51if (fn && *fn) fprintf(tabout, ".ft \\n(%d\n", S1);
52if (sz && *sz) fprintf(tabout, ".br\n.ps\n.vs\n");
53fprintf(tabout, ".br\n");
54fprintf(tabout, ".di\n");
55fprintf(tabout, ".nr %c| \\n(dn\n", texname);
56fprintf(tabout, ".nr %c- \\n(dl\n", texname);
57fprintf(tabout, "..\n");
58fprintf(tabout, ".ec \\\n");
59/* copy remainder of line */
60if (line[2])
61 tcopy (sp, line+3);
62else
63 *sp=0;
64oname=texname;
65texname = texstr[++texct];
66return(oname);
67}
68untext()
69{
70rstofill();
71fprintf(tabout, ".nf\n");
72fprintf(tabout, ".ll \\n(%du\n", SL);
73}