2 * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
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.
15 #pragma ident "%Z%%M% %I% %E% SMI"
17 /* tg.c: process included text blocks */
19 /* get_text was originally gettext and was renamed */
22 get_text(char *sp
, int ilin
, int icol
, char *fn
, char *sz
)
24 /* get a section of text */
28 if (texname
==0) error(gettext("Too many text block diversions"));
31 fprintf(tabout
, ".nr %d \\n(.lu\n", SL
); /* remember old line length */
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
);
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
))
44 fprintf(tabout
, ".nr %d \\n(.v\n", S2
);
45 if (vs
==0 || *vs
==0) vs
= "\\n(.s+2";
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
);
52 fprintf(tabout
, ".ll %sn\n", cll
[icol
]);
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
))
61 if (line
[0]=='T' && line
[1]=='}' && line
[2]== tab
) break;
62 if (match("T}", line
)) break;
63 fprintf(tabout
, "%s\n", line
);
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 */
79 texname
= texstr
[++texct
];
87 fprintf(tabout
, ".nf\n");
88 fprintf(tabout
, ".ll \\n(%du\n", SL
);