From: oharboe Date: Wed, 26 Nov 2008 13:42:02 +0000 (+0000) Subject: friendlier error messages X-Git-Tag: v0.1.0~147 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6e2e706d7eb90e58346a5e0d36c6087b19949675;p=openocd friendlier error messages git-svn-id: svn://svn.berlios.de/openocd/trunk@1185 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- diff --git a/src/helper/command.c b/src/helper/command.c index 9ca64dd2..cccf60e5 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -147,6 +147,9 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return (retval==ERROR_OK)?JIM_OK:JIM_ERR; } +/* nice short description of source file */ +#define __THIS__FILE__ "command.c" + command_t* register_command(command_context_t *context, command_t *parent, char *name, int (*handler)(struct command_context_s *context, char* name, char** args, int argc), enum command_mode mode, char *help) { command_t *c, *p; @@ -222,7 +225,7 @@ command_t* register_command(command_context_t *context, command_t *parent, char /* we now need to add an overrideable proc */ const char *override_name=alloc_printf("proc %s%s%s {args} {if {[catch {eval \"ocd_%s%s%s $args\"}]==0} {return \"\"} else { return -code error }", t1, t2, t3, t1, t2, t3); - Jim_Eval_Named(interp, override_name, __FILE__, __LINE__ ); + Jim_Eval_Named(interp, override_name, __THIS__FILE__, __LINE__ ); free((void *)override_name); /* accumulate help text in Tcl helptext list. */ @@ -442,7 +445,7 @@ int command_run_line(command_context_t *context, char *line) retcode = Jim_SetAssocData(interp, "retval", NULL, &retval); if (retcode == JIM_OK) { - retcode = Jim_Eval_Named(interp, line, __FILE__, __LINE__ ); + retcode = Jim_Eval_Named(interp, line, __THIS__FILE__, __LINE__ ); Jim_DeleteAssocData(interp, "retval"); } @@ -648,7 +651,7 @@ static int jim_capture(Jim_Interp *interp, int argc, Jim_Obj *const *argv) log_add_callback(tcl_output, tclOutput); - retcode = Jim_Eval_Named(interp, str, __FILE__, __LINE__ ); + retcode = Jim_Eval_Named(interp, str, __THIS__FILE__, __LINE__ ); log_remove_callback(tcl_output, tclOutput);