+
+/*-------------------------------------------------------------------.
+| 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);
+ }
+}
+
+
+/*-------------------------------------------------------------------.
+| MUSCLE is an M4 list of pairs. Create or extend it with the pair |
+| (A1, A2). Note that because the muscle values are output *double* |
+| quoted, one needs to strip the first level of quotes to reach the |
+| list itself. |
+`-------------------------------------------------------------------*/
+
+void muscle_pair_list_grow (const char *muscle,
+ const char *a1, const char *a2)
+{
+ char *val;
+ obstack_fgrow2 (&muscle_obstack, "[[[%s]], [[%s]]]", a1, a2);
+ obstack_1grow (&muscle_obstack, 0);
+ val = obstack_finish (&muscle_obstack);
+ muscle_grow (muscle, val, ",\n");
+ obstack_free (&muscle_obstack, val);
+}
+
+/*-------------------------------.
+| Find the value of muscle KEY. |
+`-------------------------------*/
+
+char*