Index: TODO =================================================================== diff -u -re548a952433b4d26794f535995c9ed1ababe8807 -rd8d920f2976691dcf8e2a68b336eb253385030f6 --- TODO (.../TODO) (revision e548a952433b4d26794f535995c9ed1ababe8807) +++ TODO (.../TODO) (revision d8d920f2976691dcf8e2a68b336eb253385030f6) @@ -1059,6 +1059,10 @@ - renamed "info callable -which ..." into "info callable method ..." - updated regression test to reflect the changes +- changed "info method filter ...." into "info callable filter ..." +- fixed "o info callable method" in some cases with mixins +- extended regression test +- updated migration guide TODO: - nameing Index: doc/next-migration.html =================================================================== diff -u -rcf6d3e49135f07d35079b7ee25a02d394031a746 -rd8d920f2976691dcf8e2a68b336eb253385030f6 --- doc/next-migration.html (.../next-migration.html) (revision cf6d3e49135f07d35079b7ee25a02d394031a746) +++ doc/next-migration.html (.../next-migration.html) (revision d8d920f2976691dcf8e2a68b336eb253385030f6) @@ -954,13 +954,36 @@ XOTclNext Scripting Language obj info methods ?pattern? - obj info callable ?pattern? + obj info callable methods ... ?pattern?
+ # Returns list of method names +
n.a. - # List only application specific methods
- obj info callable -application + # List only application specific methods
+ obj info callable methods -application ... ?pattern?
+ # Returns list of method names +
+ + + # Options for 'info methods'
+ #
+ # -incontext
+ # -nomixins
+
+
+ # Options for 'info callable + methods'
+ #
+ # -application
+ # -callprotection ...
+ # -incontext
+ # -methodtype ...
+ # -nomixins
+
+
+

List object/class where some method is defined

@@ -969,11 +992,13 @@ XOTclNext Scripting Language obj procsearch methodName - obj info callable -which methodName + obj info callable method methodName
+ # Returns method-handle
obj filtersearch methodName - obj info method filter methodName + obj info callable filter methodName
+ # Returns method-handle
@@ -1053,8 +1078,7 @@ XOTclNext Scripting Language obj info filter ?-order? ?-guards? ?pattern? - # ... info filter -order ... returns now - method-handles
+ # ... info filter -order ... returns method-handles
# instead of triples (applies to all three variants)


obj info filter ?-order? ?-guards? ?pattern? @@ -1249,12 +1273,12 @@ self next - # Returns now method-handle
+ # Returns method-handle
current next self filterreg - # Returns now method-handle
+ # Returns method-handle
current filterreg @@ -1371,6 +1395,6 @@
- Last modified: Wed Aug 18 14:45:57 CEST 2010 + Last modified: Thu Aug 19 14:50:52 CEST 2010 Index: generic/gentclAPI.decls =================================================================== diff -u -re548a952433b4d26794f535995c9ed1ababe8807 -rd8d920f2976691dcf8e2a68b336eb253385030f6 --- generic/gentclAPI.decls (.../gentclAPI.decls) (revision e548a952433b4d26794f535995c9ed1ababe8807) +++ generic/gentclAPI.decls (.../gentclAPI.decls) (revision d8d920f2976691dcf8e2a68b336eb253385030f6) @@ -780,7 +780,7 @@ } infoObjectMethod method XOTclObjInfoMethodMethod { {-argName "object" -type object} - {-argName "infomethodsubcmd" -type "args|definition|filter|handle|parameter|parametersyntax|type|precondition|postcondition"} + {-argName "infomethodsubcmd" -type "args|body|definition|handle|parameter|parametersyntax|type|precondition|postcondition"} {-argName "name"} } infoObjectMethod methods XOTclObjInfoMethodsMethod { @@ -847,7 +847,7 @@ } infoClassMethod method XOTclClassInfoMethodMethod { {-argName "class" -type class} - {-argName "infomethodsubcmd" -type "args|body|definition|filter|handle|parameter|parametersyntax|type|precondition|postcondition"} + {-argName "infomethodsubcmd" -type "args|body|definition|handle|parameter|parametersyntax|type|precondition|postcondition"} {-argName "name"} } infoClassMethod methods XOTclClassInfoMethodsMethod { Index: generic/tclAPI.h =================================================================== diff -u -re548a952433b4d26794f535995c9ed1ababe8807 -rd8d920f2976691dcf8e2a68b336eb253385030f6 --- generic/tclAPI.h (.../tclAPI.h) (revision e548a952433b4d26794f535995c9ed1ababe8807) +++ generic/tclAPI.h (.../tclAPI.h) (revision d8d920f2976691dcf8e2a68b336eb253385030f6) @@ -2,13 +2,13 @@ static int convertToInfomethodsubcmd(Tcl_Interp *interp, Tcl_Obj *objPtr, XOTclParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; - static CONST char *opts[] = {"args", "body", "definition", "filter", "handle", "parameter", "parametersyntax", "type", "precondition", "postcondition", NULL}; + static CONST char *opts[] = {"args", "body", "definition", "handle", "parameter", "parametersyntax", "type", "precondition", "postcondition", NULL}; result = Tcl_GetIndexFromObj(interp, objPtr, opts, "infomethodsubcmd", 0, &index); *clientData = (ClientData) INT2PTR(index + 1); *outObjPtr = objPtr; return result; } -enum InfomethodsubcmdIdx {InfomethodsubcmdNULL, InfomethodsubcmdArgsIdx, InfomethodsubcmdBodyIdx, InfomethodsubcmdDefinitionIdx, InfomethodsubcmdFilterIdx, InfomethodsubcmdHandleIdx, InfomethodsubcmdParameterIdx, InfomethodsubcmdParametersyntaxIdx, InfomethodsubcmdTypeIdx, InfomethodsubcmdPreconditionIdx, InfomethodsubcmdPostconditionIdx}; +enum InfomethodsubcmdIdx {InfomethodsubcmdNULL, InfomethodsubcmdArgsIdx, InfomethodsubcmdBodyIdx, InfomethodsubcmdDefinitionIdx, InfomethodsubcmdHandleIdx, InfomethodsubcmdParameterIdx, InfomethodsubcmdParametersyntaxIdx, InfomethodsubcmdTypeIdx, InfomethodsubcmdPreconditionIdx, InfomethodsubcmdPostconditionIdx}; static int convertToMethodtype(Tcl_Interp *interp, Tcl_Obj *objPtr, XOTclParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { Index: generic/xotcl.c =================================================================== diff -u -re548a952433b4d26794f535995c9ed1ababe8807 -rd8d920f2976691dcf8e2a68b336eb253385030f6 --- generic/xotcl.c (.../xotcl.c) (revision e548a952433b4d26794f535995c9ed1ababe8807) +++ generic/xotcl.c (.../xotcl.c) (revision d8d920f2976691dcf8e2a68b336eb253385030f6) @@ -1046,8 +1046,8 @@ if (object->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { XOTclCmdList *mixinList; for (mixinList = object->mixinOrder; mixinList; mixinList = mixinList->nextPtr) { - XOTclClass *mcl = XOTclpGetClass(interp, (char *)Tcl_GetCommandName(interp, mixinList->cmdPtr)); - if (mcl && (*pcl = SearchCMethod(mcl, name, &cmd))) { + XOTclClass *mixin = XOTclGetClassFromCmdPtr(mixinList->cmdPtr); + if (mixin && (*pcl = SearchCMethod(mixin, name, &cmd))) { break; } } @@ -13896,7 +13896,7 @@ /* infoObjectMethod method XOTclObjInfoMethodMethod { {-argName "object" -type object} - {-argName "infomethodsubcmd" -type "args|definition|filter|handle|parameter|parametersyntax|type|precondition|postcondition"} + {-argName "infomethodsubcmd" -type "args|definition|handle|parameter|parametersyntax|type|precondition|postcondition"} {-argName "name"} } */ @@ -13905,10 +13905,7 @@ Tcl_Namespace *nsPtr = object->nsPtr; Tcl_Command cmd; - if (subcmd == InfomethodsubcmdFilterIdx) { - return FilterSearchMethod(interp, object, methodName); - - } else if (*methodName == ':') { + if (*methodName == ':') { Tcl_Obj *methodObj = Tcl_NewStringObj(methodName, -1); cmd = Tcl_GetCommandFromObj(interp, methodObj); } else { @@ -14153,7 +14150,7 @@ /* infoClassMethod method XOTclClassInfoMethodMethod { {-argName "class" -type class} - {-argName "infomethodsubcmd" -type "args|body|definition|filter|name|parameter|type|precondition|postcondition"} + {-argName "infomethodsubcmd" -type "args|body|definition|handle|parameter|type|precondition|postcondition"} {-argName "name"} } */ @@ -14162,9 +14159,7 @@ Tcl_Namespace *nsPtr = class->nsPtr; Tcl_Command cmd; - if (subcmd == InfomethodsubcmdFilterIdx) { - return FilterSearchMethod(interp, &class->object, methodName); - } else if (*methodName == ':') { + if (*methodName == ':') { Tcl_Obj *methodObj = Tcl_NewStringObj(methodName, -1); cmd = Tcl_GetCommandFromObj(interp, methodObj); } else { Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -re548a952433b4d26794f535995c9ed1ababe8807 -rd8d920f2976691dcf8e2a68b336eb253385030f6 --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision e548a952433b4d26794f535995c9ed1ababe8807) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision d8d920f2976691dcf8e2a68b336eb253385030f6) @@ -542,31 +542,12 @@ ::nsf::is [self] type $cl } Object instproc filtersearch {filter} { - set handle [::nsf::cmd::ObjectInfo::method [self] filter $filter] + set handle [::nsf::cmd::ObjectInfo::callable [self] filter $filter] return [method_handle_to_xotcl $handle] } Object instproc procsearch {name} { set handle [::nsf::cmd::ObjectInfo::callable [self] method $name] return [method_handle_to_xotcl $handle] - - if {$definition ne ""} { - foreach {obj modifier kind} $definition break - if {$modifier ne "object"} { - set kind $modifier - set perClass [::nsf::is $obj class] - } else { - set perClass 0 - } - switch $kind { - alias {if {$perClass} {set kind "instcmd"} else {set kind "cmd"}} - forward {if {$perClass} {set kind "instforward"}} - method {if {$perClass} {set kind "instproc"} else {set kind "proc"}} - setter {if {$perClass} {set kind "instparametercmd"} else {set kind "parametercmd"}} - default {error "not handeled: $definition"} - } - #puts stderr "return: [list $obj $kind $name]" - return [list $obj $kind $name] - } } Class instproc allinstances {} { # TODO: mark it deprecated Index: tests/info-method.tcl =================================================================== diff -u -re548a952433b4d26794f535995c9ed1ababe8807 -rd8d920f2976691dcf8e2a68b336eb253385030f6 --- tests/info-method.tcl (.../info-method.tcl) (revision e548a952433b4d26794f535995c9ed1ababe8807) +++ tests/info-method.tcl (.../info-method.tcl) (revision d8d920f2976691dcf8e2a68b336eb253385030f6) @@ -67,3 +67,19 @@ ? {::nx::Class info callable methods -application} "" ? {lsort [C info callable methods -application]} "add1 apo fpo mpo spo" ? {lsort [c1 info callable methods -application]} "a addOne foo m m-with-assertions s" + +Test case callable { + # define the same method for Object and Class + ::nx::Object method bar {} {return Object.bar} + ::nx::Class method bar {} {return Class.bar} + + ::nx::Object create o + ? {o info callable method bar} "::nsf::classes::nx::Object::bar" + ? {o info callable methods bar} bar + ? {o bar} Object.bar + + o mixin ::nx::Class + ? {o info callable method bar} "::nsf::classes::nx::Class::bar" + ? {o info callable methods bar} bar + ? {o bar} Class.bar +}