xref: /illumos-gate/usr/src/cmd/tbl/tf.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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  /* tf.c: save and restore fill mode around table */
19 # include "t..c"
20 savefill()
21 {
22 /* remembers various things: fill mode, vs, ps in mac 35 (SF) */
23 fprintf(tabout, ".de %d\n",SF);
24 fprintf(tabout, ".ps \\n(.s\n");
25 fprintf(tabout, ".vs \\n(.vu\n");
26 fprintf(tabout, ".in \\n(.iu\n");
27 fprintf(tabout, ".if \\n(.u .fi\n");
28 fprintf(tabout, ".if \\n(.j .ad\n");
29 fprintf(tabout, ".if \\n(.j=0 .na\n");
30 fprintf(tabout, "..\n");
31 fprintf(tabout, ".nf\n");
32 /* set obx offset if useful */
33 fprintf(tabout, ".nr #~ 0\n");
34 fprintf(tabout, ".if n .nr #~ 0.6n\n");
35 }
36 rstofill()
37 {
38 fprintf(tabout, ".%d\n",SF);
39 }
40 endoff()
41 {
42 int i;
43 	for(i=0; i<MAXHEAD; i++)
44 		if (linestop[i])
45 			fprintf(tabout, ".nr #%c 0\n", 'a'+i);
46 	for(i=0; i<texct; i++)
47 		fprintf(tabout, ".rm %c+\n",texstr[i]);
48 fprintf(tabout, "%s\n", last);
49 }
50 ifdivert()
51 {
52 fprintf(tabout, ".ds #d .d\n");
53 fprintf(tabout, ".if \\(ts\\n(.z\\(ts\\(ts .ds #d nl\n");
54 }
55 saveline()
56 {
57 fprintf(tabout, ".if \\n+(b.=1 .nr d. \\n(.c-\\n(c.-1\n");
58 linstart=iline;
59 }
60 restline()
61 {
62 fprintf(tabout,".if \\n-(b.=0 .nr c. \\n(.c-\\n(d.-%d\n", iline-linstart);
63 linstart = 0;
64 }
65 cleanfc()
66 {
67 fprintf(tabout, ".fc\n");
68 }
69