Index: generic/predefined.h =================================================================== diff -u -r9a128ffc80f0c429d885af38e92c50b253cdb9e8 -r4d21376ac1245e34cb5a5f52da893072f311d3a9 --- generic/predefined.h (.../predefined.h) (revision 9a128ffc80f0c429d885af38e92c50b253cdb9e8) +++ generic/predefined.h (.../predefined.h) (revision 4d21376ac1245e34cb5a5f52da893072f311d3a9) @@ -34,7 +34,7 @@ "::xotcl::method [self] -per-object $name $arguments $body {*}$conditions}\n" "Class eval {\n" ":method object {what args} {\n" -"if {$what in [list \"alias\" \"forward\" \"method\" \"setter\"]} {\n" +"if {$what in [list \"alias\" \"attribute\" \"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" @@ -48,13 +48,13 @@ "::xotcl::methodproperty [self] unknown protected 1}\n" "Object eval {\n" ":method public {args} {\n" -"set p [lsearch -regexp $args {^(method|alias|forward|setter)$}]\n" +"set p [lsearch -regexp $args {^(method|alias|attribute|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" ":method protected {args} {\n" -"set p [lsearch -regexp $args {^(method|alias|forward|setter)$}]\n" +"set p [lsearch -regexp $args {^(method|alias|attribute|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" @@ -150,7 +150,7 @@ "if {![::xotcl::is ${slotParent} object]} {\n" "::xotcl2::Object create ${slotParent}}\n" "return ${slotParent}::$name}\n" -"::xotcl::MetaSlot method createFromParameterSyntax {target {-initblock \"\"} value default:optional} {\n" +"::xotcl::MetaSlot method createFromParameterSyntax {target -per-object:switch {-initblock \"\"} value default:optional} {\n" "set opts [list]\n" "set colonPos [string first : $value]\n" "if {$colonPos == -1} {\n" @@ -170,7 +170,13 @@ "lappend opts -type $type}\n" "if {[info exists default]} {\n" "lappend opts -default $default}\n" -":create [:slotName $name $target] {*}$opts $initblock}\n" +"if {${per-object}} {\n" +"lappend opts -per-object true\n" +"set info ObjectInfo} else {\n" +"set info ClassInfo}\n" +":create [:slotName $name $target] {*}$opts $initblock\n" +"puts stderr \"::xotcl::cmd::${info}::method $target name $name => [::xotcl::cmd::${info}::method $target name $name]\"\n" +"::xotcl::cmd::${info}::method $target name $name}\n" "::xotcl::MetaSlot create ::xotcl::Slot\n" "::xotcl::MetaSlot create ::xotcl::ObjectParameterSlot\n" "::xotcl::relation ::xotcl::ObjectParameterSlot superclass ::xotcl::Slot\n" @@ -231,7 +237,7 @@ "lappend methods $m}\n" "error \"Method '$method' unknown for slot [::xotcl::self]; valid are: {[lsort $methods]]}\"}\n" "::xotcl::ObjectParameterSlot public method destroy {} {\n" -"if {${:domain} ne \"\" && [::xotcl::is ${:domain} object]} {\n" +"if {${:domain} ne \"\" && [::xotcl::is ${:domain} class]} {\n" "${:domain} __invalidateobjectparameter}\n" "next}\n" "::xotcl::ObjectParameterSlot protected method init {args} {\n" @@ -240,7 +246,10 @@ "if {${:domain} ne \"\"} {\n" "if {![info exists :methodname]} {\n" "set :methodname ${:name}}\n" -"${:domain} __invalidateobjectparameter\n" +"if {[::xotcl::is ${:domain} class]} {\n" +"${:domain} __invalidateobjectparameter}\n" +"if {${:per-object} && [info exists :default] } {\n" +"::xotcl::setinstvar ${:domain} ${:name} ${:default}}\n" "set cl [expr {${:per-object} ? \"Object\" : \"Class\"}]\n" "::xotcl::forward ${:domain} ${:name} \\\n" "${:manager} \\\n" @@ -423,8 +432,10 @@ "set setterParam ${:name}}\n" "::xotcl::setter ${:domain} {*}$perObject $setterParam}}\n" "::xotcl::Attribute mixin add ::xotcl::Attribute::Optimizer\n" -"::xotcl2::Object method attribute {spec {-slotclass ::xotcl::Attribute} {initblock \"\"}} {\n" +"::xotcl2::Class method attribute {spec {-slotclass ::xotcl::Attribute} {initblock \"\"}} {\n" "$slotclass createFromParameterSyntax [self] -initblock $initblock {*}$spec}\n" +"::xotcl2::Object method attribute {spec {-slotclass ::xotcl::Attribute} {initblock \"\"}} {\n" +"$slotclass createFromParameterSyntax [self] -per-object -initblock $initblock {*}$spec}\n" "::xotcl2::Class public method parameter arglist {\n" "foreach arg $arglist {\n" "::xotcl::Attribute createFromParameterSyntax [self] {*}$arg}\n"