Annotation of 41BSD/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: 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== -1 || pp == 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: alocv(n)
                     56: {
                     57: int *tp, *q;
                     58: if (tpcount<0 || thisvec+n > tpvecs[tpcount]+MAXCHS)
                     59:        {
                     60:        tpcount++;
                     61:        if (tpvecs[tpcount]==0)
                     62:                {
                     63:                tpvecs[tpcount] = calloc(MAXCHS,1);
                     64:                }
                     65:        thisvec = tpvecs[tpcount];
                     66:        if (thisvec == -1)
                     67:                error("no space for vectors");
                     68:        }
                     69: tp=thisvec;
                     70: thisvec+=n;
                     71: for(q=tp; q<thisvec; q++)
                     72:        *q=0;
                     73: return(tp);
                     74: }
                     75: release()
                     76: {
                     77: extern char *exstore;
                     78: /* give back unwanted space in some vectors */
                     79: spcount=0;
                     80: tpcount= -1;
                     81: exstore=0;
                     82: }

unix.superglobalmegacorp.com

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