mojoshader_internal.h
changeset 859 824d67791db0
parent 858 d51537335896
child 862 76b8bd7c347f
--- a/mojoshader_internal.h	Wed Feb 24 01:21:21 2010 -0500
+++ b/mojoshader_internal.h	Wed Feb 24 03:20:50 2010 -0500
@@ -154,23 +154,32 @@
 // Hashtables...
 
 typedef struct HashTable HashTable;
-typedef uint32 (*HashTable_HashFn)(const void *key);
-typedef int (*HashTable_KeyMatchFn)(const void *a, const void *b);
-typedef void (*HashTable_NukeFn)(const void *key, const void *value);
+typedef uint32 (*HashTable_HashFn)(const void *key, void *data);
+typedef int (*HashTable_KeyMatchFn)(const void *a, const void *b, void *data);
+typedef void (*HashTable_NukeFn)(const void *key, const void *value, void *data);
 
-HashTable *hash_create(const uint32 initial_table_size,
-              const HashTable_HashFn hashfn,
-              const HashTable_KeyMatchFn keymatchfn,
-              const HashTable_NukeFn nukefn,
-              const int stackable,
-              MOJOSHADER_malloc m, MOJOSHADER_free f, void *d);
+HashTable *hash_create(void *data, const HashTable_HashFn hashfn,
+                       const HashTable_KeyMatchFn keymatchfn,
+                       const HashTable_NukeFn nukefn,
+                       const int stackable,
+                       MOJOSHADER_malloc m, MOJOSHADER_free f, void *d);
 void hash_destroy(HashTable *table);
 int hash_insert(HashTable *table, const void *key, const void *value);
 int hash_remove(HashTable *table, const void *key);
 int hash_find(const HashTable *table, const void *key, const void **_value);
 
-uint32 hash_hash_string(const void *sym);
-int hash_keymatch_string(const void *a, const void *b);
+uint32 hash_hash_string(const void *sym, void *unused);
+int hash_keymatch_string(const void *a, const void *b, void *unused);
+
+
+// String -> String map ...
+typedef HashTable StringMap;
+StringMap *stringmap_create(const int copy, MOJOSHADER_malloc m,
+                            MOJOSHADER_free f, void *d);
+void stringmap_destroy(StringMap *smap);
+int stringmap_insert(StringMap *smap, const char *key, const char *value);
+int stringmap_remove(StringMap *smap, const char *key);
+int stringmap_find(const StringMap *smap, const char *key, const char **_val);
 
 
 // String caching...