Index: generic/nsf.c =================================================================== diff -u -r0e705d6ad1629ad4c0c7b0a2c67b01f658597abd -r242d5780b82de4363cd774a29ff7296270cdf0d0 --- generic/nsf.c (.../nsf.c) (revision 0e705d6ad1629ad4c0c7b0a2c67b01f658597abd) +++ generic/nsf.c (.../nsf.c) (revision 242d5780b82de4363cd774a29ff7296270cdf0d0) @@ -457,6 +457,20 @@ Tcl_DStringFree(dsPtr); } +#if 0 +static char * +NsfErrorInfo(Tcl_Interp *interp) { + Tcl_Obj *value; + assert(interp); + + value = Tcl_GetVar2Ex(interp, "::errorInfo", NULL, TCL_GLOBAL_ONLY); + if (value) { + return ObjStr(value); + } + return NULL; +} +#endif + /* *---------------------------------------------------------------------- * @@ -10677,6 +10691,7 @@ (Namespace *) nsPtr, "body of proc", procName); *flagsPtr &= ~NSF_CSC_CALL_IS_COMPILE; + return result; } } @@ -13061,8 +13076,10 @@ resolvedCmd, cscPtr, methodName, &validCscPtr); if (unlikely(result == TCL_ERROR)) { - /*fprintf(stderr, "Call ErrInProc cl = %p, cmd %p, flags %.6x\n", - cl, cl ? cl->object.id : NULL, cl ? cl->object.flags : 0);*/ + /*fprintf(stderr, "Call ErrInProc cl = %p, cmd %p, methodName %s flags %.6x\n", + cl, cl ? cl->object.id : NULL, methodName, + cl ? cl->object.flags : 0);*/ + result = NsfErrInProc(interp, cmdName, cl && cl->object.teardown ? cl->object.cmdName : NULL, methodName); @@ -13266,7 +13283,6 @@ */ result = TCL_OK; } else { - /*fprintf(stderr, "%s init dispatch\n", ObjectName(object));*/ result = CallMethod(object, interp, methodObj, objc+2, objv, flags|NSF_CM_IGNORE_PERMISSIONS|NSF_CSC_IMMEDIATE); @@ -14812,15 +14828,15 @@ if ((paramPtr->slotObj || paramPtr->converter == ConvertViaCmd) && paramPtr->type) { CONST char *converterNameString; - Tcl_Obj *converterNameObj; + Tcl_Obj *converterNameObj, *slotObj; NsfObject *paramObject; Tcl_Command cmd; NsfClass *pcl = NULL; - result = GetObjectFromObj(interp, paramPtr->slotObj ? paramPtr->slotObj : - NsfGlobalObjs[NSF_METHOD_PARAMETER_SLOT_OBJ], - ¶mObject); + slotObj = paramPtr->slotObj ? paramPtr->slotObj : NsfGlobalObjs[NSF_METHOD_PARAMETER_SLOT_OBJ]; + result = GetObjectFromObj(interp, slotObj, ¶mObject); if (unlikely(result != TCL_OK)) { + NsfPrintError(interp, "non-existing slot object \"%s\"", ObjStr(slotObj)); goto param_error; } if (paramPtr->converterName == NULL) { @@ -14900,6 +14916,17 @@ ParamFree(paramPtr); paramPtr->name = NULL; +#if !defined(NDEBUG) + /* + * Whenever we return a TCL_ERROR, we expect that the interp result contains + * an error message. + */ + { + char *errStr = ObjStr(Tcl_GetObjResult(interp)); + assert(*errStr != '\0'); + } +#endif + return TCL_ERROR; } @@ -14955,6 +14982,7 @@ for (i = 0; i < argsc; i++, paramPtr++) { result = ParamParse(interp, procNameObj, argsv[i], allowedOptinons, paramPtr, &possibleUnknowns, &plainParams, &nrNonposArgs); + if (result == TCL_OK && paramPtr->converter == ConvertToNothing && i < argsc-1) { result = NsfPrintError(interp, "parameter option \"args\" invalid for parameter \"%s\"; only allowed for last parameter", @@ -15353,11 +15381,12 @@ /* Check, if we are allowed to redefine the method */ result = CanRedefineCmd(interp, nsPtr, defObject, methodName); if (likely(result == TCL_OK)) { - /* Yes, so obtain an method parameter definitions */ + /* Yes, we can! ...so obtain an method parameter definitions */ result = ParamDefsParse(interp, nameObj, args, NSF_DISALLOWED_ARG_METHOD_PARAMETER, 0, &parsedParam); } + if (unlikely(result != TCL_OK)) { return result; } @@ -26584,7 +26613,7 @@ NSF_s_set_idx, methodObj);*/ result = NsfCallMethodWithArgs(interp, (Nsf_Object *)slotObject, - methodObj ? methodObj : NsfGlobalObjs[NSF_SET], + methodObj ? methodObj : NsfGlobalObjs[NSF_SLOT_SET], object->cmdName, 3, ov, NSF_CSC_IMMEDIATE); } if (result != TCL_OK) { @@ -26712,7 +26741,7 @@ NSF_s_get_idx, methodObj);*/ result = NsfCallMethodWithArgs(interp, (Nsf_Object *)slotObject, - methodObj ? methodObj : NsfGlobalObjs[NSF_GET], + methodObj ? methodObj : NsfGlobalObjs[NSF_SLOT_GET], object->cmdName, 2, ov, NSF_CSC_IMMEDIATE); goto cget_exit; } Index: generic/nsfInt.h =================================================================== diff -u -r0e705d6ad1629ad4c0c7b0a2c67b01f658597abd -r242d5780b82de4363cd774a29ff7296270cdf0d0 --- generic/nsfInt.h (.../nsfInt.h) (revision 0e705d6ad1629ad4c0c7b0a2c67b01f658597abd) +++ generic/nsfInt.h (.../nsfInt.h) (revision 242d5780b82de4363cd774a29ff7296270cdf0d0) @@ -630,8 +630,9 @@ NSF_EMPTY, NSF_ZERO, NSF_ONE, /* methods called internally */ NSF_CONFIGURE, NSF_INITIALIZE, NSF_GET_PARAMETER_SPEC, + NSF_SLOT_GET, NSF_SLOT_SET, /* var names */ - NSF_AUTONAMES, NSF_DEFAULTMETACLASS, NSF_DEFAULTSUPERCLASS, + NSF_AUTONAMES, NSF_DEFAULTMETACLASS, NSF_DEFAULTSUPERCLASS, NSF_ARRAY_INITCMD, NSF_ARRAY_CMD, NSF_ARRAY_ALIAS, NSF_ARRAY_PARAMETERSYNTAX, NSF_POSITION, NSF_POSITIONAL, NSF_CONFIGURABLE, NSF_PARAMETERSPEC, @@ -651,15 +652,16 @@ EXTERN char *NsfGlobalStrings[]; #else char *NsfGlobalStrings[] = { - "", "0", "1", + "", "0", "1", /* methods called internally */ "configure", "initialize", "getParameterSpec", + "value=get", "value=set", /* var names */ "__autonames", "__default_metaclass", "__default_superclass", "__initcmd", "__cmd", - "::nsf::alias", "::nsf::parameter::syntax", + "::nsf::alias", "::nsf::parameter::syntax", "position", "positional", "configurable", "parameterSpec", /* object/class names */ - "::nx::methodParameterSlot", + "::nx::methodParameterSlot", /* constants */ "alias", "args", "cmd", "filter", "forward", "method", "object", "setter", "settername", "valuecheck",