1 /*-----------------------------------------------------------------------------
2 * $Id: Hash.h,v 1.4 2000/12/04 12:31:21 simonmar Exp $
4 * (c) The GHC Team, 1999
6 * Prototypes for Hash.c
8 * -------------------------------------------------------------------------- */
10 typedef struct hashtable HashTable; /* abstract */
12 /* Hash table access where the keys are StgWords */
13 HashTable * allocHashTable ( void );
14 void * lookupHashTable ( HashTable *table, StgWord key );
15 void insertHashTable ( HashTable *table, StgWord key, void *data );
16 void * removeHashTable ( HashTable *table, StgWord key, void *data );
18 /* Hash table access where the keys are C strings (the strings are
19 * assumed to be allocated by the caller, and mustn't be deallocated
20 * until the corresponding hash table entry has been removed).
22 HashTable * allocStrHashTable ( void );
24 #define lookupStrHashTable(table, key) \
25 (lookupHashTable(table, (StgWord)key))
27 #define insertStrHashTable(table, key, data) \
28 (insertHashTable(table, (StgWord)key, data))
30 #define removeStrHashTable(table, key, data) \
31 (removeHashTable(table, (StgWord)key, data))
33 /* Freeing hash tables
35 void freeHashTable ( HashTable *table, void (*freeDataFun)(void *) );