librazor/types.h
author Richard Hughes <rhughes@redhat.com>
Mon Jun 16 17:54:29 2008 -0400 (2008-06-16)
changeset 242 f2218527ad4a
permissions -rw-r--r--
Add spec file.

committer: Kristian H?gsberg <krh@redhat.com>
rhughes@241
     1
#ifndef _RAZOR_TYPES_H_
rhughes@241
     2
#define _RAZOR_TYPES_H_
rhughes@241
     3
rhughes@241
     4
#include <stdint.h>
rhughes@241
     5
rhughes@241
     6
struct array {
rhughes@241
     7
	void *data;
rhughes@241
     8
	int size, alloc;
rhughes@241
     9
};
rhughes@241
    10
rhughes@241
    11
void array_init(struct array *array);
rhughes@241
    12
void array_release(struct array *array);
rhughes@241
    13
void *array_add(struct array *array, int size);
rhughes@241
    14
rhughes@241
    15
rhughes@241
    16
struct list_head {
rhughes@241
    17
	uint list_ptr : 24;
rhughes@241
    18
	uint flags    : 8;
rhughes@241
    19
};
rhughes@241
    20
rhughes@241
    21
struct list {
rhughes@241
    22
	uint data  : 24;
rhughes@241
    23
	uint flags : 8;
rhughes@241
    24
};
rhughes@241
    25
rhughes@241
    26
void list_set_empty(struct list_head *head);
rhughes@241
    27
void list_set_ptr(struct list_head *head, uint32_t ptr);
rhughes@241
    28
void list_set_array(struct list_head *head, struct array *pool, struct array *items, int force_indirect);
rhughes@241
    29
rhughes@241
    30
struct list *list_first(struct list_head *head, struct array *pool);
rhughes@241
    31
struct list *list_next(struct list *list);
rhughes@241
    32
rhughes@241
    33
void list_remap_pool(struct array *pool, uint32_t *map);
rhughes@241
    34
void list_remap_head(struct list_head *list, uint32_t *map);
rhughes@241
    35
rhughes@241
    36
rhughes@241
    37
struct hashtable {
rhughes@241
    38
	struct array buckets;
rhughes@241
    39
	struct array *pool;
rhughes@241
    40
};
rhughes@241
    41
rhughes@241
    42
void hashtable_init(struct hashtable *table, struct array *pool);
rhughes@241
    43
void hashtable_release(struct hashtable *table);
rhughes@241
    44
uint32_t hashtable_insert(struct hashtable *table, const char *key);
rhughes@241
    45
uint32_t hashtable_lookup(struct hashtable *table, const char *key);
rhughes@241
    46
uint32_t hashtable_tokenize(struct hashtable *table, const char *string);
rhughes@241
    47
rhughes@241
    48
rhughes@241
    49
struct bitarray {
rhughes@241
    50
	uint32_t *bits;
rhughes@241
    51
};
rhughes@241
    52
rhughes@241
    53
void bitarray_init(struct bitarray *bitarray, int size, int intial_value);
rhughes@241
    54
void bitarray_release(struct bitarray *bitarray);
rhughes@241
    55
void bitarray_set(struct bitarray *bitarray, int bit, int value);
rhughes@241
    56
int bitarray_get(struct bitarray *bitarray, int bit);
rhughes@241
    57
rhughes@241
    58
rhughes@241
    59
#endif /* _RAZOR_TYPES_H_ */