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

Defined variables

Qt defined in line 233; never used

Defined struct's

opnode defined in line 82; used 2 times
  • in line 118(2)
qthdr defined in line 225; never used
querytree defined in line 164; used 6 times
resdomnode defined in line 91; used 2 times
  • in line 119(2)
rootnode defined in line 73; used 2 times
  • in line 117(2)
srcid defined in line 99; used 2 times
  • in line 120(2)
strkeeper defined in line 30; never used
symbol defined in line 143; used 4 times
varnode defined in line 52; used 2 times
  • in line 116(2)

Defined union's

symvalue defined in line 113; used 2 times
  • in line 147(2)

Defined typedef's

QTREE defined in line 171; never used
STRKEEPER defined in line 36; used 1 times
  • in line 58
SYMBOL defined in line 151; never used

Defined macros

QT_HDR_SIZ defined in line 205; used 1 times
  • in line 9
SYMOFF defined in line 141; never used
SYM_HDR_SIZ defined in line 206; never used
TYP_LEN_SIZ defined in line 207; never used
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 676
Valid CSS Valid XHTML 1.0 Strict