- muscle_insert ("version", VERSION);
- muscle_insert ("filename", infile);
-
- /* Skeleton use. */
- muscle_insert ("skeleton", skeleton);
-
- /* Types. */
- muscle_insert ("stype", "int");
- muscle_insert ("ltype", "yyltype");
-
- /* Tokens. */
- muscle_insert ("tokendef", "");
-
- /* Tables. */
- muscle_insert ("rhs", "0");
- muscle_insert ("pact", "0");
- muscle_insert ("prhs", "0");
- muscle_insert ("stos", "0");
- muscle_insert ("check", "0");
- muscle_insert ("pgoto", "0");
- muscle_insert ("table", "0");
- muscle_insert ("tname", "0");
- muscle_insert ("defact", "0");
- muscle_insert ("toknum", "0");
- muscle_insert ("defgoto", "0");
- muscle_insert ("translate", "0");
-
- /* Various macros. */
- muscle_insert ("flag", "0");
- muscle_insert ("last", "0");
- muscle_insert ("pure", "0");
- muscle_insert ("nsym", "0");
- muscle_insert ("debug", "0");
- muscle_insert ("final", "0");
- muscle_insert ("maxtok", "0");
- muscle_insert ("ntbase", "0");
- muscle_insert ("verbose", "0");
- muscle_insert ("prefix", "yy");
-
- /* No parser macros. */
- muscle_insert ("nnts", "0");
- muscle_insert ("nrules", "0");
- muscle_insert ("nstates", "0");
- muscle_insert ("ntokens", "0");
-
- /* 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;