# ACTIVESTATE TEAPOT-PKG BEGIN TM -*- tcl -*- # -- Tcl Module # @@ Meta Begin # Package lassign84 1 # Meta as::build::date 2012-10-11 # Meta platform tcl # Meta require {Tcl 8.4} # @@ Meta End # ACTIVESTATE TEAPOT-PKG BEGIN REQUIREMENTS package require Tcl 8.4 # ACTIVESTATE TEAPOT-PKG END REQUIREMENTS # ACTIVESTATE TEAPOT-PKG BEGIN DECLARE package provide lassign84 1 # ACTIVESTATE TEAPOT-PKG END DECLARE # ACTIVESTATE TEAPOT-PKG END TM ## -*- tcl -*- # # ## ### ##### ######## ############# ##################### # Lassign. Forward compatibility support. # I.e. code implementing a number of commands for 8.4 which are # otherwise only defined in 8.5+ # # ## ### ##### ######## ############# ##################### ## Requirements. package require Tcl 8.4 ; # Minimum supported version. package provide lassign84 1 ; # What we export. # # ## ### ##### ######## ############# ##################### ## I. Make sure that the Tcl interpreter has a 'lassign' command. # Bail out if we are in an environment which already provides the # command. if {[llength [info commands ::lassign]]} return # Command is missing, provide our emulation. proc lassign {valueList args} { if {[llength $args] == 0} { return -code error "wrong # args: lassign list varname ?varname..?" } uplevel 1 [list foreach $args $valueList {break}] return [lrange $valueList [llength $args] end] } ## # # ## ### ##### ######## ############# ##################### ## Ready return