This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 // implements a generic hash table
2
3 #ifndef GENHASHTABLE
4 #define GENHASHTABLE
5 #define geninitialnumbins 10
6 #define bool int
7
8 struct genhashtable {
9   unsigned int (*hash_function)(void *);
10   int (*comp_function)(void *,void *);
11   struct genpointerlist ** bins;
12   long counter;
13   int currentsize;
14   struct genpointerlist *list;
15   struct genpointerlist *last;
16 };
17
18
19 struct genpointerlist {
20   void * src;
21   void * object;
22   struct genpointerlist * next;
23
24   struct genpointerlist * inext;
25   struct genpointerlist * iprev;
26 };
27
28
29 struct geniterator {
30   struct genpointerlist * ptr;
31   bool finished;
32 };
33
34 struct genhashtable * genallocatehashtable(unsigned int (*hash_function)(void *),int (*comp_function)(void *,void *));
35 void * getfirstkey(struct genhashtable *ht);
36 void genfreehashtable(struct genhashtable * ht);
37 void genrehash(struct genhashtable * ht);
38 void * getnext(struct genhashtable *,void *);
39 int genputtable(struct genhashtable *, void *, void *);
40 void * gengettable(struct genhashtable *, void *);
41 int gencontains(struct genhashtable *, void *);
42 unsigned int genhashfunction(struct genhashtable *,void *);
43
44 int hashsize(struct genhashtable * ht);
45 void genfreekey(struct genhashtable *ht, void *);
46 struct geniterator * gengetiterator(struct genhashtable *ht);
47 void * gennext(struct geniterator *it);
48 void genfreeiterator(struct geniterator *it);
49 #endif
50
51
52