|
danw@115
|
1 |
#ifndef _RAZOR_TYPES_H_
|
|
danw@115
|
2 |
#define _RAZOR_TYPES_H_
|
|
danw@115
|
3 |
|
|
danw@115
|
4 |
#include <stdint.h>
|
|
danw@115
|
5 |
|
|
danw@115
|
6 |
struct array {
|
|
danw@115
|
7 |
void *data;
|
|
danw@115
|
8 |
int size, alloc;
|
|
danw@115
|
9 |
};
|
|
danw@115
|
10 |
|
|
danw@115
|
11 |
void array_init(struct array *array);
|
|
danw@115
|
12 |
void array_release(struct array *array);
|
|
danw@115
|
13 |
void *array_add(struct array *array, int size);
|
|
danw@115
|
14 |
|
|
danw@115
|
15 |
|
|
danw@116
|
16 |
void list_init(uint32_t *list);
|
|
danw@116
|
17 |
void list_set(uint32_t *list, struct array *pool, struct array *items);
|
|
danw@116
|
18 |
uint32_t *list_first(uint32_t *list, struct array *pool);
|
|
danw@116
|
19 |
uint32_t *list_next(uint32_t *list);
|
|
danw@116
|
20 |
void list_remap_pool(struct array *pool, uint32_t *map);
|
|
danw@116
|
21 |
void list_remap_if_immediate(uint32_t *list, uint32_t *map);
|
|
danw@116
|
22 |
#define LIST_VALUE(list) (*(list) & RAZOR_ENTRY_MASK)
|
|
danw@116
|
23 |
#define LIST_FLAGS(list) (*(list) & ~RAZOR_ENTRY_MASK)
|
|
danw@116
|
24 |
|
|
danw@115
|
25 |
struct hashtable {
|
|
danw@115
|
26 |
struct array buckets;
|
|
danw@115
|
27 |
struct array *pool;
|
|
danw@115
|
28 |
};
|
|
danw@115
|
29 |
|
|
danw@115
|
30 |
void hashtable_init(struct hashtable *table, struct array *pool);
|
|
danw@115
|
31 |
void hashtable_release(struct hashtable *table);
|
|
danw@115
|
32 |
uint32_t hashtable_insert(struct hashtable *table, const char *key);
|
|
danw@115
|
33 |
uint32_t hashtable_lookup(struct hashtable *table, const char *key);
|
|
danw@115
|
34 |
uint32_t hashtable_tokenize(struct hashtable *table, const char *string);
|
|
danw@115
|
35 |
|
|
danw@115
|
36 |
#endif /* _RAZOR_TYPES_H_ */
|