jim tests: use installed

Delete obsolete jim that comes with OpenOCD.
This commit is contained in:
Øyvind Harboe
2010-10-10 19:17:03 +02:00
parent 4617cd0f91
commit 559d08c19e
14 changed files with 79 additions and 14903 deletions

View File

@@ -18,7 +18,7 @@ MAINFILE = main.c
endif
openocd_SOURCES = $(MAINFILE)
openocd_LDADD = libopenocd.la
openocd_LDADD = libopenocd.la -ljim
libopenocd_la_SOURCES = \
hello.c \

View File

@@ -500,6 +500,10 @@ static void zylinjtag_startNetwork(void)
cyg_httpd_init_tcl_interpreter();
// Kludge! Why can't I do this from httpd.c??? I get linker errors...
// some of that --start/end-group stuff?
Jim_InitStaticExtensions(httpstate.jim_interp);
Jim_CreateCommand(httpstate.jim_interp, "log", zylinjtag_Jim_Command_log,
NULL, NULL);
Jim_CreateCommand(httpstate.jim_interp, "zy1000_reboot",

View File

@@ -9,7 +9,7 @@ noinst_LTLIBRARIES = libhelper.la
if ECOSBOARD
CONFIGFILES = time_support_ecos.c
else
CONFIGFILES = options.c jim.c jim-eventloop.c time_support_common.c
CONFIGFILES = options.c time_support_common.c
endif
@@ -48,8 +48,6 @@ noinst_HEADERS = \
time_support.h \
replacements.h \
fileio.h \
jim.h \
jim-eventloop.h \
system.h \
bin2char.c

View File

@@ -684,7 +684,8 @@ int command_run_line(struct command_context *context, char *line)
if (retval != ERROR_COMMAND_CLOSE_CONNECTION)
{
/* We do not print the connection closed error message */
Jim_PrintErrorMessage(interp);
Jim_MakeErrorMessage(interp);
LOG_USER_N("%s\n", Jim_GetString(Jim_GetResult(interp), NULL));
}
if (retval == ERROR_OK)
{
@@ -785,89 +786,6 @@ static int jim_echo(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK;
}
static size_t openocd_jim_fwrite(const void *_ptr, size_t size, size_t n, void *cookie)
{
size_t nbytes;
const char *ptr;
Jim_Interp *interp;
/* make it a char easier to read code */
ptr = _ptr;
interp = cookie;
nbytes = size * n;
if (ptr == NULL || interp == NULL || nbytes == 0) {
return 0;
}
/* do we have to chunk it? */
if (ptr[nbytes] == 0)
{
/* no it is a C style string */
LOG_USER_N("%s", ptr);
return strlen(ptr);
}
/* GRR we must chunk - not null terminated */
while (nbytes) {
char chunk[128 + 1];
int x;
x = nbytes;
if (x > 128) {
x = 128;
}
/* copy it */
memcpy(chunk, ptr, x);
/* terminate it */
chunk[n] = 0;
/* output it */
LOG_USER_N("%s", chunk);
ptr += x;
nbytes -= x;
}
return n;
}
static size_t openocd_jim_fread(void *ptr, size_t size, size_t n, void *cookie)
{
/* TCL wants to read... tell him no */
return 0;
}
static int openocd_jim_vfprintf(void *cookie, const char *fmt, va_list ap)
{
char *cp;
int n;
Jim_Interp *interp;
n = -1;
interp = cookie;
if (interp == NULL)
return n;
cp = alloc_vprintf(fmt, ap);
if (cp)
{
LOG_USER_N("%s", cp);
n = strlen(cp);
free(cp);
}
return n;
}
static int openocd_jim_fflush(void *cookie)
{
/* nothing to flush */
return 0;
}
static char* openocd_jim_fgets(char *s, int size, void *cookie)
{
/* not supported */
errno = ENOTSUP;
return NULL;
}
/* Capture progress output and return as tcl return value. If the
* progress output was empty, return tcl return value.
*/
@@ -1400,11 +1318,11 @@ struct command_context* command_init(const char *startup_tcl, Jim_Interp *interp
/* Create a jim interpreter if we were not handed one */
if (interp == NULL)
{
Jim_InitEmbedded();
/* Create an interpreter */
interp = Jim_CreateInterp();
/* Add all the Jim core commands */
Jim_RegisterCoreCommands(interp);
Jim_InitStaticExtensions(interp);
}
#endif
context->interp = interp;
@@ -1442,26 +1360,14 @@ struct command_context* command_init(const char *startup_tcl, Jim_Interp *interp
Jim_CreateCommand(interp, "echo", jim_echo, NULL, NULL);
Jim_CreateCommand(interp, "capture", jim_capture, NULL, NULL);
/* Set Jim's STDIO */
interp->cookie_stdin = interp;
interp->cookie_stdout = interp;
interp->cookie_stderr = interp;
interp->cb_fwrite = openocd_jim_fwrite;
interp->cb_fread = openocd_jim_fread ;
interp->cb_vfprintf = openocd_jim_vfprintf;
interp->cb_fflush = openocd_jim_fflush;
interp->cb_fgets = openocd_jim_fgets;
register_commands(context, NULL, command_builtin_handlers);
#if !BUILD_ECOSBOARD
Jim_EventLoopOnLoad(interp);
#endif
Jim_SetAssocData(interp, "context", NULL, context);
if (Jim_Eval_Named(interp, startup_tcl, "embedded:startup.tcl",1) == JIM_ERR)
{
LOG_ERROR("Failed to run startup.tcl (embedded into OpenOCD)");
Jim_PrintErrorMessage(interp);
Jim_MakeErrorMessage(interp);
LOG_USER_N("%s", Jim_GetString(Jim_GetResult(interp), NULL));
exit(-1);
}
Jim_DeleteAssocData(interp, "context");

View File

@@ -29,12 +29,11 @@
#if BUILD_ECOSBOARD
#include <stdio.h>
#include <stdarg.h>
/* Jim is provied by eCos */
#include <cyg/jimtcl/jim.h>
#else
#include <helper/jim.h>
#endif
#include <jim.h>
#include <jim-nvp.h>
/* To achieve C99 printf compatibility in MinGW, gnu_printf should be
* used for __attribute__((format( ... ))), with GCC v4.4 or later
*/

File diff suppressed because it is too large Load Diff

View File

@@ -1,75 +0,0 @@
/* Jim - A small embeddable Tcl interpreter
*
* Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
* Copyright 2005 Clemens Hintze <c.hintze@gmx.net>
* Copyright 2005 patthoyts - Pat Thoyts <patthoyts@users.sf.net>
* Copyright 2008 oharboe - Øyvind Harboe - oyvind.harboe@zylin.com
* Copyright 2008 Andrew Lunn <andrew@lunn.ch>
* Copyright 2008 Duane Ellis <openocd@duaneellis.com>
* Copyright 2008 Uwe Klein <uklein@klein-messgeraete.de>
*
* The FreeBSD license
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE JIM TCL PROJECT ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* JIM TCL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
* official policies, either expressed or implied, of the Jim Tcl Project.
**/
/* ------ USAGE -------
*
* In order to use this file from other extensions include it in every
* file where you need to call the eventloop API, also in the init
* function of your extension call Jim_ImportEventloopAPI(interp)
* after the Jim_InitExtension() call.
*
* See the UDP extension as example.
*/
#ifndef __JIM_EVENTLOOP_H__
#define __JIM_EVENTLOOP_H__
typedef int Jim_FileProc(Jim_Interp *interp, void *clientData, int mask);
typedef void Jim_TimeProc(Jim_Interp *interp, void *clientData);
typedef void Jim_EventFinalizerProc(Jim_Interp *interp, void *clientData);
/* File event structure */
#define JIM_EVENT_READABLE 1
#define JIM_EVENT_WRITABLE 2
#define JIM_EVENT_EXCEPTION 4
#define JIM_EVENT_FEOF 8
int Jim_EventLoopOnLoad(Jim_Interp *interp);
/* --- POSIX version of Jim_ProcessEvents, for now the only available --- */
#define JIM_FILE_EVENTS 1
#define JIM_TIME_EVENTS 2
#define JIM_ALL_EVENTS (JIM_FILE_EVENTS | JIM_TIME_EVENTS)
#define JIM_DONT_WAIT 4
int Jim_ProcessEvents(Jim_Interp *interp, int flags);
#endif /* __JIM_EVENTLOOP_H__ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -63,7 +63,7 @@ struct jtag_tap *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
if (NULL == cp)
cp = "(unknown)";
if (NULL == t)
Jim_SetResult_sprintf(interp, "Tap '%s' could not be found", cp);
Jim_SetResultFormatted(interp, "Tap '%s' could not be found", cp);
return t;
}
@@ -145,7 +145,7 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
endstate = tap_state_by_name(cp);
if (endstate < 0) {
/* update the error message */
Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp);
Jim_SetResultFormatted(interp,"endstate: %s invalid", cp);
} else {
if (!scan_is_safe(endstate))
LOG_WARNING("drscan with unsafe "
@@ -242,7 +242,7 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar
if (states[i] < 0)
{
/* update the error message */
Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp);
Jim_SetResultFormatted(interp,"endstate: %s invalid", cp);
return JIM_ERR;
}
}
@@ -419,7 +419,7 @@ static int jtag_tap_configure_cmd(Jim_GetOptInfo *goi, struct jtag_tap * tap)
return e;
break;
default:
Jim_SetResult_sprintf(goi->interp, "unknown event: %s", n->name);
Jim_SetResultFormatted(goi->interp, "unknown event: %s", n->name);
return JIM_ERR;
}
}
@@ -443,7 +443,7 @@ static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi,
jim_wide w;
int e = Jim_GetOpt_Wide(goi, &w);
if (e != JIM_OK) {
Jim_SetResult_sprintf(goi->interp, "option: %s bad parameter", n->name);
Jim_SetResultFormatted(goi->interp, "option: %s bad parameter", n->name);
return e;
}
@@ -451,7 +451,7 @@ static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi,
uint32_t *new_expected_ids = malloc(expected_len + sizeof(uint32_t));
if (new_expected_ids == NULL)
{
Jim_SetResult_sprintf(goi->interp, "no memory");
Jim_SetResultFormatted(goi->interp, "no memory");
return JIM_ERR;
}
@@ -481,7 +481,7 @@ static int jim_newtap_ir_param(Jim_Nvp *n, Jim_GetOptInfo *goi,
int e = Jim_GetOpt_Wide(goi, &w);
if (e != JIM_OK)
{
Jim_SetResult_sprintf(goi->interp,
Jim_SetResultFormatted(goi->interp,
"option: %s bad parameter", n->name);
free((void *)pTap->dotted_name);
return e;
@@ -545,7 +545,7 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
pTap = calloc(1, sizeof(struct jtag_tap));
if (!pTap) {
Jim_SetResult_sprintf(goi->interp, "no memory");
Jim_SetResultFormatted(goi->interp, "no memory");
return JIM_ERR;
}
@@ -553,7 +553,7 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
* we expect CHIP + TAP + OPTIONS
* */
if (goi->argc < 3) {
Jim_SetResult_sprintf(goi->interp, "Missing CHIP TAP OPTIONS ....");
Jim_SetResultFormatted(goi->interp, "Missing CHIP TAP OPTIONS ....");
free(pTap);
return JIM_ERR;
}
@@ -631,7 +631,7 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
return JIM_OK;
}
Jim_SetResult_sprintf(goi->interp,
Jim_SetResultFormatted(goi->interp,
"newtap: %s missing IR length",
pTap->dotted_name);
jtag_tap_free(pTap);
@@ -654,7 +654,8 @@ static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
if (Jim_EvalObj(jteap->interp, jteap->body) != JIM_OK)
{
Jim_PrintErrorMessage(jteap->interp);
Jim_MakeErrorMessage(jteap->interp);
LOG_USER_N("%s\n", Jim_GetString(Jim_GetResult(jteap->interp), NULL));
continue;
}
@@ -687,7 +688,9 @@ static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
struct command_context *context = current_command_context(interp);
int e = jtag_init_inner(context);
if (e != ERROR_OK) {
Jim_SetResult_sprintf(goi.interp, "error: %d", e);
Jim_Obj *eObj = Jim_NewIntObj(goi.interp, e);
Jim_SetResultFormatted(goi.interp, "error: %#s", eObj);
Jim_FreeNewObj(goi.interp, eObj);
return JIM_ERR;
}
return JIM_OK;
@@ -704,7 +707,9 @@ static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const
struct command_context *context = current_command_context(interp);
int e = jtag_init_reset(context);
if (e != ERROR_OK) {
Jim_SetResult_sprintf(goi.interp, "error: %d", e);
Jim_Obj *eObj = Jim_NewIntObj(goi.interp, e);
Jim_SetResultFormatted(goi.interp, "error: %#s", eObj);
Jim_FreeNewObj(goi.interp, eObj);
return JIM_ERR;
}
return JIM_OK;
@@ -754,7 +759,7 @@ static int jim_jtag_tap_enabler(Jim_Interp *interp, int argc, Jim_Obj *const *ar
Jim_GetOptInfo goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
if (goi.argc != 1) {
Jim_SetResult_sprintf(goi.interp, "usage: %s <name>", cmd_name);
Jim_SetResultFormatted(goi.interp, "usage: %s <name>", cmd_name);
return JIM_ERR;
}

View File

@@ -21,7 +21,7 @@
#include "config.h"
#endif
#include <helper/jim.h>
#include <jim.h>
#include "target.h"
#include "target_type.h"

View File

@@ -21,7 +21,7 @@
#include "config.h"
#endif
#include <helper/jim.h>
#include <jim.h>
#include "target.h"
#include "target_type.h"

View File

@@ -505,7 +505,8 @@ static int target_process_reset(struct command_context *cmd_ctx, enum target_res
jtag_poll_set_enabled(save_poll);
if (retval != JIM_OK) {
Jim_PrintErrorMessage(cmd_ctx->interp);
Jim_MakeErrorMessage(cmd_ctx->interp);
command_print(NULL,"%s\n", Jim_GetString(Jim_GetResult(cmd_ctx->interp), NULL));
return ERROR_FAIL;
}
@@ -3627,7 +3628,8 @@ void target_handle_event(struct target *target, enum target_event e)
Jim_GetString(teap->body, NULL));
if (Jim_EvalObj(teap->interp, teap->body) != JIM_OK)
{
Jim_PrintErrorMessage(teap->interp);
Jim_MakeErrorMessage(teap->interp);
command_print(NULL,"%s\n", Jim_GetString(Jim_GetResult(teap->interp), NULL));
}
}
}
@@ -3709,7 +3711,7 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
case TCFG_TYPE:
/* not setable */
if (goi->isconfigure) {
Jim_SetResult_sprintf(goi->interp,
Jim_SetResultFormatted(goi->interp,
"not settable: %s", n->name);
return JIM_ERR;
} else {
@@ -3902,7 +3904,7 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
case TCFG_VARIANT:
if (goi->isconfigure) {
if (goi->argc < 1) {
Jim_SetResult_sprintf(goi->interp,
Jim_SetResultFormatted(goi->interp,
"%s ?STRING?",
n->name);
return JIM_ERR;
@@ -3980,7 +3982,7 @@ static int jim_target_mw(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
if (goi.argc < 2 || goi.argc > 4)
{
Jim_SetResult_sprintf(goi.interp,
Jim_SetResultFormatted(goi.interp,
"usage: %s [phys] <address> <data> [<count>]", cmd_name);
return JIM_ERR;
}
@@ -4051,7 +4053,7 @@ static int jim_target_md(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
if ((goi.argc < 1) || (goi.argc > 3))
{
Jim_SetResult_sprintf(goi.interp,
Jim_SetResultFormatted(goi.interp,
"usage: %s [phys] <address> [<count>]", cmd_name);
return JIM_ERR;
}
@@ -4118,40 +4120,42 @@ static int jim_target_md(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
}
e = fn(target, a, b, y / b, target_buf);
if (e != ERROR_OK) {
Jim_SetResult_sprintf(interp, "error reading target @ 0x%08lx", (int)(a));
char tmp[10];
snprintf(tmp, sizeof(tmp), "%08lx", (long)a);
Jim_SetResultFormatted(interp, "error reading target @ 0x%s", tmp);
return JIM_ERR;
}
Jim_fprintf(interp, interp->cookie_stdout, "0x%08x ", (int)(a));
command_print(NULL, "0x%08x ", (int)(a));
switch (b) {
case 4:
for (x = 0; x < 16 && x < y; x += 4)
{
z = target_buffer_get_u32(target, &(target_buf[ x ]));
Jim_fprintf(interp, interp->cookie_stdout, "%08x ", (int)(z));
command_print(NULL, "%08x ", (int)(z));
}
for (; (x < 16) ; x += 4) {
Jim_fprintf(interp, interp->cookie_stdout, " ");
command_print(NULL, " ");
}
break;
case 2:
for (x = 0; x < 16 && x < y; x += 2)
{
z = target_buffer_get_u16(target, &(target_buf[ x ]));
Jim_fprintf(interp, interp->cookie_stdout, "%04x ", (int)(z));
command_print(NULL, "%04x ", (int)(z));
}
for (; (x < 16) ; x += 2) {
Jim_fprintf(interp, interp->cookie_stdout, " ");
command_print(NULL, " ");
}
break;
case 1:
default:
for (x = 0 ; (x < 16) && (x < y) ; x += 1) {
z = target_buffer_get_u8(target, &(target_buf[ x ]));
Jim_fprintf(interp, interp->cookie_stdout, "%02x ", (int)(z));
command_print(NULL, "%02x ", (int)(z));
}
for (; (x < 16) ; x += 1) {
Jim_fprintf(interp, interp->cookie_stdout, " ");
command_print(NULL, " ");
}
break;
}
@@ -4173,7 +4177,7 @@ static int jim_target_md(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
/* terminate */
target_buf[16] = 0;
/* print - with a newline */
Jim_fprintf(interp, interp->cookie_stdout, "%s\n", target_buf);
command_print(NULL, "%s\n", target_buf);
/* NEXT... */
c -= 16;
a += 16;
@@ -4197,7 +4201,7 @@ static int jim_target_array2mem(Jim_Interp *interp,
static int jim_target_tap_disabled(Jim_Interp *interp)
{
Jim_SetResult_sprintf(interp, "[TAP is disabled]");
Jim_SetResultFormatted(interp, "[TAP is disabled]");
return JIM_ERR;
}
@@ -4215,7 +4219,9 @@ static int jim_target_examine(Jim_Interp *interp, int argc, Jim_Obj *const *argv
int e = target->type->examine(target);
if (e != ERROR_OK)
{
Jim_SetResult_sprintf(interp, "examine-fails: %d", e);
Jim_Obj *eObj = Jim_NewIntObj(interp, e);
Jim_SetResultFormatted(interp, "examine-fails: %#s", eObj);
Jim_FreeNewObj(interp, eObj);
return JIM_ERR;
}
return JIM_OK;
@@ -4255,7 +4261,9 @@ static int jim_target_poll(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
}
if (e != ERROR_OK)
{
Jim_SetResult_sprintf(interp, "poll-fails: %d", e);
Jim_Obj *eObj = Jim_NewIntObj(interp, e);
Jim_SetResultFormatted(interp, "poll-fails: %#s", eObj);
Jim_FreeNewObj(interp, eObj);
return JIM_ERR;
}
return JIM_OK;
@@ -4296,7 +4304,7 @@ static int jim_target_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
}
if (!target->type->assert_reset || !target->type->deassert_reset)
{
Jim_SetResult_sprintf(interp,
Jim_SetResultFormatted(interp,
"No target-specific reset for %s",
target_name(target));
return JIM_ERR;
@@ -4337,7 +4345,7 @@ static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const *a
if (goi.argc != 2)
{
const char *cmd_name = Jim_GetString(argv[0], NULL);
Jim_SetResult_sprintf(goi.interp,
Jim_SetResultFormatted(goi.interp,
"%s <state_name> <timeout_in_msec>", cmd_name);
return JIM_ERR;
}
@@ -4360,10 +4368,12 @@ static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const *a
e = target_wait_state(target, n->value, a);
if (e != ERROR_OK)
{
Jim_SetResult_sprintf(goi.interp,
"target: %s wait %s fails (%d) %s",
Jim_Obj *eObj = Jim_NewIntObj(interp, e);
Jim_SetResultFormatted(goi.interp,
"target: %s wait %s fails (%#s) %s",
target_name(target), n->name,
e, target_strerror_safe(e));
eObj, target_strerror_safe(e));
Jim_FreeNewObj(interp, eObj);
return JIM_ERR;
}
return JIM_OK;
@@ -4412,7 +4422,7 @@ static int jim_target_invoke_event(Jim_Interp *interp, int argc, Jim_Obj *const
if (goi.argc != 1)
{
const char *cmd_name = Jim_GetString(argv[0], NULL);
Jim_SetResult_sprintf(goi.interp, "%s <eventname>", cmd_name);
Jim_SetResultFormatted(goi.interp, "%s <eventname>", cmd_name);
return JIM_ERR;
}
Jim_Nvp *n;
@@ -4583,7 +4593,7 @@ static int target_create(Jim_GetOptInfo *goi)
cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG);
if (cmd) {
cp = Jim_GetString(new_cmd, NULL);
Jim_SetResult_sprintf(goi->interp, "Command/target: %s Exists", cp);
Jim_SetResultFormatted(goi->interp, "Command/target: %s Exists", cp);
return JIM_ERR;
}
@@ -4598,7 +4608,7 @@ static int target_create(Jim_GetOptInfo *goi)
}
}
if (target_types[x] == NULL) {
Jim_SetResult_sprintf(goi->interp, "Unknown target type %s, try one of ", cp);
Jim_SetResultFormatted(goi->interp, "Unknown target type %s, try one of ", cp);
for (x = 0 ; target_types[x] ; x++) {
if (target_types[x + 1]) {
Jim_AppendStrings(goi->interp,
@@ -4808,7 +4818,7 @@ static int jim_target_number(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
LOG_WARNING("don't use numbers as target identifiers; use names");
if (goi.argc != 1)
{
Jim_SetResult_sprintf(goi.interp, "usage: target number <number>");
Jim_SetResultFormatted(goi.interp, "usage: target number <number>");
return JIM_ERR;
}
jim_wide w;
@@ -4825,8 +4835,12 @@ static int jim_target_number(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Jim_SetResultString(goi.interp, target_name(target), -1);
return JIM_OK;
}
Jim_SetResult_sprintf(goi.interp,
"Target: number %d does not exist", (int)(w));
{
Jim_Obj *wObj = Jim_NewIntObj(goi.interp, w);
Jim_SetResultFormatted(goi.interp,
"Target: number %#s does not exist", wObj);
Jim_FreeNewObj(interp, wObj);
}
return JIM_ERR;
}

View File

@@ -27,6 +27,7 @@
#define TARGET_TYPE_H
#include <helper/types.h>
#include <jim-nvp.h>
struct target;