# 2.11BSD#431 - /usr/ingres/source/parser/main.c

##### Functions

    main              X
    proc_error        X
    rubproc           X

       1: # include   "../ingres.h"
       2: # include   "../aux.h"
       3: # include   "../pipes.h"
       4: # include   "../tree.h"
       5: # include   "parser.h"
       6: # include   "../access.h"
       7: # include   "../unix.h"
       8:
       9: main(argc,argv1)
      10: int argc;
      11: char    *argv1[];
      12: {
      13:     register int    rt;
      14:     register char   **argv;
      15:     extern int  yydebug;
      16:     /*
      17: 	** This is a ROYAL kludge used to obtain data space for the
      18: 	** parser.  The treebuffer should really be allocated in
      19: 	** ../parser.h but unfortunately.
      20: 	*/
      21:     char        treebuffer[TREEMAX];
      22:
      23:     /* set up parser */
      24:     argv = argv1;
      25:     Qbuf = treebuffer;  /* see kludge notice above */
      26: #	ifdef xPTR1
      27:     tTrace(&argc, argv, 'P');
      28: #	endif
      29: #	ifdef xPTR2
      30:     if (tTf(17, 0))
      31:         prargs(argc, argv);
      32: #	endif
      33:     initproc("PARSER", argv);
      34:     Noupdt = !setflag(argv, 'U', 0);
      35:     Dcase = setflag(argv, 'L', 1);
      36:
      37:     /* if param specified, set result reln storage structures */
      38:     Relspec = "cheapsort";      /* default to cheapsort on ret into */
      39:     Indexspec = "isam";     /* isam on index */
      40:     for (rt=6; rt < argc; rt++)
      41:     {
      42:         if (argv[rt][0] == '-')
      43:         {
      44:             if (argv[rt][1] == 'r')
      45:             {
      46:                 Relspec = &argv[rt][2];
      47:                 continue;
      48:             }
      49:             if (argv[rt][1] == 'n')
      50:             {
      51:                 Indexspec = &argv[rt][2];
      52:                 continue;
      53:             }
      54:         }
      55:     }
      56:     if (sequal(Relspec, "heap"))
      57:         Relspec = 0;
      58:     if (sequal(Indexspec, "heap"))
      59:         Indexspec = 0;
      60:
      61:     rnginit();
      62:     openr(&Desc, 0, "attribute");
      63:     /*
      64: 	** The 'openr' must be done before this test so that the 'Admin'
      65: 	**	structure is initialized.  The 'Qrymod' flag is set when
      66: 	**	the database has query modification turned on.
      67: 	*/
      68:     Qrymod = ((Admin.adhdr.adflags & A_QRYMOD) == A_QRYMOD);
      69:     setexit();
      70:
      71:     /* EXECUTE */
      72:     for (;;)
      73:     {
      74:         startgo();      /* initializations for start of go-block */
      75:
      76:         yyparse();      /* will not return until end of go-block or error */
      77:
      78:         endgo();        /* do cleanup (resync, etc) for a go-block */
      79:     }
      80: }
      81:
      82: /*
      83: ** RUBPROC
      84: */
      85: rubproc()
      86: {
      87:     resyncpipes();
      88: }
      89:
      90: /*
      91: **  PROC_ERROR ROUTINE
      92: **
      93: **	This routine handles the processing of errors for the parser
      94: **	process.  It sets the variable 'Ingerr' if an error is passes
      95: **	up from one of the processes below.
      96: */
      97: proc_error(s1, rpipnum)
      98: struct pipfrmt  *s1;
      99: int     rpipnum;
     100: {
     101:     register struct pipfrmt *s;
     102:     register int        fd;
     103:     register char       *b;
     104:     char            buf[120];
     105:     struct pipfrmt      t;
     106:
     107:     fd = rpipnum;
     108:     s = s1;
     109:     b = buf;
     110:     if (fd != R_down)
     111:         syserr("proc_error: bad pipe");
     112:     wrpipe(P_PRIME, &t, s->exec_id, 0, s->func_id);
     113:     t.err_id = s->err_id;
     114:
     115:     copypipes(s, fd, &t, W_up);
     116:     rdpipe(P_PRIME, s);
     117:     Ingerr = 1;
     118: }

#### Defined functions

main defined in line 9; never used
proc_error defined in line 97; never used
rubproc defined in line 85; never used

Last modified: 1995-02-18 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1086 |