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