X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FHash.h;h=7babfa0439b3cac4ceebddf1a1fa3664a8706696;hb=0bffc410964e1688ad80d277d53400659e697ab5;hp=ac0df5cb49fa3e98b8c2218a8058d8ada054c047;hpb=f3bed25cb37981ef391f750cae58280e71cd80bc;p=ghc-hetmet.git diff --git a/ghc/rts/Hash.h b/ghc/rts/Hash.h index ac0df5c..7babfa0 100644 --- a/ghc/rts/Hash.h +++ b/ghc/rts/Hash.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------- - * $Id: Hash.h,v 1.1 1999/01/27 12:11:26 simonm Exp $ + * $Id: Hash.h,v 1.4 2000/12/04 12:31:21 simonmar Exp $ * * (c) The GHC Team, 1999 * @@ -9,8 +9,27 @@ typedef struct hashtable HashTable; /* abstract */ +/* Hash table access where the keys are StgWords */ +HashTable * allocHashTable ( void ); void * lookupHashTable ( HashTable *table, StgWord key ); void insertHashTable ( HashTable *table, StgWord key, void *data ); void * removeHashTable ( HashTable *table, StgWord key, void *data ); -void freeHashTable ( HashTable *table, void (*freeDataFun)(void *) ); -HashTable * allocHashTable ( void ); + +/* Hash table access where the keys are C strings (the strings are + * assumed to be allocated by the caller, and mustn't be deallocated + * until the corresponding hash table entry has been removed). + */ +HashTable * allocStrHashTable ( void ); + +#define lookupStrHashTable(table, key) \ + (lookupHashTable(table, (StgWord)key)) + +#define insertStrHashTable(table, key, data) \ + (insertHashTable(table, (StgWord)key, data)) + +#define removeStrHashTable(table, key, data) \ + (removeHashTable(table, (StgWord)key, data)) + +/* Freeing hash tables + */ +void freeHashTable ( HashTable *table, void (*freeDataFun)(void *) );