provide command context during cmd_init
For the startup.tcl code to use built-in commands, the context must be associated with the interpreter temporarily. This will be required to add help text.
This commit is contained in:
parent
5458fef43c
commit
e5b0a69ba9
|
@ -869,12 +869,14 @@ struct command_context* command_init(const char *startup_tcl)
|
||||||
#if !BUILD_ECOSBOARD
|
#if !BUILD_ECOSBOARD
|
||||||
Jim_EventLoopOnLoad(interp);
|
Jim_EventLoopOnLoad(interp);
|
||||||
#endif
|
#endif
|
||||||
|
Jim_SetAssocData(interp, "context", NULL, context);
|
||||||
if (Jim_Eval_Named(interp, startup_tcl, "embedded:startup.tcl",1) == JIM_ERR)
|
if (Jim_Eval_Named(interp, startup_tcl, "embedded:startup.tcl",1) == JIM_ERR)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Failed to run startup.tcl (embedded into OpenOCD)");
|
LOG_ERROR("Failed to run startup.tcl (embedded into OpenOCD)");
|
||||||
Jim_PrintErrorMessage(interp);
|
Jim_PrintErrorMessage(interp);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
Jim_DeleteAssocData(interp, "context");
|
||||||
|
|
||||||
register_command(context, NULL, "sleep",
|
register_command(context, NULL, "sleep",
|
||||||
handle_sleep_command, COMMAND_ANY,
|
handle_sleep_command, COMMAND_ANY,
|
||||||
|
|
Loading…
Reference in New Issue