From 5263bea9f7d576c20938619af2197eb5b47a90c3 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 12 Aug 2008 21:48:44 +0200 Subject: [PATCH] --trace=muscles * src/getargs.h, src/getargs.c (trace_muscle): New. (trace_types, trace_args): Support it. * src/output.c (output_skeleton): Use it. --- ChangeLog | 7 +++++++ src/getargs.c | 2 ++ src/getargs.h | 1 + src/output.c | 18 +++++++++++------- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9db6f4b..404ef73d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-11-10 Akim Demaille + + --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 muscles_output. diff --git a/src/getargs.c b/src/getargs.c index a8d1c548..53934f33 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -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, diff --git a/src/getargs.h b/src/getargs.h index 8d27e717..11390674 100644 --- a/src/getargs.h +++ b/src/getargs.h @@ -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. */ diff --git a/src/output.c b/src/output.c index 6e6da2e6..cac4ebfe 100644 --- a/src/output.c +++ b/src/output.c @@ -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); -- 2.47.2