]> git.saurik.com Git - bison.git/commitdiff
--trace=muscles
authorAkim Demaille <demaille@gostai.com>
Tue, 12 Aug 2008 19:48:44 +0000 (21:48 +0200)
committerAkim Demaille <demaille@gostai.com>
Mon, 10 Nov 2008 10:18:09 +0000 (11:18 +0100)
* src/getargs.h, src/getargs.c (trace_muscle): New.
(trace_types, trace_args): Support it.
* src/output.c (output_skeleton): Use it.

ChangeLog
src/getargs.c
src/getargs.h
src/output.c

index f9db6f4bf63b8480bb59d727276fd24c7a42554a..404ef73df414f33917b6ed6c0eefd726223e6062 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-11-10  Akim Demaille  <demaille@gostai.com>
+
+       --trace=muscles
+       * src/getargs.h, src/getargs.c (trace_muscle): New.
+       (trace_types, trace_args): Support it.
+       * src/output.c (output_skeleton): Use it.
+
 2008-11-10  Akim Demaille  <demaille@gostai.com>
 
        muscles_output.
index a8d1c5480ddb519257ff353e05b673daea27fc44..53934f336084a3a2b6de972d0a7ffdb53c01cfe4 100644 (file)
@@ -176,6 +176,7 @@ static const char * const trace_args[] =
   "grammar    - reading, reducing the grammar",
   "resource   - memory consumption (where available)",
   "sets       - grammar sets: firsts, nullable etc.",
+  "muscles    - m4 definitions passed to the skeleton",
   "tools      - m4 invocation",
   "m4         - m4 traces",
   "skeleton   - skeleton postprocessing",
@@ -194,6 +195,7 @@ static const int trace_types[] =
   trace_grammar,
   trace_resource,
   trace_sets,
+  trace_muscles,
   trace_tools,
   trace_m4,
   trace_skeleton,
index 8d27e7175d12317a5fc974955ea1a75b09e1a8fe..1139067452f7bcdf208997e011266eed151a7ea8 100644 (file)
@@ -106,6 +106,7 @@ enum trace
     trace_time      = 1 << 8,  /**< Time consumption. */
     trace_skeleton  = 1 << 9,  /**< Skeleton postprocessing. */
     trace_m4        = 1 << 10, /**< M4 traces. */
+    trace_muscles   = 1 << 11, /**< M4 definitions of the muscles. */
     trace_all       = ~0       /**< All of the above.  */
   };
 /** What debug items bison displays during its run.  */
index 6e6da2e6b3c540866f68059e1070563ed9731cdf..cac4ebfec9f800782e1222d607bcc05a01ca88f5 100644 (file)
@@ -514,7 +514,6 @@ static void
 output_skeleton (void)
 {
   FILE *in;
-  FILE *out;
   int filter_fd[2];
   char const *argv[9];
   pid_t pid;
@@ -602,12 +601,17 @@ output_skeleton (void)
   free (full_m4bison);
   free (full_skeleton);
 
-  out = fdopen (filter_fd[0], "w");
-  if (! out)
-    error (EXIT_FAILURE, get_errno (),
-          "fdopen");
-  muscles_output (out);
-  xfclose (out);
+
+  if (trace_flag & trace_muscles)
+    muscles_output (stderr);
+  {
+    FILE *out = fdopen (filter_fd[0], "w");
+    if (! out)
+      error (EXIT_FAILURE, get_errno (),
+             "fdopen");
+    muscles_output (out);
+    xfclose (out);
+  }
 
   /* Read and process m4's output.  */
   timevar_push (TV_M4);