Index: TODO =================================================================== diff -u -r07b40a4e9fcf594bd65394299372cd8c8556085f -r5a162b098b6a9550218646d470b274769bda8da1 --- TODO (.../TODO) (revision 07b40a4e9fcf594bd65394299372cd8c8556085f) +++ TODO (.../TODO) (revision 5a162b098b6a9550218646d470b274769bda8da1) @@ -5657,13 +5657,15 @@ - new introspection methods: "/obj/ info object method callprotection /m/" "/cls/ info method callprotection /m/" + "/obj/ info baseclass" - extended regression test ======================================================================== TODO: - add to doc: info object method callprotection info method callprotection + info baseclass - gcc6: * ISOBJ(methodObj); will raise a warning, when methodObj is decared as nonnull Index: generic/nsf.c =================================================================== diff -u -r16a02881bff0a0d626d0045dfd96660338d0c314 -r5a162b098b6a9550218646d470b274769bda8da1 --- generic/nsf.c (.../nsf.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) +++ generic/nsf.c (.../nsf.c) (revision 5a162b098b6a9550218646d470b274769bda8da1) @@ -29400,7 +29400,25 @@ /*********************************************************************** * Begin Object Info Methods ***********************************************************************/ +/* +objectInfoMethod baseclass NsfObjInfoBaseclassMethod { +} +*/ + +static int +NsfObjInfoBaseclassMethod(Tcl_Interp *interp, NsfObject *object) { + NsfObjectSystem *osPtr; + + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + osPtr = GetObjectSystem(object); + assert(osPtr != NULL); + + Tcl_SetObjResult(interp, osPtr->rootClass->object.cmdName); + + return TCL_OK; +} /* objectInfoMethod children NsfObjInfoChildrenMethod { {-argName "-type" -required 0 -nrargs 1 -type class} Index: generic/nsfAPI.decls =================================================================== diff -u -r19c84744084963110f84f4ce28fbf55714c79635 -r5a162b098b6a9550218646d470b274769bda8da1 --- generic/nsfAPI.decls (.../nsfAPI.decls) (revision 19c84744084963110f84f4ce28fbf55714c79635) +++ generic/nsfAPI.decls (.../nsfAPI.decls) (revision 5a162b098b6a9550218646d470b274769bda8da1) @@ -441,6 +441,8 @@ # # info object methods # +objectInfoMethod baseclass NsfObjInfoBaseclassMethod { +} objectInfoMethod children NsfObjInfoChildrenMethod { {-argName "-type" -required 0 -type class} {-argName "pattern" -required 0} Index: generic/nsfAPI.h =================================================================== diff -u -r16a02881bff0a0d626d0045dfd96660338d0c314 -r5a162b098b6a9550218646d470b274769bda8da1 --- generic/nsfAPI.h (.../nsfAPI.h) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) +++ generic/nsfAPI.h (.../nsfAPI.h) (revision 5a162b098b6a9550218646d470b274769bda8da1) @@ -295,7 +295,7 @@ /* just to define the symbol */ -static Nsf_methodDefinition method_definitions[112]; +static Nsf_methodDefinition method_definitions[113]; static const char *method_command_namespace_names[] = { "::nsf::methods::object::info", @@ -477,6 +477,8 @@ NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(4); static int NsfOVolatileMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(4); +static int NsfObjInfoBaseclassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) + NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(4); static int NsfObjInfoChildrenMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(4); static int NsfObjInfoClassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) @@ -700,6 +702,8 @@ NSF_nonnull(1) NSF_nonnull(2); static int NsfOVolatileMethod(Tcl_Interp *interp, NsfObject *obj) NSF_nonnull(1) NSF_nonnull(2); +static int NsfObjInfoBaseclassMethod(Tcl_Interp *interp, NsfObject *obj) + NSF_nonnull(1) NSF_nonnull(2); static int NsfObjInfoChildrenMethod(Tcl_Interp *interp, NsfObject *obj, NsfClass *withType, const char *pattern) NSF_nonnull(1) NSF_nonnull(2); static int NsfObjInfoClassMethod(Tcl_Interp *interp, NsfObject *obj) @@ -837,6 +841,7 @@ NsfOUplevelMethodIdx, NsfOUpvarMethodIdx, NsfOVolatileMethodIdx, + NsfObjInfoBaseclassMethodIdx, NsfObjInfoChildrenMethodIdx, NsfObjInfoClassMethodIdx, NsfObjInfoFilterguardMethodIdx, @@ -2833,6 +2838,26 @@ } static int +NsfObjInfoBaseclassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { + NsfObject *obj; + + NSF_nonnull_assert(clientData != NULL); + assert(objc > 0); + + obj = (NsfObject *)clientData; + + + if (unlikely(objc != 1)) { + return NsfArgumentError(interp, "too many arguments:", + method_definitions[NsfObjInfoBaseclassMethodIdx].paramDefs, + NULL, objv[0]); + } + + return NsfObjInfoBaseclassMethod(interp, obj); + +} + +static int NsfObjInfoChildrenMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { ParseContext pc; NsfObject *obj; @@ -3447,7 +3472,7 @@ } } -static Nsf_methodDefinition method_definitions[112] = { +static Nsf_methodDefinition method_definitions[113] = { {"::nsf::methods::class::alloc", NsfCAllocMethodStub, 1, { {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, @@ -3838,6 +3863,9 @@ {"::nsf::methods::object::volatile", NsfOVolatileMethodStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, +{"::nsf::methods::object::info::baseclass", NsfObjInfoBaseclassMethodStub, 0, { + {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} +}, {"::nsf::methods::object::info::children", NsfObjInfoChildrenMethodStub, 2, { {"-type", 0, 1, Nsf_ConvertTo_Class, NULL,NULL,"class",NULL,NULL,NULL,NULL,NULL}, {"pattern", 0, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} Index: generic/nsfAPI.nxdocindex =================================================================== diff -u -rf31c1a01c6a389f693b8db0f2204cbb46180fef1 -r5a162b098b6a9550218646d470b274769bda8da1 --- generic/nsfAPI.nxdocindex (.../nsfAPI.nxdocindex) (revision f31c1a01c6a389f693b8db0f2204cbb46180fef1) +++ generic/nsfAPI.nxdocindex (.../nsfAPI.nxdocindex) (revision 5a162b098b6a9550218646d470b274769bda8da1) @@ -73,6 +73,7 @@ set ::nxdoc::include(::nsf::methods::class::new) 0 set ::nxdoc::include(::nsf::methods::class::recreate) 0 set ::nxdoc::include(::nsf::methods::class::superclass) 0 +set ::nxdoc::include(::nsf::methods::object::info::baseclass) 0 set ::nxdoc::include(::nsf::methods::object::info::children) 0 set ::nxdoc::include(::nsf::methods::object::info::class) 0 set ::nxdoc::include(::nsf::methods::object::info::filterguard) 0 Index: library/nx/nx.tcl =================================================================== diff -u -r07b40a4e9fcf594bd65394299372cd8c8556085f -r5a162b098b6a9550218646d470b274769bda8da1 --- library/nx/nx.tcl (.../nx.tcl) (revision 07b40a4e9fcf594bd65394299372cd8c8556085f) +++ library/nx/nx.tcl (.../nx.tcl) (revision 5a162b098b6a9550218646d470b274769bda8da1) @@ -743,6 +743,7 @@ :method "info lookup variables" {pattern:optional} { return [: info lookup slots -type ::nx::VariableSlot {*}[current args]] } + :alias "info baseclass" ::nsf::methods::object::info::baseclass :alias "info children" ::nsf::methods::object::info::children :alias "info class" ::nsf::methods::object::info::class :alias "info has mixin" ::nsf::methods::object::info::hasmixin Index: tests/class-method.test =================================================================== diff -u -r0f881e4bc45e927c8d84c1b1b468ef7537cb9b03 -r5a162b098b6a9550218646d470b274769bda8da1 --- tests/class-method.test (.../class-method.test) (revision 0f881e4bc45e927c8d84c1b1b468ef7537cb9b03) +++ tests/class-method.test (.../class-method.test) (revision 5a162b098b6a9550218646d470b274769bda8da1) @@ -17,7 +17,7 @@ ? {lsort [::C info object methods]} "f" ? {lsort [::C info]} \ - "valid submethods of ::C info: children class filters has heritage info instances lookup method methods mixinof mixins name object parent precedence slots subclasses superclasses variable variables vars" + "valid submethods of ::C info: baseclass children class filters has heritage info instances lookup method methods mixinof mixins name object parent precedence slots subclasses superclasses variable variables vars" } # @@ -76,7 +76,7 @@ ? {lsort [::C info object methods]} "a f foo fwd p v2" ? {lsort [::C info]} \ - "valid submethods of ::C info: children class filters has heritage info instances lookup method methods mixinof mixins name object parent precedence slots subclasses superclasses variable variables vars" + "valid submethods of ::C info: baseclass children class filters has heritage info instances lookup method methods mixinof mixins name object parent precedence slots subclasses superclasses variable variables vars" } # Index: tests/method-parameter.test =================================================================== diff -u -r07b40a4e9fcf594bd65394299372cd8c8556085f -r5a162b098b6a9550218646d470b274769bda8da1 --- tests/method-parameter.test (.../method-parameter.test) (revision 07b40a4e9fcf594bd65394299372cd8c8556085f) +++ tests/method-parameter.test (.../method-parameter.test) (revision 5a162b098b6a9550218646d470b274769bda8da1) @@ -107,7 +107,7 @@ nx::test case flag-in-ensemble { nx::Class create C - set info {info children, info class, info filters, info has mixin, info has namespace, info has type, info heritage, info info, info instances, info lookup filter, info lookup filters, info lookup method, info lookup methods, info lookup mixins, info lookup parameters, info lookup slots, info lookup syntax, info lookup variables, info method args, info method body, info method callprotection, info method definition, info method definitionhandle, info method exists, info method handle, info method origin, info method parameters, info method registrationhandle, info method returns, info method submethods, info method syntax, info method type, info methods, info mixinof, info mixins, info name, info object filters, info object method args, info object method body, info object method callprotection, info object method definition, info object method definitionhandle, info object method exists, info object method handle, info object method origin, info object method parameters, info object method registrationhandle, info object method returns, info object method submethods, info object method syntax, info object method type, info object methods, info object mixins, info object slots, info object variables, info parent, info precedence, info slots, info subclasses, info superclasses, info variable definition, info variable name, info variable parameter, info variables, info vars} + set info {info baseclass, info children, info class, info filters, info has mixin, info has namespace, info has type, info heritage, info info, info instances, info lookup filter, info lookup filters, info lookup method, info lookup methods, info lookup mixins, info lookup parameters, info lookup slots, info lookup syntax, info lookup variables, info method args, info method body, info method callprotection, info method definition, info method definitionhandle, info method exists, info method handle, info method origin, info method parameters, info method registrationhandle, info method returns, info method submethods, info method syntax, info method type, info methods, info mixinof, info mixins, info name, info object filters, info object method args, info object method body, info object method callprotection, info object method definition, info object method definitionhandle, info object method exists, info object method handle, info object method origin, info object method parameters, info object method registrationhandle, info object method returns, info object method submethods, info object method syntax, info object method type, info object methods, info object mixins, info object slots, info object variables, info parent, info precedence, info slots, info subclasses, info superclasses, info variable definition, info variable name, info variable parameter, info variables, info vars} ? {C info superclasses} "::nx::Object" ? {C info -a superclass} "unable to dispatch sub-method \"-a\" of ::C info; valid are: $info" Index: tests/object-system.test =================================================================== diff -u -r2a3ac3f00afd5c5cfdfb1a9fff667cdec5b861be -r5a162b098b6a9550218646d470b274769bda8da1 --- tests/object-system.test (.../object-system.test) (revision 2a3ac3f00afd5c5cfdfb1a9fff667cdec5b861be) +++ tests/object-system.test (.../object-system.test) (revision 5a162b098b6a9550218646d470b274769bda8da1) @@ -27,12 +27,14 @@ ? {::nsf::is metaclass nx::Object} 0 ? {nx::Object info superclasses} "" ? {nx::Object info class} ::nx::Class +? {nx::Object info baseclass} ::nx::Object ? {::nsf::object::exists nx::Class} 1 ? {::nsf::is class nx::Class} 1 ? {::nsf::is metaclass nx::Class} 1 ? {nx::Class info superclasses} ::nx::Object ? {nx::Class info class} ::nx::Class +? {nx::Class info baseclass} ::nx::Object # # Minimal argument passing tests for early problem detection @@ -82,6 +84,7 @@ ? {::nsf::is class o} 0 ? {::nsf::is metaclass o} 0 ? {o info class} ::nx::Object +? {o info baseclass} ::nx::Object ? {nx::Object info instances o} ::o ? {nx::Object info instances ::o} ::o o destroy @@ -107,6 +110,7 @@ ? {::nsf::is metaclass M} 1 ? {M info superclasses} ::nx::Class ? {M info class} ::nx::Class +? {M info baseclass} ::nx::Object M create C ? {::nsf::object::exists C} 1 Index: tests/plain-object-method.test =================================================================== diff -u -r0f881e4bc45e927c8d84c1b1b468ef7537cb9b03 -r5a162b098b6a9550218646d470b274769bda8da1 --- tests/plain-object-method.test (.../plain-object-method.test) (revision 0f881e4bc45e927c8d84c1b1b468ef7537cb9b03) +++ tests/plain-object-method.test (.../plain-object-method.test) (revision 5a162b098b6a9550218646d470b274769bda8da1) @@ -11,7 +11,7 @@ ? {o filters set f} "::o: unable to dispatch method 'filters'" ? {lsort [o info object methods]} "f" - ? {lsort [o info]} "valid submethods of ::o info: children class has info lookup name object parent precedence variable vars" + ? {lsort [o info]} "valid submethods of ::o info: baseclass children class has info lookup name object parent precedence variable vars" } # @@ -60,7 +60,7 @@ ? {o info filters} "" ? {lsort [o info object methods]} "a f foo fwd p v2" - ? {lsort [o info]} "valid submethods of ::o info: children class filters has info lookup method methods mixins name object parent precedence slots variable variables vars" + ? {lsort [o info]} "valid submethods of ::o info: baseclass children class filters has info lookup method methods mixins name object parent precedence slots variable variables vars" } # Index: tests/submethods.test =================================================================== diff -u -r00d77486631daa187dbb4b7f53639e729f8583fc -r5a162b098b6a9550218646d470b274769bda8da1 --- tests/submethods.test (.../submethods.test) (revision 00d77486631daa187dbb4b7f53639e729f8583fc) +++ tests/submethods.test (.../submethods.test) (revision 5a162b098b6a9550218646d470b274769bda8da1) @@ -239,7 +239,7 @@ # defaultcmd has to return also subcmds of other shadowed ensembles ? {lsort [o1 info has]} "valid submethods of ::o1 info has: mixin namespace something type" ? {lsort [o1 info]} \ - "valid submethods of ::o1 info: children class has info lookup name object parent precedence variable vars" + "valid submethods of ::o1 info: baseclass children class has info lookup name object parent precedence variable vars" # returning methodpath in ensemble ? {o1 info has something path} "info has something path"