2000-01-04 23:41:21 -05:00
|
|
|
/* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
/* @(#) st.h 5.1 89/12/14 */
|
|
|
|
|
|
|
|
#ifndef ST_INCLUDED
|
|
|
|
|
|
|
|
#define ST_INCLUDED
|
|
|
|
|
2003-07-27 13:20:29 -04:00
|
|
|
typedef unsigned long st_data_t;
|
2003-05-20 02: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 10:55:43 -05:00
|
|
|
|
1998-01-16 07:13:05 -05:00
|
|
|
typedef struct st_table st_table;
|
|
|
|
|
|
|
|
struct st_hash_type {
|
2003-01-08 23:28:28 -05:00
|
|
|
int (*compare)();
|
|
|
|
int (*hash)();
|
* ascii.c, euc_jp.c, hash.c, oniggnu.h, oniguruma.h, regcomp.c, regenc.c, regenc.h, regerror.c, regexec.c, reggnu.c, regint.h, regparse.c, regparse.h, sjis.c, st.c, st.h, utf8.c: imported Oni Guruma 3.5.4.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-01-28 10:21:48 -05:00
|
|
|
int (*key_free)();
|
|
|
|
st_data_t (*key_clone)();
|
1998-01-16 07:13:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct st_table {
|
|
|
|
struct st_hash_type *type;
|
|
|
|
int num_bins;
|
|
|
|
int num_entries;
|
1999-01-19 23:59:39 -05:00
|
|
|
struct st_table_entry **bins;
|
1998-01-16 07:13:05 -05:00
|
|
|
};
|
|
|
|
|
* ascii.c, euc_jp.c, hash.c, oniggnu.h, oniguruma.h, regcomp.c, regenc.c, regenc.h, regerror.c, regexec.c, reggnu.c, regint.h, regparse.c, regparse.h, sjis.c, st.c, st.h, utf8.c: imported Oni Guruma 3.5.4.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-01-28 10:21:48 -05:00
|
|
|
typedef struct {
|
|
|
|
unsigned char* s;
|
|
|
|
unsigned char* end;
|
|
|
|
} st_strend_key;
|
|
|
|
|
* 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 10:55:43 -05:00
|
|
|
#define st_is_member(table,key) st_lookup(table,key,(st_data_t *)0)
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2004-09-22 00:48:52 -04:00
|
|
|
enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE, ST_CHECK};
|
|
|
|
|
2004-09-22 20:51:32 -04:00
|
|
|
#ifndef _
|
|
|
|
# define _(args) args
|
|
|
|
#endif
|
2004-12-02 22:25:29 -05:00
|
|
|
#ifndef ANYARGS
|
|
|
|
# ifdef __cplusplus
|
|
|
|
# define ANYARGS ...
|
|
|
|
# else
|
|
|
|
# define ANYARGS
|
|
|
|
# endif
|
|
|
|
#endif
|
2004-09-22 20:51:32 -04:00
|
|
|
|
2004-09-22 00:48:52 -04: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));
|
* ascii.c, euc_jp.c, hash.c, oniggnu.h, oniguruma.h, regcomp.c, regenc.c, regenc.h, regerror.c, regexec.c, reggnu.c, regint.h, regparse.c, regparse.h, sjis.c, st.c, st.h, utf8.c: imported Oni Guruma 3.5.4.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-01-28 10:21:48 -05:00
|
|
|
st_table *st_init_strend_table_with_size _((int));
|
2004-09-22 00:48:52 -04:00
|
|
|
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));
|
2005-02-23 08:10:45 -05:00
|
|
|
int st_insert_strend _((st_table *, const unsigned char*, const unsigned char*, st_data_t));
|
2004-09-22 00:48:52 -04:00
|
|
|
int st_lookup _((st_table *, st_data_t, st_data_t *));
|
2005-02-23 08:10:45 -05:00
|
|
|
int st_lookup_strend _((st_table *, const unsigned char*, const unsigned char*, st_data_t*));
|
2004-12-02 22:25:29 -05:00
|
|
|
void st_foreach _((st_table *, int (*)(ANYARGS), st_data_t));
|
2004-09-22 00:48:52 -04:00
|
|
|
void st_add_direct _((st_table *, st_data_t, st_data_t));
|
2005-02-23 08:10:45 -05:00
|
|
|
void st_add_direct_strend _((st_table *, const unsigned char*, const unsigned char*, st_data_t));
|
2004-09-22 00:48:52 -04:00
|
|
|
void st_free_table _((st_table *));
|
|
|
|
void st_cleanup_safe _((st_table *, st_data_t));
|
|
|
|
st_table *st_copy _((st_table *));
|
* 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 10:55:43 -05:00
|
|
|
|
* ascii.c, euc_jp.c, hash.c, oniggnu.h, oniguruma.h, regcomp.c, regenc.c, regenc.h, regerror.c, regexec.c, reggnu.c, regint.h, regparse.c, regparse.h, sjis.c, st.c, st.h, utf8.c: imported Oni Guruma 3.5.4.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-01-28 10:21:48 -05:00
|
|
|
extern st_data_t st_nothing_key_clone _((st_data_t key));
|
|
|
|
extern int st_nothing_key_free _((st_data_t key));
|
|
|
|
|
2003-01-08 23:28:28 -05:00
|
|
|
#define ST_NUMCMP ((int (*)()) 0)
|
|
|
|
#define ST_NUMHASH ((int (*)()) -2)
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
#define st_numcmp ST_NUMCMP
|
|
|
|
#define st_numhash ST_NUMHASH
|
|
|
|
|
|
|
|
#endif /* ST_INCLUDED */
|