rhughes@241: #ifndef _RAZOR_TYPES_H_ rhughes@241: #define _RAZOR_TYPES_H_ rhughes@241: rhughes@241: #include rhughes@241: rhughes@241: struct array { rhughes@241: void *data; rhughes@241: int size, alloc; rhughes@241: }; rhughes@241: rhughes@241: void array_init(struct array *array); rhughes@241: void array_release(struct array *array); rhughes@241: void *array_add(struct array *array, int size); rhughes@241: rhughes@241: rhughes@241: struct list_head { rhughes@241: uint list_ptr : 24; rhughes@241: uint flags : 8; rhughes@241: }; rhughes@241: rhughes@241: struct list { rhughes@241: uint data : 24; rhughes@241: uint flags : 8; rhughes@241: }; rhughes@241: rhughes@241: void list_set_empty(struct list_head *head); rhughes@241: void list_set_ptr(struct list_head *head, uint32_t ptr); rhughes@241: void list_set_array(struct list_head *head, struct array *pool, struct array *items, int force_indirect); rhughes@241: rhughes@241: struct list *list_first(struct list_head *head, struct array *pool); rhughes@241: struct list *list_next(struct list *list); rhughes@241: rhughes@241: void list_remap_pool(struct array *pool, uint32_t *map); rhughes@241: void list_remap_head(struct list_head *list, uint32_t *map); rhughes@241: rhughes@241: rhughes@241: struct hashtable { rhughes@241: struct array buckets; rhughes@241: struct array *pool; rhughes@241: }; rhughes@241: rhughes@241: void hashtable_init(struct hashtable *table, struct array *pool); rhughes@241: void hashtable_release(struct hashtable *table); rhughes@241: uint32_t hashtable_insert(struct hashtable *table, const char *key); rhughes@241: uint32_t hashtable_lookup(struct hashtable *table, const char *key); rhughes@241: uint32_t hashtable_tokenize(struct hashtable *table, const char *string); rhughes@241: rhughes@241: rhughes@241: struct bitarray { rhughes@241: uint32_t *bits; rhughes@241: }; rhughes@241: rhughes@241: void bitarray_init(struct bitarray *bitarray, int size, int intial_value); rhughes@241: void bitarray_release(struct bitarray *bitarray); rhughes@241: void bitarray_set(struct bitarray *bitarray, int bit, int value); rhughes@241: int bitarray_get(struct bitarray *bitarray, int bit); rhughes@241: rhughes@241: rhughes@241: #endif /* _RAZOR_TYPES_H_ */