100 #define SETelemsize ((int)sizeof(setelemT)) 137 #define FOREACHsetelement_(type, set, variable) \ 138 if (((variable= NULL), set)) for (\ 139 variable##p= (type **)&((set)->e[0].p); \ 140 (variable= *variable##p++);) 170 #define FOREACHsetelement_i_(type, set, variable) \ 171 if (((variable= NULL), set)) for (\ 172 variable##_i= 0, variable= (type *)((set)->e[0].p), \ 173 variable##_n= qh_setsize(set);\ 174 variable##_i < variable##_n;\ 175 variable= (type *)((set)->e[++variable##_i].p) ) 203 #define FOREACHsetelementreverse_(type, set, variable) \ 204 if (((variable= NULL), set)) for (\ 205 variable##temp= qh_setsize(set)-1, variable= qh_setlast(set);\ 206 variable; variable= \ 207 ((--variable##temp >= 0) ? SETelemt_(set, variable##temp, type) : NULL)) 234 #define FOREACHsetelementreverse12_(type, set, variable) \ 235 if (((variable= NULL), set)) for (\ 236 variable##p= (type **)&((set)->e[1].p); \ 237 (variable= *variable##p); \ 238 variable##p == ((type **)&((set)->e[0].p))?variable##p += 2: \ 239 (variable##p == ((type **)&((set)->e[1].p))?variable##p--:variable##p++)) 266 #define FOREACHelem_(set) FOREACHsetelement_(void, set, elem) 293 #define FOREACHset_(sets) FOREACHsetelement_(setT, sets, set) 308 #define SETindex_(set, elem) ((int)((void **)elem##p - (void **)&(set)->e[1].p)) 319 #define SETref_(elem) (elem##p[-1]) 331 #define SETelem_(set, n) ((set)->e[n].p) 342 #define SETelemt_(set, n, type) ((type*)((set)->e[n].p)) 353 #define SETelemaddr_(set, n, type) ((type **)(&((set)->e[n].p))) 362 #define SETfirst_(set) ((set)->e[0].p) 371 #define SETfirstt_(set, type) ((type*)((set)->e[0].p)) 380 #define SETsecond_(set) ((set)->e[1].p) 388 #define SETsecondt_(set, type) ((type*)((set)->e[1].p)) 396 #define SETaddr_(set,type) ((type **)(&((set)->e[0].p))) 408 #define SETreturnsize_(set, size) (((size)= ((set)->e[(set)->maxsize].i))?(--(size)):((size)= (set)->maxsize)) 419 #define SETempty_(set) (!set || (SETfirst_(set) ? 0 : 1)) 433 #define SETsizeaddr_(set) (&((set)->e[(set)->maxsize])) 445 #define SETtruncate_(set, size) {set->e[set->maxsize].i= size+1; \ 446 set->e[size].p= NULL;} void * qh_setdel(setT *set, void *elem)
void qh_setappend(setT **setp, void *elem)
void qh_setappend_set(setT **setp, setT *setA)
setT * qh_settemppop(void)
setT * qh_setduplicate(setT *set, int elemsize)
void qh_setcompact(setT *set)
void * qh_setdelnth(setT *set, int nth)
void qh_setfreelong(setT **set)
void qh_setcheck(setT *set, const char *tname, unsigned id)
void qh_setfree(setT **set)
int qh_setin(setT *set, void *setelem)
void qh_setaddnth(setT **setp, int nth, void *newelem)
setT * qh_setcopy(setT *set, int extra)
void qh_setaddsorted(setT **setp, void *elem)
void qh_settruncate(setT *set, int size)
void * qh_setdelnthsorted(setT *set, int nth)
void * qh_setlast(setT *set)
void qh_setappend2ndlast(setT **setp, void *elem)
void qh_setprint(FILE *fp, const char *string, setT *set)
void qh_settempfree_all(void)
int qh_setindex(setT *set, void *setelem)
void * qh_setdelsorted(setT *set, void *newelem)
void qh_setreplace(setT *set, void *oldelem, void *newelem)
int qh_setequal_except(setT *setA, void *skipelemA, setT *setB, void *skipelemB)
void qh_settemppush(setT *set)
setT * qh_setnew(int size)
int qh_setequal(setT *setA, setT *setB)
void qh_setzero(setT *set, int idx, int size)
int qh_setequal_skip(setT *setA, int skipA, setT *setB, int skipB)
void * qh_setdellast(setT *set)
void ** qh_setendpointer(setT *set)
void qh_setlarger(setT **setp)
setT * qh_settemp(int setsize)
void qh_settempfree(setT **set)
int qh_setunique(setT **set, void *elem)
int qh_setsize(setT *set)
setT * qh_setnew_delnthsorted(setT *set, int size, int nth, int prepend)
void qh_setfree2(setT **setp, int elemsize)