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