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