Index: generic/gentclAPI.tcl =================================================================== diff -u -r300e593347cf3f13d62ac4d21299a2278ff83d5e -rf4471765bb7aec8c793b5e365499726619119f63 --- generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision 300e593347cf3f13d62ac4d21299a2278ff83d5e) +++ generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision f4471765bb7aec8c793b5e365499726619119f63) @@ -168,13 +168,13 @@ set arglist [join $a ", "] } -proc genStub {stub intro idx cDefs pre call post} { +proc genStub {stub intro obj idx cDefs pre call post} { return [subst -nocommands { static int ${stub}(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; $intro - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, $obj, objv[0], method_definitions[$idx].paramDefs, method_definitions[$idx].nrParameters, &pc) != TCL_OK) { @@ -219,7 +219,7 @@ set nrArgs [llength $d(parameterDefinitions)] set stubDecl "static int $d(stub)$::objCmdProc\n" set ifd "{\"$::ns($d(methodType))::$d(methodName)\", $d(stub), $nrArgs, {\n [genifd $d(parameterDefinitions)]}\n}" - + gencall $d(stub) $d(parameterDefinitions) $d(clientData) cDefs ifDef arglist pre post intro append decls "static int [implArgList $d(implementation) {Tcl_Interp *} $ifDef];\n" if {$post ne ""} { @@ -230,7 +230,7 @@ } else { set call "return [implArgList $d(implementation) {} $arglist];" } - + #if {$nrArgs == 1} { puts stderr "$d(stub) => '$arglist'" } if {$nrArgs == 1 && $arglist eq "objc, objv"} { # TODO we would not need to generate a stub at all.... @@ -242,12 +242,17 @@ #puts stderr "$d(stub) => '$arglist'" append fns [genSimpleStub $d(stub) $intro $d(idx) $cDefs $pre $call $post] } else { - append fns [genStub $d(stub) $intro $d(idx) $cDefs $pre $call $post] + switch $d(methodType) { + objectMethod {set obj "obj"} + classMethod {set obj "(XOTclObject *) cl"} + default {set obj "NULL"} + } + append fns [genStub $d(stub) $intro $obj $d(idx) $cDefs $pre $call $post] } lappend ifds $ifd append stubDecls $stubDecl } - + puts $::converter puts { typedef struct { @@ -257,8 +262,9 @@ parameterDefinition paramDefs[10]; } methodDefinition; -static int ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *procName, - parameterDefinition CONST *paramPtr, int nrParameters, parseContext *pc); +static int ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], + XOTclObject *obj, Tcl_Obj *procName, + parameterDefinition CONST *paramPtr, int nrParameters, parseContext *pc); static int getMatchObject(Tcl_Interp *interp, Tcl_Obj *patternObj, Tcl_Obj *origObj, XOTclObject **matchObject, char **pattern); Index: generic/predefined.h =================================================================== diff -u -r0f1d08f0090b3cb676b82f049bae6fe354d331ff -rf4471765bb7aec8c793b5e365499726619119f63 --- generic/predefined.h (.../predefined.h) (revision 0f1d08f0090b3cb676b82f049bae6fe354d331ff) +++ generic/predefined.h (.../predefined.h) (revision f4471765bb7aec8c793b5e365499726619119f63) @@ -86,7 +86,7 @@ "lappend opts [$slot type]}\n" "if {[$slot exists default]} {\n" "set arg [$slot set default]\n" -"if {[string match {*\\[*\\]*} $arg] || [string first $arg {$}] > -1} {\n" +"if {[string match {*\\[*\\]*} $arg]} {\n" "lappend opts substdefault}} elseif {[$slot exists initcmd]} {\n" "set arg [$slot set initcmd]\n" "lappend opts initcmd}\n" @@ -256,7 +256,6 @@ "\\[list [::xotcl::self] __default_from_cmd \\[::xotcl::self\\] [list [::xotcl::my initcmd]]\\]\\n\"} elseif [::xotcl::my exists valuecmd] {\n" "append __initcmd \"::xotcl::my trace add variable [list $name] read \\\n" "\\[list [::xotcl::self] __value_from_cmd \\[::xotcl::self\\] [list [::xotcl::my valuecmd]]\\]\"}\n" -"append __initcmd [::xotcl::my mk_type_checker]\n" "if {[::xotcl::my exists valuechangedcmd]} {\n" "append __initcmd \"::xotcl::my trace add variable [list $name] write \\\n" "\\[list [::xotcl::self] __value_changed_cmd \\[::xotcl::self\\] [list [::xotcl::my valuechangedcmd]]\\]\"}\n" Index: generic/predefined.xotcl =================================================================== diff -u -r0f1d08f0090b3cb676b82f049bae6fe354d331ff -rf4471765bb7aec8c793b5e365499726619119f63 --- generic/predefined.xotcl (.../predefined.xotcl) (revision 0f1d08f0090b3cb676b82f049bae6fe354d331ff) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision f4471765bb7aec8c793b5e365499726619119f63) @@ -206,7 +206,8 @@ } if {[$slot exists default]} { set arg [$slot set default] - if {[string match {*\[*\]*} $arg] || [string first $arg {$}] > -1} { + # deactivated for now: || [string first {$} $arg] > -1 + if {[string match {*\[*\]*} $arg]} { lappend opts substdefault } } elseif {[$slot exists initcmd]} { @@ -347,15 +348,6 @@ #todo could be done via slotoptimizer #puts stderr "Slot [self] (name $name) init $domain calls invalidateobjectparameter" $domain invalidateobjectparameter - # TODO: the following line should not be here. It is necessary to handle currently - # computed default values, such as - # {name "[namespace tail [::xotcl::self]]"} - # - # Computed defaults could not be cached. Options: - # - define a new converter type and delay for set value - # - invent some non-caching (not preferable). - # - #[my info class] invalidateobjectparameter } #puts stderr "???? $domain $forwarder $name -default [$manager defaultmethods] $manager %1 %self %proc" $domain $forwarder $name -default [$manager defaultmethods] $manager %1 %self %proc @@ -538,7 +530,7 @@ append __initcmd "::xotcl::my trace add variable [list $name] read \ \[list [::xotcl::self] __value_from_cmd \[::xotcl::self\] [list [::xotcl::my valuecmd]]\]" } - append __initcmd [::xotcl::my mk_type_checker] + #append __initcmd [::xotcl::my mk_type_checker] if {[::xotcl::my exists valuechangedcmd]} { append __initcmd "::xotcl::my trace add variable [list $name] write \ \[list [::xotcl::self] __value_changed_cmd \[::xotcl::self\] [list [::xotcl::my valuechangedcmd]]\]" Index: generic/tclAPI.h =================================================================== diff -u -r300e593347cf3f13d62ac4d21299a2278ff83d5e -rf4471765bb7aec8c793b5e365499726619119f63 --- generic/tclAPI.h (.../tclAPI.h) (revision 300e593347cf3f13d62ac4d21299a2278ff83d5e) +++ generic/tclAPI.h (.../tclAPI.h) (revision f4471765bb7aec8c793b5e365499726619119f63) @@ -25,8 +25,9 @@ parameterDefinition paramDefs[10]; } methodDefinition; -static int ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *procName, - parameterDefinition CONST *paramPtr, int nrParameters, parseContext *pc); +static int ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], + XOTclObject *obj, Tcl_Obj *procName, + parameterDefinition CONST *paramPtr, int nrParameters, parseContext *pc); static int getMatchObject(Tcl_Interp *interp, Tcl_Obj *patternObj, Tcl_Obj *origObj, XOTclObject **matchObject, char **pattern); @@ -357,7 +358,7 @@ XOTclCheckBooleanArgsStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclCheckBooleanArgsIdx].paramDefs, method_definitions[XOTclCheckBooleanArgsIdx].nrParameters, &pc) != TCL_OK) { @@ -376,7 +377,7 @@ XOTclCheckRequiredArgsStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclCheckRequiredArgsIdx].paramDefs, method_definitions[XOTclCheckRequiredArgsIdx].nrParameters, &pc) != TCL_OK) { @@ -396,7 +397,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCAllocMethodIdx].paramDefs, method_definitions[XOTclCAllocMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -415,7 +416,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCCreateMethodIdx].paramDefs, method_definitions[XOTclCCreateMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -434,7 +435,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCDeallocMethodIdx].paramDefs, method_definitions[XOTclCDeallocMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -453,7 +454,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCInstFilterGuardMethodIdx].paramDefs, method_definitions[XOTclCInstFilterGuardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -473,7 +474,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCInstForwardMethodIdx].paramDefs, method_definitions[XOTclCInstForwardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -499,7 +500,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCInstMixinGuardMethodIdx].paramDefs, method_definitions[XOTclCInstMixinGuardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -519,7 +520,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCInstParametercmdMethodIdx].paramDefs, method_definitions[XOTclCInstParametercmdMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -538,7 +539,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCInstProcMethodIdx].paramDefs, method_definitions[XOTclCInstProcMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -561,7 +562,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCInstProcMethodCIdx].paramDefs, method_definitions[XOTclCInstProcMethodCIdx].nrParameters, &pc) != TCL_OK) { @@ -584,7 +585,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCInvalidateObjectParameterMethodIdx].paramDefs, method_definitions[XOTclCInvalidateObjectParameterMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -603,7 +604,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCInvariantsMethodIdx].paramDefs, method_definitions[XOTclCInvariantsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -622,7 +623,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCNewMethodIdx].paramDefs, method_definitions[XOTclCNewMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -641,7 +642,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCRecreateMethodIdx].paramDefs, method_definitions[XOTclCRecreateMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -660,7 +661,7 @@ parseContext pc; XOTclClass *cl = XOTclObjectToClass(clientData); if (!cl) return XOTclObjErrType(interp, objv[0], "Class"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, (XOTclObject *) cl, objv[0], method_definitions[XOTclCUnknownMethodIdx].paramDefs, method_definitions[XOTclCUnknownMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -678,7 +679,7 @@ XOTclClassInfoHeritageMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoHeritageMethodIdx].paramDefs, method_definitions[XOTclClassInfoHeritageMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -697,7 +698,7 @@ XOTclClassInfoInstancesMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstancesMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstancesMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -731,7 +732,7 @@ XOTclClassInfoInstargsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstargsMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstargsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -750,7 +751,7 @@ XOTclClassInfoInstbodyMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstbodyMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstbodyMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -769,7 +770,7 @@ XOTclClassInfoInstcommandsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstcommandsMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstcommandsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -788,7 +789,7 @@ XOTclClassInfoInstdefaultMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstdefaultMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstdefaultMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -809,7 +810,7 @@ XOTclClassInfoInstfilterMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstfilterMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstfilterMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -829,7 +830,7 @@ XOTclClassInfoInstfilterguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstfilterguardMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstfilterguardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -848,7 +849,7 @@ XOTclClassInfoInstforwardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstforwardMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstforwardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -868,7 +869,7 @@ XOTclClassInfoInstinvarMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstinvarMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstinvarMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -886,7 +887,7 @@ XOTclClassInfoInstmixinMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstmixinMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstmixinMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -921,7 +922,7 @@ XOTclClassInfoInstmixinguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstmixinguardMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstmixinguardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -940,7 +941,7 @@ XOTclClassInfoInstmixinofMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstmixinofMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstmixinofMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -974,7 +975,7 @@ XOTclClassInfoInstnonposargsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstnonposargsMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstnonposargsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -993,7 +994,7 @@ XOTclClassInfoInstparametercmdMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstparametercmdMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstparametercmdMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1012,7 +1013,7 @@ XOTclClassInfoInstpostMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstpostMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstpostMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1031,7 +1032,7 @@ XOTclClassInfoInstpreMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstpreMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstpreMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1050,7 +1051,7 @@ XOTclClassInfoInstprocsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoInstprocsMethodIdx].paramDefs, method_definitions[XOTclClassInfoInstprocsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1069,7 +1070,7 @@ XOTclClassInfoMixinofMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoMixinofMethodIdx].paramDefs, method_definitions[XOTclClassInfoMixinofMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1103,7 +1104,7 @@ XOTclClassInfoParameterMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoParameterMethodIdx].paramDefs, method_definitions[XOTclClassInfoParameterMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1121,7 +1122,7 @@ XOTclClassInfoSlotsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoSlotsMethodIdx].paramDefs, method_definitions[XOTclClassInfoSlotsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1139,7 +1140,7 @@ XOTclClassInfoSubclassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoSubclassMethodIdx].paramDefs, method_definitions[XOTclClassInfoSubclassMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1173,7 +1174,7 @@ XOTclClassInfoSuperclassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclClassInfoSuperclassMethodIdx].paramDefs, method_definitions[XOTclClassInfoSuperclassMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1193,7 +1194,7 @@ XOTclObjInfoArgsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoArgsMethodIdx].paramDefs, method_definitions[XOTclObjInfoArgsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1212,7 +1213,7 @@ XOTclObjInfoBodyMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoBodyMethodIdx].paramDefs, method_definitions[XOTclObjInfoBodyMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1231,7 +1232,7 @@ XOTclObjInfoCheckMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoCheckMethodIdx].paramDefs, method_definitions[XOTclObjInfoCheckMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1249,7 +1250,7 @@ XOTclObjInfoChildrenMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoChildrenMethodIdx].paramDefs, method_definitions[XOTclObjInfoChildrenMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1268,7 +1269,7 @@ XOTclObjInfoClassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoClassMethodIdx].paramDefs, method_definitions[XOTclObjInfoClassMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1286,7 +1287,7 @@ XOTclObjInfoCommandsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoCommandsMethodIdx].paramDefs, method_definitions[XOTclObjInfoCommandsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1305,7 +1306,7 @@ XOTclObjInfoDefaultMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoDefaultMethodIdx].paramDefs, method_definitions[XOTclObjInfoDefaultMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1326,7 +1327,7 @@ XOTclObjInfoFilterMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoFilterMethodIdx].paramDefs, method_definitions[XOTclObjInfoFilterMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1347,7 +1348,7 @@ XOTclObjInfoFilterguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoFilterguardMethodIdx].paramDefs, method_definitions[XOTclObjInfoFilterguardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1366,7 +1367,7 @@ XOTclObjInfoForwardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoForwardMethodIdx].paramDefs, method_definitions[XOTclObjInfoForwardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1386,7 +1387,7 @@ XOTclObjInfoHasnamespaceMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoHasnamespaceMethodIdx].paramDefs, method_definitions[XOTclObjInfoHasnamespaceMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1404,7 +1405,7 @@ XOTclObjInfoInvarMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoInvarMethodIdx].paramDefs, method_definitions[XOTclObjInfoInvarMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1422,7 +1423,7 @@ XOTclObjInfoMethodsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoMethodsMethodIdx].paramDefs, method_definitions[XOTclObjInfoMethodsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1445,7 +1446,7 @@ XOTclObjInfoMixinMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoMixinMethodIdx].paramDefs, method_definitions[XOTclObjInfoMixinMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1480,7 +1481,7 @@ XOTclObjInfoMixinguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoMixinguardMethodIdx].paramDefs, method_definitions[XOTclObjInfoMixinguardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1499,7 +1500,7 @@ XOTclObjInfoNonposargsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoNonposargsMethodIdx].paramDefs, method_definitions[XOTclObjInfoNonposargsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1518,7 +1519,7 @@ XOTclObjInfoParametercmdMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoParametercmdMethodIdx].paramDefs, method_definitions[XOTclObjInfoParametercmdMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1537,7 +1538,7 @@ XOTclObjInfoParentMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoParentMethodIdx].paramDefs, method_definitions[XOTclObjInfoParentMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1555,7 +1556,7 @@ XOTclObjInfoPostMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoPostMethodIdx].paramDefs, method_definitions[XOTclObjInfoPostMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1574,7 +1575,7 @@ XOTclObjInfoPreMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoPreMethodIdx].paramDefs, method_definitions[XOTclObjInfoPreMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1593,7 +1594,7 @@ XOTclObjInfoPrecedenceMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoPrecedenceMethodIdx].paramDefs, method_definitions[XOTclObjInfoPrecedenceMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1613,7 +1614,7 @@ XOTclObjInfoProcsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoProcsMethodIdx].paramDefs, method_definitions[XOTclObjInfoProcsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1632,7 +1633,7 @@ XOTclObjInfoSlotObjectsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoSlotObjectsMethodIdx].paramDefs, method_definitions[XOTclObjInfoSlotObjectsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1651,7 +1652,7 @@ XOTclObjInfoVarsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclObjInfoVarsMethodIdx].paramDefs, method_definitions[XOTclObjInfoVarsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1671,7 +1672,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOAutonameMethodIdx].paramDefs, method_definitions[XOTclOAutonameMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1692,7 +1693,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOCheckMethodIdx].paramDefs, method_definitions[XOTclOCheckMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1711,7 +1712,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOCleanupMethodIdx].paramDefs, method_definitions[XOTclOCleanupMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1740,7 +1741,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclODestroyMethodIdx].paramDefs, method_definitions[XOTclODestroyMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1759,7 +1760,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOExistsMethodIdx].paramDefs, method_definitions[XOTclOExistsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1778,7 +1779,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOFilterGuardMethodIdx].paramDefs, method_definitions[XOTclOFilterGuardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1798,7 +1799,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOFilterSearchMethodIdx].paramDefs, method_definitions[XOTclOFilterSearchMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1817,7 +1818,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOForwardMethodIdx].paramDefs, method_definitions[XOTclOForwardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1853,7 +1854,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOInvariantsMethodIdx].paramDefs, method_definitions[XOTclOInvariantsMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1872,7 +1873,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOIsClassMethodIdx].paramDefs, method_definitions[XOTclOIsClassMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1891,7 +1892,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOIsMetaClassMethodIdx].paramDefs, method_definitions[XOTclOIsMetaClassMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1910,7 +1911,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOIsMixinMethodIdx].paramDefs, method_definitions[XOTclOIsMixinMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1929,7 +1930,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOIsObjectMethodIdx].paramDefs, method_definitions[XOTclOIsObjectMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1948,7 +1949,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOIsTypeMethodIdx].paramDefs, method_definitions[XOTclOIsTypeMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1967,7 +1968,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOMixinGuardMethodIdx].paramDefs, method_definitions[XOTclOMixinGuardMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -1997,7 +1998,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclONoinitMethodIdx].paramDefs, method_definitions[XOTclONoinitMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -2016,7 +2017,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOParametercmdMethodIdx].paramDefs, method_definitions[XOTclOParametercmdMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -2035,7 +2036,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOProcMethodIdx].paramDefs, method_definitions[XOTclOProcMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -2058,7 +2059,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOProcSearchMethodIdx].paramDefs, method_definitions[XOTclOProcSearchMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -2077,7 +2078,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclORequireNamespaceMethodIdx].paramDefs, method_definitions[XOTclORequireNamespaceMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -2096,7 +2097,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOSetMethodIdx].paramDefs, method_definitions[XOTclOSetMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -2146,7 +2147,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOVolatileMethodIdx].paramDefs, method_definitions[XOTclOVolatileMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -2165,7 +2166,7 @@ parseContext pc; XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object"); - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, obj, objv[0], method_definitions[XOTclOVwaitMethodIdx].paramDefs, method_definitions[XOTclOVwaitMethodIdx].nrParameters, &pc) != TCL_OK) { @@ -2183,7 +2184,7 @@ XOTclAliasCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclAliasCmdIdx].paramDefs, method_definitions[XOTclAliasCmdIdx].nrParameters, &pc) != TCL_OK) { @@ -2206,7 +2207,7 @@ XOTclConfigureCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclConfigureCmdIdx].paramDefs, method_definitions[XOTclConfigureCmdIdx].nrParameters, &pc) != TCL_OK) { @@ -2225,7 +2226,7 @@ XOTclCreateObjectSystemCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclCreateObjectSystemCmdIdx].paramDefs, method_definitions[XOTclCreateObjectSystemCmdIdx].nrParameters, &pc) != TCL_OK) { @@ -2244,7 +2245,7 @@ XOTclDeprecatedCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclDeprecatedCmdIdx].paramDefs, method_definitions[XOTclDeprecatedCmdIdx].nrParameters, &pc) != TCL_OK) { @@ -2263,7 +2264,7 @@ XOTclFinalizeObjCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclFinalizeObjCmdIdx].paramDefs, method_definitions[XOTclFinalizeObjCmdIdx].nrParameters, &pc) != TCL_OK) { @@ -2290,7 +2291,7 @@ XOTclMethodPropertyCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclMethodPropertyCmdIdx].paramDefs, method_definitions[XOTclMethodPropertyCmdIdx].nrParameters, &pc) != TCL_OK) { @@ -2312,7 +2313,7 @@ XOTclMyCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclMyCmdIdx].paramDefs, method_definitions[XOTclMyCmdIdx].nrParameters, &pc) != TCL_OK) { @@ -2331,7 +2332,7 @@ XOTclRelationCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclRelationCmdIdx].paramDefs, method_definitions[XOTclRelationCmdIdx].nrParameters, &pc) != TCL_OK) { @@ -2351,7 +2352,7 @@ XOTclSetInstvarCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; - if (ArgumentParse(interp, objc, objv, objv[0], + if (ArgumentParse(interp, objc, objv, NULL, objv[0], method_definitions[XOTclSetInstvarCmdIdx].paramDefs, method_definitions[XOTclSetInstvarCmdIdx].nrParameters, &pc) != TCL_OK) { Index: generic/xotcl.c =================================================================== diff -u -r300e593347cf3f13d62ac4d21299a2278ff83d5e -rf4471765bb7aec8c793b5e365499726619119f63 --- generic/xotcl.c (.../xotcl.c) (revision 300e593347cf3f13d62ac4d21299a2278ff83d5e) +++ generic/xotcl.c (.../xotcl.c) (revision f4471765bb7aec8c793b5e365499726619119f63) @@ -156,15 +156,16 @@ int objc; int mustDecr; int varArgs; + XOTclObject *obj; } parseContext; #if defined(CANONICAL_ARGS) int ProcessMethodArguments(parseContext *pcPtr, Tcl_Interp *interp, - XOTclObject *obj, XOTclParamDefs *paramDefs, + XOTclObject *obj, int pushFrame, XOTclParamDefs *paramDefs, char *methodName, int objc, Tcl_Obj *CONST objv[]); #endif -void parseContextInit(parseContext *pc, int objc, Tcl_Obj *procName) { +void parseContextInit(parseContext *pc, int objc, XOTclObject *obj, Tcl_Obj *procName) { if (objc < PARSE_CONTEXT_PREALLOC) { /* the single larger memset below .... */ memset(pc, 0, sizeof(parseContext)); @@ -185,6 +186,7 @@ } pc->objv = &pc->full_objv[1]; pc->full_objv[0] = procName; + pc->obj = obj; } void parseContextExtendObjv(parseContext *pc, int from, int elts, Tcl_Obj *CONST source[]) { @@ -972,10 +974,13 @@ if (cls) { if (cl) *cl = cls; return TCL_OK; + } else { + /* flag, that we could not convert so far */ + result = TCL_ERROR; } } - /*fprintf(stderr,"try unknown\n");*/ + /*fprintf(stderr,"try unknown, result so far is %d\n",result);*/ if (base) { Tcl_Obj *ov[3]; ov[0] = base->object.cmdName; @@ -4999,8 +5004,8 @@ if (paramDefs) { parseContext pc; - result = ProcessMethodArguments(&pc, interp, obj, paramDefs, methodName, objc, objv); - /* TODO: check potential leak for */ + + result = ProcessMethodArguments(&pc, interp, obj, 1, paramDefs, methodName, objc, objv); if (result == TCL_OK) { result = PushProcCallFrame(cp, interp, pc.objc, pc.full_objv, csc); /* maybe release is to early */ @@ -5586,6 +5591,7 @@ /* * type converter */ +/* we could define parameterTypes with a converter, setter, canCheck, name */ static int convertToString(Tcl_Interp *interp, Tcl_Obj *objPtr, ClientData *clientData) { *clientData = (char *)ObjStr(objPtr); return TCL_OK; @@ -5612,9 +5618,15 @@ static int convertToSwitch(Tcl_Interp *interp, Tcl_Obj *objPtr, ClientData *clientData) { return convertToBoolean(interp, objPtr, clientData); } +static int convertToObject(Tcl_Interp *interp, Tcl_Obj *objPtr, ClientData *clientData) { + if (GetObjectFromObj(interp, objPtr, (XOTclObject **)clientData) == TCL_OK) + return TCL_OK; + return XOTclObjErrType(interp, objPtr, "object"); +} static int convertToClass(Tcl_Interp *interp, Tcl_Obj *objPtr, ClientData *clientData) { - if (GetClassFromObj(interp, objPtr, (XOTclClass **)clientData, 0) == TCL_OK) + if (GetClassFromObj(interp, objPtr, (XOTclClass **)clientData, 0) == TCL_OK) { return TCL_OK; + } return XOTclObjErrType(interp, objPtr, "class"); } @@ -5626,13 +5638,6 @@ return TCL_OK; } - -static int convertToObject(Tcl_Interp *interp, Tcl_Obj *objPtr, ClientData *clientData) { - if (GetObjectFromObj(interp, objPtr, (XOTclObject **)clientData) == TCL_OK) - return TCL_OK; - return XOTclObjErrType(interp, objPtr, "object"); -} - static int convertToObjpattern(Tcl_Interp *interp, Tcl_Obj *objPtr, ClientData *clientData) { Tcl_Obj *patternObj = objPtr; char *pattern = ObjStr(objPtr); @@ -9041,7 +9046,8 @@ #include "tclAPI.h" static int -ArgumentError(Tcl_Interp *interp, char *errorMsg, parameterDefinition CONST *paramPtr, Tcl_Obj *procNameObj) { +ArgumentError(Tcl_Interp *interp, char *errorMsg, parameterDefinition CONST *paramPtr, + Tcl_Obj *cmdNameObj, Tcl_Obj *methodNameObj) { Tcl_Obj *argStringObj = Tcl_NewStringObj("", 0); parameterDefinition CONST *aPtr; @@ -9060,20 +9066,19 @@ Tcl_AppendToObj(argStringObj, "?", 1); } } - XOTclObjWrongArgs(interp, errorMsg, procNameObj, NULL, ObjStr(argStringObj)); + XOTclObjWrongArgs(interp, errorMsg, cmdNameObj, methodNameObj, ObjStr(argStringObj)); DECR_REF_COUNT(argStringObj); return TCL_ERROR; } int ArgumentDefaults(parseContext *pcPtr, Tcl_Interp *interp, - XOTclObject *obj, /* if provided, we might have to push the frame */ - parameterDefinition CONST *ifd, int nrParameters, char *methodName) { + parameterDefinition CONST *ifd, int nrParameters) { parameterDefinition CONST *aPtr; int i, rc; for (aPtr = ifd, i=0; i %p %p, default %s\n", + /*fprintf(stderr, "ArgumentDefaults got for arg %s (%d) => %p %p, default %s\n", aPtr->name, aPtr->flags & XOTCL_ARG_REQUIRED, pcPtr->clientData[i], pcPtr->objv[i], aPtr->defaultValue ? ObjStr(aPtr->defaultValue) : "NONE");*/ @@ -9091,11 +9096,12 @@ if (aPtr->defaultValue) { Tcl_Obj *newValue = aPtr->defaultValue; + ClientData checkedData; /* we have a default, do we have to subst it? */ if (aPtr->flags & XOTCL_ARG_SUBST_DEFAULT) { - rc = SubstValue(interp, obj, &newValue); + rc = SubstValue(interp, pcPtr->obj, &newValue); if (rc != TCL_OK) { return rc; } @@ -9109,11 +9115,20 @@ } pcPtr->objv[i] = newValue; - /* TODO: default value is not jet checked; could be done (without subt) in arg parsing */ - /*fprintf(stderr,"==> setting default value '%s' for var '%s'\n",ObjStr(newValue),aPtr->name);*/ - + /*fprintf(stderr,"==> setting default value '%s' for var '%s' flag %d type %s conv %p\n", + ObjStr(newValue),aPtr->name, aPtr->flags & XOTCL_ARG_INITCMD, + aPtr->type, aPtr->converter);*/ + + /* Check the default value, unless we have an INITCMD */ + if ((aPtr->flags & XOTCL_ARG_INITCMD) == 0) { + if ((*aPtr->converter)(interp, newValue, &checkedData) != TCL_OK) { + return TCL_ERROR; + } + } } else if (aPtr->flags & XOTCL_ARG_REQUIRED) { - return XOTclVarErrMsg(interp, "method ", methodName, ": required argument '", + return XOTclVarErrMsg(interp, + pcPtr->obj ? objectName(pcPtr->obj) : "", pcPtr->obj ? " " : "", + ObjStr(pcPtr->full_objv[0]), ": required argument '", ObjStr(aPtr->nameObj), "' is missing", (char *) NULL); } else { /* Use as dummy default value an arbitrary symbol, which must not be @@ -9128,14 +9143,16 @@ } static int -ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *procNameObj, - parameterDefinition CONST *paramPtr, int nrParameters, parseContext *pc) { +ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], + XOTclObject *obj, Tcl_Obj *procNameObj, + parameterDefinition CONST *paramPtr, int nrParameters, + parseContext *pc) { int i, o, flagCount = 0, nrReq = 0, nrOpt = 0, dashdash = 0; /* todo benchmark with and without CONST */ parameterDefinition CONST *aPtr, *bPtr; + + parseContextInit(pc, nrParameters, obj, procNameObj); - parseContextInit(pc, nrParameters, procNameObj); - #if defined(PARSE_TRACE) fprintf(stderr, "BEGIN (%d) [0]%s ",objc, ObjStr(procNameObj)); for (o=1; olastobjc < nrReq || (!pc->varArgs && objc-dashdash-1 > nrReq + nrOpt)) { - ArgumentError(interp, "wrong # args:", paramPtr, procNameObj); + if (pc->lastobjc < nrReq) { + return ArgumentError(interp, "not enough arguments:", paramPtr, NULL, procNameObj); /* for methods and cmds */ } + if (!pc->varArgs && objc-dashdash-1 > nrReq + nrOpt) { + return ArgumentError(interp, "to many arguments:", paramPtr, NULL, procNameObj); /* for methods and cmds */ + } - return ArgumentDefaults(pc, interp, NULL /* TODO if obj is provided, we might have to push the frame */, - paramPtr, nrParameters, ObjStr(procNameObj)); + return ArgumentDefaults(pc, interp, paramPtr, nrParameters); return TCL_OK; } @@ -10236,7 +10255,7 @@ /* Call the objv parser and postprocess like with method parameters */ paramDefs = parsedParam.paramDefs; - result = ProcessMethodArguments(&pc, interp, NULL, paramDefs, "configure", objc, objv); + result = ProcessMethodArguments(&pc, interp, obj, 0, paramDefs, "configure", objc, objv); if (result != TCL_OK) { XOTcl_PopFrame(interp, obj); parseContextRelease(&pc); @@ -12181,12 +12200,19 @@ #if defined(CANONICAL_ARGS) int ProcessMethodArguments(parseContext *pcPtr, Tcl_Interp *interp, - XOTclObject *obj, /* if provided, we might have to push the frame */ + XOTclObject *obj, int pushFrame, XOTclParamDefs *paramDefs, char *methodName, int objc, Tcl_Obj *CONST objv[]) { int rc; + XOTcl_FrameDecls; - rc = ArgumentParse(interp, objc, objv, objv[0], paramDefs->paramPtr, paramDefs->nrParameters, pcPtr); + if (obj && pushFrame) { + XOTcl_PushFrame(interp, obj); + } + rc = ArgumentParse(interp, objc, objv, obj, objv[0], paramDefs->paramPtr, paramDefs->nrParameters, pcPtr); + if (obj && pushFrame) { + XOTcl_PopFrame(interp, obj); + } if (rc != TCL_OK) { return rc; } @@ -12227,7 +12253,7 @@ */ } } - + return TCL_OK; } @@ -12280,7 +12306,7 @@ /*if (!paramDefs) {return TCL_OK;}*/ INCR_REF_COUNT(proc); - rc = ArgumentParse(interp, objc, objv, proc, paramDefs->paramPtr, objc, &pc); + rc = ArgumentParse(interp, objc, objv, csc->self, proc, paramDefs->paramPtr, objc, &pc); DECR_REF_COUNT(proc); if (rc != TCL_OK) { @@ -12320,7 +12346,7 @@ #if defined(CANONICAL_ARGS) parseContextRelease(pcPtr); #endif - return XOTclVarErrMsg(interp, "method ",procName, ": required argument '", + return XOTclVarErrMsg(interp, "method ", procName, ": required argument '", argName, "' is missing", (char *) NULL); } } Index: tests/objparametertest.xotcl =================================================================== diff -u -rfd885cf0c5e9db40afffb54a2a7e2e3d714a8a14 -rf4471765bb7aec8c793b5e365499726619119f63 --- tests/objparametertest.xotcl (.../objparametertest.xotcl) (revision fd885cf0c5e9db40afffb54a2a7e2e3d714a8a14) +++ tests/objparametertest.xotcl (.../objparametertest.xotcl) (revision f4471765bb7aec8c793b5e365499726619119f63) @@ -14,16 +14,24 @@ } catch {::xotcl::configure cacheinterface true} +set mkTypeChecker 0 puts stderr =====START Class C -parameter {a {b:boolean} {c 1}} C c1 -? {C objectparameter} "-instfilter:relation -superclass:relation -instmixin:relation -mixin:relation -filter:relation -class:relation args" -? {c1 objectparameter} {-a {-b:boolean,initcmd { +? {C objectparameter} "-instfilter:relation -superclass:relation -instmixin:relation\ +-mixin:relation -filter:relation -class:relation args" + +if {$mkTypeChecker} { + set e {-a {-b:boolean,initcmd { if {[::xotcl::my exists b]} {::xotcl::my set __oldvalue(b) [::xotcl::my set b]} ::xotcl::my trace add variable b write [list ::C::slot::b __value_changed_cmd [::xotcl::self] { ::xotcl::my check_single_value [$obj set b] {[::C::slot::b type=boolean b $value]} boolean $obj b}]}} {-c 1} -mixin:relation -filter:relation -class:relation args} +} else { + set e {-a -b:boolean {-c 1} -mixin:relation -filter:relation -class:relation args} +} +? {c1 objectparameter} $e # reclass to Object, no neet to do anything on caching puts stderr "=== reclass c1 to Object" @@ -33,12 +41,17 @@ puts stderr "=== create Class D" Class D -superclass C -parameter {d:required} D d1 -d 100 -? {d1 objectparameter} {-d:required -a {-b:boolean,initcmd { + +if {$mkTypeChecker} { + set e {-d:required -a {-b:boolean,initcmd { if {[::xotcl::my exists b]} {::xotcl::my set __oldvalue(b) [::xotcl::my set b]} ::xotcl::my trace add variable b write [list ::C::slot::b __value_changed_cmd [::xotcl::self] { ::xotcl::my check_single_value [$obj set b] {[::C::slot::b type=boolean b $value]} boolean $obj b}]}} {-c 1} -mixin:relation -filter:relation -class:relation args} +} else { + set e {-d:required -a -b:boolean {-c 1} -mixin:relation -filter:relation -class:relation args} +} +? {d1 objectparameter} $e -puts stderr 2 set case "instmixin M into D" Class M -parameter {m1 m2 b} Class M2 -parameter {b2} @@ -49,30 +62,126 @@ ? {d1 objectparameter} "-b2 -b -m1 -m2 -d:required -a {-c 1} -mixin:relation -filter:relation -class:relation args" "$case: transitive mixin added" D instmixin "" #we should have again the old interface -? {d1 objectparameter} {-d:required -a {-b:boolean,initcmd { + +if {$mkTypeChecker} { + set e {-d:required -a {-b:boolean,initcmd { if {[::xotcl::my exists b]} {::xotcl::my set __oldvalue(b) [::xotcl::my set b]} ::xotcl::my trace add variable b write [list ::C::slot::b __value_changed_cmd [::xotcl::self] { ::xotcl::my check_single_value [$obj set b] {[::C::slot::b type=boolean b $value]} boolean $obj b}]}} {-c 1} -mixin:relation -filter:relation -class:relation args} +} else { + set e {-d:required -a -b:boolean {-c 1} -mixin:relation -filter:relation -class:relation args} +} +? {d1 objectparameter} $e + set case "instmixin M into C" puts stderr "=== $case" C instmixin M ? {d1 objectparameter} "-b2 -b -m1 -m2 -d:required -a {-c 1} -mixin:relation -filter:relation -class:relation args" "$case: mixin added" C instmixin "" #we should have again the old interface -? {d1 objectparameter} {-d:required -a {-b:boolean,initcmd { + +if {$mkTypeChecker} { + set e {-d:required -a {-b:boolean,initcmd { if {[::xotcl::my exists b]} {::xotcl::my set __oldvalue(b) [::xotcl::my set b]} ::xotcl::my trace add variable b write [list ::C::slot::b __value_changed_cmd [::xotcl::self] { ::xotcl::my check_single_value [$obj set b] {[::C::slot::b type=boolean b $value]} boolean $obj b}]}} {-c 1} -mixin:relation -filter:relation -class:relation args} +} else { + set e {-d:required -a -b:boolean {-c 1} -mixin:relation -filter:relation -class:relation args} +} +? {d1 objectparameter} $e + # test passed arguments ? {catch {D create d1 -d 123}} 0 "create d1 with required argument given" ? {catch {D create d1}} 1 "create d1 without required argument given" catch {D create d1} errorMsg -? {set _ $errorMsg} XX "check error msg" +? {set _ $errorMsg} "::d1 configure: required argument 'd' is missing" "check error msg" -## TODO: initcmd->trackType {obj var type} => trace var ... +? {if {[catch {D create d2 -d x -b a} errorMsg]} {set errorMsg}} \ + {expected boolean value but got "a"} \ + "create d2 without required argument given" +D create d1 -d 1 +D instproc foo {-b:boolean -r:required,int {-x:int aaa} {-object:object} {-class:class}} { + #if {[info exists x]} {puts stderr x=$x} +} + +? {if {[catch {d1 foo} errorMsg]} {set errorMsg}} \ + {::d1 foo: required argument 'r' is missing} \ + "call method without a required argument" + +? {if {[catch {d1 foo -r a} errorMsg]} {set errorMsg}} \ + {expected integer but got "a"} \ + "required argument is not integer" + +? {if {[catch {d1 foo -r 1} errorMsg]} {set errorMsg}} \ + {expected integer but got "aaa"} \ + "default value is not of type integer" + +? {if {[catch {d1 foo -r 1 -x 1 -object d1} errorMsg]} {set errorMsg}} \ + "" \ + "pass object" + +? {if {[catch {d1 foo -r 1 -x 1 -object d11} errorMsg]} {set errorMsg}} \ + {Invalid argument: cannot convert 'd11' to object} \ + "pass non-existing object" + +? {if {[catch {d1 foo -r 1 -x 1 -class D} errorMsg]} {set errorMsg}} \ + "" \ + "pass class" + +? {if {[catch {d1 foo -r 1 -x 1 -class d1} errorMsg]} {set errorMsg}} \ + {Invalid argument: cannot convert 'd1' to class} \ + "pass object instead of class" + +? {if {[catch {d1 foo -r 1 -x 1 -class D11} errorMsg]} {set errorMsg}} \ + {Invalid argument: cannot convert 'D11' to class} \ + "pass non-existing class" + +# +# subst default tests +# +D instproc bar { + {-s:substdefault "[self]"} + {-literal "[self]"} + {-c:substdefault "[my c]"} + {-d:integer,substdefault "$d"} +} { + return $s-$literal-$c-$d +} + +? {d1 bar -c 1} {::d1-[self]-1-1} "substdefault on method" + +Class create Bar -superclass D -parameter { + {s "[self]"} + {literal "\\[self\\]"} + {c "[my info class]"} + {d "$d"} +} +Bar create bar1 +#puts stderr [bar1 objectparameter] + +? {subst {[bar1 s]-[bar1 literal]-[bar1 c]-[bar1 d]}} \ + {::bar1-[self]-::Bar-$d} \ + "substdefault on object" + +# Observations: +# 1) syntax for "-parameter" and method parameter is quite different. +# it would be nice to be able to specify the objparameters in +# the same syntax as the method parameters. +# +# 1a) Especially specifying "-" in front of a -parameter or not might +# be confusing. +# +# 1b) Positional args for obj parameter and arguments for init +# might be confusing as well. Should we forget about +# passing arguments to init? +# +# 2) substdefault for '$' in -parameter defaults does not make much sense. +# deactivated for now; otherwise we would need "\\" + + ## TODO regression test for type checking, parameter options (initcmd, ## substdefault, combinations with defaults, ...), etc.