summaryrefslogtreecommitdiff
path: root/modules/gnu.c
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2008-05-08 20:39:16 -0600
committerEric Blake <ebb9@byu.net>2008-05-08 20:39:16 -0600
commitb9738adbaaf9c8f02c97c6179b9e595a0d28121c (patch)
treef2b04622145b0050611f1e4c5431329f33ae4475 /modules/gnu.c
parentd74cecd6377345903ba25c9d9b82729324fbbcf8 (diff)
downloadm4-b9738adbaaf9c8f02c97c6179b9e595a0d28121c.tar.gz
Stage 23: allow tracing of indirect macro calls.
* m4/m4module.h (m4_input_block): Remove. (m4_call_info): New opaque type. (m4_trace_prepare, m4_arg_info): New prototypes. (m4_macro_call, m4_push_string_finish, m4_input_print): Change prototypes. * m4/m4private.h (struct m4_macro_args): Add info field. (struct m4_call_info): New structure. (m4_arg_info): New accessor. * m4/input.c (m4_input_block): Make typedef local. (m4_push_string_init): Initialize length. (m4_push_string_finish, m4_input_print): Change signature, so that printing can be done before finalization. (struct input_funcs): Add parameter to print_func. (file_print, string_print, composite_print): Adjust accordingly. * m4/macro.c (trace_header, trace_flush, trace_pre, trace_post): Change signatures for stacked trace messages, and for using call context. (trace_prepre): Export and rename... (m4_trace_prepare): ...to this, for use by indir. Alter signature to use call context. (collect_arguments): Alter signature, to manage new field. (expand_macro): Change call context management. Move tracing... (m4_macro_call): ...here. Remove redundant parameter. (m4_arg_argc): New function. (m4_make_argv_ref): Replace unused skip parameter with new trace parameter; manage new field. * modules/gnu.c (builtin, indir): Adjust callers. * src/main.c (usage): Update debugmode flag summary. * tests/null.m4: Enhance test. * tests/null.err: Update expected output. * tests/macros.at (Tracing Hanoi Towers): Likewise. * doc/m4.texinfo (Trace): Mention more about trace formatting. (Debugmode): Enhance description of 'c' and 'x'. Enhance test to cover line numbering details in traces. (Debuglen): Enhance test to cover indir tracing. * NEWS: Mention these changes. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'modules/gnu.c')
-rw-r--r--modules/gnu.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/gnu.c b/modules/gnu.c
index f0d3a44a..c28a1004 100644
--- a/modules/gnu.c
+++ b/modules/gnu.c
@@ -447,7 +447,7 @@ M4BUILTIN_HANDLER (builtin)
m4_macro_args *new_argv;
bool flatten = (bp->flags & M4_BUILTIN_FLATTEN_ARGS) != 0;
new_argv = m4_make_argv_ref (context, argv, name, M4ARGLEN (1),
- true, flatten);
+ flatten, false);
bp->func (context, obs, argc - 1, new_argv);
}
free (value);
@@ -680,10 +680,12 @@ M4BUILTIN_HANDLER (indir)
else
{
m4_macro_args *new_argv;
+ m4_symbol_value *value = m4_get_symbol_value (symbol);
new_argv = m4_make_argv_ref (context, argv, name, M4ARGLEN (1),
- true, m4_symbol_flatten_args (symbol));
- m4_macro_call (context, m4_get_symbol_value (symbol), obs,
- argc - 1, new_argv);
+ m4_symbol_flatten_args (symbol),
+ m4_get_symbol_traced (symbol));
+ m4_trace_prepare (context, m4_arg_info (new_argv), value);
+ m4_macro_call (context, value, obs, new_argv);
}
}
}