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