1/* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */
2
3/* @(#) st.h 5.1 89/12/14 */
4
5#ifndef ST_INCLUDED
6
7#define ST_INCLUDED
8
9typedef struct st_table st_table;
10
11struct st_hash_type {
12    int (*compare)();
13    int (*hash)();
14};
15
16struct st_table {
17    struct st_hash_type *type;
18    int num_bins;
19    int num_entries;
20    struct st_table_entry **bins;
21};
22
23#define st_is_member(table,key) st_lookup(table,key,(char **)0)
24
25enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE};
26
27st_table *st_init_table();
28st_table *st_init_table_with_size();
29st_table *st_init_numtable();
30st_table *st_init_numtable_with_size();
31st_table *st_init_strtable();
32st_table *st_init_strtable_with_size();
33int st_delete(), st_delete_safe();
34int st_insert(), st_lookup();
35void st_foreach(), st_add_direct(), st_free_table(), st_cleanup_safe();
36st_table *st_copy();
37
38#define ST_NUMCMP	((int (*)()) 0)
39#define ST_NUMHASH	((int (*)()) -2)
40
41#define st_numcmp	ST_NUMCMP
42#define st_numhash	ST_NUMHASH
43
44int st_strhash();
45
46#endif /* ST_INCLUDED */
47