Implement --trace=m4.

* src/getargs.c (trace_types, trace_args): Accept trace_m4.
* src/output.c (output_skeleton): When set, pass -dV to m4.
Factor the handling of flags in m4.
* src/output.c (prepare): Rename the muscle names debug, defines,
error_verbose to debug_flag, defines_flag, error_verbose_flag.
* data/c.m4: Adjust.
(_b4_define_flag_if, b4_define_flag_if, b4_defines_if): New.
Use b4_define_flag_if to define other b4_FLAG_if macros.
(b4_location_if): As a consequence, rename as...
(b4_locations_if): this, for consistency.
Adjust all the skeletons.
This commit is contained in:
Akim Demaille
2006-05-14 20:40:35 +00:00
parent ba9ecd1910
commit 327afc7c84
9 changed files with 153 additions and 126 deletions

View File

@@ -84,7 +84,8 @@ static const char * const trace_args[] =
"grammar - reading, reducing of the grammar",
"resource - memory consumption (where available)",
"sets - grammar sets: firsts, nullable etc.",
"tools - m4 invocation and preserve the temporary file",
"tools - m4 invocation",
"m4 - m4 traces",
"skeleton - skeleton postprocessing",
"time - time consumption",
"all - all of the above",
@@ -102,6 +103,7 @@ static const int trace_types[] =
trace_resource,
trace_sets,
trace_tools,
trace_m4,
trace_skeleton,
trace_time,
trace_all

View File

@@ -73,6 +73,7 @@ enum trace
trace_grammar = 1 << 7,
trace_time = 1 << 8,
trace_skeleton = 1 << 9,
trace_m4 = 1 << 10,
trace_all = ~0
};
extern int trace_flag;

View File

@@ -501,7 +501,7 @@ output_skeleton (void)
FILE *in;
FILE *out;
int filter_fd[2];
char const *argv[5];
char const *argv[6];
pid_t pid;
/* Compute the names of the package data dir and skeleton file.
@@ -538,7 +538,8 @@ output_skeleton (void)
argv[1] = full_m4sugar;
argv[2] = "-";
argv[3] = full_skeleton;
argv[4] = NULL;
argv[4] = trace_flag & trace_m4 ? "-dV" : NULL;
argv[5] = NULL;
init_subpipe ();
pid = create_subpipe (argv, filter_fd);
@@ -582,11 +583,11 @@ static void
prepare (void)
{
/* Flags. */
MUSCLE_INSERT_BOOL ("debug", debug_flag);
MUSCLE_INSERT_BOOL ("debug_flag", debug_flag);
MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
MUSCLE_INSERT_BOOL ("error_verbose", error_verbose);
MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
MUSCLE_INSERT_BOOL ("pure", pure_parser);
MUSCLE_INSERT_BOOL ("pure_flag", pure_parser);
MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag);
/* File names. */