]> git.saurik.com Git - bison.git/commitdiff
* src/conflicts.c (print_reductions): Accept OUT as argument.
authorAkim Demaille <akim@epita.fr>
Mon, 12 Nov 2001 09:32:35 +0000 (09:32 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 12 Nov 2001 09:32:35 +0000 (09:32 +0000)
Output to it, not to output_obstack.
* src/print.c (print_actions): Adjust.

ChangeLog
src/conflicts.c
src/conflicts.h
src/print.c
tests/regression.at

index 1fde180b5efbd02a92cc83881834624eab4b4c5d..b6cd8f83b762dd5a5a740a06b5daa32a02b0fba7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-11-12  Akim Demaille  <akim@epita.fr>
+
+       * 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  <akim@epita.fr>
 
        * src/conflicts.c (count_sr_conflicts, count_rr_conflicts): Return
index 0af00c70ef50aa11b9f0381045e9d05f26684772..1e5f29cf44bf713a50f8df1b67571a3462aa1914 100644 (file)
@@ -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]]);
     }
 }
 
index ad5d4893daa4d109dca42c985b8592db76abda3b..b74cb22c3f3f1477eb12bb29b711ba109625196d 100644 (file)
@@ -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? */
index bd1e387c2b9bf16b0fc161153119ed0244869553..d9f38ca9f355a0ad2d27fb58815adeb01600017e 100644 (file)
@@ -173,7 +173,7 @@ print_actions (FILE *out, int state)
     }
   else if (redp)
     {
-      print_reductions (state);
+      print_reductions (out, state);
     }
 
   if (i < k)
index 047d7519a0b3e21a10ca39af47707932b979d14b..2a60d27ced97f5efe06a308c2b83ce810305d575 100644 (file)
@@ -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