OpenOCD commands w/prefix ocd_ now set the primary Tcl return value instead of messing with ocd_output local variable. Much more straightforward and expected behaviour. The side effect is that the ocd_xxx commands will print output twice(once immediately and once upon completion of command). This is a strange, expected and intentional behaviour.

git-svn-id: svn://svn.berlios.de/openocd/trunk@871 b42882b7-edfa-0310-969c-e2dbd0fdcd60
__archive__
oharboe 2008-07-24 20:46:15 +00:00
parent 74eb754abc
commit 1ac48e7500
1 changed files with 2 additions and 2 deletions

View File

@ -115,7 +115,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
log_remove_callback(tcl_output, tclOutput); log_remove_callback(tcl_output, tclOutput);
/* We dump output into this local variable */ /* We dump output into this local variable */
Jim_SetVariableStr(interp, "ocd_output", tclOutput); Jim_SetResult(interp, tclOutput);
Jim_DecrRefCount(interp, tclOutput); Jim_DecrRefCount(interp, tclOutput);
for (i = 0; i < nwords; i++) for (i = 0; i < nwords; i++)
@ -205,7 +205,7 @@ command_t* register_command(command_context_t *context, command_t *parent, char
free((void *)full_name); free((void *)full_name);
/* we now need to add an overrideable proc */ /* 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); const char *override_name=alloc_printf("proc %s%s%s {args} {eval \"ocd_%s%s%s $args\";return \"\"}", t1, t2, t3, t1, t2, t3);
Jim_Eval(interp, override_name); Jim_Eval(interp, override_name);
free((void *)override_name); free((void *)override_name);