mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 14:20:59 +00:00
4868a245b3
Empty structs are now (correctly) invalid. The hack of using an empty struct to represent a handle returned from a builtin has been unnecessary since opaque structs were implemented: now a pointer to an opaque struct can be used. This is mostly safe as handles are aways negative and thus attempting to dereference such a pointer should result in a VM error. It will be even safer once const is implemented and the pointers can be made constant (eg, typedef struct handle * const handle;)
70 lines
2.1 KiB
Objective-C
70 lines
2.1 KiB
Objective-C
#ifndef __ruamoko_Set_h
|
|
#define __ruamoko_Set_h
|
|
|
|
typedef struct set_s *set_t;
|
|
typedef struct set_iter_s *set_iter_t;
|
|
|
|
@extern void set_del_iter (set_iter_t *set_iter);
|
|
@extern unsigned set_iter_element (set_iter_t *set_iter);
|
|
@extern set_t *set_new (void);
|
|
@extern void set_delete (set_t *set);
|
|
@extern set_t *set_add (set_t *set, unsigned x);
|
|
@extern set_t *set_remove (set_t *set, unsigned x);
|
|
@extern set_t *set_invert (set_t *set);
|
|
@extern set_t *set_union (set_t *dst, set_t *src);
|
|
@extern set_t *set_intersection (set_t *dst, set_t *src);
|
|
@extern set_t *set_difference (set_t *dst, set_t *src);
|
|
@extern set_t *set_reverse_difference (set_t *dst, set_t *src);
|
|
@extern set_t *set_assign (set_t *dst, set_t *src);
|
|
@extern set_t *set_empty (set_t *set);
|
|
@extern set_t *set_everything (set_t *set);
|
|
@extern int set_is_empty (set_t *set);
|
|
@extern int set_is_everything (set_t *set);
|
|
@extern int set_is_disjoint (set_t *s1, set_t *s2);
|
|
@extern int set_is_intersecting (set_t *s1, set_t *s2);
|
|
@extern int set_is_equivalent (set_t *s1, set_t *s2);
|
|
@extern int set_is_subset (set_t *set, set_t *sub);
|
|
@extern int set_is_member (set_t *set, unsigned x);
|
|
@extern unsigned set_size (set_t *set);
|
|
@extern set_iter_t *set_first (set_t *set);
|
|
@extern set_iter_t *set_next (set_iter_t *set_iter);
|
|
@extern string set_as_string (set_t *set);
|
|
|
|
#include <Object.h>
|
|
|
|
@interface SetIterator: Object
|
|
{
|
|
set_iter_t *iter;
|
|
}
|
|
- (SetIterator *) next;
|
|
- (unsigned) element;
|
|
@end
|
|
|
|
@interface Set: Object
|
|
{
|
|
set_t *set;
|
|
}
|
|
+ (id) set;
|
|
- (Set *) add: (unsigned) x;
|
|
- (Set *) remove: (unsigned) x;
|
|
- (Set *) invert;
|
|
- (Set *) union: (Set *) src;
|
|
- (Set *) intersection: (Set *) src;
|
|
- (Set *) difference: (Set *) src;
|
|
- (Set *) reverse_difference: (Set *) src;
|
|
- (Set *) assign: (Set *) other;
|
|
- (Set *) empty;
|
|
- (Set *) everything;
|
|
- (int) is_empty;
|
|
- (int) is_everything;
|
|
- (int) is_disjoint: (Set *) s2;
|
|
- (int) is_intersecting: (Set *) s2;
|
|
- (int) is_equivalent: (Set *) s2;
|
|
- (int) is_subset: (Set *) sub;
|
|
- (int) is_member: (unsigned) x;
|
|
- (int) size;
|
|
- (SetIterator *) first;
|
|
- (string) as_string;
|
|
@end
|
|
|
|
#endif//__ruamoko_Set_h
|