1: #include "../h/rt.h"
   2: #ifdef SETS
   3: /*
   4:  * delete(S,x) - delete element x from set S if it is there
   5:  *  (always succeeds and returns S).
   6:  */
   7: 
   8: Xdelete(nargs,arg2,arg1,arg0)
   9: int nargs;
  10: struct descrip arg0, arg1, arg2;
  11:    {
  12:    register struct descrip *pd;
  13:    int res ;
  14:    extern struct descrip *memb();
  15: 
  16:    DeRef(arg1)
  17:    DeRef(arg2)
  18:    arg0 = arg1;
  19: 
  20:    if (QUAL(arg1) || TYPE(arg1) != T_SET)
  21:        runerr(119,&arg1);
  22:       /*
  23:       * The technique and philosophy here are the same
  24:       *  as used in insert.c - see comment there.
  25:       */
  26:    pd = memb(BLKLOC(arg1),&arg2,hash(&arg2),&res);
  27:    if (res == 1) {
  28:       /*
  29:       * The element is there so delete it.
  30:       */
  31:       *pd = BLKLOC(*pd)->selem.sblink;
  32:       (BLKLOC(arg1)->set.setsize)--;
  33:       }
  34:    }
  35: 
  36: Procblock(delete,2)
  37: 
  38: #else SETS
  39: char junk;          /* prevent null object file  */
  40: #endif SETS

Defined functions

Procblock defined in line 36; never used
Xdelete defined in line 8; never used
Last modified: 1984-11-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 906
Valid CSS Valid XHTML 1.0 Strict