Index: TODO =================================================================== diff -u -rf1358bf60e01f773bf04170671c5066a2874ac69 -r88ce4132aeb39289918426aa2c285c354a102a1e --- TODO (.../TODO) (revision f1358bf60e01f773bf04170671c5066a2874ac69) +++ TODO (.../TODO) (revision 88ce4132aeb39289918426aa2c285c354a102a1e) @@ -1309,6 +1309,11 @@ - [::nx::Object info method parameter info] returns now empty instead of error. - extended regression test +- splitted "info callable" into an ensemble + (submethods have quite different signatures) +- added "info callable slots" with functionality of "info slotobjects" +- removed "info slotobjects" + TODO: - check equivalence of the following two commands Index: generic/gentclAPI.decls =================================================================== diff -u -r99ee1ab0e5d0d04de1dc14cf190b27a0ce9edfcf -r88ce4132aeb39289918426aa2c285c354a102a1e --- generic/gentclAPI.decls (.../gentclAPI.decls) (revision 99ee1ab0e5d0d04de1dc14cf190b27a0ce9edfcf) +++ generic/gentclAPI.decls (.../gentclAPI.decls) (revision 88ce4132aeb39289918426aa2c285c354a102a1e) @@ -214,15 +214,23 @@ # # info object methods # -objectInfoMethod callable NsfObjInfoCallableMethod { - {-argName "infocallablesubcmd" -nrargs 1 -type "filter|method|methods" -required 1} +objectInfoMethod callablefilter NsfObjInfoCallableFilterMethod { + {-argName "filter"} +} +objectInfoMethod callablemethod NsfObjInfoCallableMethodMethod { + {-argName "name"} +} +objectInfoMethod callablemethods NsfObjInfoCallableMethodsMethod { {-argName "-methodtype" -nrargs 1 -type "all|scripted|builtin|alias|forwarder|object|setter"} {-argName "-callprotection" -nrargs 1 -type "all|protected|public" -default all} {-argName "-application"} {-argName "-nomixins"} {-argName "-incontext"} {-argName "pattern" -required 0} } +objectInfoMethod callableslots NsfObjInfoCallableSlotsMethod { + {-argName "-type" -required 0 -nrargs 1 -type class} +} objectInfoMethod children NsfObjInfoChildrenMethod { {-argName "-type" -required 0 -nrargs 1 -type class} {-argName "pattern" -required 0} @@ -278,9 +286,6 @@ {-argName "-intrinsic"} {-argName "pattern" -required 0} } -objectInfoMethod slotobjects NsfObjInfoSlotObjectsMethod { - {-argName "-type" -required 0 -nrargs 1 -type class} -} objectInfoMethod vars NsfObjInfoVarsMethod { {-argName "pattern" -required 0} } Index: generic/nsf.c =================================================================== diff -u -rf1358bf60e01f773bf04170671c5066a2874ac69 -r88ce4132aeb39289918426aa2c285c354a102a1e --- generic/nsf.c (.../nsf.c) (revision f1358bf60e01f773bf04170671c5066a2874ac69) +++ generic/nsf.c (.../nsf.c) (revision 88ce4132aeb39289918426aa2c285c354a102a1e) @@ -13293,36 +13293,7 @@ filter, " on ", objectName(object), (char *) NULL); } -/* - * Searches for filter on [self] and returns fully qualified name - * if it is not found it returns an empty string - */ -static int -FilterSearchMethod(Tcl_Interp *interp, NsfObject *object, CONST char *filter) { - CONST char *filterName; - NsfCmdList *cmdList; - NsfClass *fcl; - Tcl_ResetResult(interp); - - if (!(object->flags & NSF_FILTER_ORDER_VALID)) - FilterComputeDefined(interp, object); - if (!(object->flags & NSF_FILTER_ORDER_DEFINED)) - return TCL_OK; - - for (cmdList = object->filterOrder; cmdList; cmdList = cmdList->nextPtr) { - filterName = Tcl_GetCommandName(interp, cmdList->cmdPtr); - if (filterName[0] == filter[0] && !strcmp(filterName, filter)) - break; - } - - if (!cmdList) - return TCL_OK; - - fcl = cmdList->clorobj; - return ListMethodHandle(interp, (NsfObject*)fcl, !NsfObjectIsClass(&fcl->object), filterName); -} - static int NsfOInstVarMethod(Tcl_Interp *interp, NsfObject *object, int objc, Tcl_Obj *CONST objv[]) { callFrameContext ctx = {0}; @@ -14112,8 +14083,60 @@ * Begin Object Info Methods ***************************/ /* -objectInfoMethod callable NsfObjInfoCallableMethod { - {-argName "infocallablesubcmd" -nrargs 1 -type "filter|method|methods" -required 1} +objectInfoMethod callablefilter NsfObjInfoCallableFilterMethod { + {-argName "filter"} +} +*/ +static int +NsfObjInfoCallableFilterMethod(Tcl_Interp *interp, NsfObject *object, CONST char *filter) { + CONST char *filterName; + NsfCmdList *cmdList; + NsfClass *fcl; + + /* + * Searches for filter on [self] and returns fully qualified name + * if it is not found it returns an empty string + */ + Tcl_ResetResult(interp); + + if (!(object->flags & NSF_FILTER_ORDER_VALID)) + FilterComputeDefined(interp, object); + if (!(object->flags & NSF_FILTER_ORDER_DEFINED)) + return TCL_OK; + + for (cmdList = object->filterOrder; cmdList; cmdList = cmdList->nextPtr) { + filterName = Tcl_GetCommandName(interp, cmdList->cmdPtr); + if (filterName[0] == filter[0] && !strcmp(filterName, filter)) + break; + } + + if (!cmdList) + return TCL_OK; + + fcl = cmdList->clorobj; + return ListMethodHandle(interp, (NsfObject*)fcl, !NsfObjectIsClass(&fcl->object), filterName); +} + +/* +objectInfoMethod callablemethod NsfObjInfoCallableMethodMethod { + {-argName "pattern" -required 0} +} +*/ +static int +NsfObjInfoCallableMethodMethod(Tcl_Interp *interp, NsfObject *object, CONST char *name) { + NsfClass *pcl = NULL; + Tcl_Command cmd = ObjectFindMethod(interp, object, name, &pcl); + + if (cmd) { + NsfObject *pobj = pcl ? &pcl->object : object; + int perObject = (pcl == NULL); + ListMethod(interp, pobj, name, cmd, InfomethodsubcmdHandleIdx, perObject); + } + return TCL_OK; +} + +/* +objectInfoMethod callablemethods NsfObjInfoCallableMethodsMethod { {-argName "-methodtype" -nrargs 1 -type "all|scripted|builtin|alias|forwarder|object|setter"} {-argName "-callprotection" -nrargs 1 -type "all|protected|public" -default all} {-argName "-application"} @@ -14123,52 +14146,96 @@ } */ static int -NsfObjInfoCallableMethod(Tcl_Interp *interp, NsfObject *object, - int subcmd, int withMethodtype, int withCallprotection, - int withApplication, - int withNomixins, int withIncontext, CONST char *pattern) { - - if (subcmd != InfocallablesubcmdMethodsIdx) { - if (withMethodtype || withCallprotection || withApplication || withNomixins || withIncontext) { - return NsfVarErrMsg(interp, "options -methodtype, -callprotection, -application, ", - "-nomixins, -incontext are only valued for subcommand 'methods'", - (char *) NULL); - } - if (pattern == NULL) { - return NsfVarErrMsg(interp, "methodname must be provided as last argument", - (char *) NULL); - } +NsfObjInfoCallableMethodsMethod(Tcl_Interp *interp, NsfObject *object, + int withMethodtype, int withCallprotection, + int withApplication, + int withNomixins, int withIncontext, CONST char *pattern) { + /* todo: own method needed? */ + NsfClasses *pl; + int withPer_object = 1; + Tcl_HashTable *cmdTable, dupsTable, *dups = &dupsTable; + int methodType = AggregatedMethodType(withMethodtype); + + /* + * TODO: we could make this faster for patterns without metachars + * by letting ListMethodKeys() to signal us when an entry was found. + * we wait, until the we decided about "info methods defined" + * vs. "info method search" vs. "info defined" etc. + */ + if (withCallprotection == CallprotectionNULL) { + withCallprotection = CallprotectionPublicIdx; } - switch (subcmd) { - case InfocallablesubcmdMethodIdx: - { - NsfClass *pcl = NULL; - Tcl_Command cmd = ObjectFindMethod(interp, object, pattern, &pcl); - if (cmd) { - NsfObject *pobj = pcl ? &pcl->object : object; - int perObject = (pcl == NULL); - ListMethod(interp, pobj, pattern, cmd, InfomethodsubcmdHandleIdx, perObject); + if (withApplication && object->flags & IsBaseClass((NsfClass*)object)) { + return TCL_OK; + } + + Tcl_InitHashTable(dups, TCL_STRING_KEYS); + if (object->nsPtr) { + cmdTable = Tcl_Namespace_cmdTable(object->nsPtr); + ListMethodKeys(interp, cmdTable, pattern, methodType, withCallprotection, + dups, object, withPer_object); + } + + if (!withNomixins) { + if (!(object->flags & NSF_MIXIN_ORDER_VALID)) + MixinComputeDefined(interp, object); + if (object->flags & NSF_MIXIN_ORDER_DEFINED_AND_VALID) { + NsfCmdList *ml; + NsfClass *mixin; + for (ml = object->mixinOrder; ml; ml = ml->nextPtr) { + int guardOk = TCL_OK; + mixin = NsfGetClassFromCmdPtr(ml->cmdPtr); + assert(mixin); + + if (withIncontext) { + if (!RUNTIME_STATE(interp)->guardCount) { + guardOk = GuardCall(object, 0, 0, interp, ml->clientData, NULL); + } + } + if (mixin && guardOk == TCL_OK) { + Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(mixin->nsPtr); + ListMethodKeys(interp, cmdTable, pattern, methodType, withCallprotection, + dups, object, withPer_object); + } } - return TCL_OK; } - case InfocallablesubcmdMethodsIdx: - { - return ListCallableMethods(interp, object, pattern, - AggregatedMethodType(withMethodtype), withCallprotection, - withApplication, withNomixins, withIncontext); + } + + /* append method keys from inheritance order */ + for (pl = ComputeOrder(object->cl, object->cl->order, Super); pl; pl = pl->nextPtr) { + Tcl_HashTable *cmdTable = Tcl_Namespace_cmdTable(pl->cl->nsPtr); + if (withApplication && IsBaseClass(pl->cl)) { + break; } - case InfocallablesubcmdFilterIdx: - { - return FilterSearchMethod(interp, object, pattern); - } - default: - fprintf(stderr, "should never happen, subcmd %d pattern '%s'\n", subcmd, pattern); + ListMethodKeys(interp, cmdTable, pattern, methodType, withCallprotection, + dups, object, withPer_object); + } + Tcl_DeleteHashTable(dups); + return TCL_OK; +} - assert(0); /* should never happen */ +/* +objectInfoMethod callableslots NsfObjInfoCallableSlotsMethod { + {-argName "-type" -required 0 -nrargs 1 -type class} +} +*/ +static int +NsfObjInfoCallableSlotsMethod(Tcl_Interp *interp, NsfObject *object, NsfClass *type) { + NsfObjects *pl, *slotObjects; + Tcl_Obj *list = Tcl_NewListObj(0, NULL); + + slotObjects = ComputeSlotObjects(interp, object, type, 1); + for (pl=slotObjects; pl; pl = pl->nextPtr) { + Tcl_ListObjAppendElement(interp, list, pl->obj->cmdName); } + + NsfObjectListFree(slotObjects); + Tcl_SetObjResult(interp, list); + return TCL_OK; } + /* objectInfoMethod children NsfObjInfoChildrenMethod { {-argName "-type" -required 0 -nrargs 1 -type class} @@ -14396,29 +14463,6 @@ } /* -objectInfoMethod slotobjects NsfObjInfoSlotObjectsMethod { - {-argName "-type" -required 0 -nrargs 1 -type class} -} -*/ -static int -NsfObjInfoSlotObjectsMethod(Tcl_Interp *interp, NsfObject *object, NsfClass *type) { - NsfObjects *pl, *slotObjects; - Tcl_Obj *list = Tcl_NewListObj(0, NULL); - /*NsfClass *slotClass = GetClassFromString(interp, "::nx::Slot");*/ - - slotObjects = ComputeSlotObjects(interp, object, type, 1); - - for (pl=slotObjects; pl; pl = pl->nextPtr) { - /*if (slotClass && !IsSubType(pl->obj->cl, slotClass)) continue;*/ - Tcl_ListObjAppendElement(interp, list, pl->obj->cmdName); - } - - NsfObjectListFree(slotObjects); - Tcl_SetObjResult(interp, list); - return TCL_OK; -} - -/* objectInfoMethod vars NsfObjInfoVarsMethod { {-argName "pattern" -required 0} } Index: generic/tclAPI.h =================================================================== diff -u -r99ee1ab0e5d0d04de1dc14cf190b27a0ce9edfcf -r88ce4132aeb39289918426aa2c285c354a102a1e --- generic/tclAPI.h (.../tclAPI.h) (revision 99ee1ab0e5d0d04de1dc14cf190b27a0ce9edfcf) +++ generic/tclAPI.h (.../tclAPI.h) (revision 88ce4132aeb39289918426aa2c285c354a102a1e) @@ -98,17 +98,6 @@ } enum RelationtypeIdx {RelationtypeNULL, RelationtypeObject_mixinIdx, RelationtypeClass_mixinIdx, RelationtypeObject_filterIdx, RelationtypeClass_filterIdx, RelationtypeClassIdx, RelationtypeSuperclassIdx, RelationtypeRootclassIdx}; -static int ConvertToInfocallablesubcmd(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, - ClientData *clientData, Tcl_Obj **outObjPtr) { - int index, result; - static CONST char *opts[] = {"filter", "method", "methods", NULL}; - result = Tcl_GetIndexFromObj(interp, objPtr, opts, "infocallablesubcmd", 0, &index); - *clientData = (ClientData) INT2PTR(index + 1); - *outObjPtr = objPtr; - return result; -} -enum InfocallablesubcmdIdx {InfocallablesubcmdNULL, InfocallablesubcmdFilterIdx, InfocallablesubcmdMethodIdx, InfocallablesubcmdMethodsIdx}; - static int ConvertToObjectkind(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -205,7 +194,10 @@ static int NsfOUpvarMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfOVolatileMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfOVwaitMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int NsfObjInfoCallableMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int NsfObjInfoCallableFilterMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int NsfObjInfoCallableMethodMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int NsfObjInfoCallableMethodsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int NsfObjInfoCallableSlotsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfObjInfoChildrenMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfObjInfoClassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfObjInfoFilterguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); @@ -221,7 +213,6 @@ static int NsfObjInfoMixinguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfObjInfoParentMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfObjInfoPrecedenceMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int NsfObjInfoSlotObjectsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfObjInfoVarsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfCAllocMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *name); @@ -283,7 +274,10 @@ static int NsfOUpvarMethod(Tcl_Interp *interp, NsfObject *obj, int objc, Tcl_Obj *CONST objv[]); static int NsfOVolatileMethod(Tcl_Interp *interp, NsfObject *obj); static int NsfOVwaitMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *varname); -static int NsfObjInfoCallableMethod(Tcl_Interp *interp, NsfObject *obj, int infocallablesubcmd, int withMethodtype, int withCallprotection, int withApplication, int withNomixins, int withIncontext, CONST char *pattern); +static int NsfObjInfoCallableFilterMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *filter); +static int NsfObjInfoCallableMethodMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *name); +static int NsfObjInfoCallableMethodsMethod(Tcl_Interp *interp, NsfObject *obj, int withMethodtype, int withCallprotection, int withApplication, int withNomixins, int withIncontext, CONST char *pattern); +static int NsfObjInfoCallableSlotsMethod(Tcl_Interp *interp, NsfObject *obj, NsfClass *withType); static int NsfObjInfoChildrenMethod(Tcl_Interp *interp, NsfObject *obj, NsfClass *withType, CONST char *pattern); static int NsfObjInfoClassMethod(Tcl_Interp *interp, NsfObject *obj); static int NsfObjInfoFilterguardMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *filter); @@ -299,7 +293,6 @@ static int NsfObjInfoMixinguardMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *mixin); static int NsfObjInfoParentMethod(Tcl_Interp *interp, NsfObject *obj); static int NsfObjInfoPrecedenceMethod(Tcl_Interp *interp, NsfObject *obj, int withIntrinsic, CONST char *pattern); -static int NsfObjInfoSlotObjectsMethod(Tcl_Interp *interp, NsfObject *obj, NsfClass *withType); static int NsfObjInfoVarsMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *pattern); enum { @@ -362,7 +355,10 @@ NsfOUpvarMethodIdx, NsfOVolatileMethodIdx, NsfOVwaitMethodIdx, - NsfObjInfoCallableMethodIdx, + NsfObjInfoCallableFilterMethodIdx, + NsfObjInfoCallableMethodMethodIdx, + NsfObjInfoCallableMethodsMethodIdx, + NsfObjInfoCallableSlotsMethodIdx, NsfObjInfoChildrenMethodIdx, NsfObjInfoClassMethodIdx, NsfObjInfoFilterguardMethodIdx, @@ -378,7 +374,6 @@ NsfObjInfoMixinguardMethodIdx, NsfObjInfoParentMethodIdx, NsfObjInfoPrecedenceMethodIdx, - NsfObjInfoSlotObjectsMethodIdx, NsfObjInfoVarsMethodIdx } NsfMethods; @@ -1549,31 +1544,87 @@ } static int -NsfObjInfoCallableMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { +NsfObjInfoCallableFilterMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ParseContext pc; NsfObject *obj = (NsfObject *)clientData; if (!obj) return NsfObjErrType(interp, objv[0], "Object", ""); if (ArgumentParse(interp, objc, objv, obj, objv[0], - method_definitions[NsfObjInfoCallableMethodIdx].paramDefs, - method_definitions[NsfObjInfoCallableMethodIdx].nrParameters, 1, + method_definitions[NsfObjInfoCallableFilterMethodIdx].paramDefs, + method_definitions[NsfObjInfoCallableFilterMethodIdx].nrParameters, 1, &pc) != TCL_OK) { return TCL_ERROR; } else { - int infocallablesubcmd = (int )PTR2INT(pc.clientData[0]); - int withMethodtype = (int )PTR2INT(pc.clientData[1]); - int withCallprotection = (int )PTR2INT(pc.clientData[2]); - int withApplication = (int )PTR2INT(pc.clientData[3]); - int withNomixins = (int )PTR2INT(pc.clientData[4]); - int withIncontext = (int )PTR2INT(pc.clientData[5]); - CONST char *pattern = (CONST char *)pc.clientData[6]; + CONST char *filter = (CONST char *)pc.clientData[0]; ParseContextRelease(&pc); - return NsfObjInfoCallableMethod(interp, obj, infocallablesubcmd, withMethodtype, withCallprotection, withApplication, withNomixins, withIncontext, pattern); + return NsfObjInfoCallableFilterMethod(interp, obj, filter); } } static int +NsfObjInfoCallableMethodMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; + NsfObject *obj = (NsfObject *)clientData; + if (!obj) return NsfObjErrType(interp, objv[0], "Object", ""); + if (ArgumentParse(interp, objc, objv, obj, objv[0], + method_definitions[NsfObjInfoCallableMethodMethodIdx].paramDefs, + method_definitions[NsfObjInfoCallableMethodMethodIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + CONST char *name = (CONST char *)pc.clientData[0]; + + ParseContextRelease(&pc); + return NsfObjInfoCallableMethodMethod(interp, obj, name); + + } +} + +static int +NsfObjInfoCallableMethodsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; + NsfObject *obj = (NsfObject *)clientData; + if (!obj) return NsfObjErrType(interp, objv[0], "Object", ""); + if (ArgumentParse(interp, objc, objv, obj, objv[0], + method_definitions[NsfObjInfoCallableMethodsMethodIdx].paramDefs, + method_definitions[NsfObjInfoCallableMethodsMethodIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + int withMethodtype = (int )PTR2INT(pc.clientData[0]); + int withCallprotection = (int )PTR2INT(pc.clientData[1]); + int withApplication = (int )PTR2INT(pc.clientData[2]); + int withNomixins = (int )PTR2INT(pc.clientData[3]); + int withIncontext = (int )PTR2INT(pc.clientData[4]); + CONST char *pattern = (CONST char *)pc.clientData[5]; + + ParseContextRelease(&pc); + return NsfObjInfoCallableMethodsMethod(interp, obj, withMethodtype, withCallprotection, withApplication, withNomixins, withIncontext, pattern); + + } +} + +static int +NsfObjInfoCallableSlotsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; + NsfObject *obj = (NsfObject *)clientData; + if (!obj) return NsfObjErrType(interp, objv[0], "Object", ""); + if (ArgumentParse(interp, objc, objv, obj, objv[0], + method_definitions[NsfObjInfoCallableSlotsMethodIdx].paramDefs, + method_definitions[NsfObjInfoCallableSlotsMethodIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + NsfClass *withType = (NsfClass *)pc.clientData[0]; + + ParseContextRelease(&pc); + return NsfObjInfoCallableSlotsMethod(interp, obj, withType); + + } +} + +static int NsfObjInfoChildrenMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ParseContext pc; NsfObject *obj = (NsfObject *)clientData; @@ -1885,25 +1936,6 @@ } static int -NsfObjInfoSlotObjectsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - ParseContext pc; - NsfObject *obj = (NsfObject *)clientData; - if (!obj) return NsfObjErrType(interp, objv[0], "Object", ""); - if (ArgumentParse(interp, objc, objv, obj, objv[0], - method_definitions[NsfObjInfoSlotObjectsMethodIdx].paramDefs, - method_definitions[NsfObjInfoSlotObjectsMethodIdx].nrParameters, 1, - &pc) != TCL_OK) { - return TCL_ERROR; - } else { - NsfClass *withType = (NsfClass *)pc.clientData[0]; - - ParseContextRelease(&pc); - return NsfObjInfoSlotObjectsMethod(interp, obj, withType); - - } -} - -static int NsfObjInfoVarsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ParseContext pc; NsfObject *obj = (NsfObject *)clientData; @@ -2175,15 +2207,23 @@ {"::nsf::cmd::Object::vwait", NsfOVwaitMethodStub, 1, { {"varname", 1, 0, ConvertToString}} }, -{"::nsf::cmd::ObjectInfo::callable", NsfObjInfoCallableMethodStub, 7, { - {"infocallablesubcmd", 1, 1, ConvertToInfocallablesubcmd}, +{"::nsf::cmd::ObjectInfo::callablefilter", NsfObjInfoCallableFilterMethodStub, 1, { + {"filter", 0, 0, ConvertToString}} +}, +{"::nsf::cmd::ObjectInfo::callablemethod", NsfObjInfoCallableMethodMethodStub, 1, { + {"name", 0, 0, ConvertToString}} +}, +{"::nsf::cmd::ObjectInfo::callablemethods", NsfObjInfoCallableMethodsMethodStub, 6, { {"-methodtype", 0, 1, ConvertToMethodtype}, {"-callprotection", 0, 1, ConvertToCallprotection}, {"-application", 0, 0, ConvertToString}, {"-nomixins", 0, 0, ConvertToString}, {"-incontext", 0, 0, ConvertToString}, {"pattern", 0, 0, ConvertToString}} }, +{"::nsf::cmd::ObjectInfo::callableslots", NsfObjInfoCallableSlotsMethodStub, 1, { + {"-type", 0, 1, ConvertToClass}} +}, {"::nsf::cmd::ObjectInfo::children", NsfObjInfoChildrenMethodStub, 2, { {"-type", 0, 1, ConvertToClass}, {"pattern", 0, 0, ConvertToString}} @@ -2241,9 +2281,6 @@ {"-intrinsic", 0, 0, ConvertToString}, {"pattern", 0, 0, ConvertToString}} }, -{"::nsf::cmd::ObjectInfo::slotobjects", NsfObjInfoSlotObjectsMethodStub, 1, { - {"-type", 0, 1, ConvertToClass}} -}, {"::nsf::cmd::ObjectInfo::vars", NsfObjInfoVarsMethodStub, 1, { {"pattern", 0, 0, ConvertToString}} },{NULL} Index: library/nx/nx.tcl =================================================================== diff -u -r99ee1ab0e5d0d04de1dc14cf190b27a0ce9edfcf -r88ce4132aeb39289918426aa2c285c354a102a1e --- library/nx/nx.tcl (.../nx.tcl) (revision 99ee1ab0e5d0d04de1dc14cf190b27a0ce9edfcf) +++ library/nx/nx.tcl (.../nx.tcl) (revision 88ce4132aeb39289918426aa2c285c354a102a1e) @@ -448,25 +448,28 @@ # we have to use "eval", since objectParameters are not defined yet Object eval { - :alias "info callable" ::nsf::cmd::ObjectInfo::callable - :alias "info children" ::nsf::cmd::ObjectInfo::children - :alias "info class" ::nsf::cmd::ObjectInfo::class - :alias "info filter guard" ::nsf::cmd::ObjectInfo::filterguard - :alias "info filter methods" ::nsf::cmd::ObjectInfo::filtermethods - :alias "info forward" ::nsf::cmd::ObjectInfo::forward - :alias "info has mixin" ::nsf::cmd::ObjectInfo::hasmixin - :alias "info has namespace" ::nsf::cmd::ObjectInfo::hasnamespace - :alias "info has type" ::nsf::cmd::ObjectInfo::hastype - :alias "info is" ::nsf::cmd::ObjectInfo::is - :alias "info methods" ::nsf::cmd::ObjectInfo::methods - :alias "info mixin guard" ::nsf::cmd::ObjectInfo::mixinguard - :alias "info mixin classes" ::nsf::cmd::ObjectInfo::mixinclasses - :alias "info parent" ::nsf::cmd::ObjectInfo::parent - :alias "info precedence" ::nsf::cmd::ObjectInfo::precedence - :method "info slotobjects" {} { - ::nsf::dispatch [::nsf::current object] \ - ::nsf::cmd::ObjectInfo::slotobjects -type ::nx::Slot + #:alias "info callable" ::nsf::cmd::ObjectInfo::callable + :alias "info callable filter" ::nsf::cmd::ObjectInfo::callablefilter + :alias "info callable method" ::nsf::cmd::ObjectInfo::callablemethod + :alias "info callable methods" ::nsf::cmd::ObjectInfo::callablemethods + :method "info callable slots" {} { + ::nsf::dispatch [::nsf::current object] \ + ::nsf::cmd::ObjectInfo::callableslots -type ::nx::Slot } + :alias "info children" ::nsf::cmd::ObjectInfo::children + :alias "info class" ::nsf::cmd::ObjectInfo::class + :alias "info filter guard" ::nsf::cmd::ObjectInfo::filterguard + :alias "info filter methods" ::nsf::cmd::ObjectInfo::filtermethods + :alias "info forward" ::nsf::cmd::ObjectInfo::forward + :alias "info has mixin" ::nsf::cmd::ObjectInfo::hasmixin + :alias "info has namespace" ::nsf::cmd::ObjectInfo::hasnamespace + :alias "info has type" ::nsf::cmd::ObjectInfo::hastype + :alias "info is" ::nsf::cmd::ObjectInfo::is + :alias "info methods" ::nsf::cmd::ObjectInfo::methods + :alias "info mixin guard" ::nsf::cmd::ObjectInfo::mixinguard + :alias "info mixin classes" ::nsf::cmd::ObjectInfo::mixinclasses + :alias "info parent" ::nsf::cmd::ObjectInfo::parent + :alias "info precedence" ::nsf::cmd::ObjectInfo::precedence :method "info slots" {} { set slotContainer [::nsf::current object]::slot if {[::nsf::isobject $slotContainer]} { @@ -495,8 +498,15 @@ } Class eval { - #:alias "info classparent" ::nsf::cmd::ObjectInfo::parent - #:alias "info classchildren" ::nsf::cmd::ObjectInfo::children + :alias "info callable filter" ::nsf::cmd::ObjectInfo::callablefilter + :alias "info callable method" ::nsf::cmd::ObjectInfo::callablemethod + :alias "info callable methods" ::nsf::cmd::ObjectInfo::callablemethods + :method "info callable slots" {} { + ::nsf::dispatch [::nsf::current object] \ + ::nsf::cmd::ObjectInfo::callableslots -type ::nx::Slot + } + #:alias "info callable" ::nx::Object::slot::__info::callable + :alias "info filter guard" ::nsf::cmd::ClassInfo::filterguard :alias "info has mixin" ::nsf::cmd::ObjectInfo::hasmixin :alias "info has namespace" ::nsf::cmd::ObjectInfo::hasnamespace @@ -545,8 +555,8 @@ # puts Object::info-methods=[lsort [nsf::dispatch ::nx::Object::slot::__info ::nsf::cmd::ObjectInfo::methods]] # puts Class::info-methods_=[lsort [nsf::dispatch ::nx::Class::slot::__info ::nsf::cmd::ObjectInfo::methods]] # puts "" - # puts Object::info-callable=[nsf::dispatch ::nx::Object ::nsf::cmd::ObjectInfo::callable method info] - # puts Class::info-callable_=[nsf::dispatch ::nx::Class ::nsf::cmd::ObjectInfo::callable method info] + # puts Object::info-callable=[nsf::dispatch ::nx::Object ::nsf::cmd::ObjectInfo::callablemethod info] + # puts Class::info-callable_=[nsf::dispatch ::nx::Class ::nsf::cmd::ObjectInfo::callablemethod info] # puts "" # puts Object::info-def=[nsf::dispatch ::nx::Object ::nsf::cmd::ClassInfo::method definition info] # puts Class::info-def_=[nsf::dispatch ::nx::Class ::nsf::cmd::ClassInfo::method definition info] @@ -745,8 +755,8 @@ ObjectParameterSlot method unknown {method args} { set methods [list] - foreach m [::nsf::dispatch [::nsf::current object] ::nsf::cmd::ObjectInfo::callable methods] { - if {[::nsf::dispatch Object ::nsf::cmd::ObjectInfo::callable methods $m] ne ""} continue + foreach m [::nsf::dispatch [::nsf::current object] ::nsf::cmd::ObjectInfo::callablemethods] { + if {[::nsf::dispatch Object ::nsf::cmd::ObjectInfo::callablemethods $m] ne ""} continue if {[string match __* $m]} continue lappend methods $m } @@ -879,7 +889,7 @@ proc ::nsf::parametersFromSlots {obj} { set parameterdefinitions [list] - foreach slot [::nsf::dispatch $obj ::nsf::cmd::ObjectInfo::slotobjects -type ::nx::Slot] { + foreach slot [::nsf::dispatch $obj ::nsf::cmd::ObjectInfo::callableslots -type ::nx::Slot] { # Skip some slots for xotcl; # TODO: maybe different parameterFromSlots for xotcl? if {[::nsf::is class ::xotcl::Object] Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -r99ee1ab0e5d0d04de1dc14cf190b27a0ce9edfcf -r88ce4132aeb39289918426aa2c285c354a102a1e --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 99ee1ab0e5d0d04de1dc14cf190b27a0ce9edfcf) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 88ce4132aeb39289918426aa2c285c354a102a1e) @@ -482,7 +482,7 @@ set methodtype all if {$nocmds} {set methodtype scripted} if {$noprocs} {if {$nocmds} {return ""}; set methodtype builtin} - set cmd [list ::nsf::cmd::ObjectInfo::callable methods -methodtype $methodtype] + set cmd [list ::nsf::cmd::ObjectInfo::callablemethods -methodtype $methodtype] if {$incontext} {lappend cmd -incontext} if {[info exists pattern]} {lappend cmd $pattern} my {*}$cmd @@ -694,12 +694,12 @@ } Object instproc filtersearch {filter} { set handle [::nsf::dispatch [::nsf::current object] \ - ::nsf::cmd::ObjectInfo::callable filter $filter] + ::nsf::cmd::ObjectInfo::callablefilter $filter] return [method_handle_to_xotcl $handle] } Object instproc procsearch {name} { set handle [::nsf::dispatch [::nsf::current object] \ - ::nsf::cmd::ObjectInfo::callable method $name] + ::nsf::cmd::ObjectInfo::callablemethod $name] return [method_handle_to_xotcl $handle] } Class instproc allinstances {} { Index: tests/info-method.tcl =================================================================== diff -u -rf1358bf60e01f773bf04170671c5066a2874ac69 -r88ce4132aeb39289918426aa2c285c354a102a1e --- tests/info-method.tcl (.../info-method.tcl) (revision f1358bf60e01f773bf04170671c5066a2874ac69) +++ tests/info-method.tcl (.../info-method.tcl) (revision 88ce4132aeb39289918426aa2c285c354a102a1e) @@ -191,7 +191,7 @@ } D create d1 - ? {D info slotobjects} "::nx::Class::slot::object-mixin ::nx::Class::slot::mixin ::nx::Class::slot::superclass ::nx::Class::slot::object-filter ::nx::Class::slot::filter ::nx::Object::slot::class" + ? {D info callable slots} "::nx::Class::slot::object-mixin ::nx::Class::slot::mixin ::nx::Class::slot::superclass ::nx::Class::slot::object-filter ::nx::Class::slot::filter ::nx::Object::slot::class" ? {D info slots} "::D::slot::b ::D::slot::a2 ::D::slot::c" ? {::nx::Object info method parameter info} "" } \ No newline at end of file