Index: TODO =================================================================== diff -u -r6a0e62b53f8b405d11f009e3c0acb2098702d921 -rcf6d3e49135f07d35079b7ee25a02d394031a746 --- TODO (.../TODO) (revision 6a0e62b53f8b405d11f009e3c0acb2098702d921) +++ TODO (.../TODO) (revision cf6d3e49135f07d35079b7ee25a02d394031a746) @@ -1046,6 +1046,10 @@ - added "method require autoname" - added "method require exists" +- removed method "filtersearch" from nx.tcl +- added "obj info method filter methodName" to nx +- updated xotcl.2 to use new filtersearch imprementation +- updated migration guide TODO: - nameing Index: doc/next-migration.html =================================================================== diff -u -r15d57478e3976d747741fd3df9bcb6ecccc7076d -rcf6d3e49135f07d35079b7ee25a02d394031a746 --- doc/next-migration.html (.../next-migration.html) (revision 15d57478e3976d747741fd3df9bcb6ecccc7076d) +++ doc/next-migration.html (.../next-migration.html) (revision cf6d3e49135f07d35079b7ee25a02d394031a746) @@ -971,6 +971,10 @@ obj procsearch methodName obj info callable -which methodName + + obj filtersearch methodName + obj info method filter methodName +

List definition of scripted methods defined by classes

@@ -1367,6 +1371,6 @@
- Last modified: Wed Aug 18 13:17:20 CEST 2010 + Last modified: Wed Aug 18 14:45:57 CEST 2010 Index: generic/gentclAPI.decls =================================================================== diff -u -r8c2e2c14e38d6ebb9ef1c44fabcf0229a42c1a02 -rcf6d3e49135f07d35079b7ee25a02d394031a746 --- generic/gentclAPI.decls (.../gentclAPI.decls) (revision 8c2e2c14e38d6ebb9ef1c44fabcf0229a42c1a02) +++ generic/gentclAPI.decls (.../gentclAPI.decls) (revision cf6d3e49135f07d35079b7ee25a02d394031a746) @@ -433,9 +433,9 @@ # @param filter Handle to identify and address a filter once registered # @param guard A list of guard expressions # @return A string which describes a fully qualified method handle -objectMethod filtersearch XOTclOFilterSearchMethod { - {-argName "filter" -required 1} -} +#objectMethod filtersearch XOTclOFilterSearchMethod { +# {-argName "filter" -required 1} +#} # @method ::nx::Object#instvar # @@ -780,7 +780,7 @@ } infoObjectMethod method XOTclObjInfoMethodMethod { {-argName "object" -type object} - {-argName "infomethodsubcmd" -type "args|definition|name|parameter|parametersyntax|type|precondition|postcondition"} + {-argName "infomethodsubcmd" -type "args|definition|filter|name|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|name|parameter|parametersyntax|type|precondition|postcondition"} + {-argName "infomethodsubcmd" -type "args|body|definition|filter|name|parameter|parametersyntax|type|precondition|postcondition"} {-argName "name"} } infoClassMethod methods XOTclClassInfoMethodsMethod { Index: generic/tclAPI.h =================================================================== diff -u -r8c2e2c14e38d6ebb9ef1c44fabcf0229a42c1a02 -rcf6d3e49135f07d35079b7ee25a02d394031a746 --- generic/tclAPI.h (.../tclAPI.h) (revision 8c2e2c14e38d6ebb9ef1c44fabcf0229a42c1a02) +++ generic/tclAPI.h (.../tclAPI.h) (revision cf6d3e49135f07d35079b7ee25a02d394031a746) @@ -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", "name", "parameter", "parametersyntax", "type", "precondition", "postcondition", NULL}; + static CONST char *opts[] = {"args", "body", "definition", "filter", "name", "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, InfomethodsubcmdNameIdx, InfomethodsubcmdParameterIdx, InfomethodsubcmdParametersyntaxIdx, InfomethodsubcmdTypeIdx, InfomethodsubcmdPreconditionIdx, InfomethodsubcmdPostconditionIdx}; +enum InfomethodsubcmdIdx {InfomethodsubcmdNULL, InfomethodsubcmdArgsIdx, InfomethodsubcmdBodyIdx, InfomethodsubcmdDefinitionIdx, InfomethodsubcmdFilterIdx, InfomethodsubcmdNameIdx, InfomethodsubcmdParameterIdx, InfomethodsubcmdParametersyntaxIdx, InfomethodsubcmdTypeIdx, InfomethodsubcmdPreconditionIdx, InfomethodsubcmdPostconditionIdx}; static int convertToMethodtype(Tcl_Interp *interp, Tcl_Obj *objPtr, XOTclParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { @@ -176,7 +176,6 @@ static int XOTclODestroyMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclOExistsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclOFilterGuardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int XOTclOFilterSearchMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclOInstVarMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclOMixinGuardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclONoinitMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); @@ -254,7 +253,6 @@ static int XOTclODestroyMethod(Tcl_Interp *interp, XOTclObject *obj); static int XOTclOExistsMethod(Tcl_Interp *interp, XOTclObject *obj, CONST char *var); static int XOTclOFilterGuardMethod(Tcl_Interp *interp, XOTclObject *obj, CONST char *filter, Tcl_Obj *guard); -static int XOTclOFilterSearchMethod(Tcl_Interp *interp, XOTclObject *obj, CONST char *filter); static int XOTclOInstVarMethod(Tcl_Interp *interp, XOTclObject *obj, int objc, Tcl_Obj *CONST objv[]); static int XOTclOMixinGuardMethod(Tcl_Interp *interp, XOTclObject *obj, CONST char *mixin, Tcl_Obj *guard); static int XOTclONoinitMethod(Tcl_Interp *interp, XOTclObject *obj); @@ -333,7 +331,6 @@ XOTclODestroyMethodIdx, XOTclOExistsMethodIdx, XOTclOFilterGuardMethodIdx, - XOTclOFilterSearchMethodIdx, XOTclOInstVarMethodIdx, XOTclOMixinGuardMethodIdx, XOTclONoinitMethodIdx, @@ -1263,25 +1260,6 @@ } static int -XOTclOFilterSearchMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - parseContext pc; - XOTclObject *obj = (XOTclObject *)clientData; - if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); - if (ArgumentParse(interp, objc, objv, obj, objv[0], - method_definitions[XOTclOFilterSearchMethodIdx].paramDefs, - method_definitions[XOTclOFilterSearchMethodIdx].nrParameters, - &pc) != TCL_OK) { - return TCL_ERROR; - } else { - CONST char *filter = (CONST char *)pc.clientData[0]; - - parseContextRelease(&pc); - return XOTclOFilterSearchMethod(interp, obj, filter); - - } -} - -static int XOTclOInstVarMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj = (XOTclObject *)clientData; if (!obj) return XOTclObjErrType(interp, objv[0], "Object", ""); @@ -2101,9 +2079,6 @@ {"filter", 1, 0, convertToString}, {"guard", 1, 0, convertToTclobj}} }, -{"::nsf::cmd::Object::filtersearch", XOTclOFilterSearchMethodStub, 1, { - {"filter", 1, 0, convertToString}} -}, {"::nsf::cmd::Object::instvar", XOTclOInstVarMethodStub, 1, { {"args", 0, 0, convertToNothing}} }, Index: generic/xotcl.c =================================================================== diff -u -r0ce52e9337f3878865a4b05c2e6a76dda2a56917 -rcf6d3e49135f07d35079b7ee25a02d394031a746 --- generic/xotcl.c (.../xotcl.c) (revision 0ce52e9337f3878865a4b05c2e6a76dda2a56917) +++ generic/xotcl.c (.../xotcl.c) (revision cf6d3e49135f07d35079b7ee25a02d394031a746) @@ -12569,7 +12569,6 @@ if (paramPtr && paramPtr->converter == convertViaCmd && (withNocomplain || result == TCL_OK)) { - fprintf(stderr, "reset result %p\n", valueObj); Tcl_ResetResult(interp); } @@ -12965,7 +12964,7 @@ * Searches for filter on [self] and returns fully qualified name * if it is not found it returns an empty string */ -static int XOTclOFilterSearchMethod(Tcl_Interp *interp, XOTclObject *object, CONST char *filter) { +static int FilterSearchMethod(Tcl_Interp *interp, XOTclObject *object, CONST char *filter) { CONST char *filterName; XOTclCmdList *cmdList; XOTclClass *fcl; @@ -13871,7 +13870,7 @@ /* infoObjectMethod method XOTclObjInfoMethodMethod { {-argName "object" -type object} - {-argName "infomethodsubcmd" -type "args|definition|name|parameter|parametersyntax|type|precondition|postcondition"} + {-argName "infomethodsubcmd" -type "args|definition|filter|name|parameter|parametersyntax|type|precondition|postcondition"} {-argName "name"} } */ @@ -13880,7 +13879,10 @@ Tcl_Namespace *nsPtr = object->nsPtr; Tcl_Command cmd; - if (*methodName == ':') { + if (subcmd == InfomethodsubcmdFilterIdx) { + return FilterSearchMethod(interp, object, methodName); + + } else if (*methodName == ':') { Tcl_Obj *methodObj = Tcl_NewStringObj(methodName, -1); cmd = Tcl_GetCommandFromObj(interp, methodObj); } else { @@ -14125,7 +14127,7 @@ /* infoClassMethod method XOTclClassInfoMethodMethod { {-argName "class" -type class} - {-argName "infomethodsubcmd" -type "args|body|definition|name|parameter|type|precondition|postcondition"} + {-argName "infomethodsubcmd" -type "args|body|definition|filter|name|parameter|type|precondition|postcondition"} {-argName "name"} } */ @@ -14134,7 +14136,9 @@ Tcl_Namespace *nsPtr = class->nsPtr; Tcl_Command cmd; - if (*methodName == ':') { + if (subcmd == InfomethodsubcmdFilterIdx) { + return FilterSearchMethod(interp, &class->object, methodName); + } else if (*methodName == ':') { Tcl_Obj *methodObj = Tcl_NewStringObj(methodName, -1); cmd = Tcl_GetCommandFromObj(interp, methodObj); } else { Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -r304c346008d3c471fa9350eb0b18813eec2a4be6 -rcf6d3e49135f07d35079b7ee25a02d394031a746 --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 304c346008d3c471fa9350eb0b18813eec2a4be6) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision cf6d3e49135f07d35079b7ee25a02d394031a746) @@ -64,7 +64,7 @@ # provide the standard command set for ::xotcl::Object foreach cmd [info command ::nsf::cmd::Object::*] { set cmdName [namespace tail $cmd] - if {$cmdName in [list "filtersearch" "setter"]} continue + if {$cmdName in [list "setter"]} continue ::nsf::alias Object $cmdName $cmd } @@ -542,7 +542,7 @@ ::nsf::is [self] type $cl } Object instproc filtersearch {filter} { - set definition [::nsf::dispatch [self] ::nsf::cmd::Object::filtersearch $filter] + set definition [::nsf::cmd::ObjectInfo::method [self] filter $filter] return [method_handle_to_xotcl $definition] } Object instproc procsearch {name} {