From: Akim Demaille Date: Mon, 17 Dec 2001 17:32:39 +0000 (+0000) Subject: * src/files.h, src/files.c (open_files, close_files): Remove. X-Git-Tag: before-m4-back-end~113 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/331dbc1bb7fac0b108adc5591bd9308a39629287?ds=sidebyside;hp=be750e4c49acede25b7e0cd3a2f5b58e759583fd * src/files.h, src/files.c (open_files, close_files): Remove. * src/main.c (main): Don't open/close files, nor invoke lex_free, let... * src/reader.c (reader): Do it. --- diff --git a/ChangeLog b/ChangeLog index 47dc83f3..98b415f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-12-17 Akim Demaille + + * src/files.h, src/files.c (open_files, close_files): Remove. + * src/main.c (main): Don't open/close files, nor invoke lex_free, + let... + * src/reader.c (reader): Do it. + + 2001-12-17 Akim Demaille * src/conflicts.c (print_reductions): Formatting changes. diff --git a/src/files.c b/src/files.c index b6fed391..b3064b5a 100644 --- a/src/files.c +++ b/src/files.c @@ -437,34 +437,6 @@ compute_output_file_names (void) #endif /* MSDOS */ } -/*-----------------------------------------------------------------. -| Open the input file. Look for the skeletons. Find the names of | -| the output files. Prepare the obstacks. | -`-----------------------------------------------------------------*/ - -void -open_files (void) -{ - finput = xfopen (infile, "r"); - - /* Initialize the obstacks. */ - obstack_init (&action_obstack); - obstack_init (&attrs_obstack); - obstack_init (&guard_obstack); - obstack_init (&output_obstack); -} - - - -/*-----------------------. -| Close the open file.. | -`-----------------------*/ - -void -close_files (void) -{ - xfclose (finput); -} /*---------------------------. | Produce the output files. | diff --git a/src/files.h b/src/files.h index c0270887..573ea3ce 100644 --- a/src/files.h +++ b/src/files.h @@ -61,9 +61,6 @@ extern struct obstack output_obstack; extern char *infile; extern char *attrsfile; -void open_files PARAMS((void)); -void close_files PARAMS((void)); - void compute_output_file_names PARAMS((void)); void output_files PARAMS((void)); diff --git a/src/main.c b/src/main.c index f53228e6..6deec48a 100644 --- a/src/main.c +++ b/src/main.c @@ -53,7 +53,6 @@ main (int argc, char *argv[]) getargs (argc, argv); muscle_init (); - open_files (); /* Read the input. Copy some parts of it to FGUARD, FACTION, FTABLE and FATTRS. In file reader.c. The other parts are recorded in @@ -103,14 +102,9 @@ main (int argc, char *argv[]) /* Output the tables and the parser to ftable. In file output. */ output (); - /* Close the input files. */ - close_files (); - /* Free the symbol table data structure. */ free_symtab (); - lex_free (); - reduce_free (); free_conflicts (); free_nullable (); diff --git a/src/reader.c b/src/reader.c index f1577b48..4fa1aaea 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1865,6 +1865,14 @@ reader (void) undeftoken->class = token_sym; undeftoken->user_token_number = 2; + /* Initialize the obstacks. */ + obstack_init (&action_obstack); + obstack_init (&attrs_obstack); + obstack_init (&guard_obstack); + obstack_init (&output_obstack); + + finput = xfopen (infile, "r"); + /* Read the declaration section. Copy %{ ... %} groups to TABLE_OBSTACK and FDEFINES file. Also notice any %token, %left, etc. found there. */ @@ -1875,6 +1883,9 @@ reader (void) /* Some C code is given at the end of the grammar file. */ read_additionnal_code (); + lex_free (); + xfclose (finput); + /* Assign the symbols their symbol numbers. Write #defines for the token symbols into FDEFINES if requested. */ packsymbols ();