From 907b916cca8d7416964c4294cd1679e3c458ec3a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Mar 2024 10:31:58 +0000 Subject: Move "::tcl::clock::configure" to the tcl::unsupported namespace --- generic/tclClock.c | 8 ++++++-- library/clock.tcl | 18 +++++++++--------- library/init.tcl | 2 +- tests/clock-ivm.test | 2 +- tests/clock.test | 28 ++++++++++++++-------------- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index af977eb..c49b1b4 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -146,7 +146,6 @@ static const struct ClockCommand clockCommands[] = { {"milliseconds", ClockMillisecondsObjCmd,TclCompileClockReadingCmd, INT2PTR(2)}, {"scan", ClockScanObjCmd, TclCompileBasicMin1ArgCmd, NULL}, {"seconds", ClockSecondsObjCmd, TclCompileClockReadingCmd, INT2PTR(3)}, - {"configure", ClockConfigureObjCmd, NULL, NULL}, {"ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd, NULL, NULL}, {"GetDateFields", ClockGetdatefieldsObjCmd, NULL, NULL}, {"GetJulianDayFromEraYearMonthDay", @@ -267,6 +266,11 @@ TclClockInit( cmdPtr->compileProc = clockCmdPtr->compileProc ? clockCmdPtr->compileProc : TclCompileBasicMin0ArgCmd; } + cmdPtr = (Command *)Tcl_CreateObjCommand(interp, + "::tcl::unsupported::clock::configure", + ClockConfigureObjCmd, data, NULL); + data->refCount++; + cmdPtr->compileProc = TclCompileBasicMin0ArgCmd; } /* @@ -945,7 +949,7 @@ TimezoneLoaded( * This function is invoked to process the Tcl "::clock::configure" (internal) command. * * Usage: - * ::tcl::clock::configure ?-option ?value?? + * ::tcl::unsupported::clock::configure ?-option ?value?? * * Results: * Returns a standard Tcl result. diff --git a/library/clock.tcl b/library/clock.tcl index b518128..a323a7c 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -280,9 +280,9 @@ proc ::tcl::clock::Initialize {} { # Default configuration - configure -current-locale [mclocale] - #configure -default-locale C - #configure -year-century 2000 \ + ::tcl::unsupported::clock::configure -current-locale [mclocale] + #::tcl::unsupported::clock::configure -default-locale C + #::tcl::unsupported::clock::configure -year-century 2000 \ # -century-switch 38 # Translation table to map Windows TZI onto cities, so that the Olson @@ -911,7 +911,7 @@ proc ::tcl::clock::GetSystemTimeZone {} { set timezone $result } else { # ask engine for the cached timezone: - set timezone [configure -system-tz] + set timezone [::tcl::unsupported::clock::configure -system-tz] if { $timezone ne "" } { return $timezone } @@ -934,7 +934,7 @@ proc ::tcl::clock::GetSystemTimeZone {} { } # tell backend - current system timezone: - configure -system-tz $timezone + ::tcl::unsupported::clock::configure -system-tz $timezone return $timezone } @@ -1037,7 +1037,7 @@ proc ::tcl::clock::SetupTimeZone { timezone {alias {}} } { set tzname [::tcl::clock::SetupTimeZone $tzname $timezone] set TZData($timezone) $TZData($tzname) # tell backend - timezone is initialized and return shared timezone object: - return [configure -setup-tz $timezone] + return [::tcl::unsupported::clock::configure -setup-tz $timezone] } dict unset opts -errorinfo @@ -1049,7 +1049,7 @@ proc ::tcl::clock::SetupTimeZone { timezone {alias {}} } { } # tell backend - timezone is initialized and return shared timezone object: - configure -setup-tz $timezone + ::tcl::unsupported::clock::configure -setup-tz $timezone } #---------------------------------------------------------------------- @@ -2045,7 +2045,7 @@ proc ::tcl::clock::WeekdayOnOrBefore { weekday j } { #---------------------------------------------------------------------- proc ::tcl::clock::ChangeCurrentLocale {args} { - configure -current-locale [lindex $args 0] + ::tcl::unsupported::clock::configure -current-locale [lindex $args 0] } #---------------------------------------------------------------------- @@ -2071,7 +2071,7 @@ proc ::tcl::clock::ClearCaches {} { variable TimeZoneBad # tell backend - should invalidate: - configure -clear + ::tcl::unsupported::clock::configure -clear # clear msgcat cache: set mcMergedCat [dict create] diff --git a/library/init.tcl b/library/init.tcl index 2fcd074..4d70f53 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -117,7 +117,7 @@ if {[interp issafe]} { namespace inscope ::tcl::clock [list namespace ensemble create -command \ [uplevel 1 [list ::namespace origin [::lindex [info level 0] 0]]] \ -map $cmdmap] - ::tcl::clock::configure -init-complete + ::tcl::unsupported::clock::configure -init-complete # Auto-loading stubs for 'clock.tcl' diff --git a/tests/clock-ivm.test b/tests/clock-ivm.test index c6ac394..acf4adb 100644 --- a/tests/clock-ivm.test +++ b/tests/clock-ivm.test @@ -4,5 +4,5 @@ # # See the file "clock.test" for more information. -::tcl::clock::configure -valid [expr {![::tcl::clock::configure -valid]}] +::tcl::unsupported::clock::configure -valid [expr {![::tcl::unsupported::clock::configure -valid]}] source [file join [file dirname [info script]] clock.test] \ No newline at end of file diff --git a/tests/clock.test b/tests/clock.test index 5436051..bd2b436 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -34,7 +34,7 @@ testConstraint y2038 \ # Test with both validity modes - validate on / off: -set valid_mode [::tcl::clock::configure -valid] +set valid_mode [::tcl::unsupported::clock::configure -valid] # Wrapper to show validity mode in the test-case name (for possible errors): proc test {args} { @@ -44,7 +44,7 @@ proc test {args} { } puts [outputChannel] " Validity default mode: [expr {$valid_mode ? "on": "off"}]" -testConstraint valid_off [expr {![::tcl::clock::configure -valid]}] +testConstraint valid_off [expr {![::tcl::unsupported::clock::configure -valid]}] if {[namespace which -command ::tcl::unsupported::timerate] ne ""} { namespace import ::tcl::unsupported::timerate @@ -37141,13 +37141,13 @@ test clock-46.16$idx {freescan: validation rules: invalid day of week} \ _invalid_test "Sat Jan 02 00:00:00 1970$relstr" "Thu Jan 04 00:00:00 1970$relstr" } -result [lrepeat 10 1 {unable to convert input string: invalid day of week}] test clock-46.17$idx {scan: validation rules: invalid year} -setup { - set orgcfg [list -min-year [::tcl::clock::configure -min-year] -max-year [::tcl::clock::configure -max-year] \ - -year-century [::tcl::clock::configure -year-century] -century-switch [::tcl::clock::configure -century-switch]] - ::tcl::clock::configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 + set orgcfg [list -min-year [::tcl::unsupported::clock::configure -min-year] -max-year [::tcl::unsupported::clock::configure -max-year] \ + -year-century [::tcl::unsupported::clock::configure -year-century] -century-switch [::tcl::unsupported::clock::configure -century-switch]] + ::tcl::unsupported::clock::configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 } -body { _invalid_test "70-01-01$relstr" "1870-01-01$relstr" "9570-01-01$relstr" } -result [lrepeat 15 1 {unable to convert input string: invalid year}] -cleanup { - ::tcl::clock::configure {*}$orgcfg + ::tcl::unsupported::clock::configure {*}$orgcfg unset -nocomplain orgcfg } @@ -37285,23 +37285,23 @@ test clock-46.29-2 {scan: validation rules: valid day of leap/not leap year} \ [clock format [clock scan "365-2017" -format "%j-%G" -valid 1 -gmt 1] -format "%d-%m-%Y"] } -result {31-12-2016 31-12-2017 31-12-2016 31-12-2017} test clock-46.30 {scan: validation rules: invalid year} -setup { - set orgcfg [list -min-year [::tcl::clock::configure -min-year] -max-year [::tcl::clock::configure -max-year] \ - -year-century [::tcl::clock::configure -year-century] -century-switch [::tcl::clock::configure -century-switch]] - ::tcl::clock::configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 + set orgcfg [list -min-year [::tcl::unsupported::clock::configure -min-year] -max-year [::tcl::unsupported::clock::configure -max-year] \ + -year-century [::tcl::unsupported::clock::configure -year-century] -century-switch [::tcl::unsupported::clock::configure -century-switch]] + ::tcl::unsupported::clock::configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 } -body { _invalid_test "01-01-70" "%d-%m-%y" "01-01-1870" "%d-%m-%C%y" "01-01-1970" "%d-%m-%Y" } -result [lrepeat 15 1 {unable to convert input string: invalid year}] -cleanup { - ::tcl::clock::configure {*}$orgcfg + ::tcl::unsupported::clock::configure {*}$orgcfg unset -nocomplain orgcfg } test clock-46.31 {scan: validation rules: invalid iso year} -setup { - set orgcfg [list -min-year [::tcl::clock::configure -min-year] -max-year [::tcl::clock::configure -max-year] \ - -year-century [::tcl::clock::configure -year-century] -century-switch [::tcl::clock::configure -century-switch]] - ::tcl::clock::configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 + set orgcfg [list -min-year [::tcl::unsupported::clock::configure -min-year] -max-year [::tcl::unsupported::clock::configure -max-year] \ + -year-century [::tcl::unsupported::clock::configure -year-century] -century-switch [::tcl::unsupported::clock::configure -century-switch]] + ::tcl::unsupported::clock::configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 } -body { _invalid_test "01-01-70" "%d-%m-%g" "01-01-9870" "%d-%m-%C%g" "01-01-9870" "%d-%m-%G" } -result [lrepeat 15 1 {unable to convert input string: invalid iso year}] -cleanup { - ::tcl::clock::configure {*}$orgcfg + ::tcl::unsupported::clock::configure {*}$orgcfg unset -nocomplain orgcfg } rename _invalid_test {} -- cgit v0.12