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	8.2	1/22/85)
  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: 
  47:     if (!Nautoclear)
  48:         Autoclear = 1;
  49: 
  50:     /* arrange to call the parser */
  51:     initp();
  52:     call_setup(&pb, mdPARSER, NULL);
  53:     pb_prime(&pb, PB_REG);
  54:     pb.pb_proc = 1;     /**** PARSER MUST BE IN PROC ONE ****/
  55:     send_off(&pb, 0, NULL);
  56:     pb_tput(PV_EOF, "", 0, &pb);
  57:     macinit(fgetc, iop, 1);
  58:     while ((c = macgetch()) > 0)
  59:         pb_put(&c, 1, &pb);
  60:     pb_flush(&pb);
  61:     fclose(iop);
  62: 
  63:     /* wait for the response */
  64:     setjmp(GoJmpBuf);
  65:     readinput(&pb);
  66: 
  67:     if (Resp.resp_tups >= 0)
  68:         macdefine("{tuplecount}", locv(Resp.resp_tups), TRUE);
  69: 
  70:     if (Error_id == 0 && (p = macro(QRYTRAP)) != NULL)
  71:         trapquery(&Resp, p);
  72: 
  73:     resetp();
  74: 
  75:     mcall("{continuetrap}");
  76: 
  77:     prompt("\ncontinue");
  78: }

Defined functions

go defined in line 30; used 1 times

Defined variables

GoJmpBuf defined in line 28; used 1 times
  • in line 64

Defined macros

QRYTRAP defined in line 26; used 1 times
  • in line 70
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 892
Valid CSS Valid XHTML 1.0 Strict