From 61855b36b423d2293d99ccb6381e6622980e2cd9 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 25 Nov 2014 21:24:06 +0000 Subject: One way to fix the parser of $-substitution accepting non-ASCII varnames. --- generic/tclParse.c | 3 +++ tests/parse.test | 3 +++ 2 files changed, 6 insertions(+) diff --git a/generic/tclParse.c b/generic/tclParse.c index e475fb8..1523eb3 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -1438,6 +1438,9 @@ Tcl_ParseVarName( offset = Tcl_UtfToUniChar(utfBytes, &ch); } c = UCHAR(ch); + if (c != ch) { + break; + } if (isalnum(c) || (c == '_')) { /* INTL: ISO only, UCHAR. */ src += offset; numBytes -= offset; diff --git a/tests/parse.test b/tests/parse.test index d7de5ff..cd02386 100644 --- a/tests/parse.test +++ b/tests/parse.test @@ -656,6 +656,9 @@ test parse-12.24 {Tcl_ParseVarName procedure, missing close paren in array refer test parse-12.25 {Tcl_ParseVarName procedure, nested array reference} testparser { testparser {$x(a$y(b$z))} 0 } {- {$x(a$y(b$z))} 1 word {$x(a$y(b$z))} 8 variable {$x(a$y(b$z))} 7 text x 0 text a 0 variable {$y(b$z)} 4 text y 0 text b 0 variable {$z} 1 text z 0 {}} +test parse-12.26 {Tcl_ParseVarName [d2ffcca163] non-ascii} testparser { + testparser "$\u0433" -1 +} "- {$\u0433} 1 word {$\u0433} 2 text {$} 0 text \u0433 0 {}" test parse-13.1 {Tcl_ParseVar procedure} testparsevar { set abc 24 -- cgit v0.12 From 63678d528b5d4384d8a6fd8941b73888399227e5 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 26 Nov 2014 16:22:40 +0000 Subject: I like this patch better. Retain the byte orientation of the parser. --- generic/tclParse.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/generic/tclParse.c b/generic/tclParse.c index 1523eb3..90ec43d 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -1344,8 +1344,7 @@ Tcl_ParseVarName( Tcl_Token *tokenPtr; register const char *src; unsigned char c; - int varIndex, offset; - Tcl_UniChar ch; + int varIndex; unsigned array; if ((numBytes == 0) || (start == NULL)) { @@ -1428,22 +1427,10 @@ Tcl_ParseVarName( tokenPtr->numComponents = 0; while (numBytes) { - if (Tcl_UtfCharComplete(src, numBytes)) { - offset = Tcl_UtfToUniChar(src, &ch); - } else { - char utfBytes[TCL_UTF_MAX]; - - memcpy(utfBytes, src, (size_t) numBytes); - utfBytes[numBytes] = '\0'; - offset = Tcl_UtfToUniChar(utfBytes, &ch); - } - c = UCHAR(ch); - if (c != ch) { - break; - } + c = UCHAR(*src); if (isalnum(c) || (c == '_')) { /* INTL: ISO only, UCHAR. */ - src += offset; - numBytes -= offset; + src += 1; + numBytes -= 1; continue; } if ((c == ':') && (numBytes != 1) && (src[1] == ':')) { -- cgit v0.12 From f12dc54f7578abc9e2d5f625157263ec5a0bc40e Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 26 Nov 2014 17:00:55 +0000 Subject: Same issue in expr parser also tested and fixed. --- generic/tclCompExpr.c | 32 ++++++++++++-------------------- tests/parseExpr.test | 6 ++++++ 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 9142e2b..dde4e56 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -1969,31 +1969,23 @@ ParseLexeme( } } - if (Tcl_UtfCharComplete(start, numBytes)) { - scanned = Tcl_UtfToUniChar(start, &ch); - } else { - char utfBytes[TCL_UTF_MAX]; - memcpy(utfBytes, start, (size_t) numBytes); - utfBytes[numBytes] = '\0'; - scanned = Tcl_UtfToUniChar(utfBytes, &ch); - } - if (!isalnum(UCHAR(ch))) { - *lexemePtr = INVALID; - Tcl_DecrRefCount(literal); - return scanned; - } - end = start; - while (isalnum(UCHAR(ch)) || (UCHAR(ch) == '_')) { - end += scanned; - numBytes -= scanned; - if (Tcl_UtfCharComplete(end, numBytes)) { - scanned = Tcl_UtfToUniChar(end, &ch); + if (!isalnum(UCHAR(*start))) { + if (Tcl_UtfCharComplete(start, numBytes)) { + scanned = Tcl_UtfToUniChar(start, &ch); } else { char utfBytes[TCL_UTF_MAX]; - memcpy(utfBytes, end, (size_t) numBytes); + memcpy(utfBytes, start, (size_t) numBytes); utfBytes[numBytes] = '\0'; scanned = Tcl_UtfToUniChar(utfBytes, &ch); } + *lexemePtr = INVALID; + Tcl_DecrRefCount(literal); + return scanned; + } + end = start; + while (numBytes && (isalnum(UCHAR(*end)) || (UCHAR(*end) == '_'))) { + end += 1; + numBytes -= 1; } *lexemePtr = BAREWORD; if (literalPtr) { diff --git a/tests/parseExpr.test b/tests/parseExpr.test index c1c489b..3e0df29 100644 --- a/tests/parseExpr.test +++ b/tests/parseExpr.test @@ -1051,6 +1051,12 @@ test parseExpr-22.18 {Bug 3401704} -constraints testexprparser -body { testexprparser 0b02 -1 } -returnCodes error -match glob -result {*invalid binary number*} +test parseExpr-22.19 {Bug d2ffcca163} -constraints testexprparser -body { + testexprparser \u0433 -1 +} -returnCodes error -match glob -result {*invalid character*} +test parseExpr-22.20 {Bug d2ffcca163} -constraints testexprparser -body { + testexprparser \u043f -1 +} -returnCodes error -match glob -result {*invalid character*} # cleanup cleanupTests -- cgit v0.12 From a03c9da848ffd7e60101c43321e05f79635f8cef Mon Sep 17 00:00:00 2001 From: andreask Date: Mon, 1 Dec 2014 20:17:04 +0000 Subject: Fix missing export of the "NewForeachInfoType" AuxData structure for tbcload/tclcompiler packages. --- generic/tclCompile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 3736498..0f4dfaf 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -4342,10 +4342,11 @@ TclInitAuxDataTypeTable(void) Tcl_InitHashTable(&auxDataTypeTable, TCL_STRING_KEYS); /* - * There are only three AuxData types at this time, so register them here. + * There are only four AuxData types at this time, so register them here. */ RegisterAuxDataType(&tclForeachInfoType); + RegisterAuxDataType(&tclNewForeachInfoType); RegisterAuxDataType(&tclJumptableInfoType); RegisterAuxDataType(&tclDictUpdateInfoType); } -- cgit v0.12 From 6e6e7b2c773fb61f034c68c04bf90e48cacce161 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Wed, 3 Dec 2014 13:22:53 +0000 Subject: adding a test for the bug --- tests/compile.test | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/compile.test b/tests/compile.test index 22ebc7d..8150622 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -455,14 +455,22 @@ test compile-13.1 {testing underestimate of maxStackSize in list cmd} {exec} { list [catch {exec [interpreter] << $script} msg] $msg } {0 OK} -# Special test for compiling tokens from a copy of the source string. [Bug -# 599788] +# Tests compile-14.* for compiling tokens from a copy of the source string. +# [Bug 599788] [Bug 0c043a175a47da8c2342] test compile-14.1 {testing errors in element name; segfault?} {} { catch {set a([error])} msg1 catch {set bubba([join $abba $jubba]) $vol} msg2 list $msg1 $msg2 } {{wrong # args: should be "error message ?errorInfo? ?errorCode?"} {can't read "abba": no such variable}} +test compile-14.2 {testing element name "$"} -body { + unset a + set a() 1 + set a($) 2 + list [set a()] [set a($)] [unset a(); lindex [array names a] 0] +} -cleanup {unset a} -result {1 2 $} + + # Tests compile-15.* cover Tcl Bug 633204 test compile-15.1 {proper TCL_RETURN code from [return]} { apply {{} {catch return}} -- cgit v0.12 From 9e5f0ade58641b9719e70838d98e562c867193dd Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 3 Dec 2014 23:05:15 +0000 Subject: [0dca3bfa8f] Strengthen validity checks on fast-path string comparison. --- generic/tclExecute.c | 8 +++++--- tests/stringComp.test | 8 ++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 337a75f..b9da8fc 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5410,8 +5410,8 @@ TEBCresume( s1 = (char *) Tcl_GetByteArrayFromObj(valuePtr, &s1len); s2 = (char *) Tcl_GetByteArrayFromObj(value2Ptr, &s2len); memCmpFn = memcmp; - } else if (((valuePtr->typePtr == &tclStringType) - && (value2Ptr->typePtr == &tclStringType))) { + } else if ((valuePtr->typePtr == &tclStringType) + && (value2Ptr->typePtr == &tclStringType)) { /* * Do a unicode-specific comparison if both of the args are of * String type. If the char length == byte length, we can do a @@ -5422,7 +5422,9 @@ TEBCresume( s1len = Tcl_GetCharLength(valuePtr); s2len = Tcl_GetCharLength(value2Ptr); if ((s1len == valuePtr->length) - && (s2len == value2Ptr->length)) { + && (valuePtr->bytes != NULL) + && (s2len == value2Ptr->length) + && (value2Ptr->bytes != NULL)) { s1 = valuePtr->bytes; s2 = value2Ptr->bytes; memCmpFn = memcmp; diff --git a/tests/stringComp.test b/tests/stringComp.test index f9f6bda..a66525e 100644 --- a/tests/stringComp.test +++ b/tests/stringComp.test @@ -720,6 +720,14 @@ test stringComp-14.2 {Bug 82e7f67325} memory { }} {a b} } } {0} +test stringComp-14.3 {Bug 0dca3bfa8f} { + apply {arg { + set argCopy $arg + set arg [string replace $arg 1 2 aa] + # Crashes in comparison before fix + expr {$arg ne $argCopy} + }} abcde +} 1 ## string tolower ## not yet bc -- cgit v0.12 From 3e76a216e3a989a6dbaefd832a0a2dc795672e2e Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Wed, 3 Dec 2014 23:17:16 +0000 Subject: test and fix (thx dgp) --- generic/tclCompCmds.c | 2 +- tests/compile.test | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 18f4564..4e7ef97 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -3373,7 +3373,7 @@ TclPushVarName( nameChars = p - varTokenPtr[1].start; elName = p + 1; remainingChars = (varTokenPtr[2].start - p) - 1; - elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 2; + elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 1; if (remainingChars) { /* diff --git a/tests/compile.test b/tests/compile.test index 8150622..45d69e9 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -464,11 +464,12 @@ test compile-14.1 {testing errors in element name; segfault?} {} { } {{wrong # args: should be "error message ?errorInfo? ?errorCode?"} {can't read "abba": no such variable}} test compile-14.2 {testing element name "$"} -body { - unset a + unset -nocomplain a set a() 1 - set a($) 2 - list [set a()] [set a($)] [unset a(); lindex [array names a] 0] -} -cleanup {unset a} -result {1 2 $} + set a(1) 2 + set a($) 3 + list [set a()] [set a(1)] [set a($)] [unset a(); lindex [array names a] 0] +} -cleanup {unset a} -result [list 1 2 3 {$}] # Tests compile-15.* cover Tcl Bug 633204 -- cgit v0.12 From 4c172f0d7b93eab8a18f90506049970fc39cf06c Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Wed, 3 Dec 2014 23:34:36 +0000 Subject: missing unset in new test --- tests/compile.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/compile.test b/tests/compile.test index 45d69e9..7335293 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -468,7 +468,7 @@ test compile-14.2 {testing element name "$"} -body { set a() 1 set a(1) 2 set a($) 3 - list [set a()] [set a(1)] [set a($)] [unset a(); lindex [array names a] 0] + list [set a()] [set a(1)] [set a($)] [unset a() a(1); lindex [array names a] 0] } -cleanup {unset a} -result [list 1 2 3 {$}] -- cgit v0.12 From 4250f4411ad9371c8b76ecfbd57007d50115f42c Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 3 Dec 2014 23:54:16 +0000 Subject: Now make the patch by hand that fossil could not merge. --- tests/compile.test | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/compile.test b/tests/compile.test index 7335293..d4a31d4 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -455,8 +455,7 @@ test compile-13.1 {testing underestimate of maxStackSize in list cmd} {exec} { list [catch {exec [interpreter] << $script} msg] $msg } {0 OK} -# Tests compile-14.* for compiling tokens from a copy of the source string. -# [Bug 599788] [Bug 0c043a175a47da8c2342] +# Tests compile-14.* for [Bug 599788] [Bug 0c043a175a47da8c2342] test compile-14.1 {testing errors in element name; segfault?} {} { catch {set a([error])} msg1 catch {set bubba([join $abba $jubba]) $vol} msg2 -- cgit v0.12 From f9fb8c8daf918e57d3a50a0428623a5e5c260e70 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 4 Dec 2014 18:26:31 +0000 Subject: Stop using isalnum(.). Its results are not portable. Replace with our own private routine TclIsBareword() that does exactly what we want. --- generic/tclCompExpr.c | 15 ++++++++++----- generic/tclInt.h | 1 + generic/tclParse.c | 47 +++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 54 insertions(+), 9 deletions(-) diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index dde4e56..2470931 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -1920,8 +1920,7 @@ ParseLexeme( literal = Tcl_NewObj(); if (TclParseNumber(NULL, literal, NULL, start, numBytes, &end, TCL_PARSE_NO_WHITESPACE) == TCL_OK) { - if (end < start + numBytes && !isalnum(UCHAR(*end)) - && UCHAR(*end) != '_') { + if (end < start + numBytes && !TclIsBareword(*end)) { number: TclInitStringRep(literal, start, end-start); @@ -1945,7 +1944,7 @@ ParseLexeme( if (literal->typePtr == &tclDoubleType) { const char *p = start; while (p < end) { - if (!isalnum(UCHAR(*p++))) { + if (!TclIsBareword(*p++)) { /* * The number has non-bareword characters, so we * must treat it as a number. @@ -1969,7 +1968,13 @@ ParseLexeme( } } - if (!isalnum(UCHAR(*start))) { + /* + * We reject leading underscores in bareword. No sensible reason why. + * Might be inspired by reserved identifier rules in C, which of course + * have no direct relevance here. + */ + + if (!TclIsBareword(*start) || *start == '_') { if (Tcl_UtfCharComplete(start, numBytes)) { scanned = Tcl_UtfToUniChar(start, &ch); } else { @@ -1983,7 +1988,7 @@ ParseLexeme( return scanned; } end = start; - while (numBytes && (isalnum(UCHAR(*end)) || (UCHAR(*end) == '_'))) { + while (numBytes && TclIsBareword(*end)) { end += 1; numBytes -= 1; } diff --git a/generic/tclInt.h b/generic/tclInt.h index dd66d76..255ee23 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2608,6 +2608,7 @@ MODULE_SCOPE void TclInitSubsystems(void); MODULE_SCOPE int TclInterpReady(Tcl_Interp *interp); MODULE_SCOPE int TclIsLocalScalar(const char *src, int len); MODULE_SCOPE int TclIsSpaceProc(char byte); +MODULE_SCOPE int TclIsBareword(char byte); MODULE_SCOPE int TclJoinThread(Tcl_ThreadId id, int *result); MODULE_SCOPE void TclLimitRemoveAllHandlers(Tcl_Interp *interp); MODULE_SCOPE Tcl_Obj * TclLindexList(Tcl_Interp *interp, diff --git a/generic/tclParse.c b/generic/tclParse.c index 90ec43d..025304c 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -628,6 +628,47 @@ TclIsSpaceProc( /* *---------------------------------------------------------------------- * + * TclIsBareword-- + * + * Report whether byte is one that can be part of a "bareword". + * This concept is named in expression parsing, where it determines + * what can be a legal function name, but is the same definition used + * in determining what variable names can be parsed as variable + * substitutions without the benefit of enclosing braces. The set of + * ASCII chars that are accepted are the numeric chars ('0'-'9'), + * the alphabetic chars ('a'-'z', 'A'-'Z') and underscore ('_'). + * + * Results: + * Returns 1, if byte is in the accepted set of chars, 0 otherwise. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclIsBareword( + char byte) +{ + if (byte < '0' || byte > 'z') { + return 0; + } + if (byte <= '9' || byte >= 'a') { + return 1; + } + if (byte == '_') { + return 1; + } + if (byte < 'A' || byte > 'Z') { + return 0; + } + return 1; +} + +/* + *---------------------------------------------------------------------- + * * ParseWhiteSpace -- * * Scans up to numBytes bytes starting at src, consuming white space @@ -1343,7 +1384,6 @@ Tcl_ParseVarName( { Tcl_Token *tokenPtr; register const char *src; - unsigned char c; int varIndex; unsigned array; @@ -1427,13 +1467,12 @@ Tcl_ParseVarName( tokenPtr->numComponents = 0; while (numBytes) { - c = UCHAR(*src); - if (isalnum(c) || (c == '_')) { /* INTL: ISO only, UCHAR. */ + if (TclIsBareword(*src)) { src += 1; numBytes -= 1; continue; } - if ((c == ':') && (numBytes != 1) && (src[1] == ':')) { + if ((src[0] == ':') && (numBytes != 1) && (src[1] == ':')) { src += 2; numBytes -= 2; while (numBytes && (*src == ':')) { -- cgit v0.12 From c4c311b0e2ca10bc95a35e3f60d9a939b55c26e4 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 4 Dec 2014 20:45:11 +0000 Subject: The isalpha(.) calls remaining in the expr parser still bring nonportability. Commit a test that demonstrates that. --- tests/parseExpr.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/parseExpr.test b/tests/parseExpr.test index 3e0df29..c3b0d71 100644 --- a/tests/parseExpr.test +++ b/tests/parseExpr.test @@ -1057,6 +1057,9 @@ test parseExpr-22.19 {Bug d2ffcca163} -constraints testexprparser -body { test parseExpr-22.20 {Bug d2ffcca163} -constraints testexprparser -body { testexprparser \u043f -1 } -returnCodes error -match glob -result {*invalid character*} +test parseExpr-22.21 {Bug d2ffcca163} -constraints testexprparser -body { + testexprparser in\u0433(0) -1 +} -returnCodes error -match glob -result {missing operand*} # cleanup cleanupTests -- cgit v0.12 From 640e5762bc7e0aa585f1135dde28e2fa9434e79e Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 4 Dec 2014 21:29:18 +0000 Subject: Limit isalpha(.) calls in the expr parser to only apply to known ASCII arguments to make the results portable. --- generic/tclCompExpr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 2470931..7b67970 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -1883,7 +1883,7 @@ ParseLexeme( case 'i': if ((numBytes > 1) && (start[1] == 'n') - && ((numBytes == 2) || !isalpha(UCHAR(start[2])))) { + && ((numBytes == 2) || start[2] & 0x80 || !isalpha(start[2]))) { /* * Must make this check so we can tell the difference between @@ -1898,14 +1898,15 @@ ParseLexeme( case 'e': if ((numBytes > 1) && (start[1] == 'q') - && ((numBytes == 2) || !isalpha(UCHAR(start[2])))) { + && ((numBytes == 2) || start[2] & 0x80 || !isalpha(start[2]))) { *lexemePtr = STREQ; return 2; } break; case 'n': - if ((numBytes > 1) && ((numBytes == 2) || !isalpha(UCHAR(start[2])))) { + if ((numBytes > 1) + && ((numBytes == 2) || start[2] & 0x80 || !isalpha(start[2]))) { switch (start[1]) { case 'e': *lexemePtr = STRNEQ; -- cgit v0.12 From 9bc29d1afe15b7443e80d244c358d0c77ccab126 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 5 Dec 2014 21:05:17 +0000 Subject: Ever since (Tcl)PushVarName() stopped making a recursive call to Tcl_ParseCommand() (in the pre-8.4.0 timeframe), there's been no need for special protections for brace-quoted varname words. A simple word is a simple word is a simple word. --- generic/tclCompCmds.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 2f72263..c8ca828 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -4890,16 +4890,7 @@ PushVarName( nameChars = elNameChars = 0; localIndex = -1; - /* - * Check not only that the type is TCL_TOKEN_SIMPLE_WORD, but whether - * curly braces surround the variable name. This really matters for array - * elements to handle things like - * set {x($foo)} 5 - * which raises an undefined var error if we are not careful here. - */ - - if ((varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) && - (varTokenPtr->start[0] != '{')) { + if (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { /* * A simple variable name. Divide it up into "name" and "elName" * strings. If it is not a local variable, look it up at runtime. -- cgit v0.12 From 2b5841cce3dace5f052236b0f3770263222d426d Mon Sep 17 00:00:00 2001 From: ashok Date: Sat, 6 Dec 2014 11:19:32 +0000 Subject: Potential fix for [c6ed4acfd8]. Simple typo in original fix for [336441ed59]. Was looping on statePtr->next instead of statePtr2->next. Would result in an infinite loop. Definitely a bug but whether it completely fixes the above in all cases needs to be tested. --- win/tclWinSock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 2c58224..f5658ba 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1739,7 +1739,7 @@ TcpConnect( */ for (statePtr2 = tsdPtr->socketList; statePtr2 != NULL; - statePtr2 = statePtr->nextPtr) { + statePtr2 = statePtr2->nextPtr) { if (statePtr2 == statePtr) { in_socket_list = 1; break; -- cgit v0.12 From 0bd2a5add3396f7f6bcc4deff75bf70de91d384e Mon Sep 17 00:00:00 2001 From: oehhar Date: Sun, 7 Dec 2014 12:17:24 +0000 Subject: test for bug [c6ed4acfd8]: running async socket connect with other connect established will block tcl as it goes in an infinite loop in vwait --- tests/socket.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/socket.test b/tests/socket.test index eeea044..4f90e51 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -2343,6 +2343,24 @@ test socket-14.17 {empty -sockname while [socket -async] connecting} \ catch {close $client} } -result {} +# test for bug c6ed4acfd8: running async socket connect with other connect +# established will block tcl as it goes in an infinite loop in vwait +test socket-14.18 {bug c6ed4acfd8: running async socket connect made other connect block} \ + -constraints {socket} \ + -body { + proc accept {channel address port} {} + set port [randport] + set ssock [socket -server accept $port] + set csock1 [socket -async localhost [randport]] + set csock2 [socket localhost $port] + after 1000 {set done ok} + vwait done +} -cleanup { + catch {close $ssock} + catch {close $csock1} + catch {close $csock2} + } -result {} + set num 0 set x {localhost {socket} 127.0.0.1 {supported_inet} ::1 {supported_inet6}} -- cgit v0.12 From d86c0849b3c0ed313c45e7fb28c62df8577fb690 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 8 Dec 2014 16:05:19 +0000 Subject: Fix some gcc compiler warnings (probably cygwin-only) --- generic/tclCompExpr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 7b67970..23dc0a4 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -1883,7 +1883,7 @@ ParseLexeme( case 'i': if ((numBytes > 1) && (start[1] == 'n') - && ((numBytes == 2) || start[2] & 0x80 || !isalpha(start[2]))) { + && ((numBytes == 2) || start[2] & 0x80 || !isalpha(UCHAR(start[2])))) { /* * Must make this check so we can tell the difference between @@ -1898,7 +1898,7 @@ ParseLexeme( case 'e': if ((numBytes > 1) && (start[1] == 'q') - && ((numBytes == 2) || start[2] & 0x80 || !isalpha(start[2]))) { + && ((numBytes == 2) || start[2] & 0x80 || !isalpha(UCHAR(start[2])))) { *lexemePtr = STREQ; return 2; } @@ -1906,7 +1906,7 @@ ParseLexeme( case 'n': if ((numBytes > 1) - && ((numBytes == 2) || start[2] & 0x80 || !isalpha(start[2]))) { + && ((numBytes == 2) || start[2] & 0x80 || !isalpha(UCHAR(start[2])))) { switch (start[1]) { case 'e': *lexemePtr = STRNEQ; -- cgit v0.12 From 79a19a1fcbb36bd0b0e41da53fda3ee8be77efc9 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 9 Dec 2014 20:29:09 +0000 Subject: [e711ffb458] Replace TclIsLocalScalar() (which does the wrong thing).... with PushVarNameWord() (which doesn't) in the compiler for [dict lappend]. --- generic/tclCompCmds.c | 18 ++++++------------ generic/tclCompile.c | 4 ++-- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index c8ca828..7ecdc9b 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1284,32 +1284,26 @@ TclCompileDictLappendCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Proc *procPtr = envPtr->procPtr; - DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *keyTokenPtr, *valueTokenPtr; - int dictVarIndex, nameChars; - const char *name; + int isSimple, dictVarIndex = -1, isScalar = 0; + DefineLineInformation; /* TIP #280 */ /* * There must be three arguments after the command. */ - if (parsePtr->numWords != 4 || procPtr == NULL) { + if (parsePtr->numWords != 4) { return TCL_ERROR; } varTokenPtr = TokenAfter(parsePtr->tokenPtr); keyTokenPtr = TokenAfter(varTokenPtr); valueTokenPtr = TokenAfter(keyTokenPtr); - if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - name = varTokenPtr[1].start; - nameChars = varTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { + PushVarNameWord(interp, varTokenPtr, envPtr, TCL_CREATE_VAR, + &dictVarIndex, &isSimple, &isScalar, 1); + if (!isScalar || dictVarIndex < 0) { return TCL_ERROR; } - dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, procPtr); CompileWord(envPtr, keyTokenPtr, interp, 2); CompileWord(envPtr, valueTokenPtr, interp, 3); TclEmitInstInt4( INST_DICT_LAPPEND, dictVarIndex, envPtr); diff --git a/generic/tclCompile.c b/generic/tclCompile.c index f982359..5030f89 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2288,8 +2288,8 @@ TclFindCompiledLocal( * scalar or array variable. If NULL, a * temporary var should be created. */ int nameBytes, /* Number of bytes in the name. */ - int create, /* If 1, allocate a local frame entry for the - * variable if it is new. */ + int create, /* If non-zero, allocate a local frame entry + * for the variable if it is new. */ register Proc *procPtr) /* Points to structure describing procedure * containing the variable reference. */ { -- cgit v0.12 From 2f98d437c6f6fe174b88cd5e65eba288e0f3128a Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 9 Dec 2014 20:45:30 +0000 Subject: [e711ffb458] Replace TclIsLocalScalar() with PushVarNameWord() in the compiler for [dict set]. --- generic/tclCompCmds.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 7ecdc9b..ec22f65 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -683,17 +683,15 @@ TclCompileDictSetCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; - Proc *procPtr = envPtr->procPtr; - DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; - int i, dictVarIndex, nameChars; - const char *name; + int i, isSimple, isScalar = 0, dictVarIndex = -1; + DefineLineInformation; /* TIP #280 */ /* - * There must be at least one argument after the command. + * There must be at least three arguments after the (sub-)command. */ - if (parsePtr->numWords < 4 || procPtr == NULL) { + if (parsePtr->numWords < 4) { return TCL_ERROR; } @@ -704,15 +702,11 @@ TclCompileDictSetCmd( */ varTokenPtr = TokenAfter(parsePtr->tokenPtr); - if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - name = varTokenPtr[1].start; - nameChars = varTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { + PushVarNameWord(interp, varTokenPtr, envPtr, TCL_CREATE_VAR, + &dictVarIndex, &isSimple, &isScalar, 1); + if (!isScalar || dictVarIndex < 0) { return TCL_ERROR; } - dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, procPtr); /* * Remaining words (key path and value to set) can be handled normally. -- cgit v0.12 From 1e6f6d54a987ed1bcde041eac5d702960b163515 Mon Sep 17 00:00:00 2001 From: venkat Date: Wed, 10 Dec 2014 00:35:37 +0000 Subject: tzdata2014j from ietf.org --- library/tzdata/Africa/Addis_Ababa | 8 +- library/tzdata/Africa/Asmara | 9 +- library/tzdata/Africa/Bangui | 7 +- library/tzdata/Africa/Bissau | 2 +- library/tzdata/Africa/Blantyre | 7 +- library/tzdata/Africa/Brazzaville | 7 +- library/tzdata/Africa/Bujumbura | 7 +- library/tzdata/Africa/Dar_es_Salaam | 9 +- library/tzdata/Africa/Djibouti | 7 +- library/tzdata/Africa/Douala | 7 +- library/tzdata/Africa/Gaborone | 10 +- library/tzdata/Africa/Harare | 7 +- library/tzdata/Africa/Kampala | 10 +- library/tzdata/Africa/Kigali | 7 +- library/tzdata/Africa/Kinshasa | 7 +- library/tzdata/Africa/Libreville | 7 +- library/tzdata/Africa/Luanda | 8 +- library/tzdata/Africa/Lubumbashi | 7 +- library/tzdata/Africa/Lusaka | 7 +- library/tzdata/Africa/Malabo | 8 +- library/tzdata/Africa/Maseru | 9 +- library/tzdata/Africa/Mbabane | 7 +- library/tzdata/Africa/Mogadishu | 9 +- library/tzdata/Africa/Niamey | 9 +- library/tzdata/Africa/Porto-Novo | 8 +- library/tzdata/America/Grand_Turk | 171 +----------------- library/tzdata/America/Jamaica | 3 +- library/tzdata/Antarctica/Troll | 196 +++++++++++++++++++++ library/tzdata/Asia/Chita | 71 ++++++++ library/tzdata/Asia/Dhaka | 2 +- library/tzdata/Asia/Ho_Chi_Minh | 13 +- library/tzdata/Asia/Irkutsk | 6 +- library/tzdata/Asia/Krasnoyarsk | 4 +- library/tzdata/Asia/Novokuznetsk | 4 +- library/tzdata/Asia/Omsk | 4 +- library/tzdata/Asia/Phnom_Penh | 10 +- library/tzdata/Asia/Pyongyang | 8 +- library/tzdata/Asia/Samarkand | 4 +- library/tzdata/Asia/Seoul | 33 ++-- library/tzdata/Asia/Srednekolymsk | 71 ++++++++ library/tzdata/Asia/Tbilisi | 6 +- library/tzdata/Asia/Vientiane | 10 +- library/tzdata/Asia/Vladivostok | 4 +- library/tzdata/Asia/Yakutsk | 4 +- library/tzdata/Asia/Yekaterinburg | 3 +- library/tzdata/Atlantic/Azores | 2 +- library/tzdata/Atlantic/Madeira | 2 +- library/tzdata/Europe/Lisbon | 6 +- library/tzdata/Europe/Minsk | 1 + library/tzdata/Europe/Riga | 14 +- library/tzdata/Europe/Samara | 4 +- library/tzdata/Indian/Antananarivo | 9 +- library/tzdata/Indian/Comoro | 7 +- library/tzdata/Indian/Mayotte | 7 +- library/tzdata/Pacific/Bougainville | 10 ++ library/tzdata/Pacific/Fiji | 342 ++++++++++++++++++------------------ 56 files changed, 678 insertions(+), 543 deletions(-) create mode 100644 library/tzdata/Antarctica/Troll create mode 100644 library/tzdata/Asia/Chita create mode 100644 library/tzdata/Asia/Srednekolymsk create mode 100644 library/tzdata/Pacific/Bougainville diff --git a/library/tzdata/Africa/Addis_Ababa b/library/tzdata/Africa/Addis_Ababa index 4b92483..7aa5653 100644 --- a/library/tzdata/Africa/Addis_Ababa +++ b/library/tzdata/Africa/Addis_Ababa @@ -1,7 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Addis_Ababa) { - {-9223372036854775808 9288 0 LMT} - {-3155682888 9320 0 ADMT} - {-1062210920 10800 0 EAT} +if {![info exists TZData(Africa/Nairobi)]} { + LoadTimeZoneFile Africa/Nairobi } +set TZData(:Africa/Addis_Ababa) $TZData(:Africa/Nairobi) diff --git a/library/tzdata/Africa/Asmara b/library/tzdata/Africa/Asmara index 1f0f13e..3d33c94 100644 --- a/library/tzdata/Africa/Asmara +++ b/library/tzdata/Africa/Asmara @@ -1,8 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Asmara) { - {-9223372036854775808 9332 0 LMT} - {-3155682932 9332 0 AMT} - {-2524530932 9320 0 ADMT} - {-1062210920 10800 0 EAT} +if {![info exists TZData(Africa/Nairobi)]} { + LoadTimeZoneFile Africa/Nairobi } +set TZData(:Africa/Asmara) $TZData(:Africa/Nairobi) diff --git a/library/tzdata/Africa/Bangui b/library/tzdata/Africa/Bangui index 94f5058..0326a6c 100644 --- a/library/tzdata/Africa/Bangui +++ b/library/tzdata/Africa/Bangui @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Bangui) { - {-9223372036854775808 4460 0 LMT} - {-1830388460 3600 0 WAT} +if {![info exists TZData(Africa/Lagos)]} { + LoadTimeZoneFile Africa/Lagos } +set TZData(:Africa/Bangui) $TZData(:Africa/Lagos) diff --git a/library/tzdata/Africa/Bissau b/library/tzdata/Africa/Bissau index d51cb9f..5693228 100644 --- a/library/tzdata/Africa/Bissau +++ b/library/tzdata/Africa/Bissau @@ -2,6 +2,6 @@ set TZData(:Africa/Bissau) { {-9223372036854775808 -3740 0 LMT} - {-1849388260 -3600 0 WAT} + {-1830380260 -3600 0 WAT} {157770000 0 0 GMT} } diff --git a/library/tzdata/Africa/Blantyre b/library/tzdata/Africa/Blantyre index 17b58f4..9a404c5 100644 --- a/library/tzdata/Africa/Blantyre +++ b/library/tzdata/Africa/Blantyre @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Blantyre) { - {-9223372036854775808 8400 0 LMT} - {-2109291600 7200 0 CAT} +if {![info exists TZData(Africa/Maputo)]} { + LoadTimeZoneFile Africa/Maputo } +set TZData(:Africa/Blantyre) $TZData(:Africa/Maputo) diff --git a/library/tzdata/Africa/Brazzaville b/library/tzdata/Africa/Brazzaville index b4e0923..111eff4 100644 --- a/library/tzdata/Africa/Brazzaville +++ b/library/tzdata/Africa/Brazzaville @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Brazzaville) { - {-9223372036854775808 3668 0 LMT} - {-1830387668 3600 0 WAT} +if {![info exists TZData(Africa/Lagos)]} { + LoadTimeZoneFile Africa/Lagos } +set TZData(:Africa/Brazzaville) $TZData(:Africa/Lagos) diff --git a/library/tzdata/Africa/Bujumbura b/library/tzdata/Africa/Bujumbura index c26d053..1e463d8 100644 --- a/library/tzdata/Africa/Bujumbura +++ b/library/tzdata/Africa/Bujumbura @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Bujumbura) { - {-9223372036854775808 7048 0 LMT} - {-2524528648 7200 0 CAT} +if {![info exists TZData(Africa/Maputo)]} { + LoadTimeZoneFile Africa/Maputo } +set TZData(:Africa/Bujumbura) $TZData(:Africa/Maputo) diff --git a/library/tzdata/Africa/Dar_es_Salaam b/library/tzdata/Africa/Dar_es_Salaam index 98151ec..00e8d4e 100644 --- a/library/tzdata/Africa/Dar_es_Salaam +++ b/library/tzdata/Africa/Dar_es_Salaam @@ -1,8 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Dar_es_Salaam) { - {-9223372036854775808 9428 0 LMT} - {-1230777428 10800 0 EAT} - {-694321200 9900 0 BEAUT} - {-284006700 10800 0 EAT} +if {![info exists TZData(Africa/Nairobi)]} { + LoadTimeZoneFile Africa/Nairobi } +set TZData(:Africa/Dar_es_Salaam) $TZData(:Africa/Nairobi) diff --git a/library/tzdata/Africa/Djibouti b/library/tzdata/Africa/Djibouti index 0ec510c..859ea32 100644 --- a/library/tzdata/Africa/Djibouti +++ b/library/tzdata/Africa/Djibouti @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Djibouti) { - {-9223372036854775808 10356 0 LMT} - {-1846291956 10800 0 EAT} +if {![info exists TZData(Africa/Nairobi)]} { + LoadTimeZoneFile Africa/Nairobi } +set TZData(:Africa/Djibouti) $TZData(:Africa/Nairobi) diff --git a/library/tzdata/Africa/Douala b/library/tzdata/Africa/Douala index 301a530..892b16a 100644 --- a/library/tzdata/Africa/Douala +++ b/library/tzdata/Africa/Douala @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Douala) { - {-9223372036854775808 2328 0 LMT} - {-1830386328 3600 0 WAT} +if {![info exists TZData(Africa/Lagos)]} { + LoadTimeZoneFile Africa/Lagos } +set TZData(:Africa/Douala) $TZData(:Africa/Lagos) diff --git a/library/tzdata/Africa/Gaborone b/library/tzdata/Africa/Gaborone index bd38673..56c0772 100644 --- a/library/tzdata/Africa/Gaborone +++ b/library/tzdata/Africa/Gaborone @@ -1,9 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Gaborone) { - {-9223372036854775808 6220 0 LMT} - {-2682294220 5400 0 SAST} - {-2109288600 7200 0 CAT} - {-829526400 10800 1 CAST} - {-813805200 7200 0 CAT} +if {![info exists TZData(Africa/Maputo)]} { + LoadTimeZoneFile Africa/Maputo } +set TZData(:Africa/Gaborone) $TZData(:Africa/Maputo) diff --git a/library/tzdata/Africa/Harare b/library/tzdata/Africa/Harare index 7482b15..644be26 100644 --- a/library/tzdata/Africa/Harare +++ b/library/tzdata/Africa/Harare @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Harare) { - {-9223372036854775808 7452 0 LMT} - {-2109290652 7200 0 CAT} +if {![info exists TZData(Africa/Maputo)]} { + LoadTimeZoneFile Africa/Maputo } +set TZData(:Africa/Harare) $TZData(:Africa/Maputo) diff --git a/library/tzdata/Africa/Kampala b/library/tzdata/Africa/Kampala index 4cc9be1..1fbaffc 100644 --- a/library/tzdata/Africa/Kampala +++ b/library/tzdata/Africa/Kampala @@ -1,9 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Kampala) { - {-9223372036854775808 7780 0 LMT} - {-1309745380 10800 0 EAT} - {-1262314800 9000 0 BEAT} - {-694319400 9900 0 BEAUT} - {-410237100 10800 0 EAT} +if {![info exists TZData(Africa/Nairobi)]} { + LoadTimeZoneFile Africa/Nairobi } +set TZData(:Africa/Kampala) $TZData(:Africa/Nairobi) diff --git a/library/tzdata/Africa/Kigali b/library/tzdata/Africa/Kigali index f723bcd..192e0e8 100644 --- a/library/tzdata/Africa/Kigali +++ b/library/tzdata/Africa/Kigali @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Kigali) { - {-9223372036854775808 7216 0 LMT} - {-1091498416 7200 0 CAT} +if {![info exists TZData(Africa/Maputo)]} { + LoadTimeZoneFile Africa/Maputo } +set TZData(:Africa/Kigali) $TZData(:Africa/Maputo) diff --git a/library/tzdata/Africa/Kinshasa b/library/tzdata/Africa/Kinshasa index 050c1fa..04dc62e 100644 --- a/library/tzdata/Africa/Kinshasa +++ b/library/tzdata/Africa/Kinshasa @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Kinshasa) { - {-9223372036854775808 3672 0 LMT} - {-2276643672 3600 0 WAT} +if {![info exists TZData(Africa/Lagos)]} { + LoadTimeZoneFile Africa/Lagos } +set TZData(:Africa/Kinshasa) $TZData(:Africa/Lagos) diff --git a/library/tzdata/Africa/Libreville b/library/tzdata/Africa/Libreville index 8427551..ba1f686 100644 --- a/library/tzdata/Africa/Libreville +++ b/library/tzdata/Africa/Libreville @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Libreville) { - {-9223372036854775808 2268 0 LMT} - {-1830386268 3600 0 WAT} +if {![info exists TZData(Africa/Lagos)]} { + LoadTimeZoneFile Africa/Lagos } +set TZData(:Africa/Libreville) $TZData(:Africa/Lagos) diff --git a/library/tzdata/Africa/Luanda b/library/tzdata/Africa/Luanda index cd1b29e..8dcd107 100644 --- a/library/tzdata/Africa/Luanda +++ b/library/tzdata/Africa/Luanda @@ -1,7 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Luanda) { - {-9223372036854775808 3176 0 LMT} - {-2461452776 3124 0 AOT} - {-1849395124 3600 0 WAT} +if {![info exists TZData(Africa/Lagos)]} { + LoadTimeZoneFile Africa/Lagos } +set TZData(:Africa/Luanda) $TZData(:Africa/Lagos) diff --git a/library/tzdata/Africa/Lubumbashi b/library/tzdata/Africa/Lubumbashi index bd67221..7da101a 100644 --- a/library/tzdata/Africa/Lubumbashi +++ b/library/tzdata/Africa/Lubumbashi @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Lubumbashi) { - {-9223372036854775808 6592 0 LMT} - {-2276646592 7200 0 CAT} +if {![info exists TZData(Africa/Maputo)]} { + LoadTimeZoneFile Africa/Maputo } +set TZData(:Africa/Lubumbashi) $TZData(:Africa/Maputo) diff --git a/library/tzdata/Africa/Lusaka b/library/tzdata/Africa/Lusaka index ed9c30d..bcf519d 100644 --- a/library/tzdata/Africa/Lusaka +++ b/library/tzdata/Africa/Lusaka @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Lusaka) { - {-9223372036854775808 6788 0 LMT} - {-2109289988 7200 0 CAT} +if {![info exists TZData(Africa/Maputo)]} { + LoadTimeZoneFile Africa/Maputo } +set TZData(:Africa/Lusaka) $TZData(:Africa/Maputo) diff --git a/library/tzdata/Africa/Malabo b/library/tzdata/Africa/Malabo index bec0524..7dcee39 100644 --- a/library/tzdata/Africa/Malabo +++ b/library/tzdata/Africa/Malabo @@ -1,7 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Malabo) { - {-9223372036854775808 2108 0 LMT} - {-1830386108 0 0 GMT} - {-190857600 3600 0 WAT} +if {![info exists TZData(Africa/Lagos)]} { + LoadTimeZoneFile Africa/Lagos } +set TZData(:Africa/Malabo) $TZData(:Africa/Lagos) diff --git a/library/tzdata/Africa/Maseru b/library/tzdata/Africa/Maseru index 21ca968..665f15d 100644 --- a/library/tzdata/Africa/Maseru +++ b/library/tzdata/Africa/Maseru @@ -1,8 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Maseru) { - {-9223372036854775808 6600 0 LMT} - {-2109289800 7200 0 SAST} - {-829526400 10800 1 SAST} - {-813805200 7200 0 SAST} +if {![info exists TZData(Africa/Johannesburg)]} { + LoadTimeZoneFile Africa/Johannesburg } +set TZData(:Africa/Maseru) $TZData(:Africa/Johannesburg) diff --git a/library/tzdata/Africa/Mbabane b/library/tzdata/Africa/Mbabane index 4d174d5..0edb590 100644 --- a/library/tzdata/Africa/Mbabane +++ b/library/tzdata/Africa/Mbabane @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Mbabane) { - {-9223372036854775808 7464 0 LMT} - {-2109290664 7200 0 SAST} +if {![info exists TZData(Africa/Johannesburg)]} { + LoadTimeZoneFile Africa/Johannesburg } +set TZData(:Africa/Mbabane) $TZData(:Africa/Johannesburg) diff --git a/library/tzdata/Africa/Mogadishu b/library/tzdata/Africa/Mogadishu index 570d3ea..4220655 100644 --- a/library/tzdata/Africa/Mogadishu +++ b/library/tzdata/Africa/Mogadishu @@ -1,8 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Mogadishu) { - {-9223372036854775808 10888 0 LMT} - {-2403572488 10800 0 EAT} - {-1230778800 9000 0 BEAT} - {-410236200 10800 0 EAT} +if {![info exists TZData(Africa/Nairobi)]} { + LoadTimeZoneFile Africa/Nairobi } +set TZData(:Africa/Mogadishu) $TZData(:Africa/Nairobi) diff --git a/library/tzdata/Africa/Niamey b/library/tzdata/Africa/Niamey index 40ded06b..278571d 100644 --- a/library/tzdata/Africa/Niamey +++ b/library/tzdata/Africa/Niamey @@ -1,8 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Niamey) { - {-9223372036854775808 508 0 LMT} - {-1830384508 -3600 0 WAT} - {-1131231600 0 0 GMT} - {-315619200 3600 0 WAT} +if {![info exists TZData(Africa/Lagos)]} { + LoadTimeZoneFile Africa/Lagos } +set TZData(:Africa/Niamey) $TZData(:Africa/Lagos) diff --git a/library/tzdata/Africa/Porto-Novo b/library/tzdata/Africa/Porto-Novo index b89cf1b..3fa2b51 100644 --- a/library/tzdata/Africa/Porto-Novo +++ b/library/tzdata/Africa/Porto-Novo @@ -1,7 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Africa/Porto-Novo) { - {-9223372036854775808 628 0 LMT} - {-1830384628 0 0 GMT} - {-1131235200 3600 0 WAT} +if {![info exists TZData(Africa/Lagos)]} { + LoadTimeZoneFile Africa/Lagos } +set TZData(:Africa/Porto-Novo) $TZData(:Africa/Lagos) diff --git a/library/tzdata/America/Grand_Turk b/library/tzdata/America/Grand_Turk index 6c8ea4a..0edcf0b 100644 --- a/library/tzdata/America/Grand_Turk +++ b/library/tzdata/America/Grand_Turk @@ -4,6 +4,7 @@ set TZData(:America/Grand_Turk) { {-9223372036854775808 -17072 0 LMT} {-2524504528 -18431 0 KMT} {-1827687169 -18000 0 EST} + {284014800 -18000 0 EST} {294217200 -14400 1 EDT} {309938400 -18000 0 EST} {325666800 -14400 1 EDT} @@ -77,173 +78,5 @@ set TZData(:America/Grand_Turk) { {1394348400 -14400 1 EDT} {1414908000 -18000 0 EST} {1425798000 -14400 1 EDT} - {1446357600 -18000 0 EST} - {1457852400 -14400 1 EDT} - {1478412000 -18000 0 EST} - {1489302000 -14400 1 EDT} - {1509861600 -18000 0 EST} - {1520751600 -14400 1 EDT} - {1541311200 -18000 0 EST} - {1552201200 -14400 1 EDT} - {1572760800 -18000 0 EST} - {1583650800 -14400 1 EDT} - {1604210400 -18000 0 EST} - {1615705200 -14400 1 EDT} - {1636264800 -18000 0 EST} - {1647154800 -14400 1 EDT} - {1667714400 -18000 0 EST} - {1678604400 -14400 1 EDT} - {1699164000 -18000 0 EST} - {1710054000 -14400 1 EDT} - {1730613600 -18000 0 EST} - {1741503600 -14400 1 EDT} - {1762063200 -18000 0 EST} - {1772953200 -14400 1 EDT} - {1793512800 -18000 0 EST} - {1805007600 -14400 1 EDT} - {1825567200 -18000 0 EST} - {1836457200 -14400 1 EDT} - {1857016800 -18000 0 EST} - {1867906800 -14400 1 EDT} - {1888466400 -18000 0 EST} - {1899356400 -14400 1 EDT} - {1919916000 -18000 0 EST} - {1930806000 -14400 1 EDT} - {1951365600 -18000 0 EST} - {1962860400 -14400 1 EDT} - {1983420000 -18000 0 EST} - {1994310000 -14400 1 EDT} - {2014869600 -18000 0 EST} - {2025759600 -14400 1 EDT} - {2046319200 -18000 0 EST} - {2057209200 -14400 1 EDT} - {2077768800 -18000 0 EST} - {2088658800 -14400 1 EDT} - {2109218400 -18000 0 EST} - {2120108400 -14400 1 EDT} - {2140668000 -18000 0 EST} - {2152162800 -14400 1 EDT} - {2172722400 -18000 0 EST} - {2183612400 -14400 1 EDT} - {2204172000 -18000 0 EST} - {2215062000 -14400 1 EDT} - {2235621600 -18000 0 EST} - {2246511600 -14400 1 EDT} - {2267071200 -18000 0 EST} - {2277961200 -14400 1 EDT} - {2298520800 -18000 0 EST} - {2309410800 -14400 1 EDT} - {2329970400 -18000 0 EST} - {2341465200 -14400 1 EDT} - {2362024800 -18000 0 EST} - {2372914800 -14400 1 EDT} - {2393474400 -18000 0 EST} - {2404364400 -14400 1 EDT} - {2424924000 -18000 0 EST} - {2435814000 -14400 1 EDT} - {2456373600 -18000 0 EST} - {2467263600 -14400 1 EDT} - {2487823200 -18000 0 EST} - {2499318000 -14400 1 EDT} - {2519877600 -18000 0 EST} - {2530767600 -14400 1 EDT} - {2551327200 -18000 0 EST} - {2562217200 -14400 1 EDT} - {2582776800 -18000 0 EST} - {2593666800 -14400 1 EDT} - {2614226400 -18000 0 EST} - {2625116400 -14400 1 EDT} - {2645676000 -18000 0 EST} - {2656566000 -14400 1 EDT} - {2677125600 -18000 0 EST} - {2688620400 -14400 1 EDT} - {2709180000 -18000 0 EST} - {2720070000 -14400 1 EDT} - {2740629600 -18000 0 EST} - {2751519600 -14400 1 EDT} - {2772079200 -18000 0 EST} - {2782969200 -14400 1 EDT} - {2803528800 -18000 0 EST} - {2814418800 -14400 1 EDT} - {2834978400 -18000 0 EST} - {2846473200 -14400 1 EDT} - {2867032800 -18000 0 EST} - {2877922800 -14400 1 EDT} - {2898482400 -18000 0 EST} - {2909372400 -14400 1 EDT} - {2929932000 -18000 0 EST} - {2940822000 -14400 1 EDT} - {2961381600 -18000 0 EST} - {2972271600 -14400 1 EDT} - {2992831200 -18000 0 EST} - {3003721200 -14400 1 EDT} - {3024280800 -18000 0 EST} - {3035775600 -14400 1 EDT} - {3056335200 -18000 0 EST} - {3067225200 -14400 1 EDT} - {3087784800 -18000 0 EST} - {3098674800 -14400 1 EDT} - {3119234400 -18000 0 EST} - {3130124400 -14400 1 EDT} - {3150684000 -18000 0 EST} - {3161574000 -14400 1 EDT} - {3182133600 -18000 0 EST} - {3193023600 -14400 1 EDT} - {3213583200 -18000 0 EST} - {3225078000 -14400 1 EDT} - {3245637600 -18000 0 EST} - {3256527600 -14400 1 EDT} - {3277087200 -18000 0 EST} - {3287977200 -14400 1 EDT} - {3308536800 -18000 0 EST} - {3319426800 -14400 1 EDT} - {3339986400 -18000 0 EST} - {3350876400 -14400 1 EDT} - {3371436000 -18000 0 EST} - {3382930800 -14400 1 EDT} - {3403490400 -18000 0 EST} - {3414380400 -14400 1 EDT} - {3434940000 -18000 0 EST} - {3445830000 -14400 1 EDT} - {3466389600 -18000 0 EST} - {3477279600 -14400 1 EDT} - {3497839200 -18000 0 EST} - {3508729200 -14400 1 EDT} - {3529288800 -18000 0 EST} - {3540178800 -14400 1 EDT} - {3560738400 -18000 0 EST} - {3572233200 -14400 1 EDT} - {3592792800 -18000 0 EST} - {3603682800 -14400 1 EDT} - {3624242400 -18000 0 EST} - {3635132400 -14400 1 EDT} - {3655692000 -18000 0 EST} - {3666582000 -14400 1 EDT} - {3687141600 -18000 0 EST} - {3698031600 -14400 1 EDT} - {3718591200 -18000 0 EST} - {3730086000 -14400 1 EDT} - {3750645600 -18000 0 EST} - {3761535600 -14400 1 EDT} - {3782095200 -18000 0 EST} - {3792985200 -14400 1 EDT} - {3813544800 -18000 0 EST} - {3824434800 -14400 1 EDT} - {3844994400 -18000 0 EST} - {3855884400 -14400 1 EDT} - {3876444000 -18000 0 EST} - {3887334000 -14400 1 EDT} - {3907893600 -18000 0 EST} - {3919388400 -14400 1 EDT} - {3939948000 -18000 0 EST} - {3950838000 -14400 1 EDT} - {3971397600 -18000 0 EST} - {3982287600 -14400 1 EDT} - {4002847200 -18000 0 EST} - {4013737200 -14400 1 EDT} - {4034296800 -18000 0 EST} - {4045186800 -14400 1 EDT} - {4065746400 -18000 0 EST} - {4076636400 -14400 1 EDT} - {4097196000 -18000 0 EST} + {1446361200 -14400 0 AST} } diff --git a/library/tzdata/America/Jamaica b/library/tzdata/America/Jamaica index 682e47c..f752842 100644 --- a/library/tzdata/America/Jamaica +++ b/library/tzdata/America/Jamaica @@ -4,7 +4,8 @@ set TZData(:America/Jamaica) { {-9223372036854775808 -18431 0 LMT} {-2524503169 -18431 0 KMT} {-1827687169 -18000 0 EST} - {136364400 -14400 0 EDT} + {126248400 -18000 0 EST} + {126687600 -14400 1 EDT} {152085600 -18000 0 EST} {162370800 -14400 1 EDT} {183535200 -18000 0 EST} diff --git a/library/tzdata/Antarctica/Troll b/library/tzdata/Antarctica/Troll new file mode 100644 index 0000000..7d2b042 --- /dev/null +++ b/library/tzdata/Antarctica/Troll @@ -0,0 +1,196 @@ +# created by tools/tclZIC.tcl - do not edit + +set TZData(:Antarctica/Troll) { + {-9223372036854775808 0 0 zzz} + {1108166400 0 0 UTC} + {1111885200 7200 1 CEST} + {1130634000 0 0 UTC} + {1143334800 7200 1 CEST} + {1162083600 0 0 UTC} + {1174784400 7200 1 CEST} + {1193533200 0 0 UTC} + {1206838800 7200 1 CEST} + {1224982800 0 0 UTC} + {1238288400 7200 1 CEST} + {1256432400 0 0 UTC} + {1269738000 7200 1 CEST} + {1288486800 0 0 UTC} + {1301187600 7200 1 CEST} + {1319936400 0 0 UTC} + {1332637200 7200 1 CEST} + {1351386000 0 0 UTC} + {1364691600 7200 1 CEST} + {1382835600 0 0 UTC} + {1396141200 7200 1 CEST} + {1414285200 0 0 UTC} + {1427590800 7200 1 CEST} + {1445734800 0 0 UTC} + {1459040400 7200 1 CEST} + {1477789200 0 0 UTC} + {1490490000 7200 1 CEST} + {1509238800 0 0 UTC} + {1521939600 7200 1 CEST} + {1540688400 0 0 UTC} + {1553994000 7200 1 CEST} + {1572138000 0 0 UTC} + {1585443600 7200 1 CEST} + {1603587600 0 0 UTC} + {1616893200 7200 1 CEST} + {1635642000 0 0 UTC} + {1648342800 7200 1 CEST} + {1667091600 0 0 UTC} + {1679792400 7200 1 CEST} + {1698541200 0 0 UTC} + {1711846800 7200 1 CEST} + {1729990800 0 0 UTC} + {1743296400 7200 1 CEST} + {1761440400 0 0 UTC} + {1774746000 7200 1 CEST} + {1792890000 0 0 UTC} + {1806195600 7200 1 CEST} + {1824944400 0 0 UTC} + {1837645200 7200 1 CEST} + {1856394000 0 0 UTC} + {1869094800 7200 1 CEST} + {1887843600 0 0 UTC} + {1901149200 7200 1 CEST} + {1919293200 0 0 UTC} + {1932598800 7200 1 CEST} + {1950742800 0 0 UTC} + {1964048400 7200 1 CEST} + {1982797200 0 0 UTC} + {1995498000 7200 1 CEST} + {2014246800 0 0 UTC} + {2026947600 7200 1 CEST} + {2045696400 0 0 UTC} + {2058397200 7200 1 CEST} + {2077146000 0 0 UTC} + {2090451600 7200 1 CEST} + {2108595600 0 0 UTC} + {2121901200 7200 1 CEST} + {2140045200 0 0 UTC} + {2153350800 7200 1 CEST} + {2172099600 0 0 UTC} + {2184800400 7200 1 CEST} + {2203549200 0 0 UTC} + {2216250000 7200 1 CEST} + {2234998800 0 0 UTC} + {2248304400 7200 1 CEST} + {2266448400 0 0 UTC} + {2279754000 7200 1 CEST} + {2297898000 0 0 UTC} + {2311203600 7200 1 CEST} + {2329347600 0 0 UTC} + {2342653200 7200 1 CEST} + {2361402000 0 0 UTC} + {2374102800 7200 1 CEST} + {2392851600 0 0 UTC} + {2405552400 7200 1 CEST} + {2424301200 0 0 UTC} + {2437606800 7200 1 CEST} + {2455750800 0 0 UTC} + {2469056400 7200 1 CEST} + {2487200400 0 0 UTC} + {2500506000 7200 1 CEST} + {2519254800 0 0 UTC} + {2531955600 7200 1 CEST} + {2550704400 0 0 UTC} + {2563405200 7200 1 CEST} + {2582154000 0 0 UTC} + {2595459600 7200 1 CEST} + {2613603600 0 0 UTC} + {2626909200 7200 1 CEST} + {2645053200 0 0 UTC} + {2658358800 7200 1 CEST} + {2676502800 0 0 UTC} + {2689808400 7200 1 CEST} + {2708557200 0 0 UTC} + {2721258000 7200 1 CEST} + {2740006800 0 0 UTC} + {2752707600 7200 1 CEST} + {2771456400 0 0 UTC} + {2784762000 7200 1 CEST} + {2802906000 0 0 UTC} + {2816211600 7200 1 CEST} + {2834355600 0 0 UTC} + {2847661200 7200 1 CEST} + {2866410000 0 0 UTC} + {2879110800 7200 1 CEST} + {2897859600 0 0 UTC} + {2910560400 7200 1 CEST} + {2929309200 0 0 UTC} + {2942010000 7200 1 CEST} + {2960758800 0 0 UTC} + {2974064400 7200 1 CEST} + {2992208400 0 0 UTC} + {3005514000 7200 1 CEST} + {3023658000 0 0 UTC} + {3036963600 7200 1 CEST} + {3055712400 0 0 UTC} + {3068413200 7200 1 CEST} + {3087162000 0 0 UTC} + {3099862800 7200 1 CEST} + {3118611600 0 0 UTC} + {3131917200 7200 1 CEST} + {3150061200 0 0 UTC} + {3163366800 7200 1 CEST} + {3181510800 0 0 UTC} + {3194816400 7200 1 CEST} + {3212960400 0 0 UTC} + {3226266000 7200 1 CEST} + {3245014800 0 0 UTC} + {3257715600 7200 1 CEST} + {3276464400 0 0 UTC} + {3289165200 7200 1 CEST} + {3307914000 0 0 UTC} + {3321219600 7200 1 CEST} + {3339363600 0 0 UTC} + {3352669200 7200 1 CEST} + {3370813200 0 0 UTC} + {3384118800 7200 1 CEST} + {3402867600 0 0 UTC} + {3415568400 7200 1 CEST} + {3434317200 0 0 UTC} + {3447018000 7200 1 CEST} + {3465766800 0 0 UTC} + {3479072400 7200 1 CEST} + {3497216400 0 0 UTC} + {3510522000 7200 1 CEST} + {3528666000 0 0 UTC} + {3541971600 7200 1 CEST} + {3560115600 0 0 UTC} + {3573421200 7200 1 CEST} + {3592170000 0 0 UTC} + {3604870800 7200 1 CEST} + {3623619600 0 0 UTC} + {3636320400 7200 1 CEST} + {3655069200 0 0 UTC} + {3668374800 7200 1 CEST} + {3686518800 0 0 UTC} + {3699824400 7200 1 CEST} + {3717968400 0 0 UTC} + {3731274000 7200 1 CEST} + {3750022800 0 0 UTC} + {3762723600 7200 1 CEST} + {3781472400 0 0 UTC} + {3794173200 7200 1 CEST} + {3812922000 0 0 UTC} + {3825622800 7200 1 CEST} + {3844371600 0 0 UTC} + {3857677200 7200 1 CEST} + {3875821200 0 0 UTC} + {3889126800 7200 1 CEST} + {3907270800 0 0 UTC} + {3920576400 7200 1 CEST} + {3939325200 0 0 UTC} + {3952026000 7200 1 CEST} + {3970774800 0 0 UTC} + {3983475600 7200 1 CEST} + {4002224400 0 0 UTC} + {4015530000 7200 1 CEST} + {4033674000 0 0 UTC} + {4046979600 7200 1 CEST} + {4065123600 0 0 UTC} + {4078429200 7200 1 CEST} + {4096573200 0 0 UTC} +} diff --git a/library/tzdata/Asia/Chita b/library/tzdata/Asia/Chita new file mode 100644 index 0000000..eabce7f --- /dev/null +++ b/library/tzdata/Asia/Chita @@ -0,0 +1,71 @@ +# created by tools/tclZIC.tcl - do not edit + +set TZData(:Asia/Chita) { + {-9223372036854775808 27232 0 LMT} + {-1579419232 28800 0 YAKT} + {-1247558400 32400 0 YAKMMTT} + {354898800 36000 1 YAKST} + {370706400 32400 0 YAKT} + {386434800 36000 1 YAKST} + {402242400 32400 0 YAKT} + {417970800 36000 1 YAKST} + {433778400 32400 0 YAKT} + {449593200 36000 1 YAKST} + {465325200 32400 0 YAKT} + {481050000 36000 1 YAKST} + {496774800 32400 0 YAKT} + {512499600 36000 1 YAKST} + {528224400 32400 0 YAKT} + {543949200 36000 1 YAKST} + {559674000 32400 0 YAKT} + {575398800 36000 1 YAKST} + {591123600 32400 0 YAKT} + {606848400 36000 1 YAKST} + {622573200 32400 0 YAKT} + {638298000 36000 1 YAKST} + {654627600 32400 0 YAKT} + {670352400 28800 0 YAKMMTT} + {670356000 32400 1 YAKST} + {686080800 28800 0 YAKT} + {695757600 32400 0 YAKMMTT} + {701791200 36000 1 YAKST} + {717512400 32400 0 YAKT} + {733251600 36000 1 YAKST} + {748976400 32400 0 YAKT} + {764701200 36000 1 YAKST} + {780426000 32400 0 YAKT} + {796150800 36000 1 YAKST} + {811875600 32400 0 YAKT} + {828205200 36000 1 YAKST} + {846349200 32400 0 YAKT} + {859654800 36000 1 YAKST} + {877798800 32400 0 YAKT} + {891104400 36000 1 YAKST} + {909248400 32400 0 YAKT} + {922554000 36000 1 YAKST} + {941302800 32400 0 YAKT} + {954003600 36000 1 YAKST} + {972752400 32400 0 YAKT} + {985453200 36000 1 YAKST} + {1004202000 32400 0 YAKT} + {1017507600 36000 1 YAKST} + {1035651600 32400 0 YAKT} + {1048957200 36000 1 YAKST} + {1067101200 32400 0 YAKT} + {1080406800 36000 1 YAKST} + {1099155600 32400 0 YAKT} + {1111856400 36000 1 YAKST} + {1130605200 32400 0 YAKT} + {1143306000 36000 1 YAKST} + {1162054800 32400 0 YAKT} + {1174755600 36000 1 YAKST} + {1193504400 32400 0 YAKT} + {1206810000 36000 1 YAKST} + {1224954000 32400 0 YAKT} + {1238259600 36000 1 YAKST} + {1256403600 32400 0 YAKT} + {1269709200 36000 1 YAKST} + {1288458000 32400 0 YAKT} + {1301158800 36000 0 YAKT} + {1414252800 28800 0 IRKT} +} diff --git a/library/tzdata/Asia/Dhaka b/library/tzdata/Asia/Dhaka index e0c270d..6e8a334 100644 --- a/library/tzdata/Asia/Dhaka +++ b/library/tzdata/Asia/Dhaka @@ -10,5 +10,5 @@ set TZData(:Asia/Dhaka) { {38772000 21600 0 BDT} {1230746400 21600 0 BDT} {1245430800 25200 1 BDST} - {1262278740 21600 0 BDT} + {1262278800 21600 0 BDT} } diff --git a/library/tzdata/Asia/Ho_Chi_Minh b/library/tzdata/Asia/Ho_Chi_Minh index 777c8db..9da89f4 100644 --- a/library/tzdata/Asia/Ho_Chi_Minh +++ b/library/tzdata/Asia/Ho_Chi_Minh @@ -2,8 +2,13 @@ set TZData(:Asia/Ho_Chi_Minh) { {-9223372036854775808 25600 0 LMT} - {-2005974400 25580 0 SMT} - {-1855983920 25200 0 ICT} - {-1819954800 28800 0 ICT} - {-1220428800 25200 0 ICT} + {-2004073600 25590 0 PLMT} + {-1851577590 25200 0 ICT} + {-852105600 28800 0 IDT} + {-782643600 32400 0 JST} + {-767869200 25200 0 ICT} + {-718095600 28800 0 IDT} + {-457776000 25200 0 ICT} + {-315648000 28800 0 IDT} + {171820800 25200 0 ICT} } diff --git a/library/tzdata/Asia/Irkutsk b/library/tzdata/Asia/Irkutsk index e344181..08e5798 100644 --- a/library/tzdata/Asia/Irkutsk +++ b/library/tzdata/Asia/Irkutsk @@ -1,9 +1,9 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Irkutsk) { - {-9223372036854775808 25035 0 LMT} - {-2840165835 25035 0 IMT} - {-1575874635 25200 0 IRKT} + {-9223372036854775808 25025 0 LMT} + {-2840165825 25025 0 IMT} + {-1575874625 25200 0 IRKT} {-1247554800 28800 0 IRKMMTT} {354902400 32400 1 IRKST} {370710000 28800 0 IRKT} diff --git a/library/tzdata/Asia/Krasnoyarsk b/library/tzdata/Asia/Krasnoyarsk index 2770a51..17ea6c0 100644 --- a/library/tzdata/Asia/Krasnoyarsk +++ b/library/tzdata/Asia/Krasnoyarsk @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Krasnoyarsk) { - {-9223372036854775808 22280 0 LMT} - {-1577513480 21600 0 KRAT} + {-9223372036854775808 22286 0 LMT} + {-1577513486 21600 0 KRAT} {-1247551200 25200 0 KRAMMTT} {354906000 28800 1 KRAST} {370713600 25200 0 KRAT} diff --git a/library/tzdata/Asia/Novokuznetsk b/library/tzdata/Asia/Novokuznetsk index d7e308e..ab3c2d5 100644 --- a/library/tzdata/Asia/Novokuznetsk +++ b/library/tzdata/Asia/Novokuznetsk @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Novokuznetsk) { - {-9223372036854775808 20928 0 NMT} - {-1577512128 21600 0 KRAT} + {-9223372036854775808 20928 0 LMT} + {-1441259328 21600 0 KRAT} {-1247551200 25200 0 KRAMMTT} {354906000 28800 1 KRAST} {370713600 25200 0 KRAT} diff --git a/library/tzdata/Asia/Omsk b/library/tzdata/Asia/Omsk index a6b0db3..f25b8d4 100644 --- a/library/tzdata/Asia/Omsk +++ b/library/tzdata/Asia/Omsk @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Omsk) { - {-9223372036854775808 17616 0 LMT} - {-1582088016 18000 0 OMST} + {-9223372036854775808 17610 0 LMT} + {-1582088010 18000 0 OMST} {-1247547600 21600 0 OMSMMTT} {354909600 25200 1 OMSST} {370717200 21600 0 OMST} diff --git a/library/tzdata/Asia/Phnom_Penh b/library/tzdata/Asia/Phnom_Penh index 4f28420..114c786 100644 --- a/library/tzdata/Asia/Phnom_Penh +++ b/library/tzdata/Asia/Phnom_Penh @@ -1,9 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Asia/Phnom_Penh) { - {-9223372036854775808 25180 0 LMT} - {-2005973980 25580 0 SMT} - {-1855983920 25200 0 ICT} - {-1819954800 28800 0 ICT} - {-1220428800 25200 0 ICT} +if {![info exists TZData(Asia/Bangkok)]} { + LoadTimeZoneFile Asia/Bangkok } +set TZData(:Asia/Phnom_Penh) $TZData(:Asia/Bangkok) diff --git a/library/tzdata/Asia/Pyongyang b/library/tzdata/Asia/Pyongyang index dd40311..fafed54 100644 --- a/library/tzdata/Asia/Pyongyang +++ b/library/tzdata/Asia/Pyongyang @@ -2,12 +2,8 @@ set TZData(:Asia/Pyongyang) { {-9223372036854775808 30180 0 LMT} - {-2524551780 30600 0 KST} - {-2053931400 32400 0 JCST} - {-1325494800 30600 0 KST} - {-1199262600 32400 0 JCST} + {-1948782180 30600 0 KST} + {-1830414600 32400 0 JCST} {-1017824400 32400 0 JST} {-768646800 32400 0 KST} - {-498128400 28800 0 KST} - {-264931200 32400 0 KST} } diff --git a/library/tzdata/Asia/Samarkand b/library/tzdata/Asia/Samarkand index 6a1be11..4b3b49f 100644 --- a/library/tzdata/Asia/Samarkand +++ b/library/tzdata/Asia/Samarkand @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Samarkand) { - {-9223372036854775808 16032 0 LMT} - {-1441168032 14400 0 SAMT} + {-9223372036854775808 16073 0 LMT} + {-1441168073 14400 0 SAMT} {-1247544000 18000 0 SAMT} {354913200 21600 1 SAMST} {370720800 21600 0 TAST} diff --git a/library/tzdata/Asia/Seoul b/library/tzdata/Asia/Seoul index 9625291..c24a1d8 100644 --- a/library/tzdata/Asia/Seoul +++ b/library/tzdata/Asia/Seoul @@ -2,19 +2,26 @@ set TZData(:Asia/Seoul) { {-9223372036854775808 30472 0 LMT} - {-2524552072 30600 0 KST} - {-2053931400 32400 0 JCST} - {-1325494800 30600 0 KST} - {-1199262600 32400 0 JCST} + {-1948782472 30600 0 KST} + {-1830414600 32400 0 JCST} {-1017824400 32400 0 JST} {-767350800 32400 0 KST} - {-498128400 28800 0 KST} - {-303984000 32400 1 KDT} - {-293533200 28800 0 KST} - {-264931200 30600 0 KST} - {-39515400 32400 0 KST} - {547570800 36000 1 KDT} - {560872800 32400 0 KST} - {579020400 36000 1 KDT} - {592322400 32400 0 KST} + {-498128400 30600 0 KST} + {-462702600 34200 1 KDT} + {-451733400 30600 0 KST} + {-429784200 34200 1 KDT} + {-418296600 30600 0 KST} + {-399544200 34200 1 KDT} + {-387451800 30600 0 KST} + {-368094600 34200 1 KDT} + {-356002200 30600 0 KST} + {-336645000 34200 1 KDT} + {-324552600 30600 0 KST} + {-305195400 34200 1 KDT} + {-293103000 30600 0 KST} + {-264933000 32400 0 KST} + {547578000 36000 1 KDT} + {560883600 32400 0 KST} + {579027600 36000 1 KDT} + {592333200 32400 0 KST} } diff --git a/library/tzdata/Asia/Srednekolymsk b/library/tzdata/Asia/Srednekolymsk new file mode 100644 index 0000000..d1dd879 --- /dev/null +++ b/library/tzdata/Asia/Srednekolymsk @@ -0,0 +1,71 @@ +# created by tools/tclZIC.tcl - do not edit + +set TZData(:Asia/Srednekolymsk) { + {-9223372036854775808 36892 0 LMT} + {-1441188892 36000 0 MAGT} + {-1247565600 39600 0 MAGMMTT} + {354891600 43200 1 MAGST} + {370699200 39600 0 MAGT} + {386427600 43200 1 MAGST} + {402235200 39600 0 MAGT} + {417963600 43200 1 MAGST} + {433771200 39600 0 MAGT} + {449586000 43200 1 MAGST} + {465318000 39600 0 MAGT} + {481042800 43200 1 MAGST} + {496767600 39600 0 MAGT} + {512492400 43200 1 MAGST} + {528217200 39600 0 MAGT} + {543942000 43200 1 MAGST} + {559666800 39600 0 MAGT} + {575391600 43200 1 MAGST} + {591116400 39600 0 MAGT} + {606841200 43200 1 MAGST} + {622566000 39600 0 MAGT} + {638290800 43200 1 MAGST} + {654620400 39600 0 MAGT} + {670345200 36000 0 MAGMMTT} + {670348800 39600 1 MAGST} + {686073600 36000 0 MAGT} + {695750400 39600 0 MAGMMTT} + {701784000 43200 1 MAGST} + {717505200 39600 0 MAGT} + {733244400 43200 1 MAGST} + {748969200 39600 0 MAGT} + {764694000 43200 1 MAGST} + {780418800 39600 0 MAGT} + {796143600 43200 1 MAGST} + {811868400 39600 0 MAGT} + {828198000 43200 1 MAGST} + {846342000 39600 0 MAGT} + {859647600 43200 1 MAGST} + {877791600 39600 0 MAGT} + {891097200 43200 1 MAGST} + {909241200 39600 0 MAGT} + {922546800 43200 1 MAGST} + {941295600 39600 0 MAGT} + {953996400 43200 1 MAGST} + {972745200 39600 0 MAGT} + {985446000 43200 1 MAGST} + {1004194800 39600 0 MAGT} + {1017500400 43200 1 MAGST} + {1035644400 39600 0 MAGT} + {1048950000 43200 1 MAGST} + {1067094000 39600 0 MAGT} + {1080399600 43200 1 MAGST} + {1099148400 39600 0 MAGT} + {1111849200 43200 1 MAGST} + {1130598000 39600 0 MAGT} + {1143298800 43200 1 MAGST} + {1162047600 39600 0 MAGT} + {1174748400 43200 1 MAGST} + {1193497200 39600 0 MAGT} + {1206802800 43200 1 MAGST} + {1224946800 39600 0 MAGT} + {1238252400 43200 1 MAGST} + {1256396400 39600 0 MAGT} + {1269702000 43200 1 MAGST} + {1288450800 39600 0 MAGT} + {1301151600 43200 0 MAGT} + {1414245600 39600 0 SRET} +} diff --git a/library/tzdata/Asia/Tbilisi b/library/tzdata/Asia/Tbilisi index 9f4a4bf..54b278a 100644 --- a/library/tzdata/Asia/Tbilisi +++ b/library/tzdata/Asia/Tbilisi @@ -1,9 +1,9 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Tbilisi) { - {-9223372036854775808 10746 0 LMT} - {-2840151546 10746 0 TBMT} - {-1441162746 10800 0 TBIT} + {-9223372036854775808 10751 0 LMT} + {-2840151551 10751 0 TBMT} + {-1441162751 10800 0 TBIT} {-405140400 14400 0 TBIT} {354916800 18000 1 TBIST} {370724400 14400 0 TBIT} diff --git a/library/tzdata/Asia/Vientiane b/library/tzdata/Asia/Vientiane index 18ade4d..27b20ce 100644 --- a/library/tzdata/Asia/Vientiane +++ b/library/tzdata/Asia/Vientiane @@ -1,9 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Asia/Vientiane) { - {-9223372036854775808 24624 0 LMT} - {-2005973424 25580 0 SMT} - {-1855983920 25200 0 ICT} - {-1819954800 28800 0 ICT} - {-1220428800 25200 0 ICT} +if {![info exists TZData(Asia/Bangkok)]} { + LoadTimeZoneFile Asia/Bangkok } +set TZData(:Asia/Vientiane) $TZData(:Asia/Bangkok) diff --git a/library/tzdata/Asia/Vladivostok b/library/tzdata/Asia/Vladivostok index 396840d..119ff57 100644 --- a/library/tzdata/Asia/Vladivostok +++ b/library/tzdata/Asia/Vladivostok @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Vladivostok) { - {-9223372036854775808 31654 0 LMT} - {-1487321254 32400 0 VLAT} + {-9223372036854775808 31651 0 LMT} + {-1487321251 32400 0 VLAT} {-1247562000 36000 0 VLAMMTT} {354895200 39600 1 VLAST} {370702800 36000 0 VLAT} diff --git a/library/tzdata/Asia/Yakutsk b/library/tzdata/Asia/Yakutsk index 98953c9..17493a6 100644 --- a/library/tzdata/Asia/Yakutsk +++ b/library/tzdata/Asia/Yakutsk @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Yakutsk) { - {-9223372036854775808 31120 0 LMT} - {-1579423120 28800 0 YAKT} + {-9223372036854775808 31138 0 LMT} + {-1579423138 28800 0 YAKT} {-1247558400 32400 0 YAKMMTT} {354898800 36000 1 YAKST} {370706400 32400 0 YAKT} diff --git a/library/tzdata/Asia/Yekaterinburg b/library/tzdata/Asia/Yekaterinburg index 688ceca..2678958 100644 --- a/library/tzdata/Asia/Yekaterinburg +++ b/library/tzdata/Asia/Yekaterinburg @@ -2,7 +2,8 @@ set TZData(:Asia/Yekaterinburg) { {-9223372036854775808 14553 0 LMT} - {-1592611353 14400 0 SVET} + {-1688270553 13505 0 PMT} + {-1592610305 14400 0 SVET} {-1247544000 18000 0 SVEMMTT} {354913200 21600 1 SVEST} {370720800 18000 0 SVET} diff --git a/library/tzdata/Atlantic/Azores b/library/tzdata/Atlantic/Azores index c476191..fd47ba5 100644 --- a/library/tzdata/Atlantic/Azores +++ b/library/tzdata/Atlantic/Azores @@ -3,7 +3,7 @@ set TZData(:Atlantic/Azores) { {-9223372036854775808 -6160 0 LMT} {-2713904240 -6872 0 HMT} - {-1849557928 -7200 0 AZOT} + {-1830377128 -7200 0 AZOT} {-1689548400 -3600 1 AZOST} {-1677794400 -7200 0 AZOT} {-1667430000 -3600 1 AZOST} diff --git a/library/tzdata/Atlantic/Madeira b/library/tzdata/Atlantic/Madeira index 4960eeb..fac7f92 100644 --- a/library/tzdata/Atlantic/Madeira +++ b/library/tzdata/Atlantic/Madeira @@ -3,7 +3,7 @@ set TZData(:Atlantic/Madeira) { {-9223372036854775808 -4056 0 LMT} {-2713906344 -4056 0 FMT} - {-1849560744 -3600 0 MADT} + {-1830379944 -3600 0 MADT} {-1689552000 0 1 MADST} {-1677798000 -3600 0 MADT} {-1667433600 0 1 MADST} diff --git a/library/tzdata/Europe/Lisbon b/library/tzdata/Europe/Lisbon index 79c688a..7168f96 100644 --- a/library/tzdata/Europe/Lisbon +++ b/library/tzdata/Europe/Lisbon @@ -1,9 +1,9 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Europe/Lisbon) { - {-9223372036854775808 -2192 0 LMT} - {-2713908208 -2192 0 LMT} - {-1830381808 0 0 WET} + {-9223372036854775808 -2205 0 LMT} + {-2713908195 -2205 0 LMT} + {-1830381795 0 0 WET} {-1689555600 3600 1 WEST} {-1677801600 0 0 WET} {-1667437200 3600 1 WEST} diff --git a/library/tzdata/Europe/Minsk b/library/tzdata/Europe/Minsk index 1adcff8..0acb4aa 100644 --- a/library/tzdata/Europe/Minsk +++ b/library/tzdata/Europe/Minsk @@ -71,4 +71,5 @@ set TZData(:Europe/Minsk) { {1269734400 10800 1 EEST} {1288483200 7200 0 EET} {1301184000 10800 0 FET} + {1414274400 10800 0 MSK} } diff --git a/library/tzdata/Europe/Riga b/library/tzdata/Europe/Riga index 98cccc2..c829ffb 100644 --- a/library/tzdata/Europe/Riga +++ b/library/tzdata/Europe/Riga @@ -1,13 +1,13 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Europe/Riga) { - {-9223372036854775808 5788 0 LMT} - {-2840146588 5788 0 RMT} - {-1632008188 9388 1 LST} - {-1618702588 5788 0 RMT} - {-1601681788 9388 1 LST} - {-1597275388 5788 0 RMT} - {-1377308188 7200 0 EET} + {-9223372036854775808 5794 0 LMT} + {-2840146594 5794 0 RMT} + {-1632008194 9394 1 LST} + {-1618702594 5794 0 RMT} + {-1601681794 9394 1 LST} + {-1597275394 5794 0 RMT} + {-1377308194 7200 0 EET} {-928029600 10800 0 MSK} {-899521200 3600 0 CET} {-857257200 3600 0 CET} diff --git a/library/tzdata/Europe/Samara b/library/tzdata/Europe/Samara index 243a42f..ee9d989 100644 --- a/library/tzdata/Europe/Samara +++ b/library/tzdata/Europe/Samara @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Europe/Samara) { - {-9223372036854775808 12036 0 LMT} - {-1593825636 10800 0 SAMT} + {-9223372036854775808 12020 0 LMT} + {-1593825620 10800 0 SAMT} {-1247540400 14400 0 SAMT} {-1102305600 14400 0 KUYMMTT} {354916800 18000 1 KUYST} diff --git a/library/tzdata/Indian/Antananarivo b/library/tzdata/Indian/Antananarivo index 217715e..c56a893 100644 --- a/library/tzdata/Indian/Antananarivo +++ b/library/tzdata/Indian/Antananarivo @@ -1,8 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Indian/Antananarivo) { - {-9223372036854775808 11404 0 LMT} - {-1846293004 10800 0 EAT} - {-499924800 14400 1 EAST} - {-492062400 10800 0 EAT} +if {![info exists TZData(Africa/Nairobi)]} { + LoadTimeZoneFile Africa/Nairobi } +set TZData(:Indian/Antananarivo) $TZData(:Africa/Nairobi) diff --git a/library/tzdata/Indian/Comoro b/library/tzdata/Indian/Comoro index 0b3c33a..06071de 100644 --- a/library/tzdata/Indian/Comoro +++ b/library/tzdata/Indian/Comoro @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Indian/Comoro) { - {-9223372036854775808 10384 0 LMT} - {-1846291984 10800 0 EAT} +if {![info exists TZData(Africa/Nairobi)]} { + LoadTimeZoneFile Africa/Nairobi } +set TZData(:Indian/Comoro) $TZData(:Africa/Nairobi) diff --git a/library/tzdata/Indian/Mayotte b/library/tzdata/Indian/Mayotte index 0fe5f56..da55521 100644 --- a/library/tzdata/Indian/Mayotte +++ b/library/tzdata/Indian/Mayotte @@ -1,6 +1,5 @@ # created by tools/tclZIC.tcl - do not edit - -set TZData(:Indian/Mayotte) { - {-9223372036854775808 10856 0 LMT} - {-1846292456 10800 0 EAT} +if {![info exists TZData(Africa/Nairobi)]} { + LoadTimeZoneFile Africa/Nairobi } +set TZData(:Indian/Mayotte) $TZData(:Africa/Nairobi) diff --git a/library/tzdata/Pacific/Bougainville b/library/tzdata/Pacific/Bougainville new file mode 100644 index 0000000..06996f9 --- /dev/null +++ b/library/tzdata/Pacific/Bougainville @@ -0,0 +1,10 @@ +# created by tools/tclZIC.tcl - do not edit + +set TZData(:Pacific/Bougainville) { + {-9223372036854775808 37336 0 LMT} + {-2840178136 35312 0 PMMT} + {-2366790512 36000 0 PGT} + {-868010400 32400 0 JST} + {-768906000 36000 0 PGT} + {1419696000 39600 0 BST} +} diff --git a/library/tzdata/Pacific/Fiji b/library/tzdata/Pacific/Fiji index e1602ee..4aae330 100644 --- a/library/tzdata/Pacific/Fiji +++ b/library/tzdata/Pacific/Fiji @@ -17,175 +17,175 @@ set TZData(:Pacific/Fiji) { {1358604000 43200 0 FJT} {1382796000 46800 1 FJST} {1390050000 43200 0 FJT} - {1414245600 46800 1 FJST} - {1421499600 43200 0 FJT} - {1445695200 46800 1 FJST} - {1453554000 43200 0 FJT} - {1477144800 46800 1 FJST} - {1485003600 43200 0 FJT} - {1508594400 46800 1 FJST} - {1516453200 43200 0 FJT} - {1540044000 46800 1 FJST} - {1547902800 43200 0 FJT} - {1572098400 46800 1 FJST} - {1579352400 43200 0 FJT} - {1603548000 46800 1 FJST} - {1611406800 43200 0 FJT} - {1634997600 46800 1 FJST} - {1642856400 43200 0 FJT} - {1666447200 46800 1 FJST} - {1674306000 43200 0 FJT} - {1697896800 46800 1 FJST} - {1705755600 43200 0 FJT} - {1729951200 46800 1 FJST} - {1737205200 43200 0 FJT} - {1761400800 46800 1 FJST} - {1768654800 43200 0 FJT} - {1792850400 46800 1 FJST} - {1800709200 43200 0 FJT} - {1824300000 46800 1 FJST} - {1832158800 43200 0 FJT} - {1855749600 46800 1 FJST} - {1863608400 43200 0 FJT} - {1887199200 46800 1 FJST} - {1895058000 43200 0 FJT} - {1919253600 46800 1 FJST} - {1926507600 43200 0 FJT} - {1950703200 46800 1 FJST} - {1957957200 43200 0 FJT} - {1982152800 46800 1 FJST} - {1990011600 43200 0 FJT} - {2013602400 46800 1 FJST} - {2021461200 43200 0 FJT} - {2045052000 46800 1 FJST} - {2052910800 43200 0 FJT} - {2076501600 46800 1 FJST} - {2084360400 43200 0 FJT} - {2108556000 46800 1 FJST} - {2115810000 43200 0 FJT} - {2140005600 46800 1 FJST} - {2147864400 43200 0 FJT} - {2171455200 46800 1 FJST} - {2179314000 43200 0 FJT} - {2202904800 46800 1 FJST} - {2210763600 43200 0 FJT} - {2234354400 46800 1 FJST} - {2242213200 43200 0 FJT} - {2266408800 46800 1 FJST} - {2273662800 43200 0 FJT} - {2297858400 46800 1 FJST} - {2305112400 43200 0 FJT} - {2329308000 46800 1 FJST} - {2337166800 43200 0 FJT} - {2360757600 46800 1 FJST} - {2368616400 43200 0 FJT} - {2392207200 46800 1 FJST} - {2400066000 43200 0 FJT} - {2423656800 46800 1 FJST} - {2431515600 43200 0 FJT} - {2455711200 46800 1 FJST} - {2462965200 43200 0 FJT} - {2487160800 46800 1 FJST} - {2495019600 43200 0 FJT} - {2518610400 46800 1 FJST} - {2526469200 43200 0 FJT} - {2550060000 46800 1 FJST} - {2557918800 43200 0 FJT} - {2581509600 46800 1 FJST} - {2589368400 43200 0 FJT} - {2613564000 46800 1 FJST} - {2620818000 43200 0 FJT} - {2645013600 46800 1 FJST} - {2652267600 43200 0 FJT} - {2676463200 46800 1 FJST} - {2684322000 43200 0 FJT} - {2707912800 46800 1 FJST} - {2715771600 43200 0 FJT} - {2739362400 46800 1 FJST} - {2747221200 43200 0 FJT} - {2770812000 46800 1 FJST} - {2778670800 43200 0 FJT} - {2802866400 46800 1 FJST} - {2810120400 43200 0 FJT} - {2834316000 46800 1 FJST} - {2841570000 43200 0 FJT} - {2865765600 46800 1 FJST} - {2873624400 43200 0 FJT} - {2897215200 46800 1 FJST} - {2905074000 43200 0 FJT} - {2928664800 46800 1 FJST} - {2936523600 43200 0 FJT} - {2960114400 46800 1 FJST} - {2967973200 43200 0 FJT} - {2992168800 46800 1 FJST} - {2999422800 43200 0 FJT} - {3023618400 46800 1 FJST} - {3031477200 43200 0 FJT} - {3055068000 46800 1 FJST} - {3062926800 43200 0 FJT} - {3086517600 46800 1 FJST} - {3094376400 43200 0 FJT} - {3117967200 46800 1 FJST} - {3125826000 43200 0 FJT} - {3150021600 46800 1 FJST} - {3157275600 43200 0 FJT} - {3181471200 46800 1 FJST} - {3188725200 43200 0 FJT} - {3212920800 46800 1 FJST} - {3220779600 43200 0 FJT} - {3244370400 46800 1 FJST} - {3252229200 43200 0 FJT} - {3275820000 46800 1 FJST} - {3283678800 43200 0 FJT} - {3307269600 46800 1 FJST} - {3315128400 43200 0 FJT} - {3339324000 46800 1 FJST} - {3346578000 43200 0 FJT} - {3370773600 46800 1 FJST} - {3378632400 43200 0 FJT} - {3402223200 46800 1 FJST} - {3410082000 43200 0 FJT} - {3433672800 46800 1 FJST} - {3441531600 43200 0 FJT} - {3465122400 46800 1 FJST} - {3472981200 43200 0 FJT} - {3497176800 46800 1 FJST} - {3504430800 43200 0 FJT} - {3528626400 46800 1 FJST} - {3535880400 43200 0 FJT} - {3560076000 46800 1 FJST} - {3567934800 43200 0 FJT} - {3591525600 46800 1 FJST} - {3599384400 43200 0 FJT} - {3622975200 46800 1 FJST} - {3630834000 43200 0 FJT} - {3654424800 46800 1 FJST} - {3662283600 43200 0 FJT} - {3686479200 46800 1 FJST} - {3693733200 43200 0 FJT} - {3717928800 46800 1 FJST} - {3725182800 43200 0 FJT} - {3749378400 46800 1 FJST} - {3757237200 43200 0 FJT} - {3780828000 46800 1 FJST} - {3788686800 43200 0 FJT} - {3812277600 46800 1 FJST} - {3820136400 43200 0 FJT} - {3843727200 46800 1 FJST} - {3851586000 43200 0 FJT} - {3875781600 46800 1 FJST} - {3883035600 43200 0 FJT} - {3907231200 46800 1 FJST} - {3915090000 43200 0 FJT} - {3938680800 46800 1 FJST} - {3946539600 43200 0 FJT} - {3970130400 46800 1 FJST} - {3977989200 43200 0 FJT} - {4001580000 46800 1 FJST} - {4009438800 43200 0 FJT} - {4033634400 46800 1 FJST} - {4040888400 43200 0 FJT} - {4065084000 46800 1 FJST} - {4072338000 43200 0 FJT} - {4096533600 46800 1 FJST} + {1414850400 46800 1 FJST} + {1421503200 43200 0 FJT} + {1446300000 46800 1 FJST} + {1453557600 43200 0 FJT} + {1478354400 46800 1 FJST} + {1485007200 43200 0 FJT} + {1509804000 46800 1 FJST} + {1516456800 43200 0 FJT} + {1541253600 46800 1 FJST} + {1547906400 43200 0 FJT} + {1572703200 46800 1 FJST} + {1579356000 43200 0 FJT} + {1604152800 46800 1 FJST} + {1611410400 43200 0 FJT} + {1636207200 46800 1 FJST} + {1642860000 43200 0 FJT} + {1667656800 46800 1 FJST} + {1674309600 43200 0 FJT} + {1699106400 46800 1 FJST} + {1705759200 43200 0 FJT} + {1730556000 46800 1 FJST} + {1737208800 43200 0 FJT} + {1762005600 46800 1 FJST} + {1768658400 43200 0 FJT} + {1793455200 46800 1 FJST} + {1800712800 43200 0 FJT} + {1825509600 46800 1 FJST} + {1832162400 43200 0 FJT} + {1856959200 46800 1 FJST} + {1863612000 43200 0 FJT} + {1888408800 46800 1 FJST} + {1895061600 43200 0 FJT} + {1919858400 46800 1 FJST} + {1926511200 43200 0 FJT} + {1951308000 46800 1 FJST} + {1957960800 43200 0 FJT} + {1983362400 46800 1 FJST} + {1990015200 43200 0 FJT} + {2014812000 46800 1 FJST} + {2021464800 43200 0 FJT} + {2046261600 46800 1 FJST} + {2052914400 43200 0 FJT} + {2077711200 46800 1 FJST} + {2084364000 43200 0 FJT} + {2109160800 46800 1 FJST} + {2115813600 43200 0 FJT} + {2140610400 46800 1 FJST} + {2147868000 43200 0 FJT} + {2172664800 46800 1 FJST} + {2179317600 43200 0 FJT} + {2204114400 46800 1 FJST} + {2210767200 43200 0 FJT} + {2235564000 46800 1 FJST} + {2242216800 43200 0 FJT} + {2267013600 46800 1 FJST} + {2273666400 43200 0 FJT} + {2298463200 46800 1 FJST} + {2305116000 43200 0 FJT} + {2329912800 46800 1 FJST} + {2337170400 43200 0 FJT} + {2361967200 46800 1 FJST} + {2368620000 43200 0 FJT} + {2393416800 46800 1 FJST} + {2400069600 43200 0 FJT} + {2424866400 46800 1 FJST} + {2431519200 43200 0 FJT} + {2456316000 46800 1 FJST} + {2462968800 43200 0 FJT} + {2487765600 46800 1 FJST} + {2495023200 43200 0 FJT} + {2519820000 46800 1 FJST} + {2526472800 43200 0 FJT} + {2551269600 46800 1 FJST} + {2557922400 43200 0 FJT} + {2582719200 46800 1 FJST} + {2589372000 43200 0 FJT} + {2614168800 46800 1 FJST} + {2620821600 43200 0 FJT} + {2645618400 46800 1 FJST} + {2652271200 43200 0 FJT} + {2677068000 46800 1 FJST} + {2684325600 43200 0 FJT} + {2709122400 46800 1 FJST} + {2715775200 43200 0 FJT} + {2740572000 46800 1 FJST} + {2747224800 43200 0 FJT} + {2772021600 46800 1 FJST} + {2778674400 43200 0 FJT} + {2803471200 46800 1 FJST} + {2810124000 43200 0 FJT} + {2834920800 46800 1 FJST} + {2841573600 43200 0 FJT} + {2866975200 46800 1 FJST} + {2873628000 43200 0 FJT} + {2898424800 46800 1 FJST} + {2905077600 43200 0 FJT} + {2929874400 46800 1 FJST} + {2936527200 43200 0 FJT} + {2961324000 46800 1 FJST} + {2967976800 43200 0 FJT} + {2992773600 46800 1 FJST} + {2999426400 43200 0 FJT} + {3024223200 46800 1 FJST} + {3031480800 43200 0 FJT} + {3056277600 46800 1 FJST} + {3062930400 43200 0 FJT} + {3087727200 46800 1 FJST} + {3094380000 43200 0 FJT} + {3119176800 46800 1 FJST} + {3125829600 43200 0 FJT} + {3150626400 46800 1 FJST} + {3157279200 43200 0 FJT} + {3182076000 46800 1 FJST} + {3188728800 43200 0 FJT} + {3213525600 46800 1 FJST} + {3220783200 43200 0 FJT} + {3245580000 46800 1 FJST} + {3252232800 43200 0 FJT} + {3277029600 46800 1 FJST} + {3283682400 43200 0 FJT} + {3308479200 46800 1 FJST} + {3315132000 43200 0 FJT} + {3339928800 46800 1 FJST} + {3346581600 43200 0 FJT} + {3371378400 46800 1 FJST} + {3378636000 43200 0 FJT} + {3403432800 46800 1 FJST} + {3410085600 43200 0 FJT} + {3434882400 46800 1 FJST} + {3441535200 43200 0 FJT} + {3466332000 46800 1 FJST} + {3472984800 43200 0 FJT} + {3497781600 46800 1 FJST} + {3504434400 43200 0 FJT} + {3529231200 46800 1 FJST} + {3535884000 43200 0 FJT} + {3560680800 46800 1 FJST} + {3567938400 43200 0 FJT} + {3592735200 46800 1 FJST} + {3599388000 43200 0 FJT} + {3624184800 46800 1 FJST} + {3630837600 43200 0 FJT} + {3655634400 46800 1 FJST} + {3662287200 43200 0 FJT} + {3687084000 46800 1 FJST} + {3693736800 43200 0 FJT} + {3718533600 46800 1 FJST} + {3725186400 43200 0 FJT} + {3750588000 46800 1 FJST} + {3757240800 43200 0 FJT} + {3782037600 46800 1 FJST} + {3788690400 43200 0 FJT} + {3813487200 46800 1 FJST} + {3820140000 43200 0 FJT} + {3844936800 46800 1 FJST} + {3851589600 43200 0 FJT} + {3876386400 46800 1 FJST} + {3883039200 43200 0 FJT} + {3907836000 46800 1 FJST} + {3915093600 43200 0 FJT} + {3939890400 46800 1 FJST} + {3946543200 43200 0 FJT} + {3971340000 46800 1 FJST} + {3977992800 43200 0 FJT} + {4002789600 46800 1 FJST} + {4009442400 43200 0 FJT} + {4034239200 46800 1 FJST} + {4040892000 43200 0 FJT} + {4065688800 46800 1 FJST} + {4072341600 43200 0 FJT} + {4097138400 46800 1 FJST} } -- cgit v0.12 From c5f0eae368ab6a18f4d21796385e963adcd3cf34 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 11 Dec 2014 14:40:02 +0000 Subject: [e711ffb458] Same conversion for [catch] compiler. --- generic/tclCompCmds.c | 43 +++++++------------------------------------ 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index ec22f65..10cba39 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -379,8 +379,7 @@ TclCompileCatchCmd( { JumpFixup jumpFixup; Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr; - const char *name; - int resultIndex, optsIndex, nameChars, range; + int resultIndex, optsIndex, isSimple, isScalar, range; int initStackDepth = envPtr->currStackDepth; int savedStackDepth; DefineLineInformation; /* TIP #280 */ @@ -395,15 +394,6 @@ TclCompileCatchCmd( } /* - * If variables were specified and the catch command is at global level - * (not in a procedure), don't compile it inline: the payoff is too small. - */ - - if ((parsePtr->numWords >= 3) && (envPtr->procPtr == NULL)) { - return TCL_ERROR; - } - - /* * Make sure the variable names, if any, have no substitutions and just * refer to local scalars. */ @@ -412,36 +402,17 @@ TclCompileCatchCmd( cmdTokenPtr = TokenAfter(parsePtr->tokenPtr); if (parsePtr->numWords >= 3) { resultNameTokenPtr = TokenAfter(cmdTokenPtr); - /* DGP */ - if (resultNameTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + PushVarNameWord(interp, resultNameTokenPtr, envPtr, TCL_CREATE_VAR, + &resultIndex, &isSimple, &isScalar, 2); + if (!isScalar || resultIndex < 0) { return TCL_ERROR; } - name = resultNameTokenPtr[1].start; - nameChars = resultNameTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { - return TCL_ERROR; - } - resultIndex = TclFindCompiledLocal(resultNameTokenPtr[1].start, - resultNameTokenPtr[1].size, /*create*/ 1, envPtr->procPtr); - if (resultIndex < 0) { - return TCL_ERROR; - } - - /* DKF */ if (parsePtr->numWords == 4) { optsNameTokenPtr = TokenAfter(resultNameTokenPtr); - if (optsNameTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - name = optsNameTokenPtr[1].start; - nameChars = optsNameTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { - return TCL_ERROR; - } - optsIndex = TclFindCompiledLocal(optsNameTokenPtr[1].start, - optsNameTokenPtr[1].size, /*create*/ 1, envPtr->procPtr); - if (optsIndex < 0) { + PushVarNameWord(interp, optsNameTokenPtr, envPtr, TCL_CREATE_VAR, + &optsIndex, &isSimple, &isScalar, 2); + if (!isScalar || resultIndex < 0) { return TCL_ERROR; } } -- cgit v0.12 From 6e36638f7c05fb239d0b0d56fee36f8b2c62bcd1 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 11 Dec 2014 14:41:09 +0000 Subject: Get the word number right, even though it has no effect. --- generic/tclCompCmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 10cba39..e0dee13 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -411,7 +411,7 @@ TclCompileCatchCmd( if (parsePtr->numWords == 4) { optsNameTokenPtr = TokenAfter(resultNameTokenPtr); PushVarNameWord(interp, optsNameTokenPtr, envPtr, TCL_CREATE_VAR, - &optsIndex, &isSimple, &isScalar, 2); + &optsIndex, &isSimple, &isScalar, 3); if (!isScalar || resultIndex < 0) { return TCL_ERROR; } -- cgit v0.12 From b96a5cc09f4f051a6b7a85a9a240470e6f5d5553 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 11 Dec 2014 15:19:38 +0000 Subject: Similar revisions to [dict incr] compiler. --- generic/tclCompCmds.c | 60 +++++++++++++++++++-------------------------------- 1 file changed, 22 insertions(+), 38 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index e0dee13..33598e7 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -707,20 +707,31 @@ TclCompileDictIncrCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Proc *procPtr = envPtr->procPtr; - DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *keyTokenPtr; - int dictVarIndex, nameChars, incrAmount; - const char *name; + int dictVarIndex, incrAmount, isScalar, isSimple; + DefineLineInformation; /* TIP #280 */ /* * There must be at least two arguments after the command. */ - if (parsePtr->numWords < 3 || parsePtr->numWords > 4 || procPtr == NULL) { + if (parsePtr->numWords < 3 || parsePtr->numWords > 4) { return TCL_ERROR; } + + /* + * The dictionary variable must be a local scalar that is knowable at + * compile time; anything else exceeds the complexity of the opcode. So + * discover what the index is. + */ + varTokenPtr = TokenAfter(parsePtr->tokenPtr); + PushVarNameWord(interp, varTokenPtr, envPtr, TCL_CREATE_VAR, + &dictVarIndex, &isSimple, &isScalar, 1); + if (!isScalar || dictVarIndex < 0) { + return TCL_ERROR; + } + keyTokenPtr = TokenAfter(varTokenPtr); /* @@ -728,23 +739,12 @@ TclCompileDictIncrCmd( */ if (parsePtr->numWords == 4) { - const char *word; - int numBytes, code; - Tcl_Token *incrTokenPtr; - Tcl_Obj *intObj; - - incrTokenPtr = TokenAfter(keyTokenPtr); - if (incrTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - word = incrTokenPtr[1].start; - numBytes = incrTokenPtr[1].size; - - intObj = Tcl_NewStringObj(word, numBytes); - Tcl_IncrRefCount(intObj); - code = TclGetIntFromObj(NULL, intObj, &incrAmount); - TclDecrRefCount(intObj); - if (code != TCL_OK) { + Tcl_Token *incrTokenPtr = TokenAfter(keyTokenPtr); + Tcl_Obj *intObj = Tcl_NewObj(); + int fail = (!TclWordKnownAtCompileTime(incrTokenPtr, intObj) + || TCL_ERROR == TclGetIntFromObj(NULL, intObj, &incrAmount)); + Tcl_DecrRefCount(intObj); + if (fail) { return TCL_ERROR; } } else { @@ -752,22 +752,6 @@ TclCompileDictIncrCmd( } /* - * The dictionary variable must be a local scalar that is knowable at - * compile time; anything else exceeds the complexity of the opcode. So - * discover what the index is. - */ - - if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - name = varTokenPtr[1].start; - nameChars = varTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { - return TCL_ERROR; - } - dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, procPtr); - - /* * Emit the key and the code to actually do the increment. */ -- cgit v0.12 From 5ebd0feb1ccf775ec9f6dec2643698330dce1467 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 11 Dec 2014 15:45:16 +0000 Subject: Similar conversion for [dict update] compiler. --- generic/tclCompCmds.c | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 33598e7..0c5b19d 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -818,7 +818,7 @@ TclCompileDictForCmd( Tcl_DString buffer; /* - * There must be at least three argument after the command. + * There must be exactly three arguments after the command. */ if (parsePtr->numWords != 4 || procPtr == NULL) { @@ -1004,21 +1004,11 @@ TclCompileDictUpdateCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Proc *procPtr = envPtr->procPtr; - DefineLineInformation; /* TIP #280 */ - const char *name; - int i, nameChars, dictIndex, numVars, range, infoIndex; + int i, dictIndex, numVars, range, infoIndex, isSimple, isScalar; Tcl_Token **keyTokenPtrs, *dictVarTokenPtr, *bodyTokenPtr, *tokenPtr; DictUpdateInfo *duiPtr; JumpFixup jumpFixup; - - /* - * There must be at least one argument after the command. - */ - - if (parsePtr->numWords < 5 || procPtr == NULL) { - return TCL_ERROR; - } + DefineLineInformation; /* TIP #280 */ /* * Parse the command. Expect the following: @@ -1029,6 +1019,9 @@ TclCompileDictUpdateCmd( return TCL_ERROR; } numVars = (parsePtr->numWords - 3) / 2; + if (numVars < 1) { + return TCL_ERROR; + } /* * The dictionary variable must be a local scalar that is knowable at @@ -1037,15 +1030,11 @@ TclCompileDictUpdateCmd( */ dictVarTokenPtr = TokenAfter(parsePtr->tokenPtr); - if (dictVarTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - name = dictVarTokenPtr[1].start; - nameChars = dictVarTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { + PushVarNameWord(interp, dictVarTokenPtr, envPtr, TCL_CREATE_VAR, + &dictIndex, &isSimple, &isScalar, 1); + if (!isScalar || dictIndex < 0) { return TCL_ERROR; } - dictIndex = TclFindCompiledLocal(name, nameChars, 1, procPtr); /* * Assemble the instruction metadata. This is complex enough that it is @@ -1061,6 +1050,8 @@ TclCompileDictUpdateCmd( tokenPtr = TokenAfter(dictVarTokenPtr); for (i=0 ; itype != TCL_TOKEN_SIMPLE_WORD) { - ckfree((char *) duiPtr); - TclStackFree(interp, keyTokenPtrs); - return TCL_ERROR; - } - name = tokenPtr[1].start; - nameChars = tokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { + PushVarNameWord(interp, tokenPtr, envPtr, TCL_CREATE_VAR, + &index, &isSimple, &isScalar, 1); + if (!isScalar || index < 0) { ckfree((char *) duiPtr); TclStackFree(interp, keyTokenPtrs); return TCL_ERROR; @@ -1089,8 +1075,7 @@ TclCompileDictUpdateCmd( * Stash the index in the auxiliary data. */ - duiPtr->varIndices[i] = - TclFindCompiledLocal(name, nameChars, 1, procPtr); + duiPtr->varIndices[i] = index; tokenPtr = TokenAfter(tokenPtr); } if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { -- cgit v0.12 From 40ae358427d50647875105fb9760de916f5b56d1 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 11 Dec 2014 16:00:19 +0000 Subject: Similar conversion of the [dict append] compiler. --- generic/tclCompCmds.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 0c5b19d..a0f493c 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1156,18 +1156,17 @@ TclCompileDictAppendCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Proc *procPtr = envPtr->procPtr; - DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - int i, dictVarIndex; + int i, isSimple, isScalar, dictVarIndex; + DefineLineInformation; /* TIP #280 */ /* - * There must be at least two argument after the command. And we impose an - * (arbirary) safe limit; anyone exceeding it should stop worrying about - * speed quite so much. ;-) + * There must be at least two argument after the command. Since we + * implement using INST_CONCAT1, make sure the number of arguments + * stays within its range. */ - if (parsePtr->numWords<4 || parsePtr->numWords>100 || procPtr==NULL) { + if (parsePtr->numWords<4 || parsePtr->numWords>258) { return TCL_ERROR; } @@ -1176,16 +1175,10 @@ TclCompileDictAppendCmd( */ tokenPtr = TokenAfter(parsePtr->tokenPtr); - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + PushVarNameWord(interp, tokenPtr, envPtr, TCL_CREATE_VAR, + &dictVarIndex, &isSimple, &isScalar, 1); + if (!isScalar || dictVarIndex < 0) { return TCL_ERROR; - } else { - register const char *name = tokenPtr[1].start; - register int nameChars = tokenPtr[1].size; - - if (!TclIsLocalScalar(name, nameChars)) { - return TCL_ERROR; - } - dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, procPtr); } /* -- cgit v0.12 From 93dbe714cd6d9348302c7bfb6c3380b0ef868b8a Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Sat, 13 Dec 2014 02:47:25 +0000 Subject: Add header install flag to OS X GNUMakefile; thanks to Stephan Houben for patch --- macosx/GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile index d7b0d1d..54eea8e 100644 --- a/macosx/GNUmakefile +++ b/macosx/GNUmakefile @@ -100,7 +100,7 @@ INSTALL_TARGET := install export CPPROG := cp -p -INSTALL_TARGETS = install-binaries install-libraries +INSTALL_TARGETS = install-binaries install-headers install-libraries ifeq (${EMBEDDED_BUILD},) INSTALL_TARGETS += install-private-headers endif -- cgit v0.12 From b0d4be1426484422434b5b44f0ccdc6ee3d613c5 Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Sat, 13 Dec 2014 02:50:07 +0000 Subject: Add header install flag to OS X GNUMakefile; thanks to Stephan Houben for patch --- macosx/GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile index 7d19fc6..3598b3a 100644 --- a/macosx/GNUmakefile +++ b/macosx/GNUmakefile @@ -100,7 +100,7 @@ INSTALL_TARGET := install export CPPROG := cp -p -INSTALL_TARGETS = install-binaries install-libraries +INSTALL_TARGETS = install-binaries install-headers install-libraries ifeq (${EMBEDDED_BUILD},) INSTALL_TARGETS += install-private-headers endif -- cgit v0.12 From 2933029b8c2dfc2e4a8bd89cacad8aa53099d5d4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 15 Dec 2014 10:20:39 +0000 Subject: 85 -> 86 --- win/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/README b/win/README index 1a2d501..5e060ef 100644 --- a/win/README +++ b/win/README @@ -79,7 +79,7 @@ Use the Makefile "install" target to install Tcl. It will install it according to the prefix options you provided in the correct directory structure. -Note that in order to run tclsh85.exe, you must ensure that tcl85.dll is +Note that in order to run tclsh86.exe, you must ensure that tcl86.dll is on your path, in the system directory, or in the directory containing tclsh86.exe. -- cgit v0.12 From d7699753fccbdc293c9e954833f62e623b5cbfd1 Mon Sep 17 00:00:00 2001 From: oehhar Date: Wed, 17 Dec 2014 08:22:23 +0000 Subject: Documented "fconfigure $h -connecting" on socket man page --- doc/socket.n | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/socket.n b/doc/socket.n index b7a4a45..492ca66 100644 --- a/doc/socket.n +++ b/doc/socket.n @@ -97,6 +97,10 @@ writable channel event on the socket to get notified when the asynchronous connection has succeeded or failed. See the \fBvwait\fR and the \fBchan\fR commands for more details on the event loop and channel events. +.PP +The \fBchan configure\fR option \fB-connecting\fR may be used to check if the connect is still running. To verify a successful connect, the option \fB-error\fR may be checked when \fB-connecting\fR returned 0. +.PP +Operation without the event queue requires at the moment calls to \fBchan configure\fR to advance the internal state machine. .RE .SH "SERVER SOCKETS" .PP @@ -186,6 +190,11 @@ sockets, this option returns a list of three elements; these are the address, the host name and the port to which the peer socket is connected or bound. If the host name cannot be computed, the second element of the list is identical to the address, its first element. +.RE +.TP +\fB\-connecting\fR +. +This option is not supported by server sockets. For client sockets, this option returns 1 if an asyncroneous connect is still in progress, 0 otherwise. .PP .SH "EXAMPLES" .PP -- cgit v0.12 From 0223e25353900418b1cbc95b25026f8acb0e8272 Mon Sep 17 00:00:00 2001 From: oehhar Date: Wed, 17 Dec 2014 08:42:24 +0000 Subject: Include option -connecting in test iocmd-8.15.1 --- tests/ioCmd.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 57f8d47..4fbc380 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -294,7 +294,7 @@ test iocmd-8.15.1 {fconfigure command / tcp channel} -constraints {socket unixOr close $srv unset cli srv port rename iocmdSRV {} -} -returnCodes error -result {bad option "-blah": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, -translation, -peername, or -sockname} +} -returnCodes error -result {bad option "-blah": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, -translation, -connecting, -peername, or -sockname} test iocmd-8.16 {fconfigure command / tcp channel} -constraints socket -setup { set srv [socket -server iocmdSRV -myaddr 127.0.0.1 0] set port [lindex [fconfigure $srv -sockname] 2] -- cgit v0.12 From 5e778621160b6ebe88507ef12c4f417e45dac219 Mon Sep 17 00:00:00 2001 From: oehhar Date: Wed, 17 Dec 2014 11:21:16 +0000 Subject: changes for TIP427 --- changes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changes b/changes index 1decfe2..79a242d 100644 --- a/changes +++ b/changes @@ -8491,3 +8491,5 @@ include ::oo::class (fellows) 2014-11-06 (bug)[5adc35] Stop forcing EOF to be permanent (porter) --- Released 8.6.3, November 12, 2014 --- http://core.tcl.tk/tcl/ for details + +2014-12-17 (TIP 427) [fconfigure $h -connecting, -peername, -sockname] (oehlmann,rmax) -- cgit v0.12 From 5c538fa1b96b4a1f0bf417d13cd4ce7f359db158 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 17 Dec 2014 19:57:40 +0000 Subject: Revise encoding finalization so that it does a more complete job of restoring the pre-initialized state. This makes finalization errors more repeatable and cross-platform. --- generic/tclEncoding.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index d246cb2..95c59c0 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -180,9 +180,9 @@ TCL_DECLARE_MUTEX(encodingMutex) * the system encoding will be used to perform the conversion. */ -static Tcl_Encoding defaultEncoding; -static Tcl_Encoding systemEncoding; -Tcl_Encoding tclIdentityEncoding; +static Tcl_Encoding defaultEncoding = NULL; +static Tcl_Encoding systemEncoding = NULL; +Tcl_Encoding tclIdentityEncoding = NULL; /* * The following variable is used in the sparse matrix code for a @@ -652,7 +652,10 @@ TclFinalizeEncodingSubsystem(void) Tcl_MutexLock(&encodingMutex); encodingsInitialized = 0; FreeEncoding(systemEncoding); + systemEncoding = NULL; + defaultEncoding = NULL; FreeEncoding(tclIdentityEncoding); + tclIdentityEncoding = NULL; hPtr = Tcl_FirstHashEntry(&encodingTable, &search); while (hPtr != NULL) { @@ -2960,7 +2963,9 @@ TableFreeProc( */ ckfree(dataPtr->toUnicode); + dataPtr->toUnicode = NULL; ckfree(dataPtr->fromUnicode); + dataPtr->fromUnicode = NULL; ckfree(dataPtr); } @@ -3433,6 +3438,7 @@ EscapeFreeProc( subTablePtr = dataPtr->subTables; for (i = 0; i < dataPtr->numSubTables; i++) { FreeEncoding((Tcl_Encoding) subTablePtr->encodingPtr); + subTablePtr->encodingPtr = NULL; subTablePtr++; } } -- cgit v0.12 From 200c04016f9228c906561843e82918f62292a1ab Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 17 Dec 2014 20:47:58 +0000 Subject: Rework the *FinalizeThread*() routines so that the quick exit preference is respected without need to run afoul of encoding finalizations. tests pass now. All changes are fully internal. --- generic/tclEvent.c | 14 +++++++++++--- generic/tclInt.h | 2 +- generic/tclThread.c | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 3985767..6ca22a6 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -119,6 +119,7 @@ static char * VwaitVarProc(ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void InvokeExitHandlers(void); +static void FinalizeThread(int quick); /* *---------------------------------------------------------------------- @@ -983,7 +984,7 @@ Tcl_Exit( * Tcl_Channels that may have data enqueued. */ - Tcl_FinalizeThread(); + FinalizeThread(/* quick */ 1); } TclpExit(status); Tcl_Panic("OS exit failed!"); @@ -1183,7 +1184,7 @@ Tcl_Finalize(void) * This fixes the Tcl Bug #990552. */ - TclFinalizeThreadData(); + TclFinalizeThreadData(/* quick */ 0); /* * Now we can free constants for conversions to/from double. @@ -1269,6 +1270,13 @@ Tcl_Finalize(void) void Tcl_FinalizeThread(void) { + FinalizeThread(/* quick */ 0); +} + +void +FinalizeThread( + int quick) +{ ExitHandler *exitPtr; ThreadSpecificData *tsdPtr; @@ -1309,7 +1317,7 @@ Tcl_FinalizeThread(void) * * Fix [Bug #571002] */ - TclFinalizeThreadData(); + TclFinalizeThreadData(quick); } /* diff --git a/generic/tclInt.h b/generic/tclInt.h index c989eda..995da48 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2927,7 +2927,7 @@ MODULE_SCOPE void TclFinalizePreserve(void); MODULE_SCOPE void TclFinalizeSynchronization(void); MODULE_SCOPE void TclFinalizeThreadAlloc(void); MODULE_SCOPE void TclFinalizeThreadAllocThread(void); -MODULE_SCOPE void TclFinalizeThreadData(void); +MODULE_SCOPE void TclFinalizeThreadData(int quick); MODULE_SCOPE void TclFinalizeThreadObjects(void); MODULE_SCOPE double TclFloor(const mp_int *a); MODULE_SCOPE void TclFormatNaN(double value, char *buffer); diff --git a/generic/tclThread.c b/generic/tclThread.c index 5ac6a8d..198fa6a 100644 --- a/generic/tclThread.c +++ b/generic/tclThread.c @@ -353,11 +353,11 @@ Tcl_ConditionFinalize( */ void -TclFinalizeThreadData(void) +TclFinalizeThreadData(int quick) { TclFinalizeThreadDataThread(); #if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) - if ((!TclInExit())||TclFullFinalizationRequested()) { + if (!quick) { /* * Quick exit principle makes it useless to terminate allocators */ -- cgit v0.12 From f1da0fefc6ab7f421a081f26b052cd5116c819e6 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 Dec 2014 18:06:51 +0000 Subject: [7c187a3773] Fix error in managing inStatePtr->inQueueTail value in the byte-moving optimized path of [chan copy]. Thanks to Benno. --- generic/tclIO.c | 3 +++ tests/io.test | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/generic/tclIO.c b/generic/tclIO.c index 2025742..8a35aee 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -9215,6 +9215,9 @@ MBWrite( } outStatePtr->outQueueTail = tail; inStatePtr->inQueueHead = bufPtr; + if (inStatePtr->inQueueTail == tail) { + inStatePtr->inQueueTail = bufPtr; + } if (bufPtr == NULL) { inStatePtr->inQueueTail = NULL; } diff --git a/tests/io.test b/tests/io.test index b09d55a..cd8b014 100644 --- a/tests/io.test +++ b/tests/io.test @@ -7900,6 +7900,44 @@ test io-53.16 {[ed29c4da21] MBRead: fblocked seen as error} -setup { close $c removeFile out } -result 100 +test io-53.17 {[7c187a3773] MBWrite: proper inQueueTail handling} -setup { + proc driver {cmd args} { + variable buffer + variable index + set chan [lindex $args 0] + switch -- $cmd { + initialize { + set index($chan) 0 + set buffer($chan) [encoding convertto utf-8 \ + line\n[string repeat a 100]line\n] + return {initialize finalize watch read} + } + finalize { + unset index($chan) buffer($chan) + return + } + watch {} + read { + set n [lindex $args 1] + set new [expr {$index($chan) + $n}] + set result [string range $buffer($chan) $index($chan) $new-1] + set index($chan) $new + return $result + } + } + } + set c [chan create read [namespace which driver]] + chan configure $c -encoding utf-8 -translation lf -buffersize 107 + set out [makeFile {} out] + set outChan [open $out w] + chan configure $outChan -encoding utf-8 -translation lf +} -body { + list [gets $c] [chan copy $c $outChan -size 100] [gets $c] +} -cleanup { + close $outChan + close $c + removeFile out +} -result {line 100 line} test io-54.1 {Recursive channel events} {socket fileevent} { # This test checks to see if file events are delivered during recursive -- cgit v0.12 From f06d852f72d64565eab335c0aaab3fdc60927171 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 Dec 2014 19:21:31 +0000 Subject: Shift the allocation of AuxData earlier in the [foreach] compiler. --- generic/tclCompCmds.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index a0f493c..f07b19f 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1536,7 +1536,7 @@ TclCompileForeachCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Proc *procPtr = envPtr->procPtr; - ForeachInfo *infoPtr; /* Points to the structure describing this + ForeachInfo *infoPtr = NULL;/* Points to the structure describing this * foreach command. Stored in a AuxData * record in the ByteCode. */ int firstValueTemp; /* Index of the first temp var in the frame @@ -1599,6 +1599,16 @@ TclCompileForeachCmd( memset((char*) varvList, 0, numLists * sizeof(const char **)); /* + * Create and initialize the ForeachInfo and ForeachVarList data + * structures describing this command. Then create a AuxData record + * pointing to the ForeachInfo structure. + */ + + infoPtr = (ForeachInfo *) ckalloc((unsigned) + sizeof(ForeachInfo) + numLists*sizeof(ForeachVarList *)); + infoPtr->numLists = 0; /* Count this up as we go */ + + /* * Break up each var list and set the varcList and varvList arrays. Don't * compile the foreach inline if any var name needs substitutions or isn't * a scalar, or if any var list needs substitutions. @@ -1609,6 +1619,7 @@ TclCompileForeachCmd( i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { Tcl_DString varList; + ForeachVarList *varListPtr; if (i%2 != 1) { continue; @@ -1634,6 +1645,12 @@ TclCompileForeachCmd( } numVars = varcList[loopIndex]; + varListPtr = (ForeachVarList *) ckalloc((unsigned) + sizeof(ForeachVarList) + numVars*sizeof(int)); + varListPtr->numVars = numVars; + infoPtr->varLists[loopIndex] = varListPtr; + infoPtr->numLists++; + /* * If the variable list is empty, we can enter an infinite loop when * the interpreted version would not. Take care to ensure this does @@ -1678,23 +1695,11 @@ TclCompileForeachCmd( loopCtTemp = TclFindCompiledLocal(NULL, /*nameChars*/ 0, /*create*/ 1, procPtr); - /* - * Create and initialize the ForeachInfo and ForeachVarList data - * structures describing this command. Then create a AuxData record - * pointing to the ForeachInfo structure. - */ - - infoPtr = (ForeachInfo *) ckalloc((unsigned) - sizeof(ForeachInfo) + numLists*sizeof(ForeachVarList *)); - infoPtr->numLists = numLists; infoPtr->firstValueTemp = firstValueTemp; infoPtr->loopCtTemp = loopCtTemp; for (loopIndex = 0; loopIndex < numLists; loopIndex++) { - ForeachVarList *varListPtr; - numVars = varcList[loopIndex]; - varListPtr = (ForeachVarList *) ckalloc((unsigned) - sizeof(ForeachVarList) + numVars*sizeof(int)); - varListPtr->numVars = numVars; + ForeachVarList *varListPtr = infoPtr->varLists[loopIndex]; + numVars = varListPtr->numVars; for (j = 0; j < numVars; j++) { const char *varName = varvList[loopIndex][j]; int nameChars = strlen(varName); @@ -1702,7 +1707,6 @@ TclCompileForeachCmd( varListPtr->varIndexes[j] = TclFindCompiledLocal(varName, nameChars, /*create*/ 1, procPtr); } - infoPtr->varLists[loopIndex] = varListPtr; } infoIndex = TclCreateAuxData(infoPtr, &tclForeachInfoType, envPtr); @@ -1816,6 +1820,11 @@ TclCompileForeachCmd( envPtr->currStackDepth = savedStackDepth + 1; done: + if (code == TCL_ERROR) { + if (infoPtr) { + FreeForeachInfo(infoPtr); + } + } for (loopIndex = 0; loopIndex < numLists; loopIndex++) { if (varvList[loopIndex] != NULL) { ckfree((char *) varvList[loopIndex]); -- cgit v0.12 From 0495b7f2194bbfb5a1d05b091df455407e717021 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 Dec 2014 20:34:12 +0000 Subject: With that shift, varcList is no longer needed. --- generic/tclCompCmds.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index f07b19f..739bf21 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1553,11 +1553,9 @@ TclCompileForeachCmd( /* * We parse the variable list argument words and create two arrays: - * varcList[i] is number of variables in i-th var list. * varvList[i] points to array of var names in i-th var list. */ - int *varcList; const char ***varvList; /* @@ -1592,8 +1590,6 @@ TclCompileForeachCmd( */ numLists = (numWords - 2)/2; - varcList = (int *) TclStackAlloc(interp, numLists * sizeof(int)); - memset(varcList, 0, numLists * sizeof(int)); varvList = (const char ***) TclStackAlloc(interp, numLists * sizeof(const char **)); memset((char*) varvList, 0, numLists * sizeof(const char **)); @@ -1637,13 +1633,12 @@ TclCompileForeachCmd( Tcl_DStringInit(&varList); Tcl_DStringAppend(&varList, tokenPtr[1].start, tokenPtr[1].size); code = Tcl_SplitList(interp, Tcl_DStringValue(&varList), - &varcList[loopIndex], &varvList[loopIndex]); + &numVars, &varvList[loopIndex]); Tcl_DStringFree(&varList); if (code != TCL_OK) { code = TCL_ERROR; goto done; } - numVars = varcList[loopIndex]; varListPtr = (ForeachVarList *) ckalloc((unsigned) sizeof(ForeachVarList) + numVars*sizeof(int)); @@ -1831,7 +1826,6 @@ TclCompileForeachCmd( } } TclStackFree(interp, (void *)varvList); - TclStackFree(interp, varcList); return code; } -- cgit v0.12 From 748fa3a11436f305210af6a3e39d41222c25d704 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 Dec 2014 20:38:53 +0000 Subject: Simplify creation and storage of temporaries --- generic/tclCompCmds.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 739bf21..d2d14f0 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1539,10 +1539,6 @@ TclCompileForeachCmd( ForeachInfo *infoPtr = NULL;/* Points to the structure describing this * foreach command. Stored in a AuxData * record in the ByteCode. */ - int firstValueTemp; /* Index of the first temp var in the frame - * used to point to a value list. */ - int loopCtTemp; /* Index of temp var holding the loop's - * iteration count. */ Tcl_Token *tokenPtr, *bodyTokenPtr; unsigned char *jumpPc; JumpFixup jumpFalseFixup; @@ -1679,19 +1675,14 @@ TclCompileForeachCmd( */ code = TCL_OK; - firstValueTemp = -1; - for (loopIndex = 0; loopIndex < numLists; loopIndex++) { - tempVar = TclFindCompiledLocal(NULL, /*nameChars*/ 0, - /*create*/ 1, procPtr); - if (loopIndex == 0) { - firstValueTemp = tempVar; - } + + tempVar = TclFindCompiledLocal(NULL, 0, 1, procPtr); + infoPtr->firstValueTemp = tempVar; + for (loopIndex = 1; loopIndex < numLists; loopIndex++) { + TclFindCompiledLocal(NULL, 0, 1, procPtr); } - loopCtTemp = TclFindCompiledLocal(NULL, /*nameChars*/ 0, - /*create*/ 1, procPtr); + infoPtr->loopCtTemp = TclFindCompiledLocal(NULL, 0, 1, procPtr); - infoPtr->firstValueTemp = firstValueTemp; - infoPtr->loopCtTemp = loopCtTemp; for (loopIndex = 0; loopIndex < numLists; loopIndex++) { ForeachVarList *varListPtr = infoPtr->varLists[loopIndex]; numVars = varListPtr->numVars; @@ -1722,14 +1713,13 @@ TclCompileForeachCmd( if ((i%2 == 0) && (i > 0)) { SetLineInformation (i); CompileTokens(envPtr, tokenPtr, interp); - tempVar = (firstValueTemp + loopIndex); if (tempVar <= 255) { TclEmitInstInt1(INST_STORE_SCALAR1, tempVar, envPtr); } else { TclEmitInstInt4(INST_STORE_SCALAR4, tempVar, envPtr); } TclEmitOpcode(INST_POP, envPtr); - loopIndex++; + loopIndex++; tempVar++; } } -- cgit v0.12 From 3073801f15238627be21f713862787d8a5248c21 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 Dec 2014 21:08:53 +0000 Subject: Replace use of TclIsLocalScalar() and late setting of varIndexes with an earlier setting of varIndexes using PushVarNameWord(). --- generic/tclCompCmds.c | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index d2d14f0..bae1fd1 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1545,6 +1545,7 @@ TclCompileForeachCmd( int jumpBackDist, jumpBackOffset, infoIndex, range; int numWords, numLists, numVars, loopIndex, tempVar, i, j, code; int savedStackDepth = envPtr->currStackDepth; + Tcl_Obj *varListObj = NULL; DefineLineInformation; /* TIP #280 */ /* @@ -1607,6 +1608,7 @@ TclCompileForeachCmd( */ loopIndex = 0; + varListObj = Tcl_NewObj(); for (i = 0, tokenPtr = parsePtr->tokenPtr; i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { @@ -1616,7 +1618,16 @@ TclCompileForeachCmd( if (i%2 != 1) { continue; } - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + + /* + * If the variable list is empty, we can enter an infinite loop when + * the interpreted version would not. Take care to ensure this does + * not happen. [Bug 1671138] + */ + + if (!TclWordKnownAtCompileTime(tokenPtr, varListObj) || + TCL_OK != Tcl_ListObjLength(NULL, varListObj, &numVars) || + numVars == 0) { code = TCL_ERROR; goto done; } @@ -1642,25 +1653,23 @@ TclCompileForeachCmd( infoPtr->varLists[loopIndex] = varListPtr; infoPtr->numLists++; - /* - * If the variable list is empty, we can enter an infinite loop when - * the interpreted version would not. Take care to ensure this does - * not happen. [Bug 1671138] - */ - - if (numVars == 0) { - code = TCL_ERROR; - goto done; - } - for (j = 0; j < numVars; j++) { - const char *varName = varvList[loopIndex][j]; - - if (!TclIsLocalScalar(varName, (int) strlen(varName))) { + Tcl_Obj *varNameObj; + Tcl_Token token; + int varIndex, isSimple, isScalar; + + Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj); + token.start = Tcl_GetStringFromObj(varNameObj, &token.size); + PushVarNameWord(interp, &token, envPtr, TCL_CREATE_VAR, + &varIndex, &isSimple, &isScalar, 0 /* ignored */); + if (!isScalar || varIndex < 0) { code = TCL_ERROR; goto done; } + varListPtr->varIndexes[j] = varIndex; } + + Tcl_SetObjLength(varListObj, 0); loopIndex++; } @@ -1683,6 +1692,7 @@ TclCompileForeachCmd( } infoPtr->loopCtTemp = TclFindCompiledLocal(NULL, 0, 1, procPtr); +#if 0 for (loopIndex = 0; loopIndex < numLists; loopIndex++) { ForeachVarList *varListPtr = infoPtr->varLists[loopIndex]; numVars = varListPtr->numVars; @@ -1694,6 +1704,7 @@ TclCompileForeachCmd( nameChars, /*create*/ 1, procPtr); } } +#endif infoIndex = TclCreateAuxData(infoPtr, &tclForeachInfoType, envPtr); /* @@ -1810,6 +1821,9 @@ TclCompileForeachCmd( FreeForeachInfo(infoPtr); } } + if (varListObj) { + Tcl_DecrRefCount(varListObj); + } for (loopIndex = 0; loopIndex < numLists; loopIndex++) { if (varvList[loopIndex] != NULL) { ckfree((char *) varvList[loopIndex]); -- cgit v0.12 From 0b46203902b6bab47f2b10309f367e56fbf834ad Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 Dec 2014 21:29:07 +0000 Subject: Fix up the token array passed to PushVarNameWord. Remove string list parse. --- generic/tclCompCmds.c | 39 ++++++--------------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index bae1fd1..6fa1e71 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1543,7 +1543,7 @@ TclCompileForeachCmd( unsigned char *jumpPc; JumpFixup jumpFalseFixup; int jumpBackDist, jumpBackOffset, infoIndex, range; - int numWords, numLists, numVars, loopIndex, tempVar, i, j, code; + int numWords, numLists, numVars, loopIndex, tempVar, i, j, code = TCL_OK; int savedStackDepth = envPtr->currStackDepth; Tcl_Obj *varListObj = NULL; DefineLineInformation; /* TIP #280 */ @@ -1612,7 +1612,6 @@ TclCompileForeachCmd( for (i = 0, tokenPtr = parsePtr->tokenPtr; i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { - Tcl_DString varList; ForeachVarList *varListPtr; if (i%2 != 1) { @@ -1632,21 +1631,6 @@ TclCompileForeachCmd( goto done; } - /* - * Lots of copying going on here. Need a ListObj wizard to show a - * better way. - */ - - Tcl_DStringInit(&varList); - Tcl_DStringAppend(&varList, tokenPtr[1].start, tokenPtr[1].size); - code = Tcl_SplitList(interp, Tcl_DStringValue(&varList), - &numVars, &varvList[loopIndex]); - Tcl_DStringFree(&varList); - if (code != TCL_OK) { - code = TCL_ERROR; - goto done; - } - varListPtr = (ForeachVarList *) ckalloc((unsigned) sizeof(ForeachVarList) + numVars*sizeof(int)); varListPtr->numVars = numVars; @@ -1655,12 +1639,14 @@ TclCompileForeachCmd( for (j = 0; j < numVars; j++) { Tcl_Obj *varNameObj; - Tcl_Token token; + Tcl_Token token[2]; int varIndex, isSimple, isScalar; Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj); - token.start = Tcl_GetStringFromObj(varNameObj, &token.size); - PushVarNameWord(interp, &token, envPtr, TCL_CREATE_VAR, + token[0].type = TCL_TOKEN_SIMPLE_WORD; + token[0].numComponents = 1; + token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); + PushVarNameWord(interp, token, envPtr, TCL_CREATE_VAR, &varIndex, &isSimple, &isScalar, 0 /* ignored */); if (!isScalar || varIndex < 0) { code = TCL_ERROR; @@ -1692,19 +1678,6 @@ TclCompileForeachCmd( } infoPtr->loopCtTemp = TclFindCompiledLocal(NULL, 0, 1, procPtr); -#if 0 - for (loopIndex = 0; loopIndex < numLists; loopIndex++) { - ForeachVarList *varListPtr = infoPtr->varLists[loopIndex]; - numVars = varListPtr->numVars; - for (j = 0; j < numVars; j++) { - const char *varName = varvList[loopIndex][j]; - int nameChars = strlen(varName); - - varListPtr->varIndexes[j] = TclFindCompiledLocal(varName, - nameChars, /*create*/ 1, procPtr); - } - } -#endif infoIndex = TclCreateAuxData(infoPtr, &tclForeachInfoType, envPtr); /* -- cgit v0.12 From 40d7215d54e63c1f2c3c064b112c078e1edf6fba Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 Dec 2014 22:00:08 +0000 Subject: No need for varvList any more. --- generic/tclCompCmds.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 6fa1e71..1bafbe2 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1549,13 +1549,6 @@ TclCompileForeachCmd( DefineLineInformation; /* TIP #280 */ /* - * We parse the variable list argument words and create two arrays: - * varvList[i] points to array of var names in i-th var list. - */ - - const char ***varvList; - - /* * If the foreach command isn't in a procedure, don't compile it inline: * the payoff is too small. */ @@ -1583,26 +1576,18 @@ TclCompileForeachCmd( } /* - * Allocate storage for the varcList and varvList arrays if necessary. - */ - - numLists = (numWords - 2)/2; - varvList = (const char ***) TclStackAlloc(interp, - numLists * sizeof(const char **)); - memset((char*) varvList, 0, numLists * sizeof(const char **)); - - /* * Create and initialize the ForeachInfo and ForeachVarList data * structures describing this command. Then create a AuxData record * pointing to the ForeachInfo structure. */ + numLists = (numWords - 2)/2; infoPtr = (ForeachInfo *) ckalloc((unsigned) sizeof(ForeachInfo) + numLists*sizeof(ForeachVarList *)); infoPtr->numLists = 0; /* Count this up as we go */ /* - * Break up each var list and set the varcList and varvList arrays. Don't + * Parse each var list into sequence of var names. Don't * compile the foreach inline if any var name needs substitutions or isn't * a scalar, or if any var list needs substitutions. */ @@ -1669,8 +1654,6 @@ TclCompileForeachCmd( * nonoverlapping foreach loops, they don't share any temps. */ - code = TCL_OK; - tempVar = TclFindCompiledLocal(NULL, 0, 1, procPtr); infoPtr->firstValueTemp = tempVar; for (loopIndex = 1; loopIndex < numLists; loopIndex++) { @@ -1797,12 +1780,6 @@ TclCompileForeachCmd( if (varListObj) { Tcl_DecrRefCount(varListObj); } - for (loopIndex = 0; loopIndex < numLists; loopIndex++) { - if (varvList[loopIndex] != NULL) { - ckfree((char *) varvList[loopIndex]); - } - } - TclStackFree(interp, (void *)varvList); return code; } -- cgit v0.12 From 712798923a79fd0bd4a4020b31a06b21b139bdb1 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 Dec 2014 22:13:11 +0000 Subject: No need for a loopIndex. --- generic/tclCompCmds.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 1bafbe2..0030f62 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1543,7 +1543,7 @@ TclCompileForeachCmd( unsigned char *jumpPc; JumpFixup jumpFalseFixup; int jumpBackDist, jumpBackOffset, infoIndex, range; - int numWords, numLists, numVars, loopIndex, tempVar, i, j, code = TCL_OK; + int numWords, numLists, numVars, tempVar, i, j, code = TCL_OK; int savedStackDepth = envPtr->currStackDepth; Tcl_Obj *varListObj = NULL; DefineLineInformation; /* TIP #280 */ @@ -1592,7 +1592,6 @@ TclCompileForeachCmd( * a scalar, or if any var list needs substitutions. */ - loopIndex = 0; varListObj = Tcl_NewObj(); for (i = 0, tokenPtr = parsePtr->tokenPtr; i < numWords-1; @@ -1619,7 +1618,7 @@ TclCompileForeachCmd( varListPtr = (ForeachVarList *) ckalloc((unsigned) sizeof(ForeachVarList) + numVars*sizeof(int)); varListPtr->numVars = numVars; - infoPtr->varLists[loopIndex] = varListPtr; + infoPtr->varLists[i/2] = varListPtr; infoPtr->numLists++; for (j = 0; j < numVars; j++) { @@ -1641,7 +1640,6 @@ TclCompileForeachCmd( } Tcl_SetObjLength(varListObj, 0); - loopIndex++; } /* @@ -1656,7 +1654,7 @@ TclCompileForeachCmd( tempVar = TclFindCompiledLocal(NULL, 0, 1, procPtr); infoPtr->firstValueTemp = tempVar; - for (loopIndex = 1; loopIndex < numLists; loopIndex++) { + for (i= 1; i < numLists; i++) { TclFindCompiledLocal(NULL, 0, 1, procPtr); } infoPtr->loopCtTemp = TclFindCompiledLocal(NULL, 0, 1, procPtr); @@ -1673,7 +1671,6 @@ TclCompileForeachCmd( * Evaluate then store each value list in the associated temporary. */ - loopIndex = 0; for (i = 0, tokenPtr = parsePtr->tokenPtr; i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { @@ -1686,7 +1683,7 @@ TclCompileForeachCmd( TclEmitInstInt4(INST_STORE_SCALAR4, tempVar, envPtr); } TclEmitOpcode(INST_POP, envPtr); - loopIndex++; tempVar++; + tempVar++; } } -- cgit v0.12 From fee272d8e8c4275d53f447cf243b898e9e97f611 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 Dec 2014 22:25:27 +0000 Subject: A bit more tidying... --- generic/tclCompCmds.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 0030f62..002012e 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1540,6 +1540,7 @@ TclCompileForeachCmd( * foreach command. Stored in a AuxData * record in the ByteCode. */ Tcl_Token *tokenPtr, *bodyTokenPtr; + Tcl_Token token[2]; unsigned char *jumpPc; JumpFixup jumpFalseFixup; int jumpBackDist, jumpBackOffset, infoIndex, range; @@ -1593,6 +1594,8 @@ TclCompileForeachCmd( */ varListObj = Tcl_NewObj(); + token[0].type = TCL_TOKEN_SIMPLE_WORD; + token[0].numComponents = 1; for (i = 0, tokenPtr = parsePtr->tokenPtr; i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { @@ -1623,12 +1626,9 @@ TclCompileForeachCmd( for (j = 0; j < numVars; j++) { Tcl_Obj *varNameObj; - Tcl_Token token[2]; int varIndex, isSimple, isScalar; Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj); - token[0].type = TCL_TOKEN_SIMPLE_WORD; - token[0].numComponents = 1; token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); PushVarNameWord(interp, token, envPtr, TCL_CREATE_VAR, &varIndex, &isSimple, &isScalar, 0 /* ignored */); @@ -1638,13 +1638,11 @@ TclCompileForeachCmd( } varListPtr->varIndexes[j] = varIndex; } - Tcl_SetObjLength(varListObj, 0); } /* - * We will compile the foreach command. Reserve (numLists + 1) temporary - * variables: + * Reserve (numLists + 1) temporary variables: * - numLists temps to hold each value list * - 1 temp for the loop counter (index of next element in each list) * -- cgit v0.12 From bf940be5ea25aa49bc0daf614c361a74dbf1b012 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 19 Dec 2014 03:31:09 +0000 Subject: Narrow scope of numVars. --- generic/tclCompCmds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 002012e..48eafe5 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1544,7 +1544,7 @@ TclCompileForeachCmd( unsigned char *jumpPc; JumpFixup jumpFalseFixup; int jumpBackDist, jumpBackOffset, infoIndex, range; - int numWords, numLists, numVars, tempVar, i, j, code = TCL_OK; + int numWords, numLists, tempVar, i, j, code = TCL_OK; int savedStackDepth = envPtr->currStackDepth; Tcl_Obj *varListObj = NULL; DefineLineInformation; /* TIP #280 */ @@ -1600,6 +1600,7 @@ TclCompileForeachCmd( i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { ForeachVarList *varListPtr; + int numVars; if (i%2 != 1) { continue; -- cgit v0.12 From 9d653549927d022c769366f299b04e085a79282d Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 19 Dec 2014 14:17:03 +0000 Subject: Replace TclIsLocalScalar() with PushVarNameWord() in [dict for] compiler. --- generic/tclCompCmds.c | 53 ++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 48eafe5..9ccfcb6 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -806,16 +806,17 @@ TclCompileDictForCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Proc *procPtr = envPtr->procPtr; - DefineLineInformation; /* TIP #280 */ Tcl_Token *varsTokenPtr, *dictTokenPtr, *bodyTokenPtr; - int keyVarIndex, valueVarIndex, nameChars, loopRange, catchRange; + int keyVarIndex, valueVarIndex, loopRange, catchRange; int infoIndex, jumpDisplacement, bodyTargetOffset, emptyTargetOffset; - int numVars, endTargetOffset; + int numVars, endTargetOffset, isSimple, isScalar; int savedStackDepth = envPtr->currStackDepth; /* Needed because jumps confuse the stack * space calculator. */ - const char **argv; - Tcl_DString buffer; + Tcl_Obj *varNameObj, *varListObj = NULL; + Tcl_Token token[2] = {{TCL_TOKEN_SIMPLE_WORD, NULL, 0, 1}, + {TCL_TOKEN_TEXT, NULL, 0, 0}}; + DefineLineInformation; /* TIP #280 */ /* * There must be exactly three arguments after the command. @@ -828,8 +829,8 @@ TclCompileDictForCmd( varsTokenPtr = TokenAfter(parsePtr->tokenPtr); dictTokenPtr = TokenAfter(varsTokenPtr); bodyTokenPtr = TokenAfter(dictTokenPtr); - if (varsTokenPtr->type != TCL_TOKEN_SIMPLE_WORD || - bodyTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + + if (bodyTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { return TCL_ERROR; } @@ -838,33 +839,33 @@ TclCompileDictForCmd( * Then extract their indices in the LVT. */ - Tcl_DStringInit(&buffer); - Tcl_DStringAppend(&buffer, varsTokenPtr[1].start, varsTokenPtr[1].size); - if (Tcl_SplitList(NULL, Tcl_DStringValue(&buffer), &numVars, - &argv) != TCL_OK) { - Tcl_DStringFree(&buffer); - return TCL_ERROR; - } - Tcl_DStringFree(&buffer); - if (numVars != 2) { - ckfree((char *) argv); + varListObj = Tcl_NewObj(); + if (!TclWordKnownAtCompileTime(varsTokenPtr, varListObj) || + TCL_OK != Tcl_ListObjLength(NULL, varListObj, &numVars) || + numVars != 2) { + Tcl_DecrRefCount(varListObj); return TCL_ERROR; } - nameChars = strlen(argv[0]); - if (!TclIsLocalScalar(argv[0], nameChars)) { - ckfree((char *) argv); + Tcl_ListObjIndex(NULL, varListObj, 0, &varNameObj); + token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); + PushVarNameWord(interp, token, envPtr, TCL_CREATE_VAR, + &keyVarIndex, &isSimple, &isScalar, 0 /* ignored */); + if (!isScalar || keyVarIndex < 0) { + Tcl_DecrRefCount(varListObj); return TCL_ERROR; } - keyVarIndex = TclFindCompiledLocal(argv[0], nameChars, 1, procPtr); - nameChars = strlen(argv[1]); - if (!TclIsLocalScalar(argv[1], nameChars)) { - ckfree((char *) argv); + Tcl_ListObjIndex(NULL, varListObj, 1, &varNameObj); + token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); + PushVarNameWord(interp, token, envPtr, TCL_CREATE_VAR, + &valueVarIndex, &isSimple, &isScalar, 0 /* ignored */); + if (!isScalar || valueVarIndex < 0) { + Tcl_DecrRefCount(varListObj); return TCL_ERROR; } - valueVarIndex = TclFindCompiledLocal(argv[1], nameChars, 1, procPtr); - ckfree((char *) argv); + + Tcl_DecrRefCount(varListObj); /* * Allocate a temporary variable to store the iterator reference. The -- cgit v0.12 From e0d2d783da5413e8df4bbd78f16d628d1d46b8a9 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 19 Dec 2014 14:21:42 +0000 Subject: With no callers left, TclIsLocalScalar() is removed. --- generic/tclInt.h | 1 - generic/tclParse.c | 50 -------------------------------------------------- 2 files changed, 51 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 255ee23..18574c3 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2606,7 +2606,6 @@ MODULE_SCOPE void TclInitNotifier(void); MODULE_SCOPE void TclInitObjSubsystem(void); MODULE_SCOPE void TclInitSubsystems(void); MODULE_SCOPE int TclInterpReady(Tcl_Interp *interp); -MODULE_SCOPE int TclIsLocalScalar(const char *src, int len); MODULE_SCOPE int TclIsSpaceProc(char byte); MODULE_SCOPE int TclIsBareword(char byte); MODULE_SCOPE int TclJoinThread(Tcl_ThreadId id, int *result); diff --git a/generic/tclParse.c b/generic/tclParse.c index 025304c..c07336f 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -2563,56 +2563,6 @@ TclObjCommandComplete( } /* - *---------------------------------------------------------------------- - * - * TclIsLocalScalar -- - * - * Check to see if a given string is a legal scalar variable name with no - * namespace qualifiers or substitutions. - * - * Results: - * Returns 1 if the variable is a local scalar. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -TclIsLocalScalar( - const char *src, - int len) -{ - const char *p; - const char *lastChar = src + (len - 1); - - for (p=src ; p<=lastChar ; p++) { - if ((CHAR_TYPE(*p) != TYPE_NORMAL) && - (CHAR_TYPE(*p) != TYPE_COMMAND_END)) { - /* - * TCL_COMMAND_END is returned for the last character of the - * string. By this point we know it isn't an array or namespace - * reference. - */ - - return 0; - } - if (*p == '(') { - if (*lastChar == ')') { /* We have an array element */ - return 0; - } - } else if (*p == ':') { - if ((p != lastChar) && *(p+1) == ':') { /* qualified name */ - return 0; - } - } - } - - return 1; -} - -/* * Local Variables: * mode: c * c-basic-offset: 4 -- cgit v0.12 From d0716e3327f9df70f093ffa5ca02821d353d6699 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 19 Dec 2014 15:13:11 +0000 Subject: Use interp==NULL argument to PushVarName to signal that only an index into the CLT is sought, and no time should be wasted compiling other cases which the caller is just going to discard. --- generic/tclCompCmds.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 9ccfcb6..7577bd3 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -402,7 +402,7 @@ TclCompileCatchCmd( cmdTokenPtr = TokenAfter(parsePtr->tokenPtr); if (parsePtr->numWords >= 3) { resultNameTokenPtr = TokenAfter(cmdTokenPtr); - PushVarNameWord(interp, resultNameTokenPtr, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, resultNameTokenPtr, envPtr, TCL_CREATE_VAR, &resultIndex, &isSimple, &isScalar, 2); if (!isScalar || resultIndex < 0) { return TCL_ERROR; @@ -410,7 +410,7 @@ TclCompileCatchCmd( if (parsePtr->numWords == 4) { optsNameTokenPtr = TokenAfter(resultNameTokenPtr); - PushVarNameWord(interp, optsNameTokenPtr, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, optsNameTokenPtr, envPtr, TCL_CREATE_VAR, &optsIndex, &isSimple, &isScalar, 3); if (!isScalar || resultIndex < 0) { return TCL_ERROR; @@ -673,7 +673,7 @@ TclCompileDictSetCmd( */ varTokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(interp, varTokenPtr, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, varTokenPtr, envPtr, TCL_CREATE_VAR, &dictVarIndex, &isSimple, &isScalar, 1); if (!isScalar || dictVarIndex < 0) { return TCL_ERROR; @@ -726,7 +726,7 @@ TclCompileDictIncrCmd( */ varTokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(interp, varTokenPtr, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, varTokenPtr, envPtr, TCL_CREATE_VAR, &dictVarIndex, &isSimple, &isScalar, 1); if (!isScalar || dictVarIndex < 0) { return TCL_ERROR; @@ -849,7 +849,7 @@ TclCompileDictForCmd( Tcl_ListObjIndex(NULL, varListObj, 0, &varNameObj); token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); - PushVarNameWord(interp, token, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, token, envPtr, TCL_CREATE_VAR, &keyVarIndex, &isSimple, &isScalar, 0 /* ignored */); if (!isScalar || keyVarIndex < 0) { Tcl_DecrRefCount(varListObj); @@ -858,7 +858,7 @@ TclCompileDictForCmd( Tcl_ListObjIndex(NULL, varListObj, 1, &varNameObj); token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); - PushVarNameWord(interp, token, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, token, envPtr, TCL_CREATE_VAR, &valueVarIndex, &isSimple, &isScalar, 0 /* ignored */); if (!isScalar || valueVarIndex < 0) { Tcl_DecrRefCount(varListObj); @@ -1031,7 +1031,7 @@ TclCompileDictUpdateCmd( */ dictVarTokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(interp, dictVarTokenPtr, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, dictVarTokenPtr, envPtr, TCL_CREATE_VAR, &dictIndex, &isSimple, &isScalar, 1); if (!isScalar || dictIndex < 0) { return TCL_ERROR; @@ -1064,7 +1064,7 @@ TclCompileDictUpdateCmd( */ tokenPtr = TokenAfter(tokenPtr); - PushVarNameWord(interp, tokenPtr, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, tokenPtr, envPtr, TCL_CREATE_VAR, &index, &isSimple, &isScalar, 1); if (!isScalar || index < 0) { ckfree((char *) duiPtr); @@ -1176,7 +1176,7 @@ TclCompileDictAppendCmd( */ tokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(interp, tokenPtr, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, tokenPtr, envPtr, TCL_CREATE_VAR, &dictVarIndex, &isSimple, &isScalar, 1); if (!isScalar || dictVarIndex < 0) { return TCL_ERROR; @@ -1227,7 +1227,7 @@ TclCompileDictLappendCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); keyTokenPtr = TokenAfter(varTokenPtr); valueTokenPtr = TokenAfter(keyTokenPtr); - PushVarNameWord(interp, varTokenPtr, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, varTokenPtr, envPtr, TCL_CREATE_VAR, &dictVarIndex, &isSimple, &isScalar, 1); if (!isScalar || dictVarIndex < 0) { return TCL_ERROR; @@ -1632,7 +1632,7 @@ TclCompileForeachCmd( Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj); token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); - PushVarNameWord(interp, token, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, token, envPtr, TCL_CREATE_VAR, &varIndex, &isSimple, &isScalar, 0 /* ignored */); if (!isScalar || varIndex < 0) { code = TCL_ERROR; @@ -4805,7 +4805,7 @@ PushVarName( elemTokenCount = 1; } } - } else if (((n = varTokenPtr->numComponents) > 1) + } else if (interp && ((n = varTokenPtr->numComponents) > 1) && (varTokenPtr[1].type == TCL_TOKEN_TEXT) && (varTokenPtr[n].type == TCL_TOKEN_TEXT) && (varTokenPtr[n].start[varTokenPtr[n].size - 1] == ')')) { @@ -4907,7 +4907,7 @@ PushVarName( localIndex = -1; } } - if (localIndex < 0) { + if (interp && localIndex < 0) { PushLiteral(envPtr, name, nameChars); } @@ -4915,7 +4915,7 @@ PushVarName( * Compile the element script, if any. */ - if (elName != NULL) { + if (interp && elName != NULL) { if (elNameChars) { envPtr->line = line; envPtr->clNext = clNext; @@ -4924,7 +4924,7 @@ PushVarName( PushLiteral(envPtr, "", 0); } } - } else { + } else if (interp) { /* * The var name isn't simple: compile and push it. */ @@ -5708,7 +5708,7 @@ TclCompileUpvarCmd( localTokenPtr = TokenAfter(otherTokenPtr); CompileWord(envPtr, otherTokenPtr, interp, i); - PushVarNameWord(interp, localTokenPtr, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, localTokenPtr, envPtr, TCL_CREATE_VAR, &localIndex, &simpleVarName, &isScalar, i+1); if((localIndex < 0) || !isScalar) { @@ -5800,7 +5800,7 @@ TclCompileNamespaceCmd( localTokenPtr = TokenAfter(otherTokenPtr); CompileWord(envPtr, otherTokenPtr, interp, i); - PushVarNameWord(interp, localTokenPtr, envPtr, TCL_CREATE_VAR, + PushVarNameWord(NULL, localTokenPtr, envPtr, TCL_CREATE_VAR, &localIndex, &simpleVarName, &isScalar, i+1); if((localIndex < 0) || !isScalar) { -- cgit v0.12 From bc2ceda54bb62fdb07246c174ec53210f21ab3bd Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 19 Dec 2014 15:55:21 +0000 Subject: New utility routine GetLocalScalarIndex() reduces common caller boilerplate (and fixes a bug!) --- generic/tclCompCmds.c | 112 ++++++++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 7577bd3..6821637 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -152,6 +152,8 @@ static void FreeJumptableInfo(ClientData clientData); static void PrintJumptableInfo(ClientData clientData, Tcl_Obj *appendObj, ByteCode *codePtr, unsigned int pcOffset); +static int GetLocalScalarIndex(Tcl_Token *tokenPtr, + CompileEnv *envPtr, int *indexPtr); static int PushVarName(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags, int *localIndexPtr, @@ -379,7 +381,7 @@ TclCompileCatchCmd( { JumpFixup jumpFixup; Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr; - int resultIndex, optsIndex, isSimple, isScalar, range; + int resultIndex, optsIndex, range; int initStackDepth = envPtr->currStackDepth; int savedStackDepth; DefineLineInformation; /* TIP #280 */ @@ -402,17 +404,13 @@ TclCompileCatchCmd( cmdTokenPtr = TokenAfter(parsePtr->tokenPtr); if (parsePtr->numWords >= 3) { resultNameTokenPtr = TokenAfter(cmdTokenPtr); - PushVarNameWord(NULL, resultNameTokenPtr, envPtr, TCL_CREATE_VAR, - &resultIndex, &isSimple, &isScalar, 2); - if (!isScalar || resultIndex < 0) { + if (!GetLocalScalarIndex(resultNameTokenPtr, envPtr, &resultIndex)) { return TCL_ERROR; } if (parsePtr->numWords == 4) { optsNameTokenPtr = TokenAfter(resultNameTokenPtr); - PushVarNameWord(NULL, optsNameTokenPtr, envPtr, TCL_CREATE_VAR, - &optsIndex, &isSimple, &isScalar, 3); - if (!isScalar || resultIndex < 0) { + if (!GetLocalScalarIndex(optsNameTokenPtr, envPtr, &optsIndex)) { return TCL_ERROR; } } @@ -653,9 +651,8 @@ TclCompileDictSetCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr; - Tcl_Token *varTokenPtr; - int i, isSimple, isScalar = 0, dictVarIndex = -1; + Tcl_Token *tokenPtr, *varTokenPtr; + int i, dictVarIndex; DefineLineInformation; /* TIP #280 */ /* @@ -673,9 +670,7 @@ TclCompileDictSetCmd( */ varTokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(NULL, varTokenPtr, envPtr, TCL_CREATE_VAR, - &dictVarIndex, &isSimple, &isScalar, 1); - if (!isScalar || dictVarIndex < 0) { + if (!GetLocalScalarIndex(varTokenPtr, envPtr, &dictVarIndex)) { return TCL_ERROR; } @@ -708,7 +703,7 @@ TclCompileDictIncrCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr, *keyTokenPtr; - int dictVarIndex, incrAmount, isScalar, isSimple; + int dictVarIndex, incrAmount; DefineLineInformation; /* TIP #280 */ /* @@ -726,9 +721,7 @@ TclCompileDictIncrCmd( */ varTokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(NULL, varTokenPtr, envPtr, TCL_CREATE_VAR, - &dictVarIndex, &isSimple, &isScalar, 1); - if (!isScalar || dictVarIndex < 0) { + if (!GetLocalScalarIndex(varTokenPtr, envPtr, &dictVarIndex)) { return TCL_ERROR; } @@ -809,7 +802,7 @@ TclCompileDictForCmd( Tcl_Token *varsTokenPtr, *dictTokenPtr, *bodyTokenPtr; int keyVarIndex, valueVarIndex, loopRange, catchRange; int infoIndex, jumpDisplacement, bodyTargetOffset, emptyTargetOffset; - int numVars, endTargetOffset, isSimple, isScalar; + int numVars, endTargetOffset; int savedStackDepth = envPtr->currStackDepth; /* Needed because jumps confuse the stack * space calculator. */ @@ -849,18 +842,14 @@ TclCompileDictForCmd( Tcl_ListObjIndex(NULL, varListObj, 0, &varNameObj); token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); - PushVarNameWord(NULL, token, envPtr, TCL_CREATE_VAR, - &keyVarIndex, &isSimple, &isScalar, 0 /* ignored */); - if (!isScalar || keyVarIndex < 0) { + if (!GetLocalScalarIndex(token, envPtr, &keyVarIndex)) { Tcl_DecrRefCount(varListObj); return TCL_ERROR; } Tcl_ListObjIndex(NULL, varListObj, 1, &varNameObj); token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); - PushVarNameWord(NULL, token, envPtr, TCL_CREATE_VAR, - &valueVarIndex, &isSimple, &isScalar, 0 /* ignored */); - if (!isScalar || valueVarIndex < 0) { + if (!GetLocalScalarIndex(token, envPtr, &valueVarIndex)) { Tcl_DecrRefCount(varListObj); return TCL_ERROR; } @@ -1005,7 +994,7 @@ TclCompileDictUpdateCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - int i, dictIndex, numVars, range, infoIndex, isSimple, isScalar; + int i, dictIndex, numVars, range, infoIndex; Tcl_Token **keyTokenPtrs, *dictVarTokenPtr, *bodyTokenPtr, *tokenPtr; DictUpdateInfo *duiPtr; JumpFixup jumpFixup; @@ -1031,9 +1020,7 @@ TclCompileDictUpdateCmd( */ dictVarTokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(NULL, dictVarTokenPtr, envPtr, TCL_CREATE_VAR, - &dictIndex, &isSimple, &isScalar, 1); - if (!isScalar || dictIndex < 0) { + if (!GetLocalScalarIndex(dictVarTokenPtr, envPtr, &dictIndex)) { return TCL_ERROR; } @@ -1064,9 +1051,7 @@ TclCompileDictUpdateCmd( */ tokenPtr = TokenAfter(tokenPtr); - PushVarNameWord(NULL, tokenPtr, envPtr, TCL_CREATE_VAR, - &index, &isSimple, &isScalar, 1); - if (!isScalar || index < 0) { + if (!GetLocalScalarIndex(tokenPtr, envPtr, &index)) { ckfree((char *) duiPtr); TclStackFree(interp, keyTokenPtrs); return TCL_ERROR; @@ -1158,7 +1143,7 @@ TclCompileDictAppendCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; - int i, isSimple, isScalar, dictVarIndex; + int i, dictVarIndex; DefineLineInformation; /* TIP #280 */ /* @@ -1176,9 +1161,7 @@ TclCompileDictAppendCmd( */ tokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(NULL, tokenPtr, envPtr, TCL_CREATE_VAR, - &dictVarIndex, &isSimple, &isScalar, 1); - if (!isScalar || dictVarIndex < 0) { + if (!GetLocalScalarIndex(tokenPtr, envPtr, &dictVarIndex)) { return TCL_ERROR; } @@ -1213,7 +1196,7 @@ TclCompileDictLappendCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr, *keyTokenPtr, *valueTokenPtr; - int isSimple, dictVarIndex = -1, isScalar = 0; + int dictVarIndex; DefineLineInformation; /* TIP #280 */ /* @@ -1227,9 +1210,7 @@ TclCompileDictLappendCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); keyTokenPtr = TokenAfter(varTokenPtr); valueTokenPtr = TokenAfter(keyTokenPtr); - PushVarNameWord(NULL, varTokenPtr, envPtr, TCL_CREATE_VAR, - &dictVarIndex, &isSimple, &isScalar, 1); - if (!isScalar || dictVarIndex < 0) { + if (!GetLocalScalarIndex(varTokenPtr, envPtr, &dictVarIndex)) { return TCL_ERROR; } CompileWord(envPtr, keyTokenPtr, interp, 2); @@ -1628,17 +1609,14 @@ TclCompileForeachCmd( for (j = 0; j < numVars; j++) { Tcl_Obj *varNameObj; - int varIndex, isSimple, isScalar; Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj); token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); - PushVarNameWord(NULL, token, envPtr, TCL_CREATE_VAR, - &varIndex, &isSimple, &isScalar, 0 /* ignored */); - if (!isScalar || varIndex < 0) { + if (!GetLocalScalarIndex(token, envPtr, + varListPtr->varIndexes + j)) { code = TCL_ERROR; goto done; } - varListPtr->varIndexes[j] = varIndex; } Tcl_SetObjLength(varListObj, 0); } @@ -4717,6 +4695,38 @@ TclCompileWhileCmd( /* *---------------------------------------------------------------------- * + * GetLocalScalarIndex -- + * + * Procedure used in the compiling where pushing a variable name is + * necessary (append, lappend, set). + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "set" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +static int +GetLocalScalarIndex( + Tcl_Token *tokenPtr, + CompileEnv *envPtr, + int *indexPtr) +{ + int isSimple, isScalar; + + PushVarName(NULL, tokenPtr, envPtr, TCL_CREATE_VAR, indexPtr, + &isSimple, &isScalar, 0 /* ignored */, NULL /* ignored */); + return (isScalar && *indexPtr >= 0); +} + +/* + *---------------------------------------------------------------------- + * * PushVarName -- * * Procedure used in the compiling where pushing a variable name is @@ -5645,7 +5655,7 @@ TclCompileUpvarCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; - int simpleVarName, isScalar, localIndex, numWords, i; + int localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ Tcl_Obj *objPtr; @@ -5708,10 +5718,7 @@ TclCompileUpvarCmd( localTokenPtr = TokenAfter(otherTokenPtr); CompileWord(envPtr, otherTokenPtr, interp, i); - PushVarNameWord(NULL, localTokenPtr, envPtr, TCL_CREATE_VAR, - &localIndex, &simpleVarName, &isScalar, i+1); - - if((localIndex < 0) || !isScalar) { + if (!GetLocalScalarIndex(localTokenPtr, envPtr, &localIndex)) { return TCL_ERROR; } TclEmitInstInt4(INST_UPVAR, localIndex, envPtr); @@ -5755,7 +5762,7 @@ TclCompileNamespaceCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; - int simpleVarName, isScalar, localIndex, numWords, i; + int localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ if (envPtr->procPtr == NULL) { @@ -5800,10 +5807,7 @@ TclCompileNamespaceCmd( localTokenPtr = TokenAfter(otherTokenPtr); CompileWord(envPtr, otherTokenPtr, interp, i); - PushVarNameWord(NULL, localTokenPtr, envPtr, TCL_CREATE_VAR, - &localIndex, &simpleVarName, &isScalar, i+1); - - if((localIndex < 0) || !isScalar) { + if (!GetLocalScalarIndex(localTokenPtr, envPtr, &localIndex)) { return TCL_ERROR; } TclEmitInstInt4(INST_NSUPVAR, localIndex, envPtr); -- cgit v0.12 From a1d0d2dc435ce6072fbb7cf4f1b78ab2b05fdbc6 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 19 Dec 2014 17:09:32 +0000 Subject: Revise name and interface of new utility routines to match work already in place on the trunk. --- generic/tclCompCmds.c | 105 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 38 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 6821637..b3568e8 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -152,8 +152,10 @@ static void FreeJumptableInfo(ClientData clientData); static void PrintJumptableInfo(ClientData clientData, Tcl_Obj *appendObj, ByteCode *codePtr, unsigned int pcOffset); -static int GetLocalScalarIndex(Tcl_Token *tokenPtr, - CompileEnv *envPtr, int *indexPtr); +static int LocalScalarFromToken(Tcl_Token *tokenPtr, + CompileEnv *envPtr); +static int LocalScalar(const char *bytes, int numBytes, + CompileEnv *envPtr); static int PushVarName(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags, int *localIndexPtr, @@ -404,13 +406,15 @@ TclCompileCatchCmd( cmdTokenPtr = TokenAfter(parsePtr->tokenPtr); if (parsePtr->numWords >= 3) { resultNameTokenPtr = TokenAfter(cmdTokenPtr); - if (!GetLocalScalarIndex(resultNameTokenPtr, envPtr, &resultIndex)) { + resultIndex = LocalScalarFromToken(resultNameTokenPtr, envPtr); + if (resultIndex < 0) { return TCL_ERROR; } if (parsePtr->numWords == 4) { optsNameTokenPtr = TokenAfter(resultNameTokenPtr); - if (!GetLocalScalarIndex(optsNameTokenPtr, envPtr, &optsIndex)) { + optsIndex = LocalScalarFromToken(optsNameTokenPtr, envPtr); + if (optsIndex < 0) { return TCL_ERROR; } } @@ -670,7 +674,8 @@ TclCompileDictSetCmd( */ varTokenPtr = TokenAfter(parsePtr->tokenPtr); - if (!GetLocalScalarIndex(varTokenPtr, envPtr, &dictVarIndex)) { + dictVarIndex = LocalScalarFromToken(varTokenPtr, envPtr); + if (dictVarIndex < 0) { return TCL_ERROR; } @@ -721,7 +726,8 @@ TclCompileDictIncrCmd( */ varTokenPtr = TokenAfter(parsePtr->tokenPtr); - if (!GetLocalScalarIndex(varTokenPtr, envPtr, &dictVarIndex)) { + dictVarIndex = LocalScalarFromToken(varTokenPtr, envPtr); + if (dictVarIndex < 0) { return TCL_ERROR; } @@ -802,13 +808,12 @@ TclCompileDictForCmd( Tcl_Token *varsTokenPtr, *dictTokenPtr, *bodyTokenPtr; int keyVarIndex, valueVarIndex, loopRange, catchRange; int infoIndex, jumpDisplacement, bodyTargetOffset, emptyTargetOffset; - int numVars, endTargetOffset; + int numVars, endTargetOffset, numBytes; + const char *bytes; int savedStackDepth = envPtr->currStackDepth; /* Needed because jumps confuse the stack * space calculator. */ Tcl_Obj *varNameObj, *varListObj = NULL; - Tcl_Token token[2] = {{TCL_TOKEN_SIMPLE_WORD, NULL, 0, 1}, - {TCL_TOKEN_TEXT, NULL, 0, 0}}; DefineLineInformation; /* TIP #280 */ /* @@ -841,15 +846,17 @@ TclCompileDictForCmd( } Tcl_ListObjIndex(NULL, varListObj, 0, &varNameObj); - token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); - if (!GetLocalScalarIndex(token, envPtr, &keyVarIndex)) { + bytes = Tcl_GetStringFromObj(varNameObj, &numBytes); + keyVarIndex = LocalScalar(bytes, numBytes, envPtr); + if (keyVarIndex < 0) { Tcl_DecrRefCount(varListObj); return TCL_ERROR; } Tcl_ListObjIndex(NULL, varListObj, 1, &varNameObj); - token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); - if (!GetLocalScalarIndex(token, envPtr, &valueVarIndex)) { + bytes = Tcl_GetStringFromObj(varNameObj, &numBytes); + valueVarIndex = LocalScalar(bytes, numBytes, envPtr); + if (valueVarIndex < 0) { Tcl_DecrRefCount(varListObj); return TCL_ERROR; } @@ -1020,7 +1027,8 @@ TclCompileDictUpdateCmd( */ dictVarTokenPtr = TokenAfter(parsePtr->tokenPtr); - if (!GetLocalScalarIndex(dictVarTokenPtr, envPtr, &dictIndex)) { + dictIndex = LocalScalarFromToken(dictVarTokenPtr, envPtr); + if (dictIndex < 0) { return TCL_ERROR; } @@ -1051,7 +1059,8 @@ TclCompileDictUpdateCmd( */ tokenPtr = TokenAfter(tokenPtr); - if (!GetLocalScalarIndex(tokenPtr, envPtr, &index)) { + index = LocalScalarFromToken(tokenPtr, envPtr); + if (index < 0) { ckfree((char *) duiPtr); TclStackFree(interp, keyTokenPtrs); return TCL_ERROR; @@ -1161,7 +1170,8 @@ TclCompileDictAppendCmd( */ tokenPtr = TokenAfter(parsePtr->tokenPtr); - if (!GetLocalScalarIndex(tokenPtr, envPtr, &dictVarIndex)) { + dictVarIndex = LocalScalarFromToken(tokenPtr, envPtr); + if (dictVarIndex < 0) { return TCL_ERROR; } @@ -1210,7 +1220,8 @@ TclCompileDictLappendCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); keyTokenPtr = TokenAfter(varTokenPtr); valueTokenPtr = TokenAfter(keyTokenPtr); - if (!GetLocalScalarIndex(varTokenPtr, envPtr, &dictVarIndex)) { + dictVarIndex = LocalScalarFromToken(varTokenPtr, envPtr); + if (dictVarIndex < 0) { return TCL_ERROR; } CompileWord(envPtr, keyTokenPtr, interp, 2); @@ -1522,7 +1533,6 @@ TclCompileForeachCmd( * foreach command. Stored in a AuxData * record in the ByteCode. */ Tcl_Token *tokenPtr, *bodyTokenPtr; - Tcl_Token token[2]; unsigned char *jumpPc; JumpFixup jumpFalseFixup; int jumpBackDist, jumpBackOffset, infoIndex, range; @@ -1576,8 +1586,6 @@ TclCompileForeachCmd( */ varListObj = Tcl_NewObj(); - token[0].type = TCL_TOKEN_SIMPLE_WORD; - token[0].numComponents = 1; for (i = 0, tokenPtr = parsePtr->tokenPtr; i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { @@ -1609,11 +1617,13 @@ TclCompileForeachCmd( for (j = 0; j < numVars; j++) { Tcl_Obj *varNameObj; + int numBytes; + const char *bytes; Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj); - token[1].start = Tcl_GetStringFromObj(varNameObj, &token[1].size); - if (!GetLocalScalarIndex(token, envPtr, - varListPtr->varIndexes + j)) { + bytes = Tcl_GetStringFromObj(varNameObj, &numBytes); + varListPtr->varIndexes[j] = LocalScalar(bytes, numBytes, envPtr); + if (varListPtr->varIndexes[j] < 0) { code = TCL_ERROR; goto done; } @@ -4695,33 +4705,50 @@ TclCompileWhileCmd( /* *---------------------------------------------------------------------- * - * GetLocalScalarIndex -- + * LocalScalar(FromToken) -- * - * Procedure used in the compiling where pushing a variable name is - * necessary (append, lappend, set). + * Get the index into the table of compiled locals that corresponds + * to a local scalar variable name. * * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. + * Returns the non-negative integer index value into the table of + * compiled locals corresponding to a local scalar variable name. + * If the arguments passed in do not identify a local scalar variable + * then return -1. * * Side effects: - * Instructions are added to envPtr to execute the "set" command at - * runtime. + * May add an entry into the table of compiled locals. * *---------------------------------------------------------------------- */ static int -GetLocalScalarIndex( +LocalScalarFromToken( Tcl_Token *tokenPtr, - CompileEnv *envPtr, - int *indexPtr) + CompileEnv *envPtr) { - int isSimple, isScalar; + int isSimple, isScalar, index; - PushVarName(NULL, tokenPtr, envPtr, TCL_CREATE_VAR, indexPtr, + PushVarName(NULL, tokenPtr, envPtr, TCL_CREATE_VAR, &index, &isSimple, &isScalar, 0 /* ignored */, NULL /* ignored */); - return (isScalar && *indexPtr >= 0); + if (!isScalar) { + index = -1; + } + return index; +} + +static int +LocalScalar( + const char *bytes, + int numBytes, + CompileEnv *envPtr) +{ + Tcl_Token token[2] = {{TCL_TOKEN_SIMPLE_WORD, NULL, 0, 1}, + {TCL_TOKEN_TEXT, NULL, 0, 0}}; + + token[1].start = bytes; + token[1].size = numBytes; + return LocalScalarFromToken(token, envPtr); } /* @@ -5718,7 +5745,8 @@ TclCompileUpvarCmd( localTokenPtr = TokenAfter(otherTokenPtr); CompileWord(envPtr, otherTokenPtr, interp, i); - if (!GetLocalScalarIndex(localTokenPtr, envPtr, &localIndex)) { + localIndex = LocalScalarFromToken(localTokenPtr, envPtr); + if (localIndex < 0) { return TCL_ERROR; } TclEmitInstInt4(INST_UPVAR, localIndex, envPtr); @@ -5807,7 +5835,8 @@ TclCompileNamespaceCmd( localTokenPtr = TokenAfter(otherTokenPtr); CompileWord(envPtr, otherTokenPtr, interp, i); - if (!GetLocalScalarIndex(localTokenPtr, envPtr, &localIndex)) { + localIndex = LocalScalarFromToken(localTokenPtr, envPtr); + if (localIndex < 0) { return TCL_ERROR; } TclEmitInstInt4(INST_NSUPVAR, localIndex, envPtr); -- cgit v0.12 From b9a9261bbab10a7aafec70649ea9995057c0c0b8 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 22 Dec 2014 15:35:47 +0000 Subject: One more (interp==NULL) shortcut. --- generic/tclCompCmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index b3568e8..106c293 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -4826,7 +4826,7 @@ PushVarName( } } - if ((elName != NULL) && elNameChars) { + if (interp && (elName != NULL) && elNameChars) { /* * An array element, the element name is a simple string: * assemble the corresponding token. -- cgit v0.12 From e3e2ea19a40931da26882d9bbc7ff94a2cc001c9 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 22 Dec 2014 19:57:36 +0000 Subject: More complete use of the TCL_NO_ELEMENT flag to suppress useless actions. --- generic/tclCompCmds.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 30c1318..ee9209a 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -3313,7 +3313,7 @@ TclPushVarName( } } - if ((elName != NULL) && elNameChars) { + if (!(flags & TCL_NO_ELEMENT) && (elName != NULL) && elNameChars) { /* * An array element, the element name is a simple string: * assemble the corresponding token. @@ -3366,7 +3366,8 @@ TclPushVarName( remainingChars = (varTokenPtr[2].start - p) - 1; elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 1; - if (remainingChars) { + if (!(flags & TCL_NO_ELEMENT)) { + if (remainingChars) { /* * Make a first token with the extra characters in the first * token. @@ -3386,13 +3387,14 @@ TclPushVarName( memcpy(elemTokenPtr+1, varTokenPtr+2, (n-1) * sizeof(Tcl_Token)); - } else { + } else { /* * Use the already available tokens. */ elemTokenPtr = &varTokenPtr[2]; elemTokenCount = n - 1; + } } } } -- cgit v0.12 From a11afffa9f17e5c95a97d579ce36b386363c0133 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 22 Dec 2014 20:13:29 +0000 Subject: Use (interp == NULL) argument to TclPushVarName() to signal that no compiling is desired. Only a lookup of an index into the compiled variable table. --- generic/tclCompCmds.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index ee9209a..18071b1 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -3328,7 +3328,7 @@ TclPushVarName( elemTokenCount = 1; } } - } else if (((n = varTokenPtr->numComponents) > 1) + } else if (interp && ((n = varTokenPtr->numComponents) > 1) && (varTokenPtr[1].type == TCL_TOKEN_TEXT) && (varTokenPtr[n].type == TCL_TOKEN_TEXT) && (varTokenPtr[n].start[varTokenPtr[n].size - 1] == ')')) { @@ -3429,7 +3429,7 @@ TclPushVarName( localIndex = -1; } } - if (localIndex < 0) { + if (interp && localIndex < 0) { PushLiteral(envPtr, name, nameChars); } @@ -3446,7 +3446,7 @@ TclPushVarName( PushStringLiteral(envPtr, ""); } } - } else { + } else if (interp) { /* * The var name isn't simple: compile and push it. */ -- cgit v0.12 From a4001c9841d6451aa215a7387bf4a439b11a18fb Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 22 Dec 2014 20:27:14 +0000 Subject: Convert the LocalScalar*() macros to rest on TclPushVarName rather than on TclIsLocalScalar(). --- generic/tclCompCmds.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ generic/tclCompile.h | 10 ++++++---- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 18071b1..bde07bb 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -3234,6 +3234,54 @@ TclCompileFormatCmd( /* *---------------------------------------------------------------------- * + * TclLocalScalarFromToken -- + * + * Get the index into the table of compiled locals that corresponds + * to a local scalar variable name. + * + * Results: + * Returns the non-negative integer index value into the table of + * compiled locals corresponding to a local scalar variable name. + * If the arguments passed in do not identify a local scalar variable + * then return -1. + * + * Side effects: + * May add an entery into the table of compiled locals. + * + *---------------------------------------------------------------------- + */ + +int +TclLocalScalarFromToken( + Tcl_Token *tokenPtr, + CompileEnv *envPtr) +{ + int isScalar, index; + + TclPushVarName(NULL, tokenPtr, envPtr, TCL_NO_ELEMENT, &index, &isScalar); + if (!isScalar) { + index = -1; + } + return index; +} + +int +TclLocalScalar( + const char *bytes, + int numBytes, + CompileEnv *envPtr) +{ + Tcl_Token token[2] = {{TCL_TOKEN_SIMPLE_WORD, NULL, 0, 1}, + {TCL_TOKEN_TEXT, NULL, 0, 0}}; + + token[1].start = bytes; + token[1].size = numBytes; + return TclLocalScalarFromToken(token, envPtr); +} + +/* + *---------------------------------------------------------------------- + * * TclPushVarName -- * * Procedure used in the compiling where pushing a variable name is diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 51f0b34..c6c7a7c 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1151,6 +1151,10 @@ MODULE_SCOPE void TclFinalizeLoopExceptionRange(CompileEnv *envPtr, MODULE_SCOPE char * TclLiteralStats(LiteralTable *tablePtr); MODULE_SCOPE int TclLog2(int value); #endif +MODULE_SCOPE int TclLocalScalar(const char *bytes, int numBytes, + CompileEnv *envPtr); +MODULE_SCOPE int TclLocalScalarFromToken(Tcl_Token *tokenPtr, + CompileEnv *envPtr); MODULE_SCOPE void TclOptimizeBytecode(void *envPtr); #ifdef TCL_COMPILE_DEBUG MODULE_SCOPE void TclPrintByteCodeObj(Tcl_Interp *interp, @@ -1678,11 +1682,9 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData, #define AnonymousLocal(envPtr) \ (TclFindCompiledLocal(NULL, /*nameChars*/ 0, /*create*/ 1, (envPtr))) #define LocalScalar(chars,len,envPtr) \ - (!TclIsLocalScalar((chars), (len)) ? -1 : \ - TclFindCompiledLocal((chars), (len), /*create*/ 1, (envPtr))) + TclLocalScalar(chars, len, envPtr) #define LocalScalarFromToken(tokenPtr,envPtr) \ - ((tokenPtr)->type != TCL_TOKEN_SIMPLE_WORD ? -1 : \ - LocalScalar((tokenPtr)[1].start, (tokenPtr)[1].size, (envPtr))) + TclLocalScalarFromToken(tokenPtr, envPtr) /* * Flags bits used by TclPushVarName. -- cgit v0.12 From 4357393a80b049950ddac5db40e7c2e2d5de136f Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 23 Dec 2014 01:28:30 +0000 Subject: Revise CompileEachloopCmd() to use LocalScalar() in place of TclIsLocalScalar(). --- generic/tclCompCmds.c | 119 +++++++++++++++++--------------------------------- 1 file changed, 40 insertions(+), 79 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index bde07bb..ec398b6 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -2527,25 +2527,17 @@ CompileEachloopCmd( * (TCL_EACH_*) */ { Proc *procPtr = envPtr->procPtr; - ForeachInfo *infoPtr; /* Points to the structure describing this + ForeachInfo *infoPtr=NULL; /* Points to the structure describing this * foreach command. Stored in a AuxData * record in the ByteCode. */ Tcl_Token *tokenPtr, *bodyTokenPtr; int jumpBackOffset, infoIndex, range; - int numWords, numLists, numVars, loopIndex, i, j, code; + int numWords, numLists, i, j, code = TCL_OK; + Tcl_Obj *varListObj = NULL; DefineLineInformation; /* TIP #280 */ /* - * We parse the variable list argument words and create two arrays: - * varcList[i] is number of variables in i-th var list. - * varvList[i] points to array of var names in i-th var list. - */ - - int *varcList; - const char ***varvList; - - /* * If the foreach command isn't in a procedure, don't compile it inline: * the payoff is too small. */ @@ -2573,105 +2565,73 @@ CompileEachloopCmd( } /* - * Allocate storage for the varcList and varvList arrays if necessary. + * Create and initialize the ForeachInfo and ForeachVarList data + * structures describing this command. Then create a AuxData record + * pointing to the ForeachInfo structure. */ numLists = (numWords - 2)/2; - varcList = TclStackAlloc(interp, numLists * sizeof(int)); - memset(varcList, 0, numLists * sizeof(int)); - varvList = (const char ***) TclStackAlloc(interp, - numLists * sizeof(const char **)); - memset((char*) varvList, 0, numLists * sizeof(const char **)); + infoPtr = ckalloc(sizeof(ForeachInfo) + + (numLists - 1) * sizeof(ForeachVarList *)); + infoPtr->numLists = 0; /* Count this up as we go */ /* - * Break up each var list and set the varcList and varvList arrays. Don't + * Parse each var list into sequence of var names. Don't * compile the foreach inline if any var name needs substitutions or isn't * a scalar, or if any var list needs substitutions. */ - loopIndex = 0; + varListObj = Tcl_NewObj(); for (i = 0, tokenPtr = parsePtr->tokenPtr; i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { - Tcl_DString varList; + ForeachVarList *varListPtr; + int numVars; if (i%2 != 1) { continue; } - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - code = TCL_ERROR; - goto done; - } - - /* - * Lots of copying going on here. Need a ListObj wizard to show a - * better way. - */ - - Tcl_DStringInit(&varList); - TclDStringAppendToken(&varList, &tokenPtr[1]); - code = Tcl_SplitList(NULL, Tcl_DStringValue(&varList), - &varcList[loopIndex], &varvList[loopIndex]); - Tcl_DStringFree(&varList); - if (code != TCL_OK) { - code = TCL_ERROR; - goto done; - } - numVars = varcList[loopIndex]; /* * If the variable list is empty, we can enter an infinite loop when - * the interpreted version would not. Take care to ensure this does - * not happen. [Bug 1671138] + * the interpreted version would not. Take care to ensure this does + * not happen. [Bug 1671138] */ - if (numVars == 0) { + if (!TclWordKnownAtCompileTime(tokenPtr, varListObj) || + TCL_OK != Tcl_ListObjLength(NULL, varListObj, &numVars) || + numVars == 0) { code = TCL_ERROR; goto done; } - for (j = 0; j < numVars; j++) { - const char *varName = varvList[loopIndex][j]; + varListPtr = ckalloc(sizeof(ForeachVarList) + + (numVars - 1) * sizeof(int)); + varListPtr->numVars = numVars; + infoPtr->varLists[i/2] = varListPtr; + infoPtr->numLists++; - if (!TclIsLocalScalar(varName, (int) strlen(varName))) { + for (j = 0; j < numVars; j++) { + Tcl_Obj *varNameObj; + const char *bytes; + int numBytes, varIndex; + + Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj); + bytes = Tcl_GetStringFromObj(varNameObj, &numBytes); + varIndex = LocalScalar(bytes, numBytes, envPtr); + if (varIndex < 0) { code = TCL_ERROR; goto done; } + varListPtr->varIndexes[j] = varIndex; } - loopIndex++; + Tcl_SetObjLength(varListObj, 0); } /* * We will compile the foreach command. */ - code = TCL_OK; - - /* - * Create and initialize the ForeachInfo and ForeachVarList data - * structures describing this command. Then create a AuxData record - * pointing to the ForeachInfo structure. - */ - - infoPtr = ckalloc(sizeof(ForeachInfo) - + (numLists - 1) * sizeof(ForeachVarList *)); - infoPtr->numLists = numLists; - for (loopIndex = 0; loopIndex < numLists; loopIndex++) { - ForeachVarList *varListPtr; - - numVars = varcList[loopIndex]; - varListPtr = ckalloc(sizeof(ForeachVarList) - + (numVars - 1) * sizeof(int)); - varListPtr->numVars = numVars; - for (j = 0; j < numVars; j++) { - const char *varName = varvList[loopIndex][j]; - int nameChars = strlen(varName); - - varListPtr->varIndexes[j] = TclFindCompiledLocal(varName, - nameChars, /*create*/ 1, envPtr); - } - infoPtr->varLists[loopIndex] = varListPtr; - } infoIndex = TclCreateAuxData(infoPtr, &tclNewForeachInfoType, envPtr); /* @@ -2743,13 +2703,14 @@ CompileEachloopCmd( } done: - for (loopIndex = 0; loopIndex < numLists; loopIndex++) { - if (varvList[loopIndex] != NULL) { - ckfree(varvList[loopIndex]); + if (code == TCL_ERROR) { + if (infoPtr) { + FreeForeachInfo(infoPtr); } } - TclStackFree(interp, (void *)varvList); - TclStackFree(interp, varcList); + if (varListObj) { + Tcl_DecrRefCount(varListObj); + } return code; } -- cgit v0.12 From 81a240828fe7d60234ab063b23b1666272126fb2 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 23 Dec 2014 02:12:59 +0000 Subject: Eliminate TclIsLocalScalar(). No callers left. --- generic/tclInt.h | 1 - generic/tclParse.c | 50 -------------------------------------------------- 2 files changed, 51 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 995da48..3f84717 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2985,7 +2985,6 @@ MODULE_SCOPE void TclInitNotifier(void); MODULE_SCOPE void TclInitObjSubsystem(void); MODULE_SCOPE void TclInitSubsystems(void); MODULE_SCOPE int TclInterpReady(Tcl_Interp *interp); -MODULE_SCOPE int TclIsLocalScalar(const char *src, int len); MODULE_SCOPE int TclIsSpaceProc(char byte); MODULE_SCOPE int TclIsBareword(char byte); MODULE_SCOPE Tcl_Obj * TclJoinPath(int elements, Tcl_Obj * const objv[]); diff --git a/generic/tclParse.c b/generic/tclParse.c index ca12be5..5524979 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -2526,56 +2526,6 @@ TclObjCommandComplete( } /* - *---------------------------------------------------------------------- - * - * TclIsLocalScalar -- - * - * Check to see if a given string is a legal scalar variable name with no - * namespace qualifiers or substitutions. - * - * Results: - * Returns 1 if the variable is a local scalar. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -TclIsLocalScalar( - const char *src, - int len) -{ - const char *p; - const char *lastChar = src + (len - 1); - - for (p=src ; p<=lastChar ; p++) { - if ((CHAR_TYPE(*p) != TYPE_NORMAL) - && (CHAR_TYPE(*p) != TYPE_COMMAND_END)) { - /* - * TCL_COMMAND_END is returned for the last character of the - * string. By this point we know it isn't an array or namespace - * reference. - */ - - return 0; - } - if (*p == '(') { - if (*lastChar == ')') { /* We have an array element */ - return 0; - } - } else if (*p == ':') { - if ((p != lastChar) && *(p+1) == ':') { /* qualified name */ - return 0; - } - } - } - - return 1; -} - -/* * Local Variables: * mode: c * c-basic-offset: 4 -- cgit v0.12 From dd4496550090acf79f5e144602c745533549eea5 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 23 Dec 2014 02:41:54 +0000 Subject: Use more suitable variable name pushers. --- generic/tclCompCmds.c | 6 +++--- generic/tclCompCmdsGR.c | 16 ++++++---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index ec398b6..6a22a30 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -177,9 +177,9 @@ TclCompileAppendCmd( */ varTokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, - &localIndex, &isScalar, 1); - if (!isScalar || localIndex < 0) { + + localIndex = LocalScalarFromToken(varTokenPtr, envPtr); + if (localIndex < 0) { return TCL_ERROR; } diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 98407f7..e2fb43d 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -2044,7 +2044,7 @@ TclCompileNamespaceUpvarCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; - int isScalar, localIndex, numWords, i; + int localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ if (envPtr->procPtr == NULL) { @@ -2079,10 +2079,8 @@ TclCompileNamespaceUpvarCmd( localTokenPtr = TokenAfter(otherTokenPtr); CompileWord(envPtr, otherTokenPtr, interp, i); - PushVarNameWord(interp, localTokenPtr, envPtr, 0, - &localIndex, &isScalar, i+1); - - if ((localIndex < 0) || !isScalar) { + localIndex = LocalScalarFromToken(localTokenPtr, envPtr); + if (localIndex < 0) { return TCL_ERROR; } TclEmitInstInt4( INST_NSUPVAR, localIndex, envPtr); @@ -2763,7 +2761,7 @@ TclCompileUpvarCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; - int isScalar, localIndex, numWords, i; + int localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ Tcl_Obj *objPtr; @@ -2826,10 +2824,8 @@ TclCompileUpvarCmd( localTokenPtr = TokenAfter(otherTokenPtr); CompileWord(envPtr, otherTokenPtr, interp, i); - PushVarNameWord(interp, localTokenPtr, envPtr, 0, - &localIndex, &isScalar, i+1); - - if ((localIndex < 0) || !isScalar) { + localIndex = LocalScalarFromToken(localTokenPtr, envPtr); + if (localIndex < 0) { return TCL_ERROR; } TclEmitInstInt4( INST_UPVAR, localIndex, envPtr); -- cgit v0.12