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