Index: xotcl/library/lib/upvarcompat.xotcl =================================================================== diff -u -rf7894d9be99a8da3a04218abcdb9bd46b6d625c8 -r435b41481fb51bf000ebe736d8574fefbeec1710 --- xotcl/library/lib/upvarcompat.xotcl (.../upvarcompat.xotcl) (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) +++ xotcl/library/lib/upvarcompat.xotcl (.../upvarcompat.xotcl) (revision 435b41481fb51bf000ebe736d8574fefbeec1710) @@ -1,35 +1,42 @@ -#$Id: upvarcompat.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +#$Id: upvarcompat.xotcl,v 1.2 2005/09/09 21:07:23 neumann Exp $ + package provide xotcl::upvar-compat 1.0 +package require XOTcl -@ @File {description { - Provide a version of upvar and uplevel that provide - backward compatibility such that these commands - ignore inactive filter and mixin frames (upvar behaves - the same whether or not a filter is installed). Newer - scripts should use <@TT>upvar/uplevel [self callinglevel] var/command - instead. -} } +namespace eval ::xotcl::upvar-compat { + namespace import ::xotcl::* + @ @File {description { + Provide a version of upvar and uplevel that provide + backward compatibility such that these commands + ignore inactive filter and mixin frames (upvar behaves + the same whether or not a filter is installed). Newer + scripts should use <@TT>upvar/uplevel [self callinglevel] var/command + instead. + } } +} + # Define upvar and uplevel; use the level, if given explizitely: # otherwise point to the callinglevel from XOTcl -rename uplevel ::xotcl::tcl_uplevel -proc uplevel {lvl args} { - # the outer uplevel is needed to leave the scope of this proc - if {[regexp {^\#?[0-9]+$} $lvl]} { - ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_uplevel $lvl $args] - } else { - set cl [::xotcl::tcl_uplevel 1 ::xotcl::self callinglevel] - ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_uplevel $cl [list $lvl] $args] - } +rename ::uplevel ::xotcl::tcl_uplevel +proc ::uplevel {lvl args} { + # the outer uplevel is needed to leave the scope of this proc + if {[regexp {^\#?[0-9]+$} $lvl]} { + ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_uplevel $lvl $args] + } else { + set cl [::xotcl::tcl_uplevel 1 ::xotcl::self callinglevel] + ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_uplevel $cl [list $lvl] $args] + } } -rename upvar ::xotcl::tcl_upvar -proc upvar {lvl args} { - # the outer uplevel is needed to leave the scope of this proc - if {[regexp {^\#?[0-9]+$} $lvl]} { - ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_upvar $lvl $args] - } else { - set cl [::xotcl::tcl_uplevel 1 ::xotcl::self callinglevel] - ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_upvar $cl [list $lvl] $args] - } +rename ::upvar ::xotcl::tcl_upvar +proc ::upvar {lvl args} { + # the outer uplevel is needed to leave the scope of this proc + if {[regexp {^\#?[0-9]+$} $lvl]} { + ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_upvar $lvl $args] + } else { + set cl [::xotcl::tcl_uplevel 1 ::xotcl::self callinglevel] + ::xotcl::tcl_uplevel 1 [list eval ::xotcl::tcl_upvar $cl [list $lvl] $args] + } } +