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@116: void list_init(uint32_t *list); danw@116: void list_set(uint32_t *list, struct array *pool, struct array *items); danw@116: uint32_t *list_first(uint32_t *list, struct array *pool); danw@116: uint32_t *list_next(uint32_t *list); danw@116: void list_remap_pool(struct array *pool, uint32_t *map); danw@116: void list_remap_if_immediate(uint32_t *list, uint32_t *map); danw@116: #define LIST_VALUE(list) (*(list) & RAZOR_ENTRY_MASK) danw@116: #define LIST_FLAGS(list) (*(list) & ~RAZOR_ENTRY_MASK) 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@115: #endif /* _RAZOR_TYPES_H_ */