summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-07-18 16:25:15 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-07-18 16:25:15 +0000
commit310300261b4450d6a8c5f51f4ef6c0479b6b7abe (patch)
tree35f653d11f810ffe9fcc186f1759c69db4216964
parent2249f589468777094c5184ee2c0e13ba7bdda333 (diff)
downloadopenocd_libswd-310300261b4450d6a8c5f51f4ef6c0479b6b7abe.tar.gz
openocd_libswd-310300261b4450d6a8c5f51f4ef6c0479b6b7abe.tar.bz2
openocd_libswd-310300261b4450d6a8c5f51f4ef6c0479b6b7abe.tar.xz
openocd_libswd-310300261b4450d6a8c5f51f4ef6c0479b6b7abe.zip
This allows overriding builtin openocd commands.
git-svn-id: svn://svn.berlios.de/openocd/trunk@834 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/helper/command.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/helper/command.c b/src/helper/command.c
index 234b64ef..04737001 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -178,10 +178,15 @@ command_t* register_command(command_context_t *context, command_t *parent, char
t2="_";
}
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);
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. */
Jim_Obj *helptext=Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG);
if (Jim_IsShared(helptext))