Index: ChangeLog =================================================================== diff -u -r7e095cf77bbf64283e4ee1cfaa6f8ebbbbafa348 -r83460374153c5fda6a3399ba671804a4337e04e3 --- ChangeLog (.../ChangeLog) (revision 7e095cf77bbf64283e4ee1cfaa6f8ebbbbafa348) +++ ChangeLog (.../ChangeLog) (revision 83460374153c5fda6a3399ba671804a4337e04e3) @@ -1,3 +1,7 @@ +2008-05-09 + * used catch in the deprecated package xotcl::upvar-compat + as suggested by Jeff Hobbs + 2008-03-18 * allowed "abstract method" in additon to "abstract instproc" and "abstract proc" Index: library/lib/upvarcompat.xotcl =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -r83460374153c5fda6a3399ba671804a4337e04e3 --- library/lib/upvarcompat.xotcl (.../upvarcompat.xotcl) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ library/lib/upvarcompat.xotcl (.../upvarcompat.xotcl) (revision 83460374153c5fda6a3399ba671804a4337e04e3) @@ -10,7 +10,7 @@ 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 + the same whether or not a filter is installed). Newer scripts should use <@TT>upvar/uplevel [self callinglevel] var/command instead. } } @@ -20,23 +20,33 @@ # 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] - } + set cl [::xotcl::tcl_uplevel 1 ::xotcl::self callinglevel] + if {[string match #* $cl]} { + # we were called from XOTcl, use the XOTcl method + set cmd [concat [list my uplevel $lvl] $args] + } else { + # no XOTcl in sight, use tcl variant + set cmd [concat [list ::xotcl::tcl_uplevel $lvl] $args] + } + #puts stderr cmd=$cmd + set code [catch [list ::xotcl::tcl_uplevel 1 $cmd] msg] + return -code $code $msg } 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] - } + set cl [::xotcl::tcl_uplevel 1 ::xotcl::self callinglevel] + if {[string match #* $cl]} { + # we were called from XOTcl, use the XOTcl method + set cmd [concat [list my upvar $lvl] $args] + #set code [catch {my uplevel $lvl $args} msg] + } else { + # no XOTcl in sight, use tcl variant + set cmd [concat [list ::xotcl::tcl_upvar $lvl] $args] + } + set code [catch [list ::xotcl::tcl_uplevel 1 $cmd] msg] + return -code $code $msg } +puts stderr HU +