* src/files.c (action_obstack): Remove, unused.

(output_obstack): Remove it, and all its dependencies, as it is no
longer needed.
* src/reader.c (epilogue_set): Build the epilogue in the
muscle_obstack.
* src/output.h, src/output.c (muscle_obstack): Move to...
* src/muscle_tab.h, src/muscle_tab.h: here.
(muscle_init): Initialize muscle_obstack.
(muscle_free): New.
* src/main.c (main): Call it.
This commit is contained in:
Akim Demaille
2002-06-14 17:36:24 +00:00
parent 0c15323de7
commit 592e8d4d01
10 changed files with 55 additions and 35 deletions

View File

@@ -24,6 +24,10 @@
#include "muscle_tab.h"
#include "getargs.h"
/* An obstack used to create some entries. */
struct obstack muscle_obstack;
/* Initial capacity of muscles hash table. */
#define HT_INITIAL_CAPACITY 257
@@ -44,16 +48,24 @@ hash_muscle (const void *x, unsigned int tablesize)
return hash_string (m->key, tablesize);
}
/*-----------------------------------------------------------------.
| Create the MUSCLE_TABLE, and initialize it with default values. |
| Also set up the MUSCLE_OBSTACK. |
`-----------------------------------------------------------------*/
void
muscle_init (void)
{
muscle_table = hash_initialize (HT_INITIAL_CAPACITY, NULL, hash_muscle,
hash_compare_muscles, NULL);
hash_compare_muscles, free);
/* Version and input file. */
muscle_insert ("version", VERSION);
muscle_insert ("filename", infile);
/* FIXME: there should probably be no default here, only in the
skeletons. */
/* Types. */
muscle_insert ("ltype", "yyltype");
@@ -66,8 +78,25 @@ muscle_init (void)
/* C++ macros. */
muscle_insert ("name", "Parser");
/* Initialize the muscle obstack. */
obstack_init (&muscle_obstack);
}
/*------------------------------------------------------------.
| Free all the memory consumed by the muscle machinery only. |
`------------------------------------------------------------*/
void
muscle_free (void)
{
hash_free (muscle_table);
obstack_free (&muscle_obstack, NULL);
}
void
muscle_insert (const char *key, const char *value)
{