2000-01-05 07:41:21 +03:00
|
|
|
/* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */
|
1998-01-16 15:13:05 +03:00
|
|
|
|
|
|
|
/* @(#) st.h 5.1 89/12/14 */
|
|
|
|
|
|
|
|
#ifndef ST_INCLUDED
|
|
|
|
|
|
|
|
#define ST_INCLUDED
|
|
|
|
|
2003-07-27 21:20:29 +04:00
|
|
|
typedef unsigned long st_data_t;
|
2003-05-20 10:48:04 +04:00
|
|
|
#define ST_DATA_T_DEFINED
|
* st.h, st.c: Introduce new conventional typedef's, st_data_t,
st_compare_func_t, st_hash_func_t and st_each_func_t.
* st.h, st.c: Do explicit function declarations and do not rely on
implicit declarations. On such platforms as IA64, int argument
values are NOT automatically promoted to long (64bit) values, so
explicit declarations are mandatory for those functions that
take long values or pointers. This fixes miniruby's coredump on
FreeBSD/IA64.
* class.c, eval.c, gc.c, hash.c, marshal.c, parse.y, variable.c:
Add proper casts to avoid warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-06 18:55:43 +03:00
|
|
|
|
1998-01-16 15:13:05 +03:00
|
|
|
typedef struct st_table st_table;
|
|
|
|
|
|
|
|
struct st_hash_type {
|
2003-01-09 07:28:28 +03:00
|
|
|
int (*compare)();
|
|
|
|
int (*hash)();
|
1998-01-16 15:13:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct st_table {
|
|
|
|
struct st_hash_type *type;
|
|
|
|
int num_bins;
|
|
|
|
int num_entries;
|
1999-01-20 07:59:39 +03:00
|
|
|
struct st_table_entry **bins;
|
1998-01-16 15:13:05 +03:00
|
|
|
};
|
|
|
|
|
* st.h, st.c: Introduce new conventional typedef's, st_data_t,
st_compare_func_t, st_hash_func_t and st_each_func_t.
* st.h, st.c: Do explicit function declarations and do not rely on
implicit declarations. On such platforms as IA64, int argument
values are NOT automatically promoted to long (64bit) values, so
explicit declarations are mandatory for those functions that
take long values or pointers. This fixes miniruby's coredump on
FreeBSD/IA64.
* class.c, eval.c, gc.c, hash.c, marshal.c, parse.y, variable.c:
Add proper casts to avoid warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-06 18:55:43 +03:00
|
|
|
#define st_is_member(table,key) st_lookup(table,key,(st_data_t *)0)
|
1998-01-16 15:13:05 +03:00
|
|
|
|
|
|
|
enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE};
|
|
|
|
|
* st.h, st.c: Introduce new conventional typedef's, st_data_t,
st_compare_func_t, st_hash_func_t and st_each_func_t.
* st.h, st.c: Do explicit function declarations and do not rely on
implicit declarations. On such platforms as IA64, int argument
values are NOT automatically promoted to long (64bit) values, so
explicit declarations are mandatory for those functions that
take long values or pointers. This fixes miniruby's coredump on
FreeBSD/IA64.
* class.c, eval.c, gc.c, hash.c, marshal.c, parse.y, variable.c:
Add proper casts to avoid warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-06 18:55:43 +03:00
|
|
|
st_table *st_init_table(struct st_hash_type *);
|
|
|
|
st_table *st_init_table_with_size(struct st_hash_type *, int);
|
|
|
|
st_table *st_init_numtable(void);
|
|
|
|
st_table *st_init_numtable_with_size(int);
|
|
|
|
st_table *st_init_strtable(void);
|
|
|
|
st_table *st_init_strtable_with_size(int);
|
|
|
|
int st_delete(st_table *, st_data_t *, st_data_t *);
|
|
|
|
int st_delete_safe(st_table *, st_data_t *, st_data_t *, st_data_t);
|
|
|
|
int st_insert(st_table *, st_data_t, st_data_t);
|
|
|
|
int st_lookup(st_table *, st_data_t, st_data_t *);
|
2003-01-09 07:28:28 +03:00
|
|
|
void st_foreach(st_table *, int (*)(), st_data_t);
|
* st.h, st.c: Introduce new conventional typedef's, st_data_t,
st_compare_func_t, st_hash_func_t and st_each_func_t.
* st.h, st.c: Do explicit function declarations and do not rely on
implicit declarations. On such platforms as IA64, int argument
values are NOT automatically promoted to long (64bit) values, so
explicit declarations are mandatory for those functions that
take long values or pointers. This fixes miniruby's coredump on
FreeBSD/IA64.
* class.c, eval.c, gc.c, hash.c, marshal.c, parse.y, variable.c:
Add proper casts to avoid warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-06 18:55:43 +03:00
|
|
|
void st_add_direct(st_table *, st_data_t, st_data_t);
|
|
|
|
void st_free_table(st_table *);
|
|
|
|
void st_cleanup_safe(st_table *, st_data_t);
|
|
|
|
st_table *st_copy(st_table *);
|
|
|
|
|
2003-01-09 07:28:28 +03:00
|
|
|
#define ST_NUMCMP ((int (*)()) 0)
|
|
|
|
#define ST_NUMHASH ((int (*)()) -2)
|
1998-01-16 15:13:05 +03:00
|
|
|
|
|
|
|
#define st_numcmp ST_NUMCMP
|
|
|
|
#define st_numhash ST_NUMHASH
|
|
|
|
|
|
|
|
int st_strhash();
|
|
|
|
|
|
|
|
#endif /* ST_INCLUDED */
|