1: 
   2: # include   <ingres.h>
   3: # include   "scanner.h"
   4: # include   <sccs.h>
   5: # include   <errors.h>
   6: 
   7: SCCSID(@(#)s_comment.c	8.2	2/8/85)
   8: 
   9: /*
  10: ** COMMENT
  11: ** scans comments (as delimited by the tokens 'Tokens.bgncmnt'
  12: ** and 'Tokens.endcmnt') and removes them from the query text.
  13: */
  14: comment()
  15: {
  16:     register int        i, l;
  17:     register struct optab   *op;
  18:     register    char    *sp;
  19:     char            buf[3];
  20: 
  21:     /* find the end_of_comment operator */
  22:     for (op = Optab; op->term; op++)
  23:         if (op->token == Tokens.endcmnt)
  24:             break;
  25:     if (!op->term)
  26:         syserr("no end_of_comment token");
  27: 
  28:     /* scan for the end of the comment */
  29:     l = length(op->term);
  30:     for (i = 0,sp = buf; i < l; sp++, i++)      /* set up window on input */
  31:         if ((*sp = get_scan(NORMAL)) <= 0)
  32:             /* non-terminated comment */
  33:             par_error(COMMTERM, FATAL, 0);      /* must end parsing */
  34:     while (!bequal(buf, op->term, l))
  35:     {
  36:         /* move window on input */
  37:         for (sp = buf,i = 0; i < l-1; i++,sp++)
  38:             *sp = *(sp+1);
  39:         if (( *sp = get_scan(NORMAL)) <= 0)
  40:             /* non terminated comment */
  41:             par_error(COMMTERM, FATAL, 0);      /* must end parsing */
  42:     }
  43:     return (0);
  44: }

Defined functions

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