/*
 * hash.h: hash storage for C..
 *  an hash is a hash table of (key, value) trees..
 *
 * (C) Duncan C. White, 1996-2008 although it seems longer:-)
 */


typedef struct hash_s *hash;
typedef void *value;
typedef char *key;

typedef void (*printfunc)( FILE *, key, value );
typedef void (*foreachcbfunc)( key, value, void * );
typedef void (*freefunc)( value );
typedef value (*copyfunc)( value );

extern hash hashCreate( printfunc p, freefunc f, copyfunc c );
extern void hashEmpty( hash a );
extern hash hashCopy( hash h );
extern void hashFree( hash h );
extern void hashSet( hash a, key k, value v );
extern int hashPresent( hash a, key k, value * v );
extern value hashFind( hash a, key k );
extern void hashForeach( hash a, foreachcbfunc cb, void * arg );
extern void hashDump( FILE * out, hash a );
extern void hashMetrics( hash h, int * min, int * max, double * avg );
