Mercurial > cgi-bin > hgwebdir.cgi > VMS > C_Libraries > Hash_impl
comparison PrivateHash.h @ 31:1d42a512f482
Renamed VMS to PR, in new branch
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Fri, 08 Mar 2013 05:44:24 -0800 |
| parents | 18ec64d06e35 |
| children | 097d8ccb18b7 |
comparison
equal
deleted
inserted
replaced
| 9:d157ea598e06 | 10:2789f6ef9d6e |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2009 OpenSourceStewardshipFoundation.org | 2 * Copyright 2009 OpenSourceResearchInstitute.org |
| 3 * Licensed under GNU General Public License version 2 | 3 * Licensed under GNU General Public License version 2 |
| 4 * | 4 * |
| 5 * Author: seanhalle@yahoo.com | 5 * Author: seanhalle@yahoo.com |
| 6 */ | 6 */ |
| 7 | 7 |
| 25 | 25 |
| 26 | 26 |
| 27 //===================== structs ===================== | 27 //===================== structs ===================== |
| 28 union hashkey_t{ | 28 union hashkey_t{ |
| 29 char hashable[8]; | 29 char hashable[8]; |
| 30 int parts[2]; | 30 int32 parts[2]; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 typedef union hashkey_t hashkey_t; | 33 typedef union hashkey_t hashkey_t; |
| 34 | 34 |
| 35 typedef struct _HashEntry HashEntry; | 35 typedef struct _HashEntry HashEntry; |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 typedef void (*FreeEntryContentFnPtr) ( void * ); | 44 typedef void (*FreeEntryContentFnPtr) ( void * ); |
| 45 | 45 |
| 46 typedef struct | 46 typedef struct |
| 47 { int tableSz; | 47 { int32 tableSz; |
| 48 int numEntries; | 48 int32 numEntries; |
| 49 HashEntry* *entries; | 49 HashEntry* *entries; |
| 50 int32 hashMask; | 50 int32 hashMask; |
| 51 int32 prevHash; | 51 int32 prevHash; |
| 52 FreeEntryContentFnPtr freeEntryContentFn; | 52 FreeEntryContentFnPtr freeEntryContentFn; |
| 53 } | 53 } |
| 56 | 56 |
| 57 //=========================================================================== | 57 //=========================================================================== |
| 58 // Public functions | 58 // Public functions |
| 59 HashTable *makeHashTable( int numHashSlots, FreeEntryContentFnPtr freeFn ); | 59 HashTable *makeHashTable( int numHashSlots, FreeEntryContentFnPtr freeFn ); |
| 60 | 60 |
| 61 int putEntryIntoTable( HashEntry *entry, HashTable *table); | 61 int32 putEntryIntoTable( HashEntry *entry, HashTable *table); |
| 62 int addValueIntoTable( char* key, void *value, HashTable *table); | 62 int32 addValueIntoTable( char* key, void *value, HashTable *table); |
| 63 HashEntry *getEntryFromTable( char *key, HashTable *table ); | 63 HashEntry *getEntryFromTable( char *key, HashTable *table ); |
| 64 void *getValueFromTable( char *key, HashTable *table ); | 64 void *getValueFromTable( char *key, HashTable *table ); |
| 65 | 65 |
| 66 bool8 deleteEntryFromTable( char *key, HashTable *table ); | 66 bool8 deleteEntryFromTable( char *key, HashTable *table ); |
| 67 bool8 deleteThisEntryFromTable( HashEntry *entry, HashTable *table ); | 67 bool8 deleteThisEntryFromTable( HashEntry *entry, HashTable *table ); |
| 72 | 72 |
| 73 //================= Same Fns, but for 32b array key hash fn ================ | 73 //================= Same Fns, but for 32b array key hash fn ================ |
| 74 HashTable *makeHashTable32(int32 powerOf2OfSz, FreeEntryContentFnPtr freeFn); | 74 HashTable *makeHashTable32(int32 powerOf2OfSz, FreeEntryContentFnPtr freeFn); |
| 75 HashTable *makeDefaultSizeHashTable32( FreeEntryContentFnPtr freeFn ); | 75 HashTable *makeDefaultSizeHashTable32( FreeEntryContentFnPtr freeFn ); |
| 76 | 76 |
| 77 int putEntryIntoTable32( HashEntry *entry, HashTable *table); | 77 int32 putEntryIntoTable32( HashEntry *entry, HashTable *table); |
| 78 HashEntry *addValueIntoTable32( uint32 key[], void *value, HashTable *table); | 78 HashEntry *addValueIntoTable32( uint32 key[], void *value, HashTable *table); |
| 79 HashEntry *getEntryFromTable32( uint32 key[], HashTable *table ); | 79 HashEntry *getEntryFromTable32( uint32 key[], HashTable *table ); |
| 80 void *getValueFromTable32( uint32 key[], HashTable *table ); | 80 void *getValueFromTable32( uint32 key[], HashTable *table ); |
| 81 | 81 |
| 82 bool32 deleteEntryFromTable32( uint32 key[], HashTable *table ); | 82 bool32 deleteEntryFromTable32( uint32 key[], HashTable *table ); |
