Index: TODO =================================================================== diff -u -r224d1a24b787b67fb9f0ff8a894f3092e8e4d5ae -ra98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3 --- TODO (.../TODO) (revision 224d1a24b787b67fb9f0ff8a894f3092e8e4d5ae) +++ TODO (.../TODO) (revision a98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3) @@ -821,6 +821,11 @@ - use size_t where appropriate - added notnull annotations +- Implemented "Class info parameter" in Tcl, aliases for xotcl. + Now both definition of parameters and setting of __parameter are + in Tcl. + + TODO: - rename source files from xotcl{Int}.{ch}->next*.* | next-scripting*.* ? Stefan, meinung dazu? Notwending|Empfehlenswert|nicht? @@ -850,9 +855,7 @@ - rename tests from .xotcl to .tcl -- info parameter in tcl? - -- copy objectMethod and classMethod as comments +- copy decls for objectMethod and classMethod as comments to xotcl.c, fix and check order - should we extract parameter decls from pseudo-comments from the c source Index: generic/gentclAPI.decls =================================================================== diff -u -ra2a10538733f58248a38ab9d13d342ebd0fb475d -ra98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3 --- generic/gentclAPI.decls (.../gentclAPI.decls) (revision a2a10538733f58248a38ab9d13d342ebd0fb475d) +++ generic/gentclAPI.decls (.../gentclAPI.decls) (revision a98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3) @@ -860,9 +860,6 @@ {-argName "-scope" -required 0 -nrargs 1 -type "all|class|object"} {-argName "pattern" -type objpattern} } -infoClassMethod parameter XOTclClassInfoParameterMethod { - {-argName "class" -required 1 -type class} -} infoClassMethod slots XOTclClassInfoSlotsMethod { {-argName "class" -required 1 -type class} } Index: generic/predefined.h =================================================================== diff -u -r2d07f2bafa5332c5e30f4969b4233d2345eab832 -ra98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3 --- generic/predefined.h (.../predefined.h) (revision 2d07f2bafa5332c5e30f4969b4233d2345eab832) +++ generic/predefined.h (.../predefined.h) (revision a98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3) @@ -454,6 +454,12 @@ "set slot [::nx::core::current object]::slot\n" "if {![::nx::core::objectproperty $slot object]} {::nx::Object create $slot}\n" "::nx::core::setvar $slot __parameter $arglist}\n" +"::nx::core::method ::nx::classInfo parameter {class} {\n" +"set slot ${class}::slot\n" +"if {![::nx::core::objectproperty $slot object]} {::nx::Object create $slot}\n" +"if {[::nx::core::existsvar $slot __parameter]} {\n" +"return [::nx::core::setvar $slot __parameter]}\n" +"return \"\"}\n" "proc createBootstrapAttributeSlots {} {}\n" "::nx::Slot method type=hasmixin {name value arg} {\n" "if {![::nx::core::objectproperty $value hasmixin $arg]} {\n" Index: generic/predefined.xotcl =================================================================== diff -u -r6ef3475add453ab5c2d62ca807a545bf4bc0686a -ra98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3 --- generic/predefined.xotcl (.../predefined.xotcl) (revision 6ef3475add453ab5c2d62ca807a545bf4bc0686a) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision a98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3) @@ -1127,6 +1127,14 @@ if {![::nx::core::objectproperty $slot object]} {::nx::Object create $slot} ::nx::core::setvar $slot __parameter $arglist } + ::nx::core::method ::nx::classInfo parameter {class} { + set slot ${class}::slot + if {![::nx::core::objectproperty $slot object]} {::nx::Object create $slot} + if {[::nx::core::existsvar $slot __parameter]} { + return [::nx::core::setvar $slot __parameter] + } + return "" + } ################################################################## # now the slots are defined; now we can defines the Objects or Index: generic/tclAPI.h =================================================================== diff -u -r3f0573cc75724179f416942b974373e5a62ec05e -ra98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3 --- generic/tclAPI.h (.../tclAPI.h) (revision 3f0573cc75724179f416942b974373e5a62ec05e) +++ generic/tclAPI.h (.../tclAPI.h) (revision a98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3) @@ -164,7 +164,6 @@ static int XOTclClassInfoMixinMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclClassInfoMixinOfMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclClassInfoMixinguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int XOTclClassInfoParameterMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclClassInfoSlotsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclClassInfoSubclassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclClassInfoSuperclassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); @@ -245,7 +244,6 @@ static int XOTclClassInfoMixinMethod(Tcl_Interp *interp, XOTclClass *class, int withClosure, int withGuards, CONST char *patternString, XOTclObject *patternObj); static int XOTclClassInfoMixinOfMethod(Tcl_Interp *interp, XOTclClass *class, int withClosure, int withScope, CONST char *patternString, XOTclObject *patternObj); static int XOTclClassInfoMixinguardMethod(Tcl_Interp *interp, XOTclClass *class, CONST char *mixin); -static int XOTclClassInfoParameterMethod(Tcl_Interp *interp, XOTclClass *class); static int XOTclClassInfoSlotsMethod(Tcl_Interp *interp, XOTclClass *class); static int XOTclClassInfoSubclassMethod(Tcl_Interp *interp, XOTclClass *class, int withClosure, CONST char *patternString, XOTclObject *patternObj); static int XOTclClassInfoSuperclassMethod(Tcl_Interp *interp, XOTclClass *class, int withClosure, Tcl_Obj *pattern); @@ -327,7 +325,6 @@ XOTclClassInfoMixinMethodIdx, XOTclClassInfoMixinOfMethodIdx, XOTclClassInfoMixinguardMethodIdx, - XOTclClassInfoParameterMethodIdx, XOTclClassInfoSlotsMethodIdx, XOTclClassInfoSubclassMethodIdx, XOTclClassInfoSuperclassMethodIdx, @@ -791,24 +788,6 @@ } static int -XOTclClassInfoParameterMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - parseContext pc; - - if (ArgumentParse(interp, objc, objv, NULL, objv[0], - method_definitions[XOTclClassInfoParameterMethodIdx].paramDefs, - method_definitions[XOTclClassInfoParameterMethodIdx].nrParameters, - &pc) != TCL_OK) { - return TCL_ERROR; - } else { - XOTclClass *class = (XOTclClass *)pc.clientData[0]; - - parseContextRelease(&pc); - return XOTclClassInfoParameterMethod(interp, class); - - } -} - -static int XOTclClassInfoSlotsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; @@ -2060,9 +2039,6 @@ {"class", 1, 0, convertToClass}, {"mixin", 1, 0, convertToString}} }, -{"::nx::core::cmd::ClassInfo::parameter", XOTclClassInfoParameterMethodStub, 1, { - {"class", 1, 0, convertToClass}} -}, {"::nx::core::cmd::ClassInfo::slots", XOTclClassInfoSlotsMethodStub, 1, { {"class", 1, 0, convertToClass}} }, Index: generic/xotcl.c =================================================================== diff -u -r5f4e564db33cac6f6fdf57c6ba82f61603641004 -ra98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3 --- generic/xotcl.c (.../xotcl.c) (revision 5f4e564db33cac6f6fdf57c6ba82f61603641004) +++ generic/xotcl.c (.../xotcl.c) (revision a98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3) @@ -14033,36 +14033,6 @@ } /* -infoClassMethod parameter XOTclClassInfoParameterMethod { - {-argName "class" -required 1 -type class} -} -*/ -static int XOTclClassInfoParameterMethod(Tcl_Interp *interp, XOTclClass *class) { - Tcl_DString ds, *dsPtr = &ds; - XOTclObject *object; - - /* TODO: shouldn't this be implemented in tcl? no need for c, - hardcoded __parameter should be in predefined rather than here - */ - DSTRING_INIT(dsPtr); - Tcl_DStringAppend(dsPtr, className(class), -1); - Tcl_DStringAppend(dsPtr, "::slot", 6); - object = XOTclpGetObject(interp, Tcl_DStringValue(dsPtr)); - if (object) { - Tcl_Obj *varNameObj = Tcl_NewStringObj("__parameter",-1); - Tcl_Obj *parameters = XOTcl_ObjGetVar2((XOTcl_Object*)object, - interp, varNameObj, NULL, - TCL_LEAVE_ERR_MSG); - if (parameters) { - Tcl_SetObjResult(interp, parameters); - } - DECR_REF_COUNT(varNameObj); - } - DSTRING_FREE(dsPtr); - return TCL_OK; -} - -/* infoClassMethod slots XOTclClassInfoSlotsMethod { {-argName "class" -required 1 -type class} } Index: library/lib/xotcl1.xotcl =================================================================== diff -u -rdaafc0f0261f6b47a01c7cc8975acdd66f91f360 -ra98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3 --- library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision daafc0f0261f6b47a01c7cc8975acdd66f91f360) +++ library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision a98ffcaf356b6d0a1e9d58ae7d0835ed11f56fa3) @@ -125,8 +125,8 @@ } # - # use parameter definition from next - # + # Use parameter definition from next + # (same with classInfo parameter, see below) ::nx::core::alias ::xotcl::Class parameter ::nx::core::classes::nx::Class::parameter # We provide a default value for superclass (when no superclass is @@ -395,6 +395,7 @@ ::nx::core::alias ::xotcl::classInfo instforward ::nx::core::cmd::ClassInfo::forward #::nx::core::alias ::xotcl::classInfo mixinof ::nx::core::cmd::ClassInfo::object-mixin-of ::nx::core::forward ::xotcl::classInfo mixinof ::nx::core::cmd::ClassInfo::mixinof %1 -scope object + ::nx::core::alias ::xotcl::classInfo parameter ::nx::classInfo::parameter # assertion handling ::nx::core::alias ::xotcl::classInfo invar objectInfo::invar