2 ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003.
3 ** See ../LICENSE for license information.
10 # ifndef CSTRINGTABLE_H
11 # define CSTRINGTABLE_H
13 /*@constant int HBUCKET_BASESIZE; @*/
14 # define HBUCKET_BASESIZE 2
16 /*@constant int HBUCKET_DNE; @*/
17 # define HBUCKET_DNE NOT_FOUND
20 abst_typedef null struct _cstringTable *cstringTable;
23 /*:private:*/ typedef struct
25 /*@only@*/ cstring key;
29 /*:private:*/ typedef /*@only@*/ hentry o_hentry;
31 typedef /*@null@*/ struct
35 /*@only@*/ o_hentry *entries;
38 typedef /*@only@*/ hbucket o_hbucket;
43 unsigned long nentries;
44 /*@only@*/ o_hbucket *buckets;
48 /*@constant null cstringTable cstringTable_undefined; @*/
49 # define cstringTable_undefined ((cstringTable) NULL)
51 extern /*@falsewhennull@*/ bool cstringTable_isDefined(cstringTable) /*@*/ ;
52 # define cstringTable_isDefined(p_h) ((p_h) != cstringTable_undefined)
54 extern /*@nullwhentrue@*/ /*@unused@*/ bool cstringTable_isUndefined(cstringTable) /*@*/ ;
55 # define cstringTable_isUndefined(p_h) ((p_h) == cstringTable_undefined)
57 extern /*@only@*/ cstringTable cstringTable_create(unsigned long p_size) /*@*/ ;
58 extern void cstringTable_insert (cstringTable p_h,
59 /*@only@*/ cstring p_key,
60 int p_value) /*@modifies p_h@*/ ;
62 extern int cstringTable_lookup (cstringTable p_h, cstring p_key);
63 extern /*@unused@*/ /*@only@*/ cstring cstringTable_stats(cstringTable p_h);
64 extern void cstringTable_free (/*@only@*/ cstringTable p_h);
65 extern void cstringTable_remove (cstringTable p_h, cstring p_key) /*@modifies p_h@*/ ;
67 extern /*@unused@*/ cstring cstringTable_unparse (cstringTable) /*@*/ ;
69 extern /*@unused@*/ void cstringTable_update (cstringTable p_h, cstring p_key, int p_newval) /*@modifies p_h@*/ ;
72 cstringTable_replaceKey (cstringTable p_h, cstring p_oldkey,
73 /*@only@*/ cstring p_newkey);
76 # error "Multiple include"