| 1 |
|
| 2 |
|
| 3 |
#ifndef RXHASHH |
| 4 |
#define RXHASHH |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
#include "rxbitset.h" |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
struct rx_hash_item |
| 35 |
{ |
| 36 |
struct rx_hash_item * next_same_hash; |
| 37 |
struct rx_hash * table; |
| 38 |
unsigned long hash; |
| 39 |
void * data; |
| 40 |
void * binding; |
| 41 |
}; |
| 42 |
|
| 43 |
struct rx_hash |
| 44 |
{ |
| 45 |
struct rx_hash * parent; |
| 46 |
int refs; |
| 47 |
RX_subset nested_p; |
| 48 |
void ** children[16]; |
| 49 |
}; |
| 50 |
|
| 51 |
struct rx_hash_rules; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
#ifdef __STDC__ |
| 56 |
typedef int (*rx_hash_eq)(void *, void *); |
| 57 |
typedef struct rx_hash * (*rx_alloc_hash)(struct rx_hash_rules *); |
| 58 |
typedef void (*rx_free_hash)(struct rx_hash *, |
| 59 |
struct rx_hash_rules *); |
| 60 |
typedef struct rx_hash_item * (*rx_alloc_hash_item)(struct rx_hash_rules *, |
| 61 |
void *); |
| 62 |
typedef void (*rx_free_hash_item)(struct rx_hash_item *, |
| 63 |
struct rx_hash_rules *); |
| 64 |
typedef void (*rx_hash_freefn) (struct rx_hash_item * it); |
| 65 |
#else |
| 66 |
typedef int (*rx_hash_eq)(); |
| 67 |
typedef struct rx_hash * (*rx_alloc_hash)(); |
| 68 |
typedef void (*rx_free_hash)(); |
| 69 |
typedef struct rx_hash_item * (*rx_alloc_hash_item)(); |
| 70 |
typedef void (*rx_free_hash_item)(); |
| 71 |
typedef void (*rx_hash_freefn) (); |
| 72 |
#endif |
| 73 |
|
| 74 |
struct rx_hash_rules |
| 75 |
{ |
| 76 |
rx_hash_eq eq; |
| 77 |
rx_alloc_hash hash_alloc; |
| 78 |
rx_free_hash free_hash; |
| 79 |
rx_alloc_hash_item hash_item_alloc; |
| 80 |
rx_free_hash_item free_hash_item; |
| 81 |
}; |
| 82 |
|
| 83 |
|
| 84 |
#ifdef __STDC__ |
| 85 |
extern struct rx_hash_item * rx_hash_find (struct rx_hash * table, |
| 86 |
unsigned long hash, |
| 87 |
void * value, |
| 88 |
struct rx_hash_rules * rules); |
| 89 |
extern struct rx_hash_item * rx_hash_store (struct rx_hash * table, |
| 90 |
unsigned long hash, |
| 91 |
void * value, |
| 92 |
struct rx_hash_rules * rules); |
| 93 |
extern void rx_hash_free (struct rx_hash_item * it, struct rx_hash_rules * rules); |
| 94 |
extern void rx_free_hash_table (struct rx_hash * tab, rx_hash_freefn freefn, |
| 95 |
struct rx_hash_rules * rules); |
| 96 |
extern int rx_count_hash_nodes (struct rx_hash * st); |
| 97 |
|
| 98 |
#else |
| 99 |
extern struct rx_hash_item * rx_hash_find (); |
| 100 |
extern struct rx_hash_item * rx_hash_store (); |
| 101 |
extern void rx_hash_free (); |
| 102 |
extern void rx_free_hash_table (); |
| 103 |
extern int rx_count_hash_nodes (); |
| 104 |
|
| 105 |
#endif |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
#endif |
| 112 |
|