Annotation of 43BSD/contrib/icon/lib/bscan.c, revision 1.1.1.1

1.1       root        1: #include "../h/rt.h"
                      2: 
                      3: /*
                      4:  * bscan - set &subject and &pos upon entry to a scanning expression.
                      5:  *
                      6:  *  Arguments are:
                      7:  *      arg1 - new value for &subject
                      8:  *      arg2 - saved value of &subject
                      9:  *      arg3 - saved value of &pos
                     10:  */
                     11: 
                     12: bscan(nargs, arg3, arg2, arg1)
                     13: int nargs;
                     14: struct descrip arg3, arg2, arg1;
                     15:    {
                     16:    DclSave
                     17:    char sbuf[MAXSTRING];
                     18:    extern char *alcstr();
                     19:    struct descrip tsubject;
                     20: 
                     21:    SetBound;
                     22:    /*
                     23:     * Make a copy of the value for &subject and convert it to a string.
                     24:     */
                     25:    tsubject = arg1;
                     26:    switch (cvstr(&tsubject, sbuf)) {
                     27:       case NULL:
                     28:          runerr(103, &tsubject);
                     29:       case 1:
                     30:          /*
                     31:           * The new value for &subject wasn't a string.  Allocate the
                     32:           *  new value and fall through.
                     33:           */
                     34:          sneed(STRLEN(tsubject));
                     35:          STRLOC(tsubject) = alcstr(STRLOC(tsubject), STRLEN(tsubject));
                     36:       case 2:
                     37:          /*
                     38:           * Establish a new &subject value and set &pos to 1.
                     39:           */
                     40:          k_subject = tsubject;
                     41:          k_pos = 1;
                     42:       }
                     43:    suspend();
                     44: 
                     45:    /*
                     46:     * bscan has been resumed. Restore the old &subject and &pos values
                     47:     *  and fail.
                     48:     */
                     49:    k_subject = arg2;
                     50:    k_pos = INTVAL(arg3);
                     51:    fail();
                     52:    }

unix.superglobalmegacorp.com

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