abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
st.h
Go to the documentation of this file.
1 /*
2  * Revision Control Information
3  *
4  * /projects/hsis/CVS/utilities/st/st.h,v
5  * serdar
6  * 1.1
7  * 1993/07/29 01:00:21
8  *
9  */
10 /* LINTLIBRARY */
11 
12 /* /projects/hsis/CVS/utilities/st/st.h,v 1.1 1993/07/29 01:00:21 serdar Exp */
13 
14 #ifndef ABC__misc__st__st_h
15 #define ABC__misc__st__st_h
16 #define st__INCLUDED
17 
18 #include "misc/util/abc_global.h"
19 
21 
22 
23 /* These are potential duplicates. */
24 #ifndef EXTERN
25 # ifdef __cplusplus
26 # ifdef ABC_NAMESPACE
27 # define EXTERN extern
28 # else
29 # define EXTERN extern "C"
30 # endif
31 # else
32 # define EXTERN extern
33 # endif
34 #endif
35 
36 #ifndef ARGS
37 #define ARGS(protos) protos
38 #endif
39 
40 
41 typedef int (* st__compare_func_type)(const char*, const char*);
42 typedef int (* st__hash_func_type)(const char*, int);
43 
46  char *key;
47  char *record;
49 };
50 
51 typedef struct st__table st__table;
52 struct st__table {
55  int num_bins;
59  double grow_factor;
61 };
62 
64 struct st__generator {
67  int index;
68 };
69 
70 #define st__is_member(table,key) st__lookup(table,key,(char **) 0)
71 #define st__count(table) ((table)->num_entries)
72 
74 
75 typedef enum st__retval (* st__PFSR)(char *, char *, char *);
76 typedef int (* st__PFI)();
77 
78 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);
80 extern void st__free_table ( st__table *);
81 extern int st__lookup ( st__table *, const char *, char **);
82 extern int st__lookup_int ( st__table *, char *, int *);
83 extern int st__insert ( st__table *, const char *, char *);
84 extern int st__add_direct ( st__table *, char *, char *);
85 extern int st__find_or_add ( st__table *, char *, char ***);
86 extern int st__find ( st__table *, char *, char ***);
87 extern st__table * st__copy ( st__table *);
88 extern int st__delete ( st__table *, const char **, char **);
89 extern int st__delete_int ( st__table *, long *, char **);
90 extern int st__foreach ( st__table *, st__PFSR, char *);
91 extern int st__strhash (const char *, int);
92 extern int st__numhash (const char *, int);
93 extern int st__ptrhash (const char *, int);
94 extern int st__numcmp (const char *, const char *);
95 extern int st__ptrcmp (const char *, const char *);
97 extern int st__gen ( st__generator *, const char **, char **);
98 extern int st__gen_int ( st__generator *, const char **, long *);
99 extern void st__free_gen ( st__generator *);
100 
101 
102 #define st__DEFAULT_MAX_DENSITY 5
103 #define st__DEFAULT_INIT_TABLE_SIZE 11
104 #define st__DEFAULT_GROW_FACTOR 2.0
105 #define st__DEFAULT_REORDER_FLAG 0
106 
107 #define st__foreach_item(table, gen, key, value) \
108  for(gen= st__init_gen(table); st__gen(gen,key,value) || ( st__free_gen(gen),0);)
109 
110 #define st__foreach_item_int(table, gen, key, value) \
111  for(gen= st__init_gen(table); st__gen_int(gen,key,value) || ( st__free_gen(gen),0);)
112 
113 #define st__OUT_OF_MEM -10000
114 
115 
116 
118 
119 
120 
121 #endif /* st__INCLUDED */
st__table_entry * next
Definition: st.h:48
st__table * table
Definition: st.h:65
st__compare_func_type compare
Definition: st.h:53
double grow_factor
Definition: st.h:59
int num_bins
Definition: st.h:55
int st__lookup_int(st__table *, char *, int *)
Definition: st.c:134
int num_entries
Definition: st.h:56
st__table * st__copy(st__table *)
Definition: st.c:330
char * record
Definition: st.h:47
st__table_entry ** bins
Definition: st.h:60
int(* st__hash_func_type)(const char *, int)
Definition: st.h:42
Definition: st.h:73
int st__gen_int(st__generator *, const char **, long *)
Definition: st.c:529
enum st__retval(* st__PFSR)(char *, char *, char *)
Definition: st.h:75
int st__ptrhash(const char *, int)
Definition: st.c:468
int st__gen(st__generator *, const char **, char **)
Definition: st.c:502
st__retval
Definition: st.h:73
int reorder_flag
Definition: st.h:58
char * key
Definition: st.h:46
st__generator * st__init_gen(st__table *)
Definition: st.c:486
int st__strhash(const char *, int)
Definition: st.c:449
Definition: st.h:52
int st__insert(st__table *, const char *, char *)
Definition: st.c:171
Definition: st.h:45
int st__find_or_add(st__table *, char *, char ***)
Definition: st.c:230
static uint32_t hash(uint32_t x)
Definition: Map.h:38
static int size
Definition: cuddSign.c:86
void st__free_gen(st__generator *)
Definition: st.c:556
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
st__table_entry * entry
Definition: st.h:66
int st__add_direct(st__table *, char *, char *)
Definition: st.c:205
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
int(* st__PFI)()
Definition: st.h:76
st__table * st__init_table(st__compare_func_type, st__hash_func_type)
Definition: st.c:72
int st__delete(st__table *, const char **, char **)
Definition: st.c:375
int index
Definition: st.h:67
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)
Definition: st.c:41
int st__find(st__table *, char *, char ***)
Definition: st.c:264
int st__ptrcmp(const char *, const char *)
Definition: st.c:480
int(* st__compare_func_type)(const char *, const char *)
Definition: st.h:41
int st__delete_int(st__table *, long *, char **)
Definition: st.c:398
int st__numhash(const char *, int)
Definition: st.c:462
int max_density
Definition: st.h:57
st__hash_func_type hash
Definition: st.h:54
void st__free_table(st__table *)
Definition: st.c:81
Definition: st.h:73
int st__lookup(st__table *, const char *, char **)
Definition: st.c:114
int st__numcmp(const char *, const char *)
Definition: st.c:474
int st__foreach(st__table *, st__PFSR, char *)