types.h
author Dan Winship <danw@gnome.org>
Wed Feb 20 13:34:55 2008 -0500 (2008-02-20)
changeset 127 4a12eceb0858
parent 118 832743d47157
child 140 017f92f7039a
permissions -rw-r--r--
Merge file lists when updating

Currently a bit of a mess due to repeated rewriting. To be cleaned up
after we decide whether or not to keep the current file layout
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@117
    16
struct list_head {
danw@118
    17
	uint list_ptr : 24;
danw@118
    18
	uint flags    : 8;
danw@117
    19
};
danw@117
    20
danw@117
    21
struct list {
danw@118
    22
	uint data  : 24;
danw@118
    23
	uint flags : 8;
danw@117
    24
};
danw@117
    25
danw@117
    26
void list_set_empty(struct list_head *head);
danw@117
    27
void list_set_ptr(struct list_head *head, uint32_t ptr);
danw@124
    28
void list_set_array(struct list_head *head, struct array *pool, struct array *items, int force_indirect);
danw@117
    29
danw@117
    30
struct list *list_first(struct list_head *head, struct array *pool);
danw@117
    31
struct list *list_next(struct list *list);
danw@117
    32
danw@116
    33
void list_remap_pool(struct array *pool, uint32_t *map);
danw@117
    34
void list_remap_head(struct list_head *list, uint32_t *map);
danw@117
    35
danw@116
    36
danw@115
    37
struct hashtable {
danw@115
    38
	struct array buckets;
danw@115
    39
	struct array *pool;
danw@115
    40
};
danw@115
    41
danw@115
    42
void hashtable_init(struct hashtable *table, struct array *pool);
danw@115
    43
void hashtable_release(struct hashtable *table);
danw@115
    44
uint32_t hashtable_insert(struct hashtable *table, const char *key);
danw@115
    45
uint32_t hashtable_lookup(struct hashtable *table, const char *key);
danw@115
    46
uint32_t hashtable_tokenize(struct hashtable *table, const char *string);
danw@115
    47
danw@115
    48
#endif /* _RAZOR_TYPES_H_ */