|
|
1.1 ! root 1: /* ! 2: ** TREE.H -- defines the structure of a querytree ! 3: ** ! 4: ** Version: ! 5: ** @(#)tree.h 7.1 2/5/81 ! 6: */ ! 7: ! 8: ! 9: # ifndef QT_HDR_SIZ ! 10: ! 11: # include <ingres.h> ! 12: ! 13: ! 14: /* ! 15: ** Structures Used In The Value Fields of Querytree nodes ! 16: */ ! 17: ! 18: /* ! 19: ** VAR node ! 20: ** ! 21: ** This node type contains info for a tuple variable. ! 22: ** varno -- index into range table ! 23: ** attno -- attribute number in this relation ! 24: ** varfrmt -- type of this domain ! 25: ** varfrml -- length of this domain ! 26: ** valptr -- pointer to value when bound. ! 27: ** ! 28: ** If varno == -1, then this variable has been substituted; to ! 29: ** get the actual VAR node, follow the chain of valptr's. ! 30: */ ! 31: ! 32: struct varnode ! 33: { ! 34: char varno; /* variable number */ ! 35: char attno; /* attribute number */ ! 36: char varfrmt; /* type */ ! 37: char varfrml; /* length */ ! 38: ANYTYPE *valptr; /* pointer to value */ ! 39: }; ! 40: ! 41: ! 42: /* ! 43: ** STRUCTURE FOR AND, AGHEAD, AND ROOT NODES ! 44: ** ! 45: ** In the parser and qrymod none of these fields are used. ! 46: ** Decomp maintains information about the variables ! 47: ** in the left and right descendents of the nodes. ! 48: ** The "rootuser" flag is present only in the ROOT and AGHEAD ! 49: ** nodes. It is TRUE only in the original ROOT node of the query. ! 50: */ ! 51: ! 52: struct rootnode /* AND, AGHEAD, ROOT nodes */ ! 53: { ! 54: char tvarc; /* total of var's in sub-tree */ ! 55: char lvarc; /* # of variables in left branch */ ! 56: short lvarm; /* bit map of var's in left branch */ ! 57: short rvarm; /* bit map of var's in right branch*/ ! 58: short rootuser; /* flag: TRUE if root of user generated query */ ! 59: }; ! 60: ! 61: struct opnode /* AOP, BOP, UOP nodes */ ! 62: { ! 63: short opno; /* operator number */ ! 64: char opfrmt; /* format of function */ ! 65: char opfrml; /* length of function */ ! 66: char agfrmt; /* in AOP, format of result */ ! 67: char agfrml; /* in AOP, length of result */ ! 68: }; ! 69: ! 70: struct resdomnode /* RESDOM node */ ! 71: { ! 72: short resno; /* result domain number */ ! 73: char resfrmt; /* result format */ ! 74: char resfrml; /* result length */ ! 75: }; ! 76: ! 77: ! 78: struct srcid /* SOURCEID node */ ! 79: { ! 80: short srcvar; /* variable number */ ! 81: DESC srcdesc; /* descriptor for this var */ ! 82: }; ! 83: ! 84: ! 85: /* ! 86: ** SYMVALUE UNION ! 87: ** ! 88: ** This union contains all of the types available ! 89: ** in the value field of a querytree node. ! 90: */ ! 91: ! 92: union symvalue ! 93: { ! 94: union anytype sym_data; ! 95: struct varnode sym_var; ! 96: struct rootnode sym_root; ! 97: struct opnode sym_op; ! 98: struct resdomnode sym_resdom; ! 99: struct srcid sym_srcid; ! 100: }; ! 101: ! 102: ! 103: /* ! 104: ** SYMBOL DEFINITION ! 105: ** ! 106: ** Basic symbol structure. "Type" is one of the symbols ! 107: ** in "symbol.h", "len" is the length of the "value" ! 108: ** field (0 to 255 bytes), "value" is variable length and ! 109: ** holds the actual value (if len != 0) of the node. ! 110: ** The "value" is one of the types contained in "union symvalue". ! 111: ** ! 112: ** On a thirty-two bit machine, there are two bytes of padding ! 113: ** after type and length. These two bytes are discarded ! 114: ** when a symbol is written to a pipe. ! 115: */ ! 116: ! 117: struct symbol ! 118: { ! 119: char type; /* type codes in symbol.h */ ! 120: char len; /* length in bytes of value field */ ! 121: union symvalue value; ! 122: }; ! 123: ! 124: typedef struct symbol SYMBOL; ! 125: ! 126: ! 127: /* ! 128: ** QUERYTREE NODE ! 129: ** ! 130: ** Basic node in the querytree. Each node has a left and ! 131: ** right descendent. If the node is a leaf node then the ! 132: ** left and right pointers will be NULL. Depending on the ! 133: ** "type" field of the symbol structure, there may be additional ! 134: ** information. ! 135: */ ! 136: ! 137: struct querytree ! 138: { ! 139: struct querytree *left; ! 140: struct querytree *right; ! 141: struct symbol sym; ! 142: }; ! 143: ! 144: typedef struct querytree QTREE; ! 145: ! 146: ! 147: /* ! 148: ** SUNDRY CONSTANTS ! 149: ** ! 150: ** There are several differences in the handling of data ! 151: ** structures on 16 and 32 bit machines: ! 152: ** 1). A pointer to memory is either 2 or 4 bytes. ! 153: ** 2). Padding is inserted in structures to insure ! 154: ** alignment of 16 and 32 bit numbers. ! 155: ** ! 156: ** For these reasons the following constant definitions ! 157: ** are useful for machine independent allocation. ! 158: ** ! 159: ** These are based on the PDP11 compile flag. ! 160: ** ! 161: ** QT_HDR_SIZ -- size of left and right pointers, typ, ! 162: ** len and padding ! 163: ** SYM_HDR_SIZ -- size of type and len in symbol ! 164: ** structure -- includes any padding before ! 165: ** the value field ! 166: ** TYP_LEN_SIZ -- size of type and len in symbol ! 167: ** structure -- without padding ! 168: ** ! 169: ** INGRES FOLKS: don't change these back to sizeof's!!! ! 170: ** The PDP-11 compiler doesn't understand! ! 171: */ ! 172: ! 173: # ifdef PDP11 ! 174: # define QT_HDR_SIZ 6 ! 175: # define SYM_HDR_SIZ 2 ! 176: # define TYP_LEN_SIZ 2 ! 177: # else ! 178: # define QT_HDR_SIZ 12 ! 179: # define SYM_HDR_SIZ 4 ! 180: # define TYP_LEN_SIZ 2 ! 181: ! 182: ! 183: ! 184: ! 185: # endif PDP11 ! 186: ! 187: ! 188: ! 189: ! 190: ! 191: /* ! 192: ** Query Tree Header. ! 193: ** ! 194: ** Qt_ctx should be of type 'ctx_t *', but it is 'char *' ! 195: ** to insure that we don't need ctlmod.h. ! 196: */ ! 197: ! 198: struct qthdr ! 199: { ! 200: char qt_active; /* if set, Qt area is in use */ ! 201: char *qt_ctx; /* pointer to context */ ! 202: short qt_qmode; /* query mode */ ! 203: short qt_resvar; /* result variable number */ ! 204: RANGEV qt_rangev[MAXRANGE]; /* the range table */ ! 205: short qt_remap[MAXRANGE]; /* variable remapping (for QM) */ ! 206: } Qt; ! 207: ! 208: ! 209: # endif QT_HDR_SIZ
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.