1 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 2 /* All Rights Reserved */ 3 4 5 /* 6 * Copyright (c) 1980 Regents of the University of California. 7 * All rights reserved. The Berkeley software License Agreement 8 * specifies the terms and conditions for redistribution. 9 */ 10 11 /* 12 * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. 13 * All Rights Reserved. 14 */ 15 16 #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ 17 18 /* tg.c: process included text blocks */ 19 # include "t..c" 20 /* get_text was originally gettext and was renamed */ 21 get_text(sp, ilin,icol, fn, sz) 22 char *sp, *fn, *sz; 23 { 24 /* get a section of text */ 25 char line[BIGBUF]; 26 int oname; 27 char *vs; 28 if (texname==0) error(gettext("Too many text block diversions")); 29 if (textflg==0) 30 { 31 fprintf(tabout, ".nr %d \\n(.lu\n", SL); /* remember old line length */ 32 textflg=1; 33 } 34 fprintf(tabout, ".eo\n"); 35 fprintf(tabout, ".am %02d\n", icol+80); 36 fprintf(tabout, ".br\n"); 37 fprintf(tabout, ".di %c+\n", texname); 38 rstofill(); 39 if (fn && *fn) fprintf(tabout, ".nr %d \\n(.f\n.ft %s\n", S1, fn); 40 fprintf(tabout, ".ft \\n(.f\n"); /* protect font */ 41 vs = vsize[stynum[ilin]][icol]; 42 if ((sz && *sz) || (vs && *vs)) 43 { 44 fprintf(tabout, ".nr %d \\n(.v\n", S2); 45 if (vs==0 || *vs==0) vs= "\\n(.s+2"; 46 if (sz && *sz) 47 fprintf(tabout, ".ps %s\n",sz); 48 fprintf(tabout, ".vs %s\n",vs); 49 fprintf(tabout, ".if \\n(%du>\\n(.vu .sp \\n(%du-\\n(.vu\n", S2,S2); 50 } 51 if (cll[icol][0]) 52 fprintf(tabout, ".ll %sn\n", cll[icol]); 53 else 54 fprintf(tabout, ".ll \\n(%du*%du/%du\n",SL,ctspan(ilin,icol),ncol+1); 55 fprintf(tabout,".if \\n(.l<\\n(%d .ll \\n(%du\n", icol+CRIGHT, icol+CRIGHT); 56 if (ctype(ilin,icol)=='a') 57 fprintf(tabout, ".ll -2n\n"); 58 fprintf(tabout, ".in 0\n"); 59 while (gets1(line, sizeof line)) 60 { 61 if (line[0]=='T' && line[1]=='}' && line[2]== tab) break; 62 if (match("T}", line)) break; 63 fprintf(tabout, "%s\n", line); 64 } 65 if (fn && *fn) fprintf(tabout, ".ft \\n(%d\n", S1); 66 if (sz && *sz) fprintf(tabout, ".br\n.ps\n.vs\n"); 67 fprintf(tabout, ".br\n"); 68 fprintf(tabout, ".di\n"); 69 fprintf(tabout, ".nr %c| \\n(dn\n", texname); 70 fprintf(tabout, ".nr %c- \\n(dl\n", texname); 71 fprintf(tabout, "..\n"); 72 fprintf(tabout, ".ec \\\n"); 73 /* copy remainder of line */ 74 if (line[2]) 75 tcopy (sp, line+3); 76 else 77 *sp=0; 78 oname=texname; 79 texname = texstr[++texct]; 80 return(oname); 81 } 82 untext() 83 { 84 rstofill(); 85 fprintf(tabout, ".nf\n"); 86 fprintf(tabout, ".ll \\n(%du\n", SL); 87 } 88