Index: generic/xotclError.c =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -r46f02e4868e118466d888b35d6b281b3f2ba31ac --- generic/xotclError.c (.../xotclError.c) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ generic/xotclError.c (.../xotclError.c) (revision 46f02e4868e118466d888b35d6b281b3f2ba31ac) @@ -15,34 +15,33 @@ #include "xotclInt.h" int -XOTclErrMsg(Tcl_Interp *in, char *msg, Tcl_FreeProc* type) { - Tcl_SetResult(in, msg, type); +XOTclErrMsg(Tcl_Interp *interp, char *msg, Tcl_FreeProc* type) { + Tcl_SetResult(interp, msg, type); return TCL_ERROR; } int -XOTclVarErrMsg TCL_VARARGS_DEF (Tcl_Interp *, arg1) -{ +XOTclVarErrMsg TCL_VARARGS_DEF (Tcl_Interp *, arg1) { va_list argList; char *string; - Tcl_Interp *in; + Tcl_Interp *interp; - in = TCL_VARARGS_START(Tcl_Interp *, arg1, argList); - Tcl_ResetResult(in); + interp = TCL_VARARGS_START(Tcl_Interp *, arg1, argList); + Tcl_ResetResult(interp); while (1) { string = va_arg(argList, char *); if (string == NULL) { break; } - Tcl_AppendResult(in, string, (char *) NULL); + Tcl_AppendResult(interp, string, (char *) NULL); } va_end(argList); return TCL_ERROR; } int -XOTclErrInProc (Tcl_Interp *in, Tcl_Obj *objName, +XOTclErrInProc (Tcl_Interp *interp, Tcl_Obj *objName, Tcl_Obj *clName, char *procName) { Tcl_DString errMsg; char *cName, *space; @@ -59,44 +58,54 @@ Tcl_DStringAppend(&errMsg, cName, -1); Tcl_DStringAppend(&errMsg, "->", 2); Tcl_DStringAppend(&errMsg, procName, -1); - Tcl_AddErrorInfo (in, Tcl_DStringValue(&errMsg)); + Tcl_AddErrorInfo (interp, Tcl_DStringValue(&errMsg)); DSTRING_FREE(&errMsg); return TCL_ERROR; } int -XOTclObjErrArgCnt(Tcl_Interp *in, Tcl_Obj *cmdname, char *arglist) { - Tcl_ResetResult(in); - Tcl_AppendResult(in, "wrong # args: should be {", (char *) NULL); - if (cmdname) { - Tcl_AppendResult(in, ObjStr(cmdname), " ", (char *) NULL); +XOTclObjErrArgCnt(Tcl_Interp *interp, Tcl_Obj *cmdName, Tcl_Obj *methodName, char *arglist) { + int need_space = 0; + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "wrong # args: should be \"", (char *) NULL); + if (cmdName) { + Tcl_AppendResult(interp, ObjStr(cmdName), (char *) NULL); + need_space = 1; } - if (arglist != 0) Tcl_AppendResult(in, arglist, (char *) NULL); - Tcl_AppendResult(in, "}", (char *) NULL); + if (methodName) { + if (need_space) Tcl_AppendResult(interp, " ", (char *) NULL); + Tcl_AppendResult(interp, ObjStr(methodName), (char *) NULL); + need_space = 1; + } + if (arglist != NULL) { + if (need_space) Tcl_AppendResult(interp, " ", (char *) NULL); + Tcl_AppendResult(interp, arglist, (char *) NULL); + } + Tcl_AppendResult(interp, "\"", (char *) NULL); return TCL_ERROR; } int -XOTclErrBadVal(Tcl_Interp *in, char *context, char *expected, char *value) { - Tcl_ResetResult(in); - Tcl_AppendResult(in, context, ": expected ", expected, " but got '", +XOTclErrBadVal(Tcl_Interp *interp, char *context, char *expected, char *value) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, context, ": expected ", expected, " but got '", value, "'", (char *) NULL); return TCL_ERROR; } int -XOTclErrBadVal_(Tcl_Interp *in, char *expected, char *value) { +XOTclErrBadVal_(Tcl_Interp *interp, char *expected, char *value) { fprintf(stderr, "Deprecated call, recompile your program with xotcl 1.5 or newer\n"); - Tcl_ResetResult(in); - Tcl_AppendResult(in, ": expected ", expected, " but got '", + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, ": expected ", expected, " but got '", value, "'", (char *) NULL); return TCL_ERROR; } extern int -XOTclObjErrType(Tcl_Interp *in, Tcl_Obj *nm, char *wt) { - Tcl_ResetResult(in); - Tcl_AppendResult(in,"'",ObjStr(nm), "' method should be called on '", - wt, "'", (char *) NULL); +XOTclObjErrType(Tcl_Interp *interp, Tcl_Obj *nm, char *wt) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp,"Invalid argument: cannot convert '",ObjStr(nm), "' to ", + wt, (char *) NULL); return TCL_ERROR; }