#if !defined (_HASHLIB_H_)
#define _HASHLIB_H_
#include "stdc.h"
#ifndef PTR_T
# ifdef __STDC__
# define PTR_T void *
# else
# define PTR_T char *
# endif
#endif
typedef struct bucket_contents {
struct bucket_contents *next;
char *key;
PTR_T data;
unsigned int khash;
int times_found;
} BUCKET_CONTENTS;
typedef struct hash_table {
BUCKET_CONTENTS **bucket_array;
int nbuckets;
int nentries;
} HASH_TABLE;
typedef int hash_wfunc __P((BUCKET_CONTENTS *));
extern HASH_TABLE *hash_create __P((int));
extern HASH_TABLE *hash_copy __P((HASH_TABLE *, sh_string_func_t *));
extern void hash_flush __P((HASH_TABLE *, sh_free_func_t *));
extern void hash_dispose __P((HASH_TABLE *));
extern void hash_walk __P((HASH_TABLE *, hash_wfunc *));
extern int hash_bucket __P((const char *, HASH_TABLE *));
extern int hash_size __P((HASH_TABLE *));
extern BUCKET_CONTENTS *hash_search __P((const char *, HASH_TABLE *, int));
extern BUCKET_CONTENTS *hash_insert __P((char *, HASH_TABLE *, int));
extern BUCKET_CONTENTS *hash_remove __P((const char *, HASH_TABLE *, int));
extern unsigned int hash_string __P((const char *));
#define hash_items(bucket, table) \
((table && (bucket < table->nbuckets)) ? \
table->bucket_array[bucket] : \
(BUCKET_CONTENTS *)NULL)
#define DEFAULT_HASH_BUCKETS 64
#define HASH_ENTRIES(ht) ((ht) ? (ht)->nentries : 0)
#define HASH_NOSRCH 0x01
#define HASH_CREATE 0x02
#if !defined (NULL)
# if defined (__STDC__)
# define NULL ((void *) 0)
# else
# define NULL 0x0
# endif
#endif
#endif