Index: TODO =================================================================== diff -u -r4a717be00f0ded2d1023afbaf7455688459fd185 -r03990ee9d7185ded72b0fa05e81f848e866451c2 --- TODO (.../TODO) (revision 4a717be00f0ded2d1023afbaf7455688459fd185) +++ TODO (.../TODO) (revision 03990ee9d7185ded72b0fa05e81f848e866451c2) @@ -2865,8 +2865,8 @@ - nsf.c: use NsfObjectRefCountIncr() instead of object->refCount++ - nsf.c: fix small memory leak for nsf::is in error cases +- renamed converter from "mixinspec" to "mixinreg" - TODO: - add explicit regression tests for disposition + types - check refcounting for dispo+types Index: generic/nsf.c =================================================================== diff -u -re2d9aad98f218c1634f576c19ffc822937fb5a6d -r03990ee9d7185ded72b0fa05e81f848e866451c2 --- generic/nsf.c (.../nsf.c) (revision e2d9aad98f218c1634f576c19ffc822937fb5a6d) +++ generic/nsf.c (.../nsf.c) (revision 03990ee9d7185ded72b0fa05e81f848e866451c2) @@ -5112,82 +5112,82 @@ ***********************************************************************/ /* - * Mixinspec type begin + * Mixinreg type begin */ typedef struct { NsfClass *class; Tcl_Obj *guardObj; -} MixinSpec; +} MixinReg; -static Tcl_DupInternalRepProc MixinspecDupInteralRep; -static Tcl_FreeInternalRepProc MixinspecFreeInternalRep; -static Tcl_UpdateStringProc MixinspecUpdateString; -static Tcl_SetFromAnyProc MixinspecSetFromAny; +static Tcl_DupInternalRepProc MixinregDupInteralRep; +static Tcl_FreeInternalRepProc MixinregFreeInternalRep; +static Tcl_UpdateStringProc MixinregUpdateString; +static Tcl_SetFromAnyProc MixinregSetFromAny; -static Tcl_ObjType mixinspecObjType = { - "nsfMixinspec", /* name */ - MixinspecFreeInternalRep, /* freeIntRepProc */ - MixinspecDupInteralRep, /* dupIntRepProc */ - MixinspecUpdateString, /* updateStringProc */ - MixinspecSetFromAny /* setFromAnyProc */ +static Tcl_ObjType mixinregObjType = { + "nsfMixinreg", /* name */ + MixinregFreeInternalRep, /* freeIntRepProc */ + MixinregDupInteralRep, /* dupIntRepProc */ + MixinregUpdateString, /* updateStringProc */ + MixinregSetFromAny /* setFromAnyProc */ }; /* * Dummy placeholder, should never be called. */ static void -MixinspecUpdateString(Tcl_Obj *objPtr) { - Tcl_Panic("MixinspecUpdateString %s of type %s should not be called", "updateStringProc", +MixinregUpdateString(Tcl_Obj *objPtr) { + Tcl_Panic("MixinregUpdateString %s of type %s should not be called", "updateStringProc", objPtr->typePtr->name); } /* * Dummy placeholder, should never be called. */ static void -MixinspecDupInteralRep(Tcl_Obj *srcPtr, Tcl_Obj *UNUSED(dupPtr)) { - Tcl_Panic("MixinspecDupInteralRep %s of type %s should not be called", "dupStringProc", +MixinregDupInteralRep(Tcl_Obj *srcPtr, Tcl_Obj *UNUSED(dupPtr)) { + Tcl_Panic("MixinregDupInteralRep %s of type %s should not be called", "dupStringProc", srcPtr->typePtr->name); } /* * freeIntRepProc */ static void -MixinspecFreeInternalRep( - register Tcl_Obj *objPtr) /* Mixinspec structure object with internal +MixinregFreeInternalRep( + register Tcl_Obj *objPtr) /* Mixinreg structure object with internal * representation to free. */ { - MixinSpec *mixinSpecPtr = (MixinSpec *)objPtr->internalRep.twoPtrValue.ptr1; + MixinReg *mixinRegPtr = (MixinReg *)objPtr->internalRep.twoPtrValue.ptr1; - if (mixinSpecPtr != NULL) { - /*fprintf(stderr, "MixinspecFreeInternalRep freeing mixinSpec %p class %p guard %p\n", - mixinSpecPtr, mixinSpecPtr->class, mixinSpecPtr->guardObj);*/ + if (mixinRegPtr != NULL) { + /*fprintf(stderr, "MixinregFreeInternalRep freeing mixinReg %p class %p guard %p\n", + mixinRegPtr, mixinRegPtr->class, mixinRegPtr->guardObj);*/ /* * Decrement refCounts */ - NsfObjectRefCountDecr(&(mixinSpecPtr->class)->object); - if (mixinSpecPtr->guardObj) {DECR_REF_COUNT(mixinSpecPtr->guardObj);} + NsfObjectRefCountDecr(&(mixinRegPtr->class)->object); + if (mixinRegPtr->guardObj) {DECR_REF_COUNT(mixinRegPtr->guardObj);} /* * ... and free structure */ - FREE(MixinSpec, mixinSpecPtr); + FREE(MixinReg, mixinRegPtr); } } /* * setFromAnyProc */ static int -MixinspecSetFromAny( +MixinregSetFromAny( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ register Tcl_Obj *objPtr) /* The object to convert. */ { NsfClass *mixin = NULL; Tcl_Obj *guardObj = NULL, *nameObj; int oc; Tcl_Obj **ov; - MixinSpec *mixinSpecPtr; + MixinReg *mixinRegPtr; if (Tcl_ListObjGetElements(interp, objPtr, &oc, &ov) == TCL_OK) { if (oc == 3 && !strcmp(ObjStr(ov[1]), NsfGlobalStrings[NSF_GUARD_OPTION])) { @@ -5212,31 +5212,31 @@ * Conversion was ok. * Allocate structure ... */ - mixinSpecPtr = NEW(MixinSpec); + mixinRegPtr = NEW(MixinReg); /* * ... and increment refCounts */ NsfObjectRefCountIncr((&mixin->object)); if (guardObj) {INCR_REF_COUNT(guardObj);} - mixinSpecPtr->class = mixin; - mixinSpecPtr->guardObj = guardObj; + mixinRegPtr->class = mixin; + mixinRegPtr->guardObj = guardObj; - /*fprintf(stderr, "MixinspecSetFromAny alloc mixinSpec %p class %p guard %p\n", - mixinSpecPtr, mixinSpecPtr->class, mixinSpecPtr->guardObj);*/ + /*fprintf(stderr, "MixinregSetFromAny alloc mixinReg %p class %p guard %p\n", + mixinRegPtr, mixinRegPtr->class, mixinRegPtr->guardObj);*/ /* * Free origninal rep and store structure as internal representation. */ TclFreeIntRep(objPtr); - objPtr->internalRep.twoPtrValue.ptr1 = (void *)mixinSpecPtr; + objPtr->internalRep.twoPtrValue.ptr1 = (void *)mixinRegPtr; objPtr->internalRep.twoPtrValue.ptr2 = NULL; - objPtr->typePtr = &mixinspecObjType; + objPtr->typePtr = &mixinregObjType; return TCL_OK; } /* - * Mixinspec type end + * Mixinreg type end */ /* @@ -5476,7 +5476,7 @@ *---------------------------------------------------------------------- * MixinAdd -- * - * Add a mixinspec (mixin class with a potential guard) provided as a + * Add a mixinreg (mixin class with a potential guard) provided as a * Tcl_Obj* to 'mixinList' by appending it to the provided cmdList. * * Results: @@ -5497,15 +5497,15 @@ /*fprintf(stderr, "MixinAdd gets obj %p type %p %s\n", nameObj, nameObj->typePtr, nameObj->typePtr?nameObj->typePtr->name : "NULL");*/ /* - * When the provided nameObj is of type mixinspecObjType, the nsf specific + * When the provided nameObj is of type mixinregObjType, the nsf specific * converter was called already and we can simply obtain the mixin class and * the guard from the internal representation. */ - if (nameObj->typePtr == &mixinspecObjType) { - MixinSpec *mixinSpecPtr = nameObj->internalRep.twoPtrValue.ptr1; + if (nameObj->typePtr == &mixinregObjType) { + MixinReg *mixinRegPtr = nameObj->internalRep.twoPtrValue.ptr1; - guardObj = mixinSpecPtr->guardObj; - mixin = mixinSpecPtr->class; + guardObj = mixinRegPtr->guardObj; + mixin = mixinRegPtr->class; } else { if (Tcl_ListObjGetElements(interp, nameObj, &ocName, &ovName) == TCL_OK && ocName > 1) { @@ -9662,11 +9662,11 @@ /* *---------------------------------------------------------------------- - * Nsf_ConvertToMixinspec -- + * Nsf_ConvertToMixinreg -- * * Nsf_TypeConverter setting the client data (passed to C functions) to the * Tcl_Obj. This nsf type converter checks the passed value via the - * mixinspecObjType() tcl_obj converter, which provides an internal + * mixinregObjType() tcl_obj converter, which provides an internal * representation for the client function. * * Results: @@ -9679,16 +9679,16 @@ */ int -Nsf_ConvertToMixinspec(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, +Nsf_ConvertToMixinreg(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int result; *outObjPtr = objPtr; - result = Tcl_ConvertToType(interp, objPtr, &mixinspecObjType); + result = Tcl_ConvertToType(interp, objPtr, &mixinregObjType); if (result == TCL_OK) { *clientData = objPtr; return result; } - return NsfObjErrType(interp, NULL, objPtr, "mixinspec", (Nsf_Param *)pPtr); + return NsfObjErrType(interp, NULL, objPtr, "mixinreg", (Nsf_Param *)pPtr); } /* @@ -10004,8 +10004,8 @@ result = ParamOptionSetConverter(interp, paramPtr, "class", Nsf_ConvertToClass); paramPtr->flags |= NSF_ARG_BASECLASS; - } else if (strncmp(option, "mixinspec", 9) == 0) { - result = ParamOptionSetConverter(interp, paramPtr, "mixinspec", Nsf_ConvertToMixinspec); + } else if (strncmp(option, "mixinreg", 8) == 0) { + result = ParamOptionSetConverter(interp, paramPtr, "mixinreg", Nsf_ConvertToMixinreg); } else if (strncmp(option, "parameter", 9) == 0) { result = ParamOptionSetConverter(interp, paramPtr, "parameter", Nsf_ConvertToParameter); Index: library/nx/nx.tcl =================================================================== diff -u -r58c1880b874484f218afa0275b0998e25d4282f0 -r03990ee9d7185ded72b0fa05e81f848e866451c2 --- library/nx/nx.tcl (.../nx.tcl) (revision 58c1880b874484f218afa0275b0998e25d4282f0) +++ library/nx/nx.tcl (.../nx.tcl) (revision 03990ee9d7185ded72b0fa05e81f848e866451c2) @@ -1216,12 +1216,12 @@ ${os}::Class::slot::dummy destroy ::nx::RelationSlot create ${os}::Object::slot::mixin \ - -forwardername object-mixin -elementtype mixinspec + -forwardername object-mixin -elementtype mixinreg ::nx::RelationSlot create ${os}::Object::slot::filter \ -forwardername object-filter ::nx::RelationSlot create ${os}::Class::slot::mixin \ - -forwardername class-mixin -elementtype mixinspec + -forwardername class-mixin -elementtype mixinreg ::nx::RelationSlot create ${os}::Class::slot::filter \ -forwardername class-filter @@ -1230,7 +1230,7 @@ # of per-object mixins and filters for classes. # ::nx::ObjectParameterSlot create ${os}::Class::slot::object-mixin \ - -methodname "::nsf::classes::nx::Object::mixin" -elementtype mixinspec + -methodname "::nsf::classes::nx::Object::mixin" -elementtype mixinreg ::nx::ObjectParameterSlot create ${os}::Class::slot::object-filter \ -methodname "::nsf::classes::nx::Object::filter" Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -r58c1880b874484f218afa0275b0998e25d4282f0 -r03990ee9d7185ded72b0fa05e81f848e866451c2 --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 58c1880b874484f218afa0275b0998e25d4282f0) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 03990ee9d7185ded72b0fa05e81f848e866451c2) @@ -403,11 +403,11 @@ ::nx::RelationSlot create ${oSlotContainer}::class -elementtype class -multiplicity 1..1 ::nsf::method::alias ${oSlotContainer}::class assign ::nsf::relation ::nx::RelationSlot create ${oSlotContainer}::mixin -forwardername object-mixin \ - -elementtype mixinspec -multiplicity 0..n + -elementtype mixinreg -multiplicity 0..n ::nx::RelationSlot create ${oSlotContainer}::filter -forwardername object-filter \ -multiplicity 0..n ::nx::RelationSlot create ${cSlotContainer}::instmixin -forwardername class-mixin \ - -elementtype mixinspec -multiplicity 0..n + -elementtype mixinreg -multiplicity 0..n ::nx::RelationSlot create ${cSlotContainer}::instfilter -forwardername class-filter \ -multiplicity 0..n } Index: library/xotcl/tests/slottest.xotcl =================================================================== diff -u -r58c1880b874484f218afa0275b0998e25d4282f0 -r03990ee9d7185ded72b0fa05e81f848e866451c2 --- library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision 58c1880b874484f218afa0275b0998e25d4282f0) +++ library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision 03990ee9d7185ded72b0fa05e81f848e866451c2) @@ -112,7 +112,7 @@ ? {o1 class} "::O" o1 class Object ? {o1 class} "::xotcl::Object" -? {Object objectparameter} "-mixin:mixinspec,alias,0..n -filter:alias,0..n -class:class,alias args" +? {Object objectparameter} "-mixin:mixinreg,alias,0..n -filter:alias,0..n -class:class,alias args" ? {o1 class add M} {class: expected a class but got "M ::xotcl::Object"} Index: tests/info-method.test =================================================================== diff -u -r58c1880b874484f218afa0275b0998e25d4282f0 -r03990ee9d7185ded72b0fa05e81f848e866451c2 --- tests/info-method.test (.../info-method.test) (revision 58c1880b874484f218afa0275b0998e25d4282f0) +++ tests/info-method.test (.../info-method.test) (revision 03990ee9d7185ded72b0fa05e81f848e866451c2) @@ -493,10 +493,10 @@ :method "sub foo" args {;} } - ? {C info parameter syntax} "?-a value? ?-b value? ?-volatile? ?-noinit? ?-mixin mixinspec ...? ?-class class? ?-filter value ...? ?__initcmd?" + ? {C info parameter syntax} "?-a value? ?-b value? ?-volatile? ?-noinit? ?-mixin mixinreg ...? ?-class class? ?-filter value ...? ?__initcmd?" ? {C info parameter syntax a} "?-a value?" - ? {C info parameter spec} "-a {-b 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinspec,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" + ? {C info parameter spec} "-a {-b 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" ? {C info parameter list} "-a -b -volatile -noinit -mixin -class -filter __initcmd" ? {C info parameter name} "a b volatile noinit mixin class filter __initcmd" Index: tests/parameters.test =================================================================== diff -u -rc95e8ce3d63c826e5d706b55acb3be94cb8edcde -r03990ee9d7185ded72b0fa05e81f848e866451c2 --- tests/parameters.test (.../parameters.test) (revision c95e8ce3d63c826e5d706b55acb3be94cb8edcde) +++ tests/parameters.test (.../parameters.test) (revision 03990ee9d7185ded72b0fa05e81f848e866451c2) @@ -249,7 +249,7 @@ C create c1 ? {C eval :objectparameter} \ - "-a -b:boolean {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinspec,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" + "-a -b:boolean {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" ? {c1 eval :objectparameter} \ "::c1: unable to dispatch method 'objectparameter'" @@ -276,7 +276,7 @@ "::D::slot::d ::C::slot::a ::C::slot::b ::C::slot::c" ? {D eval :objectparameter} \ - "-d:required -a -b:boolean {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinspec,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" + "-d:required -a -b:boolean {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" } ####################################################### @@ -293,29 +293,29 @@ D mixin M ? {D eval :objectparameter} \ - "-b -m1 -m2 -d:required -a {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinspec,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" \ + "-b -m1 -m2 -d:required -a {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" \ "mixin added" M mixin M2 ? {D eval :objectparameter} \ - "-b2 -b -m1 -m2 -d:required -a {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinspec,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" \ + "-b2 -b -m1 -m2 -d:required -a {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" \ "transitive mixin added" D mixin "" #we should have again the old interface ? {D eval :objectparameter} \ - "-d:required -a -b:boolean {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinspec,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" + "-d:required -a -b:boolean {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" C mixin M ? {D eval :objectparameter} \ - "-b2 -b -m1 -m2 -d:required -a {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinspec,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" \ + "-b2 -b -m1 -m2 -d:required -a {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" \ "mixin added" C mixin "" #we should have again the old interface ? {D eval :objectparameter} \ - "-d:required -a -b:boolean {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinspec,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" + "-d:required -a -b:boolean {-c 1} -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" } ####################################################### @@ -1617,7 +1617,7 @@ ? {C info slots -closure} "::C::slot::a1 ::nx::Object::slot::volatile ::nx::Object::slot::noinit ::nx::Object::slot::mixin ::nx::Object::slot::__initcmd ::nx::Object::slot::class ::nx::Object::slot::filter" - ? {C eval :objectparameter} "-a1 -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinspec,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" + ? {C eval :objectparameter} "-a1 -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" # # invalidate object parameter and expect that the per-class mixin @@ -1631,7 +1631,7 @@ ? {C info slots -closure} "::C::slot::a1 ::nx::Object::slot::volatile ::nx::Object::slot::noinit ::nx::Object::slot::mixin ::nx::Object::slot::__initcmd ::nx::Object::slot::class ::nx::Object::slot::filter" - ? {C eval :objectparameter} "-a1 -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinspec,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" + ? {C eval :objectparameter} "-a1 -volatile:alias,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,1..n -class:class,alias,method=::nsf::methods::object::class -filter:alias,1..n __initcmd:initcmd,optional" # should not require b1 ? {C create c2} ::c2