This is an automated email from Gerrit. Antonio Borneo ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/5669
-- gerrit commit 29bd19a63e36fa7c40a7c5d8c85dc9a61a2be347 Author: Antonio Borneo <[email protected]> Date: Sat May 9 02:00:45 2020 +0200 command mode: return "any" for tcl proc A tlc proc can be executed anytime, in any command mode. Let the command "command mode" to detect a tcl proc and return the string "any". Change-Id: I0559076c3063632ee0ea9a57a25f91060209b77f Signed-off-by: Antonio Borneo <[email protected]> diff --git a/src/helper/command.c b/src/helper/command.c index d9a021c..9d75411 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -53,6 +53,12 @@ static int unregister_command(struct command_context *context, struct command *parent, const char *name); static char *command_name(struct command *c, char delim); +/* wrap jimtcl internal data */ +static inline bool jimcmd_is_proc(Jim_Cmd *cmd) +{ + return cmd->isproc; +} + static void tcl_output(void *privData, const char *file, unsigned line, const char *function, const char *string) { @@ -1050,6 +1056,15 @@ static int jim_command_mode(Jim_Interp *interp, int argc, Jim_Obj *const *argv) enum command_mode mode; if (argc > 1) { + char *full_name = alloc_concatenate_strings(argc - 1, argv + 1); + if (!full_name) + return JIM_ERR; + Jim_Cmd *cmd = Jim_GetCommand(interp, Jim_NewStringObj(interp, full_name, -1), JIM_ERRMSG); + free(full_name); + if (cmd && jimcmd_is_proc(cmd)) { + Jim_SetResultString(interp, "any", -1); + return JIM_OK; + } struct command *c = cmd_ctx->commands; int remaining = command_unknown_find(argc - 1, argv + 1, c, &c); /* if nothing could be consumed, then it's an unknown command */ -- _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
