/* hashLib.h - hash table library header */ /* Copyright 1984-2003 Wind River Systems, Inc. */ /* modification history -------------------- 01j,26jun03,to merged from AE1.1: de-classified, moved private definitions to private/hashLibP.h. 01i,23oct01,rae undo 01h 01h,10oct01,rae merge from truestack ver 01i base 01g 01g,22sep92,rrr added support for c++ 01f,04jul92,jcf cleaned up. 01e,26may92,rrr the tree shuffle 01d,04oct91,rrr passed through the ansification filter -changed copyright notice 01c,05oct90,shl added ANSI function prototypes. made #endif ANSI style. added copyright notice. 01b,26jun90,jcf remove hash id error status. 01a,17nov89,jcf written. */ #ifndef __INChashLibh #define __INChashLibh #ifdef __cplusplus extern "C" { #endif #include "vwModNum.h" #include "sllLib.h" /* status codes */ #define S_hashLib_KEY_CLASH (M_hashLib | 1) /* type definitions */ typedef SL_NODE HASH_NODE; /* HASH_NODE */ typedef struct hashtbl * HASH_ID; /* These hash nodes are used by the hashing functions in hashLib(1) */ typedef struct /* H_NODE_INT */ { HASH_NODE node; /* linked list node (must be first) */ int key; /* hash node key */ int data; /* hash node data */ } H_NODE_INT; typedef struct /* H_NODE_STRING */ { HASH_NODE node; /* linked list node (must be first) */ char * string; /* hash node key */ int data; /* hash node data */ } H_NODE_STRING; /* function declarations */ extern BOOL hashKeyCmp (H_NODE_INT * pMatchHNode, H_NODE_INT * pHNode, int keyCmpArg); extern BOOL hashKeyStrCmp (H_NODE_STRING * pMatchHNode, H_NODE_STRING * pHNode, int keyCmpArg); extern HASH_ID hashTblCreate (int sizeLog2, FUNCPTR keyCmpRtn, FUNCPTR keyRtn, int keyArg); extern HASH_NODE * hashTblEach (HASH_ID hashId, FUNCPTR routine, int routineArg); extern HASH_NODE * hashTblFind (HASH_ID hashId, HASH_NODE * pMatchNode, int keyCmpArg); extern STATUS hashLibInit (void); extern STATUS hashTblDelete (HASH_ID hashId); extern STATUS hashTblDestroy (HASH_ID hashId, BOOL dealloc); extern STATUS hashTblInit (HASH_ID pHashTbl, SL_LIST * pTblMem, int sizeLog2, FUNCPTR keyCmpRtn, FUNCPTR keyRtn, int keyArg); extern STATUS hashTblPut (HASH_ID hashId, HASH_NODE * pHashNode); extern STATUS hashTblRemove (HASH_ID hashId, HASH_NODE * pHashNode); extern STATUS hashTblTerminate (HASH_ID hashId); extern int hashFuncIterScale (int elements, H_NODE_STRING * pHNode, int seed); extern int hashFuncModulo (int elements, H_NODE_INT * pHNode, int divisor); extern int hashFuncMultiply (int elements, H_NODE_INT * pHNode, int multiplier); #ifdef __cplusplus } #endif #endif /* __INChashLibh */