]> git.saurik.com Git - bison.git/commitdiff
* src/getargs.c (statistics_flag): Replace with...
authorAkim Demaille <akim@epita.fr>
Mon, 19 Nov 2001 10:37:58 +0000 (10:37 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 19 Nov 2001 10:37:58 +0000 (10:37 +0000)
(trace_flag): New.
(longopts): Accept --trace instead of --statistics.
* src/getargs.h, src/options.c: Adjust.
* src/LR0.c, src/closure.c, src/derives.c, src/nullable.c,
* src/reduce.c: Use trace_flags instead of the CPP conditional TRACE.

ChangeLog
src/LR0.c
src/closure.c
src/derives.c
src/getargs.c
src/getargs.h
src/nullable.c
src/options.c
src/reduce.c

index be9a7bfbda89d74f81890fe421589a6b8bfadd60..cd1080aace21323c6fb5f7086ce1aa21e6a015a0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2001-11-19  Akim Demaille  <akim@epita.fr>
+
+       * src/getargs.c (statistics_flag): Replace with...
+       (trace_flag): New.
+       (longopts): Accept --trace instead of --statistics.
+       * src/getargs.h, src/options.c: Adjust.
+       * src/LR0.c, src/closure.c, src/derives.c, src/nullable.c,
+       * src/reduce.c: Use trace_flags instead of the CPP conditional TRACE.
+
 2001-11-19  Akim Demaille  <akim@epita.fr>
 
        * src/LR0.c (new_itemsets, get_state): Use more arrays and less
@@ -23,7 +32,7 @@
        * src/output.c (free_itemsets, free_reductions, free_shifts):
        Remove, replaced by LIST_FREE.
 
-       
+
 2001-11-19  Akim Demaille  <akim@epita.fr>
 
        * src/state.h (CORE_ALLOC, SHIFTS_ALLOC, ERRS_ALLOC)
@@ -31,7 +40,7 @@
        * src/LR0.c, src/conflicts.c: Use them to de-obfuscate memory
        allocation.
 
-       
+
 2001-11-19  Akim Demaille  <akim@epita.fr>
 
        * src/LR0.c (new_state): Complete trace code.
@@ -51,7 +60,7 @@
        (print_actions): Don't output the actions as part of the nodes,
        since that's the job of the edges.
        (print_state): Don't output by hand: fill the node description,
-       and ask for its output. 
+       and ask for its output.
 
 2001-11-19  Akim Demaille  <akim@epita.fr>
 
@@ -65,7 +74,7 @@
        * src/reader.c (record_rule_lines, rline, rline_allocated): Remove.
        * src/output.c: Adjust.
 
-       
+
 2001-11-19  Akim Demaille  <akim@epita.fr>
 
        * src/gram.h (rprec, rprecsym, rassoc): Remove, now part of...
@@ -81,7 +90,7 @@
        * src/lalr.c, src/nullable.c, src/output.c, src/print.c,
        * src/reader.c, src/reduce.c: Adjust.
 
-       
+
 2001-11-19  Akim Demaille  <akim@epita.fr>
 
        * src/reader.c (symbols_output): New, extracted from...
        * src/lalr.c (initialize_LA): Only initialize LA.  Let...
        (set_state_table): handle the `lookaheads' members.
 
-       
+
 2001-11-19  Akim Demaille  <akim@epita.fr>
 
        * src/lalr.h (lookaheads): Removed array, which contents is now
        * src/output.c, src/lalr.c, src/print_graph.c, src/conflicts.c:
        Adjust.
 
-       
+
 2001-11-19  Akim Demaille  <akim@epita.fr>
 
        * src/lalr.h (state_t): New.
index d1d703ffef7fe82dcd722add9bb70349cb6f26fe..3760a988ef2a29cb2ca21fe3fab7e909f4769506 100644 (file)
--- a/src/LR0.c
+++ b/src/LR0.c
@@ -23,6 +23,7 @@
    The entry point is generate_states.  */
 
 #include "system.h"
+#include "getargs.h"
 #include "gram.h"
 #include "state.h"
 #include "complain.h"
@@ -147,10 +148,8 @@ new_itemsets (void)
   int i;
   int shiftcount;
 
-#if TRACE
-  fprintf (stderr, "Entering new_itemsets, state = %d\n",
-          this_state->number);
-#endif
+  if (trace_flag)
+    fprintf (stderr, "Entering new_itemsets, state = %d\n", nstates);
 
   for (i = 0; i < nsyms; i++)
     kernel_end[i] = NULL;
@@ -192,10 +191,9 @@ new_state (int symbol)
   int n;
   core *p;
 
-#if TRACE
-  fprintf (stderr, "Entering new_state, state = %d, symbol = %d\n",
-          nstates, symbol);
-#endif
+  if (trace_flag)
+    fprintf (stderr, "Entering new_state, state = %d, symbol = %d\n",
+            nstates, symbol);
 
   if (nstates >= MAXSHORT)
     fatal (_("too many states (max %d)"), MAXSHORT);
@@ -233,10 +231,9 @@ get_state (int symbol)
 
   int n = kernel_end[symbol] - kernel_base[symbol];
 
-#if TRACE
-  fprintf (stderr, "Entering get_state, state = %d, symbol = %d\n",
-          nstates, symbol);
-#endif
+  if (trace_flag)
+    fprintf (stderr, "Entering get_state, state = %d, symbol = %d\n",
+            nstates, symbol);
 
   /* Add up the target state's active item numbers to get a hash key.
      */
@@ -296,9 +293,9 @@ append_states (void)
   int j;
   int symbol;
 
-#if TRACE
-  fprintf (stderr, "Entering append_states\n");
-#endif
+  if (trace_flag)
+    fprintf (stderr, "Entering append_states\n");
+
 
   /* first sort shift_symbol into increasing order */
 
index 94fa636e0a8b17115c61f3d7e539777a77c09ba5..b06d808fa27dd184d57f22a121e4be053eeab0d6 100644 (file)
@@ -19,6 +19,7 @@
    02111-1307, USA.  */
 
 #include "system.h"
+#include "getargs.h"
 #include "gram.h"
 #include "reader.h"
 #include "closure.h"
@@ -39,7 +40,6 @@ static int rulesetsize;
 /* number of words required to hold a bit for each variable */
 static int varsetsize;
 \f
-#if TRACE
 
 /*-----------------.
 | Debugging code.  |
@@ -97,7 +97,6 @@ print_fderives (void)
          fprintf (stderr, "   %d\n", j);
     }
 }
-#endif
 \f
 /*-------------------------------------------------------------------.
 | Set FIRSTS to be an NVARS by NVARS bit matrix indicating which     |
@@ -142,9 +141,8 @@ set_firsts (void)
 
   RTC (firsts, nvars);
 
-#ifdef TRACE
-  print_firsts ();
-#endif
+  if (trace_flag)
+    print_firsts ();
 }
 
 /*-------------------------------------------------------------------.
@@ -203,9 +201,8 @@ set_fderives (void)
       rrow += rulesetsize;
     }
 
-#ifdef TRACE
-  print_fderives ();
-#endif
+  if (trace_flag)
+    print_fderives ();
 
   XFREE (firsts);
 }
@@ -300,9 +297,8 @@ closure (short *core, int n)
   while (csp < csend)
     *itemsetend++ = *csp++;
 
-#if TRACE
-  print_closure (n);
-#endif
+  if (trace_flag)
+    print_closure (n);
 }
 
 
index ec7173d95b9433756b5a79c3497a73231d8be03c..7b862d8223190da235484d96ecee69c165dd27d9 100644 (file)
@@ -25,6 +25,7 @@
    */
 
 #include "system.h"
+#include "getargs.h"
 #include "types.h"
 #include "reader.h"
 #include "gram.h"
@@ -32,7 +33,6 @@
 
 short **derives;
 
-#if TRACE
 
 static void
 print_derives (void)
@@ -53,7 +53,6 @@ print_derives (void)
   putc ('\n', stderr);
 }
 
-#endif
 
 void
 set_derives (void)
@@ -96,9 +95,8 @@ set_derives (void)
       *q++ = -1;
     }
 
-#if TRACE
-  print_derives ();
-#endif
+  if (trace_flag)
+    print_derives ();
 
   XFREE (dset + ntokens);
   XFREE (delts);
index e3ffdb68feeb3221072424c6d5e560cc21b688fc..76e3823f21ae0098d2020bfe61bdc44e45e9ac3c 100644 (file)
@@ -34,9 +34,9 @@ int no_lines_flag = 0;
 int no_parser_flag = 0;
 int token_table_flag = 0;
 int verbose_flag = 0;
-int statistics_flag = 0;
 int yacc_flag = 0;     /* for -y */
 int graph_flag = 0;
+int trace_flag = 0;
 
 const char *skeleton = NULL;
 
index f3c3760192db0617dedb475966546dffcf801e19..4ff100bb6bd5b7883e68a9d6d26076e54fa4d206 100644 (file)
@@ -31,11 +31,11 @@ extern int defines_flag;            /* for -d */
 extern int locations_flag;
 extern int no_lines_flag;      /* for -l */
 extern int no_parser_flag;     /* for -n */
-extern int statistics_flag;
 extern int token_table_flag;           /* for -k */
 extern int verbose_flag;       /* for -v */
 extern int graph_flag;         /* for -g */
 extern int yacc_flag;                  /* for -y */
+extern int trace_flag;
 
 void getargs PARAMS ((int argc, char *argv[]));
 
index 4568114f9f84b3f64f92c8c50f8895f5746327c3..eedc5a33ac8af5d451b8dda0a675d9f2ba311d9d 100644 (file)
@@ -24,6 +24,7 @@
    do so.  */
 
 #include "system.h"
+#include "getargs.h"
 #include "types.h"
 #include "gram.h"
 #include "nullable.h"
@@ -47,9 +48,8 @@ set_nullable (void)
   char any_tokens;
   short *r1;
 
-#ifdef TRACE
-  fprintf (stderr, "Entering set_nullable\n");
-#endif
+  if (trace_flag)
+    fprintf (stderr, "Entering set_nullable");
 
   nullable = XCALLOC (char, nvars) - ntokens;
 
index 9ab815316a3b82c0f131edc3fcff32ca67c7897a..f1240766ce89d56cdef0445569ddae8184ef5e41 100644 (file)
@@ -60,7 +60,7 @@ const struct option_table_struct option_table[] =
   /* Hidden. */
   /* Fixme: What is this `1' doing here!!!  Sounds dead wrong.  See
      locations too below.  */
-  {opt_cmd_line, "statistics", no_argument, &statistics_flag,        0,     1},
+  {opt_cmd_line, "trace", no_argument, &trace_flag,          0,     1},
 
   /*
    * Percent declarations.
index b179f608fe443a648f099ff7fa68f67d665708c2..a95b4bbd57d7aebf2d3bda2140ad39df6192b4de 100644 (file)
@@ -438,7 +438,6 @@ reduce_output (FILE *out)
     fprintf (out, "\n\n");
 }
 \f
-#if TRACE
 static void
 dump_grammar (FILE *out)
 {
@@ -478,7 +477,6 @@ dump_grammar (FILE *out)
     }
   fprintf (out, "\n\n");
 }
-#endif
 
 
 
@@ -539,20 +537,15 @@ reduce_grammar (void)
           tags[start_symbol]);
 
   reduce_grammar_tables ();
-#if TRACE
-  dump_grammar (stderr);
-#endif
-
-  if (statistics_flag)
-    fprintf (stderr, _("reduced %s defines %d terminal%s, %d nonterminal%s\
-, and %d production%s.\n"),
-            infile,
-            ntokens,
-            (ntokens == 1 ? "" : "s"),
-            nvars,
-            (nvars == 1 ? "" : "s"),
-            nrules,
-            (nrules == 1 ? "" : "s"));
+
+  if (trace_flag)
+    {
+      dump_grammar (stderr);
+
+      fprintf (stderr, "reduced %s defines %d terminals, %d nonterminals\
+, and %d productions.\n",
+              infile, ntokens, nvars, nrules);
+    }
 }