Index: generic/predefined.h =================================================================== diff -u -r88ef0a6d60c84d75b1436e8cc0e8f8f5d176328e -rbf9bae94d157de9bbd4c398f6a3a9a4d93626025 --- generic/predefined.h (.../predefined.h) (revision 88ef0a6d60c84d75b1436e8cc0e8f8f5d176328e) +++ generic/predefined.h (.../predefined.h) (revision bf9bae94d157de9bbd4c398f6a3a9a4d93626025) @@ -6,10 +6,12 @@ "::xotcl::createobjectsystem ::xotcl2::Object ::xotcl2::Class\n" "foreach cmd [info command ::xotcl::cmd::Object::*] {\n" "set cmdName [namespace tail $cmd]\n" -"if {$cmdName in [list \"instvar\"]} continue\n" +"if {$cmdName in [list \"instvar\" \"object-method\"]} continue\n" "::xotcl::alias Object $cmdName $cmd}\n" "foreach cmd [info command ::xotcl::cmd::Class::*] {\n" -"::xotcl::alias Class [namespace tail $cmd] $cmd}\n" +"set cmdName [namespace tail $cmd]\n" +"if {$cmdName in [list \"class-method\"]} continue\n" +"::xotcl::alias Class $cmdName $cmd}\n" "foreach cmd [list __next cleanup noinit residualargs] {\n" "::xotcl::methodproperty Object $cmd protected 1}\n" "foreach cmd [list recreate] {\n" @@ -18,15 +20,38 @@ "::xotcl::methodproperty Class alloc static true\n" "::xotcl::methodproperty Class dealloc static true\n" "::xotcl::methodproperty Class create static true\n" +"::xotcl::dispatch Class ::xotcl::cmd::Class::class-method method {\n" +"-per-object:switch -public:switch -protected:switch\n" +"name arguments body -precondition -postcondition} {\n" +"set conditions [list]\n" +"if {[info exists precondition]} {lappend conditions -precondition $precondition}\n" +"if {[info exists postcondition]} {lappend conditions -postcondition $postcondition}\n" +"if {${per-object}} {\n" +"set cls Object\n" +"set prefix object} else {\n" +"set cls Class\n" +"set prefix class}\n" +"::xotcl::dispatch [self] ::xotcl::cmd::${cls}::$prefix-method \\\n" +"$name $arguments $body {*}$conditions\n" +"if {$protected} {::xotcl::methodproperty [self] $name protected true}}\n" +"::xotcl::dispatch Object ::xotcl::cmd::Class::class-method method {\n" +"-public:switch -protected:switch\n" +"name arguments body -precondition -postcondition} {\n" +"set conditions [list]\n" +"if {[info exists precondition]} {lappend conditions -precondition $precondition}\n" +"if {[info exists postcondition]} {lappend conditions -postcondition $postcondition}\n" +"::xotcl::dispatch [self] ::xotcl::cmd::Object::object-method \\\n" +"$name $arguments $body {*}$conditions\n" +"if {$protected} {::xotcl::methodproperty [self] $name -per-object protected true}}\n" "Class method unknown {args} {\n" "puts stderr \"use '[self] create $args', not '[self] $args'\"\n" "eval my create $args}\n" "Object method unknown {m args} {\n" "if {![self isnext]} {\n" "error \"[self]: unable to dispatch method '$m'\"}}\n" -"Object method init args {}\n" +"Object method -protected init args {}\n" "Object method defaultmethod {} {::xotcl::self}\n" -"Object method objectparameter {} {;}\n" +"Object method -protected objectparameter {} {;}\n" "Class method -per-object __unknown {name} {}\n" "Object method -public alias {-objscope:switch -protected:switch methodName cmd} {\n" "::xotcl::alias [self] $methodName \\\n" @@ -123,7 +148,7 @@ "unset arg}\n" "lappend parameterdefinitions $parameterdefinition}\n" "return $parameterdefinitions}\n" -"::xotcl2::Object method objectparameter {} {\n" +"::xotcl2::Object method -protected objectparameter {} {\n" "set parameterdefinitions [::xotcl::parametersFromSlots [self]]\n" "if {[::xotcl::is [self] class]} {\n" "lappend parameterdefinitions -parameter:method,optional}\n" @@ -319,7 +344,7 @@ "if {[set .defaultmethods] ne {get assign}} return\n" "if {[.info callable -which assign] ne \"::xotcl::Slot alias assign ::xotcl::setinstvar\"} return\n" "if {[.info callable -which get] ne \"::xotcl::Slot alias get ::xotcl::setinstvar\"} return\n" -"${.domain} setter {*}[expr {${.per-object} ? \"-per-object\" : \"\"}] ${.name}}}\n" +"::xotcl::dispatch ${.domain} ::xotcl::cmd::Class::setter {*}[expr {${.per-object} ? \"-per-object\" : \"\"}] ${.name}}}\n" "::xotcl::Attribute mixin add ::xotcl::Slot::Optimizer\n" "::xotcl2::Class create ::xotcl::ScopedNew -superclass ::xotcl2::Class\n" "createBootstrapAttributeSlots ::xotcl::ScopedNew {\n"