Annotation of researchv10no/cmd/basic/bite/src/on.c, revision 1.1

1.1     ! root        1: /* Copyright Bell Telephone Laboratories Whippany, N.J.
        !             2: 
        !             3:  *     ***********************************
        !             4:  *     ***********************************
        !             5:  *     ********** ON GOTO/GOSUB **********
        !             6:  *     *** R. B. Drake WH 8C-005 X4163 ***
        !             7:  *     **** Sun Aug 26 11:02:16 1979 *****
        !             8:  *     ***********************************
        !             9:  *     ***********************************
        !            10: 
        !            11: */
        !            12: /*   "@(#) on.c:  V 1.1  12/21/80" */
        !            13: 
        !            14: /* routine to handle on goto */
        !            15: #include "bas.h"
        !            16: extern int stpflg;
        !            17: double evalx();
        !            18: char *prncpy();
        !            19: extern char *expr,*eoexpr;
        !            20: on()
        !            21: {
        !            22:        int i,j;
        !            23:        char txtbuf[80];
        !            24:        char c;
        !            25:        if((j = evalx(expr)) <= 0)
        !            26:        {
        !            27:                error(inst.thing.linno,38);
        !            28:                return(-1);
        !            29:        }
        !            30:        if(stpflg == 1)
        !            31:                return(-1);
        !            32:        if((c= *eoexpr++) > '\003' && c != '\016')
        !            33:        {
        !            34:                error(inst.thing.linno,8); /* expression syntax */
        !            35:                return(-1);
        !            36:        }
        !            37:        for(i=0;i<j;i++)
        !            38:        {
        !            39:                eoexpr = prncpy(txtbuf,eoexpr);
        !            40:                if(*eoexpr++ == '\0' && i != (j-1))
        !            41:                {
        !            42:                        error(inst.thing.linno,38); /* not enough references*/
        !            43:                        return(-1);
        !            44:                }
        !            45:        }
        !            46:        expr = txtbuf;
        !            47:        if(c != '\016')
        !            48:        {
        !            49:        if(__goto() < 0)
        !            50:                return(-1);
        !            51:        return(0);
        !            52:        }
        !            53:        if(gosub() < 0)
        !            54:                return(-1);
        !            55:        return(0);
        !            56: }

unix.superglobalmegacorp.com

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