Index: generic/gentclAPI.decls =================================================================== diff -u -r68e773f0a21300bd799c60fefc76f696fd230ca0 -rbe717fe9ef13e09dcfabf496ca61d75e4c042422 --- generic/gentclAPI.decls (.../gentclAPI.decls) (revision 68e773f0a21300bd799c60fefc76f696fd230ca0) +++ generic/gentclAPI.decls (.../gentclAPI.decls) (revision be717fe9ef13e09dcfabf496ca61d75e4c042422) @@ -18,9 +18,9 @@ # xotclCmd alias XOTclAliasCmd { {-argName "object" -type object} + {-argName "-per-object"} {-argName "methodName"} {-argName "-objscope"} - {-argName "-per-object"} {-argName "cmdName" -required 1 -type tclobj} } xotclCmd assertion XOTclAssertionCmd { @@ -44,7 +44,6 @@ xotclCmd dispatch XOTclDispatchCmd { {-argName "object" -required 1 -type object} {-argName "-objscope"} - {-argName "-noassertions"} {-argName "command" -required 1 -type tclobj} {-argName "args" -type args} } @@ -96,8 +95,8 @@ } xotclCmd methodproperty XOTclMethodPropertyCmd { {-argName "object" -required 1 -type object} - {-argName "methodName" -required 1 -type tclobj} {-argName "-per-object"} + {-argName "methodName" -required 1 -type tclobj} {-argName "methodproperty" -required 1 -type "protected|redefine-protected|slotobj"} {-argName "value" -type tclobj} } @@ -132,8 +131,8 @@ } xotclCmd setter XOTclSetterCmd { {-argName "object" -required 1 -type object} + {-argName "-per-object"} {-argName "methodName" -required 1} - {-argName "-per-object" -type switch} } # # object methods Index: generic/predefined.h =================================================================== diff -u -r8ec36a4408ae5e7546b4f16fccfa458a2242cb81 -rbe717fe9ef13e09dcfabf496ca61d75e4c042422 --- generic/predefined.h (.../predefined.h) (revision 8ec36a4408ae5e7546b4f16fccfa458a2242cb81) +++ generic/predefined.h (.../predefined.h) (revision be717fe9ef13e09dcfabf496ca61d75e4c042422) @@ -69,7 +69,7 @@ "::xotcl::forward Class forward ::xotcl::forward %self\n" "Class protected object method __unknown {name} {}\n" "Object public method alias {-objscope:switch methodName cmd} {\n" -"::xotcl::alias [self] $methodName -per-object \\\n" +"::xotcl::alias [self] -per-object $methodName \\\n" "{*}[expr {${objscope} ? \"-objscope\" : \"\"}] \\\n" "$cmd}\n" "Class public method alias {-objscope:switch methodName cmd} {\n" @@ -78,8 +78,8 @@ "$cmd}\n" "Object public method setter {methodName value:optional} {\n" "if {[info exists value]} {\n" -"::xotcl::setter [self] $methodName -per-object $value} else {\n" -"::xotcl::setter [self] $methodName -per-object}}\n" +"::xotcl::setter [self] -per-object $methodName $value} else {\n" +"::xotcl::setter [self] -per-object $methodName}}\n" "Class public method setter {methodName value:optional} {\n" "if {[info exists value]} {\n" "::xotcl::setter [self] $methodName $value} else {\n" Index: generic/predefined.xotcl =================================================================== diff -u -r8ec36a4408ae5e7546b4f16fccfa458a2242cb81 -rbe717fe9ef13e09dcfabf496ca61d75e4c042422 --- generic/predefined.xotcl (.../predefined.xotcl) (revision 8ec36a4408ae5e7546b4f16fccfa458a2242cb81) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision be717fe9ef13e09dcfabf496ca61d75e4c042422) @@ -150,7 +150,7 @@ # [... info method name ] # Object public method alias {-objscope:switch methodName cmd} { - ::xotcl::alias [self] $methodName -per-object \ + ::xotcl::alias [self] -per-object $methodName \ {*}[expr {${objscope} ? "-objscope" : ""}] \ $cmd } @@ -164,9 +164,9 @@ # Object public method setter {methodName value:optional} { if {[info exists value]} { - ::xotcl::setter [self] $methodName -per-object $value + ::xotcl::setter [self] -per-object $methodName $value } else { - ::xotcl::setter [self] $methodName -per-object + ::xotcl::setter [self] -per-object $methodName } } Class public method setter {methodName value:optional} { Index: generic/tclAPI.h =================================================================== diff -u -r68e773f0a21300bd799c60fefc76f696fd230ca0 -rbe717fe9ef13e09dcfabf496ca61d75e4c042422 --- generic/tclAPI.h (.../tclAPI.h) (revision 68e773f0a21300bd799c60fefc76f696fd230ca0) +++ generic/tclAPI.h (.../tclAPI.h) (revision be717fe9ef13e09dcfabf496ca61d75e4c042422) @@ -243,12 +243,12 @@ static int XOTclOUpvarMethod(Tcl_Interp *interp, XOTclObject *obj, int objc, Tcl_Obj *CONST objv[]); static int XOTclOVolatileMethod(Tcl_Interp *interp, XOTclObject *obj); static int XOTclOVwaitMethod(Tcl_Interp *interp, XOTclObject *obj, char *varname); -static int XOTclAliasCmd(Tcl_Interp *interp, XOTclObject *object, char *methodName, int withObjscope, int withPer_object, Tcl_Obj *cmdName); +static int XOTclAliasCmd(Tcl_Interp *interp, XOTclObject *object, int withPer_object, char *methodName, int withObjscope, Tcl_Obj *cmdName); static int XOTclAssertionCmd(Tcl_Interp *interp, XOTclObject *object, int assertionsubcmd, Tcl_Obj *arg); static int XOTclConfigureCmd(Tcl_Interp *interp, int configureoption, Tcl_Obj *value); static int XOTclCreateObjectSystemCmd(Tcl_Interp *interp, Tcl_Obj *rootClass, Tcl_Obj *rootMetaClass); static int XOTclDeprecatedCmd(Tcl_Interp *interp, char *what, char *oldCmd, char *newCmd); -static int XOTclDispatchCmd(Tcl_Interp *interp, XOTclObject *object, int withObjscope, int withNoassertions, Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]); +static int XOTclDispatchCmd(Tcl_Interp *interp, XOTclObject *object, int withObjscope, Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]); static int XOTclDotCmd(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); static int XOTclExistsCmd(Tcl_Interp *interp, XOTclObject *object, char *var); static int XOTclFinalizeObjCmd(Tcl_Interp *interp); @@ -258,14 +258,14 @@ static int XOTclInterpObjCmd(Tcl_Interp *interp, char *name, int objc, Tcl_Obj *CONST objv[]); static int XOTclIsCmd(Tcl_Interp *interp, Tcl_Obj *object, int objectkind, Tcl_Obj *value); static int XOTclMethodCmd(Tcl_Interp *interp, XOTclObject *object, int withInner_namespace, int withPer_object, int withPublic, Tcl_Obj *name, Tcl_Obj *args, Tcl_Obj *body, Tcl_Obj *withPrecondition, Tcl_Obj *withPostcondition); -static int XOTclMethodPropertyCmd(Tcl_Interp *interp, XOTclObject *object, Tcl_Obj *methodName, int withPer_object, int methodproperty, Tcl_Obj *value); +static int XOTclMethodPropertyCmd(Tcl_Interp *interp, XOTclObject *object, int withPer_object, Tcl_Obj *methodName, int methodproperty, Tcl_Obj *value); static int XOTclMyCmd(Tcl_Interp *interp, int withLocal, Tcl_Obj *method, int nobjc, Tcl_Obj *CONST nobjv[]); static int XOTclNSCopyCmds(Tcl_Interp *interp, Tcl_Obj *fromNs, Tcl_Obj *toNs); static int XOTclNSCopyVars(Tcl_Interp *interp, Tcl_Obj *fromNs, Tcl_Obj *toNs); static int XOTclQualifyObjCmd(Tcl_Interp *interp, Tcl_Obj *name); static int XOTclRelationCmd(Tcl_Interp *interp, XOTclObject *object, int relationtype, Tcl_Obj *value); static int XOTclSetInstvarCmd(Tcl_Interp *interp, XOTclObject *object, Tcl_Obj *variable, Tcl_Obj *value); -static int XOTclSetterCmd(Tcl_Interp *interp, XOTclObject *object, char *methodName, int withPer_object); +static int XOTclSetterCmd(Tcl_Interp *interp, XOTclObject *object, int withPer_object, char *methodName); enum { XOTclCheckBooleanArgsIdx, @@ -1506,13 +1506,13 @@ return TCL_ERROR; } else { XOTclObject *object = (XOTclObject *)pc.clientData[0]; - char *methodName = (char *)pc.clientData[1]; - int withObjscope = (int )PTR2INT(pc.clientData[2]); - int withPer_object = (int )PTR2INT(pc.clientData[3]); + int withPer_object = (int )PTR2INT(pc.clientData[1]); + char *methodName = (char *)pc.clientData[2]; + int withObjscope = (int )PTR2INT(pc.clientData[3]); Tcl_Obj *cmdName = (Tcl_Obj *)pc.clientData[4]; parseContextRelease(&pc); - return XOTclAliasCmd(interp, object, methodName, withObjscope, withPer_object, cmdName); + return XOTclAliasCmd(interp, object, withPer_object, methodName, withObjscope, cmdName); } } @@ -1607,11 +1607,10 @@ } else { XOTclObject *object = (XOTclObject *)pc.clientData[0]; int withObjscope = (int )PTR2INT(pc.clientData[1]); - int withNoassertions = (int )PTR2INT(pc.clientData[2]); - Tcl_Obj *command = (Tcl_Obj *)pc.clientData[3]; + Tcl_Obj *command = (Tcl_Obj *)pc.clientData[2]; parseContextRelease(&pc); - return XOTclDispatchCmd(interp, object, withObjscope, withNoassertions, command, objc-pc.lastobjc, objv+pc.lastobjc); + return XOTclDispatchCmd(interp, object, withObjscope, command, objc-pc.lastobjc, objv+pc.lastobjc); } } @@ -1800,13 +1799,13 @@ return TCL_ERROR; } else { XOTclObject *object = (XOTclObject *)pc.clientData[0]; - Tcl_Obj *methodName = (Tcl_Obj *)pc.clientData[1]; - int withPer_object = (int )PTR2INT(pc.clientData[2]); + int withPer_object = (int )PTR2INT(pc.clientData[1]); + Tcl_Obj *methodName = (Tcl_Obj *)pc.clientData[2]; int methodproperty = (int )PTR2INT(pc.clientData[3]); Tcl_Obj *value = (Tcl_Obj *)pc.clientData[4]; parseContextRelease(&pc); - return XOTclMethodPropertyCmd(interp, object, methodName, withPer_object, methodproperty, value); + return XOTclMethodPropertyCmd(interp, object, withPer_object, methodName, methodproperty, value); } } @@ -1937,11 +1936,11 @@ return TCL_ERROR; } else { XOTclObject *object = (XOTclObject *)pc.clientData[0]; - char *methodName = (char *)pc.clientData[1]; - int withPer_object = (int )PTR2INT(pc.clientData[2]); + int withPer_object = (int )PTR2INT(pc.clientData[1]); + char *methodName = (char *)pc.clientData[2]; parseContextRelease(&pc); - return XOTclSetterCmd(interp, object, methodName, withPer_object); + return XOTclSetterCmd(interp, object, withPer_object, methodName); } } @@ -2186,9 +2185,9 @@ }, {"::xotcl::alias", XOTclAliasCmdStub, 5, { {"object", 0, 0, convertToObject}, + {"-per-object", 0, 0, convertToString}, {"methodName", 0, 0, convertToString}, {"-objscope", 0, 0, convertToString}, - {"-per-object", 0, 0, convertToString}, {"cmdName", 1, 0, convertToTclobj}} }, {"::xotcl::assertion", XOTclAssertionCmdStub, 3, { @@ -2209,10 +2208,9 @@ {"oldCmd", 1, 0, convertToString}, {"newCmd", 0, 0, convertToString}} }, -{"::xotcl::dispatch", XOTclDispatchCmdStub, 5, { +{"::xotcl::dispatch", XOTclDispatchCmdStub, 4, { {"object", 1, 0, convertToObject}, {"-objscope", 0, 0, convertToString}, - {"-noassertions", 0, 0, convertToString}, {"command", 1, 0, convertToTclobj}, {"args", 0, 0, convertToNothing}} }, @@ -2268,8 +2266,8 @@ }, {"::xotcl::methodproperty", XOTclMethodPropertyCmdStub, 5, { {"object", 1, 0, convertToObject}, - {"methodName", 1, 0, convertToTclobj}, {"-per-object", 0, 0, convertToString}, + {"methodName", 1, 0, convertToTclobj}, {"methodproperty", 1, 0, convertToMethodproperty}, {"value", 0, 0, convertToTclobj}} }, @@ -2301,8 +2299,8 @@ }, {"::xotcl::setter", XOTclSetterCmdStub, 3, { {"object", 1, 0, convertToObject}, - {"methodName", 1, 0, convertToString}, - {"-per-object", 0, 0, convertToBoolean}} + {"-per-object", 0, 0, convertToString}, + {"methodName", 1, 0, convertToString}} } }; Index: generic/xotcl.c =================================================================== diff -u -r8ec36a4408ae5e7546b4f16fccfa458a2242cb81 -rbe717fe9ef13e09dcfabf496ca61d75e4c042422 --- generic/xotcl.c (.../xotcl.c) (revision 8ec36a4408ae5e7546b4f16fccfa458a2242cb81) +++ generic/xotcl.c (.../xotcl.c) (revision be717fe9ef13e09dcfabf496ca61d75e4c042422) @@ -10275,8 +10275,17 @@ /********************************* * Begin generated XOTcl commands *********************************/ -static int XOTclAliasCmd(Tcl_Interp *interp, XOTclObject *object, char *methodName, - int withObjscope, int withPer_object, Tcl_Obj *cmdName) { +/* +xotclCmd alias XOTclAliasCmd { + {-argName "object" -type object} + {-argName "-per-object"} + {-argName "methodName"} + {-argName "-objscope"} + {-argName "cmdName" -required 1 -type tclobj} +} +*/ +static int XOTclAliasCmd(Tcl_Interp *interp, XOTclObject *object, int withPer_object, + char *methodName, int withObjscope, Tcl_Obj *cmdName) { Tcl_ObjCmdProc *objProc, *newObjProc = NULL; Tcl_CmdDeleteProc *deleteProc = NULL; AliasCmdClientData *tcd = NULL; /* make compiler happy */ @@ -10616,8 +10625,7 @@ static int -XOTclDispatchCmd(Tcl_Interp *interp, XOTclObject *object, - int withObjscope, int withNoassertions, +XOTclDispatchCmd(Tcl_Interp *interp, XOTclObject *object, int withObjscope, Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]) { int result; char *methodName = ObjStr(command); @@ -10875,8 +10883,17 @@ return TCL_OK; } -static int XOTclMethodPropertyCmd(Tcl_Interp *interp, XOTclObject *object, Tcl_Obj *methodObj, - int withPer_object, int methodproperty, Tcl_Obj *value) { +/* +xotclCmd methodproperty XOTclMethodPropertyCmd { + {-argName "object" -required 1 -type object} + {-argName "-per-object"} + {-argName "methodName" -required 1 -type tclobj} + {-argName "methodproperty" -required 1 -type "protected|redefine-protected|slotobj"} + {-argName "value" -type tclobj} +} +*/ +static int XOTclMethodPropertyCmd(Tcl_Interp *interp, XOTclObject *object, int withPer_object, + Tcl_Obj *methodObj, int methodproperty, Tcl_Obj *value) { char *methodName = ObjStr(methodObj); Tcl_Command cmd = NULL; @@ -11718,9 +11735,14 @@ return setInstVar(interp, object , variable, value); } -/* TODO move me at the right place */ -static int XOTclSetterCmd(Tcl_Interp *interp, XOTclObject *object, char *methodName, - int withPer_object) { +/* +xotclCmd setter XOTclSetterCmd { + {-argName "object" -required 1 -type object} + {-argName "-per-object"} + {-argName "methodName" -required 1} + } */ +static int XOTclSetterCmd(Tcl_Interp *interp, XOTclObject *object, int withPer_object, + char *methodName) { int result; XOTclClass *cl = (withPer_object || ! XOTclObjectIsClass(object)) ? NULL : (XOTclClass *)object; Index: library/lib/xotcl1.xotcl =================================================================== diff -u -r68e773f0a21300bd799c60fefc76f696fd230ca0 -rbe717fe9ef13e09dcfabf496ca61d75e4c042422 --- library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision 68e773f0a21300bd799c60fefc76f696fd230ca0) +++ library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision be717fe9ef13e09dcfabf496ca61d75e4c042422) @@ -489,7 +489,7 @@ ::xotcl::alias ::xotcl::Object move ::xotcl::classes::xotcl2::Object::move ::xotcl::alias ::xotcl::Object defaultmethod ::xotcl::classes::xotcl2::Object::defaultmethod - ::xotcl::alias ::xotcl::Class __unknown -per-object ::xotcl2::Class::__unknown + ::xotcl::alias ::xotcl::Class -per-object __unknown ::xotcl2::Class::__unknown ::xotcl::alias ::xotcl::Class parameter ::xotcl::classes::xotcl2::Class::parameter proc myproc {args} {linsert $args 0 [::xotcl::self]} Index: library/serialize/Serializer.xotcl =================================================================== diff -u -r7050a52ac53992d9a3aec12e48b0fa58a26449e6 -rbe717fe9ef13e09dcfabf496ca61d75e4c042422 --- library/serialize/Serializer.xotcl (.../Serializer.xotcl) (revision 7050a52ac53992d9a3aec12e48b0fa58a26449e6) +++ library/serialize/Serializer.xotcl (.../Serializer.xotcl) (revision be717fe9ef13e09dcfabf496ca61d75e4c042422) @@ -378,7 +378,7 @@ my instvar post_cmds set post_cmds "" # register for introspection purposes "trace" under a different name - ::xotcl::alias ::xotcl::Object __trace__ -objscope ::trace + ::xotcl::alias ::xotcl::Object __trace__ -objscope ::trace ::xotcl::alias ::xotcl2::Object __trace__ -objscope ::trace my topoSort $list $all #foreach i [lsort [array names .level]] {my warn "$i: [my set level($i)]"} Index: tests/aliastest.xotcl =================================================================== diff -u -rd70c849219212800fa401c2227796b9a63eadcaf -rbe717fe9ef13e09dcfabf496ca61d75e4c042422 --- tests/aliastest.xotcl (.../aliastest.xotcl) (revision d70c849219212800fa401c2227796b9a63eadcaf) +++ tests/aliastest.xotcl (.../aliastest.xotcl) (revision be717fe9ef13e09dcfabf496ca61d75e4c042422) @@ -107,9 +107,9 @@ T method foo args { return [self class]->[self proc] } T object method bar args { return [self class]->[self proc] } -::xotcl::alias T FOO -per-object ::xotcl::classes::T::foo -::xotcl::alias T BAR -per-object ::T::FOO -::xotcl::alias T ZAP -per-object ::T::BAR +::xotcl::alias T -per-object FOO ::xotcl::classes::T::foo +::xotcl::alias T -per-object BAR ::T::FOO +::xotcl::alias T -per-object ZAP ::T::BAR ? {T info methods -methodtype scripted} {foo} ? {lsort [T object info methods -methodtype alias]} {BAR FOO ZAP} ? {lsort [T object info methods -methodtype scripted]} {BAR FOO ZAP bar} @@ -142,8 +142,8 @@ # per-object methods as per-object aliases # T object method m1 args { return [self class]->[self proc] } -::xotcl::alias T M1 -per-object ::T::m1 -::xotcl::alias T M11 -per-object ::T::M1 +::xotcl::alias T -per-object M1 ::T::m1 +::xotcl::alias T -per-object M11 ::T::M1 ? {lsort [T object info methods -methodtype scripted]} {M1 M11 bar m1} ? {T m1} ->m1 ? {T M1} ->m1 @@ -161,7 +161,7 @@ proc foo args { return [self class]->[self proc] } ::xotcl::alias T FOO1 ::foo -::xotcl::alias T FOO2 -per-object ::foo +::xotcl::alias T -per-object FOO2 ::foo # # ! per-object alias referenced as per-class alias ! # @@ -204,12 +204,12 @@ U create u ? {namespace exists ::U} 0 U object method zap args { return [self class]->[self proc] } -::xotcl::alias ::U ZAP -per-object ::U::zap +::xotcl::alias ::U -per-object ZAP ::U::zap U requireNamespace ? {namespace exists ::U} 1 U object method bar args { return [self class]->[self proc] } -::xotcl::alias U BAR -per-object ::U::bar +::xotcl::alias U -per-object BAR ::U::bar ? {lsort [U object info methods -methodtype scripted]} {BAR ZAP bar zap} ? {U BAR} ->bar ? {U ZAP} ->zap @@ -237,7 +237,7 @@ proc foo args { return [.bar ${.z}]-[set .z]-[my bar [set .z]] } ::xotcl::alias V FOO1 ::foo -::xotcl::alias V FOO2 -per-object ::foo +::xotcl::alias V -per-object FOO2 ::foo ? {lsort [V object info methods -methodtype scripted]} {FOO2 bar} ? {lsort [V info methods -methodtype scripted]} {FOO1 bar} ? {V FOO2} 1-1-1