PageRenderTime 50ms CodeModel.GetById 20ms app.highlight 6ms RepoModel.GetById 14ms app.codeStats 0ms

/tools/Ruby/lib/ruby/1.8/i386-mingw32/st.h

http://github.com/agross/netopenspace
C Header | 72 lines | 55 code | 15 blank | 2 comment | 3 complexity | c7e8653d87d0328098b838b05a53478e MD5 | raw file
 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
 9#if SIZEOF_LONG == SIZEOF_VOIDP
10typedef unsigned long st_data_t;
11#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
12typedef unsigned LONG_LONG st_data_t;
13#else
14# error ---->> st.c requires sizeof(void*) == sizeof(long) to be compiled. <<---
15-
16#endif
17#define ST_DATA_T_DEFINED
18
19typedef struct st_table st_table;
20
21struct st_hash_type {
22    int (*compare)();
23    int (*hash)();
24};
25
26struct st_table {
27    struct st_hash_type *type;
28    int num_bins;
29    int num_entries;
30    struct st_table_entry **bins;
31};
32
33#define st_is_member(table,key) st_lookup(table,key,(st_data_t *)0)
34
35enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE, ST_CHECK};
36
37#ifndef _
38# define _(args) args
39#endif
40#ifndef ANYARGS
41# ifdef __cplusplus
42#   define ANYARGS ...
43# else
44#   define ANYARGS
45# endif
46#endif
47
48st_table *st_init_table _((struct st_hash_type *));
49st_table *st_init_table_with_size _((struct st_hash_type *, int));
50st_table *st_init_numtable _((void));
51st_table *st_init_numtable_with_size _((int));
52st_table *st_init_strtable _((void));
53st_table *st_init_strtable_with_size _((int));
54int st_delete _((st_table *, st_data_t *, st_data_t *));
55int st_delete_safe _((st_table *, st_data_t *, st_data_t *, st_data_t));
56int st_insert _((st_table *, st_data_t, st_data_t));
57int st_lookup _((st_table *, st_data_t, st_data_t *));
58int st_foreach _((st_table *, int (*)(ANYARGS), st_data_t));
59void st_add_direct _((st_table *, st_data_t, st_data_t));
60void st_free_table _((st_table *));
61void st_cleanup_safe _((st_table *, st_data_t));
62st_table *st_copy _((st_table *));
63
64#define ST_NUMCMP	((int (*)()) 0)
65#define ST_NUMHASH	((int (*)()) -2)
66
67#define st_numcmp	ST_NUMCMP
68#define st_numhash	ST_NUMHASH
69
70int st_strhash();
71
72#endif /* ST_INCLUDED */