From: Akim Demaille Date: Mon, 12 Nov 2001 09:32:35 +0000 (+0000) Subject: * src/conflicts.c (print_reductions): Accept OUT as argument. X-Git-Tag: before-m4-back-end~319 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/c73a41af8e332ef9736dc29be99f0b6c251e6c01?ds=sidebyside * src/conflicts.c (print_reductions): Accept OUT as argument. Output to it, not to output_obstack. * src/print.c (print_actions): Adjust. --- diff --git a/ChangeLog b/ChangeLog index 1fde180b..b6cd8f83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-11-12 Akim Demaille + + * src/conflicts.c (print_reductions): Accept OUT as argument. + Output to it, not to output_obstack. + * src/print.c (print_actions): Adjust. + + 2001-11-12 Akim Demaille * src/conflicts.c (count_sr_conflicts, count_rr_conflicts): Return diff --git a/src/conflicts.c b/src/conflicts.c index 0af00c70..1e5f29cf 100644 --- a/src/conflicts.c +++ b/src/conflicts.c @@ -502,7 +502,7 @@ conflicts_print (void) void -print_reductions (int state) +print_reductions (FILE *out, int state) { int i; int j; @@ -580,9 +580,8 @@ print_reductions (int state) for (i = 0; i < ntokens; i++) { if (mask & *fp3) - obstack_fgrow3 (&output_obstack, - _(" %-4s\t[reduce using rule %d (%s)]\n"), - tags[i], default_rule, tags[rlhs[default_rule]]); + fprintf (out, _(" %-4s\t[reduce using rule %d (%s)]\n"), + tags[i], default_rule, tags[rlhs[default_rule]]); mask <<= 1; if (mask == 0) @@ -592,9 +591,8 @@ print_reductions (int state) } } - obstack_fgrow2 (&output_obstack, - _(" $default\treduce using rule %d (%s)\n\n"), - default_rule, tags[rlhs[default_rule]]); + fprintf (out, _(" $default\treduce using rule %d (%s)\n\n"), + default_rule, tags[rlhs[default_rule]]); } else if (n - m >= 1) { @@ -681,7 +679,7 @@ print_reductions (int state) if (j != default_LA) { rule = LAruleno[j]; - obstack_fgrow3 (&output_obstack, + fprintf (out, _(" %-4s\treduce using rule %d (%s)\n"), tags[i], rule, tags[rlhs[rule]]); } @@ -695,13 +693,13 @@ print_reductions (int state) if (defaulted) { rule = LAruleno[default_LA]; - obstack_fgrow3 (&output_obstack, + fprintf (out, _(" %-4s\treduce using rule %d (%s)\n"), tags[i], rule, tags[rlhs[rule]]); defaulted = 0; } rule = LAruleno[j]; - obstack_fgrow3 (&output_obstack, + fprintf (out, _(" %-4s\t[reduce using rule %d (%s)]\n"), tags[i], rule, tags[rlhs[rule]]); } @@ -722,11 +720,8 @@ print_reductions (int state) } if (default_LA >= 0) - obstack_fgrow2 (&output_obstack, - _(" $default\treduce using rule %d (%s)\n"), - default_rule, tags[rlhs[default_rule]]); - - obstack_1grow (&output_obstack, '\n'); + fprintf (out, _(" $default\treduce using rule %d (%s)\n"), + default_rule, tags[rlhs[default_rule]]); } } diff --git a/src/conflicts.h b/src/conflicts.h index ad5d4893..b74cb22c 100644 --- a/src/conflicts.h +++ b/src/conflicts.h @@ -25,7 +25,7 @@ void solve_conflicts PARAMS ((void)); void conflicts_print PARAMS ((void)); void conflicts_output PARAMS ((FILE *out)); -void print_reductions PARAMS ((int)); +void print_reductions PARAMS ((FILE*out, int state)); void free_conflicts PARAMS ((void)); /* Were there conflicts? */ diff --git a/src/print.c b/src/print.c index bd1e387c..d9f38ca9 100644 --- a/src/print.c +++ b/src/print.c @@ -173,7 +173,7 @@ print_actions (FILE *out, int state) } else if (redp) { - print_reductions (state); + print_reductions (out, state); } if (i < k) diff --git a/tests/regression.at b/tests/regression.at index 047d7519..2a60d27c 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -123,6 +123,9 @@ state 4 OP shift, and go to state 3 + OP [reduce using rule 1 (exp)] + $default reduce using rule 1 (exp) + state 5