From 3910fc59f08f55b33bbfee6ca8a7fa489019f677 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 4 Mar 2024 12:48:28 +0000 Subject: Code cleanup in init.tcl, 'stolen' from sebres-?-?-clock-speedup-cr2. No change in functionality --- library/init.tcl | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/library/init.tcl b/library/init.tcl index 1a51294..e57c5ce 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -6,7 +6,9 @@ # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 Scriptics Corporation. -# Copyright (c) 2004 Kevin B. Kenny. All rights reserved. +# Copyright (c) 2004 Kevin B. Kenny. +# +# All rights reserved. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -49,6 +51,7 @@ if {![info exists auto_path]} { set auto_path "" } } + namespace eval tcl { if {![interp issafe]} { variable Dir @@ -423,16 +426,20 @@ proc unknown args { proc auto_load {cmd {namespace {}}} { global auto_index auto_path + # qualify names: if {$namespace eq ""} { set namespace [uplevel 1 [list ::namespace current]] } set nameList [auto_qualify $cmd $namespace] # workaround non canonical auto_index entries that might be around # from older auto_mkindex versions - lappend nameList $cmd - foreach name $nameList { + if {$cmd ni $nameList} {lappend nameList $cmd} + + # try to load (and create sub-cmd handler "_sub_load_cmd" for further usage): + foreach name $nameList [set _sub_load_cmd { + # via auto_index: if {[info exists auto_index($name)]} { - namespace eval :: $auto_index($name) + namespace inscope :: $auto_index($name) # There's a couple of ways to look for a command of a given # name. One is to use # info commands $name @@ -444,22 +451,19 @@ proc auto_load {cmd {namespace {}}} { return 1 } } - } + }] + + # load auto_index if possible: if {![info exists auto_path]} { return 0 } - if {![auto_load_index]} { return 0 } - foreach name $nameList { - if {[info exists auto_index($name)]} { - namespace eval :: $auto_index($name) - if {[namespace which -command $name] ne ""} { - return 1 - } - } - } + + # try again (something new could be loaded): + foreach name $nameList $_sub_load_cmd + return 0 } @@ -610,7 +614,7 @@ proc auto_import {pattern} { foreach name [array names auto_index $pattern] { if {([namespace which -command $name] eq "") && ([namespace qualifiers $pattern] eq [namespace qualifiers $name])} { - namespace eval :: $auto_index($name) + namespace inscope :: $auto_index($name) } } } @@ -673,17 +677,14 @@ proc auto_execok name { return "" } - set path "[file dirname [info nameof]];.;" + set path "[file dirname [info nameofexecutable]];.;" if {[info exists env(SystemRoot)]} { set windir $env(SystemRoot) } elseif {[info exists env(WINDIR)]} { set windir $env(WINDIR) } if {[info exists windir]} { - if {$tcl_platform(os) eq "Windows NT"} { - append path "$windir/system32;" - } - append path "$windir/system;$windir;" + append path "$windir/system32;$windir/system;$windir;" } foreach var {PATH Path path} { -- cgit v0.12 From 140c60456401d8ff840bc670f84b0d072cddd80f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 4 Mar 2024 15:47:31 +0000 Subject: Add akst/akdt (Alaska) time-zones to "clock" command. Also 'stolen' from "sebres-?-?-clock-speedup-cr2" branch --- library/clock.tcl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/clock.tcl b/library/clock.tcl index b9bbc2c..e578f4d 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -31,7 +31,7 @@ uplevel \#0 { # library code can find message catalogs and time zone definition files. namespace eval ::tcl::clock \ - [list variable LibDir [file dirname [info script]]] + [list variable LibDir [info library]] #---------------------------------------------------------------------- # @@ -554,6 +554,8 @@ proc ::tcl::clock::Initialize {} { pdt -0700 \ yst -0900 \ ydt -0800 \ + akst -0900 \ + akdt -0800 \ hst -1000 \ hdt -0900 \ cat -1000 \ -- cgit v0.12