/* $MirOS: src/usr.bin/oldroff/tbl/t5.c,v 1.3 2008/11/08 23:04:53 tg Exp $ */ /*- * Copyright (c) 1979, 1980, 1981, 1986, 1988, 1990, 1991, 1992 * The Regents of the University of California. * Copyright (C) Caldera International Inc. 2001-2002. * Copyright (c) 2003, 2004 * Thorsten "mirabilos" Glaser * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code and documentation must retain * the above copyright notice, this list of conditions and the * following disclaimer. Redistributions in binary form must * reproduce the above copyright notice, this list of conditions * and the following disclaimer in the documentation and/or other * materials provided with the distribution. * * All advertising materials mentioning features or use of this * software must display the following acknowledgement: * This product includes software developed or owned by * Caldera International, Inc. * * Neither the name of Caldera International, Inc. nor the names * of other contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA * INTERNATIONAL, INC. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE * LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* t5.c: read data for table */ # include "t..c" __SCCSID("@(#)t5.c 4.4 (Berkeley) 4/18/91"); __RCSID("$MirOS: src/usr.bin/oldroff/tbl/t5.c,v 1.3 2008/11/08 23:04:53 tg Exp $"); gettbl() { extern char *gettext(char *, int, int, char *, char *); int icol, ch; cstore=cspace= chspace(); textflg=0; for (nlin=nslin=0; gets1(cstore); nlin++) { stynum[nlin]=nslin; if (prefix(".TE", cstore)) { leftover=0; break; } if (prefix(".TC", cstore) || prefix(".T&", cstore)) { readspec(); nslin++; } if (nlin>=MAXLIN) { leftover=(int)cstore; break; } fullbot[nlin]=0; if (cstore[0] == '.' && !isdigit(cstore[1])) { instead[nlin] = cstore; while (*cstore++); continue; } else instead[nlin] = 0; if (nodata(nlin)) { if (ch = oneh(nlin)) fullbot[nlin]= ch; nlin++; nslin++; instead[nlin]=(char *)0; fullbot[nlin]=0; } table[nlin] = (struct colstr *)alocv((ncol+2)*sizeof(table[0][0])); if (cstore[1]==0) switch(cstore[0]) { case '_': fullbot[nlin]= '-'; continue; case '=': fullbot[nlin]= '='; continue; } stynum[nlin] = nslin; nslin = min(nslin+1, nclin-1); for (icol = 0; icol MAXCHS) cstore = cspace = chspace(); } last = cstore; permute(); if (textflg) untext(); return; } nodata(il) { int c; for (c=0; c=nlin)return(0); if (ij<0) return(0); if (ij>(ncol+1))return(0); if (instead[ir]) return(0); if (ifform==0 && ctype(ir,ij)=='^') return(1); if (table[ir] == NULL) return(0); if (table[ir][ij].rcol!=0) return(0); if (fullbot[ir]) return(0); return(vspen(table[ir][ij].col)); } vspen(s) char *s; { if (s==0) return(0); if (!point(s)) return(0); return(match(s, SPAN)); }