|
|
1.1 ! root 1: # include "monitor.h" ! 2: # include <ingres.h> ! 3: # include <aux.h> ! 4: # include <resp.h> ! 5: # include <symbol.h> ! 6: # include <pv.h> ! 7: # include <pipes.h> ! 8: # include <setjmp.h> ! 9: # include <sccs.h> ! 10: ! 11: SCCSID(@(#)go.c 7.1 2/5/81) ! 12: ! 13: ! 14: ! 15: /* ! 16: ** PROCESS QUERY ! 17: ** ! 18: ** The appropriate messages are printed, and the query is scanned. ! 19: ** Tokens are passed to the parser. A parser response is then ! 20: ** expected. ! 21: ** ! 22: ** Trace Flags: ! 23: ** 5 ! 24: */ ! 25: ! 26: # define QRYTRAP "{querytrap}" ! 27: ! 28: jmp_buf GoJmpBuf; ! 29: ! 30: go() ! 31: { ! 32: FILE *iop; ! 33: auto char c; ! 34: register char *p; ! 35: extern int fgetc(); ! 36: pb_t pb; ! 37: extern char *macro(); ! 38: ! 39: clrline(1); ! 40: fflush(Qryiop); ! 41: if ((iop = fopen(Qbname, "r")) == NULL) ! 42: syserr("go: open 1"); ! 43: if (Nodayfile >= 0) ! 44: printf("Executing . . .\n\n"); ! 45: ! 46: # ifdef xMTM ! 47: if (tTf(76, 1)) ! 48: timtrace(3, 0); ! 49: # endif ! 50: ! 51: if (!Nautoclear) ! 52: Autoclear = 1; ! 53: ! 54: /* arrange to call the parser */ ! 55: initp(); ! 56: call_setup(&pb, mdPARSER, NULL); ! 57: pb_prime(&pb, PB_REG); ! 58: pb.pb_proc = 1; /**** PARSER MUST BE IN PROC ONE ****/ ! 59: send_off(&pb, 0, NULL); ! 60: pb_tput(PV_EOF, "", 0, &pb); ! 61: macinit(fgetc, iop, 1); ! 62: while ((c = macgetch()) > 0) ! 63: pb_put(&c, 1, &pb); ! 64: pb_flush(&pb); ! 65: fclose(iop); ! 66: ! 67: /* wait for the response */ ! 68: setjmp(GoJmpBuf); ! 69: readinput(&pb); ! 70: ! 71: if (Resp.resp_tups >= 0) ! 72: macdefine("{tuplecount}", locv(Resp.resp_tups), TRUE); ! 73: ! 74: if (Error_id == 0 && (p = macro(QRYTRAP)) != NULL) ! 75: trapquery(&Resp, p); ! 76: ! 77: resetp(); ! 78: ! 79: mcall("{continuetrap}"); ! 80: ! 81: # ifdef xMTM ! 82: if (tTf(76, 1)) ! 83: timtrace(4, 0); ! 84: # endif ! 85: prompt("\ncontinue"); ! 86: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.