Index: generic/predefined.h =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -r46f02e4868e118466d888b35d6b281b3f2ba31ac --- generic/predefined.h (.../predefined.h) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ generic/predefined.h (.../predefined.h) (revision 46f02e4868e118466d888b35d6b281b3f2ba31ac) @@ -1,183 +1,231 @@ static char cmd[] = -"# $Id: predefined.h,v 1.17 2007/09/05 19:09:22 neumann Exp $\n" -"foreach cmd [info command ::xotcl::Object::instcmd::*] {\n" +"# $Id: predefined.xotcl,v 1.12 2006/10/04 20:40:23 neumann Exp $\n" +"namespace eval ::xotcl {\n" +"puts stderr =====\n" +"proc ::xotcl::setrelation args {\n" +"puts stderr \"::xotcl::setrelation is deprecated, use '::xotcl::relation $args' instead\"\n" +"uplevel ::xotcl::relation $args}\n" +"if {[info command ::oo::object] ne \"\"} {\n" +"::xotcl::alias ::oo::class alloc ::xotcl::cmd::Class::alloc\n" +"::oo::class alloc ::xotcl::Object\n" +"::oo::class alloc ::xotcl::Class\n" +"::xotcl::relation ::xotcl::Class superclass {::oo::class ::xotcl::Object}\n" +"::xotcl::relation ::xotcl::Object class ::xotcl::Class\n" +"::xotcl::relation ::xotcl::Class class ::xotcl::Class}\n" +"set bootstrap 1\n" +"foreach cmd [info command ::xotcl::cmd::Object::*] {\n" "::xotcl::alias ::xotcl::Object [namespace tail $cmd] $cmd}\n" "foreach cmd {array append eval incr lappend trace subst unset} {\n" "::xotcl::alias ::xotcl::Object $cmd -objscope ::$cmd}\n" -"foreach cmd [info command ::xotcl::Class::instcmd::*] {\n" +"foreach cmd [info command ::xotcl::cmd::Class::*] {\n" "::xotcl::alias ::xotcl::Class [namespace tail $cmd] $cmd}\n" -"unset cmd\n" "::xotcl::Object instproc init args {}\n" +"puts stderr =====0\n" +"::xotcl::Class create ::xotcl::NonposArgs\n" +"puts stderr =====0b\n" +"foreach cmd [info command ::xotcl::cmd::NonposArgs::*] {\n" +"::xotcl::alias ::xotcl::NonposArgs [namespace tail $cmd] $cmd}\n" +"puts stderr =====1\n" +"::xotcl::NonposArgs create ::xotcl::nonposArgs\n" +"puts stderr =====2\n" +"::xotcl::Object create ::xotcl::objectInfo\n" +"::xotcl::Object create ::xotcl::classInfo\n" +"foreach cmd [info command ::xotcl::cmd::ObjectInfo::*] {\n" +"::xotcl::alias ::xotcl::objectInfo [namespace tail $cmd] $cmd\n" +"::xotcl::alias ::xotcl::classInfo [namespace tail $cmd] $cmd}\n" +"foreach cmd [info command ::xotcl::cmd::ClassInfo::*] {\n" +"::xotcl::alias ::xotcl::classInfo [namespace tail $cmd] $cmd}\n" +"::xotcl::alias ::xotcl::objectInfo is ::xotcl::is\n" +"::xotcl::alias ::xotcl::classInfo is ::xotcl::is\n" +"::xotcl::alias ::xotcl::classInfo classparent ::xotcl::cmd::ObjectInfo::parent\n" +"::xotcl::alias ::xotcl::classInfo classchildren ::xotcl::cmd::ObjectInfo::children\n" +"unset cmd\n" +"::xotcl::Object instforward info -onerror ::xotcl::infoError ::xotcl::objectInfo %1 {%@2 %self}\n" +"::xotcl::Class instforward info -onerror ::xotcl::infoError ::xotcl::classInfo %1 {%@2 %self}\n" +"proc ::xotcl::infoError msg {\n" +"regsub -all \" \" $msg \"\" msg\n" +"regsub -all \" \" $msg \"\" msg\n" +"regsub {\\\"} $msg \"\\\"info \" msg\n" +"error $msg \"\"}\n" +"::xotcl::objectInfo proc info {obj} {\n" +"set methods [list]\n" +"foreach m [::info commands ::xotcl::objectInfo::*] {\n" +"set name [namespace tail $m]\n" +"if {$name eq \"unknown\"} continue\n" +"lappend methods $name}\n" +"return \"valid options are: [join [lsort $methods] {, }]\"}\n" +"::xotcl::objectInfo proc unknown {method args} {\n" +"error \"unknown info option \\\"$method\\\"; [my info info]\"}\n" +"::xotcl::classInfo proc info {cl} {\n" +"set methods [list]\n" +"foreach m [::info commands ::xotcl::classInfo::*] {\n" +"set name [namespace tail $m]\n" +"if {$name eq \"unknown\"} continue\n" +"lappend methods $name}\n" +"return \"valid options are: [join [lsort $methods] {, }]\"}\n" +"::xotcl::classInfo proc unknown {method args} {\n" +"error \"unknown info option \\\"$method\\\"; [my info info]\"}\n" "::xotcl::Object create ::xotcl::@\n" "::xotcl::@ proc unknown args {}\n" "proc ::xotcl::myproc {args} {linsert $args 0 [::xotcl::self]}\n" "proc ::xotcl::myvar {var} {::xotcl::my requireNamespace; return [::xotcl::self]::$var}\n" -"namespace eval ::xotcl { namespace export @ myproc myvar Attribute}\n" -"::xotcl::setrelation ::xotcl::Class::Parameter superclass ::xotcl::Class\n" -"::xotcl::Class::Parameter instproc mkParameter {obj name args} {\n" -"if {[$obj exists $name]} {\n" -"eval [$obj set $name] configure $args} else {\n" -"$obj set $name [eval ::xotcl::my new -childof $obj $args]}}\n" -"::xotcl::Class::Parameter instproc getParameter {obj name args} {\n" -"[$obj set $name]}\n" -"::xotcl::Class::Parameter proc Class {param args} {\n" -"::xotcl::my set access [lindex $param 0]\n" -"::xotcl::my set setter mkParameter\n" -"::xotcl::my set getter getParameter\n" -"::xotcl::my set extra {[::xotcl::self]}\n" -"::xotcl::my set defaultParam [lrange $param 1 end]}\n" -"::xotcl::Class::Parameter proc default {val} {\n" -"[::xotcl::my set cl] set __defaults([::xotcl::my set name]) $val}\n" -"::xotcl::Class::Parameter proc setter x {\n" -"::xotcl::my set setter $x}\n" -"::xotcl::Class::Parameter proc getter x {\n" -"::xotcl::my set getter $x}\n" -"::xotcl::Class::Parameter proc access obj {\n" -"::xotcl::my set access $obj\n" -"::xotcl::my set extra \\[::xotcl::self\\]\n" -"foreach v [$obj info vars] {::xotcl::my set $v [$obj set $v]}}\n" -"::xotcl::Class::Parameter proc values {param args} {\n" -"set cl [::xotcl::my set cl]\n" -"set ci [$cl info instinvar]\n" -"set valueTest {}\n" -"foreach a $args {\n" -"::lappend valueTest \"\\[\\$cl set $param\\] == [list $a]\"}\n" -"::lappend ci [join $valueTest \" || \"]\n" -"$cl instinvar $ci}\n" +"namespace export Object Class @ myproc myvar Attribute\n" "::xotcl::Class create ::xotcl::MetaSlot\n" -"::xotcl::setrelation ::xotcl::MetaSlot superclass ::xotcl::Class\n" +"::xotcl::relation ::xotcl::MetaSlot superclass ::xotcl::Class\n" "::xotcl::MetaSlot instproc new args {\n" -"set slotobject [self callingobject]::slot\n" -"if {![my isobject $slotobject]} {Object create $slotobject}\n" +"set slotobject [::xotcl::self callingobject]::slot\n" +"if {![::xotcl::is $slotobject object]} {::xotcl::Object create $slotobject}\n" "eval next -childof $slotobject $args}\n" -"::xotcl::MetaSlot create ::xotcl::Slot -array set __defaults {\n" -"name \"[namespace tail [::xotcl::self]]\"\n" -"domain \"[lindex [regexp -inline {^(.*)::slot::[^:]+$} [::xotcl::self]] 1]\"\n" -"defaultmethods {get assign}\n" -"manager \"[::xotcl::self]\"\n" -"multivalued false\n" -"per-object false}\n" -"foreach p {name domain defaultmethods manager default multivalued type\n" -"per-object initcmd valuecmd valuechangedcmd} {\n" -"::xotcl::Slot instparametercmd $p}\n" -"unset p\n" -"::xotcl::alias ::xotcl::Slot get ::xotcl::setinstvar\n" -"::xotcl::alias ::xotcl::Slot assign ::xotcl::setinstvar\n" -"::xotcl::Slot instproc add {obj prop value {pos 0}} {\n" -"if {![my multivalued]} {\n" -"error \"Property $prop of [my domain]->$obj ist not multivalued\"}\n" +"::xotcl::MetaSlot create ::xotcl::Slot\n" +"proc createBootstrapAttributeSlots {class definitions} {\n" +"if {![::xotcl::is ${class}::slot object]} {\n" +"::xotcl::Object create ${class}::slot}\n" +"foreach att $definitions {\n" +"if {[llength $att]>1} {foreach {att default} $att break}\n" +"::xotcl::Slot create ${class}::slot::$att\n" +"if {[info exists default]} {\n" +"::xotcl::setinstvar ${class}::slot::$att default $default\n" +"unset default}\n" +"$class instparametercmd $att}\n" +"foreach att $definitions {\n" +"if {[llength $att]>1} {foreach {att default} $att break}\n" +"if {[info exists default]} {\n" +"foreach i [$class info instances] {\n" +"if {![$i exists $att]} {::xotcl::setinstvar $i $att $default}}\n" +"unset default}}}\n" +"createBootstrapAttributeSlots ::xotcl::Class {\n" +"{__default_superclass ::xotcl::Object}}\n" +"createBootstrapAttributeSlots ::xotcl::Slot {\n" +"{name \"[namespace tail [::xotcl::self]]\"}\n" +"{domain \"[lindex [regexp -inline {^(.*)::slot::[^:]+$} [::xotcl::self]] 1]\"}\n" +"{manager \"[::xotcl::self]\"}\n" +"{per-object false}\n" +"{required false}}\n" +"::xotcl::Slot instproc unknown {method args} {\n" +"set methods [list]\n" +"foreach m [::xotcl::my info methods] {\n" +"if {[::xotcl::Object info methods $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::MetaSlot create ::xotcl::ValueSlot\n" +"::xotcl::relation ::xotcl::ValueSlot superclass ::xotcl::Slot\n" +"createBootstrapAttributeSlots ::xotcl::ValueSlot {\n" +"{defaultmethods {get assign}}\n" +"{multivalued false}\n" +"default\n" +"type}\n" +"::xotcl::alias ::xotcl::ValueSlot get ::xotcl::setinstvar\n" +"::xotcl::alias ::xotcl::ValueSlot assign ::xotcl::setinstvar\n" +"::xotcl::ValueSlot instproc add {obj prop value {pos 0}} {\n" +"if {![::xotcl::my multivalued]} {\n" +"error \"Property $prop of [::xotcl::my domain]->$obj ist not multivalued\"}\n" "if {[$obj exists $prop]} {\n" "$obj set $prop [linsert [$obj set $prop] $pos $value]} else {\n" "$obj set $prop [list $value]}}\n" -"::xotcl::Slot instproc delete {-nocomplain:switch obj prop value} {\n" +"::xotcl::ValueSlot instproc delete {-nocomplain:switch obj prop value} {\n" "set old [$obj set $prop]\n" "set p [lsearch -glob $old $value]\n" "if {$p>-1} {$obj set $prop [lreplace $old $p $p]} else {\n" "error \"$value is not a $prop of $obj (valid are: $old)\"}}\n" -"::xotcl::Slot instproc unknown {method args} {\n" -"set methods [list]\n" -"foreach m [my info methods] {\n" -"if {[::xotcl::Object info methods $m] ne \"\"} continue\n" -"if {[string match __* $m]} continue\n" -"lappend methods $m}\n" -"error \"Method '$method' unknown for slot [self]; valid are: {[lsort $methods]]}\"}\n" -"::xotcl::Slot instproc init {} {\n" -"my instvar name domain manager\n" -"set forwarder [expr {[my per-object] ? \"forward\" : \"instforward\"}]\n" +"::xotcl::ValueSlot instproc init {} {\n" +"::xotcl::my instvar name domain manager per-object\n" "if {$domain eq \"\"} {\n" -"set domain [self callingobject]}\n" +"set domain [::xotcl::self callingobject]}\n" +"if {!${per-object} && ![::xotcl::is $domain class]} {\n" +"set per-object true}\n" +"set forwarder [expr {${per-object} ? \"forward\" : \"instforward\"}]\n" "$domain $forwarder $name -default [$manager defaultmethods] $manager %1 %self %proc}\n" -"::xotcl::MetaSlot create ::xotcl::InfoSlot -array set __defaults {\n" -"multivalued true}\n" -"::xotcl::setrelation ::xotcl::InfoSlot superclass ::xotcl::Slot\n" +"::xotcl::MetaSlot create ::xotcl::InfoSlot\n" +"createBootstrapAttributeSlots ::xotcl::InfoSlot {\n" +"{multivalued true}}\n" +"::xotcl::relation ::xotcl::InfoSlot superclass ::xotcl::ValueSlot\n" "::xotcl::InfoSlot instproc get {obj prop} {$obj info $prop}\n" "::xotcl::InfoSlot instproc add {obj prop value {pos 0}} {\n" -"if {![my multivalued]} {\n" -"error \"Property $prop of [my domain]->$obj ist not multivalued\"}\n" +"if {![::xotcl::my multivalued]} {\n" +"error \"Property $prop of [::xotcl::my domain]->$obj ist not multivalued\"}\n" "$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" "error \"$value is not a $prop of $obj (valid are: $old)\"}}\n" -"::xotcl::MetaSlot create ::xotcl::InterceptorSlot\n" -"::xotcl::setrelation ::xotcl::InterceptorSlot superclass ::xotcl::InfoSlot\n" -"::xotcl::alias ::xotcl::InterceptorSlot set ::xotcl::setrelation ;# for backwards compatibility\n" -"::xotcl::alias ::xotcl::InterceptorSlot assign ::xotcl::setrelation\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 instproc add {obj prop value {pos 0}} {\n" -"if {![my multivalued]} {\n" -"error \"Property $prop of [my domain]->$obj ist not multivalued\"}\n" +"if {![::xotcl::my multivalued]} {\n" +"error \"Property $prop of [::xotcl::my domain]->$obj ist not multivalued\"}\n" "$obj $prop [linsert [$obj info $prop -guards] $pos $value]}\n" -"namespace eval ::xotcl::Class::slot {}\n" "namespace eval ::xotcl::Object::slot {}\n" +"::xotcl::Object alloc ::xotcl::Class::slot\n" +"::xotcl::Object alloc ::xotcl::Object::slot\n" "::xotcl::InfoSlot create ::xotcl::Class::slot::superclass\n" -"::xotcl::alias ::xotcl::Class::slot::superclass assign ::xotcl::setrelation\n" +"::xotcl::alias ::xotcl::Class::slot::superclass assign ::xotcl::relation\n" "::xotcl::InfoSlot create ::xotcl::Object::slot::class\n" -"::xotcl::alias ::xotcl::Object::slot::class assign ::xotcl::setrelation\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::Class::slot::instmixin\n" "::xotcl::InterceptorSlot create ::xotcl::Class::slot::instfilter\n" -"::xotcl::MetaSlot create ::xotcl::Attribute -superclass ::xotcl::Slot\n" -"foreach p {default value_check initcmd valuecmd valuechangedcmd} {\n" -"::xotcl::Attribute instparametercmd $p}\n" -"unset p\n" -"::xotcl::Attribute array set __defaults {\n" -"value_check once}\n" +"::xotcl::MetaSlot create ::xotcl::Attribute -superclass ::xotcl::ValueSlot\n" +"createBootstrapAttributeSlots ::xotcl::Attribute {\n" +"{value_check once}\n" +"initcmd\n" +"valuecmd\n" +"valuechangedcmd}\n" "::xotcl::Attribute instproc __default_from_cmd {obj cmd var sub op} {\n" -"$obj trace remove variable $var $op [list [self] [self proc] $obj $cmd]\n" -"$obj set $var [$obj eval $cmd]}\n" +"$obj trace remove variable $var $op [list [::xotcl::self] [::xotcl::self proc] $obj $cmd]\n" +"$obj set $var [eval $cmd]}\n" "::xotcl::Attribute instproc __value_from_cmd {obj cmd var sub op} {\n" -"$obj set $var [$obj eval $cmd]}\n" +"$obj set $var [eval $cmd]}\n" "::xotcl::Attribute instproc __value_changed_cmd {obj cmd var sub op} {\n" "eval $cmd}\n" -"::xotcl::Attribute instproc destroy {} {\n" -"next}\n" "::xotcl::Attribute instproc check_single_value {\n" "{-keep_old_value:boolean true}\n" "value predicate type obj var} {\n" "if {![expr $predicate]} {\n" "if {[$obj exists __oldvalue($var)]} {\n" "$obj set $var [$obj set __oldvalue($var)]} else {\n" "$obj unset -nocomplain $var}\n" -"error \"$value is not of type $type\"}\n" +"error \"'$value' is not of type $type\"}\n" "if {$keep_old_value} {$obj set __oldvalue($var) $value}}\n" "::xotcl::Attribute instproc check_multiple_values {values predicate type obj var} {\n" "foreach value $values {\n" -"my check_single_value -keep_old_value false $value $predicate $type $obj $var}\n" +"::xotcl::my check_single_value -keep_old_value false $value $predicate $type $obj $var}\n" "$obj set __oldvalue($var) $value}\n" "::xotcl::Attribute instproc mk_type_checker {} {\n" "set __initcmd \"\"\n" -"if {[my exists type]} {\n" -"my instvar type name\n" +"if {[::xotcl::my exists type]} {\n" +"::xotcl::my instvar type name\n" "if {[::xotcl::Object isclass $type]} {\n" -"set predicate [subst -nocommands {[::xotcl::Object isobject \\$value]\n" -"&& [\\$value istype $type]}]} elseif {[llength $type]>1} {\n" +"set predicate [subst -nocommands {\n" +"[::xotcl::Object isobject \\$value] && [\\$value istype $type]}]} elseif {[llength $type]>1} {\n" "set predicate \"\\[$type \\$value\\]\"} else {\n" -"set predicate \"\\[string is $type \\$value\\]\"}\n" -"my append valuechangedcmd [subst {\n" -"my [expr {[my multivalued] ? \"check_multiple_values\" : \"check_single_value\"}] \\[\\$obj set $name\\] \\\n" +"set predicate \"\\[[self] type=$type $name \\$value\\]\"}\n" +"::xotcl::my append valuechangedcmd [subst {\n" +"::xotcl::my [expr {[::xotcl::my multivalued] ?\n" +"\"check_multiple_values\" : \"check_single_value\"}] \\[\\$obj set $name\\] \\\n" "{$predicate} [list $type] \\$obj $name}]\n" "append __initcmd [subst -nocommands {\n" -"if {[my exists $name]} {my set __oldvalue($name) [my set $name]}\\n}]}\n" +"if {[::xotcl::my exists $name]} {::xotcl::my set __oldvalue($name) [::xotcl::my set $name]}\\n}]}\n" "return $__initcmd}\n" "::xotcl::Attribute instproc init {} {\n" -"my instvar domain name\n" +"::xotcl::my instvar domain name\n" "next ;# do first ordinary slot initialization\n" -"$domain unset -nocomplain __defaults($name)\n" "set __initcmd \"\"\n" -"if {[my exists default]} {\n" -"$domain set __defaults($name) [my default]} elseif [my exists initcmd] {\n" -"append __initcmd \"my trace add variable [list $name] read \\\n" -"\\[list [self] __default_from_cmd \\[self\\] [list [my initcmd]]\\]\\n\"} elseif [my exists valuecmd] {\n" -"append __initcmd \"my trace add variable [list $name] read \\\n" -"\\[list [self] __value_from_cmd \\[self\\] [list [my valuecmd]]\\]\"}\n" -"append __initcmd [my mk_type_checker]\n" -"if {[my exists valuechangedcmd]} {\n" -"append __initcmd \"my trace add variable [list $name] write \\\n" -"\\[list [self] __value_changed_cmd \\[self\\] [list [my valuechangedcmd]]\\]\"}\n" +"if {[::xotcl::my exists default]} {} elseif [::xotcl::my exists initcmd] {\n" +"append __initcmd \"::xotcl::my trace add variable [list $name] read \\\n" +"\\[list [::xotcl::self] __default_from_cmd \\[::xotcl::self\\] [list [::xotcl::my initcmd]]\\]\\n\"} elseif [::xotcl::my exists valuecmd] {\n" +"append __initcmd \"::xotcl::my trace add variable [list $name] read \\\n" +"\\[list [::xotcl::self] __value_from_cmd \\[::xotcl::self\\] [list [::xotcl::my valuecmd]]\\]\"}\n" +"append __initcmd [::xotcl::my mk_type_checker]\n" +"if {[::xotcl::my exists valuechangedcmd]} {\n" +"append __initcmd \"::xotcl::my trace add variable [list $name] write \\\n" +"\\[list [::xotcl::self] __value_changed_cmd \\[::xotcl::self\\] [list [::xotcl::my valuechangedcmd]]\\]\"}\n" "if {$__initcmd ne \"\"} {\n" -"$domain set __initcmds($name) $__initcmd}}\n" +"my set initcmd $__initcmd}}\n" "::xotcl::Class create ::xotcl::Slot::Nocheck \\\n" "-instproc check_single_value args {;} -instproc check_multiple_values args {;} \\\n" "-instproc mk_type_checker args {return \"\"}\n" @@ -192,11 +240,11 @@ "if {[::xotcl::my procsearch get] ne \"::xotcl::Slot instcmd get\"} return\n" "set forwarder [expr {[::xotcl::my per-object] ? \"parametercmd\":\"instparametercmd\"}]\n" "[::xotcl::my domain] $forwarder [::xotcl::my name]}\n" -"::xotcl::Slot instmixin add ::xotcl::Slot::Optimizer\n" -"::xotcl::Class create ::xotcl::ScopedNew -superclass ::xotcl::Class \\\n" -"-array set __defaults {withclass ::xotcl::Object}\n" -"::xotcl::ScopedNew instparametercmd withclass\n" -"::xotcl::ScopedNew instparametercmd inobject\n" +"::xotcl::Attribute instmixin add ::xotcl::Slot::Optimizer\n" +"::xotcl::Class create ::xotcl::ScopedNew -superclass ::xotcl::Class\n" +"createBootstrapAttributeSlots ::xotcl::ScopedNew {\n" +"{withclass ::xotcl::Object}\n" +"inobject}\n" "::xotcl::ScopedNew instproc init {} {\n" "::xotcl::my instproc new {-childof args} {\n" "[::xotcl::self class] instvar {inobject object} withclass\n" @@ -220,24 +268,42 @@ "namespace eval $object $cmds}}\n" "::xotcl::Class instforward slots %self contains \\\n" "-object {%::xotcl::my subst [::xotcl::self]::slot}\n" +"::xotcl::Object instforward slots %self contains \\\n" +"-object {%::xotcl::my subst [::xotcl::self]::slot}\n" "::xotcl::Class instproc parameter arglist {\n" -"if {![::xotcl::my isobject [self]::slot]} {::xotcl::Object create [self]::slot}\n" +"if {![::xotcl::is [::xotcl::self]::slot object]} {\n" +"::xotcl::Object create [::xotcl::self]::slot}\n" "foreach arg $arglist {\n" "set l [llength $arg]\n" "set name [lindex $arg 0]\n" +"if {[string first : $name] > -1} {\n" +"foreach {name type} [split $name :] break\n" +"if {$type eq \"required\"} {\n" +"set required 1\n" +"unset type}}\n" +"set cmd [list ::xotcl::Attribute create [::xotcl::self]::slot::$name]\n" +"if {[info exists type]} {\n" +"lappend cmd -type $type\n" +"unset type}\n" +"if {[info exists required]} {\n" +"lappend cmd -required 1\n" +"unset required}\n" "if {$l == 1} {\n" -"::xotcl::Attribute create [::xotcl::self]::slot::$name} elseif {$l == 2} {\n" -"::xotcl::Attribute create [::xotcl::self]::slot::$name [list -default [lindex $arg 1]]} elseif {$l == 3 && [lindex $arg 1] eq \"-default\"} {\n" -"::xotcl::Attribute create [::xotcl::self]::slot::$name [list -default [lindex $arg 2]]} else {\n" +"eval $cmd} elseif {$l == 2} {\n" +"lappend cmd -default [lindex $arg 1]\n" +"eval $cmd} elseif {$l == 3 && [lindex $arg 1] eq \"-default\"} {\n" +"lappend cmd -default [lindex $arg 2]\n" +"eval $cmd} else {\n" "set paramstring [string range $arg [expr {[string length $name]+1}] end]\n" "if {[string match {[$\\[]*} $paramstring]} {\n" -"::xotcl::Attribute create [::xotcl::self]::slot::$name [list -default $paramstring]\n" +"lappend cmd -default $paramstring\n" +"eval $cmd\n" "continue}\n" "set po ::xotcl::Class::Parameter\n" "puts stderr \"deprecated parameter usage '$arg'; use '-slots {Attribute ...}' instead\"\n" -"set cl [self]\n" +"set cl [::xotcl::self]\n" "$po set name $name\n" -"$po set cl [self]\n" +"$po set cl [::xotcl::self]\n" "::eval $po configure [lrange $arg 1 end]\n" "if {[$po exists extra] || [$po exists setter] ||\n" "[$po exists getter] || [$po exists access]} {\n" @@ -254,7 +320,7 @@ "foreach instvar {extra defaultParam setter getter access} {\n" "$po unset -nocomplain $instvar}} else {\n" "::xotcl::my instparametercmd $name}}}\n" -"[self]::slot set __parameter $arglist}\n" +"[::xotcl::self]::slot set __parameter $arglist}\n" "::xotcl::Object instproc self {} {::xotcl::self}\n" "::xotcl::Object instproc defaultmethod {} {\n" "return [::xotcl::self]}\n" @@ -274,6 +340,8 @@ "::xotcl::Object proc __exitHandler {} $newbody}\n" "::xotcl::Object proc getExitHandler {} {\n" "::xotcl::Object info body __exitHandler}\n" +"proc ::xotcl::__exitHandler {} {\n" +"::xotcl::Object __exitHandler}\n" "::xotcl::Object instproc abstract {methtype methname arglist} {\n" "if {$methtype ne \"proc\" && $methtype ne \"instproc\"} {\n" "error \"invalid method type '$methtype', \\\n" @@ -311,7 +379,6 @@ "set cl [[$origin info class] create $dest -noinit]\n" "set obj $cl\n" "$cl superclass [$origin info superclass]\n" -"$cl parameterclass [$origin info parameterclass]\n" "$cl instinvar [$origin info instinvar]\n" "$cl instfilter [$origin info instfilter -guards]\n" "$cl instmixin [$origin info instmixin]\n" @@ -449,8 +516,8 @@ "::xotcl::Class proc __unknown name {}\n" "::xotcl::Class instproc uses list {\n" "foreach package $list {\n" -"::xotcl::package import -into [self] $package\n" -"puts stderr \"*** using ${package}::* in [self]\"}}\n" +"::xotcl::package import -into [::xotcl::self] $package\n" +"puts stderr \"*** using ${package}::* in [::xotcl::self]\"}}\n" "::xotcl::Class create ::xotcl::package -superclass ::xotcl::Class -parameter {\n" "provide\n" "{version 1.0}\n" @@ -466,16 +533,16 @@ "::xotcl::package instproc contains script {\n" "if {[my exists provide]} {\n" "package provide [my provide] [my version]} else {\n" -"package provide [self] [my version]}\n" -"namespace eval [self] {namespace import ::xotcl::*}\n" -"namespace eval [self] $script\n" +"package provide [::xotcl::self] [::xotcl::my version]}\n" +"namespace eval [::xotcl::self] {namespace import ::xotcl::*}\n" +"namespace eval [::xotcl::self] $script\n" "foreach e [my export] {\n" "set nq [namespace qualifiers $e]\n" "if {$nq ne \"\"} {\n" -"namespace eval [self]::$nq [list namespace export [namespace tail $e]]} else {\n" -"namespace eval [self] [list namespace export $e]}}\n" +"namespace eval [::xotcl::self]::$nq [list namespace export [namespace tail $e]]} else {\n" +"namespace eval [::xotcl::self] [list namespace export $e]}}\n" "foreach e [my autoexport] {\n" -"namespace eval :: [list namespace import [self]::$e]}}\n" +"namespace eval :: [list namespace import [::xotcl::self]::$e]}}\n" "::xotcl::package configure \\\n" "-set component . \\\n" "-set verbose 0 \\\n" @@ -520,21 +587,9 @@ "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" -"proc ::xotcl::tmpdir {} {\n" -"foreach e [list TMPDIR TEMP TMP] {\n" -"if {[info exists ::env($e)] \\\n" -"&& [file isdirectory $::env($e)] \\\n" -"&& [file writable $::env($e)]} {\n" -"return $::env($e)}}\n" -"if {$::tcl_platform(platform) eq \"windows\"} {\n" -"foreach d [list \"C:\\\\TEMP\" \"C:\\\\TMP\" \"\\\\TEMP\" \"\\\\TMP\"] {\n" -"if {[file isdirectory $d] && [file writable $d]} {\n" -"return $d}}}\n" -"return /tmp}\n" -""; +"unset bootstrap}";