Index: generic/predefined.h =================================================================== diff -u -r675e28583d105313f7fbc1dad66d2696c18b19f4 -r555e7f84db642cb7f4d77c8a5189922e1287b3d4 --- generic/predefined.h (.../predefined.h) (revision 675e28583d105313f7fbc1dad66d2696c18b19f4) +++ generic/predefined.h (.../predefined.h) (revision 555e7f84db642cb7f4d77c8a5189922e1287b3d4) @@ -50,7 +50,7 @@ "lappend methods $name}\n" "return \"valid options are: [join [lsort $methods] {, }]\"}\n" "objectInfo method unknown {method args} {\n" -"error \"unknown info option \\\"$method\\\"; [my info info]\"}\n" +"error \"unknown info option \\\"$method\\\"; [.info info]\"}\n" "classInfo method info {cl} {\n" "set methods [list]\n" "foreach m [::info commands ::xotcl::classInfo::*] {\n" @@ -59,7 +59,7 @@ "lappend methods $name}\n" "return \"valid options are: [join [lsort $methods] {, }]\"}\n" "classInfo method unknown {method args} {\n" -"error \"unknown info option \\\"$method\\\"; [my info info]\"}\n" +"error \"unknown info option \\\"$method\\\"; [.info info]\"}\n" "namespace export Object Class}\n" "namespace eval ::xotcl {\n" "::xotcl::createobjectsystem ::xotcl::Object ::xotcl::Class}\n" @@ -113,7 +113,7 @@ "lappend methods $name}\n" "return \"valid options are: [join [lsort $methods] {, }]\"}\n" "::xotcl::objectInfo method unknown {method args} {\n" -"error \"unknown info option \\\"$method\\\"; [my info info]\"}\n" +"error \"unknown info option \\\"$method\\\"; [.info info]\"}\n" "::xotcl::classInfo method info {cl} {\n" "set methods [list]\n" "foreach m [::info commands ::xotcl::classInfo::*] {\n" @@ -122,7 +122,7 @@ "lappend methods $name}\n" "return \"valid options are: [join [lsort $methods] {, }]\"}\n" "::xotcl::classInfo method unknown {method args} {\n" -"error \"unknown info option \\\"$method\\\"; [my info info]\"}\n" +"error \"unknown info option \\\"$method\\\"; [.info info]\"}\n" "# info instargs\n" "# istype\n" "proc ::xotcl::info_args {inst o method} {\n" @@ -183,7 +183,7 @@ "::xotcl::Object create ::xotcl::@\n" "::xotcl::@ method 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" +"proc ::xotcl::myvar {var} {.requireNamespace; return [::xotcl::self]::$var}\n" "namespace eval ::xotcl {\n" "namespace export Object Class @ myproc myvar Attribute}\n" "::xotcl::Class create ::xotcl::MetaSlot\n" @@ -260,8 +260,8 @@ "::xotcl::alias ::xotcl::Slot get ::xotcl::setinstvar\n" "::xotcl::alias ::xotcl::Slot assign ::xotcl::setinstvar\n" "::xotcl::Slot method 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 {![set .multivalued]} {\n" +"error \"Property $prop of [set .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" @@ -272,45 +272,43 @@ "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 [::xotcl::my info methods] {\n" +"foreach m [.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::Slot method destroy {} {\n" -"::xotcl::instvar domain\n" -"if {$domain ne \"\"} {\n" -"$domain invalidateobjectparameter}\n" +"if {${.domain} ne \"\"} {\n" +"${.domain} invalidateobjectparameter}\n" "next}\n" "::xotcl::Slot method init {} {\n" -"::xotcl::instvar name domain manager per-object\n" -"set forwarder [expr {${per-object} ? \"forward\" : \"instforward\"}]\n" -"if {$domain eq \"\"} {\n" -"set domain [::xotcl::self callingobject]} else {\n" -"$domain invalidateobjectparameter}\n" -"$domain $forwarder $name -default [$manager defaultmethods] $manager %1 %self %proc}\n" +"set forwarder [expr {${.per-object} ? \"forward\" : \"instforward\"}]\n" +"if {${.domain} eq \"\"} {\n" +"set .domain [::xotcl::self callingobject]} else {\n" +"${.domain} invalidateobjectparameter}\n" +"${.domain} $forwarder ${.name} -default [${.manager} defaultmethods] ${.manager} %1 %self %proc}\n" "::xotcl::MetaSlot create ::xotcl::InfoSlot\n" "createBootstrapAttributeSlots ::xotcl::InfoSlot {\n" "{multivalued true}\n" "{elementtype ::xotcl::Class}}\n" "::xotcl::relation ::xotcl::InfoSlot superclass ::xotcl::Slot\n" "::xotcl::InfoSlot method get {obj prop} {$obj info $prop}\n" "::xotcl::InfoSlot method 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 {![set .multivalued]} {\n" +"error \"Property $prop of ${.domain}->$obj ist not multivalued\"}\n" "$obj $prop [linsert [$obj info $prop] $pos $value]}\n" "::xotcl::InfoSlot method delete {-nocomplain:switch obj prop value} {\n" "set old [$obj info $prop]\n" "if {[string first * $value] > -1 || [string first \\[ $value] > -1} {\n" -"if {[my elementtype] ne \"\" && ![string match ::* $value]} {\n" +"if {${.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" +"return [$obj $prop [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 [$value self]}\n" -"if {![::xotcl::is [my elementtype] class]} {\n" -"error \"$value does not appear to be of type [my 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" "$obj $prop [lreplace $old $p $p]} else {\n" @@ -320,8 +318,8 @@ "::xotcl::alias ::xotcl::InterceptorSlot set ::xotcl::relation ;# for backwards compatibility\n" "::xotcl::alias ::xotcl::InterceptorSlot assign ::xotcl::relation\n" "::xotcl::InterceptorSlot method 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 {![set .multivalued]} {\n" +"error \"Property $prop of ${.domain}->$obj ist not multivalued\"}\n" "$obj $prop [linsert [$obj info $prop -guards] $pos $value]}\n" "foreach os {::xotcl ::xotcl2} {\n" "${os}::Object alloc ${os}::Class::slot\n" @@ -363,59 +361,56 @@ "if {$keep_old_value} {$obj set __oldvalue($var) $value}}\n" "::xotcl::Attribute method check_multiple_values {values predicate type obj var} {\n" "foreach value $values {\n" -"::xotcl::my 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" "$obj set __oldvalue($var) $value}\n" "::xotcl::Attribute method mk_type_checker {} {\n" "set __initcmd \"\"\n" -"if {[::xotcl::my exists type]} {\n" -"::xotcl::my instvar type name\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 \"\\[[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" +"[::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\"}] \\[\\$obj set ${.name}\\] \\\n" +"{$predicate} [list ${.type}] \\$obj ${.name}}]\n" "append __initcmd [subst -nocommands {\n" -"if {[::xotcl::my exists $name]} {::xotcl::my set __oldvalue($name) [::xotcl::my set $name]}\\n}]}\n" +"if {[.exists ${.name}]} {set .__oldvalue(${.name}) [set .${.name}]}\\n}]}\n" "return $__initcmd}\n" "::xotcl::Attribute method init {} {\n" -"::xotcl::my instvar domain name\n" "next ;# do first ordinary slot initialization\n" "set __initcmd \"\"\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" -"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 {[.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" -"my set initcmd $__initcmd}}\n" +"set .initcmd $__initcmd}}\n" "::xotcl::Class create ::xotcl::Slot::Nocheck \\\n" "-method check_single_value args {;} -method check_multiple_values args {;} \\\n" "-method mk_type_checker args {return \"\"}\n" "::xotcl::Class create ::xotcl::Slot::Optimizer \\\n" -"-method proc args {::xotcl::next; ::xotcl::my optimize} \\\n" -"-method forward args {::xotcl::next; ::xotcl::my optimize} \\\n" -"-method init args {::xotcl::next; ::xotcl::my optimize} \\\n" +"-method proc args {::xotcl::next; .optimize} \\\n" +"-method forward args {::xotcl::next; .optimize} \\\n" +"-method init args {::xotcl::next; .optimize} \\\n" "-method optimize {} {\n" -"if {[::xotcl::my multivalued]} return\n" -"if {[::xotcl::my defaultmethods] ne {get assign}} return\n" -"if {[::xotcl::my procsearch assign] ne \"::xotcl::Slot instcmd assign\"} return\n" -"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" +"if {[set .multivalued]} return\n" +"if {[set .defaultmethods] ne {get assign}} return\n" +"if {[.procsearch assign] ne \"::xotcl::Slot instcmd assign\"} return\n" +"if {[.procsearch get] ne \"::xotcl::Slot instcmd get\"} return\n" +"set forwarder [expr {[set .per-object] ? \"parametercmd\":\"instparametercmd\"}]\n" +"${.domain} $forwarder ${.name}}\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 method init {} {\n" -"::xotcl::my method new {-childof args} {\n" +".method new {-childof args} {\n" "[::xotcl::self class] instvar {inobject object} withclass\n" "if {![::xotcl::is $object object]} {\n" "$withclass create $object}\n" @@ -436,7 +431,7 @@ "::xotcl::Class instmixin delete $m} else {\n" "namespace eval $object $cmds}}\n" "::xotcl::Class instforward slots %self contains \\\n" -"-object {%::xotcl::my subst [::xotcl::self]::slot}\n" +"-object {%::xotcl::dispatch [::xotcl::self] -objscope ::subst [::xotcl::self]::slot}\n" "::xotcl::Class method parameter arglist {\n" "if {![::xotcl::is [::xotcl::self]::slot object]} {\n" "::xotcl::Object create [::xotcl::self]::slot}\n" @@ -486,7 +481,7 @@ "return \\[eval $access $setter $extra $name \\$args $defaultParam \\]}\"\n" "foreach instvar {extra defaultParam setter getter access} {\n" "$po unset -nocomplain $instvar}} else {\n" -"::xotcl::my instparametercmd $name}}}\n" +".instparametercmd $name}}}\n" "[::xotcl::self]::slot set __parameter $arglist}\n" "::xotcl::Object method self {} {::xotcl::self}\n" "::xotcl::Object method defaultmethod {} {\n" @@ -495,7 +490,7 @@ "if {[::xotcl::is [self] mixin $cl]} {return 1}\n" "::xotcl::is [self] type $cl}\n" "::xotcl::Class method allinstances {} {\n" -"return [::xotcl::my info instances -closure]}\n" +"return [.info instances -closure]}\n" "::xotcl::alias ::xotcl2::Class parameter ::xotcl::classes::xotcl::Class::parameter\n" "::xotcl::alias ::xotcl2::Object defaultmethod ::xotcl::classes::xotcl::Object::defaultmethod\n" "::xotcl::Object method -per-object unsetExitHandler {} {\n" @@ -512,7 +507,7 @@ "if {$methtype ne \"proc\" && $methtype ne \"instproc\" && $methtype ne \"method\"} {\n" "error \"invalid method type '$methtype', \\\n" "must be either 'proc', 'instproc' or 'method'.\"}\n" -"::xotcl::my $methtype $methname $arglist \"\n" +".$methtype $methname $arglist \"\n" "if {!\\[::xotcl::self isnextcall\\]} {\n" "error \\\"Abstract method $methname $arglist called\\\"} else {::xotcl::next}\n" "\"}\n" @@ -521,7 +516,7 @@ "{dest \"\"}\n" "objLength}\n" "::xotcl::Object::CopyHandler method makeTargetList t {\n" -"::xotcl::my lappend targetList $t\n" +"lappend .targetList $t\n" "if {[::xotcl::is $t object]} {\n" "if {[$t info hasnamespace]} {\n" "set children [$t info children]} else {\n" @@ -530,16 +525,16 @@ "if {![::xotcl::is $c object]} {\n" "lappend children [namespace children $t]}}\n" "foreach c $children {\n" -"::xotcl::my makeTargetList $c}}\n" +".makeTargetList $c}}\n" "::xotcl::Object::CopyHandler method copyNSVarsAndCmds {orig dest} {\n" "::xotcl::namespace_copyvars $orig $dest\n" "::xotcl::namespace_copycmds $orig $dest}\n" "::xotcl::Object::CopyHandler method getDest origin {\n" -"set tail [string range $origin [::xotcl::my set objLength] end]\n" -"return ::[string trimleft [::xotcl::my set dest]$tail :]}\n" +"set tail [string range $origin [set .objLength] end]\n" +"return ::[string trimleft [set .dest]$tail :]}\n" "::xotcl::Object::CopyHandler method copyTargets {} {\n" -"foreach origin [::xotcl::my set targetList] {\n" -"set dest [::xotcl::my getDest $origin]\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" @@ -548,7 +543,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" +".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" @@ -557,7 +552,7 @@ "if {[$origin info hasnamespace]} {\n" "$obj requireNamespace}} else {\n" "namespace eval $dest {}}\n" -"::xotcl::my 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" @@ -572,32 +567,32 @@ "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 [::xotcl::my set targetList] {\n" +"foreach origin [set .targetList] {\n" "if {[::xotcl::is $origin class]} {\n" -"set dest [::xotcl::my 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" "::xotcl::Object::CopyHandler method copy {obj dest} {\n" -"::xotcl::my set objLength [string length $obj]\n" -"::xotcl::my set dest $dest\n" -"::xotcl::my makeTargetList $obj\n" -"::xotcl::my copyTargets}\n" +"set .objLength [string length $obj]\n" +"set .dest $dest\n" +".makeTargetList $obj\n" +".copyTargets}\n" "::xotcl::Object method copy newName {\n" "if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} {\n" "[[::xotcl::self class]::CopyHandler new -volatile] copy [::xotcl::self] $newName}}\n" "::xotcl::Object method move newName {\n" "if {[string trimleft $newName :] ne [string trimleft [::xotcl::self] :]} {\n" "if {$newName ne \"\"} {\n" -"::xotcl::my copy $newName}\n" +".copy $newName}\n" "if {[::xotcl::is [::xotcl::self] class] && $newName ne \"\"} {\n" -"foreach subclass [::xotcl::my 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" -"::xotcl::my destroy}}\n" +".destroy}}\n" "::xotcl::Object create ::xotcl::config\n" "::xotcl::config method load {obj file} {\n" "source $file\n" @@ -694,62 +689,60 @@ "if {$nq ne \"\" && ![namespace exists $nq]} {Object create $nq}\n" "next}\n" "::xotcl::package method -per-object extend {name args} {\n" -"my require $name\n" +".require $name\n" "eval $name configure $args}\n" "::xotcl::package method -per-object contains script {\n" -"if {[my exists provide]} {\n" -"package provide [my provide] [my version]} else {\n" -"package provide [::xotcl::self] [::xotcl::my version]}\n" +"if {[.exists provide]} {\n" +"package provide [set .provide] [set .version]} else {\n" +"package provide [::xotcl::self] [set .version]}\n" "namespace eval [::xotcl::self] {namespace import ::xotcl::*}\n" "namespace eval [::xotcl::self] $script\n" -"foreach e [my export] {\n" +"foreach e [set .export] {\n" "set nq [namespace qualifiers $e]\n" "if {$nq ne \"\"} {\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" +"foreach e [set .autoexport] {\n" "namespace eval :: [list namespace import [::xotcl::self]::$e]}}\n" "::xotcl::package configure \\\n" "-set component . \\\n" "-set verbose 0 \\\n" "-set packagecmd ::package\n" "::xotcl::package method -per-object unknown args {\n" -"eval [my set packagecmd] $args}\n" +"eval [set .packagecmd] $args}\n" "::xotcl::package method -per-object verbose value {\n" -"my set verbose $value}\n" +"set .verbose $value}\n" "::xotcl::package method -per-object present args {\n" "if {$::tcl_version<8.3} {\n" -"my instvar loaded\n" "switch -exact -- [lindex $args 0] {\n" "-exact {set pkg [lindex $args 1]}\n" "default {set pkg [lindex $args 0]}}\n" -"if {[info exists loaded($pkg)]} {\n" -"return $loaded($pkg)} else {\n" +"if {[info exists .loaded($pkg)]} {\n" +"return ${.loaded}($pkg)} else {\n" "error \"not found\"}} else {\n" -"eval [my set packagecmd] present $args}}\n" +"eval [set .packagecmd] present $args}}\n" "::xotcl::package method -per-object import {{-into ::} pkg} {\n" -"my require $pkg\n" +".require $pkg\n" "namespace eval $into [subst -nocommands {\n" "namespace import ${pkg}::*}]\n" "foreach e [$pkg export] {\n" "set nq [namespace qualifiers $e]\n" "if {$nq ne \"\"} {\n" "namespace eval $into$nq [list namespace import ${pkg}::$e]}}}\n" -"::xotcl::package method -per-object require args {\n" -"::xotcl::my instvar component verbose uses loaded\n" -"set prevComponent $component\n" +"::xotcl::package method -per-object require args {\n" +"set prevComponent ${.component}\n" "if {[catch {set v [eval package present $args]} msg]} {\n" "switch -exact -- [lindex $args 0] {\n" "-exact {set pkg [lindex $args 1]}\n" "default {set pkg [lindex $args 0]}}\n" -"set component $pkg\n" -"lappend uses($prevComponent) $component\n" -"set v [uplevel \\#1 [my set packagecmd] require $args]\n" -"if {$v ne \"\" && $verbose} {\n" +"set .component $pkg\n" +"lappend .uses($prevComponent) ${.component}\n" +"set v [uplevel \\#1 [set .packagecmd] require $args]\n" +"if {$v ne \"\" && ${.verbose}} {\n" "set path [lindex [::package ifneeded $pkg $v] 1]\n" "puts \"... $pkg $v loaded from '$path'\"\n" -"set loaded($pkg) $v ;# loaded stuff needed for Tcl 8.0}}\n" -"set component $prevComponent\n" +"set .loaded($pkg) $v ;# loaded stuff needed for Tcl 8.0}}\n" +"set .component $prevComponent\n" "return $v}\n" "proc ::xotcl::tmpdir {} {\n" "foreach e [list TMPDIR TEMP TMP] {\n" Index: generic/predefined.xotcl =================================================================== diff -u -r675e28583d105313f7fbc1dad66d2696c18b19f4 -r555e7f84db642cb7f4d77c8a5189922e1287b3d4 --- generic/predefined.xotcl (.../predefined.xotcl) (revision 675e28583d105313f7fbc1dad66d2696c18b19f4) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision 555e7f84db642cb7f4d77c8a5189922e1287b3d4) @@ -97,7 +97,7 @@ return "valid options are: [join [lsort $methods] {, }]" } objectInfo method unknown {method args} { - error "unknown info option \"$method\"; [my info info]" + error "unknown info option \"$method\"; [.info info]" } classInfo method info {cl} { @@ -110,7 +110,7 @@ return "valid options are: [join [lsort $methods] {, }]" } classInfo method unknown {method args} { - error "unknown info option \"$method\"; [my info info]" + error "unknown info option \"$method\"; [.info info]" } namespace export Object Class @@ -249,7 +249,7 @@ return "valid options are: [join [lsort $methods] {, }]" } ::xotcl::objectInfo method unknown {method args} { - error "unknown info option \"$method\"; [my info info]" + error "unknown info option \"$method\"; [.info info]" } ::xotcl::classInfo method info {cl} { @@ -262,7 +262,7 @@ return "valid options are: [join [lsort $methods] {, }]" } ::xotcl::classInfo method unknown {method args} { - error "unknown info option \"$method\"; [my info info]" + error "unknown info option \"$method\"; [.info info]" } # @@ -392,7 +392,7 @@ ::xotcl::@ method unknown args {} proc ::xotcl::myproc {args} {linsert $args 0 [::xotcl::self]} -proc ::xotcl::myvar {var} {::xotcl::my requireNamespace; return [::xotcl::self]::$var} +proc ::xotcl::myvar {var} {.requireNamespace; return [::xotcl::self]::$var} namespace eval ::xotcl { namespace export Object Class @ myproc myvar Attribute @@ -550,15 +550,15 @@ ::xotcl::alias ::xotcl::Slot assign ::xotcl::setinstvar ::xotcl::Slot method add {obj prop value {pos 0}} { - if {![::xotcl::my multivalued]} { - error "Property $prop of [::xotcl::my domain]->$obj ist not multivalued" + if {![set .multivalued]} { + error "Property $prop of [set .domain]->$obj ist not multivalued" } if {[$obj exists $prop]} { $obj set $prop [linsert [$obj set $prop] $pos $value] } else { $obj set $prop [list $value] } - #[::xotcl::my domain] invalidateobjectparameter ;# TODO maybe not needed here + #[set .domain] invalidateobjectparameter ;# TODO maybe not needed here } ::xotcl::Slot method delete {-nocomplain:switch obj prop value} { set old [$obj set $prop] @@ -570,7 +570,7 @@ ::xotcl::Slot method unknown {method args} { set methods [list] - foreach m [::xotcl::my info methods] { + foreach m [.info methods] { if {[::xotcl::Object info methods $m] ne ""} continue if {[string match __* $m]} continue lappend methods $m @@ -579,27 +579,23 @@ } ::xotcl::Slot method destroy {} { - ::xotcl::instvar domain - if {$domain ne ""} { - $domain invalidateobjectparameter + if {${.domain} ne ""} { + ${.domain} invalidateobjectparameter } next } ::xotcl::Slot method init {} { - ::xotcl::instvar name domain manager per-object - #puts stderr "slot init [self] exists name? [info exists name] '$name'" - set forwarder [expr {${per-object} ? "forward" : "instforward"}] - #puts "domain=$domain /[::xotcl::self callingobject]/[::xotcl::my info parent]" - if {$domain eq ""} { - set domain [::xotcl::self callingobject] + set forwarder [expr {${.per-object} ? "forward" : "instforward"}] + if {${.domain} eq ""} { + set .domain [::xotcl::self callingobject] } else { #todo could be done via slotoptimizer - #puts stderr "Slot [self] (name $name) init $domain calls invalidateobjectparameter" - $domain invalidateobjectparameter + #puts stderr "Slot [self] (name ${.name}) init ${.domain} calls invalidateobjectparameter" + ${.domain} invalidateobjectparameter } - #puts stderr "???? $domain $forwarder $name -default [$manager defaultmethods] $manager %1 %self %proc" - $domain $forwarder $name -default [$manager defaultmethods] $manager %1 %self %proc + #puts stderr "???? ${.domain} $forwarder ${.name} -default [${.manager} defaultmethods] ${.manager} %1 %self %proc" + ${.domain} $forwarder ${.name} -default [${.manager} defaultmethods] ${.manager} %1 %self %proc } # @@ -613,29 +609,29 @@ ::xotcl::relation ::xotcl::InfoSlot superclass ::xotcl::Slot ::xotcl::InfoSlot method get {obj prop} {$obj info $prop} ::xotcl::InfoSlot method add {obj prop value {pos 0}} { - if {![::xotcl::my multivalued]} { - error "Property $prop of [::xotcl::my domain]->$obj ist not multivalued" + if {![set .multivalued]} { + error "Property $prop of ${.domain}->$obj ist not multivalued" } $obj $prop [linsert [$obj info $prop] $pos $value] } ::xotcl::InfoSlot method delete {-nocomplain:switch obj prop value} { set old [$obj info $prop] if {[string first * $value] > -1 || [string first \[ $value] > -1} { # string contains meta characters - if {[my elementtype] ne "" && ![string match ::* $value]} { + if {${.elementtype} ne "" && ![string match ::* $value]} { # prefix string with ::, since all object names have leading :: set value ::$value } return [$obj $prop [lsearch -all -not -glob -inline $old $value]] - } elseif {[my elementtype] ne ""} { + } elseif {${.elementtype} ne ""} { if {[string first :: $value] == -1} { if {![::xotcl::is $value object]} { error "$value does not appear to be an object" } set value [$value self] } - if {![::xotcl::is [my elementtype] class]} { - error "$value does not appear to be of type [my elementtype]" + if {![::xotcl::is ${.elementtype} class]} { + error "$value does not appear to be of type ${.elementtype}" } } set p [lsearch -exact $old $value] @@ -656,8 +652,8 @@ ::xotcl::alias ::xotcl::InterceptorSlot assign ::xotcl::relation ::xotcl::InterceptorSlot method add {obj prop value {pos 0}} { - if {![::xotcl::my multivalued]} { - error "Property $prop of [::xotcl::my domain]->$obj ist not multivalued" + if {![set .multivalued]} { + error "Property $prop of ${.domain}->$obj ist not multivalued" } $obj $prop [linsert [$obj info $prop -guards] $pos $value] } @@ -730,57 +726,54 @@ ::xotcl::Attribute method check_multiple_values {values predicate type obj var} { foreach value $values { - ::xotcl::my check_single_value -keep_old_value false $value $predicate $type $obj $var + .check_single_value -keep_old_value false $value $predicate $type $obj $var } $obj set __oldvalue($var) $value } ::xotcl::Attribute method mk_type_checker {} { set __initcmd "" - if {[::xotcl::my exists type]} { - ::xotcl::my instvar type name - if {[::xotcl::is $type class]} { + if {[.exists type]} { + if {[::xotcl::is ${.type} class]} { set predicate [subst -nocommands { - [::xotcl::is \$value object] && [::xotcl::is \$value type $type] + [::xotcl::is \$value object] && [::xotcl::is \$value type ${.type}] }] - } elseif {[llength $type]>1} { - set predicate "\[$type \$value\]" + } elseif {[llength ${.type}]>1} { + set predicate "\[${.type} \$value\]" } else { - #set predicate "\[string is $type \$value\]" - set predicate "\[[self] type=$type $name \$value\]" + #set predicate "\[string is ${.type} \$value\]" + set predicate "\[.type=${.type} ${.name} \$value\]" } #puts stderr predicate=$predicate - ::xotcl::my append valuechangedcmd [subst { - ::xotcl::my [expr {[::xotcl::my multivalued] ? - "check_multiple_values" : "check_single_value" - }] \[\$obj set $name\] \ - {$predicate} [list $type] \$obj $name + append .valuechangedcmd [subst { + [expr {${.multivalued} ? ".check_multiple_values" : ".check_single_value" + }] \[\$obj set ${.name}\] \ + {$predicate} [list ${.type}] \$obj ${.name} }] append __initcmd [subst -nocommands { - if {[::xotcl::my exists $name]} {::xotcl::my set __oldvalue($name) [::xotcl::my set $name]}\n + if {[.exists ${.name}]} {set .__oldvalue(${.name}) [set .${.name}]}\n }] } return $__initcmd } ::xotcl::Attribute method init {} { - ::xotcl::my instvar domain name next ;# do first ordinary slot initialization # there might be already default values registered on the class set __initcmd "" - if {[::xotcl::my exists default]} { - } elseif [::xotcl::my exists initcmd] { - append __initcmd "::xotcl::my trace add variable [list $name] read \ - \[list [::xotcl::self] __default_from_cmd \[::xotcl::self\] [list [::xotcl::my initcmd]]\]\n" - } elseif [::xotcl::my exists valuecmd] { - append __initcmd "::xotcl::my trace add variable [list $name] read \ - \[list [::xotcl::self] __value_from_cmd \[::xotcl::self\] [list [::xotcl::my valuecmd]]\]" + if {[.exists default]} { + } elseif [.exists initcmd] { + append __initcmd ".trace add variable [list ${.name}] read \ + \[list [::xotcl::self] __default_from_cmd \[::xotcl::self\] [list [set .initcmd]]\]\n" + } elseif [.exists valuecmd] { + append __initcmd ".trace add variable [list ${.name}] read \ + \[list [::xotcl::self] __value_from_cmd \[::xotcl::self\] [list [set .valuecmd]]\]" } - #append __initcmd [::xotcl::my mk_type_checker] - if {[::xotcl::my exists valuechangedcmd]} { - append __initcmd "::xotcl::my trace add variable [list $name] write \ - \[list [::xotcl::self] __value_changed_cmd \[::xotcl::self\] [list [::xotcl::my valuechangedcmd]]\]" + #append __initcmd [.mk_type_checker] + if {[.exists valuechangedcmd]} { + append __initcmd ".trace add variable [list ${.name}] write \ + \[list [::xotcl::self] __value_changed_cmd \[::xotcl::self\] [list [set .valuechangedcmd]]\]" } if {$__initcmd ne ""} { - my set initcmd $__initcmd + set .initcmd $__initcmd } } @@ -789,19 +782,19 @@ -method check_single_value args {;} -method check_multiple_values args {;} \ -method mk_type_checker args {return ""} ::xotcl::Class create ::xotcl::Slot::Optimizer \ - -method proc args {::xotcl::next; ::xotcl::my optimize} \ - -method forward args {::xotcl::next; ::xotcl::my optimize} \ - -method init args {::xotcl::next; ::xotcl::my optimize} \ + -method proc args {::xotcl::next; .optimize} \ + -method forward args {::xotcl::next; .optimize} \ + -method init args {::xotcl::next; .optimize} \ -method optimize {} { - #puts stderr "slot optimizer for [::xotcl::my domain] calls invalidateobjectparameter" - #[::xotcl::my domain] invalidateobjectparameter - if {[::xotcl::my multivalued]} return - if {[::xotcl::my defaultmethods] ne {get assign}} return - if {[::xotcl::my procsearch assign] ne "::xotcl::Slot instcmd assign"} return - if {[::xotcl::my procsearch get] ne "::xotcl::Slot instcmd get"} return - set forwarder [expr {[::xotcl::my per-object] ? "parametercmd":"instparametercmd"}] - #puts stderr "**** optimizing [::xotcl::my domain] $forwarder [::xotcl::my name]" - [::xotcl::my domain] $forwarder [::xotcl::my name] + #puts stderr "slot optimizer for ${.domain} calls invalidateobjectparameter" + #${.domain} invalidateobjectparameter + if {[set .multivalued]} return + if {[set .defaultmethods] ne {get assign}} return + if {[.procsearch assign] ne "::xotcl::Slot instcmd assign"} return + if {[.procsearch get] ne "::xotcl::Slot instcmd get"} return + set forwarder [expr {[set .per-object] ? "parametercmd":"instparametercmd"}] + #puts stderr "**** optimizing ${.domain} $forwarder ${.name}" + ${.domain} $forwarder ${.name} } # register the optimizer per default ::xotcl::Attribute instmixin add ::xotcl::Slot::Optimizer @@ -818,7 +811,7 @@ } ::xotcl::ScopedNew method init {} { - ::xotcl::my method new {-childof args} { + .method new {-childof args} { [::xotcl::self class] instvar {inobject object} withclass if {![::xotcl::is $object object]} { $withclass create $object @@ -851,7 +844,7 @@ } } ::xotcl::Class instforward slots %self contains \ - -object {%::xotcl::my subst [::xotcl::self]::slot} + -object {%::xotcl::dispatch [::xotcl::self] -objscope ::subst [::xotcl::self]::slot} # # define parameter for backward compatibility and convenience @@ -924,7 +917,7 @@ $po unset -nocomplain $instvar } } else { - ::xotcl::my instparametercmd $name + .instparametercmd $name } } } @@ -946,7 +939,7 @@ } ::xotcl::Class method allinstances {} { # TODO: mark it deprecated - return [::xotcl::my info instances -closure] + return [.info instances -closure] } # reuse definitions from xotcl in xotcl2 @@ -981,7 +974,7 @@ error "invalid method type '$methtype', \ must be either 'proc', 'instproc' or 'method'." } - ::xotcl::my $methtype $methname $arglist " + .$methtype $methname $arglist " if {!\[::xotcl::self isnextcall\]} { error \"Abstract method $methname $arglist called\" } else {::xotcl::next} @@ -999,7 +992,7 @@ # targets are all namspaces and objs part-of the copied obj ::xotcl::Object::CopyHandler method makeTargetList t { - ::xotcl::my lappend targetList $t + lappend .targetList $t # if it is an object without namespace, it is a leaf if {[::xotcl::is $t object]} { if {[$t info hasnamespace]} { @@ -1021,7 +1014,7 @@ # a namespace or an obj with namespace may have children # itself foreach c $children { - ::xotcl::my makeTargetList $c + .makeTargetList $c } } @@ -1032,14 +1025,14 @@ # construct destination obj name from old qualified ns name ::xotcl::Object::CopyHandler method getDest origin { - set tail [string range $origin [::xotcl::my set objLength] end] - return ::[string trimleft [::xotcl::my set dest]$tail :] + set tail [string range $origin [set .objLength] end] + return ::[string trimleft [set .dest]$tail :] } ::xotcl::Object::CopyHandler method copyTargets {} { - #puts stderr "COPY will copy targetList = [::xotcl::my set targetList]" - foreach origin [::xotcl::my set targetList] { - set dest [::xotcl::my getDest $origin] + #puts stderr "COPY will copy targetList = [set .targetList]" + foreach origin [set .targetList] { + set dest [.getDest $origin] if {[::xotcl::is $origin object]} { # copy class information if {[::xotcl::is $origin class]} { @@ -1050,7 +1043,7 @@ $cl instinvar [$origin info instinvar] $cl instfilter [$origin info instfilter -guards] $cl instmixin [$origin info instmixin] - my copyNSVarsAndCmds ::xotcl::classes$origin ::xotcl::classes$dest + .copyNSVarsAndCmds ::xotcl::classes$origin ::xotcl::classes$dest } else { # create obj set obj [[$origin info class] create $dest -noinit] @@ -1066,7 +1059,7 @@ } else { namespace eval $dest {} } - ::xotcl::my copyNSVarsAndCmds $origin $dest + .copyNSVarsAndCmds $origin $dest foreach i [$origin info forward] { eval [concat $dest forward $i [$origin info forward -definition $i]] } @@ -1092,9 +1085,9 @@ #puts stderr "=====" } # alter 'domain' and 'manager' in slot objects for classes - foreach origin [::xotcl::my set targetList] { + foreach origin [set .targetList] { if {[::xotcl::is $origin class]} { - set dest [::xotcl::my getDest $origin] + set dest [.getDest $origin] foreach oldslot [$origin info slots] { set newslot ${dest}::slot::[namespace tail $oldslot] if {[$oldslot domain] eq $origin} {$newslot domain $cl} @@ -1106,16 +1099,12 @@ ::xotcl::Object::CopyHandler method copy {obj dest} { #puts stderr "[::xotcl::self] copy <$obj> <$dest>" - ::xotcl::my set objLength [string length $obj] - ::xotcl::my set dest $dest - ::xotcl::my makeTargetList $obj - ::xotcl::my copyTargets + set .objLength [string length $obj] + set .dest $dest + .makeTargetList $obj + .copyTargets } -#Class create ::xotcl::NoInit -#::xotcl::NoInit method init args {;} - - ::xotcl::Object method copy newName { if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} { [[::xotcl::self class]::CopyHandler new -volatile] copy [::xotcl::self] $newName @@ -1125,19 +1114,19 @@ ::xotcl::Object method move newName { if {[string trimleft $newName :] ne [string trimleft [::xotcl::self] :]} { if {$newName ne ""} { - ::xotcl::my copy $newName + .copy $newName } ### let all subclasses get the copied class as superclass if {[::xotcl::is [::xotcl::self] class] && $newName ne ""} { - foreach subclass [::xotcl::my info subclass] { + foreach subclass [.info subclass] { set scl [$subclass info superclass] if {[set index [lsearch -exact $scl [::xotcl::self]]] != -1} { set scl [lreplace $scl $index $index $newName] $subclass superclass $scl } } } - ::xotcl::my destroy + .destroy } } @@ -1279,26 +1268,26 @@ next } ::xotcl::package method -per-object extend {name args} { - my require $name + .require $name eval $name configure $args } ::xotcl::package method -per-object contains script { - if {[my exists provide]} { - package provide [my provide] [my version] + if {[.exists provide]} { + package provide [set .provide] [set .version] } else { - package provide [::xotcl::self] [::xotcl::my version] + package provide [::xotcl::self] [set .version] } namespace eval [::xotcl::self] {namespace import ::xotcl::*} namespace eval [::xotcl::self] $script - foreach e [my export] { + foreach e [set .export] { set nq [namespace qualifiers $e] if {$nq ne ""} { namespace eval [::xotcl::self]::$nq [list namespace export [namespace tail $e]] } else { namespace eval [::xotcl::self] [list namespace export $e] } } - foreach e [my autoexport] { + foreach e [set .autoexport] { namespace eval :: [list namespace import [::xotcl::self]::$e] } } @@ -1309,29 +1298,28 @@ ::xotcl::package method -per-object unknown args { #puts stderr "unknown: package $args" - eval [my set packagecmd] $args + eval [set .packagecmd] $args } ::xotcl::package method -per-object verbose value { - my set verbose $value + set .verbose $value } ::xotcl::package method -per-object present args { if {$::tcl_version<8.3} { - my instvar loaded switch -exact -- [lindex $args 0] { -exact {set pkg [lindex $args 1]} default {set pkg [lindex $args 0]} } - if {[info exists loaded($pkg)]} { - return $loaded($pkg) + if {[info exists .loaded($pkg)]} { + return ${.loaded}($pkg) } else { error "not found" } } else { - eval [my set packagecmd] present $args + eval [set .packagecmd] present $args } } ::xotcl::package method -per-object import {{-into ::} pkg} { - my require $pkg + .require $pkg namespace eval $into [subst -nocommands { #puts stderr "*** package import ${pkg}::* into [namespace current]" namespace import ${pkg}::* @@ -1344,26 +1332,25 @@ } } } -::xotcl::package method -per-object require args { +::xotcl::package method -per-object require args { #puts "XOTCL package require $args, current=[namespace current]" - ::xotcl::my instvar component verbose uses loaded - set prevComponent $component + set prevComponent ${.component} if {[catch {set v [eval package present $args]} msg]} { #puts stderr "we have to load $msg" switch -exact -- [lindex $args 0] { -exact {set pkg [lindex $args 1]} default {set pkg [lindex $args 0]} } - set component $pkg - lappend uses($prevComponent) $component - set v [uplevel \#1 [my set packagecmd] require $args] - if {$v ne "" && $verbose} { + set .component $pkg + lappend .uses($prevComponent) ${.component} + set v [uplevel \#1 [set .packagecmd] require $args] + if {$v ne "" && ${.verbose}} { set path [lindex [::package ifneeded $pkg $v] 1] puts "... $pkg $v loaded from '$path'" - set loaded($pkg) $v ;# loaded stuff needed for Tcl 8.0 + set .loaded($pkg) $v ;# loaded stuff needed for Tcl 8.0 } } - set component $prevComponent + set .component $prevComponent return $v } Index: generic/xotcl.c =================================================================== diff -u -r79475c4a626408498480a5aa4fff1c35b7dcbe1f -r555e7f84db642cb7f4d77c8a5189922e1287b3d4 --- generic/xotcl.c (.../xotcl.c) (revision 79475c4a626408498480a5aa4fff1c35b7dcbe1f) +++ generic/xotcl.c (.../xotcl.c) (revision 555e7f84db642cb7f4d77c8a5189922e1287b3d4) @@ -1577,29 +1577,50 @@ char buffer[64]; /* for now */ } xotclResolvedVarInfo; +static void +HashVarFree(Tcl_Var var) { + /*fprintf(stderr,"#### refcount %d\n", VarHashRefCount(var));*/ + if (VarHashRefCount(var) == 1) { + /*fprintf(stderr,"#### free %p\n", var);*/ + ckfree((char *) var); + } else { + VarHashRefCount(var)--; + } +} + static Tcl_Var CompiledDotVarFetch(Tcl_Interp *interp, Tcl_ResolvedVarInfo *vinfoPtr) { xotclResolvedVarInfo *resVarInfo = (xotclResolvedVarInfo *)vinfoPtr; XOTclCallStackContent *cscPtr = CallStackGetFrame(interp, NULL); XOTclObject *obj = cscPtr ? cscPtr->self : NULL; TclVarHashTable *varTablePtr; - Tcl_Var var; - int new; + Tcl_Var var = resVarInfo->var; + int new, flags = var ? ((Var*)var)->flags : 0; + /*fprintf(stderr,"CompiledDotVarFetch var '%s' var %p flags = %.4x dead? %.4x\n", + ObjStr(resVarInfo->nameObj), var, flags, flags&VAR_DEAD_HASH);*/ + /* * We cache lookups based on obj; we have to care about cases, where * variables are deleted in recreates or on single deletes. In these * cases, the var flags are reset. */ - if (obj == resVarInfo->lastObj && ((Var*)(resVarInfo->var))->flags & VAR_IN_HASHTABLE) { + if (obj == resVarInfo->lastObj && ((flags & VAR_DEAD_HASH)) == 0) { #if defined(VAR_RESOLVER_TRACE) - Var *v = (Var*)(resVarInfo->var); - fprintf(stderr,".... cached var flags = %.6x\n",v->flags); + fprintf(stderr,".... cached var '%s' var %p flags = %.4x\n",ObjStr(resVarInfo->nameObj), var, flags); #endif - return resVarInfo->var; + return var; } + if (var) { + /* + * we have already a variable, which is not valid anymore. clean + * it up. + */ + HashVarFree(var); + } + varTablePtr = obj->nsPtr ? Tcl_Namespace_varTable(obj->nsPtr) : obj->varTable; if (varTablePtr == NULL && obj->varTable == NULL) { /* @@ -1614,11 +1635,18 @@ resVarInfo->buffer, obj, obj->nsPtr, varTablePtr); */ resVarInfo->lastObj = obj; resVarInfo->var = var = (Tcl_Var) VarHashCreateVar(varTablePtr, resVarInfo->nameObj, &new); + /* + * Increment the reference counter to avoid ckfree() of the variable + * in Tcl's FreeVarEntry(); for cleanup, we provide our own + * HashVarFree(); + */ + VarHashRefCount(var)++; #if defined(VAR_RESOLVER_TRACE) { Var *v = (Var*)(resVarInfo->var); - fprintf(stderr,".... looked up var %s flags = %.6x\n",resVarInfo->buffer, v->flags); + fprintf(stderr,".... looked up var %s (%s) var %p flags = %.6x\n",resVarInfo->buffer, ObjStr(resVarInfo->nameObj), + v, v->flags); } #endif return var; @@ -1627,6 +1655,7 @@ void CompiledDotVarFree(Tcl_ResolvedVarInfo *vinfoPtr) { xotclResolvedVarInfo *resVarInfo = (xotclResolvedVarInfo *)vinfoPtr; DECR_REF_COUNT(resVarInfo->nameObj); + if (resVarInfo->var) {HashVarFree(resVarInfo->var);} ckfree((char *) vinfoPtr); } @@ -1691,7 +1720,7 @@ } #if defined(VAR_RESOLVER_TRACE) - fprintf(stderr, "dotVarResolver called var=%s flags %.8x\n", varName, flags); + fprintf(stderr, "dotVarResolver called var=%s flags %.4x\n", varName, flags); #endif varName ++; varFramePtr = Tcl_Interp_varFramePtr(interp); @@ -1804,17 +1833,18 @@ for (hPtr = Tcl_FirstHashEntry(cmdTable, &hSrch); hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { Tcl_Command cmd = (Tcl_Command)Tcl_GetHashValue(hPtr); + if (!Tcl_Command_cmdEpoch(cmd)) { char *oname = Tcl_GetHashKey(cmdTable, hPtr); Tcl_DString name; XOTclObject *obj; - /* fprintf(stderr, " ... child %s\n", oname); */ + /*fprintf(stderr, " ... child %s\n", oname);*/ ALLOC_NAME_NS(&name, ns->fullName, oname); obj = XOTclpGetObject(interp, Tcl_DStringValue(&name)); if (obj) { - /*fprintf(stderr, " ... obj=%s flags %.6x\n", objectName(obj), obj->flags);*/ + /*fprintf(stderr, " ... obj=%s flags %.4x\n", objectName(obj), obj->flags);*/ /* in the exit handler physical destroy --> directly call destroy */ if (RUNTIME_STATE(interp)->exitHandlerDestroyRound @@ -1894,12 +1924,12 @@ /* * cmd is an aliased object, reduce the refcount */ + /*fprintf(stderr, "NSCleanupNamespace cleanup aliased object %p\n",invokeObj);*/ XOTclCleanupObject(invokeObj); } - + /*fprintf(stderr, "NSCleanupNamespace deleting %s %p\n", Tcl_Command_nsPtr(cmd)->fullName, cmd);*/ - XOTcl_DeleteCommandFromToken(interp, cmd); } }