1*0Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 2*0Sstevel@tonic-gate /* All Rights Reserved */ 3*0Sstevel@tonic-gate 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gate /* 6*0Sstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California. 7*0Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 8*0Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 9*0Sstevel@tonic-gate */ 10*0Sstevel@tonic-gate 11*0Sstevel@tonic-gate /* 12*0Sstevel@tonic-gate * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. 13*0Sstevel@tonic-gate * All Rights Reserved. 14*0Sstevel@tonic-gate */ 15*0Sstevel@tonic-gate 16*0Sstevel@tonic-gate #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ 17*0Sstevel@tonic-gate 18*0Sstevel@tonic-gate /* tb.c: check which entries exist, also storage allocation */ 19*0Sstevel@tonic-gate # include "t..c" 20*0Sstevel@tonic-gate checkuse() 21*0Sstevel@tonic-gate { 22*0Sstevel@tonic-gate int i,c, k; 23*0Sstevel@tonic-gate for(c=0; c<ncol; c++) 24*0Sstevel@tonic-gate { 25*0Sstevel@tonic-gate used[c]=lused[c]=rused[c]=0; 26*0Sstevel@tonic-gate for(i=0; i<nlin; i++) 27*0Sstevel@tonic-gate { 28*0Sstevel@tonic-gate if (instead[i] || fullbot[i]) continue; 29*0Sstevel@tonic-gate k = ctype(i,c); 30*0Sstevel@tonic-gate if (k== '-' || k == '=') continue; 31*0Sstevel@tonic-gate if ((k=='n'||k=='a')) 32*0Sstevel@tonic-gate { 33*0Sstevel@tonic-gate rused[c]|= real(table[i][c].rcol); 34*0Sstevel@tonic-gate if( !real(table[i][c].rcol)) 35*0Sstevel@tonic-gate used[c] |= real(table[i][c].col); 36*0Sstevel@tonic-gate if (table[i][c].rcol) 37*0Sstevel@tonic-gate lused[c] |= real(table[i][c].col); 38*0Sstevel@tonic-gate } 39*0Sstevel@tonic-gate else 40*0Sstevel@tonic-gate used[c] |= real(table[i][c].col); 41*0Sstevel@tonic-gate } 42*0Sstevel@tonic-gate } 43*0Sstevel@tonic-gate } 44*0Sstevel@tonic-gate real(s) 45*0Sstevel@tonic-gate char *s; 46*0Sstevel@tonic-gate { 47*0Sstevel@tonic-gate if (s==0) return(0); 48*0Sstevel@tonic-gate if (!point(s)) return(1); 49*0Sstevel@tonic-gate if (*s==0) return(0); 50*0Sstevel@tonic-gate return(1); 51*0Sstevel@tonic-gate } 52*0Sstevel@tonic-gate int spcount = 0; 53*0Sstevel@tonic-gate extern char * calloc(); 54*0Sstevel@tonic-gate # define MAXVEC 20 55*0Sstevel@tonic-gate char *spvecs[MAXVEC]; 56*0Sstevel@tonic-gate 57*0Sstevel@tonic-gate char * 58*0Sstevel@tonic-gate chspace() 59*0Sstevel@tonic-gate { 60*0Sstevel@tonic-gate char *pp; 61*0Sstevel@tonic-gate if (spvecs[spcount]) 62*0Sstevel@tonic-gate return(spvecs[spcount++]); 63*0Sstevel@tonic-gate if (spcount>=MAXVEC) 64*0Sstevel@tonic-gate error(gettext("Too many characters in table")); 65*0Sstevel@tonic-gate spvecs[spcount++]= pp = calloc(MAXCHS+MAXSTR,1); 66*0Sstevel@tonic-gate if (pp == 0) 67*0Sstevel@tonic-gate error(gettext("no space for characters")); 68*0Sstevel@tonic-gate return(pp); 69*0Sstevel@tonic-gate } 70*0Sstevel@tonic-gate # define MAXPC 50 71*0Sstevel@tonic-gate char *thisvec; 72*0Sstevel@tonic-gate int tpcount = -1; 73*0Sstevel@tonic-gate char *tpvecs[MAXPC]; 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate int * 76*0Sstevel@tonic-gate alocv(n) 77*0Sstevel@tonic-gate { 78*0Sstevel@tonic-gate int *tp, *q; 79*0Sstevel@tonic-gate if (tpcount<0 || thisvec+n > tpvecs[tpcount]+MAXCHS) 80*0Sstevel@tonic-gate { 81*0Sstevel@tonic-gate tpcount++; 82*0Sstevel@tonic-gate if (tpvecs[tpcount]==0) 83*0Sstevel@tonic-gate { 84*0Sstevel@tonic-gate tpvecs[tpcount] = calloc(MAXCHS,1); 85*0Sstevel@tonic-gate } 86*0Sstevel@tonic-gate thisvec = tpvecs[tpcount]; 87*0Sstevel@tonic-gate if (thisvec == 0) 88*0Sstevel@tonic-gate error(gettext("no space for vectors")); 89*0Sstevel@tonic-gate } 90*0Sstevel@tonic-gate tp=(int *)thisvec; 91*0Sstevel@tonic-gate thisvec+=n; 92*0Sstevel@tonic-gate for(q=tp; q<(int *)thisvec; q++) 93*0Sstevel@tonic-gate *q=0; 94*0Sstevel@tonic-gate return(tp); 95*0Sstevel@tonic-gate } 96*0Sstevel@tonic-gate release() 97*0Sstevel@tonic-gate { 98*0Sstevel@tonic-gate extern char *exstore; 99*0Sstevel@tonic-gate /* give back unwanted space in some vectors */ 100*0Sstevel@tonic-gate spcount=0; 101*0Sstevel@tonic-gate tpcount= -1; 102*0Sstevel@tonic-gate exstore=0; 103*0Sstevel@tonic-gate } 104