Annotation of 42BSD/ingres/source/parser/s_comment.c, revision 1.1

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

unix.superglobalmegacorp.com

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