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