This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 #ifndef SIMPLEHASH_H
2 #define SIMPLEHASH_H
3
4 #ifndef bool
5 #define bool int
6 #endif
7
8 #ifndef true
9 #define true 1
10 #endif
11
12 #ifndef false
13 #define false 0
14 #endif
15
16 #include "mem.h"
17
18 /* SimpleHash *********************************************************/
19
20 struct RuntimeHash * noargallocateRuntimeHash();
21 struct RuntimeHash * allocateRuntimeHash(int size);
22 void RuntimeHashaddChild(struct RuntimeHash *thisvar, struct RuntimeHash * child);
23 void freeRuntimeHash(struct RuntimeHash *);
24
25 void RuntimeHashrehash(struct RuntimeHash * thisvar);
26 int RuntimeHashadd(struct RuntimeHash *, int key, int data);
27 #ifdef RAW
28 int RuntimeHashadd_I(struct RuntimeHash *, int key, int data);
29 #endif
30 int RuntimeHashremovekey(struct RuntimeHash *,int key);
31 int RuntimeHashremove(struct RuntimeHash *,int key, int data);
32 bool RuntimeHashcontainskey(struct RuntimeHash *,int key);
33 bool RuntimeHashcontainskeydata(struct RuntimeHash *,int key, int data);
34 int RuntimeHashget(struct RuntimeHash *,int key, int* data);
35 void RuntimeHashaddParent(struct RuntimeHash *,struct RuntimeHash* parent);
36 int RuntimeHashfirstkey(struct RuntimeHash *);
37 struct RuntimeIterator* RuntimeHashcreateiterator(struct RuntimeHash *);
38 void RuntimeHashiterator(struct RuntimeHash *, struct RuntimeIterator * it);
39 int RuntimeHashcount(struct RuntimeHash *, int key);
40 struct RuntimeHash * RuntimeHashimageSet(struct RuntimeHash *, int key);
41
42 struct RuntimeHash {
43     int numelements;
44     int size;
45     struct RuntimeNode **bucket;
46     struct RuntimeNode *listhead;
47     struct RuntimeNode *listtail;
48 };
49
50 inline int RuntimeHashcountset(struct RuntimeHash * thisvar);
51
52 /* RuntimeHashException  *************************************************/
53
54
55 /* RuntimeIterator *****************************************************/
56 #define ARRAYSIZE 100
57
58 struct RuntimeNode {
59   struct RuntimeNode *next;
60   struct RuntimeNode *lnext;
61   struct RuntimeNode *lprev;
62   int data;
63   int key;
64 };
65
66 struct RuntimeIterator {
67   struct RuntimeNode *cur;
68 };
69
70 inline struct RuntimeIterator * noargallocateRuntimeIterator();
71
72 inline struct RuntimeIterator * allocateRuntimeIterator(struct RuntimeNode *start);
73
74 inline int RunhasNext(struct RuntimeIterator *thisvar);
75
76 inline int Runnext(struct RuntimeIterator *thisvar);
77
78 inline int Runkey(struct RuntimeIterator *thisvar);
79
80 #endif