1: # include   "../ingres.h"
   2: # include   "../symbol.h"
   3: # include   "../tree.h"
   4: # include   "../pipes.h"
   5: # include   "../batch.h"
   6: # include   "ovqp.h"
   7: 
   8: /*
   9: **	This file contains all the routines needed
  10: **	for communicating with the equel process.
  11: **	They are called only if the flag Equel = TRUE.
  12: */
  13: 
  14: /* global equel pipebuffer */
  15: struct pipfrmt  Eoutpipe;
  16: 
  17: 
  18: equelatt(ss)
  19: struct symbol   *ss;
  20: 
  21: /*
  22: **	equelatt writes one symbol pointed to
  23: **	by ss up the data pipe to the equel
  24: **	process.
  25: **
  26: **	if a symbol is a character then *ss->value
  27: **	contains a pointer to the character string.
  28: **	otherwise the value is stored in successive
  29: **	words starting in ss->value.
  30: */
  31: 
  32: {
  33: #	ifdef xOTR1
  34:     if (tTf(20, 0))
  35:         prstack(ss);
  36: #	endif
  37:     pwritesym(&Eoutpipe, W_front, ss);
  38: }
  39: 
  40: 
  41: equeleol(code)
  42: int code;
  43: 
  44: /*
  45: **	equeleol is called at the end of the interpretation of
  46: **	a tuple. Its purpose is to write an end-of-tuple
  47: **	symbol to the equel process and flush the pipe.
  48: **
  49: **	It is also called at the end of a query to write
  50: **	an exit symbol to equel.
  51: **
  52: **	History:
  53: **		1/22/79 -- (marc) modified so won't flush pipe
  54: **			buffer after each tuple
  55: */
  56: 
  57: {
  58:     register int    mode;
  59:     struct symbol   symb;
  60: 
  61:     if (code == EXIT)
  62:         mode = P_END;
  63:     else
  64:         mode = P_FLUSH;
  65: 
  66:     symb.type = code;
  67:     symb.len = 0;
  68: 
  69: #	ifdef  xOTR1
  70:     if (tTf(20, 3))
  71:         printf("equeleol:writing %d to equel\n", code);
  72: #	endif
  73: 
  74:     wrpipe(P_NORM, &Eoutpipe, W_front, &symb, 2);
  75:     if (mode != P_FLUSH || Equel != 2)
  76:         wrpipe(mode, &Eoutpipe, W_front);
  77: }
  78: 
  79: 
  80: pwritesym(pipedesc, filedesc, ss)
  81: struct pipfrmt  *pipedesc;
  82: int     filedesc;
  83: struct stacksym *ss;
  84: 
  85: /*
  86: **	pwritesym write the stacksymbol
  87: **	pointed to by "ss" to the pipe
  88: **	indicated by filedesc.
  89: **
  90: **	The destination will either be equel
  91: **	or decomp
  92: **
  93: **	Since a CHAR isn't stored immediately following
  94: **	the type and len of the symbol, A small bit
  95: **	of manipulation must be done.
  96: */
  97: 
  98: {
  99:     register struct stacksym    *s;
 100:     register char           *p;
 101:     register int            length;
 102: 
 103:     s = ss;
 104:     length = s->len & 0377;
 105: 
 106:     if (s->type  == CHAR)
 107:     {
 108:         wrpipe(P_NORM, pipedesc, filedesc, s, 2);   /* write the type and length */
 109:         p = cpderef(ss->value);     /* p points to the string */
 110:     }
 111:     else
 112:     {
 113:         p = (char *) ss;
 114:         length += 2;    /* include two bytes for type and length */
 115:     }
 116:     wrpipe(P_NORM, pipedesc, filedesc, p, length);
 117: }

Defined functions

equelatt defined in line 18; used 1 times
pwritesym defined in line 80; used 2 times

Defined variables

Eoutpipe defined in line 15; used 3 times
Last modified: 1995-03-02
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2572
Valid CSS Valid XHTML 1.0 Strict