1: # include "../ingres.h"
2: # include "../tree.h"
3: # include "../symbol.h"
4: # include "qrymod.h"
5:
6: /*
7: ** TREE -- create new tree node.
8: **
9: ** This is a stripped down version of the same thing in the
10: ** parser.
11: **
12: ** It only knows about lengths of zero and two.
13: **
14: ** Parameters:
15: ** lptr -- the left pointer.
16: ** rptr -- the right pointer.
17: ** typ -- the node type.
18: ** len -- the node length.
19: ** value -- the node value.
20: **
21: ** Returns:
22: ** A pointer to the created node.
23: **
24: ** Side Effects:
25: ** Space is taken from Qbuf.
26: **
27: ** Requires:
28: ** need -- to get space from Qbuf.
29: **
30: ** History:
31: ** 2/14/79 -- version 6.2/0 release.
32: */
33:
34:
35: QTREE *
36: tree(lptr, rptr, typ, len, value)
37: QTREE *lptr;
38: QTREE *rptr;
39: char typ;
40: int len;
41: int value;
42: {
43: register QTREE *tptr;
44: extern char *need();
45: register int l;
46:
47: l = len;
48:
49: tptr = (QTREE *) need(Qbuf, l + 6);
50: tptr->left = lptr;
51: tptr->right = rptr;
52: tptr->sym.type = typ;
53: tptr->sym.len = l;
54:
55: if (l > 0)
56: tptr->sym.value[0] = value;
57: return (tptr);
58: }
Defined functions
tree
defined in line
35; used 14 times