X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FHash.h;h=7babfa0439b3cac4ceebddf1a1fa3664a8706696;hb=7849c8aa807427f9ca8b0897b5d13cf399fd9d23;hp=74ff3217eb3797d4d5fb28c62ae6b0a16c4af45b;hpb=1b28d4e1f43185ad8c8e7407c66413e1b358402b;p=ghc-hetmet.git diff --git a/ghc/rts/Hash.h b/ghc/rts/Hash.h index 74ff321..7babfa0 100644 --- a/ghc/rts/Hash.h +++ b/ghc/rts/Hash.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------- - * $Id: Hash.h,v 1.2 2000/01/13 14:34:03 hwloidl Exp $ + * $Id: Hash.h,v 1.4 2000/12/04 12:31:21 simonmar Exp $ * * (c) The GHC Team, 1999 * @@ -9,9 +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 *) );