+ MUSCLE_INSERT_STRING ("name", "Parser");
+}
+
+
+/*------------------------------------------------------------.
+| Free all the memory consumed by the muscle machinery only. |
+`------------------------------------------------------------*/
+
+void
+muscle_free (void)
+{
+ hash_free (muscle_table);
+ obstack_free (&muscle_obstack, NULL);
+}
+
+
+
+/*------------------------------------------------------------.
+| Insert (KEY, VALUE). If KEY already existed, overwrite the |
+| previous value. |
+`------------------------------------------------------------*/
+
+void
+muscle_insert (const char *key, char *value)
+{
+ muscle_entry_t probe;
+ muscle_entry_t *entry = NULL;
+
+ probe.key = key;
+ entry = hash_lookup (muscle_table, &probe);
+
+ if (!entry)
+ {
+ /* First insertion in the hash. */
+ entry = XMALLOC (muscle_entry_t, 1);
+ entry->key = key;
+ hash_insert (muscle_table, entry);
+ }
+ entry->value = value;
+}
+
+
+/*-------------------------------------------------------------------.
+| Insert (KEY, VALUE). If KEY already existed, overwrite the |
+| previous value. Uses MUSCLE_OBSTACK. De-allocates the previously |
+| associated value. VALUE and SEPARATOR are copied. |
+`-------------------------------------------------------------------*/
+
+void
+muscle_grow (const char *key, const char *val, const char *separator)
+{
+ muscle_entry_t probe;
+ muscle_entry_t *entry = NULL;
+
+ probe.key = key;
+ entry = hash_lookup (muscle_table, &probe);
+
+ if (!entry)
+ {
+ /* First insertion in the hash. */
+ entry = XMALLOC (muscle_entry_t, 1);
+ entry->key = key;
+ hash_insert (muscle_table, entry);
+ entry->value = xstrdup (val);
+ }
+ else
+ {
+ /* Grow the current value. */
+ char *new_val;
+ fprintf (stderr, "<= %s + %s\n", entry->value, val);
+ obstack_sgrow (&muscle_obstack, entry->value);
+ free (entry->value);
+ obstack_sgrow (&muscle_obstack, separator);
+ obstack_sgrow (&muscle_obstack, val);
+ obstack_1grow (&muscle_obstack, 0);
+ new_val = obstack_finish (&muscle_obstack);
+ entry->value = xstrdup (new_val);
+ fprintf (stderr, "=> %s\n", new_val);
+ obstack_free (&muscle_obstack, new_val);
+ }