1 #ifndef lint 2 static char sccsid[] = "@(#)tb.c 4.2 08/11/83"; 3 #endif 4 5 /* tb.c: check which entries exist, also storage allocation */ 6 # include "t..c" 7 checkuse() 8 { 9 int i,c, k; 10 for(c=0; c<ncol; c++) 11 { 12 used[c]=lused[c]=rused[c]=0; 13 for(i=0; i<nlin; i++) 14 { 15 if (instead[i] || fullbot[i]) continue; 16 k = ctype(i,c); 17 if (k== '-' || k == '=') continue; 18 if ((k=='n'||k=='a')) 19 { 20 rused[c]|= real(table[i][c].rcol); 21 if( !real(table[i][c].rcol)) 22 used[c] |= real(table[i][c].col); 23 if (table[i][c].rcol) 24 lused[c] |= real(table[i][c].col); 25 } 26 else 27 used[c] |= real(table[i][c].col); 28 } 29 } 30 } 31 real(s) 32 char *s; 33 { 34 if (s==0) return(0); 35 if (!point(s)) return(1); 36 if (*s==0) return(0); 37 return(1); 38 } 39 int spcount = 0; 40 extern char * calloc(); 41 # define MAXVEC 20 42 char *spvecs[MAXVEC]; 43 chspace() 44 { 45 char *pp; 46 if (spvecs[spcount]) 47 return(spvecs[spcount++]); 48 if (spcount>=MAXVEC) 49 error("Too many characters in table"); 50 spvecs[spcount++]= pp = calloc(MAXCHS+200,1); 51 if (pp== -1 || pp == 0) 52 error("no space for characters"); 53 return(pp); 54 } 55 # define MAXPC 50 56 char *thisvec; 57 int tpcount = -1; 58 char *tpvecs[MAXPC]; 59 alocv(n) 60 { 61 int *tp, *q; 62 if (tpcount<0 || thisvec+n > tpvecs[tpcount]+MAXCHS) 63 { 64 tpcount++; 65 if (tpvecs[tpcount]==0) 66 { 67 tpvecs[tpcount] = calloc(MAXCHS,1); 68 } 69 thisvec = tpvecs[tpcount]; 70 if (thisvec == -1) 71 error("no space for vectors"); 72 } 73 tp=thisvec; 74 thisvec+=n; 75 for(q=tp; q<thisvec; q++) 76 *q=0; 77 return(tp); 78 } 79 release() 80 { 81 extern char *exstore; 82 /* give back unwanted space in some vectors */ 83 spcount=0; 84 tpcount= -1; 85 exstore=0; 86 } 87