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