This allows overriding builtin openocd commands.

git-svn-id: svn://svn.berlios.de/openocd/trunk@834 b42882b7-edfa-0310-969c-e2dbd0fdcd60
__archive__
oharboe 2008-07-18 16:25:15 +00:00
parent 2249f58946
commit 310300261b
1 changed files with 6 additions and 1 deletions

View File

@ -178,10 +178,15 @@ command_t* register_command(command_context_t *context, command_t *parent, char
t2="_"; t2="_";
} }
t3=c->name; t3=c->name;
const char *full_name=alloc_printf("%s%s%s", t1, t2, t3); const char *full_name=alloc_printf("ocd_%s%s%s", t1, t2, t3);
Jim_CreateCommand(interp, full_name, script_command, c, NULL); Jim_CreateCommand(interp, full_name, script_command, c, NULL);
free((void *)full_name); free((void *)full_name);
/* we now need to add an overrideable proc */
const char *override_name=alloc_printf("proc %s%s%s {args} {return [eval \"ocd_%s%s%s $args\"]}", t1, t2, t3, t1, t2, t3);
Jim_Eval(interp, override_name);
free((void *)override_name);
/* accumulate help text in Tcl helptext list. */ /* accumulate help text in Tcl helptext list. */
Jim_Obj *helptext=Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG); Jim_Obj *helptext=Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG);
if (Jim_IsShared(helptext)) if (Jim_IsShared(helptext))