+/** Simple implementation of a hash table which uses
+ string (key, value) pairs. If a key already exists in the
+ table, the newly added value will replace it.
+ This is used for the assembler token table. The replace existing
+ condition is used to implement inheritance.
+*/
+static int
+_compare (const void *s1, const void *s2)
+{
+ return !strcmp (s1, s2);
+}
+
+static int
+_hash (const char *sz)
+{
+ /* Dumb for now */
+ return *sz;
+}
+
+void
+shash_add (hTab ** h, const char *szKey, const char *szValue)
+{
+ int key = _hash (szKey);
+ /* First, delete any that currently exist */
+ hTabDeleteByKey (h, key, szKey, _compare);
+ /* Now add in ours */
+ hTabAddItemLong (h, key, gc_strdup (szKey), gc_strdup (szValue));
+}
+
+const char *
+shash_find (hTab * h, const char *szKey)
+{
+ int key = _hash (szKey);
+ return (char *) hTabFindByKey (h, key, szKey, _compare);