#include <string.h>#include "setGetHashTable.h"#include "MALLOC.h"Include dependency graph for setGetHashTable.c:

Go to the source code of this file.
Functions | |
| static unsigned int | setGetHashTableHash (void *key) |
| static int | setGetHashTableEqualKeys (void *k1, void *k2) |
| GetPropertyHashTable * | createGetHashTable (void) |
| void | destroyGetHashTable (GetPropertyHashTable *hashTable) |
| getPropertyFunc | searchGetHashtable (GetPropertyHashTable *hashTable, char *key) |
| int | insertGetHashtable (GetPropertyHashTable *hashTable, char *key, getPropertyFunc value) |
| SetPropertyHashTable * | createSetHashTable (void) |
| void | destroySetHashTable (SetPropertyHashTable *hashTable) |
| setPropertyFunc | searchSetHashtable (SetPropertyHashTable *hashTable, char *key) |
| int | insertSetHashtable (SetPropertyHashTable *hashTable, char *key, setPropertyFunc value) |
| GetPropertyHashTable* createGetHashTable | ( | void | ) |
Create a new hashTable of get functions
Definition at line 42 of file setGetHashTable.c.
References create_hashtable(), setGetHashTableEqualKeys(), and setGetHashTableHash().
Referenced by createScilabGetHashTable().
00043 { 00044 return create_hashtable(16, setGetHashTableHash, setGetHashTableEqualKeys ) ; 00045 }
Here is the call graph for this function:

Here is the caller graph for this function:

| SetPropertyHashTable* createSetHashTable | ( | void | ) |
Create a new hashTable of set functions
Definition at line 72 of file setGetHashTable.c.
References create_hashtable(), setGetHashTableEqualKeys(), and setGetHashTableHash().
Referenced by createScilabSetHashTable().
00073 { 00074 return create_hashtable(16, setGetHashTableHash, setGetHashTableEqualKeys ) ; 00075 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void destroyGetHashTable | ( | GetPropertyHashTable * | hashTable | ) |
destroy the hashtable and free the used resources.
Definition at line 47 of file setGetHashTable.c.
References hashtable_destroy().
Referenced by destroyScilabGetHashTable().
00048 { 00049 /* we just store pointers */ 00050 hashtable_destroy( hashTable, 0 ) ; 00051 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void destroySetHashTable | ( | SetPropertyHashTable * | hashTable | ) |
destroy the hashtable and free the used resources.
Definition at line 77 of file setGetHashTable.c.
References hashtable_destroy().
Referenced by destroyScilabSetHashTable().
00078 { 00079 /* we just store pointers */ 00080 hashtable_destroy( hashTable, 0 ) ; 00081 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int insertGetHashtable | ( | GetPropertyHashTable * | hashTable, | |
| char * | key, | |||
| getPropertyFunc | value | |||
| ) |
Definition at line 58 of file setGetHashTable.c.
References hashtable_insert(), MALLOC, and NULL.
Referenced by createScilabGetHashTable().
00059 { 00060 /* allocate a new key because the hashtable claims ownership */ 00061 /* and will free it when destroyed */ 00062 char * copyKey = NULL ; 00063 int keyLength = strlen( key ) + 1 ; 00064 00065 copyKey = MALLOC( keyLength * sizeof(char) ) ; 00066 if ( copyKey == NULL ) { return 0 ; } 00067 strcpy( copyKey, key ) ; 00068 00069 return hashtable_insert( hashTable, copyKey, value ) ; 00070 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int insertSetHashtable | ( | SetPropertyHashTable * | hashTable, | |
| char * | key, | |||
| setPropertyFunc | value | |||
| ) |
Definition at line 88 of file setGetHashTable.c.
References hashtable_insert(), MALLOC, and NULL.
Referenced by createScilabSetHashTable().
00089 { 00090 /* allocate a new key because the hashtable claims ownership */ 00091 /* and will free it when destroyed */ 00092 char * copyKey = NULL ; 00093 int keyLength = strlen( key ) + 1 ; 00094 00095 copyKey = MALLOC( keyLength * sizeof(char) ) ; 00096 strcpy( copyKey, key ) ; 00097 00098 return hashtable_insert( hashTable, copyKey, value ) ; 00099 }
Here is the call graph for this function:

Here is the caller graph for this function:

| getPropertyFunc searchGetHashtable | ( | GetPropertyHashTable * | hashTable, | |
| char * | key | |||
| ) |
Search for a key in a hashtable. if succeed, return the value needed. if failed, return NULL
Definition at line 53 of file setGetHashTable.c.
References hashtable_search().
Referenced by callGetProperty().
00054 { 00055 return (getPropertyFunc) hashtable_search( hashTable, key ) ; 00056 }
Here is the call graph for this function:

Here is the caller graph for this function:

| setPropertyFunc searchSetHashtable | ( | SetPropertyHashTable * | hashTable, | |
| char * | key | |||
| ) |
Search for a key in a hashtable. if succeed, return the value needed. if failed, return NULL
Definition at line 83 of file setGetHashTable.c.
References hashtable_search().
Referenced by callSetProperty().
00084 { 00085 return (setPropertyFunc) hashtable_search( hashTable, key ) ; 00086 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int setGetHashTableEqualKeys | ( | void * | k1, | |
| void * | k2 | |||
| ) | [static] |
Definition at line 33 of file setGetHashTable.c.
Referenced by createGetHashTable(), and createSetHashTable().
00034 { 00035 if ( strcmp( (char *)k1, (char *)k2 ) == 0 ) 00036 { 00037 return 1 ; 00038 } 00039 return 0 ; 00040 }
Here is the caller graph for this function:

| static unsigned int setGetHashTableHash | ( | void * | key | ) | [static] |
Definition at line 18 of file setGetHashTable.c.
Referenced by createGetHashTable(), and createSetHashTable().
00019 { 00020 unsigned long hash = 5381; 00021 int c ; 00022 char * str = key ; 00023 00024 while ( (c = *str++) ) 00025 { 00026 hash = ((hash << 5) + hash) + c ; /* hash * 33 + c */ 00027 } 00028 00029 return hash; 00030 00031 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.5.1