# 2.11BSD#431 - /usr/ingres/source/decomp/makenode.c

##### Functions

    copy_ands         X
    copytree          X
    makavar           X
    makresdom         X
    makroot           X

       1: # include   "../ingres.h"
       2: # include   "../tree.h"
       3: # include   "../symbol.h"
       4: # include   "decomp.h"
       5:
       6:
       7: extern struct querytree     *need();
       8:
       9:
      10: struct querytree *copytree(root, buf)
      11: struct querytree    *root;
      12: char            *buf;
      13:
      14: /*
      15: **	Make a copy of a tree.
      16: */
      17:
      18: {
      19:     register struct querytree   *r, *q;
      20:     register int            length;
      21:
      22:     r = root;
      23:
      24:     if (!r)
      25:         return (0);
      26:
      27:     length = r->sym.len & I1MASK;
      28:     q = need(buf, length + 6);
      29:     bmove(&r->sym, &q->sym, length + 2);
      30:
      31:     q->left = copytree(r->left, buf);
      32:     q->right = copytree(r->right, buf);
      33:
      34:     return (q);
      35: }
      36: struct querytree *copy_ands(root, buf)
      37: struct querytree    *root;
      38: char            *buf;
      39:
      40: /*
      41: **	Make a new copy of the root by making
      42: **	new AND nodes and connecting them to the
      43: **	same branches.
      44: */
      45: {
      46:     register struct querytree   *q;
      47:     register struct querytree   *x, *y;
      48:     struct querytree        *newroot;
      49:
      50: #	ifdef xDTR1
      51:     if (tTf(10, -1))
      52:         printf("COPY_ANDS");
      53: #	endif
      54:     newroot = need(buf, 0);
      55:     y = 0;
      56:
      57:     for (q=root; q->sym.type != QLEND; q=q->right)
      58:     {
      59:         x = need(buf, q->sym.len + 6);
      60:         x->left = q->left;
      61:         bmove(&q->sym, &x->sym, q->sym.len + 2);
      62:         if (y)
      63:             y->right = x;
      64:         y = x;
      65:     }
      66:     y->right = q;
      67:
      68: #	ifdef xDTR1
      69:     if (tTf(10, 0))
      70:         printree(newroot, "Newtree");
      71: #	endif
      72:     return(newroot);
      73: }
      74:
      75:
      76:
      77: struct querytree *makroot(buf)
      78: char    *buf;
      79: {
      80:     register struct querytree *s;
      81:
      82:     s = need(buf, 14);
      83:     s->right = Qle;
      84:     s->left = Tr;
      85:     ((struct qt_root *)s)->rootuser = ((struct qt_root *)s)->lvarm = ((struct qt_root *)s)->rvarm = ((struct qt_root *)s)->tvarc = ((struct qt_root *)s)->lvarc = 0;
      86:     s->sym.type = ROOT;
      87:     s->sym.len = 8;
      88:     return (s);
      89: }
      90:
      91:
      92: struct querytree *makresdom(buf, node)
      93: char            *buf;
      94: struct querytree    *node;
      95: {
      96:     register struct querytree   *res, *n;
      97:
      98:     n = node;
      99:     res = need(buf, 10);
     100:     res->sym.type = RESDOM;
     101:     res->sym.len = 4;
     102:     if (n->sym.type == AOP)
     103:     {
     104:         ((struct qt_var *)res)->frmt = ((struct qt_ag *)n)->agfrmt;
     105:         ((struct qt_var *)res)->frml = ((struct qt_ag *)n)->agfrml;
     106:     }
     107:     else
     108:     {
     109:         ((struct qt_var *)res)->frmt = ((struct qt_var *)n)->frmt;
     110:         ((struct qt_var *)res)->frml = ((struct qt_var *)n)->frml;
     111:     }
     112:     return (res);
     113: }
     114:
     115: struct querytree *makavar(node, varnum, attnum)
     116: struct querytree    *node;
     117: int         varnum, attnum;
     118: {
     119:     register struct querytree *avar, *n;
     120:
     121:     n = node;
     122:     avar = need(Qbuf, 12);
     123:     avar->left = avar->right = (struct querytree *) 0;
     124:     ((struct qt_var *)avar)->valptr = (char *) 0;
     125:     avar->sym.type = VAR;
     126:     avar->sym.len = 6;
     127:     ((struct qt_var *)avar)->frmt = ((struct qt_var *)n)->frmt;
     128:     ((struct qt_var *)avar)->frml = ((struct qt_var *)n)->frml;
     129:     ((struct qt_var *)avar)->varno = varnum;
     130:     ((struct qt_var *)avar)->attno = attnum;
     131: #	ifdef xDTR1
     132:     if (tTf(14, 3))
     133:     {
     134:         printf("makavar: node=%l  ", n);
     135:         writenod(avar);
     136:     }
     137: #	endif
     138:     return(avar);
     139: }

#### Defined functions

copy_ands defined in line 36; used 4 times

- in /usr/ingres/source/decomp/decision.c line 60, 213
- in /usr/ingres/source/decomp/decomp.c line 156, 218

copytree defined in line 10; used 8 times

- in line 31-32(2)
- in /usr/ingres/source/decomp/byeval.c line 68, 148, 274, 299
- in /usr/ingres/source/decomp/pull_sq.c line 200, 230

makavar defined in line 115; used 14 times

- in /usr/ingres/source/decomp/ageval.c line 48, 81
- in /usr/ingres/source/decomp/aggregate.c line 67, 189, 213, 481, 543
- in /usr/ingres/source/decomp/byeval.c line 68, 182, 197, 274, 300
- in /usr/ingres/source/decomp/ret_unique.c line 49, 62

makresdom defined in line 92; used 7 times

- in /usr/ingres/source/decomp/ageval.c line 47, 72
- in /usr/ingres/source/decomp/byeval.c line 68, 146, 176
- in /usr/ingres/source/decomp/pull_sq.c line 200, 223

makroot defined in line 77; used 12 times

- in /usr/ingres/source/decomp/ageval.c line 46, 62
- in /usr/ingres/source/decomp/byeval.c line 68, 134
- in /usr/ingres/source/decomp/pull_const.c line 28, 41
- in /usr/ingres/source/decomp/pull_sq.c line 26, 99
- in /usr/ingres/source/decomp/reduction.c line 172, 184
- in /usr/ingres/source/decomp/reformat.c line 208, 248

Last modified: 1995-04-14 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1185 |