- muscle_insert ("version", VERSION);
- muscle_insert ("filename", infile);
-
- /* Types. */
- muscle_insert ("stype", "int");
- muscle_insert ("ltype", "yyltype");
-
- /* Tables. */
- muscle_insert ("rhs", NULL);
- muscle_insert ("pact", NULL);
- muscle_insert ("prhs", NULL);
- muscle_insert ("stos", NULL);
- muscle_insert ("check", NULL);
- muscle_insert ("pgoto", NULL);
- muscle_insert ("table", NULL);
- muscle_insert ("tname", NULL);
- muscle_insert ("defact", NULL);
- muscle_insert ("toknum", NULL);
- muscle_insert ("defgoto", NULL);
- muscle_insert ("translate", NULL);
-
- /* Various macros. */
- muscle_insert ("flag", NULL);
- muscle_insert ("last", NULL);
- muscle_insert ("pure", NULL);
- muscle_insert ("nsym", NULL);
- muscle_insert ("debug", NULL);
- muscle_insert ("final", NULL);
- muscle_insert ("maxtok", NULL);
- muscle_insert ("ntbase", NULL);
- muscle_insert ("error-verbose", NULL);
- muscle_insert ("prefix", NULL);
- /* Default #line formatting. */
- muscle_insert ("linef", "#line %d %s\n");
-
- /* No parser macros. */
- muscle_insert ("nnts", NULL);
- muscle_insert ("nrules", NULL);
- muscle_insert ("nstates", NULL);
- muscle_insert ("ntokens", NULL);
-
- /* Stack parameters. */
- muscle_insert ("maxdepth", "10000");
- muscle_insert ("initdepth", "200");
-
- /* C++ macros. */
- muscle_insert ("name", "Parser");
+ MUSCLE_INSERT_STRING ("version", VERSION);
+ MUSCLE_INSERT_C_STRING ("filename", grammar_file);
+}
+
+
+/*------------------------------------------------------------.
+| 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 probe;
+ muscle_entry *entry = NULL;
+
+ probe.key = key;
+ entry = hash_lookup (muscle_table, &probe);
+
+ if (!entry)
+ {
+ /* First insertion in the hash. */
+ MALLOC (entry, 1);
+ entry->key = key;
+ hash_insert (muscle_table, entry);
+ }
+ entry->value = value;