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