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