1: # include   "../ingres.h"
   2: # include   "../symbol.h"
   3: # include   "../tree.h"
   4: # include   "../pipes.h"
   5: # include   "ovqp.h"
   6: 
   7: extern struct pipfrmt   Inpipe, Outpipe;
   8: 
   9: char *rdsym()
  10: /*
  11: **	Reads one symbol from the pipe
  12: **	and inserts it in the next slot
  13: **	on the Ovqpbuf.
  14: **
  15: **	returns address of list element.
  16: */
  17: {
  18:     register char   *next;
  19:     register int    i;
  20:     register int    j;
  21:     extern char *Ovqpbuf;
  22:     char        *need();
  23: 
  24:     next = need(Ovqpbuf, 2);    /* get two bytes for type and length */
  25: 
  26:     if (j = rdpipe(P_NORM, &Inpipe, R_decomp, next, 2) !=2) /* get type and length */
  27:         syserr("rdsym:bad rdpipe %d", j);
  28:     i = *(next + 1) & 0377; /* get length of symbol */
  29: #	ifdef xOTR1
  30:     if (tTf(29, 0))
  31:         printf("RDSYM: sym %2.d  len=%3.d\t",*next, i);
  32: #	endif
  33: 
  34:     if (i)
  35:     {
  36:         /* if i is odd round up and allocate enought space. */
  37:         /* alloc will guarantee an even byte adress */
  38: 
  39:         need(Ovqpbuf, i);       /* get space for value */
  40:         if (j = rdpipe(P_NORM, &Inpipe, R_decomp, next+2, i) != i)
  41:             syserr("rdsym:bad rdpipe of %d", j);
  42:     }
  43: 
  44: #	ifdef xOTR1
  45:     if (tTf(29, 1))
  46:         if (((struct symbol *)next)->type != VAR)
  47:             prsym(next);
  48: #	endif
  49: 
  50:     if (Qvpointer >= MAXNODES)
  51:         ov_err(NODOVFLOW);
  52:     Qvect [Qvpointer++] = (struct symbol *) next;
  53:     return (next);
  54: }
  55: 
  56: /*
  57: **  Sym_ad -- reasonable way of getting the address
  58: **	of the last symbol read in.
  59: **
  60: */
  61: 
  62: struct symbol **sym_ad()
  63: {
  64:     return (&Qvect [Qvpointer - 1]);
  65: }
  66: 
  67: 
  68: 
  69: putvar(sym, desc, tup)
  70: struct symbol   *sym;
  71: char        tup[];
  72: struct descriptor   *desc;
  73: 
  74: /*
  75: **	putvar is called to insert a tuple
  76: **	pointer into the list. Desc is a
  77: **	descriptor struc of an open relation.
  78: **	Tup is the tuple buffer for the relation.
  79: */
  80: 
  81: {
  82:     register struct descriptor  *d;
  83:     register char           *next;
  84:     register int            attnum;
  85:     extern char         *Ovqpbuf;
  86:     char                *need();
  87: 
  88:     next = (char *) sym;
  89:     d = desc;
  90: 
  91: 
  92:     attnum = ((struct stacksym *)next)->value[0] & 0377;
  93:     next = need(Ovqpbuf, 4);    /* get four more bytes */
  94: 
  95:     if (attnum)
  96:     {
  97:         /* attnum is a real attribute number */
  98:         if (attnum > d->relatts)
  99:             syserr("rdsym:bad att %d in %.12s", attnum, d->relid);
 100:         ((struct stacksym *)next)->type = d->relfrmt[attnum];
 101:         ((struct stacksym *)next)->len = d->relfrml[attnum];
 102:         ((struct stacksym *)next)->value[0] = (int) &tup[0] + d->reloff[attnum];    /* address within tuple buffer location */
 103:     }
 104:     else
 105:     {
 106:         /* attnum refers to the tuple id */
 107:         ((struct stacksym *)next)->type = TIDTYPE;
 108:         ((struct stacksym *)next)->len = TIDLEN;    /* tids are longs */
 109:         ((struct stacksym *)next)->value[0] = (int) &Intid; /* address of tid */
 110:     }
 111: #	ifdef xOTR1
 112:     if (tTf(29, 3))
 113:         prsym(next - 4);
 114: #	endif
 115:     return;
 116: }

Defined functions

putvar defined in line 69; used 4 times
rdsym defined in line 9; used 6 times
sym_ad defined in line 62; used 5 times
Last modified: 1995-02-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2938
Valid CSS Valid XHTML 1.0 Strict