Index: generic/predefined.h =================================================================== diff -u -reef622da1b387cfd1dd68babeb0bfecfbae5caa3 -r210eab6d9149846d5d6a6a8e0fa74e232ca5b6de --- generic/predefined.h (.../predefined.h) (revision eef622da1b387cfd1dd68babeb0bfecfbae5caa3) +++ generic/predefined.h (.../predefined.h) (revision 210eab6d9149846d5d6a6a8e0fa74e232ca5b6de) @@ -33,38 +33,38 @@ "if {[info exists postcondition]} {lappend conditions -postcondition $postcondition}\n" "::xotcl::method [self] -per-object $name $arguments $body {*}$conditions}\n" "Class eval {\n" -".method object {what args} {\n" +":method object {what args} {\n" "if {$what in [list \"alias\" \"forward\" \"method\" \"setter\"]} {\n" "return [::xotcl::dispatch [self] ::xotcl::classes::xotcl2::Object::$what {*}$args]}\n" "if {$what in [list \"info\"]} {\n" "return [::xotcl2::objectInfo [lindex $args 0] [self] {*}[lrange $args 1 end]]}\n" "if {$what in [list \"filter\" \"mixin\"]} {\n" -"return [.object-$what {*}$args]}\n" +"return [:object-$what {*}$args]}\n" "if {$what in [list \"filterguard\" \"mixinguard\"]} {\n" "return [::xotcl::dispatch [self] ::xotcl::cmd::Object::$what {*}$args]}}\n" -".method unknown {m args} {\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::methodproperty [self] unknown protected 1}\n" "Object eval {\n" -".method public {args} {\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" +"set r [{*}:$args]\n" "::xotcl::methodproperty [self] $r protected false\n" "return $r}\n" -".method 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" +"set r [{*}:$args]\n" "::xotcl::methodproperty [self] $r [self proc] true\n" "return $r}\n" -".protected method unknown {m args} {\n" +":protected method unknown {m args} {\n" "if {![self isnext]} {\n" "error \"[self]: unable to dispatch method '$m'\"}}\n" -".protected method init args {}\n" -".protected method defaultmethod {} {::xotcl::self}\n" -".protected method objectparameter {} {;}}\n" +":protected method init args {}\n" +":protected method defaultmethod {} {::xotcl::self}\n" +":protected method objectparameter {} {;}}\n" "::xotcl::forward Object forward ::xotcl::forward %self -per-object\n" "::xotcl::forward Class forward ::xotcl::forward %self\n" "Class protected object method __unknown {name} {}\n" @@ -87,17 +87,17 @@ "Object create ::xotcl2::objectInfo\n" "Object create ::xotcl2::classInfo\n" "objectInfo eval {\n" -".alias is ::xotcl::is\n" -".public method info {obj} {\n" +":alias is ::xotcl::is\n" +":public method info {obj} {\n" "set methods [list]\n" "foreach name [::xotcl::cmd::ObjectInfo::methods [self]] {\n" "if {$name eq \"unknown\"} continue\n" "lappend methods $name}\n" "return \"valid options are: [join [lsort $methods] {, }]\"}\n" -".method unknown {method obj args} {\n" +":method unknown {method obj args} {\n" "error \"[::xotcl::self] unknown info option \\\"$method\\\"; [$obj info info]\"}}\n" "classInfo eval {\n" -".public method mixinof {obj -closure:switch {-scope all} pattern:optional} {\n" +":public method mixinof {obj -closure:switch {-scope all} pattern:optional} {\n" "set withClosure [expr {$closure ? \"-closure\" : \"\"}]\n" "set withPattern [expr {[info exists pattern] ? $pattern : \"\"}]\n" "if {$scope eq \"all\"} {\n" @@ -106,11 +106,11 @@ "lappend r {*}[$c info instances {*}$withPattern]}\n" "return [lsort -unique $r]} else {\n" "return [::xotcl::cmd::ClassInfo::$scope-mixin-of $obj {*}$withClosure {*}$withPattern]}}\n" -".alias is ::xotcl::is\n" -".alias classparent ::xotcl::cmd::ObjectInfo::parent\n" -".alias classchildren ::xotcl::cmd::ObjectInfo::children\n" -".alias info [::xotcl::cmd::ObjectInfo::method objectInfo name info]\n" -".alias unknown [::xotcl::cmd::ObjectInfo::method objectInfo name info]}\n" +":alias is ::xotcl::is\n" +":alias classparent ::xotcl::cmd::ObjectInfo::parent\n" +":alias classchildren ::xotcl::cmd::ObjectInfo::children\n" +":alias info [::xotcl::cmd::ObjectInfo::method objectInfo name info]\n" +":alias unknown [::xotcl::cmd::ObjectInfo::method objectInfo name info]}\n" "foreach cmd [info command ::xotcl::cmd::ObjectInfo::*] {\n" "::xotcl::alias ::xotcl2::objectInfo [namespace tail $cmd] $cmd\n" "::xotcl::alias ::xotcl2::classInfo [namespace tail $cmd] $cmd}\n" @@ -134,8 +134,8 @@ "error \\\"Abstract method $methname $arglist called\\\"} else {::xotcl::next}\n" "\"\n" "if {${per-object}} {\n" -".method -per-object $methname $arglist $body} else {\n" -".method $methname $arglist $body}}\n" +":method -per-object $methname $arglist $body} else {\n" +":method $methname $arglist $body}}\n" "proc ::xotcl::unsetExitHandler {} {\n" "proc ::xotcl::__exitHandler {} {}}\n" "proc ::xotcl::setExitHandler {newbody} {::proc ::xotcl::__exitHandler {} $newbody}\n" @@ -228,8 +228,8 @@ "::xotcl::alias ::xotcl::Slot get ::xotcl::setinstvar\n" "::xotcl::alias ::xotcl::Slot assign ::xotcl::setinstvar\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 {![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" @@ -240,26 +240,26 @@ "error \"$value is not a $prop of $obj (valid are: $old)\"}}\n" "::xotcl::Slot method unknown {method args} {\n" "set methods [list]\n" -"foreach m [.info callable] {\n" +"foreach m [:info callable] {\n" "if {[::xotcl2::Object info callable $m] ne \"\"} continue\n" "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 public method destroy {} {\n" -"if {${.domain} ne \"\" && [::xotcl::is ${.domain} object]} {\n" -"${.domain} __invalidateobjectparameter}\n" +"if {${:domain} ne \"\" && [::xotcl::is ${:domain} object]} {\n" +"${:domain} __invalidateobjectparameter}\n" "next}\n" "::xotcl::Slot method init {args} {\n" -"if {${.domain} eq \"\"} {\n" -"set .domain [::xotcl::self callingobject]}\n" -"if {${.domain} ne \"\"} {\n" -"if {![info exists .methodname]} {\n" -"set .methodname ${.name}}\n" -"${.domain} __invalidateobjectparameter\n" -"set cl [expr {${.per-object} ? \"Object\" : \"Class\"}]\n" -"::xotcl::dispatch ${.domain} ::xotcl::classes::xotcl2::${cl}::forward \\\n" -"${.name} ${.manager} [list %1 [${.manager} defaultmethods]] %self \\\n" -"${.methodname}}}\n" +"if {${:domain} eq \"\"} {\n" +"set :domain [::xotcl::self callingobject]}\n" +"if {${:domain} ne \"\"} {\n" +"if {![info exists :methodname]} {\n" +"set :methodname ${:name}}\n" +"${:domain} __invalidateobjectparameter\n" +"set cl [expr {${:per-object} ? \"Object\" : \"Class\"}]\n" +"::xotcl::dispatch ${:domain} ::xotcl::classes::xotcl2::${cl}::forward \\\n" +"${:name} ${:manager} [list %1 [${:manager} defaultmethods]] %self \\\n" +"${:methodname}}}\n" "::xotcl::MetaSlot create ::xotcl::InfoSlot\n" "createBootstrapAttributeSlots ::xotcl::InfoSlot {\n" "{multivalued true}\n" @@ -268,39 +268,39 @@ "::xotcl::InfoSlot public method get {obj prop} {\n" "$obj info $prop}\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" +"if {![set :multivalued]} {\n" +"error \"Property $prop of ${:domain}->$obj ist not multivalued\"}\n" "$obj $prop [linsert [$obj info $prop] $pos $value]}\n" "::xotcl::InfoSlot protected method delete_value {obj prop old value} {\n" "if {[string first * $value] > -1 || [string first \\[ $value] > -1} {\n" -"if {${.elementtype} ne \"\" && ![string match ::* $value]} {\n" +"if {${:elementtype} ne \"\" && ![string match ::* $value]} {\n" "set value ::$value}\n" -"return [lsearch -all -not -glob -inline $old $value]} elseif {${.elementtype} ne \"\"} {\n" +"return [lsearch -all -not -glob -inline $old $value]} elseif {${:elementtype} ne \"\"} {\n" "if {[string first :: $value] == -1} {\n" "if {![::xotcl::is $value object]} {\n" "error \"$value does not appear to be an object\"}\n" "set value [::xotcl::dispatch $value -objscope ::xotcl::self]}\n" -"if {![::xotcl::is ${.elementtype} class]} {\n" -"error \"$value does not appear to be of type ${.elementtype}\"}}\n" +"if {![::xotcl::is ${:elementtype} class]} {\n" +"error \"$value does not appear to be of type ${:elementtype}\"}}\n" "set p [lsearch -exact $old $value]\n" "if {$p > -1} {\n" "return [lreplace $old $p $p]} else {\n" "error \"$value is not a $prop of $obj (valid are: $old)\"}}\n" "::xotcl::InfoSlot public method delete {-nocomplain:switch obj prop value} {\n" -"$obj $prop [.delete_value $obj $prop [$obj info $prop] $value]}\n" +"$obj $prop [:delete_value $obj $prop [$obj info $prop] $value]}\n" "::xotcl::MetaSlot alloc ::xotcl::InterceptorSlot\n" "::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 public method get {obj prop} {\n" "::xotcl::relation $obj $prop}\n" "::xotcl::InterceptorSlot public method add {obj prop value {pos 0}} {\n" -"if {![set .multivalued]} {\n" -"error \"Property $prop of ${.domain}->$obj ist not multivalued\"}\n" +"if {![set :multivalued]} {\n" +"error \"Property $prop of ${:domain}->$obj ist not multivalued\"}\n" "set oldSetting [::xotcl::relation $obj $prop]\n" "uplevel [list ::xotcl::relation $obj $prop [linsert $oldSetting $pos $value]]}\n" "::xotcl::InterceptorSlot public method delete {-nocomplain:switch obj prop value} {\n" -"uplevel [list ::xotcl::relation $obj $prop [.delete_value $obj $prop [::xotcl::relation $obj $prop] $value]]}\n" +"uplevel [list ::xotcl::relation $obj $prop [:delete_value $obj $prop [::xotcl::relation $obj $prop] $value]]}\n" "proc ::xotcl::register_system_slots {os} {\n" "${os}::Object alloc ${os}::Class::slot\n" "${os}::Object alloc ${os}::Object::slot\n" @@ -344,56 +344,56 @@ "if {$keep_old_value} {::xotcl::setinstvar $obj __oldvalue($var) $value}}\n" "::xotcl::Attribute method check_multiple_values {values predicate type obj var} {\n" "foreach value $values {\n" -".check_single_value -keep_old_value false $value $predicate $type $obj $var}\n" +":check_single_value -keep_old_value false $value $predicate $type $obj $var}\n" "::xotcl::setinstvar $obj __oldvalue($var) $value}\n" "::xotcl::Attribute method mk_type_checker {} {\n" "set __initcmd \"\"\n" -"if {[.exists type]} {\n" -"if {[::xotcl::is ${.type} class]} {\n" +"if {[:exists type]} {\n" +"if {[::xotcl::is ${:type} class]} {\n" "set predicate [subst -nocommands {\n" -"[::xotcl::is \\$value object] && [::xotcl::is \\$value type ${.type}]}]} elseif {[llength ${.type}]>1} {\n" -"set predicate \"\\[${.type} \\$value\\]\"} else {\n" -"set predicate \"\\[.type=${.type} ${.name} \\$value\\]\"}\n" -"append .valuechangedcmd [subst {\n" -"[expr {${.multivalued} ? \".check_multiple_values\" : \".check_single_value\"}] \\[::xotcl::setinstvar \\$obj ${.name}\\] \\\n" -"{$predicate} [list ${.type}] \\$obj ${.name}}]\n" +"[::xotcl::is \\$value object] && [::xotcl::is \\$value type ${:type}]}]} elseif {[llength ${:type}]>1} {\n" +"set predicate \"\\[${:type} \\$value\\]\"} else {\n" +"set predicate \"\\[:type=${:type} ${:name} \\$value\\]\"}\n" +"append :valuechangedcmd [subst {\n" +"[expr {${:multivalued} ? \":check_multiple_values\" : \":check_single_value\"}] \\[::xotcl::setinstvar \\$obj ${:name}\\] \\\n" +"{$predicate} [list ${:type}] \\$obj ${:name}}]\n" "append __initcmd [subst -nocommands {\n" -"if {[.exists ${.name}]} {set .__oldvalue(${.name}) [set .${.name}]}\\n}]}\n" +"if {[:exists ${:name}]} {set :__oldvalue(${:name}) [set :${:name}]}\\n}]}\n" "return $__initcmd}\n" "::xotcl::Attribute method init {} {\n" "next ;# do first ordinary slot initialization\n" "set __initcmd \"\"\n" -"if {[.exists default]} {} elseif [.exists initcmd] {\n" -"append __initcmd \".trace add variable [list ${.name}] read \\\n" -"\\[list [::xotcl::self] __default_from_cmd \\[::xotcl::self\\] [list [set .initcmd]]\\]\\n\"} elseif [.exists valuecmd] {\n" -"append __initcmd \".trace add variable [list ${.name}] read \\\n" -"\\[list [::xotcl::self] __value_from_cmd \\[::xotcl::self\\] [list [set .valuecmd]]\\]\"}\n" -"if {[.exists valuechangedcmd]} {\n" -"append __initcmd \".trace add variable [list ${.name}] write \\\n" -"\\[list [::xotcl::self] __value_changed_cmd \\[::xotcl::self\\] [list [set .valuechangedcmd]]\\]\"}\n" +"if {[:exists default]} {} elseif [:exists initcmd] {\n" +"append __initcmd \":trace add variable [list ${:name}] read \\\n" +"\\[list [::xotcl::self] __default_from_cmd \\[::xotcl::self\\] [list [set :initcmd]]\\]\\n\"} elseif [:exists valuecmd] {\n" +"append __initcmd \":trace add variable [list ${:name}] read \\\n" +"\\[list [::xotcl::self] __value_from_cmd \\[::xotcl::self\\] [list [set :valuecmd]]\\]\"}\n" +"if {[:exists valuechangedcmd]} {\n" +"append __initcmd \":trace add variable [list ${:name}] write \\\n" +"\\[list [::xotcl::self] __value_changed_cmd \\[::xotcl::self\\] [list [set :valuechangedcmd]]\\]\"}\n" "if {$__initcmd ne \"\"} {\n" -"set .initcmd $__initcmd}}\n" +"set :initcmd $__initcmd}}\n" "::xotcl2::Class create ::xotcl::Slot::Nocheck {\n" -".method check_single_value args {;}\n" -".method check_multiple_values args {;}\n" -".method mk_type_checker args {return \"\"}}\n" +":method check_single_value args {;}\n" +":method check_multiple_values args {;}\n" +":method mk_type_checker args {return \"\"}}\n" "::xotcl2::Class create ::xotcl::Slot::Optimizer {\n" -".method method args {::xotcl::next; .optimize}\n" -".method forward args {::xotcl::next; .optimize}\n" -".method init args {::xotcl::next; .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" -"if {[.info callable -which get] ne \"::xotcl::Slot alias get ::xotcl::setinstvar\"} return\n" -"::xotcl::setter ${.domain} {*}[expr {${.per-object} ? \"-per-object\" : \"\"}] ${.name}}}\n" +":method method args {::xotcl::next; :optimize}\n" +":method forward args {::xotcl::next; :optimize}\n" +":method init args {::xotcl::next; :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" +"if {[:info callable -which get] ne \"::xotcl::Slot alias get ::xotcl::setinstvar\"} return\n" +"::xotcl::setter ${:domain} {*}[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" "{withclass ::xotcl2::Object}\n" "inobject}\n" "::xotcl::ScopedNew method init {} {\n" -".public method new {-childof args} {\n" +":public method new {-childof args} {\n" "::xotcl::importvar [::xotcl::self class] {inobject object} withclass\n" "if {![::xotcl::is $object object]} {\n" "$withclass create $object}\n" @@ -470,8 +470,8 @@ "{targetList \"\"}\n" "{dest \"\"}\n" "objLength} {\n" -".method makeTargetList {t} {\n" -"lappend .targetList $t\n" +":method makeTargetList {t} {\n" +"lappend :targetList $t\n" "if {[::xotcl::is $t object]} {\n" "if {[$t info hasnamespace]} {\n" "set children [$t info children]} else {\n" @@ -480,16 +480,16 @@ "if {![::xotcl::is $c object]} {\n" "lappend children [namespace children $t]}}\n" "foreach c $children {\n" -".makeTargetList $c}}\n" -".method copyNSVarsAndCmds {orig dest} {\n" +":makeTargetList $c}}\n" +":method copyNSVarsAndCmds {orig dest} {\n" "::xotcl::namespace_copyvars $orig $dest\n" "::xotcl::namespace_copycmds $orig $dest}\n" -".method getDest origin {\n" -"set tail [string range $origin [set .objLength] end]\n" -"return ::[string trimleft [set .dest]$tail :]}\n" -".method copyTargets {} {\n" -"foreach origin [set .targetList] {\n" -"set dest [.getDest $origin]\n" +":method getDest origin {\n" +"set tail [string range $origin [set :objLength] end]\n" +"return ::[string trimleft [set :dest]$tail :]}\n" +":method copyTargets {} {\n" +"foreach origin [set :targetList] {\n" +"set dest [:getDest $origin]\n" "if {[::xotcl::is $origin object]} {\n" "if {[::xotcl::is $origin class]} {\n" "set cl [[$origin info class] create $dest -noinit]\n" @@ -498,7 +498,7 @@ "::xotcl::assertion $cl class-invar [::xotcl::assertion $origin class-invar]\n" "::xotcl::relation $cl class-filter [::xotcl::relation $origin class-filter]\n" "::xotcl::relation $cl class-mixin [::xotcl::relation $origin class-mixin]\n" -".copyNSVarsAndCmds ::xotcl::classes$origin ::xotcl::classes$dest} else {\n" +":copyNSVarsAndCmds ::xotcl::classes$origin ::xotcl::classes$dest} else {\n" "set obj [[$origin info class] create $dest -noinit]}\n" "::xotcl::assertion $obj check [::xotcl::assertion $origin check]\n" "::xotcl::assertion $obj object-invar [::xotcl::assertion $origin object-invar]\n" @@ -507,7 +507,7 @@ "if {[$origin info hasnamespace]} {\n" "$obj requireNamespace}} else {\n" "namespace eval $dest {}}\n" -".copyNSVarsAndCmds $origin $dest\n" +":copyNSVarsAndCmds $origin $dest\n" "foreach i [$origin info forward] {\n" "eval [concat $dest forward $i [$origin info forward -definition $i]]}\n" "if {[::xotcl::is $origin class]} {\n" @@ -522,34 +522,34 @@ "if {[lindex $def 0] eq $origin} {\n" "set def [concat $dest [lrange $def 1 end]]}\n" "$dest trace add variable $var $op $def}}}}\n" -"foreach origin [set .targetList] {\n" +"foreach origin [set :targetList] {\n" "if {[::xotcl::is $origin class]} {\n" -"set dest [.getDest $origin]\n" +"set dest [:getDest $origin]\n" "foreach oldslot [$origin info slots] {\n" "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" -".public method copy {obj dest} {\n" -"set .objLength [string length $obj]\n" -"set .dest $dest\n" -".makeTargetList $obj\n" -".copyTargets}}\n" +":public method copy {obj dest} {\n" +"set :objLength [string length $obj]\n" +"set :dest $dest\n" +":makeTargetList $obj\n" +":copyTargets}}\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 public method move newName {\n" "if {[string trimleft $newName :] ne [string trimleft [::xotcl::self] :]} {\n" "if {$newName ne \"\"} {\n" -".copy $newName}\n" +":copy $newName}\n" "if {[::xotcl::is [::xotcl::self] class] && $newName ne \"\"} {\n" -"foreach subclass [.info subclass] {\n" +"foreach subclass [:info subclass] {\n" "set scl [$subclass info superclass]\n" "if {[set index [lsearch -exact $scl [::xotcl::self]]] != -1} {\n" "set scl [lreplace $scl $index $index $newName]\n" "$subclass superclass $scl}} }\n" -".destroy}}\n" +":destroy}}\n" "::xotcl2::Object create ::xotcl::@ {\n" -".method unknown args {}}\n" +":method unknown args {}}\n" "namespace eval ::xotcl {\n" "namespace export @ Attribute\n" "if {![info exists ::env(HOME)]} {set ::env(HOME) /root}\n"