xref: /csrg-svn/old/tbl/t9.c (revision 48316)
1*48316Sbostic /*-
2*48316Sbostic  * %sccs.include.proprietary.c%
3*48316Sbostic  */
4*48316Sbostic 
514512Ssam #ifndef lint
6*48316Sbostic static char sccsid[] = "@(#)t9.c	4.4 (Berkeley) 04/18/91";
7*48316Sbostic #endif /* not lint */
811036Sshannon 
911036Sshannon  /* t9.c: write lines for tables over 200 lines */
1011036Sshannon # include "t..c"
1111036Sshannon static useln;
yetmore()1211036Sshannon yetmore()
1311036Sshannon {
1411036Sshannon for(useln=0; useln<MAXLIN && table[useln]==0; useln++);
1511036Sshannon if (useln>=MAXLIN)
1638574Smckusick 	error("Weird.  No data in table.");
1711036Sshannon table[0]=table[useln];
1811036Sshannon for(useln=nlin-1; useln>=0 && (fullbot[useln] || instead[useln]); useln--);
1911036Sshannon if (useln<0)
2038574Smckusick 	error("Weird.  No real lines in table.");
2111036Sshannon domore(leftover);
2211036Sshannon while (gets1(cstore=cspace) && domore(cstore))
2311036Sshannon 	;
2411036Sshannon last =cstore;
2511036Sshannon return;
2611036Sshannon }
domore(dataln)2711036Sshannon domore(dataln)
2811036Sshannon 	char *dataln;
2911036Sshannon {
3011036Sshannon 	int icol, ch;
3111036Sshannon if (prefix(".TE", dataln))
3211036Sshannon 	return(0);
3311036Sshannon if (dataln[0] == '.' && !isdigit(dataln[1]))
3411036Sshannon 	{
3511036Sshannon 	puts(dataln);
3611036Sshannon 	return(1);
3711036Sshannon 	}
3811036Sshannon instead[0]=fullbot[0]=0;
3911036Sshannon if (dataln[1]==0)
4011036Sshannon switch(dataln[0])
4111036Sshannon 	{
4211036Sshannon 	case '_': fullbot[0]= '-'; putline(useln,0);  return(1);
4311036Sshannon 	case '=': fullbot[0]= '='; putline(useln, 0); return(1);
4411036Sshannon 	}
4511036Sshannon for (icol = 0; icol <ncol; icol++)
4611036Sshannon 	{
4711036Sshannon 	table[0][icol].col = dataln;
4811036Sshannon 	table[0][icol].rcol=0;
4911036Sshannon 	for(; (ch= *dataln) != '\0' && ch != tab; dataln++)
5011036Sshannon 			;
5111036Sshannon 	*dataln++ = '\0';
5211036Sshannon 	switch(ctype(useln,icol))
5311036Sshannon 		{
5411036Sshannon 		case 'n':
5511036Sshannon 			table[0][icol].rcol = maknew(table[0][icol].col);
5611036Sshannon 			break;
5711036Sshannon 		case 'a':
5811036Sshannon 			table[0][icol].rcol = table[0][icol].col;
5911036Sshannon 			table[0][icol].col= "";
6011036Sshannon 			break;
6111036Sshannon 		}
6211036Sshannon 	while (ctype(useln,icol+1)== 's') /* spanning */
6311036Sshannon 		table[0][++icol].col = "";
6411036Sshannon 	if (ch == '\0') break;
6511036Sshannon 	}
6611036Sshannon while (++icol <ncol)
6711036Sshannon 	table[0][icol].col = "";
6811036Sshannon putline(useln,0);
6911036Sshannon return(1);
7011036Sshannon }
71