Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | merge novem |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | dgp-refactor |
Files: | files | file ages | folders |
SHA1: |
05f8eaadb78d0cfc50a13af45af79b76 |
User & Date: | dgp 2016-04-04 16:20:55.093 |
Context
2016-04-05
| ||
12:08 | merge novem check-in: 31591fd353 user: dgp tags: dgp-refactor | |
2016-04-04
| ||
16:20 | merge novem check-in: 05f8eaadb7 user: dgp tags: dgp-refactor | |
16:11 | merge trunk check-in: 08f9df78ea user: dgp tags: novem | |
2016-03-29
| ||
12:14 | merge novem check-in: d7da8edfc0 user: dgp tags: dgp-refactor | |
Changes
Changes to doc/AllowExc.3.
︙ | ︙ | |||
25 26 27 28 29 30 31 | .PP If a script is evaluated at top-level (i.e. no other scripts are pending evaluation when the script is invoked), and if the script terminates with a completion code other than \fBTCL_OK\fR, \fBTCL_ERROR\fR or \fBTCL_RETURN\fR, then Tcl normally converts this into a \fBTCL_ERROR\fR return with an appropriate message. The particular script evaluation procedures of Tcl that act in the manner are | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | .PP If a script is evaluated at top-level (i.e. no other scripts are pending evaluation when the script is invoked), and if the script terminates with a completion code other than \fBTCL_OK\fR, \fBTCL_ERROR\fR or \fBTCL_RETURN\fR, then Tcl normally converts this into a \fBTCL_ERROR\fR return with an appropriate message. The particular script evaluation procedures of Tcl that act in the manner are \fBTcl_EvalObjEx\fR, \fBTcl_EvalObjv\fR, \fBTcl_Eval\fR, \fBTcl_EvalEx\fR. .PP However, if \fBTcl_AllowExceptions\fR is invoked immediately before calling one of those a procedures, then arbitrary completion codes are permitted from the script, and they are returned without modification. This is useful in cases where the caller can deal with exceptions such as \fBTCL_BREAK\fR or \fBTCL_CONTINUE\fR in a meaningful way. |
︙ | ︙ |
Changes to doc/clock.n.
︙ | ︙ | |||
85 86 87 88 89 90 91 | exactly 86400 seconds. Tcl responds to leap seconds by speeding or slowing its clock by a tiny fraction for some minutes until it is back in sync with UTC; its data model does not represent minutes that have 59 or 61 seconds. .TP \fIunit\fR One of the words, \fBseconds\fR, \fBminutes\fR, \fBhours\fR, | | | | < | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | exactly 86400 seconds. Tcl responds to leap seconds by speeding or slowing its clock by a tiny fraction for some minutes until it is back in sync with UTC; its data model does not represent minutes that have 59 or 61 seconds. .TP \fIunit\fR One of the words, \fBseconds\fR, \fBminutes\fR, \fBhours\fR, \fBdays\fR, \fBweekdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR. Used in conjunction with \fIcount\fR to identify an interval of time, for example, \fI3 seconds\fR or \fI1 year\fR. .SS "OPTIONS" .TP \fB\-base\fR time Specifies that any relative times present in a \fBclock scan\fR command are to be given relative to \fItime\fR. \fItime\fR must be expressed as a count of nominal seconds from the epoch time of 1 January 1970, 00:00 UTC. .TP |
︙ | ︙ | |||
171 172 173 174 175 176 177 | .PP The \fBclock add\fR command performs clock arithmetic on a value (expressed as nominal seconds from the epoch time of 1 January 1970, 00:00 UTC) given as its first argument. The remaining arguments (other than the possible \fB\-timezone\fR, \fB\-locale\fR and \fB\-gmt\fR options) are integers and keywords in alternation, where the keywords are chosen from \fBseconds\fR, \fBminutes\fR, \fBhours\fR, | | < | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | .PP The \fBclock add\fR command performs clock arithmetic on a value (expressed as nominal seconds from the epoch time of 1 January 1970, 00:00 UTC) given as its first argument. The remaining arguments (other than the possible \fB\-timezone\fR, \fB\-locale\fR and \fB\-gmt\fR options) are integers and keywords in alternation, where the keywords are chosen from \fBseconds\fR, \fBminutes\fR, \fBhours\fR, \fBdays\fR, \fBweekdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR. .PP Addition of seconds, minutes and hours is fairly straightforward; the given time increment (times sixty for minutes, or 3600 for hours) is simply added to the \fItimeVal\fR given to the \fBclock add\fR command. The result is interpreted as a nominal number of seconds from the Epoch. .PP |
︙ | ︙ | |||
209 210 211 212 213 214 215 | .CE .PP Adding and subtracting days and weeks is accomplished by converting the given time to a calendar day and time of day in the appropriate time zone and locale. The requisite number of days (weeks are converted to days by multiplying by seven) is added to the calendar day, and the date and time are then converted back to a count of seconds from | | > | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | .CE .PP Adding and subtracting days and weeks is accomplished by converting the given time to a calendar day and time of day in the appropriate time zone and locale. The requisite number of days (weeks are converted to days by multiplying by seven) is added to the calendar day, and the date and time are then converted back to a count of seconds from the epoch time. The \fBweekdays\fR keyword is similar to \fBdays\fR, with the only difference that weekends - Saturdays and Sundays - are skipped. .PP Adding and subtracting a given number of days across the point that the time changes at the start or end of summer time (Daylight Saving Time) results in the \fIsame local time\fR on the day in question. For instance, the following code sets the value of \fBx\fR to \fB05:00:00\fR. .PP .CS |
︙ | ︙ |
Changes to doc/mathfunc.n.
︙ | ︙ | |||
102 103 104 105 106 107 108 | \fBsin\fR \fBsinh\fR \fBsqrt\fR \fBsrand\fR \fBtan\fR \fBtanh\fR \fBwide\fR .DE .PP In addition to these predefined functions, applications may define additional functions by using \fBproc\fR (or any other method, such as \fBinterp alias\fR or \fBTcl_CreateObjCommand\fR) to define | | | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | \fBsin\fR \fBsinh\fR \fBsqrt\fR \fBsrand\fR \fBtan\fR \fBtanh\fR \fBwide\fR .DE .PP In addition to these predefined functions, applications may define additional functions by using \fBproc\fR (or any other method, such as \fBinterp alias\fR or \fBTcl_CreateObjCommand\fR) to define new commands in the \fBtcl::mathfunc\fR namespace. .SS "DETAILED DEFINITIONS" .TP \fBabs \fIarg\fR . Returns the absolute value of \fIarg\fR. \fIArg\fR may be either integer or floating-point, and the result is returned in the same form. .TP |
︙ | ︙ |
Changes to generic/tclEvent.c.
︙ | ︙ | |||
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | * implementation of self-initializing locks. */ TclInitThreadStorage(); /* Creates master hash table for * thread local storage */ #if USE_TCLALLOC TclInitAlloc(); /* Process wide mutex init */ #endif #ifdef TCL_MEM_DEBUG TclInitDbCkalloc(); /* Process wide mutex init */ #endif TclpInitPlatform(); /* Creates signal handler(s) */ TclInitDoubleConversion(); /* Initializes constants for | > > > | 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 | * implementation of self-initializing locks. */ TclInitThreadStorage(); /* Creates master hash table for * thread local storage */ #if USE_TCLALLOC TclInitAlloc(); /* Process wide mutex init */ #endif #if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) TclpInitAllocCache(); #endif #ifdef TCL_MEM_DEBUG TclInitDbCkalloc(); /* Process wide mutex init */ #endif TclpInitPlatform(); /* Creates signal handler(s) */ TclInitDoubleConversion(); /* Initializes constants for |
︙ | ︙ |
Changes to generic/tclExecute.c.
︙ | ︙ | |||
31 32 33 34 35 36 37 | */ #if (FLT_RADIX == 2) && (DBL_MANT_DIG == 53) && (DBL_MAX_EXP == 1024) #define IEEE_FLOATING_POINT #endif /* | | | | | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | */ #if (FLT_RADIX == 2) && (DBL_MANT_DIG == 53) && (DBL_MAX_EXP == 1024) #define IEEE_FLOATING_POINT #endif /* * A counter that is used to work out when the bytecode engine should call * Tcl_AsyncReady() to see whether there is a signal that needs handling, and * other expensive periodic operations. */ #ifndef ASYNC_CHECK_COUNT # define ASYNC_CHECK_COUNT 64 #endif /* !ASYNC_CHECK_COUNT */ /* * Boolean flag indicating whether the Tcl bytecode interpreter has been * initialized. */ static int execInitialized = 0; |
︙ | ︙ | |||
2054 2055 2056 2057 2058 2059 2060 | */ /* * Constants: variables that do not change during the execution, used * sporadically: no special need for speed. */ | > | | > > > > > | 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 | */ /* * Constants: variables that do not change during the execution, used * sporadically: no special need for speed. */ unsigned interruptCounter = 1; /* Counter that is used to work out when to * call Tcl_AsyncReady(). This must be 1 * initially so that we call the async-check * stanza early, otherwise there are command * sequences that can make the interpreter * busy-loop without an opportunity to * recognise an interrupt. */ const char *curInstName; #ifdef TCL_COMPILE_DEBUG int traceInstructions; /* Whether we are doing instruction-level * tracing or not. */ #endif Var *compiledLocals = iPtr->varFramePtr->compiledLocals; |
︙ | ︙ | |||
2253 2254 2255 2256 2257 2258 2259 | break; } cleanup0: /* * Check for asynchronous handlers [Bug 746722]; we do the check every | | > | | 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 | break; } cleanup0: /* * Check for asynchronous handlers [Bug 746722]; we do the check every * ASYNC_CHECK_COUNT instructions. */ if ((--interruptCounter) == 0) { interruptCounter = ASYNC_CHECK_COUNT; DECACHE_STACK_INFO(); if (TclAsyncReady(iPtr)) { result = Tcl_AsyncInvoke(interp, result); if (result == TCL_ERROR) { CACHE_STACK_INFO(); goto gotError; } |
︙ | ︙ |
Changes to generic/tclInt.h.
︙ | ︙ | |||
4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 | MODULE_SCOPE Tcl_Obj * TclThreadAllocObj(void); MODULE_SCOPE void TclThreadFreeObj(Tcl_Obj *); MODULE_SCOPE Tcl_Mutex *TclpNewAllocMutex(void); MODULE_SCOPE void TclFreeAllocCache(void *); MODULE_SCOPE void * TclpGetAllocCache(void); MODULE_SCOPE void TclpSetAllocCache(void *); MODULE_SCOPE void TclpFreeAllocMutex(Tcl_Mutex *mutex); MODULE_SCOPE void TclpFreeAllocCache(void *); /* * These macros need to be kept in sync with the code of TclThreadAllocObj() * and TclThreadFreeObj(). * * Note that the optimiser should resolve the case (interp==NULL) at compile | > | 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 | MODULE_SCOPE Tcl_Obj * TclThreadAllocObj(void); MODULE_SCOPE void TclThreadFreeObj(Tcl_Obj *); MODULE_SCOPE Tcl_Mutex *TclpNewAllocMutex(void); MODULE_SCOPE void TclFreeAllocCache(void *); MODULE_SCOPE void * TclpGetAllocCache(void); MODULE_SCOPE void TclpSetAllocCache(void *); MODULE_SCOPE void TclpFreeAllocMutex(Tcl_Mutex *mutex); MODULE_SCOPE void TclpInitAllocCache(void); MODULE_SCOPE void TclpFreeAllocCache(void *); /* * These macros need to be kept in sync with the code of TclThreadAllocObj() * and TclThreadFreeObj(). * * Note that the optimiser should resolve the case (interp==NULL) at compile |
︙ | ︙ |
Changes to generic/tclResult.c.
︙ | ︙ | |||
442 443 444 445 446 447 448 | Tcl_Obj *elementPtr = Tcl_NewStringObj(element, -1); Tcl_Obj *listPtr = Tcl_NewListObj(1, &elementPtr); int length; const char *bytes; if (Tcl_IsShared(iPtr->objResultPtr)) { Tcl_SetObjResult(interp, Tcl_DuplicateObj(iPtr->objResultPtr)); | | | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | Tcl_Obj *elementPtr = Tcl_NewStringObj(element, -1); Tcl_Obj *listPtr = Tcl_NewListObj(1, &elementPtr); int length; const char *bytes; if (Tcl_IsShared(iPtr->objResultPtr)) { Tcl_SetObjResult(interp, Tcl_DuplicateObj(iPtr->objResultPtr)); } bytes = Tcl_GetStringFromObj(iPtr->objResultPtr, &length); if (TclNeedSpace(bytes, bytes+length)) { Tcl_AppendToObj(iPtr->objResultPtr, " ", 1); } Tcl_AppendObjToObj(iPtr->objResultPtr, listPtr); Tcl_DecrRefCount(listPtr); } |
︙ | ︙ |
Changes to generic/tclZlib.c.
︙ | ︙ | |||
1190 1191 1192 1193 1194 1195 1196 | outSize = deflateBound(&zshPtr->stream, zshPtr->stream.avail_in)+100; zshPtr->stream.avail_out = outSize; dataTmp = ckalloc(zshPtr->stream.avail_out); zshPtr->stream.next_out = (Bytef *) dataTmp; e = deflate(&zshPtr->stream, flush); | | | > | | | 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 | outSize = deflateBound(&zshPtr->stream, zshPtr->stream.avail_in)+100; zshPtr->stream.avail_out = outSize; dataTmp = ckalloc(zshPtr->stream.avail_out); zshPtr->stream.next_out = (Bytef *) dataTmp; e = deflate(&zshPtr->stream, flush); while (e == Z_BUF_ERROR || (flush == Z_FINISH && e == Z_OK)) { /* * Output buffer too small to hold the data being generated or we * are doing the end-of-stream flush (which can spit out masses of * data). This means we need to put a new buffer into place after * saving the old generated data to the outData list. */ obj = Tcl_NewByteArrayObj((unsigned char *) dataTmp, outSize); Tcl_ListObjAppendElement(NULL, zshPtr->outData, obj); if (outSize < 0xFFFF) { outSize = 0xFFFF; /* There may be *lots* of data left to |
︙ | ︙ |
Changes to library/clock.tcl.
︙ | ︙ | |||
4244 4245 4246 4247 4248 4249 4250 | return -code error \ -errorcode [list CLOCK wrongNumArgs] \ "wrong \# args: should be\ \"$cmdName clockval ?number units?...\ ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?\"" } if { [catch { expr {wide($clockval)} } result] } { | | | 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 | return -code error \ -errorcode [list CLOCK wrongNumArgs] \ "wrong \# args: should be\ \"$cmdName clockval ?number units?...\ ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?\"" } if { [catch { expr {wide($clockval)} } result] } { return -code error "expected integer but got \"$clockval\"" } set offsets {} set gmt 0 set locale c set timezone [GetSystemTimeZone] |
︙ | ︙ | |||
4283 4284 4285 4286 4287 4288 4289 | # Check options for validity if { [info exists saw(-gmt)] && [info exists saw(-timezone)] } { return -code error \ -errorcode [list CLOCK gmtWithTimezone] \ "cannot use -gmt and -timezone in same call" } | < < < | 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 | # Check options for validity if { [info exists saw(-gmt)] && [info exists saw(-timezone)] } { return -code error \ -errorcode [list CLOCK gmtWithTimezone] \ "cannot use -gmt and -timezone in same call" } if { ![string is boolean -strict $gmt] } { return -code error "expected boolean value but got \"$gmt\"" } elseif { $gmt } { set timezone :GMT } EnterLocale $locale |
︙ | ︙ | |||
4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 | set clockval [AddDays [expr { 7 * $quantity }] \ $clockval $timezone $changeover] } days - day { set clockval [AddDays $quantity $clockval $timezone \ $changeover] } hours - hour { set clockval [expr { 3600 * $quantity + $clockval }] } minutes - minute { set clockval [expr { 60 * $quantity + $clockval }] } | > > > > > | 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 | set clockval [AddDays [expr { 7 * $quantity }] \ $clockval $timezone $changeover] } days - day { set clockval [AddDays $quantity $clockval $timezone \ $changeover] } weekdays - weekday { set clockval [AddWeekDays $quantity $clockval $timezone \ $changeover] } hours - hour { set clockval [expr { 3600 * $quantity + $clockval }] } minutes - minute { set clockval [expr { 60 * $quantity + $clockval }] } |
︙ | ︙ | |||
4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 | }] set date [ConvertLocalToUTC $date[set date {}] $TZData($timezone) \ $changeover] return [dict get $date seconds] } #---------------------------------------------------------------------- # # AddDays -- # # Add a given number of days to a given clock value in a given time # zone. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 | }] set date [ConvertLocalToUTC $date[set date {}] $TZData($timezone) \ $changeover] return [dict get $date seconds] } #---------------------------------------------------------------------- # # AddWeekDays -- # # Add a given number of week days (skipping Saturdays and Sundays) # to a given clock value in a given time zone. # # Parameters: # days - Number of days to add (may be negative) # clockval - Seconds since the epoch before the operation # timezone - Time zone in which the operation is to be performed # changeover - Julian Day on which the Gregorian calendar was adopted # in the target locale. # # Results: # Returns the new clock value as a number of seconds since the epoch. # # Side effects: # None. # #---------------------------------------------------------------------- proc ::tcl::clock::AddWeekDays { days clockval timezone changeover } { if {$days == 0} { return $clockval } set day [format $clockval -format %u] set weeks [expr {$days / 5}] set rdays [expr {$days % 5}] set toAdd [expr {7 * $weeks + $rdays}] set resDay [expr {$day + ($toAdd % 7)}] # Adjust if we start from a weekend if {$day > 5} { set adj [expr {5 - $day}] incr toAdd $adj incr resDay $adj } # Adjust if we end up on a weekend if {$resDay > 5} { incr toAdd 2 } AddDays $toAdd $clockval $timezone $changeover } #---------------------------------------------------------------------- # # AddDays -- # # Add a given number of days to a given clock value in a given time # zone. |
︙ | ︙ |
Changes to tests/clock.test.
︙ | ︙ | |||
34988 34989 34990 34991 34992 34993 34994 34995 34996 34997 34998 34999 35000 35001 | test clock-29.1800 {time parsing} { clock scan {2440588 xi:lix:lix pm} \ -gmt true -locale en_US_roman \ -format {%J %Ol:%OM:%OS %P} } 86399 # END testcases29 test clock-30.1 {clock add years} { set t [clock scan 2000-01-01 -format %Y-%m-%d -timezone :UTC] set f [clock add $t 1 year -timezone :UTC] clock format $f -format %Y-%m-%d -timezone :UTC } {2001-01-01} test clock-30.2 {clock add years - leap day} { set t [clock scan 2000-02-29 -format %Y-%m-%d -timezone :UTC] | > > > > | 34988 34989 34990 34991 34992 34993 34994 34995 34996 34997 34998 34999 35000 35001 35002 35003 35004 35005 | test clock-29.1800 {time parsing} { clock scan {2440588 xi:lix:lix pm} \ -gmt true -locale en_US_roman \ -format {%J %Ol:%OM:%OS %P} } 86399 # END testcases29 # BEGIN testcases30 # Test [clock add] test clock-30.1 {clock add years} { set t [clock scan 2000-01-01 -format %Y-%m-%d -timezone :UTC] set f [clock add $t 1 year -timezone :UTC] clock format $f -format %Y-%m-%d -timezone :UTC } {2001-01-01} test clock-30.2 {clock add years - leap day} { set t [clock scan 2000-02-29 -format %Y-%m-%d -timezone :UTC] |
︙ | ︙ | |||
35214 35215 35216 35217 35218 35219 35220 35221 35222 35223 35224 35225 35226 35227 | set t [clock scan {2004-10-31 01:00:00 -0400} \ -format {%Y-%m-%d %H:%M:%S %z} \ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00] set f1 [clock add $t 3600 seconds -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00] set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00] } {2004-10-31 01:00:00 -0500} test clock-31.1 {system locale} \ -constraints win \ -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 35218 35219 35220 35221 35222 35223 35224 35225 35226 35227 35228 35229 35230 35231 35232 35233 35234 35235 35236 35237 35238 35239 35240 35241 35242 35243 35244 35245 35246 35247 35248 35249 35250 35251 35252 35253 35254 35255 35256 35257 35258 35259 35260 35261 35262 35263 35264 35265 35266 35267 35268 35269 35270 35271 35272 35273 35274 35275 35276 35277 35278 35279 35280 35281 35282 | set t [clock scan {2004-10-31 01:00:00 -0400} \ -format {%Y-%m-%d %H:%M:%S %z} \ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00] set f1 [clock add $t 3600 seconds -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00] set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00] } {2004-10-31 01:00:00 -0500} test clock-30.26 {clock add weekdays} { set t [clock scan {2013-11-20}] ;# Wednesday set f1 [clock add $t 3 weekdays] set x1 [clock format $f1 -format {%Y-%m-%d}] } {2013-11-25} test clock-30.27 {clock add weekdays starting on Saturday} { set t [clock scan {2013-11-23}] ;# Saturday set f1 [clock add $t 1 weekday] set x1 [clock format $f1 -format {%Y-%m-%d}] } {2013-11-25} test clock-30.28 {clock add weekdays starting on Sunday} { set t [clock scan {2013-11-24}] ;# Sunday set f1 [clock add $t 1 weekday] set x1 [clock format $f1 -format {%Y-%m-%d}] } {2013-11-25} test clock-30.29 {clock add 0 weekdays starting on a weekend} { set t [clock scan {2016-02-27}] ;# Saturday set f1 [clock add $t 0 weekdays] set x1 [clock format $f1 -format {%Y-%m-%d}] } {2016-02-27} test clock-30.30 {clock add weekdays and back} -body { set n [clock seconds] # we start on each day of the week for {set i 0} {$i < 7} {incr i} { set start [clock add $n $i days] set startu [clock format $start -format %u] # add 0 - 100 weekdays for {set j 0} {$j < 100} {incr j} { set forth [clock add $start $j weekdays] set back [clock add $forth -$j weekdays] # If $s was a weekday or $j was 0, $b must be the same day. # Otherwise, $b must be the immediately preceeding Friday set fail 0 if {$j == 0 || $startu < 6} { if {$start != $back} { set fail 1} } else { set friday [clock add $start -[expr {$startu % 5}] days] if {$friday != $back} { set fail 1 } } if {$fail} { set sdate [clock format $start -format {%Y-%m-%d}] set bdate [clock format $back -format {%Y-%m-%d}] return "$sdate + $j - $j := $bdate" } } } return "OK" } -result {OK} # END testcases30 test clock-31.1 {system locale} \ -constraints win \ -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } |
︙ | ︙ |
Changes to tests/zlib.test.
︙ | ︙ | |||
871 872 873 874 875 876 877 878 879 880 881 882 883 884 | set f [open $file rb] set d [read $f] close $f zlib gunzip $d -header noSuchNs::foo } -cleanup { removeFile $file } -returnCodes error -result {can't set "noSuchNs::foo": parent namespace doesn't exist} ::tcltest::cleanupTests return # Local Variables: # mode: tcl # End: | > > > > > > > > > > > > > > > > > > | 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | set f [open $file rb] set d [read $f] close $f zlib gunzip $d -header noSuchNs::foo } -cleanup { removeFile $file } -returnCodes error -result {can't set "noSuchNs::foo": parent namespace doesn't exist} test zlib-12.1 {Tk Bug 9eb55debc5} -constraints zlib -setup { set stream [zlib stream compress] } -body { for {set opts {};set y 0} {$y < 60} {incr y} { for {set line {};set x 0} {$x < 100} {incr x} { append line [binary format ccc $x $y 128] } if {$y == 59} { set opts -finalize } $stream put {*}$opts $line } set data [$stream get] list [string length $data] [string length [zlib decompress $data]] } -cleanup { $stream close } -result {12026 18000} ::tcltest::cleanupTests return # Local Variables: # mode: tcl # End: |
Changes to unix/tclUnixThrd.c.
︙ | ︙ | |||
619 620 621 622 623 624 625 | #ifdef TCL_THREADS /* * Additions by AOL for specialized thread memory allocator. */ #ifdef USE_THREAD_ALLOC | < | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | #ifdef TCL_THREADS /* * Additions by AOL for specialized thread memory allocator. */ #ifdef USE_THREAD_ALLOC static pthread_key_t key; typedef struct { Tcl_Mutex tlock; pthread_mutex_t plock; } allocMutex; |
︙ | ︙ | |||
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | allocMutex* lockPtr = (allocMutex*) mutex; if (!lockPtr) { return; } pthread_mutex_destroy(&lockPtr->plock); free(lockPtr); } void TclpFreeAllocCache( void *ptr) { if (ptr != NULL) { /* * Called by the pthread lib when a thread exits */ TclFreeAllocCache(ptr); pthread_setspecific(key, NULL); | > > > > > > > > | < < < < < < < < < < < < < < | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | allocMutex* lockPtr = (allocMutex*) mutex; if (!lockPtr) { return; } pthread_mutex_destroy(&lockPtr->plock); free(lockPtr); } void TclpInitAllocCache(void) { pthread_mutex_lock(allocLockPtr); pthread_key_create(&key, TclpFreeAllocCache); pthread_mutex_unlock(allocLockPtr); } void TclpFreeAllocCache( void *ptr) { if (ptr != NULL) { /* * Called by the pthread lib when a thread exits */ TclFreeAllocCache(ptr); pthread_setspecific(key, NULL); } else { pthread_key_delete(key); } } void * TclpGetAllocCache(void) { return pthread_getspecific(key); } void TclpSetAllocCache( void *arg) { |
︙ | ︙ |
Changes to win/coffbase.txt.
︙ | ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 | tdom 0x109E0000 0x00080000 tclvfs 0x10A70000 0x00010000 tkvideo 0x10B00000 0x00010000 tclsdl 0x10B20000 0x00080000 vqtcl 0x10C00000 0x00010000 tdbc 0x10C40000 0x00010000 thread 0x10C80000 0x00020000 ; ; insert new packages here ; snack 0x1E000000 0x00400000 sound 0x1E400000 0x00400000 snackogg 0x1E800000 0x00200000 | > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | tdom 0x109E0000 0x00080000 tclvfs 0x10A70000 0x00010000 tkvideo 0x10B00000 0x00010000 tclsdl 0x10B20000 0x00080000 vqtcl 0x10C00000 0x00010000 tdbc 0x10C40000 0x00010000 thread 0x10C80000 0x00020000 nsf 0x10ca0000 0x00080000 ; ; insert new packages here ; snack 0x1E000000 0x00400000 sound 0x1E400000 0x00400000 snackogg 0x1E800000 0x00200000 |
Changes to win/tclWinNotify.c.
︙ | ︙ | |||
47 48 49 50 51 52 53 | * notifiers. It controls the lifetime of the TclNotifier window class. * * You must hold the notifierMutex lock before accessing this variable. */ static int notifierCount = 0; static const TCHAR className[] = TEXT("TclNotifier"); | > | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | * notifiers. It controls the lifetime of the TclNotifier window class. * * You must hold the notifierMutex lock before accessing this variable. */ static int notifierCount = 0; static const TCHAR className[] = TEXT("TclNotifier"); static int initialized = 0; static CRITICAL_SECTION notifierMutex; /* * Static routines defined in this file. */ static LRESULT CALLBACK NotifierProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); |
︙ | ︙ | |||
81 82 83 84 85 86 87 88 89 90 91 92 | { if (tclNotifierHooks.initNotifierProc) { return tclNotifierHooks.initNotifierProc(); } else { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); WNDCLASS class; /* * Register Notifier window class if this is the first thread to use * this module. */ | > > > > > > > | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | { if (tclNotifierHooks.initNotifierProc) { return tclNotifierHooks.initNotifierProc(); } else { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); WNDCLASS class; TclpMasterLock(); if (!initialized) { initialized = 1; InitializeCriticalSection(¬ifierMutex); } TclpMasterUnlock(); /* * Register Notifier window class if this is the first thread to use * this module. */ EnterCriticalSection(¬ifierMutex); if (notifierCount == 0) { class.style = 0; class.cbClsExtra = 0; class.cbWndExtra = 0; class.hInstance = TclWinGetTclInstance(); class.hbrBackground = NULL; class.lpszMenuName = NULL; class.lpszClassName = className; class.lpfnWndProc = NotifierProc; class.hIcon = NULL; class.hCursor = NULL; if (!RegisterClass(&class)) { Tcl_Panic("Unable to register TclNotifier window class"); } } notifierCount++; LeaveCriticalSection(¬ifierMutex); tsdPtr->pending = 0; tsdPtr->timerActive = 0; InitializeCriticalSection(&tsdPtr->crit); tsdPtr->hwnd = NULL; |
︙ | ︙ | |||
179 180 181 182 183 184 185 | } /* * If this is the last thread to use the notifier, unregister the * notifier window class. */ | | > | | | | > | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | } /* * If this is the last thread to use the notifier, unregister the * notifier window class. */ EnterCriticalSection(¬ifierMutex); if (notifierCount) { notifierCount--; if (notifierCount == 0) { UnregisterClass(className, TclWinGetTclInstance()); } } LeaveCriticalSection(¬ifierMutex); } } /* *---------------------------------------------------------------------- * * Tcl_AlertNotifier -- |
︙ | ︙ |
Changes to win/tclWinThrd.c.
︙ | ︙ | |||
113 114 115 116 117 118 119 | } WinCondition; /* * Additions by AOL for specialized thread memory allocator. */ #ifdef USE_THREAD_ALLOC | < | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | } WinCondition; /* * Additions by AOL for specialized thread memory allocator. */ #ifdef USE_THREAD_ALLOC static DWORD tlsKey; typedef struct { Tcl_Mutex tlock; CRITICAL_SECTION wlock; } allocMutex; #endif /* USE_THREAD_ALLOC */ |
︙ | ︙ | |||
961 962 963 964 965 966 967 968 969 970 971 972 | if (!lockPtr) { return; } DeleteCriticalSection(&lockPtr->wlock); free(lockPtr); } void * TclpGetAllocCache(void) { void *result; | > > > > > > > > > > > > > > < < < < < < < < < < < < < < | 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | if (!lockPtr) { return; } DeleteCriticalSection(&lockPtr->wlock); free(lockPtr); } void TclpInitAllocCache(void) { /* * We need to make sure that TclpFreeAllocCache is called on each * thread that calls this, but only on threads that call this. */ tlsKey = TlsAlloc(); if (tlsKey == TLS_OUT_OF_INDEXES) { Tcl_Panic("could not allocate thread local storage"); } } void * TclpGetAllocCache(void) { void *result; result = TlsGetValue(tlsKey); if ((result == NULL) && (GetLastError() != NO_ERROR)) { Tcl_Panic("TlsGetValue failed from TclpGetAllocCache"); } return result; } |
︙ | ︙ | |||
1015 1016 1017 1018 1019 1020 1021 | */ TclFreeAllocCache(ptr); success = TlsSetValue(tlsKey, NULL); if (!success) { Tcl_Panic("TlsSetValue failed from TclpFreeAllocCache"); } | | < < | 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | */ TclFreeAllocCache(ptr); success = TlsSetValue(tlsKey, NULL); if (!success) { Tcl_Panic("TlsSetValue failed from TclpFreeAllocCache"); } } else { /* * Called by us in TclFinalizeThreadAlloc() during the library * finalization initiated from Tcl_Finalize() */ success = TlsFree(tlsKey); if (!success) { Tcl_Panic("TlsFree failed from TclpFreeAllocCache"); } } } #endif /* USE_THREAD_ALLOC */ void * TclpThreadCreateKey(void) { |
︙ | ︙ |