types.h
author Dan Winship <danw@gnome.org>
Fri Feb 29 11:53:15 2008 -0500 (2008-02-29)
changeset 137 4722cd3437cb
parent 118 832743d47157
child 140 017f92f7039a
permissions -rw-r--r--
Redo updates and removes in terms of a single razor_transaction abstraction

Also does versioned depsolving at least partially.
Update main.c and test-driver.c for that, and fix some unrelated test-driver
bugs.

Now gets up to testUpdateSinglePackageObsoletesOldRequirement, although
it really should not be passing the multilib tests; apparently they aren't
clever enough in their testing of the depsolving algorithm and are allowing
it to come up with the right answer for the wrong reason.
     1 #ifndef _RAZOR_TYPES_H_
     2 #define _RAZOR_TYPES_H_
     3 
     4 #include <stdint.h>
     5 
     6 struct array {
     7 	void *data;
     8 	int size, alloc;
     9 };
    10 
    11 void array_init(struct array *array);
    12 void array_release(struct array *array);
    13 void *array_add(struct array *array, int size);
    14 
    15 
    16 struct list_head {
    17 	uint list_ptr : 24;
    18 	uint flags    : 8;
    19 };
    20 
    21 struct list {
    22 	uint data  : 24;
    23 	uint flags : 8;
    24 };
    25 
    26 void list_set_empty(struct list_head *head);
    27 void list_set_ptr(struct list_head *head, uint32_t ptr);
    28 void list_set_array(struct list_head *head, struct array *pool, struct array *items, int force_indirect);
    29 
    30 struct list *list_first(struct list_head *head, struct array *pool);
    31 struct list *list_next(struct list *list);
    32 
    33 void list_remap_pool(struct array *pool, uint32_t *map);
    34 void list_remap_head(struct list_head *list, uint32_t *map);
    35 
    36 
    37 struct hashtable {
    38 	struct array buckets;
    39 	struct array *pool;
    40 };
    41 
    42 void hashtable_init(struct hashtable *table, struct array *pool);
    43 void hashtable_release(struct hashtable *table);
    44 uint32_t hashtable_insert(struct hashtable *table, const char *key);
    45 uint32_t hashtable_lookup(struct hashtable *table, const char *key);
    46 uint32_t hashtable_tokenize(struct hashtable *table, const char *string);
    47 
    48 #endif /* _RAZOR_TYPES_H_ */