Annotation of 42BSD/ingres/source/decomp/mapvar.c, revision 1.1.1.1

1.1       root        1: # include      <ingres.h>
                      2: # include      <aux.h>
                      3: # include      <tree.h>
                      4: # include      <symbol.h>
                      5: # include      <sccs.h>
                      6: 
                      7: SCCSID(@(#)mapvar.c    7.1     2/5/81)
                      8: 
                      9: /*
                     10: **     MAPVAR -- construct variable maps for ROOT, AND, and AGHEAD nodes.
                     11: **     tl is a flag  which indicates if the target list should
                     12: **     be included in the mapping.  If tl = 0, it should; else it should not.
                     13: **
                     14: **     Trace Flags:
                     15: **             52
                     16: */
                     17: 
                     18: mapvar(t, tl)
                     19: register QTREE *t;
                     20: int            tl;
                     21: {
                     22:        register int    rmap, lmap;
                     23:        extern QTREE    *ckvar();
                     24: 
                     25:        if (t == NULL)
                     26:                return (NULL);
                     27: 
                     28: # ifdef xDTR3
                     29:        if (tTf(52, 0))
                     30:                printf("mapvar(%x) %c\n", t, t->sym.type);
                     31: # endif xDTR3
                     32: 
                     33:        switch (t->sym.type)
                     34:        {
                     35:          case ROOT:
                     36:          case AND:
                     37:          case AGHEAD:
                     38:                /* map the right side */
                     39:                t->sym.value.sym_root.rvarm = rmap = mapvar(t->right, tl);
                     40: 
                     41:                /* map the left side or else use existing values */
                     42:                if (tl == 0)
                     43:                {
                     44:                        t->sym.value.sym_root.lvarm = lmap = mapvar(t->left, tl);
                     45:                        t->sym.value.sym_root.lvarc = bitcnt(lmap);
                     46:                }
                     47:                else
                     48:                        lmap = t->sym.value.sym_root.lvarm;
                     49: 
                     50:                /* form map of both sides */
                     51:                rmap |= lmap;
                     52: 
                     53:                /* compute total var count */
                     54:                t->sym.value.sym_root.tvarc = bitcnt(rmap);
                     55: 
                     56:                return (rmap);
                     57: 
                     58:          case VAR:
                     59:                if ((t = ckvar(t))->sym.value.sym_var.valptr)
                     60:                        return (NULL);  /* var is a constant */
                     61:                return (01 << t->sym.value.sym_var.varno);
                     62:        }
                     63: 
                     64:        /* node is not a VAR, AND, ROOT, or AGHEAD */
                     65:        return (mapvar(t->left, tl) | mapvar(t->right, tl));
                     66: }

unix.superglobalmegacorp.com

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