Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | unbreak Win build after TIP#173 and TIP#209 commit |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
b01aea85244b63a3eb4a18aca4e19b46 |
| User & Date: | kennykb 2004-08-18 20:59:20.000 |
Context
|
2004-08-18
| ||
| 21:29 | silence compiler warning on systems without mktime check-in: 85982dc155 user: kennykb tags: trunk | |
| 20:59 | unbreak Win build after TIP#173 and TIP#209 commit check-in: b01aea8524 user: kennykb tags: trunk | |
| 19:58 | TIP #173 and #209 implementation - see ChangeLog for details check-in: 251b9c6eca user: kennykb tags: trunk | |
Changes
Changes to ChangeLog.
| ︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * tools/installData.tcl: (new file) * tools/loadICU.tcl: (new file) * tools/makeTestCases.tcl: (new file) * tools/tclZIC.tcl: (new file) * unix/Makefile.in: * unix/configure: (regenerated) * unix/tcl.m4: Implementation of TIPs #173 and #209. The [clock] command is now a Tcl ensemble, with most of its functionality written in Tcl and callouts to C code only to access low-level functions such as localtime, mktime and tzset. | > > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | * tools/installData.tcl: (new file) * tools/loadICU.tcl: (new file) * tools/makeTestCases.tcl: (new file) * tools/tclZIC.tcl: (new file) * unix/Makefile.in: * unix/configure: (regenerated) * unix/tcl.m4: * tests/clock.test (all): * win/Makefile.in: * win/Makefile.vc: Implementation of TIPs #173 and #209. The [clock] command is now a Tcl ensemble, with most of its functionality written in Tcl and callouts to C code only to access low-level functions such as localtime, mktime and tzset. |
| ︙ | ︙ |
Changes to library/clock.tcl.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | # #---------------------------------------------------------------------- # # Copyright (c) 2004 by 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. # | | | > > > > > > > > > > > > > > > > > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
#
#----------------------------------------------------------------------
#
# Copyright (c) 2004 by 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.
#
# RCS: @(#) $Id: clock.tcl,v 1.2 2004/08/18 20:59:33 kennykb Exp $
#
#----------------------------------------------------------------------
# We must have message catalogs that support the root locale, and
# we need access to the Registry on Windows systems. We also need
# Tcl 8.5 dictionaries.
uplevel \#0 {
package require msgcat 1.4
if { $::tcl_platform(platform) eq {windows} } {
if { [catch { package require registry 1.1 }] } {
# HIDEOUS KLUDGE: [package require registry 1.1] has failed.
# This failure likely means that we're running in Tcl's build
# directory instead of the install directory. We recover by
# trying to load tclreg*.dll directly.
if { [catch {
load [lindex \
[glob -directory \
[file join \
[pwd] \
[file dirname [info nameofexecutable]]] \
tclReg*.dll] \
0] registry
}] } {
# Still no registry!
namespace eval ::tcl::clock [list variable NoRegistry {}]
}
}
}
}
# Put the library directory into the namespace for the ensemble
# so that the library code can find message catalogs and time zone
# definition files.
|
| ︙ | ︙ | |||
2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 |
# so that default strings can be obtained if the Registry query
# fails.
#
#----------------------------------------------------------------------
proc ::tcl::clock::LoadWindowsDateTimeFormats { locale } {
if { ![catch {
registry get "HKEY_CURRENT_USER\\Control Panel\\International" \
sShortDate
} string] } {
set quote {}
set datefmt {}
foreach { unquoted quoted } [split $string '] {
| > > > > > | 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 |
# so that default strings can be obtained if the Registry query
# fails.
#
#----------------------------------------------------------------------
proc ::tcl::clock::LoadWindowsDateTimeFormats { locale } {
# Bail out if we can't find the Registry
variable NoRegistry
if { [info exists NoRegistry] } return
if { ![catch {
registry get "HKEY_CURRENT_USER\\Control Panel\\International" \
sShortDate
} string] } {
set quote {}
set datefmt {}
foreach { unquoted quoted } [split $string '] {
|
| ︙ | ︙ | |||
3140 3141 3142 3143 3144 3145 3146 |
}
} else {
# We couldn't parse this as a POSIX time zone. Try
# again with a time zone file - this time without a colon
| | | < | > < | 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 |
}
} else {
# We couldn't parse this as a POSIX time zone. Try
# again with a time zone file - this time without a colon
if { [catch { LoadTimeZoneFile $timezone }]
&& [catch { LoadZoneinfoFile $timezone }] } {
return -code error -errorcode $::errorCode \
"time zone $timezone not found"
}
set TZData($timezone) $TZData(:$timezone)
}
}
return
}
#----------------------------------------------------------------------
|
| ︙ | ︙ | |||
3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 |
proc ::tcl::clock::GuessWindowsTimeZone {} {
variable WinZoneInfo
variable SecondsPerHour
variable SecondsPerMinute
variable MinutesPerHour
# Dredge time zone information out of the registry
| > > > > > > | | | > | | | | | | | | | | | | | > > > > > > | 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 |
proc ::tcl::clock::GuessWindowsTimeZone {} {
variable WinZoneInfo
variable SecondsPerHour
variable SecondsPerMinute
variable MinutesPerHour
variable NoRegistry
if { [info exists NoRegistry] } {
return :localtime
}
# Dredge time zone information out of the registry
if { [catch {
set rpath HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\TimeZoneInformation
set data [list \
[expr { -$SecondsPerMinute
* [registry get $rpath Bias] }] \
[expr { -$SecondsPerMinute \
* [registry get $rpath StandardBias] }] \
[expr { -$SecondsPerMinute \
* [registry get $rpath DaylightBias] }]]
set stdtzi [registry get $rpath StandardStart]
foreach ind {0 2 14 4 6 8 10 12} {
binary scan $stdtzi @${ind}s val
lappend data $val
}
set daytzi [registry get $rpath DaylightStart]
foreach ind {0 2 14 4 6 8 10 12} {
binary scan $daytzi @${ind}s val
lappend data $val
}
}] } {
# Missing values in the Registry - bail out
return :localtime
}
# Make up a Posix time zone specifier if we can't find one
if { ! [dict exists $WinZoneInfo $data] } {
foreach {
bias stdBias dstBias
|
| ︙ | ︙ | |||
3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 |
# TZData(:fileName) contains the time zone data
#
#----------------------------------------------------------------------
proc ::tcl::clock::LoadTimeZoneFile { fileName } {
variable DataDir
variable TZData
# Since an unsafe interp uses the [clock] command in the master,
# this code is security sensitive. Make sure that the path name
# cannot escape the given directory.
if { ![regexp {^[[:alpha:]_]+(?:/[[:alpha:]_]+)*$} $fileName] } {
return -code error \
-errorcode [list CLOCK badTimeZone $:fileName] \
"time zone \":$fileName\" not valid"
}
if { [catch {
source -encoding utf-8 [file join $DataDir $fileName]
}] } {
return -code error \
-errorcode [list CLOCK badTimeZone :$fileName] \
"time zone \":$fileName\" not found"
}
}
#----------------------------------------------------------------------
#
# LoadZoneinfoFile --
#
# Loads a binary time zone information file in Olson format.
| > > > > > | 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 |
# TZData(:fileName) contains the time zone data
#
#----------------------------------------------------------------------
proc ::tcl::clock::LoadTimeZoneFile { fileName } {
variable DataDir
variable TZData
if { [info exists TZData($fileName)] } {
return
}
# Since an unsafe interp uses the [clock] command in the master,
# this code is security sensitive. Make sure that the path name
# cannot escape the given directory.
if { ![regexp {^[[:alpha:]_]+(?:/[[:alpha:]_]+)*$} $fileName] } {
return -code error \
-errorcode [list CLOCK badTimeZone $:fileName] \
"time zone \":$fileName\" not valid"
}
if { [catch {
source -encoding utf-8 [file join $DataDir $fileName]
}] } {
return -code error \
-errorcode [list CLOCK badTimeZone :$fileName] \
"time zone \":$fileName\" not found"
}
return
}
#----------------------------------------------------------------------
#
# LoadZoneinfoFile --
#
# Loads a binary time zone information file in Olson format.
|
| ︙ | ︙ | |||
3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 |
# Next come ${nTime} transition times, followed by ${nTime} time type
# codes. The type codes are unsigned 1-byte quantities. We insert an
# arbitrary start time in front of the transitions.
binary scan $d @${seek}I${nTime}c${nTime} times tempCodes
incr seek [expr { 5 * $nTime }]
set times [linsert $times 0 $MINWIDE]
foreach c $tempCodes {
lappend codes [expr { $c & 0xff }]
}
set codes [linsert $codes 0 0]
# Next come ${nType} time type descriptions, each of which has an
# offset (seconds east of GMT), a DST indicator, and an index into
| > | 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 |
# Next come ${nTime} transition times, followed by ${nTime} time type
# codes. The type codes are unsigned 1-byte quantities. We insert an
# arbitrary start time in front of the transitions.
binary scan $d @${seek}I${nTime}c${nTime} times tempCodes
incr seek [expr { 5 * $nTime }]
set times [linsert $times 0 $MINWIDE]
set codes {}
foreach c $tempCodes {
lappend codes [expr { $c & 0xff }]
}
set codes [linsert $codes 0 0]
# Next come ${nType} time type descriptions, each of which has an
# offset (seconds east of GMT), a DST indicator, and an index into
|
| ︙ | ︙ |
Changes to tests/clock.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # clock.test -- # # This test file covers the 'clock' command that manipulates time. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 2004 by 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. # | | | > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# clock.test --
#
# This test file covers the 'clock' command that manipulates time.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 2004 by 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.
#
# RCS: @(#) $Id: clock.test,v 1.36 2004/08/18 20:59:34 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
if { $::tcl_platform(platform) eq {windows} } {
if { [catch { package require registry 1.1 }] } {
# HIDEOUS KLUDGE: [package require registry 1.1] has failed.
# This failure likely means that we're running in Tcl's build
# directory instead of the install directory. We recover by
# trying to load tclreg*.dll directly.
if { [catch {
load [lindex \
[glob -directory \
[file join \
[pwd] \
[file dirname [info nameofexecutable]]] \
tclReg*.dll] \
0] registry
}] } {
# Still no registry!
namespace eval ::tcl::clock [set NoRegistry {}]
}
}
}
package require msgcat 1.4
# TEST PLAN
# clock-1:
# [clock format] - tests of bad and empty arguments
|
| ︙ | ︙ |
Changes to win/Makefile.in.
1 2 3 4 5 6 7 | # # This file is a Makefile for Tcl. If it has the name "Makefile.in" # then it is a template for a Makefile; to generate the actual Makefile, # run "./configure", which is a configuration script generated by the # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # # This file is a Makefile for Tcl. If it has the name "Makefile.in" # then it is a template for a Makefile; to generate the actual Makefile, # run "./configure", which is a configuration script generated by the # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # # RCS: @(#) $Id: Makefile.in,v 1.80 2004/08/18 20:59:35 kennykb Exp $ VERSION = @TCL_VERSION@ #---------------------------------------------------------------- # Things you can change to personalize the Makefile for your own # site (you can make these changes in either Makefile.in or # Makefile, but changes to Makefile will get lost if you re-run |
| ︙ | ︙ | |||
510 511 512 513 514 515 516 | $(LIB_INSTALL_DIR)/reg1.1; \ fi @if [ -f $(REG_LIB_FILE) ]; then \ echo installing $(REG_LIB_FILE); \ $(COPY) $(REG_LIB_FILE) $(LIB_INSTALL_DIR)/reg1.1; \ fi | | | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | $(LIB_INSTALL_DIR)/reg1.1; \ fi @if [ -f $(REG_LIB_FILE) ]; then \ echo installing $(REG_LIB_FILE); \ $(COPY) $(REG_LIB_FILE) $(LIB_INSTALL_DIR)/reg1.1; \ fi install-libraries: libraries install-tzdata install-msgs @for i in $(prefix)/lib $(INCLUDE_INSTALL_DIR) \ $(SCRIPT_INSTALL_DIR); \ do \ if [ ! -d $$i ] ; then \ echo "Making directory $$i"; \ $(MKDIR) $$i; \ else true; \ |
| ︙ | ︙ | |||
569 570 571 572 573 574 575 576 577 578 579 580 581 582 | $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/tcltest2.2"; \ done; @echo "Installing encodings"; @for i in $(ROOT_DIR)/library/encoding/*.enc ; do \ $(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)/encoding"; \ done; install-doc: doc # Optional target to install private headers install-private-headers: libraries @for i in $(PRIVATE_INCLUDE_INSTALL_DIR); \ do \ if [ ! -d $$i ] ; then \ | > > > > > > > > > > > > | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 |
$(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/tcltest2.2"; \
done;
@echo "Installing encodings";
@for i in $(ROOT_DIR)/library/encoding/*.enc ; do \
$(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)/encoding"; \
done;
install-tzdata:
@echo "Installing time zone data"
@TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
./$(TCLSH) "$(ROOT_DIR)/tools/installData.tcl" \
"$(ROOT_DIR)/library/tzdata" "$(SCRIPT_INSTALL_DIR)/tzdata"
install-msgs:
@echo "Installing message catalogs"
@TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
./$(TCLSH) "$(ROOT_DIR)/tools/installData.tcl" \
"$(ROOT_DIR)/library/msgs" "$(SCRIPT_INSTALL_DIR)/msgs"
install-doc: doc
# Optional target to install private headers
install-private-headers: libraries
@for i in $(PRIVATE_INCLUDE_INSTALL_DIR); \
do \
if [ ! -d $$i ] ; then \
|
| ︙ | ︙ |
Changes to win/makefile.vc.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | # # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # Copyright (c) 2001 ActiveState Corporation. # Copyright (c) 2001-2004 David Gravereaux. # #------------------------------------------------------------------------------ | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # Copyright (c) 2001 ActiveState Corporation. # Copyright (c) 2001-2004 David Gravereaux. # #------------------------------------------------------------------------------ # RCS: @(#) $Id: makefile.vc,v 1.130 2004/08/18 20:59:36 kennykb Exp $ #------------------------------------------------------------------------------ !if !defined(MSDEVDIR) && !defined(MSVCDIR) MSG = ^ You'll need to run vcvars32.bat from Developer Studio, first, to setup^ the environment. Jump to this line to read the new instructions. !error $(MSG) |
| ︙ | ︙ | |||
859 860 861 862 863 864 865 | !if exist($(TCLPIPEDLL)) @echo installing $(TCLPIPEDLLNAME) @$(CPY) "$(TCLPIPEDLL)" "$(BIN_INSTALL_DIR)\" !endif @echo installing $(TCLSTUBLIBNAME) @$(CPY) "$(TCLSTUBLIB)" "$(LIB_INSTALL_DIR)\" | | | 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | !if exist($(TCLPIPEDLL)) @echo installing $(TCLPIPEDLLNAME) @$(CPY) "$(TCLPIPEDLL)" "$(BIN_INSTALL_DIR)\" !endif @echo installing $(TCLSTUBLIBNAME) @$(CPY) "$(TCLSTUBLIB)" "$(LIB_INSTALL_DIR)\" install-libraries: tclConfig install-msgs install-tzdata @echo installing tclConfig.sh @$(CPY) "$(OUT_DIR)\tclConfig.sh" "$(LIB_INSTALL_DIR)\" @echo installing http1.0 @$(CPY) "$(ROOT)\library\http1.0\*.tcl" \ "$(SCRIPT_INSTALL_DIR)\http1.0\" @echo installing http2.4 @$(CPY) "$(ROOT)\library\http\*.tcl" \ |
| ︙ | ︙ | |||
910 911 912 913 914 915 916 917 918 919 920 921 922 923 | @$(CPY) "$(ROOT)\library\parray.tcl" "$(SCRIPT_INSTALL_DIR)\" @$(CPY) "$(ROOT)\library\safe.tcl" "$(SCRIPT_INSTALL_DIR)\" @$(CPY) "$(ROOT)\library\tclIndex" "$(SCRIPT_INSTALL_DIR)\" @$(CPY) "$(ROOT)\library\package.tcl" "$(SCRIPT_INSTALL_DIR)\" @$(CPY) "$(ROOT)\library\word.tcl" "$(SCRIPT_INSTALL_DIR)\" @$(CPY) "$(ROOT)\library\auto.tcl" "$(SCRIPT_INSTALL_DIR)\" #--------------------------------------------------------------------- # Clean up #--------------------------------------------------------------------- tidy: !if "$(TCLLIB)" != "$(TCLIMPLIB)" | > > > > > > > > > > > | 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 | @$(CPY) "$(ROOT)\library\parray.tcl" "$(SCRIPT_INSTALL_DIR)\" @$(CPY) "$(ROOT)\library\safe.tcl" "$(SCRIPT_INSTALL_DIR)\" @$(CPY) "$(ROOT)\library\tclIndex" "$(SCRIPT_INSTALL_DIR)\" @$(CPY) "$(ROOT)\library\package.tcl" "$(SCRIPT_INSTALL_DIR)\" @$(CPY) "$(ROOT)\library\word.tcl" "$(SCRIPT_INSTALL_DIR)\" @$(CPY) "$(ROOT)\library\auto.tcl" "$(SCRIPT_INSTALL_DIR)\" install-tzdata: @echo "Installing time zone data" set TCL_LIBRARY="$(ROOT)/library" $(TCLSH) "$(ROOT)/tools/installData.tcl" \ "$(ROOT)/library/tzdata" "$(SCRIPT_INSTALL_DIR)/tzdata" install-msgs: @echo "Installing message catalogs" set TCL_LIBRARY="$(ROOT)/library" $(TCLSH) "$(ROOT)/tools/installData.tcl" \ "$(ROOT)/library/msgs" "$(SCRIPT_INSTALL_DIR)/msgs" #--------------------------------------------------------------------- # Clean up #--------------------------------------------------------------------- tidy: !if "$(TCLLIB)" != "$(TCLIMPLIB)" |
| ︙ | ︙ |