Propagate its use.
* src/print.c: Formatting and ordering changes.
(verbose, terse): Replace with...
(print_results): this new function.
Adjust dependencies.
+2000-10-02 Akim Demaille <akim@epita.fr>
+
+ * src/print.h: New file.
+ Propagate its use.
+ * src/print.c: Formatting and ordering changes.
+ (verbose, terse): Replace with...
+ (print_results): this new function.
+ Adjust dependencies.
+
+
2000-10-02 Akim Demaille <akim@epita.fr>
* src/conflicts.c (conflict_report): New function.
derives.h \
files.h getargs.h gram.h lalr.h lex.h nullable.h \
output.h state.h \
- reader.h reduce.h symtab.h system.h types.h
+ print.h reader.h reduce.h symtab.h system.h types.h
data_DATA = bison.simple bison.hairy
extern int noparserflag; /* for -n */
extern int rawtoknumflag; /* for -r */
extern int toknumflag; /* for -k */
-extern int verboseflag; /* for -v */
+extern int verboseflag; /* for -v */
void getargs PARAMS ((int argc, char *argv[]));
#include "lalr.h"
#include "reduce.h"
#include "nullable.h"
+#include "print.h"
#if 0 /* XXX currently unused. */
/* Nonzero means failure has been detected; don't write a parser file. */
extern void generate_states PARAMS ((void));
extern void initialize_conflicts PARAMS ((void));
extern void finalize_conflicts PARAMS ((void));
-extern void verbose PARAMS ((void));
-extern void terse PARAMS ((void));
/* VMS complained about using `int'. */
declarations. */
initialize_conflicts ();
- /* Print information about results, if requested. In file print.
- */
- if (verboseflag)
- verbose ();
- else
- terse ();
+ /* Print information about results, if requested. */
+ print_results ();
/* Output the tables and the parser to ftable. In file output. */
output ();
#include "state.h"
#include "lalr.h"
#include "conflicts.h"
+#include "getargs.h"
+#include "state.h"
extern char **tags;
-extern int nstates;
extern int final_state;
-extern void terse PARAMS ((void));
-extern void verbose PARAMS ((void));
-
-#if 0 /* XXX currently unused. */
-static void print_token PARAMS ((int, int));
-#endif
-
-static void print_state PARAMS ((int));
-static void print_core PARAMS ((int));
-static void print_actions PARAMS ((int));
-static void print_grammar PARAMS ((void));
-
-void
-terse (void)
-{
- if (any_conflicts)
- print_conflicts ();
-}
-
-
-void
-verbose (void)
-{
- int i;
-
- if (any_conflicts)
- print_conflicts ();
-
- print_grammar ();
-
- for (i = 0; i < nstates; i++)
- print_state (i);
-}
-
-
-#if 0 /* XXX currently unused. */
+#if 0
static void
print_token (int extnum, int token)
{
}
#endif
-
-static void
-print_state (int state)
-{
- fprintf (foutput, _("\n\nstate %d\n\n"), state);
- print_core (state);
- print_actions (state);
-}
-
+\f
+/*================================\
+| Report information on a state. |
+\================================*/
static void
print_core (int state)
putc ('\n', foutput);
}
-
static void
print_actions (int state)
{
}
}
+static void
+print_state (int state)
+{
+ fprintf (foutput, _("\n\nstate %d\n\n"), state);
+ print_core (state);
+ print_actions (state);
+}
+\f
+/*-----------------------------------------.
+| Print information on the whole grammar. |
+`-----------------------------------------*/
+
#define END_TEST(end) \
do { \
if (column + strlen(buffer) > (end)) { \
} \
} while (0)
+
static void
print_grammar (void)
{
fprintf (foutput, "%s\n", buffer);
}
}
+\f
+void
+print_results (void)
+{
+ int i;
+
+ if (any_conflicts)
+ print_conflicts ();
+
+ if (verboseflag)
+ print_grammar ();
+
+ if (verboseflag)
+ for (i = 0; i < nstates; i++)
+ print_state (i);
+}
--- /dev/null
+/* Print information on generated parser, for bison,
+ Copyright (C) 2000 Free Software Foundation, Inc.
+
+ This file is part of Bison, the GNU Compiler Compiler.
+
+ Bison is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ Bison is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Bison; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef PRINT_H_
+# define PRINT_H_
+
+void print_results PARAMS ((void));
+
+#endif /* !PRINT_H_ */