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 int RuntimeHashremovekey(struct RuntimeHash *,int key);
28 int RuntimeHashremove(struct RuntimeHash *,int key, int data);
29 bool RuntimeHashcontainskey(struct RuntimeHash *,int key);
30 bool RuntimeHashcontainskeydata(struct RuntimeHash *,int key, int data);
31 int RuntimeHashget(struct RuntimeHash *,int key, int* data);
32 void RuntimeHashaddParent(struct RuntimeHash *,struct RuntimeHash* parent);
33 int RuntimeHashfirstkey(struct RuntimeHash *);
34 struct RuntimeIterator* RuntimeHashcreateiterator(struct RuntimeHash *);
35 void RuntimeHashiterator(struct RuntimeHash *, struct RuntimeIterator * it);
36 int RuntimeHashcount(struct RuntimeHash *, int key);
37 struct RuntimeHash * RuntimeHashimageSet(struct RuntimeHash *, int key);
38
39 struct RuntimeHash {
40     int numelements;
41     int size;
42     struct RuntimeNode **bucket;
43     struct RuntimeNode *listhead;
44     struct RuntimeNode *listtail;
45 };
46
47 inline int RuntimeHashcountset(struct RuntimeHash * thisvar);
48
49 /* RuntimeHashException  *************************************************/
50
51
52 /* RuntimeIterator *****************************************************/
53 #define ARRAYSIZE 100
54
55 struct RuntimeNode {
56   struct RuntimeNode *next;
57   struct RuntimeNode *lnext;
58   struct RuntimeNode *lprev;
59   int data;
60   int key;
61 };
62
63 struct RuntimeIterator {
64   struct RuntimeNode *cur;
65 };
66
67 inline struct RuntimeIterator * noargallocateRuntimeIterator();
68
69 inline struct RuntimeIterator * allocateRuntimeIterator(struct RuntimeNode *start);
70
71 inline int RunhasNext(struct RuntimeIterator *thisvar);
72
73 inline int Runnext(struct RuntimeIterator *thisvar);
74
75 inline int Runkey(struct RuntimeIterator *thisvar);
76
77 #endif