X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FHash.h;h=208deb5813521d6e324c3a1d1b2e14128b6d71f2;hb=0e6454e68c2b0278b6cc3655303ab44f8d40c42d;hp=ac0df5cb49fa3e98b8c2218a8058d8ada054c047;hpb=f3bed25cb37981ef391f750cae58280e71cd80bc;p=ghc-hetmet.git diff --git a/ghc/rts/Hash.h b/ghc/rts/Hash.h index ac0df5c..208deb5 100644 --- a/ghc/rts/Hash.h +++ b/ghc/rts/Hash.h @@ -1,5 +1,4 @@ /*----------------------------------------------------------------------------- - * $Id: Hash.h,v 1.1 1999/01/27 12:11:26 simonm Exp $ * * (c) The GHC Team, 1999 * @@ -9,8 +8,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 *) );