1 #ifndef _HASH_H
2 #define _HASH_H 1
3 
4 typedef enum {CHAR, INT} keytype;
5 
6 typedef struct {
7 		void *key;
8 		void *val;
9 } bucket;
10 
11 typedef struct {
12 		int size;
13 		int numkeys;
14 		unsigned (*hashfunc)(void *key, int M);
15 		int (*compfunc)(void *c1, void *c2);
16 		void * (*dupefunc)(void *key);
17 		bucket **table;
18 } hashtable;
19 
20 void hashcreate(hashtable *table, keytype typ, int size);
21 void hashinsert(hashtable *table, void *key, void *val);
22 void * hashfind(hashtable *table, void *key);
23 void hashforeach(hashtable *table, void (*func)(void *, void *));
24 void hashempty(hashtable *table);
25 void hashdelete(hashtable *table, void *key);
26 
27 #endif
28