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

  1.  /* t9.c: write lines for tables over 200 lines */
  2. # include "t..c"
  3. static useln;
  4. yetmore()
  5. {
  6. for(useln=0; useln<MAXLIN && table[useln]==0; useln++);
  7. if (useln>=MAXLIN)
  8.     error("Wierd.  No data in table.");
  9. table[0]=table[useln];
  10. for(useln=nlin-1; useln>=0 && (fullbot[useln] || instead[useln]); useln--);
  11. if (useln<0)
  12.     error("Wierd.  No real lines in table.");
  13. domore(leftover);
  14. while (gets1(cstore=cspace) && domore(cstore))
  15.     ;
  16. last =cstore;
  17. return;
  18. }
  19. domore(dataln)
  20.     char *dataln;
  21. {
  22.     int icol, ch;
  23. if (prefix(".TE", dataln))
  24.     return(0);
  25. if (dataln[0] == '.' && !isdigit(dataln[1]))
  26.     {
  27.     puts(dataln);
  28.     return(1);
  29.     }
  30. instead[0]=fullbot[0]=0;
  31. if (dataln[1]==0)
  32. switch(dataln[0])
  33.     {
  34.     case '_': fullbot[0]= '-'; putline(useln,0);  return(1);
  35.     case '=': fullbot[0]= '='; putline(useln, 0); return(1);
  36.     }
  37. for (icol = 0; icol <ncol; icol++)
  38.     {
  39.     table[0][icol].col = dataln;
  40.     table[0][icol].rcol=0;
  41.     for(; (ch= *dataln) != '\0' && ch != tab; dataln++)
  42.             ;
  43.     *dataln++ = '\0';
  44.     switch(ctype(useln,icol))
  45.         {
  46.         case 'n':
  47.             table[0][icol].rcol = maknew(table[0][icol].col);
  48.             break;
  49.         case 'a':
  50.             table[0][icol].rcol = table[0][icol].col;
  51.             table[0][icol].col= "";
  52.             break;
  53.         }
  54.     while (ctype(useln,icol+1)== 's') /* spanning */
  55.         table[0][++icol].col = "";
  56.     if (ch == '\0') break;
  57.     }
  58. while (++icol <ncol)
  59.     table[0][icol].col = "";
  60. putline(useln,0);
  61. return(1);
  62. }
  63.