Index: generic/predefined.h =================================================================== diff -u -r4dd2595d98574faaac87f5dd33b542516fdff5df -r2111020b49da8ce57758e51accf0b6073037f0d2 --- generic/predefined.h (.../predefined.h) (revision 4dd2595d98574faaac87f5dd33b542516fdff5df) +++ generic/predefined.h (.../predefined.h) (revision 2111020b49da8ce57758e51accf0b6073037f0d2) @@ -128,7 +128,8 @@ "$domain $forwarder $name -default [$manager defaultmethods] $manager %1 %self %proc}\n" "::xotcl::MetaSlot create ::xotcl::InfoSlot\n" "createBootstrapAttributeSlots ::xotcl::InfoSlot {\n" -"{multivalued true}}\n" +"{multivalued true}\n" +"{elementtype ::xotcl::Class}}\n" "::xotcl::relation ::xotcl::InfoSlot superclass ::xotcl::Slot\n" "::xotcl::InfoSlot instproc get {obj prop} {$obj info $prop}\n" "::xotcl::InfoSlot instproc add {obj prop value {pos 0}} {\n" @@ -137,8 +138,19 @@ "$obj $prop [linsert [$obj info $prop] $pos $value]}\n" "::xotcl::InfoSlot instproc delete {-nocomplain:switch obj prop value} {\n" "set old [$obj info $prop]\n" -"set p [lsearch -glob $old $value]\n" -"if {$p>-1} {$obj $prop [lreplace $old $p $p]} else {\n" +"if {[string first * $value] > -1 || [string first \\[ $value] > -1} {\n" +"if {[my elementtype] ne \"\" && ![string match ::* $value]} {\n" +"set value ::$value}\n" +"return [$obj $prop [lsearch -all -not -glob -inline $old $value]]} elseif {[my elementtype] ne \"\"} {\n" +"if {[string first :: $value] == -1} {\n" +"if {![my isobject $value]} {\n" +"error \"$value does not appear to be an object\"}\n" +"set value [$value self]}\n" +"if {![$value isclass [my elementtype]]} {\n" +"error \"$value does not appear to be of type [my elementtype]\"}}\n" +"set p [lsearch -exact $old $value]\n" +"if {$p > -1} {\n" +"$obj $prop [lreplace $old $p $p]} else {\n" "error \"$value is not a $prop of $obj (valid are: $old)\"}}\n" "::xotcl::MetaSlot alloc ::xotcl::InterceptorSlot\n" "::xotcl::relation ::xotcl::InterceptorSlot superclass ::xotcl::InfoSlot\n" @@ -156,9 +168,9 @@ "::xotcl::InfoSlot create ::xotcl::Object::slot::class\n" "::xotcl::alias ::xotcl::Object::slot::class assign ::xotcl::relation\n" "::xotcl::InterceptorSlot create ::xotcl::Object::slot::mixin\n" -"::xotcl::InterceptorSlot create ::xotcl::Object::slot::filter\n" +"::xotcl::InterceptorSlot create ::xotcl::Object::slot::filter -elementtype \"\"\n" "::xotcl::InterceptorSlot create ::xotcl::Class::slot::instmixin\n" -"::xotcl::InterceptorSlot create ::xotcl::Class::slot::instfilter\n" +"::xotcl::InterceptorSlot create ::xotcl::Class::slot::instfilter -elementtype \"\"\n" "::xotcl::MetaSlot create ::xotcl::Attribute -superclass ::xotcl::Slot\n" "createBootstrapAttributeSlots ::xotcl::Attribute {\n" "{value_check once}\n" @@ -316,10 +328,7 @@ "if {[::xotcl::my ismixin $cl]} {return 1}\n" "::xotcl::my istype $cl}\n" "::xotcl::Class instproc allinstances {} {\n" -"set set [::xotcl::my info instances]\n" -"foreach sc [::xotcl::my info subclass] {\n" -"eval lappend set [$sc allinstances]}\n" -"return $set}\n" +"return [::xotcl::my info instances -closure]}\n" "::xotcl::Object proc unsetExitHandler {} {\n" "::xotcl::Object proc __exitHandler {} {\n" ";}}\n" @@ -331,9 +340,9 @@ "proc ::xotcl::__exitHandler {} {\n" "::xotcl::Object __exitHandler}\n" "::xotcl::Object instproc abstract {methtype methname arglist} {\n" -"if {$methtype ne \"proc\" && $methtype ne \"instproc\"} {\n" +"if {$methtype ne \"proc\" && $methtype ne \"instproc\" && $methtype ne \"method\"} {\n" "error \"invalid method type '$methtype', \\\n" -"must be either 'proc' or 'instproc'.\"}\n" +"must be either 'proc', 'instproc' or 'method'.\"}\n" "::xotcl::my $methtype $methname $arglist \"\n" "if {!\\[::xotcl::self isnextcall\\]} {\n" "error \\\"Abstract method $methname $arglist called\\\"} else {::xotcl::next}\n" @@ -370,7 +379,7 @@ "$cl instinvar [$origin info instinvar]\n" "$cl instfilter [$origin info instfilter -guards]\n" "$cl instmixin [$origin info instmixin]\n" -"my copyNSVarsAndCmds ::xotcl::classes::$origin ::xotcl::classes::$dest} else {\n" +"my copyNSVarsAndCmds ::xotcl::classes$origin ::xotcl::classes$dest} else {\n" "set obj [[$origin info class] create $dest -noinit]}\n" "$obj invar [$origin info invar]\n" "$obj check [$origin info check]\n" @@ -391,7 +400,6 @@ "if {$cmds ne \"\"} {\n" "foreach cmd $cmds {\n" "foreach {op def} $cmd break\n" -"$origin trace remove variable $var $op $def\n" "if {[lindex $def 0] eq $origin} {\n" "set def [concat $dest [lrange $def 1 end]]}\n" "$dest trace add variable $var $op $def}}}}\n" @@ -575,8 +583,7 @@ "return $v}\n" "::xotcl::Object instproc method {name arguments body} {\n" "my proc name $arguments $body }\n" -"::xotcl::Class instproc method {\n" -"-per-object:switch name arguments body} {\n" +"::xotcl::Class instproc method {-per-object:switch name arguments body} {\n" "if {${per-object}} {\n" "my proc $name $arguments $body} else {\n" "my instproc $name $arguments $body}}\n"