comparison PrivateHash.h @ 1:5900d90f5d71

Works -- fixed some minor bugs -- VMSHW_matrix_mult working
author Me
date Wed, 28 Jul 2010 13:14:54 -0700
parents ee3ad252427e
children 7c4d2bf121a9
comparison
equal deleted inserted replaced
0:bc7d6c169089 1:b9cfb28f8f37
6 */ 6 */
7 7
8 #ifndef _PRIVATE_HASH_H 8 #ifndef _PRIVATE_HASH_H
9 #define _PRIVATE_HASH_H 9 #define _PRIVATE_HASH_H
10 10
11 #include "../VMS_primitive_data_types.h"
11 12
12 #define TRUE 1 13 #define TRUE 1
13 #define FALSE 0 14 #define FALSE 0
14 15
15 16
16 #define HASHSIZE 101 17 #define DEFAULT_HASHSIZE 1 << 10
17 18
18 typedef struct _HashEntry HashEntry; 19 typedef struct _HashEntry HashEntry;
19 20
20 struct _HashEntry 21 struct _HashEntry
21 { 22 {
32 HashEntry* *entries; 33 HashEntry* *entries;
33 FreeEntryContentFnPtr freeEntryContentFn; 34 FreeEntryContentFnPtr freeEntryContentFn;
34 } 35 }
35 HashTable; 36 HashTable;
36 37
37 //===========================================================================
38 // Internal functions
39 void freeHashEntryUsing( HashEntry *entry, HashTable *table );
40 char* strdup_m(char *o);
41 unsigned int hashThisKey( char *s, int hashSz );
42 void nullOutTablesArray( HashTable *table );
43 void *getEntryFromTable( char *key, HashTable *table );
44 void doubleTableSize( HashTable *table );
45 void addEntryToTable( HashEntry *entry, HashTable *table );
46 38
47 //=========================================================================== 39 //===========================================================================
48 // Public functions 40 // Public functions
49 HashTable *makeHashTable( int numHashSlots, FreeEntryContentFnPtr freeFn ); 41 HashTable *makeHashTable( int numHashSlots, FreeEntryContentFnPtr freeFn );
50 42
43 int putEntryIntoTable( HashEntry *entry, HashTable *table);
44 int addValueIntoTable( char* key, void *value, HashTable *table);
45 HashEntry *getEntryFromTable( char *key, HashTable *table );
51 void *getValueFromTable( char *key, HashTable *table ); 46 void *getValueFromTable( char *key, HashTable *table );
47
52 bool8 deleteEntryFromTable( char *key, HashTable *table ); 48 bool8 deleteEntryFromTable( char *key, HashTable *table );
49 bool8 deleteThisEntryFromTable( HashEntry *entry, HashTable *table );
53 bool8 deleteEntrysValueInTable( char *key, HashTable *table ); 50 bool8 deleteEntrysValueInTable( char *key, HashTable *table );
51 bool8 deleteEntryFromTableAndFreeValue( char *key, HashTable *table );
52 void freeHashTable( HashTable *table );
53 //char *paramBagToString( ParamBag * bag )
54 54
55 int addToTable( char* key, void *content, HashTable *table ); 55 //===========================================================================
56 void freeTable( HashTable *table ); 56 // Internal functions
57 //char *paramBagToString( ParamBag * bag ) 57 void freeHashEntryUsing( HashEntry *entry, HashTable *table );
58 unsigned int hashThisKey( char *s, int hashSz );
59 void nullOutTablesArray( HashTable *table );
60 void doubleTableSize( HashTable *table );
61 void freeHashEntryButNotContent( HashEntry *entry );
58 62
59 #endif /* _PRIVATE_HASH_H */ 63 #endif /* _PRIVATE_HASH_H */
60 64