+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.
#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. |
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));
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
/* 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 ();
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. */
/* 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 ();