* 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.
This commit is contained in:
Akim Demaille
2001-12-17 17:32:39 +00:00
parent be750e4c49
commit 331dbc1bb7
5 changed files with 19 additions and 37 deletions

View File

@@ -1,3 +1,11 @@
2001-12-17 Akim Demaille <akim@epita.fr>
* 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 <akim@epita.fr>
* src/conflicts.c (print_reductions): Formatting changes.

View File

@@ -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. |

View File

@@ -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));

View File

@@ -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 ();

View File

@@ -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 ();