Annotation of 43BSD/contrib/icon/functions/cset.c, revision 1.1.1.1

1.1       root        1: #include "../h/rt.h"
                      2: 
                      3: /*
                      4:  * cset(x) - convert x to cset.
                      5:  */
                      6: 
                      7: Xcset(nargs, arg1, arg0)
                      8: int nargs;
                      9: struct descrip arg1, arg0;
                     10:    {
                     11:    register int i;
                     12:    register struct b_cset *bp;
                     13:    int *cs, csbuf[CSETSIZE];
                     14:    extern struct b_cset *alccset();
                     15: 
                     16:    hneed(sizeof(struct b_cset));
                     17: 
                     18:    DeRef(arg1)
                     19: 
                     20:    if (!QUAL(arg1) && TYPE(arg1) == T_CSET)
                     21:       /*
                     22:        * x is already a cset, just return it.
                     23:        */
                     24:       arg0 = arg1;
                     25:    else if (cvcset(&arg1, &cs, csbuf) != NULL) {
                     26:       /*
                     27:        * x was convertible to cset and the result resides in csbuf.  Allocate
                     28:        *  a cset, make arg0 a descriptor for it and copy the bits from csbuf
                     29:        *  into it.
                     30:        */
                     31:       arg0.type = D_CSET;
                     32:       bp = alccset();
                     33:       BLKLOC(arg0) =  (union block *) bp;
                     34:       for (i = 0; i < CSETSIZE; i++)
                     35:          bp->bits[i] = cs[i];
                     36:       }
                     37:    else /* Not a cset nor convertible to one. */
                     38:       fail();
                     39:    }
                     40: 
                     41: Procblock(cset,1)

unix.superglobalmegacorp.com

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