* * This exits if it cannot init the pool because of insufficient * memory. */ extern void DestroySetManager(void); /**< * Destroys the set pool. Bombs if no pool exists. */ extern void ReportSetManager(FILE*f); /**< * Reports on the set pool to f. */ extern struct set_t *CreateEmptySet(void); /**< * Creates an empty set. */ extern void InsertInteger(struct set_t *set, asc_intptr_t i); /**< * Insert i into set. You can insert i multiple times without causing * problems. Set must be non-NULL. This will coerce an empty set type * into an integer set type; after that no symbols can be inserted into * the set. */ extern void InsertIntegerRange(struct set_t *set, long lower, long upper); /**< * Insert the elements i such that i >= lower and i <= upper. Note if * lower > upper, no elements are inserted. This will coerce an empty * set type into an integer set type. */ extern void InsertString(struct set_t *set, symchar *str); /**< * Insert str into set. This will coerce an empty set type into * a string set type; after which no integers can be inserted. */ extern struct set_t *SetUnion(CONST struct set_t *s1, CONST struct set_t *s2); /**< * Create a set which is the union of s1 and s2. s1 and s2 are uneffected. * Union with empty set is always okay. */ extern struct set_t *SetIntersection(CONST struct set_t *s1, CONST struct set_t *s2); /**< * Create a set which is the intersection of s1 and s2. s1 and s2 are * uneffected. Intersection with empty set is okay. */ extern struct set_t *SetDifference(CONST struct set_t *s1, CONST struct set_t *s2); /**< * Create a set which is define as follows: * return set := { i | (i IN s1) and (NOT (i IN s2))} */ extern struct set_t *CopySet(CONST struct set_t *set); /**< * Copy a set. */ extern int IntMember(asc_intptr_t i, CONST struct set_t *set); /**< * Return a TRUE value if i is a member of set; otherwise, return a false * value. */ extern int StrMember(symchar *str, CONST struct set_t *set); /**< * Return a TRUE value if str is a member of set; otherwise, return a false * value. */ extern void DestroySet(struct set_t *set); /**< "Free up" set pointer. Actually returns it to the pool of set stubs. */ extern int NullSet(CONST struct set_t *set); /**< Testing if the set is empty. TRUE if set is empty. */ ASC_DLLSPEC unsigned long Cardinality(CONST struct set_t *set); /**< Return the number of members. */ ASC_DLLSPEC symchar*FetchStrMember(CONST struct set_t *set, unsigned long n); /**< Returns the nth (internal sort order ) member symbol. */ ASC_DLLSPEC asc_intptr_t FetchIntMember(CONST struct set_t *set, unsigned long n); /**< Returns the nth (internal sort order ) member number. */ extern void SetIterate(struct set_t *set, void (*func)()); /**< Calls func for every element in set. */ ASC_DLLSPEC enum set_kind SetKind(CONST struct set_t *set); /**< Returns the type of the set. */ extern int SetsEqual(CONST struct set_t *s1, CONST struct set_t *s2); /**< * Returns a true value if the two sets are equal. Set equality is * defined as: * (i IN s1) <==> (i IN s2) * This always returns FALSE if the sets are of different type. */ extern int Subset(CONST struct set_t *s1, CONST struct set_t *s2); /**< * Returns a true value if s1 is contained in s2. It always returns FALSE * if the sets are of different type(even if they are empty sets). * * - TRUE if (i IN s1) ==> (i IN s2) * - FALSE otherwise */ extern int CmpSetInstVal(CONST struct set_t *s1, CONST struct set_t *s2); /**< * Returns -1, 0, 1 from comparing s1,s2. */ /* * Some ordered set processing. The elements of the below sets are * not necessarily unique and not necessarily ordered. In this way they * behave more like lists. For TRUE sets use the InsertInteger and * InsertString functions above. */ extern void AppendIntegerElement(struct set_t *set, asc_intptr_t i ); /**< * This function will append an integer to a set. In so doing it will NOT * attempt to sort the elements of the set or to make the elements of the * set unique. In this way the set is treated as a list. */ extern void AppendStringElement(struct set_t *set, symchar *str); /**< * This function will append an string to a set. In so doing it will NOT * attempt to sort the elements of the set or to make the elements of the * set unique. In this way the set is treated as a list. */ /* @} */ #endif /* ASC_SETINSTVAL_H */