From f2acea59d91fe5384859772a0a74f09e7f53a296 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 2 Oct 2000 07:55:11 +0000 Subject: [PATCH] * src/output.c (token_actions): Introduce a temporary array, YYDEFACT, that makes it possible for this function to use output_short_table. --- ChangeLog | 7 +++++++ src/output.c | 36 +++++++++--------------------------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf03f981..3d7b9c87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-10-02 Akim Demaille + + * src/output.c (token_actions): Introduce a temporary array, + YYDEFACT, that makes it possible for this function to use + output_short_table. + + 2000-10-02 Akim Demaille `user_toknums' is output as a `short[]' in `output.c', while it is diff --git a/src/output.c b/src/output.c index a89e77ed..56538f0c 100644 --- a/src/output.c +++ b/src/output.c @@ -734,45 +734,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); } -- 2.47.2