Index: generic/predefined.h =================================================================== diff -u -r962c96dcc0ddc25782570a831c104fb2b955891d -r142687efa93af981936db61ecfde494d8f269b0a --- generic/predefined.h (.../predefined.h) (revision 962c96dcc0ddc25782570a831c104fb2b955891d) +++ generic/predefined.h (.../predefined.h) (revision 142687efa93af981936db61ecfde494d8f269b0a) @@ -21,71 +21,63 @@ "::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" +"-per-object: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" -"set result [::xotcl::dispatch [self] ::xotcl::cmd::${cls}::$prefix-method \\\n" -"$name $arguments $body {*}$conditions]\n" -"if {$protected} {::xotcl::methodproperty [self] $name protected true}\n" -"return $result}\n" +"set cls [expr {${per-object} ? \"Object\" : \"Class\"}]\n" +"::xotcl::dispatch [self] ::xotcl::cmd::${cls}::[string tolower $cls]-method \\\n" +"$name $arguments $body {*}$conditions}\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" -"set result [::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" -"return $result}\n" -"Object method -public public {args} {\n" +"::xotcl::dispatch [self] ::xotcl::cmd::Object::object-method \\\n" +"$name $arguments $body {*}$conditions}\n" +"::xotcl::dispatch Class -objscope ::eval {\n" +".method object {args} {\n" +"set p [expr {[lsearch -regexp $args {^(method|alias|forward|setter)$}] + 1}]\n" +"set cmd [linsert $args $p \"-per-object\"]\n" +"return [{*}.$cmd]}\n" +".method unknown {m args} {\n" +"error \"Method '$m' unknown for [self].\\\n" +"Consider '[self] create $m $args' instead of '[self] $m $args'\"}}\n" +"::xotcl::dispatch Object -objscope ::eval {\n" +".method public {args} {\n" "set p [lsearch -regexp $args {^(method|alias|forward|setter)$}]\n" "if {$p == -1} {error \"$args is not a method defining method\"}\n" "set r [{*}.$args]\n" "::xotcl::methodproperty [self] $r protected false\n" "return $r}\n" -"Object method -public protected {args} {\n" +".method protected {args} {\n" "set p [lsearch -regexp $args {^(method|alias|forward|setter)$}]\n" "if {$p == -1} {error \"$args is not a method defining command\"}\n" "set r [{*}.$args]\n" "::xotcl::methodproperty [self] $r [self proc] true\n" "return $r}\n" -"Class method -public object {args} {\n" -"set p [expr {[lsearch -regexp $args {^(method|alias|forward|setter)$}] + 1}]\n" -"set cmd [linsert $args $p \"-per-object\"]\n" -"return [{*}.$cmd]}\n" -"Class method unknown {m args} {\n" -"error \"Method '$m' unknown for [self]. Consider '[self] create $m $args' instead of '[self] $m $args'\"}\n" -"Object method unknown {m args} {\n" +".method unknown {m args} {\n" "if {![self isnext]} {\n" "error \"[self]: unable to dispatch method '$m'\"}}\n" -"Object method -protected init args {}\n" -"Object method defaultmethod {} {::xotcl::self}\n" -"Object method -protected objectparameter {} {;}\n" -"Class method -per-object __unknown {name} {}\n" -"Object method -public alias {-objscope:switch -protected:switch methodName cmd} {\n" +".protected method init args {}\n" +".protected method defaultmethod {} {::xotcl::self}\n" +".protected method objectparameter {} {;}}\n" +"Class protected object method __unknown {name} {}\n" +"Object public method alias {-objscope:switch methodName cmd} {\n" "::xotcl::alias [self] $methodName \\\n" "{*}[expr {${objscope} ? \"-objscope\" : \"\"}] \\\n" -"{*}[expr {${protected} ? \"-protected\" : \"\"}] \\\n" "$cmd}\n" -"Class method -public alias {-objscope:switch -per-object:switch -protected:switch methodName cmd} {\n" +"Class public method alias {-objscope:switch -per-object:switch methodName cmd} {\n" "::xotcl::alias [self] $methodName \\\n" "{*}[expr {${objscope} ? \"-objscope\" : \"\"}] \\\n" "{*}[expr {${per-object} ? \"-per-object\" : \"\"}] \\\n" -"{*}[expr {${protected} ? \"-protected\" : \"\"}] \\\n" "$cmd}\n" "Object create ::xotcl2::objectInfo\n" "Object create ::xotcl2::classInfo\n" "::xotcl::dispatch objectInfo -objscope ::eval {\n" ".alias is ::xotcl::is\n" -".method -public info {obj} {\n" +".public method info {obj} {\n" "set methods [list]\n" "foreach name [::xotcl::cmd::ObjectInfo::methods [self]] {\n" "if {$name eq \"unknown\"} continue\n" @@ -134,7 +126,7 @@ "namespace export Object Class}\n" "::xotcl2::Class create ::xotcl::MetaSlot\n" "::xotcl::relation ::xotcl::MetaSlot superclass ::xotcl2::Class\n" -"::xotcl::MetaSlot method -public new args {\n" +"::xotcl::MetaSlot public method new args {\n" "set slotobject [::xotcl::self callingobject]::slot\n" "if {![::xotcl::is $slotobject object]} {::xotcls::Object create $slotobject}\n" "eval next -childof $slotobject $args}\n" @@ -165,7 +157,7 @@ "unset arg}\n" "lappend parameterdefinitions $parameterdefinition}\n" "return $parameterdefinitions}\n" -"::xotcl2::Object method -protected objectparameter {} {\n" +"::xotcl2::Object protected method objectparameter {} {\n" "set parameterdefinitions [::xotcl::parametersFromSlots [self]]\n" "if {[::xotcl::is [self] class]} {\n" "lappend parameterdefinitions -parameter:method,optional}\n" @@ -211,13 +203,13 @@ "type}\n" "::xotcl::alias ::xotcl::Slot get ::xotcl::setinstvar\n" "::xotcl::alias ::xotcl::Slot assign ::xotcl::setinstvar\n" -"::xotcl::Slot method -public add {obj prop value {pos 0}} {\n" +"::xotcl::Slot public method add {obj prop value {pos 0}} {\n" "if {![set .multivalued]} {\n" "error \"Property $prop of [set .domain]->$obj ist not multivalued\"}\n" "if {[$obj exists $prop]} {\n" "::xotcl::setinstvar $obj $prop [linsert [::xotcl::setinstvar $obj $prop] $pos $value]} else {\n" "::xotcl::setinstvar $obj $prop [list $value]}}\n" -"::xotcl::Slot method -public delete {-nocomplain:switch obj prop value} {\n" +"::xotcl::Slot public method delete {-nocomplain:switch obj prop value} {\n" "set old [::xotcl::setinstvar $obj $prop]\n" "set p [lsearch -glob $old $value]\n" "if {$p>-1} {::xotcl::setinstvar $obj $prop [lreplace $old $p $p]} else {\n" @@ -229,7 +221,7 @@ "if {[string match __* $m]} continue\n" "lappend methods $m}\n" "error \"Method '$method' unknown for slot [::xotcl::self]; valid are: {[lsort $methods]]}\"}\n" -"::xotcl::Slot method -public destroy {} {\n" +"::xotcl::Slot public method destroy {} {\n" "if {${.domain} ne \"\"} {\n" "${.domain} __invalidateobjectparameter}\n" "next}\n" @@ -248,14 +240,14 @@ "{multivalued true}\n" "{elementtype ::xotcl2::Class}}\n" "::xotcl::relation ::xotcl::InfoSlot superclass ::xotcl::Slot\n" -"::xotcl::InfoSlot method -public get {obj prop} {\n" +"::xotcl::InfoSlot public method get {obj prop} {\n" "$obj info $prop}\n" -"::xotcl::InfoSlot method -public add {obj prop value {pos 0}} {\n" +"::xotcl::InfoSlot public method add {obj prop value {pos 0}} {\n" "if {![set .multivalued]} {\n" "error \"Property $prop of ${.domain}->$obj ist not multivalued\"}\n" "puts stderr \"adding infoslot: $obj $prop [linsert [$obj info $prop] $pos $value]\"\n" "$obj $prop [linsert [$obj info $prop] $pos $value]}\n" -"::xotcl::InfoSlot method -public delete {-nocomplain:switch obj prop value} {\n" +"::xotcl::InfoSlot public method delete {-nocomplain:switch obj prop value} {\n" "puts stderr infoslot-delete-[self args]\n" "set old [$obj info $prop]\n" "if {[string first * $value] > -1 || [string first \\[ $value] > -1} {\n" @@ -276,9 +268,9 @@ "::xotcl::relation ::xotcl::InterceptorSlot superclass ::xotcl::InfoSlot\n" "::xotcl::alias ::xotcl::InterceptorSlot set ::xotcl::relation ;# for backwards compatibility\n" "::xotcl::alias ::xotcl::InterceptorSlot assign ::xotcl::relation\n" -"::xotcl::InterceptorSlot method -public get {obj -per-object:switch prop} {\n" +"::xotcl::InterceptorSlot public method get {obj -per-object:switch prop} {\n" "::xotcl::relation $obj {*}[expr {${per-object} ? \"-per-object\" : \"\"}] $prop}\n" -"::xotcl::InterceptorSlot method -public add {obj -per-object:switch prop value {pos 0}} {\n" +"::xotcl::InterceptorSlot public method add {obj -per-object:switch prop value {pos 0}} {\n" "if {![set .multivalued]} {\n" "error \"Property $prop of ${.domain}->$obj ist not multivalued\"}\n" "set perObject [expr {${per-object} ? \"-per-object\" : \"\"}]\n" @@ -356,7 +348,7 @@ ".method method args {::xotcl::next; .optimize}\n" ".method forward args {::xotcl::next; .optimize}\n" ".method init args {::xotcl::next; .optimize}\n" -".method -public optimize {} {\n" +".public method optimize {} {\n" "if {[set .multivalued]} return\n" "if {[set .defaultmethods] ne {get assign}} return\n" "if {[.info callable -which assign] ne \"::xotcl::Slot alias assign ::xotcl::setinstvar\"} return\n" @@ -368,12 +360,12 @@ "{withclass ::xotcl2::Object}\n" "inobject}\n" "::xotcl::ScopedNew method init {} {\n" -".method -public new {-childof args} {\n" +".public method new {-childof args} {\n" "::xotcl::instvar -object [::xotcl::self class] {inobject object} withclass\n" "if {![::xotcl::is $object object]} {\n" "$withclass create $object}\n" "eval ::xotcl::next -childof $object $args}}\n" -"::xotcl2::Object method -public contains {\n" +"::xotcl2::Object public method contains {\n" "{-withnew:boolean true}\n" "-object\n" "{-class ::xotcl2::Object}\n" @@ -390,7 +382,7 @@ "namespace eval $object $cmds}}\n" "::xotcl2::Class forward slots %self contains \\\n" "-object {%::xotcl::dispatch [::xotcl::self] -objscope ::subst [::xotcl::self]::slot}\n" -"::xotcl2::Class method -public parameter arglist {\n" +"::xotcl2::Class public method parameter arglist {\n" "if {![::xotcl::is [::xotcl::self]::slot object]} {\n" "::xotcl2::Object create [::xotcl::self]::slot}\n" "foreach arg $arglist {\n" @@ -433,7 +425,7 @@ "if {![info exists setter]} {set setter set}\n" "if {![info exists getter]} {set getter set}\n" "if {![info exists access]} {set access ::xotcl::my}\n" -"$cl method -public $name args \"\n" +"$cl public method $name args \"\n" "if {\\[llength \\$args] == 0} {\n" "return \\[$access $getter $extra $name\\]} else {\n" "return \\[eval $access $setter $extra $name \\$args $defaultParam \\]}\"\n" @@ -504,15 +496,15 @@ "set newslot ${dest}::slot::[namespace tail $oldslot]\n" "if {[$oldslot domain] eq $origin} {$newslot domain $cl}\n" "if {[$oldslot manager] eq $oldslot} {$newslot manager $newslot}}}}}\n" -".method -public copy {obj dest} {\n" +".public method copy {obj dest} {\n" "set .objLength [string length $obj]\n" "set .dest $dest\n" ".makeTargetList $obj\n" ".copyTargets}}\n" -"::xotcl2::Object method -public copy newName {\n" +"::xotcl2::Object public method copy newName {\n" "if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} {\n" "[::xotcl::CopyHandler new -volatile] copy [::xotcl::self] $newName}}\n" -"::xotcl2::Object method -public move newName {\n" +"::xotcl2::Object public method move newName {\n" "if {[string trimleft $newName :] ne [string trimleft [::xotcl::self] :]} {\n" "if {$newName ne \"\"} {\n" ".copy $newName}\n"