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
00019 typedef struct st_table {
00020 struct st_hash_type *type;
00021 int num_bins;
00022 int num_entries;
00023 struct st_table_entry **bins;
00024 }st_table;
00025
00026 #define st_is_member(table,key) st_lookup(table,key,(char **)0)
00027
00028 enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE};
00029
00030
00031
00032 DKC_EXTERN st_table* st_init_table_with_size(
00033 struct st_hash_type *type, int size
00034 );
00035
00036 DKC_EXTERN st_table* st_init_table( struct st_hash_type *type);
00037
00038 DKC_EXTERN st_table *st_init_numtable();
00039
00040 DKC_EXTERN st_table* st_init_numtable_with_size( int size);
00041
00042 DKC_EXTERN st_table* st_init_strtable();
00043
00044 DKC_EXTERN st_table* st_init_strtable_with_size(int size);
00045
00046 DKC_EXTERN void st_free_table( st_table *table);
00047
00048
00049
00050 DKC_EXTERN int st_lookup( st_table *table,register char *key,char **value);
00051
00052
00053 DKC_EXTERN int st_insert( st_table *table, char *key,char *value);
00054
00055
00056 DKC_EXTERN void st_add_direct( st_table *table,
00057 char *key,
00058 char *value);
00059
00060
00061 DKC_EXTERN st_table* st_copy( st_table *old_table);
00062
00063 DKC_EXTERN int st_delete(st_table *table,char **key,char **value);
00064
00065 DKC_EXTERN int st_delete_safe(st_table *table,char **key,char **value,char *never);
00066
00067 DKC_EXTERN void st_cleanup_safe( st_table *table,
00068 char *never);
00069
00070
00071
00072
00073
00074
00075 DKC_EXTERN void st_foreach(st_table *table,int (*func)(),char *arg);
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 #endif