source: EcnlProtoTool/trunk/onigmo-5.15.0/src/st.h@ 279

Last change on this file since 279 was 279, checked in by coas-nagasima, 7 years ago

ファイルを追加、更新。

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 1.6 KB
RevLine 
[279]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 uintptr_t st_data_t;
10#define ST_DATA_T_DEFINED
11
12typedef struct st_table st_table;
13typedef int st_index_t;
14
15struct st_hash_type {
16 int (*compare)();
17 int (*hash)();
18};
19
20struct st_table {
21 struct st_hash_type *type;
22 int num_bins;
23 int num_entries;
24 struct st_table_entry **bins;
25};
26
27#define st_is_member(table,key) st_lookup(table,key,(st_data_t *)0)
28
29enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE, ST_CHECK};
30
31#ifndef _
32# define _(args) args
33#endif
34#ifndef ANYARGS
35# ifdef __cplusplus
36# define ANYARGS ...
37# else
38# define ANYARGS
39# endif
40#endif
41
42st_table *st_init_table _((struct st_hash_type *));
43st_table *st_init_table_with_size _((struct st_hash_type *, int));
44st_table *st_init_numtable _((void));
45st_table *st_init_numtable_with_size _((int));
46st_table *st_init_strtable _((void));
47st_table *st_init_strtable_with_size _((int));
48int st_delete _((st_table *, st_data_t *, st_data_t *));
49int st_delete_safe _((st_table *, st_data_t *, st_data_t *, st_data_t));
50int st_insert _((st_table *, st_data_t, st_data_t));
51int st_lookup _((st_table *, st_data_t, st_data_t *));
52int st_foreach _((st_table *, int (*)(ANYARGS), st_data_t));
53void st_add_direct _((st_table *, st_data_t, st_data_t));
54void st_free_table _((st_table *));
55void st_cleanup_safe _((st_table *, st_data_t));
56st_table *st_copy _((st_table *));
57
58#define ST_NUMCMP ((int (*)()) 0)
59#define ST_NUMHASH ((int (*)()) -2)
60
61#define st_numcmp ST_NUMCMP
62#define st_numhash ST_NUMHASH
63
64#endif /* ST_INCLUDED */
Note: See TracBrowser for help on using the repository browser.