]>
Commit | Line | Data |
---|---|---|
885824d3 | 1 | /* |
2 | ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2000. | |
3 | ** See ../LICENSE for license information. | |
4 | ** | |
5 | */ | |
6 | /* | |
7 | ** hashTable.h | |
8 | */ | |
9 | ||
10 | # ifndef HTABLE_H | |
11 | # define HTABLE_H | |
12 | ||
13 | /*@constant int HBUCKET_BASESIZE; @*/ | |
14 | # define HBUCKET_BASESIZE 2 | |
15 | ||
16 | /*@constant int HBUCKET_DNE; @*/ | |
17 | # define HBUCKET_DNE NOT_FOUND | |
18 | ||
19 | typedef struct _hashTable *hashTable ; | |
20 | ||
21 | typedef struct _hentry | |
22 | { | |
23 | /*@dependent@*/ cstring key; | |
24 | int val; | |
25 | } hentry; | |
26 | ||
27 | typedef /*@null@*/ struct _hbucket | |
28 | { | |
29 | int size; | |
30 | int nspace; | |
31 | /*@only@*/ hentry *entries; | |
32 | } *hbucket; | |
33 | ||
34 | typedef /*@only@*/ hbucket o_hbucket; | |
35 | ||
36 | struct _hashTable | |
37 | { | |
38 | int size; | |
39 | int nentries; | |
40 | /*@only@*/ o_hbucket *buckets; | |
41 | } ; | |
42 | ||
43 | ||
44 | extern /*@only@*/ hashTable hashTable_create(int p_size); | |
45 | extern void hashTable_insert (hashTable p_h, cstring p_key, int p_value); | |
46 | extern int hashTable_lookup (hashTable p_h, cstring p_key); | |
47 | extern /*@unused@*/ /*@only@*/ cstring hashTable_stats(hashTable p_h); | |
48 | extern void hashTable_free (/*@only@*/ hashTable p_h); | |
49 | extern void hashTable_remove (hashTable p_h, cstring p_key) /*@modifies p_h@*/ ; | |
50 | extern void | |
51 | hashTable_replaceKey (hashTable p_h, cstring p_oldkey, /*@dependent@*/ cstring p_newkey); | |
52 | ||
53 | # else | |
54 | # error "Multiple include" | |
55 | # endif | |
56 | ||
57 | ||
58 | ||
59 | ||
60 | ||
61 | ||
62 | ||
63 | ||
64 | ||
65 | ||
66 | ||
67 | ||
68 |