Bell 32V development
[unix-history] / usr / src / cmd / tbl / t9.c
CommitLineData
6554f91c
TL
1 /* t9.c: write lines for tables over 200 lines */
2# include "t..c"
3static useln;
4yetmore()
5{
6for(useln=0; useln<MAXLIN && table[useln]==0; useln++);
7if (useln>=MAXLIN)
8 error("Wierd. No data in table.");
9table[0]=table[useln];
10for(useln=nlin-1; useln>=0 && (fullbot[useln] || instead[useln]); useln--);
11if (useln<0)
12 error("Wierd. No real lines in table.");
13domore(leftover);
14while (gets1(cstore=cspace) && domore(cstore))
15 ;
16last =cstore;
17return;
18}
19domore(dataln)
20 char *dataln;
21{
22 int icol, ch;
23if (prefix(".TE", dataln))
24 return(0);
25if (dataln[0] == '.' && !isdigit(dataln[1]))
26 {
27 puts(dataln);
28 return(1);
29 }
30instead[0]=fullbot[0]=0;
31if (dataln[1]==0)
32switch(dataln[0])
33 {
34 case '_': fullbot[0]= '-'; putline(useln,0); return(1);
35 case '=': fullbot[0]= '='; putline(useln, 0); return(1);
36 }
37for (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 }
58while (++icol <ncol)
59 table[0][icol].col = "";
60putline(useln,0);
61return(1);
62}