1: # include <ingres.h>
2: # include <aux.h>
3: # include <symbol.h>
4: # include <tree.h>
5: # include <batch.h>
6: # include "../ctlmod/pipes.h"
7: # include "../decomp/globs.h"
8: # include <sccs.h>
9:
10: SCCSID(@(#)equelpr.c 8.2 1/17/85)
11:
12: /*
13: ** This file contains all the routines needed
14: ** for communicating with the equel process.
15: ** They are called only if the flag Equel = TRUE.
16: */
17:
18:
19: pb_t EquelPb;
20:
21:
22: startequel()
23: {
24: pb_prime(&EquelPb, PB_REG);
25: EquelPb.pb_proc = PB_FRONT;
26: EquelPb.pb_st = PB_FRONT;
27: EquelPb.pb_stat |= PB_INFO;
28: }
29: /*
30: ** equelatt writes one symbol pointed to
31: ** by ss up the data pipe to the equel
32: ** process.
33: **
34: ** if a symbol is a character then *ss->value
35: ** contains a pointer to the character string.
36: ** otherwise the value is stored in successive
37: ** words starting in ss->value.
38: */
39:
40: equelatt(ss)
41: SYMBOL *ss;
42: {
43: # ifdef xOTR1
44: if (tTf(80, 0))
45: prstack(ss);
46: # endif
47: pwritesym(ss);
48: }
49: /*
50: ** equeleol is called at the end of the interpretation of
51: ** a tuple. Its purpose is to write an end-of-tuple
52: ** symbol to the equel process and flush the pipe.
53: **
54: ** It is also called at the end of a query to write
55: ** an exit symbol to equel.
56: */
57:
58: equeleol(code)
59: int code;
60: {
61: struct stacksym symb;
62:
63: symb.s_type = code;
64: symb.s_len = 0;
65:
66: # ifdef xOTR1
67: if (tTf(80, 3))
68: printf("equeleol:writing %d to equel\n", code);
69: # endif
70:
71: pb_put((char *)&symb, TYP_LEN_SIZ, &EquelPb);
72:
73:
74: /* flush after every tuple for Equel versions before 6.2
75: * and at end of results always
76: */
77: if (code == EXIT)
78: pb_flush(&EquelPb);
79: }
80: /*
81: ** pwritesym write the stacksymbol
82: ** pointed to by "ss" to the pipe
83: ** indicated by filedesc.
84: **
85: ** The destination will either be equel
86: ** or decomp
87: **
88: ** Since a CHAR isn't stored immediately following
89: ** the type and len of the symbol, A small bit
90: ** of manipulation must be done.
91: */
92:
93: pwritesym(s)
94: register SYMBOL *s;
95: {
96: register char *p;
97: register int length;
98: char cheat;
99:
100: length = s->len & I1MASK;
101: pb_put((char *)s, TYP_LEN_SIZ, &EquelPb);
102:
103: if (s->type == CHAR)
104: p = s->value.sym_data.cptype; /* p points to the string */
105: else
106: {
107: if ( s->type == INT && length == 1 )
108: {
109: cheat = s->value.sym_data.i1type;
110: pb_put(&cheat,length,&EquelPb);
111: return;
112: }
113:
114: p = s->value.sym_data.c0type;
115: }
116:
117: pb_put(p, length, &EquelPb);
118: }
Defined functions
Defined variables