00001
00008 #ifndef ST_INCLUDED
00009 #define ST_INCLUDED
00010
00011 #include "dkcOSIndependent.h"
00012
00013
00014 struct st_hash_type {
00015 int (*compare)();
00016 int (*hash)();
00017 };
00018 typedef struct st_table {
00019 struct st_hash_type *type;
00020 int num_bins;
00021 int num_entries;
00022 struct st_table_entry **bins;
00023 }st_table;
00024
00025 #define st_is_member(table,key) st_lookup(table,key,(char **)0)
00026
00027 enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE};
00028
00029
00030
00031 DKC_EXTERN st_table* st_init_table_with_size(
00032 struct st_hash_type *type, int size
00033 );
00034
00035 DKC_EXTERN st_table* st_init_table( struct st_hash_type *type);
00036
00037 DKC_EXTERN st_table *st_init_numtable();
00038
00039 DKC_EXTERN st_table* st_init_numtable_with_size( int size);
00040
00041 DKC_EXTERN st_table* st_init_strtable();
00042
00043 DKC_EXTERN st_table* st_init_strtable_with_size(int size);
00044
00045 DKC_EXTERN void st_free_table( st_table *table);
00046
00047
00048
00049 DKC_EXTERN int st_lookup( st_table *table,register char *key,char **value);
00050
00051
00052 DKC_EXTERN int st_insert( st_table *table, char *key,char *value);
00053
00054
00055 DKC_EXTERN void st_add_direct( st_table *table,
00056 char *key,
00057 char *value);
00058
00059
00060 DKC_EXTERN st_table* st_copy( st_table *old_table);
00061
00062 DKC_EXTERN int st_delete(st_table *table,char **key,char **value);
00063
00064 DKC_EXTERN int st_delete_safe(st_table *table,char **key,char **value,char *never);
00065
00066 DKC_EXTERN void st_cleanup_safe( st_table *table,
00067 char *never);
00068
00069
00070
00071
00072
00073
00074 DKC_EXTERN void st_foreach(st_table *table,int (*func)(),char *arg);
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 #ifndef ST_INCLUDED_C
00103 # ifndef __cplusplus
00104 # include "st.c"
00105 # endif
00106 #endif
00107
00108
00109 #endif