diff options
author | dgp <dgp@users.sourceforge.net> | 2013-01-30 18:58:37 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-01-30 18:58:37 (GMT) |
commit | 3ac002a666fce71f19f025288d9e18c0819bb91a (patch) | |
tree | 0bf3ad72dc599167e49c1f6917fd1fb260a7749e /library/package.tcl | |
parent | 3475ea5378a063cc71bc3c0e35ae338c31d0426f (diff) | |
download | tcl-3ac002a666fce71f19f025288d9e18c0819bb91a.zip tcl-3ac002a666fce71f19f025288d9e18c0819bb91a.tar.gz tcl-3ac002a666fce71f19f025288d9e18c0819bb91a.tar.bz2 |
For [package] etc., select modernizations from Patrick Fradin.
Diffstat (limited to 'library/package.tcl')
-rw-r--r-- | library/package.tcl | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/library/package.tcl b/library/package.tcl index 3831822..06f619c 100644 --- a/library/package.tcl +++ b/library/package.tcl @@ -389,9 +389,7 @@ proc pkg_mkIndex {args} { foreach pkg [lsort [array names files]] { set cmd {} - foreach {name version} $pkg { - break - } + lassign $pkg name version lappend cmd ::tcl::Pkg::Create -name $name -version $version foreach spec [lsort -index 0 $files($pkg)] { foreach {file type procs} $spec { @@ -544,8 +542,7 @@ proc tclPkgUnknown {name args} { # $use_path. Don't add directories we've already seen, or ones # already on the $use_path. foreach dir [lrange $auto_path $index end] { - if {![info exists tclSeenPath($dir)] - && ([lsearch -exact $use_path $dir] == -1) } { + if {![info exists tclSeenPath($dir)] && ($dir ni $use_path)} { lappend use_path $dir } } @@ -632,8 +629,7 @@ proc tcl::MacOSXPkgUnknown {original name args} { # $use_path. Don't add directories we've already seen, or ones # already on the $use_path. foreach dir [lrange $auto_path $index end] { - if {![info exists tclSeenPath($dir)] - && ([lsearch -exact $use_path $dir] == -1) } { + if {![info exists tclSeenPath($dir)] && ($dir ni $use_path)} { lappend use_path $dir } } @@ -685,10 +681,7 @@ proc ::tcl::Pkg::Create {args} { } # Initialize parameters - set opts(-name) {} - set opts(-version) {} - set opts(-source) {} - set opts(-load) {} + array set opts {-name {} -version {} -source {} -load {}} # process parameters for {set i 0} {$i < $len} {incr i} { @@ -736,12 +729,7 @@ proc ::tcl::Pkg::Create {args} { # Handle -load and -source specs foreach key {load source} { foreach filespec $opts(-$key) { - foreach {filename proclist} {{} {}} { - break - } - foreach {filename proclist} $filespec { - break - } + lassign $filespec filename proclist if { [llength $proclist] == 0 } { set cmd "\[list $key \[file join \$dir [list $filename]\]\]" |