#ifndef _HTABLE_H_d2351bd3_ #define _HTABLE_H_d2351bd3_ /* This file is in the public domain. */ void *add_hentry(void * /*tbl*/, void * /*entry*/); void add_new_hentry(void * /*tbl*/, void * /*entry*/); void clear_htable(void * /*tbl*/); void *del_hentry(void * /*tbl*/, const void * /*entry*/); void *del_one_hentry(void * /*tbl*/); int del_this_hentry(void * /*tbl*/, void * /*entry*/); void *find_hentry(const void * /*tbl*/, const void * /*entry*/); void free_htable(void * /*tbl*/); void hset_cmpfxn(void * /*tbl*/, int (* /*fxn*/)(const void * /*obj*/, const void * /*entry*/)); int htable_entries(const void * /*tbl*/); void map_htable(void * /*tbl*/, void (* /*fxn*/)(void *)); void *new_htable(unsigned int (* /*hfxn*/)(const void * /*obj*/, int /*size*/), int (* /*cmpfxn*/)(const void * /*obj*/, const void * /*entry*/)); int string_cmpfxn(const void * /*obj*/, const void * /*entry*/); unsigned int string_hfxn(const void * /*obj*/, int /*size*/); /* char *add_hentry(Tbl,entry) add an entry, returning already-there?old-entry:0 add_new_hentry(Tbl,entry) add an entry, assuming it's not already there clear_htable(Tbl) throws away all entries char *del_hentry(Tbl,entry) delete the entry, returning it (0 if not there) char *del_one_hentry(Tbl) delete any one entry, returning it (0 if no more) del_this_hentry(Tbl,entry) delete the specified entry, returning 1 if it was present char *find_hentry(Tbl,entry) find the entry, if it exists (0 otherwise) free_htable(Tbl) throws away the table hset_cmpfxn(Tbl,cmpfxn) change the comparison function (does not rehash) int htable_entries(Tbl) return the number of entries map_htable(Tbl,fxn) call (*fxn)(entry) for each entry in htable char *new_htable(hfxn,cmpfxn) create and return a new htable int string_cmpfxn(s1,s2) comparison function suited to hashing on strings int string_hfxn(str,siz) hash function suited to hashing on strings calling sequence for hfxns and cmpfxns: hfxn(object,tablesize) -- returns [0..tablesize) cmpfxn(object,entry) -- 0 for match, nonzero otherwise */ #endif