plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

tf.c (1281B)


      1 /* tf.c: save and restore fill mode around table */
      2 # include "t.h"
      3 
      4 void
      5 savefill(void)
      6 {
      7 			/* remembers various things: fill mode, vs, ps in mac 35 (SF) */
      8 	Bprint(&tabout, ".de %d\n", SF);
      9 	Bprint(&tabout, ".ps \\n(.s\n");
     10 	Bprint(&tabout, ".vs \\n(.vu\n");
     11 	Bprint(&tabout, ".in \\n(.iu\n");
     12 	Bprint(&tabout, ".if \\n(.u .fi\n");
     13 	Bprint(&tabout, ".if \\n(.j .ad\n");
     14 	Bprint(&tabout, ".if \\n(.j=0 .na\n");
     15 	Bprint(&tabout, "..\n");
     16 	Bprint(&tabout, ".nf\n");
     17 	/* set obx offset if useful */
     18 	Bprint(&tabout, ".nr #~ 0\n");
     19 	Bprint(&tabout, ".if \\n(.T .if n .nr #~ 0.6n\n");
     20 }
     21 
     22 
     23 void
     24 rstofill(void)
     25 {
     26 	Bprint(&tabout, ".%d\n", SF);
     27 }
     28 
     29 
     30 void
     31 endoff(void)
     32 {
     33 	int	i;
     34 
     35 	for (i = 0; i < MAXHEAD; i++)
     36 		if (linestop[i])
     37 			Bprint(&tabout, ".nr #%c 0\n", linestop[i] + 'a' - 1);
     38 	for (i = 0; i < texct; i++)
     39 		Bprint(&tabout, ".rm %c+\n", texstr[i]);
     40 	Bprint(&tabout, "%s\n", last);
     41 }
     42 
     43 
     44 void
     45 ifdivert(void)
     46 {
     47 	Bprint(&tabout, ".ds #d .d\n");
     48 	Bprint(&tabout, ".if \\(ts\\n(.z\\(ts\\(ts .ds #d nl\n");
     49 }
     50 
     51 
     52 void
     53 saveline(void)
     54 {
     55 	Bprint(&tabout, ".if \\n+(b.=1 .nr d. \\n(.c-\\n(c.-1\n");
     56 	linstart = iline;
     57 }
     58 
     59 
     60 void
     61 restline(void)
     62 {
     63 	Bprint(&tabout, ".if \\n-(b.=0 .nr c. \\n(.c-\\n(d.-%d\n", iline - linstart);
     64 	linstart = 0;
     65 }
     66 
     67 
     68 void
     69 cleanfc(void)
     70 {
     71 	Bprint(&tabout, ".fc\n");
     72 }