1: #include "../h/rt.h"
   2: #ifdef SETS
   3: /*
   4:  * memb - sets res flag to 1 if x is a member of set S,
   5:  *  sets res flag to 0 if not.
   6:  *  Returns pointer to the descriptor which points to
   7:  *  the element (or which would point to it if it were
   8:  *  there).
   9:  */
  10: 
  11: struct descrip *memb(ps,x,hn,res)
  12: int *res;               /* pointer to integer result flag */
  13: struct b_set *ps;
  14: struct descrip  *x;
  15: int hn;
  16:    {
  17:     register struct descrip *lp;
  18:     register struct b_selem  *pe;
  19:     extern int equiv();
  20: 
  21:    lp = &(ps->sbucks[hn % NBUCKETS]);
  22:    /*
  23:     * Look for x in the hash chain.
  24:     */
  25:    *res = 0;
  26:    while (BLKLOC(*lp) != NULL) {
  27:        pe = (struct b_selem *) BLKLOC(*lp);
  28:        if ( pe->hnum > hn)      /* too far - it isn't there */
  29:          return (lp);
  30:        else if (( pe->hnum == hn ) && ( equiv(&pe->setmem, x )))  {
  31:          *res = 1;
  32:          return (lp);
  33:          }
  34:    /*
  35:     * We haven't reached the right hashnumber yet or
  36:     *  the element isn't the right one so keep looking.
  37:     */
  38:       lp = &(pe->sblink);
  39:    }
  40:    /*
  41:     *  At end of chain - not there.
  42:     */
  43:    return (lp);
  44:    }
  45: #else SETS
  46: char junk;   /* prevent null object file */
  47: #endif SETS

Defined functions

memb defined in line 11; never used

Defined variables

junk defined in line 46; never used
Last modified: 1984-11-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 776
Valid CSS Valid XHTML 1.0 Strict