home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / src / cmd / tbl / tg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1979-01-10  |  1.8 KB  |  70 lines

  1.  /* tg.c: process included text blocks */
  2. # include "t..c"
  3. gettext(sp, ilin,icol, fn, sz)
  4.     char *sp, *fn, *sz;
  5. {
  6. /* get a section of text */
  7. char line[256];
  8. int oname;
  9. char *vs;
  10. if (texname==0) error("Too many text block diversions");
  11. if (textflg==0)
  12.     {
  13.     fprintf(tabout, ".nr %d \\n(.lu\n", SL); /* remember old line length */
  14.     textflg=1;
  15.     }
  16. fprintf(tabout, ".eo\n");
  17. fprintf(tabout, ".am %02d\n", icol+80);
  18. fprintf(tabout, ".br\n");
  19. fprintf(tabout, ".di %c+\n", texname);
  20. rstofill();
  21. if (fn && *fn) fprintf(tabout, ".nr %d \\n(.f\n.ft %s\n", S1, fn);
  22. fprintf(tabout, ".ft \\n(.f\n"); /* protect font */
  23. vs = vsize[stynum[ilin]][icol];
  24. if ((sz && *sz) || (vs && *vs))
  25.     {
  26.     fprintf(tabout, ".nr %d \\n(.v\n", S2);
  27.     if (vs==0 || *vs==0) vs= "\\n(.s+2";
  28.     if (sz && *sz)
  29.         fprintf(tabout, ".ps %s\n",sz);
  30.     fprintf(tabout, ".vs %s\n",vs);
  31.     fprintf(tabout, ".if \\n(%du>\\n(.vu .sp \\n(%du-\\n(.vu\n", S2,S2);
  32.     }
  33. if (cll[icol][0])
  34.     fprintf(tabout, ".ll %sn\n", cll[icol]);
  35. else
  36.     fprintf(tabout, ".ll \\n(%du*%du/%du\n",SL,ctspan(ilin,icol),ncol+1);
  37. fprintf(tabout,".if \\n(.l<\\n(%d .ll \\n(%du\n", icol+CRIGHT, icol+CRIGHT);
  38. if (ctype(ilin,icol)=='a')
  39.     fprintf(tabout, ".ll -2n\n");
  40. fprintf(tabout, ".in 0\n");
  41. while (gets1(line))
  42.     {
  43.     if (line[0]=='T' && line[1]=='}' && line[2]== tab) break;
  44.     if (match("T}", line)) break;
  45.     fprintf(tabout, "%s\n", line);
  46.     }
  47. if (fn && *fn) fprintf(tabout, ".ft \\n(%d\n", S1);
  48. if (sz && *sz) fprintf(tabout, ".br\n.ps\n.vs\n");
  49. fprintf(tabout, ".br\n");
  50. fprintf(tabout, ".di\n");
  51. fprintf(tabout, ".nr %c| \\n(dn\n", texname);
  52. fprintf(tabout, ".nr %c- \\n(dl\n", texname);
  53. fprintf(tabout, "..\n");
  54. fprintf(tabout, ".ec \\\n");
  55. /* copy remainder of line */
  56. if (line[2])
  57.     tcopy (sp, line+3);
  58. else
  59.     *sp=0;
  60. oname=texname;
  61. texname = texstr[++texct];
  62. return(oname);
  63. }
  64. untext()
  65. {
  66. rstofill();
  67. fprintf(tabout, ".nf\n");
  68. fprintf(tabout, ".ll \\n(%du\n", SL);
  69. }
  70.