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