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 #ifdef RAW
41 int genputtable_I(struct genhashtable *, void *, void *);
42 #endif
43 void * gengettable(struct genhashtable *, void *);
44 int gencontains(struct genhashtable *, void *);
45 unsigned int genhashfunction(struct genhashtable *,void *);
46
47 int hashsize(struct genhashtable * ht);
48 void genfreekey(struct genhashtable *ht, void *);
49 struct geniterator * gengetiterator(struct genhashtable *ht);
50 void * gennext(struct geniterator *it);
51 void genfreeiterator(struct geniterator *it);
52 #endif
53
54
55