1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
/*
* Revision Control Information
*
* /projects/hsis/CVS/utilities/st/st.h,v
* serdar
* 1.1
* 1993/07/29 01:00:21
*
*/
/* LINTLIBRARY */
/* /projects/hsis/CVS/utilities/st/st.h,v 1.1 1993/07/29 01:00:21 serdar Exp */
#ifndef ABC__misc__st__st_h
#define ABC__misc__st__st_h
#define st__INCLUDED
#include "misc/util/abc_global.h"
ABC_NAMESPACE_HEADER_START
/* These are potential duplicates. */
#ifndef EXTERN
# ifdef __cplusplus
# ifdef ABC_NAMESPACE
# define EXTERN extern
# else
# define EXTERN extern "C"
# endif
# else
# define EXTERN extern
# endif
#endif
#ifndef ARGS
#define ARGS(protos) protos
#endif
typedef int (* st__compare_func_type)(const char*, const char*);
typedef int (* st__hash_func_type)(const char*, int);
typedef struct st__table_entry st__table_entry;
struct st__table_entry {
char *key;
char *record;
st__table_entry *next;
};
typedef struct st__table st__table;
struct st__table {
st__compare_func_type compare;
st__hash_func_type hash;
int num_bins;
int num_entries;
int max_density;
int reorder_flag;
double grow_factor;
st__table_entry **bins;
};
typedef struct st__generator st__generator;
struct st__generator {
st__table *table;
st__table_entry *entry;
int index;
};
#define st__is_member(table,key) st__lookup(table,key,(char **) 0)
#define st__count(table) ((table)->num_entries)
enum st__retval { st__CONTINUE, st__STOP, st__DELETE};
typedef enum st__retval (* st__PFSR)(char *, char *, char *);
typedef int (* st__PFI)();
extern st__table * st__init_table_with_params ( st__compare_func_type compare, st__hash_func_type hash, int size, int density, double grow_factor, int reorder_flag);
extern st__table * st__init_table ( st__compare_func_type, st__hash_func_type);
extern void st__free_table ( st__table *);
extern int st__lookup ( st__table *, const char *, char **);
extern int st__lookup_int ( st__table *, char *, int *);
extern int st__insert ( st__table *, const char *, char *);
extern int st__add_direct ( st__table *, char *, char *);
extern int st__find_or_add ( st__table *, char *, char ***);
extern int st__find ( st__table *, char *, char ***);
extern st__table * st__copy ( st__table *);
extern int st__delete ( st__table *, const char **, char **);
extern int st__delete_int ( st__table *, long *, char **);
extern int st__foreach ( st__table *, st__PFSR, char *);
extern int st__strhash (const char *, int);
extern int st__numhash (const char *, int);
extern int st__ptrhash (const char *, int);
extern int st__numcmp (const char *, const char *);
extern int st__ptrcmp (const char *, const char *);
extern st__generator * st__init_gen ( st__table *);
extern int st__gen ( st__generator *, const char **, char **);
extern int st__gen_int ( st__generator *, const char **, long *);
extern void st__free_gen ( st__generator *);
#define st__DEFAULT_MAX_DENSITY 5
#define st__DEFAULT_INIT_TABLE_SIZE 11
#define st__DEFAULT_GROW_FACTOR 2.0
#define st__DEFAULT_REORDER_FLAG 0
#define st__foreach_item(table, gen, key, value) \
for(gen= st__init_gen(table); st__gen(gen,key,value) || ( st__free_gen(gen),0);)
#define st__foreach_item_int(table, gen, key, value) \
for(gen= st__init_gen(table); st__gen_int(gen,key,value) || ( st__free_gen(gen),0);)
#define st__OUT_OF_MEM -10000
ABC_NAMESPACE_HEADER_END
#endif /* st__INCLUDED */
|