diff --git a/doc/manual/helper.txt b/doc/manual/helper.txt index d5710ddde..b59fd664f 100644 --- a/doc/manual/helper.txt +++ b/doc/manual/helper.txt @@ -79,6 +79,8 @@ command handlers and helpers: - @c CMD_NAME - invoked command name - @c CMD_ARGC - the number of command arguments - @c CMD_ARGV - array of command argument strings +- @c CMD_JIMTCL_ARGV - array containing the Jim_Obj equivalent of command + argument in @c CMD_ARGV. @section helpercmdregister Command Registration diff --git a/src/helper/command.c b/src/helper/command.c index 57db2adc1..a775c730b 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -511,6 +511,7 @@ static int exec_command(Jim_Interp *interp, struct command_context *context, .name = c->name, .argc = argc - 1, .argv = words + 1, + .jimtcl_argv = argv + 1, }; cmd.output = Jim_NewEmptyStringObj(context->interp); diff --git a/src/helper/command.h b/src/helper/command.h index 42cb9cb7d..dc4507042 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -79,6 +79,7 @@ struct command_invocation { const char *name; unsigned argc; const char **argv; + Jim_Obj * const *jimtcl_argv; Jim_Obj *output; }; @@ -153,6 +154,11 @@ void *jimcmd_privdata(Jim_Cmd *cmd); * rather than accessing the variable directly. It may be moved. */ #define CMD_ARGV (cmd->argv) +/** + * Use this macro to access the jimtcl arguments for the command being + * handled, rather than accessing the variable directly. It may be moved. + */ +#define CMD_JIMTCL_ARGV (cmd->jimtcl_argv) /** * Use this macro to access the name of the command being handled, * rather than accessing the variable directly. It may be moved.