diff options
author | dgp <dgp@users.sourceforge.net> | 2013-01-30 17:58:00 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-01-30 17:58:00 (GMT) |
commit | f26510438d420ec20e8840063ca9c3cc8989663e (patch) | |
tree | 7a5a21328d26afb61961c84fae455f653161f18a /library/auto.tcl | |
parent | a528a204f2cedc505d1d28610ecf975740f12fcd (diff) | |
parent | 3475ea5378a063cc71bc3c0e35ae338c31d0426f (diff) | |
download | tcl-f26510438d420ec20e8840063ca9c3cc8989663e.zip tcl-f26510438d420ec20e8840063ca9c3cc8989663e.tar.gz tcl-f26510438d420ec20e8840063ca9c3cc8989663e.tar.bz2 |
In the script library, selected modernizations from Patrick Fradin.
Diffstat (limited to 'library/auto.tcl')
-rw-r--r-- | library/auto.tcl | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/library/auto.tcl b/library/auto.tcl index 4bd860d..e86257e 100644 --- a/library/auto.tcl +++ b/library/auto.tcl @@ -20,8 +20,9 @@ # None. proc auto_reset {} { - if {[array exists ::auto_index]} { - foreach cmdName [array names ::auto_index] { + global auto_execs auto_index auto_path + if {[array exists auto_index]} { + foreach cmdName [array names auto_index] { set fqcn [namespace which $cmdName] if {$fqcn eq ""} { continue @@ -29,11 +30,11 @@ proc auto_reset {} { rename $fqcn {} } } - unset -nocomplain ::auto_execs ::auto_index ::tcl::auto_oldpath - if {[catch {llength $::auto_path}]} { - set ::auto_path [list [info library]] - } elseif {[info library] ni $::auto_path} { - lappend ::auto_path [info library] + unset -nocomplain auto_execs auto_index ::tcl::auto_oldpath + if {[catch {llength $auto_path}]} { + set auto_path [list [info library]] + } elseif {[info library] ni $auto_path} { + lappend auto_path [info library] } } @@ -53,7 +54,7 @@ proc auto_reset {} { proc tcl_findLibrary {basename version patch initScript enVarName varName} { upvar #0 $varName the_library - global env + global auto_path env tcl_platform set dirs {} set errors {} @@ -83,12 +84,10 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} { # 3. Relative to auto_path directories. This checks relative to the # Tcl library as well as allowing loading of libraries added to the # auto_path that is not relative to the core library or binary paths. - foreach d $::auto_path { + foreach d $auto_path { lappend dirs [file join $d $basename$version] - if { - $::tcl_platform(platform) eq "unix" - && $::tcl_platform(os) eq "Darwin" - } then { + if {$tcl_platform(platform) eq "unix" + && $tcl_platform(os) eq "Darwin"} { # 4. On MacOSX, check the Resources/Scripts subdir too lappend dirs [file join $d $basename$version Resources Scripts] } |