tf.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. /* tf.c: save and restore fill mode around table */
  10. # include "t.h"
  11. void
  12. savefill(void)
  13. {
  14. /* remembers various things: fill mode, vs, ps in mac 35 (SF) */
  15. Bprint(&tabout, ".de %d\n", SF);
  16. Bprint(&tabout, ".ps \\n(.s\n");
  17. Bprint(&tabout, ".vs \\n(.vu\n");
  18. Bprint(&tabout, ".in \\n(.iu\n");
  19. Bprint(&tabout, ".if \\n(.u .fi\n");
  20. Bprint(&tabout, ".if \\n(.j .ad\n");
  21. Bprint(&tabout, ".if \\n(.j=0 .na\n");
  22. Bprint(&tabout, "..\n");
  23. Bprint(&tabout, ".nf\n");
  24. /* set obx offset if useful */
  25. Bprint(&tabout, ".nr #~ 0\n");
  26. Bprint(&tabout, ".if \\n(.T .if n .nr #~ 0.6n\n");
  27. }
  28. void
  29. rstofill(void)
  30. {
  31. Bprint(&tabout, ".%d\n", SF);
  32. }
  33. void
  34. endoff(void)
  35. {
  36. int i;
  37. for (i = 0; i < MAXHEAD; i++)
  38. if (linestop[i])
  39. Bprint(&tabout, ".nr #%c 0\n", linestop[i] + 'a' - 1);
  40. for (i = 0; i < texct; i++)
  41. Bprint(&tabout, ".rm %c+\n", texstr[i]);
  42. Bprint(&tabout, "%s\n", last);
  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. void
  51. saveline(void)
  52. {
  53. Bprint(&tabout, ".if \\n+(b.=1 .nr d. \\n(.c-\\n(c.-1\n");
  54. linstart = iline;
  55. }
  56. void
  57. restline(void)
  58. {
  59. Bprint(&tabout, ".if \\n-(b.=0 .nr c. \\n(.c-\\n(d.-%d\n", iline - linstart);
  60. linstart = 0;
  61. }
  62. void
  63. cleanfc(void)
  64. {
  65. Bprint(&tabout, ".fc\n");
  66. }