17c478bd9Sstevel@tonic-gate /*
2*b5514887Smuffin * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
37c478bd9Sstevel@tonic-gate * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate */
57c478bd9Sstevel@tonic-gate
67c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
77c478bd9Sstevel@tonic-gate /* All Rights Reserved */
87c478bd9Sstevel@tonic-gate
97c478bd9Sstevel@tonic-gate
107c478bd9Sstevel@tonic-gate /*
117c478bd9Sstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California.
127c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement
137c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution.
147c478bd9Sstevel@tonic-gate */
157c478bd9Sstevel@tonic-gate
167c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
177c478bd9Sstevel@tonic-gate
187c478bd9Sstevel@tonic-gate /* t9.c: write lines for tables over 200 lines */
197c478bd9Sstevel@tonic-gate # include "t..c"
20*b5514887Smuffin
21*b5514887Smuffin static int useln;
22*b5514887Smuffin
23*b5514887Smuffin void
yetmore(void)24*b5514887Smuffin yetmore(void)
257c478bd9Sstevel@tonic-gate {
267c478bd9Sstevel@tonic-gate for(useln=0; useln<MAXLIN && table[useln]==0; useln++);
277c478bd9Sstevel@tonic-gate if (useln>=MAXLIN)
287c478bd9Sstevel@tonic-gate error(gettext("Weird. No data in table."));
297c478bd9Sstevel@tonic-gate table[0]=table[useln];
307c478bd9Sstevel@tonic-gate for(useln=nlin-1; useln>=0 && (fullbot[useln] || instead[useln]); useln--);
317c478bd9Sstevel@tonic-gate if (useln<0)
327c478bd9Sstevel@tonic-gate error(gettext("Weird. No real lines in table."));
337c478bd9Sstevel@tonic-gate domore(leftover);
347c478bd9Sstevel@tonic-gate while (gets1(cstore=cspace, MAXSTR) && domore(cstore))
357c478bd9Sstevel@tonic-gate ;
367c478bd9Sstevel@tonic-gate last =cstore;
377c478bd9Sstevel@tonic-gate return;
387c478bd9Sstevel@tonic-gate }
39*b5514887Smuffin
40*b5514887Smuffin int
domore(char * dataln)41*b5514887Smuffin domore(char *dataln)
427c478bd9Sstevel@tonic-gate {
437c478bd9Sstevel@tonic-gate int icol, ch;
447c478bd9Sstevel@tonic-gate if (prefix(".TE", dataln))
457c478bd9Sstevel@tonic-gate return(0);
467c478bd9Sstevel@tonic-gate if (dataln[0] == '.' && !isdigit((unsigned char)dataln[1]))
477c478bd9Sstevel@tonic-gate {
487c478bd9Sstevel@tonic-gate puts(dataln);
497c478bd9Sstevel@tonic-gate return(1);
507c478bd9Sstevel@tonic-gate }
517c478bd9Sstevel@tonic-gate instead[0]=0;
527c478bd9Sstevel@tonic-gate fullbot[0]=0;
537c478bd9Sstevel@tonic-gate if (dataln[1]==0)
547c478bd9Sstevel@tonic-gate switch(dataln[0])
557c478bd9Sstevel@tonic-gate {
567c478bd9Sstevel@tonic-gate case '_': fullbot[0]= '-'; putline(useln,0); return(1);
577c478bd9Sstevel@tonic-gate case '=': fullbot[0]= '='; putline(useln, 0); return(1);
587c478bd9Sstevel@tonic-gate }
597c478bd9Sstevel@tonic-gate for (icol = 0; icol <ncol; icol++)
607c478bd9Sstevel@tonic-gate {
617c478bd9Sstevel@tonic-gate table[0][icol].col = dataln;
627c478bd9Sstevel@tonic-gate table[0][icol].rcol=0;
637c478bd9Sstevel@tonic-gate for(; (ch= *dataln) != '\0' && ch != tab; dataln++)
647c478bd9Sstevel@tonic-gate ;
657c478bd9Sstevel@tonic-gate *dataln++ = '\0';
667c478bd9Sstevel@tonic-gate switch(ctype(useln,icol))
677c478bd9Sstevel@tonic-gate {
687c478bd9Sstevel@tonic-gate case 'n':
697c478bd9Sstevel@tonic-gate table[0][icol].rcol = maknew(table[0][icol].col);
707c478bd9Sstevel@tonic-gate break;
717c478bd9Sstevel@tonic-gate case 'a':
727c478bd9Sstevel@tonic-gate table[0][icol].rcol = table[0][icol].col;
737c478bd9Sstevel@tonic-gate table[0][icol].col= "";
747c478bd9Sstevel@tonic-gate break;
757c478bd9Sstevel@tonic-gate }
767c478bd9Sstevel@tonic-gate while (ctype(useln,icol+1)== 's') /* spanning */
777c478bd9Sstevel@tonic-gate table[0][++icol].col = "";
787c478bd9Sstevel@tonic-gate if (ch == '\0') break;
797c478bd9Sstevel@tonic-gate }
807c478bd9Sstevel@tonic-gate while (++icol <ncol)
817c478bd9Sstevel@tonic-gate table[0][icol].col = "";
827c478bd9Sstevel@tonic-gate putline(useln,0);
837c478bd9Sstevel@tonic-gate return(1);
847c478bd9Sstevel@tonic-gate }
85