Index: TODO =================================================================== diff -u -r7efafd7b19c58bf0f5ac486779e8ce778e60c9bb -rf93a860bacabe371e1f01bd3f3841015c6b14a21 --- TODO (.../TODO) (revision 7efafd7b19c58bf0f5ac486779e8ce778e60c9bb) +++ TODO (.../TODO) (revision f93a860bacabe371e1f01bd3f3841015c6b14a21) @@ -1262,8 +1262,13 @@ - new flag for configure: "nx::configure checkresult on|off" - turn off result-checking for non-converters, when checking is off (per default, it is on) -- extended regression test for optional result checking +- extended regressi +- new flag for configure: "nx::configure checkarguments on|off" +- turn off argument-checking for non-converters, when checking is off + (per default, it is on) +- extended regression test for optional argument checking + TODO: - reflect changes in /is/objectproperty/info has/info is/ in migration guide - implement built-in-converter for "baseclass" and "metaclass"? Index: generic/gentclAPI.decls =================================================================== diff -u -r7efafd7b19c58bf0f5ac486779e8ce778e60c9bb -rf93a860bacabe371e1f01bd3f3841015c6b14a21 --- generic/gentclAPI.decls (.../gentclAPI.decls) (revision 7efafd7b19c58bf0f5ac486779e8ce778e60c9bb) +++ generic/gentclAPI.decls (.../gentclAPI.decls) (revision f93a860bacabe371e1f01bd3f3841015c6b14a21) @@ -32,7 +32,7 @@ } xotclCmd configure XOTclConfigureCmd { - {-argName "configureoption" -required 1 -type "filter|softrecreate|objectsystems|keepinitcmd|checkresult"} + {-argName "configureoption" -required 1 -type "filter|softrecreate|objectsystems|keepinitcmd|checkresults|checkarguments"} {-argName "value" -required 0 -type tclobj} } xotclCmd createobjectsystem XOTclCreateObjectSystemCmd { Index: generic/gentclAPI.tcl =================================================================== diff -u -r1008a85cf8fe5d95365568f6c765a83389028ff2 -rf93a860bacabe371e1f01bd3f3841015c6b14a21 --- generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision 1008a85cf8fe5d95365568f6c765a83389028ff2) +++ generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision f93a860bacabe371e1f01bd3f3841015c6b14a21) @@ -197,7 +197,7 @@ $intro if (ArgumentParse(interp, objc, objv, $obj, objv[0], method_definitions[$idx].paramDefs, - method_definitions[$idx].nrParameters, + method_definitions[$idx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -285,7 +285,8 @@ static int ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], XOTclObject *obj, Tcl_Obj *procName, - XOTclParam CONST *paramPtr, int nrParameters, parseContext *pc); + XOTclParam CONST *paramPtr, int nrParameters, int doCheck, + parseContext *pc); static int getMatchObject(Tcl_Interp *interp, Tcl_Obj *patternObj, Tcl_Obj *origObj, XOTclObject **matchObject, CONST char **pattern); Index: generic/tclAPI.h =================================================================== diff -u -r7efafd7b19c58bf0f5ac486779e8ce778e60c9bb -rf93a860bacabe371e1f01bd3f3841015c6b14a21 --- generic/tclAPI.h (.../tclAPI.h) (revision 7efafd7b19c58bf0f5ac486779e8ce778e60c9bb) +++ generic/tclAPI.h (.../tclAPI.h) (revision f93a860bacabe371e1f01bd3f3841015c6b14a21) @@ -79,13 +79,13 @@ static int convertToConfigureoption(Tcl_Interp *interp, Tcl_Obj *objPtr, XOTclParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; - static CONST char *opts[] = {"filter", "softrecreate", "objectsystems", "keepinitcmd", "checkresult", NULL}; + static CONST char *opts[] = {"filter", "softrecreate", "objectsystems", "keepinitcmd", "checkresults", "checkarguments", NULL}; result = Tcl_GetIndexFromObj(interp, objPtr, opts, "configureoption", 0, &index); *clientData = (ClientData) INT2PTR(index + 1); *outObjPtr = objPtr; return result; } -enum ConfigureoptionIdx {ConfigureoptionNULL, ConfigureoptionFilterIdx, ConfigureoptionSoftrecreateIdx, ConfigureoptionObjectsystemsIdx, ConfigureoptionKeepinitcmdIdx, ConfigureoptionCheckresultIdx}; +enum ConfigureoptionIdx {ConfigureoptionNULL, ConfigureoptionFilterIdx, ConfigureoptionSoftrecreateIdx, ConfigureoptionObjectsystemsIdx, ConfigureoptionKeepinitcmdIdx, ConfigureoptionCheckresultsIdx, ConfigureoptionCheckargumentsIdx}; static int convertToCurrentoption(Tcl_Interp *interp, Tcl_Obj *objPtr, XOTclParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { @@ -130,7 +130,8 @@ static int ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], XOTclObject *obj, Tcl_Obj *procName, - XOTclParam CONST *paramPtr, int nrParameters, parseContext *pc); + XOTclParam CONST *paramPtr, int nrParameters, int doCheck, + parseContext *pc); static int getMatchObject(Tcl_Interp *interp, Tcl_Obj *patternObj, Tcl_Obj *origObj, XOTclObject **matchObject, CONST char **pattern); @@ -392,7 +393,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCAllocMethodIdx].paramDefs, - method_definitions[XOTclCAllocMethodIdx].nrParameters, + method_definitions[XOTclCAllocMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -411,7 +412,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCCreateMethodIdx].paramDefs, - method_definitions[XOTclCCreateMethodIdx].nrParameters, + method_definitions[XOTclCCreateMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -430,7 +431,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCDeallocMethodIdx].paramDefs, - method_definitions[XOTclCDeallocMethodIdx].nrParameters, + method_definitions[XOTclCDeallocMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -449,7 +450,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCFilterGuardMethodIdx].paramDefs, - method_definitions[XOTclCFilterGuardMethodIdx].nrParameters, + method_definitions[XOTclCFilterGuardMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -469,7 +470,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCMixinGuardMethodIdx].paramDefs, - method_definitions[XOTclCMixinGuardMethodIdx].nrParameters, + method_definitions[XOTclCMixinGuardMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -489,7 +490,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCNewMethodIdx].paramDefs, - method_definitions[XOTclCNewMethodIdx].nrParameters, + method_definitions[XOTclCNewMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -508,7 +509,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCRecreateMethodIdx].paramDefs, - method_definitions[XOTclCRecreateMethodIdx].nrParameters, + method_definitions[XOTclCRecreateMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -527,7 +528,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoFilterguardMethodIdx].paramDefs, - method_definitions[XOTclClassInfoFilterguardMethodIdx].nrParameters, + method_definitions[XOTclClassInfoFilterguardMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -546,7 +547,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoFiltermethodsMethodIdx].paramDefs, - method_definitions[XOTclClassInfoFiltermethodsMethodIdx].nrParameters, + method_definitions[XOTclClassInfoFiltermethodsMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -566,7 +567,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoForwardMethodIdx].paramDefs, - method_definitions[XOTclClassInfoForwardMethodIdx].nrParameters, + method_definitions[XOTclClassInfoForwardMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -586,7 +587,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoHeritageMethodIdx].paramDefs, - method_definitions[XOTclClassInfoHeritageMethodIdx].nrParameters, + method_definitions[XOTclClassInfoHeritageMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -605,7 +606,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoInstancesMethodIdx].paramDefs, - method_definitions[XOTclClassInfoInstancesMethodIdx].nrParameters, + method_definitions[XOTclClassInfoInstancesMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -639,7 +640,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoMethodMethodIdx].paramDefs, - method_definitions[XOTclClassInfoMethodMethodIdx].nrParameters, + method_definitions[XOTclClassInfoMethodMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -659,7 +660,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoMethodsMethodIdx].paramDefs, - method_definitions[XOTclClassInfoMethodsMethodIdx].nrParameters, + method_definitions[XOTclClassInfoMethodsMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -682,7 +683,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoMixinOfMethodIdx].paramDefs, - method_definitions[XOTclClassInfoMixinOfMethodIdx].nrParameters, + method_definitions[XOTclClassInfoMixinOfMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -717,7 +718,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoMixinclassesMethodIdx].paramDefs, - method_definitions[XOTclClassInfoMixinclassesMethodIdx].nrParameters, + method_definitions[XOTclClassInfoMixinclassesMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -752,7 +753,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoMixinguardMethodIdx].paramDefs, - method_definitions[XOTclClassInfoMixinguardMethodIdx].nrParameters, + method_definitions[XOTclClassInfoMixinguardMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -771,7 +772,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoSlotsMethodIdx].paramDefs, - method_definitions[XOTclClassInfoSlotsMethodIdx].nrParameters, + method_definitions[XOTclClassInfoSlotsMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -790,7 +791,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoSubclassMethodIdx].paramDefs, - method_definitions[XOTclClassInfoSubclassMethodIdx].nrParameters, + method_definitions[XOTclClassInfoSubclassMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -824,7 +825,7 @@ if (!cl) return XOTclObjErrType(interp, objv[0], "Class", ""); if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclClassInfoSuperclassMethodIdx].paramDefs, - method_definitions[XOTclClassInfoSuperclassMethodIdx].nrParameters, + method_definitions[XOTclClassInfoSuperclassMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -844,7 +845,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOAutonameMethodIdx].paramDefs, - method_definitions[XOTclOAutonameMethodIdx].nrParameters, + method_definitions[XOTclOAutonameMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -865,7 +866,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOCleanupMethodIdx].paramDefs, - method_definitions[XOTclOCleanupMethodIdx].nrParameters, + method_definitions[XOTclOCleanupMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -894,7 +895,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclODestroyMethodIdx].paramDefs, - method_definitions[XOTclODestroyMethodIdx].nrParameters, + method_definitions[XOTclODestroyMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -913,7 +914,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOExistsMethodIdx].paramDefs, - method_definitions[XOTclOExistsMethodIdx].nrParameters, + method_definitions[XOTclOExistsMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -932,7 +933,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOFilterGuardMethodIdx].paramDefs, - method_definitions[XOTclOFilterGuardMethodIdx].nrParameters, + method_definitions[XOTclOFilterGuardMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -962,7 +963,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOMixinGuardMethodIdx].paramDefs, - method_definitions[XOTclOMixinGuardMethodIdx].nrParameters, + method_definitions[XOTclOMixinGuardMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -982,7 +983,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclONoinitMethodIdx].paramDefs, - method_definitions[XOTclONoinitMethodIdx].nrParameters, + method_definitions[XOTclONoinitMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1001,7 +1002,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclORequireNamespaceMethodIdx].paramDefs, - method_definitions[XOTclORequireNamespaceMethodIdx].nrParameters, + method_definitions[XOTclORequireNamespaceMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1050,7 +1051,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOVolatileMethodIdx].paramDefs, - method_definitions[XOTclOVolatileMethodIdx].nrParameters, + method_definitions[XOTclOVolatileMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1069,7 +1070,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOVwaitMethodIdx].paramDefs, - method_definitions[XOTclOVwaitMethodIdx].nrParameters, + method_definitions[XOTclOVwaitMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1088,7 +1089,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoCallableMethodIdx].paramDefs, - method_definitions[XOTclObjInfoCallableMethodIdx].nrParameters, + method_definitions[XOTclObjInfoCallableMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1113,7 +1114,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoChildrenMethodIdx].paramDefs, - method_definitions[XOTclObjInfoChildrenMethodIdx].nrParameters, + method_definitions[XOTclObjInfoChildrenMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1132,7 +1133,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoClassMethodIdx].paramDefs, - method_definitions[XOTclObjInfoClassMethodIdx].nrParameters, + method_definitions[XOTclObjInfoClassMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1151,7 +1152,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoFilterguardMethodIdx].paramDefs, - method_definitions[XOTclObjInfoFilterguardMethodIdx].nrParameters, + method_definitions[XOTclObjInfoFilterguardMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1170,7 +1171,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoFiltermethodsMethodIdx].paramDefs, - method_definitions[XOTclObjInfoFiltermethodsMethodIdx].nrParameters, + method_definitions[XOTclObjInfoFiltermethodsMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1191,7 +1192,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoForwardMethodIdx].paramDefs, - method_definitions[XOTclObjInfoForwardMethodIdx].nrParameters, + method_definitions[XOTclObjInfoForwardMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1211,7 +1212,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoHasMixinMethodIdx].paramDefs, - method_definitions[XOTclObjInfoHasMixinMethodIdx].nrParameters, + method_definitions[XOTclObjInfoHasMixinMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1230,7 +1231,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoHasTypeMethodIdx].paramDefs, - method_definitions[XOTclObjInfoHasTypeMethodIdx].nrParameters, + method_definitions[XOTclObjInfoHasTypeMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1249,7 +1250,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoHasnamespaceMethodIdx].paramDefs, - method_definitions[XOTclObjInfoHasnamespaceMethodIdx].nrParameters, + method_definitions[XOTclObjInfoHasnamespaceMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1268,7 +1269,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoIsMethodIdx].paramDefs, - method_definitions[XOTclObjInfoIsMethodIdx].nrParameters, + method_definitions[XOTclObjInfoIsMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1287,7 +1288,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoMethodMethodIdx].paramDefs, - method_definitions[XOTclObjInfoMethodMethodIdx].nrParameters, + method_definitions[XOTclObjInfoMethodMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1307,7 +1308,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoMethodsMethodIdx].paramDefs, - method_definitions[XOTclObjInfoMethodsMethodIdx].nrParameters, + method_definitions[XOTclObjInfoMethodsMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1330,7 +1331,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoMixinclassesMethodIdx].paramDefs, - method_definitions[XOTclObjInfoMixinclassesMethodIdx].nrParameters, + method_definitions[XOTclObjInfoMixinclassesMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1365,7 +1366,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoMixinguardMethodIdx].paramDefs, - method_definitions[XOTclObjInfoMixinguardMethodIdx].nrParameters, + method_definitions[XOTclObjInfoMixinguardMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1384,7 +1385,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoParentMethodIdx].paramDefs, - method_definitions[XOTclObjInfoParentMethodIdx].nrParameters, + method_definitions[XOTclObjInfoParentMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1403,7 +1404,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoPrecedenceMethodIdx].paramDefs, - method_definitions[XOTclObjInfoPrecedenceMethodIdx].nrParameters, + method_definitions[XOTclObjInfoPrecedenceMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1423,7 +1424,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoSlotObjectsMethodIdx].paramDefs, - method_definitions[XOTclObjInfoSlotObjectsMethodIdx].nrParameters, + method_definitions[XOTclObjInfoSlotObjectsMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1442,7 +1443,7 @@ if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclObjInfoVarsMethodIdx].paramDefs, - method_definitions[XOTclObjInfoVarsMethodIdx].nrParameters, + method_definitions[XOTclObjInfoVarsMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1460,7 +1461,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclAliasCmdIdx].paramDefs, - method_definitions[XOTclAliasCmdIdx].nrParameters, + method_definitions[XOTclAliasCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1483,7 +1484,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclAssertionCmdIdx].paramDefs, - method_definitions[XOTclAssertionCmdIdx].nrParameters, + method_definitions[XOTclAssertionCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1512,7 +1513,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclConfigureCmdIdx].paramDefs, - method_definitions[XOTclConfigureCmdIdx].nrParameters, + method_definitions[XOTclConfigureCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1531,7 +1532,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclCreateObjectSystemCmdIdx].paramDefs, - method_definitions[XOTclCreateObjectSystemCmdIdx].nrParameters, + method_definitions[XOTclCreateObjectSystemCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1551,7 +1552,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclCurrentCmdIdx].paramDefs, - method_definitions[XOTclCurrentCmdIdx].nrParameters, + method_definitions[XOTclCurrentCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1569,7 +1570,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclDeprecatedCmdIdx].paramDefs, - method_definitions[XOTclDeprecatedCmdIdx].nrParameters, + method_definitions[XOTclDeprecatedCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1589,7 +1590,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclDispatchCmdIdx].paramDefs, - method_definitions[XOTclDispatchCmdIdx].nrParameters, + method_definitions[XOTclDispatchCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1609,7 +1610,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclExistsVarCmdIdx].paramDefs, - method_definitions[XOTclExistsVarCmdIdx].nrParameters, + method_definitions[XOTclExistsVarCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1628,7 +1629,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclFinalizeObjCmdIdx].paramDefs, - method_definitions[XOTclFinalizeObjCmdIdx].nrParameters, + method_definitions[XOTclFinalizeObjCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1646,7 +1647,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclForwardCmdIdx].paramDefs, - method_definitions[XOTclForwardCmdIdx].nrParameters, + method_definitions[XOTclForwardCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1673,7 +1674,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclImportvarCmdIdx].paramDefs, - method_definitions[XOTclImportvarCmdIdx].nrParameters, + method_definitions[XOTclImportvarCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1691,7 +1692,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclInterpObjCmdIdx].paramDefs, - method_definitions[XOTclInterpObjCmdIdx].nrParameters, + method_definitions[XOTclInterpObjCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1709,7 +1710,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclInvalidateObjectParameterCmdIdx].paramDefs, - method_definitions[XOTclInvalidateObjectParameterCmdIdx].nrParameters, + method_definitions[XOTclInvalidateObjectParameterCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1727,7 +1728,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclIsCmdIdx].paramDefs, - method_definitions[XOTclIsCmdIdx].nrParameters, + method_definitions[XOTclIsCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1747,7 +1748,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclIsObjectCmdIdx].paramDefs, - method_definitions[XOTclIsObjectCmdIdx].nrParameters, + method_definitions[XOTclIsObjectCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1765,7 +1766,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclMethodCmdIdx].paramDefs, - method_definitions[XOTclMethodCmdIdx].nrParameters, + method_definitions[XOTclMethodCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1791,7 +1792,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclMethodPropertyCmdIdx].paramDefs, - method_definitions[XOTclMethodPropertyCmdIdx].nrParameters, + method_definitions[XOTclMethodPropertyCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1813,7 +1814,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclMyCmdIdx].paramDefs, - method_definitions[XOTclMyCmdIdx].nrParameters, + method_definitions[XOTclMyCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1832,7 +1833,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclNSCopyCmdsIdx].paramDefs, - method_definitions[XOTclNSCopyCmdsIdx].nrParameters, + method_definitions[XOTclNSCopyCmdsIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1851,7 +1852,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclNSCopyVarsIdx].paramDefs, - method_definitions[XOTclNSCopyVarsIdx].nrParameters, + method_definitions[XOTclNSCopyVarsIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1870,7 +1871,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclQualifyObjCmdIdx].paramDefs, - method_definitions[XOTclQualifyObjCmdIdx].nrParameters, + method_definitions[XOTclQualifyObjCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1888,7 +1889,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclRelationCmdIdx].paramDefs, - method_definitions[XOTclRelationCmdIdx].nrParameters, + method_definitions[XOTclRelationCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1908,7 +1909,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclSetVarCmdIdx].paramDefs, - method_definitions[XOTclSetVarCmdIdx].nrParameters, + method_definitions[XOTclSetVarCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { @@ -1928,7 +1929,7 @@ if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclSetterCmdIdx].paramDefs, - method_definitions[XOTclSetterCmdIdx].nrParameters, + method_definitions[XOTclSetterCmdIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { Index: generic/xotcl.c =================================================================== diff -u -r7efafd7b19c58bf0f5ac486779e8ce778e60c9bb -rf93a860bacabe371e1f01bd3f3841015c6b14a21 --- generic/xotcl.c (.../xotcl.c) (revision 7efafd7b19c58bf0f5ac486779e8ce778e60c9bb) +++ generic/xotcl.c (.../xotcl.c) (revision f93a860bacabe371e1f01bd3f3841015c6b14a21) @@ -216,8 +216,8 @@ static int ProcessMethodArguments(parseContext *pcPtr, Tcl_Interp *interp, XOTclObject *object, int pushFrame, XOTclParamDefs *paramDefs, CONST char *methodName, int objc, Tcl_Obj *CONST objv[]); -static int ArgumentCheck(Tcl_Interp *interp, Tcl_Obj *objPtr, struct XOTclParam CONST *pPtr, int *flags, - ClientData *clientData, Tcl_Obj **outObjPtr); +static int ArgumentCheck(Tcl_Interp *interp, Tcl_Obj *objPtr, struct XOTclParam CONST *pPtr, int doCheck, + int *flags, ClientData *clientData, Tcl_Obj **outObjPtr); static int Parametercheck(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Obj *valueObj, const char *varNamePrefix, int doCheck, XOTclParam **paramPtrPtr); @@ -5173,11 +5173,10 @@ int overflow, limit = 60, nameLen; const char *procName; - /*fprintf(stderr, "MakeProcError zzzz %p type %p refCount %d\n", + /*fprintf(stderr, "MakeProcError %p type %p refCount %d\n", procNameObj, procNameObj->typePtr, procNameObj->refCount);*/ procName = Tcl_GetStringFromObj(procNameObj, &nameLen); - /*fprintf(stderr, ".... procName = %s\n", procName);*/ overflow = (nameLen > limit); Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (procedure \"%.*s%s\" line %d)", @@ -5520,6 +5519,7 @@ CONST char *methodName = data[2]; XOTclObject *object = cscPtr->self; XOTclObjectOpt *opt = object->opt; + XOTclParamDefs *paramDefs; int rc; /*fprintf(stderr, "---- FinalizeProcMethod result %d, csc %p, pcPtr %p, obj %p\n", @@ -5532,16 +5532,15 @@ ); # endif - { XOTclParamDefs *paramDefs = ParamDefsGet(cscPtr->cmdPtr); + paramDefs = ParamDefsGet(cscPtr->cmdPtr); - if (result == TCL_OK && paramDefs && paramDefs->returns) { - Tcl_Obj *valueObj = Tcl_GetObjResult(interp); - /*fprintf(stderr, "***** we have returns for method '%s' check %s, value %p\n", - methodName, ObjStr(paramDefs->returns), valueObj);*/ - result = Parametercheck(interp, paramDefs->returns, valueObj, "return-value:", - RUNTIME_STATE(interp)->doCheckresult, - NULL); - } + if (result == TCL_OK && paramDefs && paramDefs->returns) { + Tcl_Obj *valueObj = Tcl_GetObjResult(interp); + /*fprintf(stderr, "***** we have returns for method '%s' check %s, value %p\n", + methodName, ObjStr(paramDefs->returns), valueObj);*/ + result = Parametercheck(interp, paramDefs->returns, valueObj, "return-value:", + RUNTIME_STATE(interp)->doCheckResults, + NULL); } if (opt && object->teardown && (opt->checkoptions & CHECK_POST)) { @@ -5745,7 +5744,7 @@ /*fprintf(stderr, "***** we have returns for method '%s' check %s, value %p is shared %d\n", methodName, ObjStr(paramDefs->returns), valueObj, Tcl_IsShared(valueObj));*/ result = Parametercheck(interp, paramDefs->returns, valueObj, "return-value:", - RUNTIME_STATE(interp)->doCheckresult, + RUNTIME_STATE(interp)->doCheckResults, NULL); } @@ -5834,7 +5833,7 @@ /* fprintf(stderr, "***** CMD we have returns for method '%s' check %s, value %p\n", methodName, ObjStr(paramDefs->returns), valueObj);*/ result = Parametercheck(interp, paramDefs->returns, valueObj, "return-value:", - RUNTIME_STATE(interp)->doCheckresult, + RUNTIME_STATE(interp)->doCheckResults, NULL); } } @@ -5858,12 +5857,14 @@ # define MethodDispatch __MethodDispatch__ #endif +#if 0 static Tcl_Obj* SubcmdObj(Tcl_Interp *interp, CONST char *start, size_t len) { Tcl_Obj *checker = Tcl_NewStringObj("sub=", 4); Tcl_AppendLimitedToObj(checker, start, len, INT_MAX, NULL); return checker; } +#endif static int DispatchUnknownMethod(ClientData clientData, @@ -8993,7 +8994,9 @@ int result, flags = 0; ClientData checkedData; - result = ArgumentCheck(interp, objv[1], cd->paramsPtr, &flags, &checkedData, &outObjPtr); + result = ArgumentCheck(interp, objv[1], cd->paramsPtr, + RUNTIME_STATE(interp)->doCheckArguments, + &flags, &checkedData, &outObjPtr); if (result == TCL_OK) { result = setInstVar(interp, object, objv[0], outObjPtr); @@ -9715,10 +9718,18 @@ } static int -ArgumentCheck(Tcl_Interp *interp, Tcl_Obj *objPtr, struct XOTclParam CONST *pPtr, int *flags, - ClientData *clientData, Tcl_Obj **outObjPtr) { +ArgumentCheck(Tcl_Interp *interp, Tcl_Obj *objPtr, struct XOTclParam CONST *pPtr, int doCheck, + int *flags, ClientData *clientData, Tcl_Obj **outObjPtr) { int result; + if (doCheck == 0 && (pPtr->flags & (XOTCL_ARG_IS_CONVERTER|XOTCL_ARG_INITCMD)) == 0) { + /*fprintf(stderr, "*** omit argument check for arg %s flags %.6x\n",pPtr->name, pPtr->flags);*/ + *outObjPtr = objPtr; + *clientData = ObjStr(objPtr); + *flags = 0; + return TCL_OK; + } + if (pPtr->flags & XOTCL_ARG_MULTIVALUED) { int objc, i; Tcl_Obj **ov; @@ -9756,8 +9767,8 @@ switch to the version of this handler building an output list */ - fprintf(stderr, "switch to output list construction for value %s\n", - ObjStr(elementObjPtr)); + /*fprintf(stderr, "switch to output list construction for value %s\n", + ObjStr(elementObjPtr));*/ *flags |= XOTCL_PC_MUST_DECR; result = ArgumentCheckHelper(interp, objPtr, pPtr, flags, clientData, outObjPtr); break; @@ -9837,7 +9848,9 @@ /* Check the default value, unless we have an INITCMD or METHOD */ if ((pPtr->flags & (XOTCL_ARG_INITCMD|XOTCL_ARG_METHOD)) == 0) { int mustDecrList = 0; - if (ArgumentCheck(interp, newValue, pPtr, &mustDecrList, &checkedData, &pcPtr->objv[i]) != TCL_OK) { + if (ArgumentCheck(interp, newValue, pPtr, + RUNTIME_STATE(interp)->doCheckArguments, + &mustDecrList, &checkedData, &pcPtr->objv[i]) != TCL_OK) { return TCL_ERROR; } @@ -9881,7 +9894,7 @@ static int ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], XOTclObject *object, Tcl_Obj *procNameObj, - XOTclParam CONST *paramPtr, int nrParams, + XOTclParam CONST *paramPtr, int nrParams, int doCheck, parseContext *pcPtr) { int i, o, flagCount, nrReq = 0, nrOpt = 0, dashdash = 0, nrDashdash = 0; XOTclParam CONST *pPtr; @@ -9938,8 +9951,8 @@ i, nppPtr->name, ObjStr(objv[p]), nppPtr->nrArgs, nppPtr->flags & XOTCL_ARG_REQUIRED ? "req":"not req", nppPtr->converter); #endif - if (ArgumentCheck(interp, objv[p], nppPtr, &pcPtr->flags[j], - &pcPtr->clientData[j], &pcPtr->objv[j]) != TCL_OK) { + if (ArgumentCheck(interp, objv[p], nppPtr, doCheck, + &pcPtr->flags[j], &pcPtr->clientData[j], &pcPtr->objv[j]) != TCL_OK) { return TCL_ERROR; } @@ -9996,7 +10009,9 @@ /*fprintf(stderr, "... arg %s req %d converter %p try to set on %d: '%s' convertViaCmd %p\n", pPtr->name, pPtr->flags & XOTCL_ARG_REQUIRED, pPtr->converter, i, ObjStr(objv[o]), convertViaCmd);*/ - if (ArgumentCheck(interp, objv[o], pPtr, &pcPtr->flags[i], &pcPtr->clientData[i], &pcPtr->objv[i]) != TCL_OK) { + + if (ArgumentCheck(interp, objv[o], pPtr, doCheck, + &pcPtr->flags[i], &pcPtr->clientData[i], &pcPtr->objv[i]) != TCL_OK) { return TCL_ERROR; } if (pcPtr->flags[i] & XOTCL_PC_MUST_DECR) @@ -11153,13 +11168,19 @@ RUNTIME_STATE(interp)->doKeepinitcmd = bool; break; - case ConfigureoptionCheckresultIdx: + case ConfigureoptionCheckresultsIdx: Tcl_SetBooleanObj(Tcl_GetObjResult(interp), - (RUNTIME_STATE(interp)->doCheckresult)); + (RUNTIME_STATE(interp)->doCheckResults)); if (valueObj) - RUNTIME_STATE(interp)->doCheckresult = bool; + RUNTIME_STATE(interp)->doCheckResults = bool; break; + case ConfigureoptionCheckargumentsIdx: + Tcl_SetBooleanObj(Tcl_GetObjResult(interp), + (RUNTIME_STATE(interp)->doCheckArguments)); + if (valueObj) + RUNTIME_STATE(interp)->doCheckArguments = bool; + break; } return TCL_OK; } @@ -12741,18 +12762,13 @@ paramPtr = paramWrapperPtr->paramPtr; if (paramPtrPtr) *paramPtrPtr = paramPtr; - if (paramPtr->flags & XOTCL_ARG_IS_CONVERTER) { - /* always call checker if it is a converter */ - doCheck = 1; - } - - if (!doCheck) { + /* if (!doCheck) { outObjPtr = valueObj; checkedData = ObjStr(valueObj); return TCL_OK; - } + }*/ - result = ArgumentCheck(interp, valueObj, paramPtr, &flags, &checkedData, &outObjPtr); + result = ArgumentCheck(interp, valueObj, paramPtr, doCheck, &flags, &checkedData, &outObjPtr); /*fprintf(stderr, "ParamSetFromAny paramPtr %p final refcount of wrapper %d can free %d\n", paramPtr, paramWrapperPtr->refCount, paramWrapperPtr->canFree);*/ @@ -14580,7 +14596,9 @@ } result = ArgumentParse(interp, objc, objv, object, objv[0], - paramDefs->paramsPtr, paramDefs->nrParams, pcPtr); + paramDefs->paramsPtr, paramDefs->nrParams, + RUNTIME_STATE(interp)->doCheckArguments, + pcPtr); if (object && pushFrame) { XOTcl_PopFrameObj(interp, framePtr); } @@ -15047,7 +15065,8 @@ #endif RUNTIME_STATE(interp)->doFilters = 1; - RUNTIME_STATE(interp)->doCheckresult = 1; + RUNTIME_STATE(interp)->doCheckResults = 1; + RUNTIME_STATE(interp)->doCheckArguments = 1; /* create xotcl namespace */ RUNTIME_STATE(interp)->XOTclNS = Index: generic/xotclInt.h =================================================================== diff -u -r7efafd7b19c58bf0f5ac486779e8ce778e60c9bb -rf93a860bacabe371e1f01bd3f3841015c6b14a21 --- generic/xotclInt.h (.../xotclInt.h) (revision 7efafd7b19c58bf0f5ac486779e8ce778e60c9bb) +++ generic/xotclInt.h (.../xotclInt.h) (revision f93a860bacabe371e1f01bd3f3841015c6b14a21) @@ -664,8 +664,8 @@ int doFilters; int doSoftrecreate; int doKeepinitcmd; - int doCheckresult; - int doCheckparameter; + int doCheckResults; + int doCheckArguments; int exitHandlerDestroyRound; int returnCode; int overloadedMethods; Index: library/lib/test.tcl =================================================================== diff -u -r18122dd21b99cf0d5b4cd01635048641a23aa051 -rf93a860bacabe371e1f01bd3f3841015c6b14a21 --- library/lib/test.tcl (.../test.tcl) (revision 18122dd21b99cf0d5b4cd01635048641a23aa051) +++ library/lib/test.tcl (.../test.tcl) (revision f93a860bacabe371e1f01bd3f3841015c6b14a21) @@ -43,7 +43,7 @@ # from global evals. So, this approach is not suitable for all test # (but for most). # - # Current limitations: just for xotcl2, no method/mixin cleanup/var cleanup + # Current limitations: just for nx::Objects, no method/mixin cleanup/var cleanup # set :case $name if {[info exists arg]} { @@ -73,9 +73,9 @@ set testfile [file rootname [file tail [info script]]] if {[info exists :case]} { if {![info exists :ccount(${:case})]} {set :ccount(${:case}) 0} - set :name $testfile-${:case}.[format %.3d [incr :ccount(${:case})]] + set :name $testfile/${:case}.[format %.3d [incr :ccount(${:case})]] } else { - set :name $testfile-t.[format %.3d [incr :count]] + set :name $testfile/t.[format %.3d [incr :count]] } :create ${:name} -name ${:name} {*}$args } Index: tests/parameters.tcl =================================================================== diff -u -r7efafd7b19c58bf0f5ac486779e8ce778e60c9bb -rf93a860bacabe371e1f01bd3f3841015c6b14a21 --- tests/parameters.tcl (.../parameters.tcl) (revision 7efafd7b19c58bf0f5ac486779e8ce778e60c9bb) +++ tests/parameters.tcl (.../parameters.tcl) (revision f93a860bacabe371e1f01bd3f3841015c6b14a21) @@ -92,6 +92,10 @@ #? {::nsf::is object o -type C} 0 #? {::nsf::is object o -hasmixin C} 0 + # scripted checker + ? {::nsf::is metaclass ::nx::Class} 1 + ? {::nsf::is metaclass ::nx::Object} 0 + ? {::nsf::is -complain class o1} {expected class but got "o1" for parameter value} ? {::nsf::is class o1} 0 ? {::nsf::is -complain class Test} 1 @@ -1111,6 +1115,75 @@ ? {c1 b 101} {::c1: unable to dispatch method 'b'} ? {c1 c 102} {::c1: unable to dispatch method 'c'} } + +Test parameter count 10000 +Test case check-arguments { + + Class create Foo { + :method noarg {} {return ""} + :method onearg {x} {return $x} + :method intarg {x:integer} {return $x} + :method intsarg {x:integer,multivalued} {return $x} + :method boolarg {x:boolean} {return $x} + :method classarg {x:class} {return $x} + :method upperarg {x:upper} {return $x} + :method metaclassarg {x:metaclass} {return $x} + :create f1 + } + + ? {f1 noarg} "" + ? {f1 onearg 1} 1 + # built-in checker + ? {f1 intarg 1} 1 + ? {f1 intarg a} {expected integer but got "a" for parameter x} + ? {f1 intsarg {10 11 12}} {10 11 12} + ? {f1 intsarg {10 11 1a2}} {invalid value in "10 11 1a2": expected integer but got "1a2" for parameter x} + ? {f1 boolarg 1} 1 + ? {f1 boolarg a} {expected boolean value but got "a" for parameter x} + ? {f1 classarg ::Foo} ::Foo + ? {f1 classarg f1} {expected class but got "f1" for parameter x} + # tcl checker + ? {f1 upperarg ABC} ABC + ? {f1 upperarg abc} {expected upper but got "abc" for parameter x} + # scripted checker + ? {f1 metaclassarg ::nx::Class} ::nx::Class + ? {f1 metaclassarg ::Foo} {expected metaclass but got "::Foo" for parameter x} +} + +::nsf::configure checkarguments off +Test case check-arguments-nocheck { + + Class create Foo { + :method noarg {} {return ""} + :method onearg {x} {return $x} + :method intarg {x:integer} {return $x} + :method intsarg {x:integer,multivalued} {return $x} + :method boolarg {x:boolean} {return $x} + :method classarg {x:class} {return $x} + :method upperarg {x:upper} {return $x} + :method metaclassarg {x:metaclass} {return $x} + :create f1 + } + + ? {f1 noarg} "" + ? {f1 onearg 1} 1 + # built-in checker + ? {f1 intarg 1} 1 + ? {f1 intarg a} a + ? {f1 intsarg {10 11 12}} {10 11 12} + ? {f1 intsarg {10 11 1a2}} {10 11 1a2} + ? {f1 boolarg 1} 1 + ? {f1 boolarg a} a + ? {f1 classarg ::Foo} ::Foo + ? {f1 classarg f1} f1 + # tcl checker + ? {f1 upperarg ABC} ABC + ? {f1 upperarg abc} abc + # scripted checker + ? {f1 metaclassarg ::nx::Class} ::nx::Class + ? {f1 metaclassarg ::Foo} ::Foo +} + ## TODO regression test for type checking, parameter options (initcmd, ## substdefault, combinations with defaults, ...), etc. Index: tests/returns.tcl =================================================================== diff -u -r7efafd7b19c58bf0f5ac486779e8ce778e60c9bb -rf93a860bacabe371e1f01bd3f3841015c6b14a21 --- tests/returns.tcl (.../returns.tcl) (revision 7efafd7b19c58bf0f5ac486779e8ce778e60c9bb) +++ tests/returns.tcl (.../returns.tcl) (revision f93a860bacabe371e1f01bd3f3841015c6b14a21) @@ -9,7 +9,7 @@ # ::nsf::configure checkresult true -Test parameter count 10 +Test parameter count 10000 Test case int-returns { nx::Class create C { # scripted method without paramdefs @@ -34,7 +34,7 @@ ? {c1 bar-nok 1 2} {expected integer but got "a" for parameter return-value} ? {c1 incr x} 1 - ? {c1 incr x} 12 + ? {c1 incr x} 10002 ? {c1 lappend l e1} {expected integer but got "e1" for parameter return-value} @@ -43,8 +43,14 @@ # reset it to emtpy ? {::nsf::methodproperty C lappend returns ""} "" + ? {::nsf::methodproperty C bar-ok1 returns ""} "" + ? {::nsf::methodproperty C bar-ok2 returns ""} "" + ? {::nsf::methodproperty C bar-nok returns ""} "" - # no checking on lappend + # no checking + ? {c1 bar-ok1 1 2} 1 + ? {c1 bar-ok2 1 2} 1 + ? {c1 bar-nok 1 2} a ? {c1 lappend l e2} "e1 e2" # query returns "", if there is no returns checking @@ -53,6 +59,7 @@ } +Test parameter count 10 Test case app-specific-returns { ::nx::methodParameterSlot method type=range {name value arg} { @@ -88,6 +95,7 @@ ? {c1 lappend l e1} {Value 'e1' of parameter return-value not between 1 and 30} } +Test parameter count 1000 Test case converting-returns { ::nx::methodParameterSlot method type=sex {name value args} { @@ -141,9 +149,9 @@ # # turn off result checking # -::nsf::configure checkresult false +::nsf::configure checkresults false -Test parameter count 10 +Test parameter count 10000 Test case int-returns-nocheck { nx::Class create C { # scripted method without paramdefs @@ -168,7 +176,7 @@ ? {c1 bar-nok 1 2} a ? {c1 incr x} 1 - ? {c1 incr x} 12 + ? {c1 incr x} 10002 ? {c1 lappend l e1} e1 @@ -188,6 +196,7 @@ } +Test parameter count 10 Test case app-specific-returns-nocheck { ::nx::methodParameterSlot method type=range {name value arg} { @@ -223,6 +232,7 @@ ? {c1 lappend l e1} e1 } +Test parameter count 1000 Test case converting-returns-nocheck { ::nx::methodParameterSlot method type=sex {name value args} {