Annotation of 43BSD/contrib/icon/operators/rasgn.c, revision 1.1

1.1     ! root        1: #include "../h/rt.h"
        !             2: 
        !             3: /*
        !             4:  * x <- y - assign y to x.
        !             5:  * Reverses assignment if resumed.
        !             6:  */
        !             7: 
        !             8: rasgn(nargs, arg2, arg1, arg0)
        !             9: int nargs;
        !            10: struct descrip arg2, arg1, arg0;
        !            11:    {
        !            12:    DclSave
        !            13:    SetBound;
        !            14:    /*
        !            15:     * x must be a variable.
        !            16:     */
        !            17:    if (QUAL(arg1) || !VAR(arg1))
        !            18:       runerr(111, &arg1);
        !            19:    /*
        !            20:     * The return value is the variable x, so make a copy of it before
        !            21:     *  it is dereferenced.
        !            22:     */
        !            23:    arg0 = arg1;
        !            24:    DeRef(arg1)
        !            25:    DeRef(arg2)
        !            26:    /*
        !            27:     * Assign y to x and suspend.
        !            28:     */
        !            29:    doasgn(&arg0, &arg2);
        !            30:    suspend();
        !            31:    /*
        !            32:     * <- has been resumed, reverse the assignment by assigning the old value
        !            33:     *  of x (present as arg1) back into x and fail.
        !            34:     */
        !            35:    doasgn(&arg0, &arg1);
        !            36:    fail();
        !            37:    }
        !            38: 
        !            39: Opblock(rasgn,2,"<-")

unix.superglobalmegacorp.com

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