1: # include "../ingres.h" 2: # include "../aux.h" 3: # include "../symbol.h" 4: # include "../tree.h" 5: # include "decomp.h" 6: 7: 8: 9: 10: writenod(n) 11: struct querytree *n; 12: { 13: register int t; 14: register struct querytree *q; 15: register struct symbol *s; 16: char *cp; 17: int l; 18: 19: q = n; 20: s = &q->sym; 21: t = s->type; 22: l = s->len & I1MASK; 23: 24: printf("%l/ %l: %l: ", q, q->left, q->right); 25: printf("%d, %d, ", t, l); 26: 27: switch (t) 28: { 29: case VAR: 30: printf("%d,%d,%d,%d,%l/", ((struct qt_var *)q)->varno, ((struct qt_var *)q)->attno, ((struct qt_var *)q)->frmt, ((struct qt_var *)q)->frml&0377, ((struct qt_var *)q)->valptr); 31: if (((struct qt_var *)q)->varno < 0) 32: writenod(((struct qt_var *)q)->valptr); 33: else 34: printf("\n"); 35: return; 36: 37: case AND: 38: case ROOT: 39: case AGHEAD: 40: printf("%d,%d,%o,%o", ((struct qt_root *)q)->tvarc, ((struct qt_root *)q)->lvarc, ((struct qt_root *)q)->lvarm, ((struct qt_root *)q)->rvarm); 41: if (t != AND) 42: printf(",(%d)", ((struct qt_root *)q)->rootuser); 43: break; 44: 45: case AOP: 46: case RESDOM: 47: printf("%d,%d,%d", ((struct qt_res *)q)->resno, ((struct qt_var *)q)->frmt, ((struct qt_var *)q)->frml & 0377); 48: if (t == AOP) 49: printf("(%d,%d)", ((struct qt_ag *)q)->agfrmt, ((struct qt_ag *)q)->agfrml & 0377); 50: break; 51: 52: case UOP: 53: case BOP: 54: case COP: 55: case INT: 56: switch (l) 57: { 58: case 1: 59: printf("%d", i1deref(s->value)); 60: break; 61: case 2: 62: printf("%d", i2deref(s->value)); 63: break; 64: case 4: 65: printf("%s", locv(i4deref(s->value))); 66: } 67: break; 68: 69: case FLOAT: 70: switch (l) 71: { 72: case 4: 73: printf("%.10f", f4deref(s->value)); 74: break; 75: case 8: 76: printf("%.10f", f8deref(s->value)); 77: } 78: break; 79: 80: case CHAR: 81: cp = (char *) s->value; 82: while (l--) 83: putchar(*cp++); 84: break; 85: 86: case TREE: 87: case OR: 88: case QLEND: 89: case BYHEAD: 90: break; 91: 92: default: 93: printf("Error in writenod"); 94: } 95: printf("/\n"); 96: }