Annotation of 43BSD/ingres/source/parser/s_comment.c, revision 1.1.1.1

1.1       root        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: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.