File:  [CSRG BSD Unix] / 43BSD / contrib / icon / functions / cset.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:55 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43
BSD 4.3

#include "../h/rt.h"

/*
 * cset(x) - convert x to cset.
 */

Xcset(nargs, arg1, arg0)
int nargs;
struct descrip arg1, arg0;
   {
   register int i;
   register struct b_cset *bp;
   int *cs, csbuf[CSETSIZE];
   extern struct b_cset *alccset();

   hneed(sizeof(struct b_cset));

   DeRef(arg1)

   if (!QUAL(arg1) && TYPE(arg1) == T_CSET)
      /*
       * x is already a cset, just return it.
       */
      arg0 = arg1;
   else if (cvcset(&arg1, &cs, csbuf) != NULL) {
      /*
       * x was convertible to cset and the result resides in csbuf.  Allocate
       *  a cset, make arg0 a descriptor for it and copy the bits from csbuf
       *  into it.
       */
      arg0.type = D_CSET;
      bp = alccset();
      BLKLOC(arg0) =  (union block *) bp;
      for (i = 0; i < CSETSIZE; i++)
         bp->bits[i] = cs[i];
      }
   else /* Not a cset nor convertible to one. */
      fail();
   }

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.