From 66410d2537bad8e455e803d1868e7de6bf8cabbd Mon Sep 17 00:00:00 2001 From: oharboe Date: Wed, 9 Jul 2008 15:22:05 +0000 Subject: "flash banks" is now implemented in Tcl on top of "flash_banks". openocd_throw prefix is no longer required when executing OpenOCD commands from tcl. git-svn-id: svn://svn.berlios.de/openocd/trunk@779 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/openocd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/openocd.c') diff --git a/src/openocd.c b/src/openocd.c index 4698fc16..b2a8ade5 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -379,6 +379,12 @@ int jim_command(command_context_t *context, char *line) line = Jim_GetString(objPtr, NULL); LOG_USER_N("In procedure '%s' called at file \"%s\", line %s" JIM_NL, proc, file, line); } + long t; + if (Jim_GetLong(interp, Jim_GetVariableStr(interp, "openocd_result", JIM_ERRMSG), &t)==JIM_OK) + { + return t; + } + return ERROR_FAIL; } else if (retcode == JIM_EXIT) { /* ignore. */ /* exit(Jim_GetExitCode(interp)); */ @@ -419,6 +425,13 @@ static int Jim_Command_openocd_ignore(Jim_Interp *interp, int argc, Jim_Obj *con log_add_callback(tcl_output, tclOutput); retval=command_run_line_internal(active_cmd_ctx, cmd); + + /* we need to be able to get at the retval, so we store in a variable + */ + Jim_Obj *resultvar=Jim_NewIntObj(interp, retval); + Jim_IncrRefCount(resultvar); + Jim_SetGlobalVariableStr(interp, "openocd_result", resultvar); + Jim_DecrRefCount(interp, resultvar); if (startLoop) { -- cgit v1.2.3