1: #include "../h/rt.h" 2: #ifdef SETS 3: 4: /* 5: * member(S,x) - returns x if x is a member of set S otherwise fails. 6: */ 7: 8: Xmember(nargs,arg2,arg1,arg0) 9: int nargs; 10: struct descrip arg2, arg1, arg0; 11: { 12: int res; 13: extern struct descrip *memb(); 14: 15: DeRef(arg1) 16: DeRef(arg2) 17: if (QUAL(arg1) || TYPE(arg1) != T_SET) 18: runerr(119,&arg1); /* S is not a set */ 19: /* If arg2 is a member of set arg1 then "res" will have the 20: * value 1 otherwise it will have the value 0. 21: */ 22: memb(BLKLOC(arg1),&arg2,hash(&arg2),&res); 23: if (res == 1) { /* It is a member. */ 24: arg0 = arg2; /* Return the member if it is in arg1. */ 25: return; 26: } 27: fail(); 28: } 29: 30: Procblock(member,2) 31: 32: #else SETS 33: char junk; /* prevent null object file */ 34: #endif SETS