Index: generic/predefined.xotcl =================================================================== diff -u -r1e72a93dd117734d0ab49c7ea7aa87f69f9a00b5 -r05f4b42f7615ea410b7ac33093f5b8382ce7e8c5 --- generic/predefined.xotcl (.../predefined.xotcl) (revision 1e72a93dd117734d0ab49c7ea7aa87f69f9a00b5) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision 05f4b42f7615ea410b7ac33093f5b8382ce7e8c5) @@ -413,14 +413,14 @@ } # - # create class and object for parameter slots - ::xotcl::MetaSlot create ::xotcl::ParameterSlot - foreach cmd [info command ::xotcl::cmd::ParameterSlot::*] { - ::xotcl::alias ::xotcl::ParameterSlot [namespace tail $cmd] $cmd + # create class and object for method parameter slots + ::xotcl::MetaSlot create ::xotcl::MethodParameterSlot + foreach cmd [info command ::xotcl::cmd::MethodParameterSlot::*] { + ::xotcl::alias ::xotcl::MethodParameterSlot [namespace tail $cmd] $cmd } # create an object for dispatching - ::xotcl::ParameterSlot create ::xotcl::parameterSlot + ::xotcl::MethodParameterSlot create ::xotcl::methodParameterSlot # use low level interface for defining slot values. Normally, this is @@ -542,25 +542,24 @@ } ############################################ - # InfoSlot + # RelationSlot ############################################ - ::xotcl::MetaSlot create ::xotcl::InfoSlot - createBootstrapAttributeSlots ::xotcl::InfoSlot { + ::xotcl::MetaSlot create ::xotcl::RelationSlot + createBootstrapAttributeSlots ::xotcl::RelationSlot { {multivalued true} + {type relation} {elementtype ::xotcl2::Class} } - ::xotcl::relation ::xotcl::InfoSlot superclass ::xotcl::Slot - ::xotcl::InfoSlot public method get {obj prop} { - $obj info $prop - } - ::xotcl::InfoSlot public method add {obj prop value {pos 0}} { - if {![set :multivalued]} { - error "Property $prop of ${:domain}->$obj ist not multivalued" + ::xotcl::relation ::xotcl::RelationSlot superclass ::xotcl::Slot + ::xotcl::alias ::xotcl::RelationSlot assign ::xotcl::relation + + ::xotcl::RelationSlot protected method init {} { + if {${:type} ne "relation"} { + error "RelationSlot requires type == \"relation\"" } - #puts stderr "adding infoslot: $obj $prop [linsert [$obj info $prop] $pos $value]" - $obj $prop [linsert [$obj info $prop] $pos $value] + next } - ::xotcl::InfoSlot protected method delete_value {obj prop old value} { + ::xotcl::RelationSlot protected method delete_value {obj prop old value} { if {[string first * $value] > -1 || [string first \[ $value] > -1} { # string contains meta characters if {${:elementtype} ne "" && ![string match ::* $value]} { @@ -587,69 +586,55 @@ } } - ::xotcl::InfoSlot public method delete {-nocomplain:switch obj prop value} { - #puts stderr infoslot-delete-[self args] + ::xotcl::RelationSlot public method delete {-nocomplain:switch obj prop value} { + #puts stderr RelationSlot-delete-[self args] $obj $prop [:delete_value $obj $prop [$obj info $prop] $value] } - ############################################ - # InterceptorSlot - ############################################ - ::xotcl::MetaSlot alloc ::xotcl::InterceptorSlot - - ::xotcl::relation ::xotcl::InterceptorSlot superclass ::xotcl::InfoSlot - ::xotcl::alias ::xotcl::InterceptorSlot set ::xotcl::relation ;# for backwards compatibility - ::xotcl::alias ::xotcl::InterceptorSlot assign ::xotcl::relation - - ::xotcl::InterceptorSlot public method get {obj prop} { + ::xotcl::RelationSlot public method get {obj prop} { ::xotcl::relation $obj $prop } - ::xotcl::InterceptorSlot public method add {obj prop value {pos 0}} { + ::xotcl::RelationSlot public method add {obj prop value {pos 0}} { if {![set :multivalued]} { error "Property $prop of ${:domain}->$obj ist not multivalued" } set oldSetting [::xotcl::relation $obj $prop] # use uplevel to avoid namespace surprises uplevel [list ::xotcl::relation $obj $prop [linsert $oldSetting $pos $value]] } - ::xotcl::InterceptorSlot public method delete {-nocomplain:switch obj prop value} { + ::xotcl::RelationSlot public method delete {-nocomplain:switch obj prop value} { uplevel [list ::xotcl::relation $obj $prop [:delete_value $obj $prop [::xotcl::relation $obj $prop] $value]] } + ############################################ # system slots ############################################ proc ::xotcl::register_system_slots {os} { ${os}::Object alloc ${os}::Class::slot ${os}::Object alloc ${os}::Object::slot - ::xotcl::InfoSlot create ${os}::Class::slot::superclass -type relation + ::xotcl::RelationSlot create ${os}::Class::slot::superclass ::xotcl::alias ${os}::Class::slot::superclass assign ::xotcl::relation - ::xotcl::InfoSlot create ${os}::Object::slot::class -type relation + ::xotcl::RelationSlot create ${os}::Object::slot::class -multivalued false ::xotcl::alias ${os}::Object::slot::class assign ::xotcl::relation - ::xotcl::InterceptorSlot create ${os}::Object::slot::mixin \ - -type relation -methodname object-mixin + ::xotcl::RelationSlot create ${os}::Object::slot::mixin \ + -methodname object-mixin - ::xotcl::InterceptorSlot create ${os}::Object::slot::filter \ - -elementtype "" -type relation + ::xotcl::RelationSlot create ${os}::Object::slot::filter \ + -elementtype "" - ::xotcl::InterceptorSlot create ${os}::Class::slot::mixin \ - -type relation -methodname class-mixin - ::xotcl::InterceptorSlot create ${os}::Class::slot::filter \ - -type relation -methodname filter-mixin + ::xotcl::RelationSlot create ${os}::Class::slot::mixin \ + -methodname class-mixin + ::xotcl::RelationSlot create ${os}::Class::slot::filter \ + -methodname filter-mixin # create tho conveniance slots to allow configuration of # object-slots for classes via object-mixin - ::xotcl::InterceptorSlot create ${os}::Class::slot::object-mixin \ - -type relation - ::xotcl::InterceptorSlot create ${os}::Class::slot::object-filter \ - -elementtype "" -type relation - - # We could define a mixin on class, the calls always class-mixin. - # therfore, - #::xotcl::InterceptorSlot create ${os}::Class::slot::mixin \ - # -type relation -methodname class-mixin + ::xotcl::RelationSlot create ${os}::Class::slot::object-mixin + ::xotcl::RelationSlot create ${os}::Class::slot::object-filter \ + -elementtype "" } ::xotcl::register_system_slots ::xotcl2