diff options
author | dgp <dgp@users.sourceforge.net> | 2013-01-30 17:46:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-01-30 17:46:30 (GMT) |
commit | 3475ea5378a063cc71bc3c0e35ae338c31d0426f (patch) | |
tree | 2b6f271802dff517ab1ac014a845780edd5ee2d3 /library/auto.tcl | |
parent | 46d5769e5f4e9edd66b356958496b14cb9265f4e (diff) | |
download | tcl-3475ea5378a063cc71bc3c0e35ae338c31d0426f.zip tcl-3475ea5378a063cc71bc3c0e35ae338c31d0426f.tar.gz tcl-3475ea5378a063cc71bc3c0e35ae338c31d0426f.tar.bz2 |
In the script library, selected modernizations from Patrick Fradin.
Diffstat (limited to 'library/auto.tcl')
-rw-r--r-- | library/auto.tcl | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/library/auto.tcl b/library/auto.tcl index 55fc90f..b0fb61d 100644 --- a/library/auto.tcl +++ b/library/auto.tcl @@ -20,19 +20,20 @@ # 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} rename $fqcn {} } } - unset -nocomplain ::auto_execs ::auto_index ::tcl::auto_oldpath - if {[catch {llength $::auto_path}]} { - set ::auto_path [list [info library]] + unset -nocomplain auto_execs auto_index ::tcl::auto_oldpath + if {[catch {llength $auto_path}]} { + set auto_path [list [info library]] } else { - if {[info library] ni $::auto_path} { - lappend ::auto_path [info library] + if {[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 {} @@ -86,10 +87,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"} { + 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] } |