* src/system.h: Include `xalloc.h'.

Remove it from the C files.
* src/files.c (output_files): Free the obstacks.
* src/lex.c (init_lex): Rename as...
(lex_init): this.
(lex_free): New.
* src/main.c (main): Use it.
This commit is contained in:
Akim Demaille
2001-09-25 18:35:04 +00:00
parent 9190f3e726
commit 7ba81a101f
19 changed files with 32 additions and 24 deletions

View File

@@ -1,3 +1,13 @@
2001-09-25 Akim Demaille <akim@epita.fr>
* src/system.h: Include `xalloc.h'.
Remove it from the C files.
* src/files.c (output_files): Free the obstacks.
* src/lex.c (init_lex): Rename as...
(lex_init): this.
(lex_free): New.
* src/main.c (main): Use it.
2001-09-24 Marc Autret <autret_m@epita.fr> 2001-09-24 Marc Autret <autret_m@epita.fr>
* src/vcg.c (open_edge, close_edge, open_node, close_node): Change * src/vcg.c (open_edge, close_edge, open_node, close_node): Change

View File

@@ -23,7 +23,6 @@
The entry point is generate_states. */ The entry point is generate_states. */
#include "system.h" #include "system.h"
#include "xalloc.h"
#include "gram.h" #include "gram.h"
#include "state.h" #include "state.h"
#include "complain.h" #include "complain.h"

View File

@@ -19,7 +19,6 @@
02111-1307, USA. */ 02111-1307, USA. */
#include "system.h" #include "system.h"
#include "xalloc.h"
#include "gram.h" #include "gram.h"
#include "closure.h" #include "closure.h"
#include "derives.h" #include "derives.h"

View File

@@ -20,7 +20,6 @@
#include "system.h" #include "system.h"
#include "getargs.h" #include "getargs.h"
#include "xalloc.h"
#include "files.h" #include "files.h"
#include "gram.h" #include "gram.h"
#include "state.h" #include "state.h"

View File

@@ -25,7 +25,6 @@
*/ */
#include "system.h" #include "system.h"
#include "xalloc.h"
#include "types.h" #include "types.h"
#include "gram.h" #include "gram.h"
#include "derives.h" #include "derives.h"

View File

@@ -22,7 +22,6 @@
#include "system.h" #include "system.h"
#include "getargs.h" #include "getargs.h"
#include "files.h" #include "files.h"
#include "xalloc.h"
#include "gram.h" #include "gram.h"
#include "complain.h" #include "complain.h"
@@ -467,14 +466,17 @@ output_files (void)
obstack_save (&table_obstack, spec_outfile); obstack_save (&table_obstack, spec_outfile);
else else
obstack_save (&table_obstack, stringappend (base_name, src_extension)); obstack_save (&table_obstack, stringappend (base_name, src_extension));
obstack_free (&table_obstack, NULL);
/* Output the header file if wanted. */ /* Output the header file if wanted. */
if (defines_flag) if (defines_flag)
defines_obstack_save (spec_defines_file); defines_obstack_save (spec_defines_file);
obstack_free (&defines_obstack, NULL);
/* If we output only the table, dump the actions in ACTFILE. */ /* If we output only the table, dump the actions in ACTFILE. */
if (no_parser_flag) if (no_parser_flag)
obstack_save (&action_obstack, stringappend (short_base_name, ".act")); obstack_save (&action_obstack, stringappend (short_base_name, ".act"));
obstack_free (&action_obstack, NULL);
/* If we produced a semantic parser ATTRS_OBSTACK must be dumped /* If we produced a semantic parser ATTRS_OBSTACK must be dumped
into its own file, ATTTRSFILE. */ into its own file, ATTTRSFILE. */
@@ -483,10 +485,12 @@ output_files (void)
char *temp_name; char *temp_name;
obstack_save (&attrs_obstack, attrsfile); obstack_save (&attrs_obstack, attrsfile);
obstack_free (&attrs_obstack, NULL);
temp_name = stringappend (short_base_name, EXT_GUARD_C); temp_name = stringappend (short_base_name, EXT_GUARD_C);
#ifndef MSDOS #ifndef MSDOS
temp_name = stringappend (temp_name, src_extension); temp_name = stringappend (temp_name, src_extension);
#endif /* MSDOS */ #endif /* MSDOS */
obstack_save (&guard_obstack, temp_name); obstack_save (&guard_obstack, temp_name);
obstack_free (&guard_obstack, NULL);
} }
} }

View File

@@ -26,7 +26,6 @@
#include "system.h" #include "system.h"
#include "types.h" #include "types.h"
#include "LR0.h" #include "LR0.h"
#include "xalloc.h"
#include "gram.h" #include "gram.h"
#include "complain.h" #include "complain.h"
#include "lalr.h" #include "lalr.h"

View File

@@ -24,7 +24,6 @@
#include "getopt.h" /* for optarg */ #include "getopt.h" /* for optarg */
#include "symtab.h" #include "symtab.h"
#include "lex.h" #include "lex.h"
#include "xalloc.h"
#include "complain.h" #include "complain.h"
#include "gram.h" #include "gram.h"
#include "quote.h" #include "quote.h"
@@ -43,13 +42,20 @@ static bucket *unlexed_symval = NULL;
void void
init_lex (void) lex_init (void)
{ {
obstack_init (&token_obstack); obstack_init (&token_obstack);
unlexed = tok_undef; unlexed = tok_undef;
} }
void
lex_free (void)
{
obstack_free (&token_obstack, NULL);
}
int int
skip_white_space (void) skip_white_space (void)
{ {

View File

@@ -58,7 +58,8 @@ extern const char *token_buffer;
extern bucket *symval; extern bucket *symval;
extern int numval; extern int numval;
void init_lex PARAMS ((void)); void lex_init PARAMS ((void));
void lex_free PARAMS ((void));
int skip_white_space PARAMS ((void)); int skip_white_space PARAMS ((void));
void unlex PARAMS ((int)); void unlex PARAMS ((int));
void read_type_name PARAMS ((FILE *fin)); void read_type_name PARAMS ((FILE *fin));

View File

@@ -102,6 +102,8 @@ main (int argc, char *argv[])
/* Free the symbol table data structure. */ /* Free the symbol table data structure. */
free_symtab (); free_symtab ();
lex_free ();
/* Close the input files. */ /* Close the input files. */
close_files (); close_files ();

View File

@@ -26,7 +26,6 @@
#include "system.h" #include "system.h"
#include "types.h" #include "types.h"
#include "gram.h" #include "gram.h"
#include "xalloc.h"
#include "nullable.h" #include "nullable.h"
char *nullable = NULL; char *nullable = NULL;

View File

@@ -94,7 +94,6 @@
#include "obstack.h" #include "obstack.h"
#include "quotearg.h" #include "quotearg.h"
#include "getargs.h" #include "getargs.h"
#include "xalloc.h"
#include "files.h" #include "files.h"
#include "gram.h" #include "gram.h"
#include "LR0.h" #include "LR0.h"

View File

@@ -20,7 +20,6 @@
#include "system.h" #include "system.h"
#include "xalloc.h"
#include "files.h" #include "files.h"
#include "gram.h" #include "gram.h"
#include "LR0.h" #include "LR0.h"

View File

@@ -19,7 +19,6 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include "system.h" #include "system.h"
#include "xalloc.h"
#include "files.h" #include "files.h"
#include "gram.h" #include "gram.h"
#include "LR0.h" #include "LR0.h"

View File

@@ -26,7 +26,6 @@
#include "quote.h" #include "quote.h"
#include "getargs.h" #include "getargs.h"
#include "files.h" #include "files.h"
#include "xalloc.h"
#include "symtab.h" #include "symtab.h"
#include "lex.h" #include "lex.h"
#include "gram.h" #include "gram.h"
@@ -1912,7 +1911,7 @@ reader (void)
grammar = NULL; grammar = NULL;
init_lex (); lex_init ();
lineno = 1; lineno = 1;
/* Initialize the symbol table. */ /* Initialize the symbol table. */

View File

@@ -29,7 +29,6 @@
#include "getargs.h" #include "getargs.h"
#include "files.h" #include "files.h"
#include "gram.h" #include "gram.h"
#include "xalloc.h"
#include "complain.h" #include "complain.h"
#include "reduce.h" #include "reduce.h"
#include "reader.h" #include "reader.h"

View File

@@ -20,7 +20,6 @@
#include "system.h" #include "system.h"
#include "xalloc.h"
#include "symtab.h" #include "symtab.h"
#include "gram.h" #include "gram.h"

View File

@@ -73,7 +73,7 @@ extern int errno;
# define PARAMS(p) () # define PARAMS(p) ()
#endif #endif
# include "xalloc.h"
/*---------------------. /*---------------------.
| Missing prototypes. | | Missing prototypes. |
@@ -159,9 +159,9 @@ typedef int bool;
| Obstacks. | | Obstacks. |
`-----------*/ `-----------*/
#define obstack_chunk_alloc xmalloc # define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free # define obstack_chunk_free free
#include "obstack.h" # include "obstack.h"
#define obstack_sgrow(Obs, Str) \ #define obstack_sgrow(Obs, Str) \
obstack_grow (Obs, Str, strlen (Str)) obstack_grow (Obs, Str, strlen (Str))
@@ -271,8 +271,6 @@ do { \
# if WITH_DMALLOC # if WITH_DMALLOC
# define DMALLOC_FUNC_CHECK # define DMALLOC_FUNC_CHECK
# include <dmalloc.h> # include <dmalloc.h>
# endif /* WITH_DMALLOC */ # endif /* WITH_DMALLOC */
#endif /* BISON_SYSTEM_H */ #endif /* BISON_SYSTEM_H */

View File

@@ -19,7 +19,6 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include "system.h" #include "system.h"
#include "xalloc.h"
#include "vcg.h" #include "vcg.h"
#include "vcg_defaults.h" #include "vcg_defaults.h"