Annotation of researchv9/cmd/tbl/tb.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.