]> git.saurik.com Git - bison.git/blobdiff - src/output.c
Various anti-`extern in *.c' changes.
[bison.git] / src / output.c
index a89e77ede198548941e3ad9d812441abbad30577..0da18d0098ceb9176c10b5f41087e0ea269ed004 100644 (file)
 #include "alloc.h"
 #include "files.h"
 #include "gram.h"
-#include "state.h"
+#include "LR0.h"
 #include "complain.h"
 #include "output.h"
+#include "lalr.h"
+#include "reader.h"
+#include "conflicts.h"
 
 extern void berror PARAMS((const char *));
 
-extern char **tags;
-extern short *user_toknums;
-extern int tokensetsize;
-extern int final_state;
-extern core **state_table;
-extern shifts **shift_table;
-extern errs **err_table;
-extern reductions **reduction_table;
-extern short *accessing_symbol;
-extern unsigned *LA;
-extern short *LAruleno;
-extern short *lookaheads;
-extern char *consistent;
-extern short *goto_map;
-extern short *from_state;
-extern short *to_state;
-
-extern void reader_output_yylsp PARAMS ((FILE *));
+
 
 static int nvectors;
 static int nentries;
@@ -734,45 +720,27 @@ save_row (int state)
 | Figure out the actions for the specified state, indexed by        |
 | lookahead token type.                                             |
 |                                                                   |
-| The yydefact table is output now.  The detailed info is saved for |
-| putting into yytable later.                                       |
+| The YYDEFACT table is output now.  The detailed info is saved for |
+| putting into YYTABLE later.                                       |
 `------------------------------------------------------------------*/
 
 static void
 token_actions (void)
 {
   int i;
-  int j;
-  int k;
+  short *yydefact = NEW2 (nstates, short);
 
   actrow = NEW2 (ntokens, short);
-
-  k = action_row (0);
-  fprintf (ftable, "\nstatic const short yydefact[] = {%6d", k);
-  save_row (0);
-
-  j = 10;
-  for (i = 1; i < nstates; i++)
+  for (i = 0; i < nstates; ++i)
     {
-      putc (',', ftable);
-
-      if (j >= 10)
-       {
-         putc ('\n', ftable);
-         j = 1;
-       }
-      else
-       {
-         j++;
-       }
-
-      k = action_row (i);
-      fprintf (ftable, "%6d", k);
+      yydefact[i] = action_row (i);
       save_row (i);
     }
-
-  fprintf (ftable, "\n};\n");
   FREE (actrow);
+
+  output_short_table (ftable, "yydefact", yydefact,
+                     yydefact[0], 1, nstates);
+  FREE (yydefact);
 }
 
 
@@ -1025,8 +993,7 @@ pack_vector (int vector)
   i = order[vector];
   t = tally[i];
 
-  if (t == 0)
-    berror ("pack_vector");
+  assert (t);
 
   from = froms[i];
   to = tos[i];