From 3030616f91ca88f302a094e9f7388f5c7971fe3a Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 19 Jul 2016 15:00:51 +0000 Subject: Remove outdated comment. --- generic/tclVar.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/generic/tclVar.c b/generic/tclVar.c index 47c6e14..2adffbc 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -219,10 +219,6 @@ static Tcl_SetFromAnyProc PanicOnSetVarName; * or NULL if it is this same obj * twoPtrValue.ptr2: index into locals table * - * nsVarName - INTERNALREP DEFINITION: - * twoPtrValue.ptr1: pointer to the namespace containing the reference - * twoPtrValue.ptr2: pointer to the corresponding Var - * * parsedVarName - INTERNALREP DEFINITION: * twoPtrValue.ptr1: pointer to the array name Tcl_Obj, or NULL if it is a * scalar variable -- cgit v0.12 From 883ca7abcd437926de756a838f60e7574f111881 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 19 Jul 2016 19:31:28 +0000 Subject: [0363f0146c] Fix [array startsearch] id handling to support var name variations --- generic/tclInt.h | 1 - generic/tclObj.c | 1 - generic/tclVar.c | 171 ++++++++++--------------------------------------------- 3 files changed, 31 insertions(+), 142 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 4ecac7d..b39c8ea 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2707,7 +2707,6 @@ MODULE_SCOPE const Tcl_ObjType tclListType; MODULE_SCOPE const Tcl_ObjType tclDictType; MODULE_SCOPE const Tcl_ObjType tclProcBodyType; MODULE_SCOPE const Tcl_ObjType tclStringType; -MODULE_SCOPE const Tcl_ObjType tclArraySearchType; MODULE_SCOPE const Tcl_ObjType tclEnsembleCmdType; #ifndef TCL_WIDE_INT_IS_LONG MODULE_SCOPE const Tcl_ObjType tclWideIntType; diff --git a/generic/tclObj.c b/generic/tclObj.c index b145d7e..df17f13 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -402,7 +402,6 @@ TclInitObjSubsystem(void) Tcl_RegisterObjType(&tclListType); Tcl_RegisterObjType(&tclDictType); Tcl_RegisterObjType(&tclByteCodeType); - Tcl_RegisterObjType(&tclArraySearchType); Tcl_RegisterObjType(&tclCmdNameType); Tcl_RegisterObjType(&tclRegexpType); Tcl_RegisterObjType(&tclProcBodyType); diff --git a/generic/tclVar.c b/generic/tclVar.c index 091baf8..a4f1ec5 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -149,6 +149,7 @@ static const char *isArrayElement = */ typedef struct ArraySearch { + Tcl_Obj *name; /* Name of this search */ int id; /* Integer id used to distinguish among * multiple concurrent searches for the same * array. */ @@ -188,8 +189,6 @@ static ArraySearch * ParseSearchId(Tcl_Interp *interp, const Var *varPtr, static void UnsetVarStruct(Var *varPtr, Var *arrayPtr, Interp *iPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags, int index); -static int SetArraySearchObj(Tcl_Interp *interp, - Tcl_Obj *objPtr); /* * Functions defined in this file that may be exported in the future for use @@ -235,22 +234,6 @@ static const Tcl_ObjType tclParsedVarNameType = { FreeParsedVarName, DupParsedVarName, NULL, NULL }; -/* - * Type of Tcl_Objs used to speed up array searches. - * - * INTERNALREP DEFINITION: - * twoPtrValue.ptr1: searchIdNumber (cast to pointer) - * twoPtrValue.ptr2: variableNameStartInString (cast to pointer) - * - * Note that the value stored in ptr2 is the offset into the string of the - * start of the variable name and not the address of the variable name itself, - * as this can be safely copied. - */ - -const Tcl_ObjType tclArraySearchType = { - "array search", - NULL, NULL, NULL, SetArraySearchObj -}; Var * TclVarHashCreateVar( @@ -2966,8 +2949,9 @@ ArrayStartSearchCmd( searchPtr->nextEntry = VarHashFirstEntry(varPtr->value.tablePtr, &searchPtr->search); Tcl_SetHashValue(hPtr, searchPtr); - Tcl_SetObjResult(interp, - Tcl_ObjPrintf("s-%d-%s", searchPtr->id, varName)); + searchPtr->name = Tcl_ObjPrintf("s-%d-%s", searchPtr->id, varName); + Tcl_IncrRefCount(searchPtr->name); + Tcl_SetObjResult(interp, searchPtr->name); return TCL_OK; } @@ -3291,6 +3275,7 @@ ArrayDoneSearchCmd( } } } + Tcl_DecrRefCount(searchPtr->name); ckfree(searchPtr); return TCL_OK; } @@ -4930,75 +4915,6 @@ Tcl_UpvarObjCmd( /* *---------------------------------------------------------------------- * - * SetArraySearchObj -- - * - * This function converts the given tcl object into one that has the - * "array search" internal type. - * - * Results: - * TCL_OK if the conversion succeeded, and TCL_ERROR if it failed (when - * an error message will be placed in the interpreter's result.) - * - * Side effects: - * Updates the internal type and representation of the object to make - * this an array-search object. See the tclArraySearchType declaration - * above for details of the internal representation. - * - *---------------------------------------------------------------------- - */ - -static int -SetArraySearchObj( - Tcl_Interp *interp, - Tcl_Obj *objPtr) -{ - const char *string; - char *end; /* Can't be const due to strtoul defn. */ - int id; - size_t offset; - - /* - * Get the string representation. Make it up-to-date if necessary. - */ - - string = TclGetString(objPtr); - - /* - * Parse the id into the three parts separated by dashes. - */ - - if ((string[0] != 's') || (string[1] != '-')) { - goto syntax; - } - id = strtoul(string+2, &end, 10); - if ((end == (string+2)) || (*end != '-')) { - goto syntax; - } - - /* - * Can't perform value check in this context, so place reference to place - * in string to use for the check in the object instead. - */ - - end++; - offset = end - string; - - TclFreeIntRep(objPtr); - objPtr->typePtr = &tclArraySearchType; - objPtr->internalRep.twoPtrValue.ptr1 = INT2PTR(id); - objPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(offset); - return TCL_OK; - - syntax: - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "illegal search identifier \"%s\"", string)); - Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ARRAYSEARCH", string, NULL); - return TCL_ERROR; -} - -/* - *---------------------------------------------------------------------- - * * ParseSearchId -- * * This function translates from a tcl object to a pointer to an active @@ -5009,10 +4925,6 @@ SetArraySearchObj( * or NULL if there isn't one. If NULL is returned, the interp's result * contains an error message. * - * Side effects: - * The tcl object might have its internal type and representation - * modified. - * *---------------------------------------------------------------------- */ @@ -5028,65 +4940,43 @@ ParseSearchId( * name. */ { Interp *iPtr = (Interp *) interp; - register const char *string; - register size_t offset; - int id; ArraySearch *searchPtr; - const char *varName = TclGetString(varNamePtr); - - /* - * Parse the id. - */ - - if ((handleObj->typePtr != &tclArraySearchType) - && (SetArraySearchObj(interp, handleObj) != TCL_OK)) { - return NULL; - } - - /* - * Extract the information out of the Tcl_Obj. - */ - - id = PTR2INT(handleObj->internalRep.twoPtrValue.ptr1); - string = TclGetString(handleObj); - offset = PTR2INT(handleObj->internalRep.twoPtrValue.ptr2); - - /* - * This test cannot be placed inside the Tcl_Obj machinery, since it is - * dependent on the variable context. - */ - - if (strcmp(string+offset, varName) != 0) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "search identifier \"%s\" isn't for variable \"%s\"", - string, varName)); - goto badLookup; - } - - /* - * Search through the list of active searches on the interpreter to see if - * the desired one exists. - * - * Note that we cannot store the searchPtr directly in the Tcl_Obj as that - * would run into trouble when DeleteSearches() was called so we must scan - * this list every time. - */ + const char *handle = TclGetString(handleObj); + char *end; if (varPtr->flags & VAR_SEARCH_ACTIVE) { Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&iPtr->varSearches, varPtr); + /* First look for same (Tcl_Obj *) */ for (searchPtr = Tcl_GetHashValue(hPtr); searchPtr != NULL; searchPtr = searchPtr->nextPtr) { - if (searchPtr->id == id) { + if (searchPtr->name == handleObj) { return searchPtr; } } + /* Fallback: do string compares. */ + for (searchPtr = Tcl_GetHashValue(hPtr); searchPtr != NULL; + searchPtr = searchPtr->nextPtr) { + if (strcmp(TclGetString(searchPtr->name), handle) == 0) { + return searchPtr; + } + } + } + if ((handle[0] != 's') || (handle[1] != '-') + || (strtoul(handle + 2, &end, 10), end == (handle + 2)) + || (*end != '-')) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "illegal search identifier \"%s\"", handle)); + } else if (strcmp(end + 1, TclGetString(varNamePtr)) != 0) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "search identifier \"%s\" isn't for variable \"%s\"", + handle, TclGetString(varNamePtr))); + } else { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "couldn't find search \"%s\"", handle)); } - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "couldn't find search \"%s\"", string)); - badLookup: - Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ARRAYSEARCH", string, NULL); + Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ARRAYSEARCH", handle, NULL); return NULL; } @@ -5121,6 +5011,7 @@ DeleteSearches( for (searchPtr = Tcl_GetHashValue(sPtr); searchPtr != NULL; searchPtr = nextPtr) { nextPtr = searchPtr->nextPtr; + Tcl_DecrRefCount(searchPtr->name); ckfree(searchPtr); } arrayVarPtr->flags &= ~VAR_SEARCH_ACTIVE; -- cgit v0.12 From 27f4a98be411aa6878d45e7e86e5c90cf2208c92 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 19 Jul 2016 19:33:35 +0000 Subject: "array search" is no longer a registered Tcl_ObjType. --- tests/obj.test | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/obj.test b/tests/obj.test index 7bf00f7..a8d2d20 100644 --- a/tests/obj.test +++ b/tests/obj.test @@ -26,7 +26,6 @@ testConstraint wideBiggerThanInt [expr {wide(0x80000000) != int(0x80000000)}] test obj-1.1 {Tcl_AppendAllObjTypes, and InitTypeTable, Tcl_RegisterObjType} testobj { set r 1 foreach {t} { - {array search} bytearray bytecode cmdName -- cgit v0.12 From c235e3492b4494286cee64ae3a29ff161c62a821 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 19 Jul 2016 20:40:27 +0000 Subject: Factor out common prologue. --- generic/tclVar.c | 176 +++++++++++++++---------------------------------------- 1 file changed, 48 insertions(+), 128 deletions(-) diff --git a/generic/tclVar.c b/generic/tclVar.c index 1d08832..56c5a05 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -189,6 +189,7 @@ static ArraySearch * ParseSearchId(Tcl_Interp *interp, const Var *varPtr, static void UnsetVarStruct(Var *varPtr, Var *arrayPtr, Interp *iPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags, int index); +static Var * VerifyArray(Tcl_Interp *interp, Tcl_Obj *varNameObj); /* * Functions defined in this file that may be exported in the future for use @@ -2870,34 +2871,22 @@ TclArraySet( */ /* ARGSUSED */ -static int -ArrayStartSearchCmd( - ClientData clientData, + +static Var * +VerifyArray( Tcl_Interp *interp, - int objc, - Tcl_Obj *const objv[]) + Tcl_Obj *varNameObj) { Interp *iPtr = (Interp *) interp; - Var *varPtr, *arrayPtr; - Tcl_HashEntry *hPtr; - Tcl_Obj *varNameObj; - int isNew; - ArraySearch *searchPtr; - const char *varName; - - if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "arrayName"); - return TCL_ERROR; - } - varNameObj = objv[1]; + const char *varName = TclGetString(varNameObj); + Var *arrayPtr; /* * Locate the array variable. */ - varPtr = TclObjLookupVarEx(interp, varNameObj, NULL, /*flags*/ 0, + Var *varPtr = TclObjLookupVarEx(interp, varNameObj, NULL, /*flags*/ 0, /*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr); - varName = TclGetString(varNameObj); /* * Special array trace used to keep the env array in sync for array names, @@ -2909,7 +2898,7 @@ ArrayStartSearchCmd( if (TclObjCallVarTraces(iPtr, arrayPtr, varPtr, varNameObj, NULL, (TCL_LEAVE_ERR_MSG|TCL_NAMESPACE_ONLY|TCL_GLOBAL_ONLY| TCL_TRACE_ARRAY), /* leaveErrMsg */ 1, -1) == TCL_ERROR) { - return TCL_ERROR; + return NULL; } } @@ -2919,11 +2908,36 @@ ArrayStartSearchCmd( * traces. */ - if ((varPtr == NULL) || !TclIsVarArray(varPtr) - || TclIsVarUndefined(varPtr)) { + if ((varPtr == NULL) || !TclIsVarArray(varPtr) || TclIsVarUndefined(varPtr)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "\"%s\" isn't an array", varName)); Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ARRAY", varName, NULL); + return NULL; + } + + return varPtr; +} + +static int +ArrayStartSearchCmd( + ClientData clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *const objv[]) +{ + Interp *iPtr = (Interp *) interp; + Var *varPtr; + Tcl_HashEntry *hPtr; + int isNew; + ArraySearch *searchPtr; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "arrayName"); + return TCL_ERROR; + } + + varPtr = VerifyArray(interp, objv[1]); + if (varPtr == NULL) { return TCL_ERROR; } @@ -2945,7 +2959,7 @@ ArrayStartSearchCmd( searchPtr->nextEntry = VarHashFirstEntry(varPtr->value.tablePtr, &searchPtr->search); Tcl_SetHashValue(hPtr, searchPtr); - searchPtr->name = Tcl_ObjPrintf("s-%d-%s", searchPtr->id, varName); + searchPtr->name = Tcl_ObjPrintf("s-%d-%s", searchPtr->id, TclGetString(objv[1])); Tcl_IncrRefCount(searchPtr->name); Tcl_SetObjResult(interp, searchPtr->name); return TCL_OK; @@ -2977,7 +2991,7 @@ ArrayAnyMoreCmd( Tcl_Obj *const objv[]) { Interp *iPtr = (Interp *) interp; - Var *varPtr, *arrayPtr; + Var *varPtr; Tcl_Obj *varNameObj, *searchObj; int gotValue; ArraySearch *searchPtr; @@ -2989,42 +3003,11 @@ ArrayAnyMoreCmd( varNameObj = objv[1]; searchObj = objv[2]; - /* - * Locate the array variable. - */ - - varPtr = TclObjLookupVarEx(interp, varNameObj, NULL, /*flags*/ 0, - /*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr); - - /* - * Special array trace used to keep the env array in sync for array names, - * array get, etc. - */ - - if (varPtr && (varPtr->flags & VAR_TRACED_ARRAY) - && (TclIsVarArray(varPtr) || TclIsVarUndefined(varPtr))) { - if (TclObjCallVarTraces(iPtr, arrayPtr, varPtr, varNameObj, NULL, - (TCL_LEAVE_ERR_MSG|TCL_NAMESPACE_ONLY|TCL_GLOBAL_ONLY| - TCL_TRACE_ARRAY), /* leaveErrMsg */ 1, -1) == TCL_ERROR) { - return TCL_ERROR; - } - } - - /* - * Verify that it is indeed an array variable. This test comes after the - * traces - the variable may actually become an array as an effect of said - * traces. - */ - - if ((varPtr == NULL) || !TclIsVarArray(varPtr) - || TclIsVarUndefined(varPtr)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "\"%s\" isn't an array", TclGetString(varNameObj))); - Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ARRAY", - TclGetString(varNameObj), NULL); + varPtr = VerifyArray(interp, varNameObj); + if (varPtr == NULL) { return TCL_ERROR; } - + /* * Get the search. */ @@ -3083,8 +3066,7 @@ ArrayNextElementCmd( int objc, Tcl_Obj *const objv[]) { - Interp *iPtr = (Interp *) interp; - Var *varPtr, *arrayPtr; + Var *varPtr; Tcl_Obj *varNameObj, *searchObj; ArraySearch *searchPtr; @@ -3095,41 +3077,10 @@ ArrayNextElementCmd( varNameObj = objv[1]; searchObj = objv[2]; - /* - * Locate the array variable. - */ - - varPtr = TclObjLookupVarEx(interp, varNameObj, NULL, /*flags*/ 0, - /*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr); - - /* - * Special array trace used to keep the env array in sync for array names, - * array get, etc. - */ - - if (varPtr && (varPtr->flags & VAR_TRACED_ARRAY) - && (TclIsVarArray(varPtr) || TclIsVarUndefined(varPtr))) { - if (TclObjCallVarTraces(iPtr, arrayPtr, varPtr, varNameObj, NULL, - (TCL_LEAVE_ERR_MSG|TCL_NAMESPACE_ONLY|TCL_GLOBAL_ONLY| - TCL_TRACE_ARRAY), /* leaveErrMsg */ 1, -1) == TCL_ERROR) { - return TCL_ERROR; - } - } - - /* - * Verify that it is indeed an array variable. This test comes after the - * traces - the variable may actually become an array as an effect of said - * traces. - */ - - if ((varPtr == NULL) || !TclIsVarArray(varPtr) - || TclIsVarUndefined(varPtr)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "\"%s\" isn't an array", TclGetString(varNameObj))); - Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ARRAY", - TclGetString(varNameObj), NULL); + varPtr = VerifyArray(interp, varNameObj); + if (varPtr == NULL) { return TCL_ERROR; - } + } /* * Get the search. @@ -3193,7 +3144,7 @@ ArrayDoneSearchCmd( Tcl_Obj *const objv[]) { Interp *iPtr = (Interp *) interp; - Var *varPtr, *arrayPtr; + Var *varPtr; Tcl_HashEntry *hPtr; Tcl_Obj *varNameObj, *searchObj; ArraySearch *searchPtr, *prevPtr; @@ -3205,39 +3156,8 @@ ArrayDoneSearchCmd( varNameObj = objv[1]; searchObj = objv[2]; - /* - * Locate the array variable. - */ - - varPtr = TclObjLookupVarEx(interp, varNameObj, NULL, /*flags*/ 0, - /*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr); - - /* - * Special array trace used to keep the env array in sync for array names, - * array get, etc. - */ - - if (varPtr && (varPtr->flags & VAR_TRACED_ARRAY) - && (TclIsVarArray(varPtr) || TclIsVarUndefined(varPtr))) { - if (TclObjCallVarTraces(iPtr, arrayPtr, varPtr, varNameObj, NULL, - (TCL_LEAVE_ERR_MSG|TCL_NAMESPACE_ONLY|TCL_GLOBAL_ONLY| - TCL_TRACE_ARRAY), /* leaveErrMsg */ 1, -1) == TCL_ERROR) { - return TCL_ERROR; - } - } - - /* - * Verify that it is indeed an array variable. This test comes after the - * traces - the variable may actually become an array as an effect of said - * traces. - */ - - if ((varPtr == NULL) || !TclIsVarArray(varPtr) - || TclIsVarUndefined(varPtr)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "\"%s\" isn't an array", TclGetString(varNameObj))); - Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ARRAY", - TclGetString(varNameObj), NULL); + varPtr = VerifyArray(interp, varNameObj); + if (varPtr == NULL) { return TCL_ERROR; } -- cgit v0.12 From 05c0da6eee9a84deb417980eb524efd8395516ec Mon Sep 17 00:00:00 2001 From: venkat Date: Wed, 20 Jul 2016 03:05:01 +0000 Subject: Update tzdata to 2016f from ietf.org --- library/tzdata/America/Cambridge_Bay | 2 +- library/tzdata/America/Inuvik | 2 +- library/tzdata/America/Iqaluit | 2 +- library/tzdata/America/Pangnirtung | 2 +- library/tzdata/America/Rankin_Inlet | 2 +- library/tzdata/America/Resolute | 2 +- library/tzdata/America/Yellowknife | 2 +- library/tzdata/Antarctica/Casey | 2 +- library/tzdata/Antarctica/Davis | 4 +- library/tzdata/Antarctica/DumontDUrville | 4 +- library/tzdata/Antarctica/Macquarie | 4 +- library/tzdata/Antarctica/Mawson | 2 +- library/tzdata/Antarctica/Palmer | 2 +- library/tzdata/Antarctica/Rothera | 2 +- library/tzdata/Antarctica/Syowa | 2 +- library/tzdata/Antarctica/Troll | 2 +- library/tzdata/Antarctica/Vostok | 2 +- library/tzdata/Asia/Baku | 2 +- library/tzdata/Asia/Novokuznetsk | 133 +++++++++++++++--------------- library/tzdata/Asia/Novosibirsk | 135 ++++++++++++++++--------------- library/tzdata/Europe/Minsk | 6 +- library/tzdata/Indian/Kerguelen | 2 +- 22 files changed, 159 insertions(+), 159 deletions(-) diff --git a/library/tzdata/America/Cambridge_Bay b/library/tzdata/America/Cambridge_Bay index 23004bb..3115ee1 100644 --- a/library/tzdata/America/Cambridge_Bay +++ b/library/tzdata/America/Cambridge_Bay @@ -1,7 +1,7 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:America/Cambridge_Bay) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-1577923200 -25200 0 MST} {-880210800 -21600 1 MWT} {-769395600 -21600 1 MPT} diff --git a/library/tzdata/America/Inuvik b/library/tzdata/America/Inuvik index dd0d151..08f0fd6 100644 --- a/library/tzdata/America/Inuvik +++ b/library/tzdata/America/Inuvik @@ -1,7 +1,7 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:America/Inuvik) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-536457600 -28800 0 PST} {-147888000 -21600 1 PDDT} {-131558400 -28800 0 PST} diff --git a/library/tzdata/America/Iqaluit b/library/tzdata/America/Iqaluit index 2a2e9fe..ff82866 100644 --- a/library/tzdata/America/Iqaluit +++ b/library/tzdata/America/Iqaluit @@ -1,7 +1,7 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:America/Iqaluit) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-865296000 -14400 0 EWT} {-769395600 -14400 1 EPT} {-765396000 -18000 0 EST} diff --git a/library/tzdata/America/Pangnirtung b/library/tzdata/America/Pangnirtung index 640808e..14d8516 100644 --- a/library/tzdata/America/Pangnirtung +++ b/library/tzdata/America/Pangnirtung @@ -1,7 +1,7 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:America/Pangnirtung) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-1546300800 -14400 0 AST} {-880221600 -10800 1 AWT} {-769395600 -10800 1 APT} diff --git a/library/tzdata/America/Rankin_Inlet b/library/tzdata/America/Rankin_Inlet index 770ec5d..9ce9f8d 100644 --- a/library/tzdata/America/Rankin_Inlet +++ b/library/tzdata/America/Rankin_Inlet @@ -1,7 +1,7 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:America/Rankin_Inlet) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-410227200 -21600 0 CST} {-147895200 -14400 1 CDDT} {-131565600 -21600 0 CST} diff --git a/library/tzdata/America/Resolute b/library/tzdata/America/Resolute index b4c0bab..a9881b4 100644 --- a/library/tzdata/America/Resolute +++ b/library/tzdata/America/Resolute @@ -1,7 +1,7 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:America/Resolute) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-704937600 -21600 0 CST} {-147895200 -14400 1 CDDT} {-131565600 -21600 0 CST} diff --git a/library/tzdata/America/Yellowknife b/library/tzdata/America/Yellowknife index 44ca658..c6c4ed5 100644 --- a/library/tzdata/America/Yellowknife +++ b/library/tzdata/America/Yellowknife @@ -1,7 +1,7 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:America/Yellowknife) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-1104537600 -25200 0 MST} {-880210800 -21600 1 MWT} {-769395600 -21600 1 MPT} diff --git a/library/tzdata/Antarctica/Casey b/library/tzdata/Antarctica/Casey index 56d5df7..2573dac 100644 --- a/library/tzdata/Antarctica/Casey +++ b/library/tzdata/Antarctica/Casey @@ -1,7 +1,7 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Antarctica/Casey) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-31536000 28800 0 AWST} {1255802400 39600 0 CAST} {1267714800 28800 0 AWST} diff --git a/library/tzdata/Antarctica/Davis b/library/tzdata/Antarctica/Davis index 2762d2f..c98be2f 100644 --- a/library/tzdata/Antarctica/Davis +++ b/library/tzdata/Antarctica/Davis @@ -1,9 +1,9 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Antarctica/Davis) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-409190400 25200 0 DAVT} - {-163062000 0 0 zzz} + {-163062000 0 0 -00} {-28857600 25200 0 DAVT} {1255806000 18000 0 DAVT} {1268251200 25200 0 DAVT} diff --git a/library/tzdata/Antarctica/DumontDUrville b/library/tzdata/Antarctica/DumontDUrville index 41dc1e3..8d21d45 100644 --- a/library/tzdata/Antarctica/DumontDUrville +++ b/library/tzdata/Antarctica/DumontDUrville @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Antarctica/DumontDUrville) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-725846400 36000 0 PMT} - {-566992800 0 0 zzz} + {-566992800 0 0 -00} {-415497600 36000 0 DDUT} } diff --git a/library/tzdata/Antarctica/Macquarie b/library/tzdata/Antarctica/Macquarie index 07ddff6..9ed0630 100644 --- a/library/tzdata/Antarctica/Macquarie +++ b/library/tzdata/Antarctica/Macquarie @@ -1,12 +1,12 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Antarctica/Macquarie) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-2214259200 36000 0 AEST} {-1680508800 39600 1 AEDT} {-1669892400 39600 0 AEDT} {-1665392400 36000 0 AEST} - {-1601719200 0 0 zzz} + {-1601719200 0 0 -00} {-94730400 36000 0 AEST} {-71136000 39600 1 AEDT} {-55411200 36000 0 AEST} diff --git a/library/tzdata/Antarctica/Mawson b/library/tzdata/Antarctica/Mawson index ba03ba1..e50aa07 100644 --- a/library/tzdata/Antarctica/Mawson +++ b/library/tzdata/Antarctica/Mawson @@ -1,7 +1,7 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Antarctica/Mawson) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-501206400 21600 0 MAWT} {1255809600 18000 0 MAWT} } diff --git a/library/tzdata/Antarctica/Palmer b/library/tzdata/Antarctica/Palmer index 5767985..62b17e1 100644 --- a/library/tzdata/Antarctica/Palmer +++ b/library/tzdata/Antarctica/Palmer @@ -1,7 +1,7 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Antarctica/Palmer) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-157766400 -14400 0 ART} {-152654400 -14400 0 ART} {-132955200 -10800 1 ARST} diff --git a/library/tzdata/Antarctica/Rothera b/library/tzdata/Antarctica/Rothera index 24d7f3e..3a219c7 100644 --- a/library/tzdata/Antarctica/Rothera +++ b/library/tzdata/Antarctica/Rothera @@ -1,6 +1,6 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Antarctica/Rothera) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {218246400 -10800 0 ROTT} } diff --git a/library/tzdata/Antarctica/Syowa b/library/tzdata/Antarctica/Syowa index 4d046b5..1fe030a 100644 --- a/library/tzdata/Antarctica/Syowa +++ b/library/tzdata/Antarctica/Syowa @@ -1,6 +1,6 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Antarctica/Syowa) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-407808000 10800 0 SYOT} } diff --git a/library/tzdata/Antarctica/Troll b/library/tzdata/Antarctica/Troll index 7d2b042..09727a8 100644 --- a/library/tzdata/Antarctica/Troll +++ b/library/tzdata/Antarctica/Troll @@ -1,7 +1,7 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Antarctica/Troll) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {1108166400 0 0 UTC} {1111885200 7200 1 CEST} {1130634000 0 0 UTC} diff --git a/library/tzdata/Antarctica/Vostok b/library/tzdata/Antarctica/Vostok index f846f65..a59868b 100644 --- a/library/tzdata/Antarctica/Vostok +++ b/library/tzdata/Antarctica/Vostok @@ -1,6 +1,6 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Antarctica/Vostok) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-380073600 21600 0 VOST} } diff --git a/library/tzdata/Asia/Baku b/library/tzdata/Asia/Baku index bc0701a..e9ee835 100644 --- a/library/tzdata/Asia/Baku +++ b/library/tzdata/Asia/Baku @@ -28,7 +28,7 @@ set TZData(:Asia/Baku) { {683496000 14400 0 AZST} {686098800 10800 0 AZT} {701823600 14400 1 AZST} - {717537600 14400 0 AZT} + {717548400 14400 0 AZT} {820440000 14400 0 AZT} {828234000 18000 1 AZST} {846378000 14400 0 AZT} diff --git a/library/tzdata/Asia/Novokuznetsk b/library/tzdata/Asia/Novokuznetsk index f079faa..a43a984 100644 --- a/library/tzdata/Asia/Novokuznetsk +++ b/library/tzdata/Asia/Novokuznetsk @@ -2,71 +2,70 @@ set TZData(:Asia/Novokuznetsk) { {-9223372036854775808 20928 0 LMT} - {-1441259328 21600 0 KRAT} - {-1247551200 25200 0 KRAMMTT} - {354906000 28800 1 KRAST} - {370713600 25200 0 KRAT} - {386442000 28800 1 KRAST} - {402249600 25200 0 KRAT} - {417978000 28800 1 KRAST} - {433785600 25200 0 KRAT} - {449600400 28800 1 KRAST} - {465332400 25200 0 KRAT} - {481057200 28800 1 KRAST} - {496782000 25200 0 KRAT} - {512506800 28800 1 KRAST} - {528231600 25200 0 KRAT} - {543956400 28800 1 KRAST} - {559681200 25200 0 KRAT} - {575406000 28800 1 KRAST} - {591130800 25200 0 KRAT} - {606855600 28800 1 KRAST} - {622580400 25200 0 KRAT} - {638305200 28800 1 KRAST} - {654634800 25200 0 KRAT} - {670359600 21600 0 KRAMMTT} - {670363200 25200 1 KRAST} - {686088000 21600 0 KRAT} - {695764800 25200 0 KRAMMTT} - {701809200 28800 1 KRAST} - {717534000 25200 0 KRAT} - {733258800 28800 1 KRAST} - {748983600 25200 0 KRAT} - {764708400 28800 1 KRAST} - {780433200 25200 0 KRAT} - {796158000 28800 1 KRAST} - {811882800 25200 0 KRAT} - {828212400 28800 1 KRAST} - {846356400 25200 0 KRAT} - {859662000 28800 1 KRAST} - {877806000 25200 0 KRAT} - {891111600 28800 1 KRAST} - {909255600 25200 0 KRAT} - {922561200 28800 1 KRAST} - {941310000 25200 0 KRAT} - {954010800 28800 1 KRAST} - {972759600 25200 0 KRAT} - {985460400 28800 1 KRAST} - {1004209200 25200 0 KRAT} - {1017514800 28800 1 KRAST} - {1035658800 25200 0 KRAT} - {1048964400 28800 1 KRAST} - {1067108400 25200 0 KRAT} - {1080414000 28800 1 KRAST} - {1099162800 25200 0 KRAT} - {1111863600 28800 1 KRAST} - {1130612400 25200 0 KRAT} - {1143313200 28800 1 KRAST} - {1162062000 25200 0 KRAT} - {1174762800 28800 1 KRAST} - {1193511600 25200 0 KRAT} - {1206817200 28800 1 KRAST} - {1224961200 25200 0 KRAT} - {1238266800 28800 1 KRAST} - {1256410800 25200 0 KRAT} - {1269716400 21600 0 NOVMMTT} - {1269720000 25200 1 NOVST} - {1288468800 21600 0 NOVT} - {1301169600 25200 0 NOVT} - {1414263600 25200 0 KRAT} + {-1441259328 21600 0 +06} + {-1247551200 25200 0 +08} + {354906000 28800 1 +08} + {370713600 25200 0 +07} + {386442000 28800 1 +08} + {402249600 25200 0 +07} + {417978000 28800 1 +08} + {433785600 25200 0 +07} + {449600400 28800 1 +08} + {465332400 25200 0 +07} + {481057200 28800 1 +08} + {496782000 25200 0 +07} + {512506800 28800 1 +08} + {528231600 25200 0 +07} + {543956400 28800 1 +08} + {559681200 25200 0 +07} + {575406000 28800 1 +08} + {591130800 25200 0 +07} + {606855600 28800 1 +08} + {622580400 25200 0 +07} + {638305200 28800 1 +08} + {654634800 25200 0 +07} + {670359600 21600 0 +07} + {670363200 25200 1 +07} + {686088000 21600 0 +06} + {695764800 25200 0 +08} + {701809200 28800 1 +08} + {717534000 25200 0 +07} + {733258800 28800 1 +08} + {748983600 25200 0 +07} + {764708400 28800 1 +08} + {780433200 25200 0 +07} + {796158000 28800 1 +08} + {811882800 25200 0 +07} + {828212400 28800 1 +08} + {846356400 25200 0 +07} + {859662000 28800 1 +08} + {877806000 25200 0 +07} + {891111600 28800 1 +08} + {909255600 25200 0 +07} + {922561200 28800 1 +08} + {941310000 25200 0 +07} + {954010800 28800 1 +08} + {972759600 25200 0 +07} + {985460400 28800 1 +08} + {1004209200 25200 0 +07} + {1017514800 28800 1 +08} + {1035658800 25200 0 +07} + {1048964400 28800 1 +08} + {1067108400 25200 0 +07} + {1080414000 28800 1 +08} + {1099162800 25200 0 +07} + {1111863600 28800 1 +08} + {1130612400 25200 0 +07} + {1143313200 28800 1 +08} + {1162062000 25200 0 +07} + {1174762800 28800 1 +08} + {1193511600 25200 0 +07} + {1206817200 28800 1 +08} + {1224961200 25200 0 +07} + {1238266800 28800 1 +08} + {1256410800 25200 0 +07} + {1269716400 21600 0 +07} + {1269720000 25200 1 +07} + {1288468800 21600 0 +06} + {1301169600 25200 0 +07} } diff --git a/library/tzdata/Asia/Novosibirsk b/library/tzdata/Asia/Novosibirsk index 54c83fa..21f5c00 100644 --- a/library/tzdata/Asia/Novosibirsk +++ b/library/tzdata/Asia/Novosibirsk @@ -2,71 +2,72 @@ set TZData(:Asia/Novosibirsk) { {-9223372036854775808 19900 0 LMT} - {-1579476700 21600 0 NOVT} - {-1247551200 25200 0 NOVMMTT} - {354906000 28800 1 NOVST} - {370713600 25200 0 NOVT} - {386442000 28800 1 NOVST} - {402249600 25200 0 NOVT} - {417978000 28800 1 NOVST} - {433785600 25200 0 NOVT} - {449600400 28800 1 NOVST} - {465332400 25200 0 NOVT} - {481057200 28800 1 NOVST} - {496782000 25200 0 NOVT} - {512506800 28800 1 NOVST} - {528231600 25200 0 NOVT} - {543956400 28800 1 NOVST} - {559681200 25200 0 NOVT} - {575406000 28800 1 NOVST} - {591130800 25200 0 NOVT} - {606855600 28800 1 NOVST} - {622580400 25200 0 NOVT} - {638305200 28800 1 NOVST} - {654634800 25200 0 NOVT} - {670359600 21600 0 NOVMMTT} - {670363200 25200 1 NOVST} - {686088000 21600 0 NOVT} - {695764800 25200 0 NOVMMTT} - {701809200 28800 1 NOVST} - {717534000 25200 0 NOVT} - {733258800 28800 1 NOVST} - {738090000 25200 0 NOVST} - {748987200 21600 0 NOVT} - {764712000 25200 1 NOVST} - {780436800 21600 0 NOVT} - {796161600 25200 1 NOVST} - {811886400 21600 0 NOVT} - {828216000 25200 1 NOVST} - {846360000 21600 0 NOVT} - {859665600 25200 1 NOVST} - {877809600 21600 0 NOVT} - {891115200 25200 1 NOVST} - {909259200 21600 0 NOVT} - {922564800 25200 1 NOVST} - {941313600 21600 0 NOVT} - {954014400 25200 1 NOVST} - {972763200 21600 0 NOVT} - {985464000 25200 1 NOVST} - {1004212800 21600 0 NOVT} - {1017518400 25200 1 NOVST} - {1035662400 21600 0 NOVT} - {1048968000 25200 1 NOVST} - {1067112000 21600 0 NOVT} - {1080417600 25200 1 NOVST} - {1099166400 21600 0 NOVT} - {1111867200 25200 1 NOVST} - {1130616000 21600 0 NOVT} - {1143316800 25200 1 NOVST} - {1162065600 21600 0 NOVT} - {1174766400 25200 1 NOVST} - {1193515200 21600 0 NOVT} - {1206820800 25200 1 NOVST} - {1224964800 21600 0 NOVT} - {1238270400 25200 1 NOVST} - {1256414400 21600 0 NOVT} - {1269720000 25200 1 NOVST} - {1288468800 21600 0 NOVT} - {1301169600 25200 0 NOVT} - {1414263600 21600 0 NOVT} + {-1579476700 21600 0 +06} + {-1247551200 25200 0 +08} + {354906000 28800 1 +08} + {370713600 25200 0 +07} + {386442000 28800 1 +08} + {402249600 25200 0 +07} + {417978000 28800 1 +08} + {433785600 25200 0 +07} + {449600400 28800 1 +08} + {465332400 25200 0 +07} + {481057200 28800 1 +08} + {496782000 25200 0 +07} + {512506800 28800 1 +08} + {528231600 25200 0 +07} + {543956400 28800 1 +08} + {559681200 25200 0 +07} + {575406000 28800 1 +08} + {591130800 25200 0 +07} + {606855600 28800 1 +08} + {622580400 25200 0 +07} + {638305200 28800 1 +08} + {654634800 25200 0 +07} + {670359600 21600 0 +07} + {670363200 25200 1 +07} + {686088000 21600 0 +06} + {695764800 25200 0 +08} + {701809200 28800 1 +08} + {717534000 25200 0 +07} + {733258800 28800 1 +08} + {738090000 25200 0 +07} + {748987200 21600 0 +06} + {764712000 25200 1 +07} + {780436800 21600 0 +06} + {796161600 25200 1 +07} + {811886400 21600 0 +06} + {828216000 25200 1 +07} + {846360000 21600 0 +06} + {859665600 25200 1 +07} + {877809600 21600 0 +06} + {891115200 25200 1 +07} + {909259200 21600 0 +06} + {922564800 25200 1 +07} + {941313600 21600 0 +06} + {954014400 25200 1 +07} + {972763200 21600 0 +06} + {985464000 25200 1 +07} + {1004212800 21600 0 +06} + {1017518400 25200 1 +07} + {1035662400 21600 0 +06} + {1048968000 25200 1 +07} + {1067112000 21600 0 +06} + {1080417600 25200 1 +07} + {1099166400 21600 0 +06} + {1111867200 25200 1 +07} + {1130616000 21600 0 +06} + {1143316800 25200 1 +07} + {1162065600 21600 0 +06} + {1174766400 25200 1 +07} + {1193515200 21600 0 +06} + {1206820800 25200 1 +07} + {1224964800 21600 0 +06} + {1238270400 25200 1 +07} + {1256414400 21600 0 +06} + {1269720000 25200 1 +07} + {1288468800 21600 0 +06} + {1301169600 25200 0 +07} + {1414263600 21600 0 +06} + {1469304000 25200 0 +07} } diff --git a/library/tzdata/Europe/Minsk b/library/tzdata/Europe/Minsk index 5e47063..2857e5b 100644 --- a/library/tzdata/Europe/Minsk +++ b/library/tzdata/Europe/Minsk @@ -30,10 +30,10 @@ set TZData(:Europe/Minsk) { {606870000 14400 1 MSD} {622594800 10800 0 MSK} {631141200 10800 0 MSK} - {670374000 10800 1 EEST} + {670374000 7200 0 EEMMTT} + {670377600 10800 1 EEST} {686102400 7200 0 EET} - {701820000 10800 1 EEST} - {717544800 10800 0 EEST} + {701827200 10800 1 EEST} {717552000 7200 0 EET} {733276800 10800 1 EEST} {749001600 7200 0 EET} diff --git a/library/tzdata/Indian/Kerguelen b/library/tzdata/Indian/Kerguelen index b41b85a..8820010 100644 --- a/library/tzdata/Indian/Kerguelen +++ b/library/tzdata/Indian/Kerguelen @@ -1,6 +1,6 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Indian/Kerguelen) { - {-9223372036854775808 0 0 zzz} + {-9223372036854775808 0 0 -00} {-631152000 18000 0 TFT} } -- cgit v0.12 From fcf66a8c31f5c02f6b8337c822d21e55c07df7f6 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 20 Jul 2016 15:43:08 +0000 Subject: Use the new private flag INDEX_TEMP_TABLE in testing command too. --- generic/tclTestObj.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index a637498..6053ae3 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -577,23 +577,9 @@ TestindexobjCmd( } argv[objc-4] = NULL; - /* - * Tcl_GetIndexFromObj assumes that the table is statically-allocated so - * that its address is different for each index object. If we accidently - * allocate a table at the same address as that cached in the index - * object, clear out the object's cached state. - */ - - if (objv[3]->typePtr != NULL - && !strcmp("index", objv[3]->typePtr->name)) { - indexRep = objv[3]->internalRep.twoPtrValue.ptr1; - if (indexRep->tablePtr == (void *) argv) { - TclFreeIntRep(objv[3]); - } - } - result = Tcl_GetIndexFromObj((setError? interp : NULL), objv[3], - argv, "token", (allowAbbrev? 0 : TCL_EXACT), &index); + argv, "token", INDEX_TEMP_TABLE|(allowAbbrev? 0 : TCL_EXACT), + &index); ckfree(argv); if (result == TCL_OK) { Tcl_SetIntObj(Tcl_GetObjResult(interp), index); -- cgit v0.12 From 1eff5acecce7c6cae25d692ba941f02c9961dc74 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 20 Jul 2016 16:32:16 +0000 Subject: Use strchr() to parse array variable syntax. --- generic/tclVar.c | 58 +++++++++++++++----------------------------------------- 1 file changed, 15 insertions(+), 43 deletions(-) diff --git a/generic/tclVar.c b/generic/tclVar.c index 56c5a05..20fce82 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -504,9 +504,8 @@ TclObjLookupVarEx( register Var *varPtr; /* Points to the variable's in-frame Var * structure. */ const char *part1; - int index, len1, len2; + int index, len; int parsed = 0; - Tcl_Obj *objPtr; const Tcl_ObjType *typePtr = part1Ptr->typePtr; const char *errMsg = NULL; CallFrame *varFramePtr = iPtr->varFramePtr; @@ -566,18 +565,17 @@ TclObjLookupVarEx( } parsed = 1; } - part1 = TclGetStringFromObj(part1Ptr, &len1); + part1 = TclGetStringFromObj(part1Ptr, &len); - if (!parsed && len1 && (*(part1 + len1 - 1) == ')')) { + if (!parsed && len && (*(part1 + len - 1) == ')')) { /* * part1Ptr is possibly an unparsed array element. */ - register int i; + part2 = strchr(part1, '('); + if (part2) { + Tcl_Obj *arrayPtr; - len2 = -1; - for (i = 0; i < len1; i++) { - if (*(part1 + i) == '(') { if (part2Ptr != NULL) { if (flags & TCL_LEAVE_ERR_MSG) { TclObjVarErrMsg(interp, part1Ptr, part2Ptr, msg, @@ -588,44 +586,18 @@ TclObjLookupVarEx( return NULL; } - /* - * part1Ptr points to an array element; first copy the element - * name to a new string part2. - */ - - part2 = part1 + i + 1; - len2 = len1 - i - 2; - len1 = i; - - part2Ptr = Tcl_NewStringObj(part2, len2); - - /* - * Free the internal rep of the original part1Ptr, now renamed - * objPtr, and set it to tclParsedVarNameType. - */ + arrayPtr = Tcl_NewStringObj(part1, (part2 - part1)); + part2Ptr = Tcl_NewStringObj(part2 + 1, len - (part2 - part1) - 2); - objPtr = part1Ptr; - TclFreeIntRep(objPtr); - objPtr->typePtr = &tclParsedVarNameType; + TclFreeIntRep(part1Ptr); - /* - * Define a new string object to hold the new part1Ptr, i.e., - * the array name. Set the internal rep of objPtr, reset - * typePtr and part1 to contain the references to the array - * name. - */ - - TclNewStringObj(part1Ptr, part1, len1); - Tcl_IncrRefCount(part1Ptr); - - objPtr->internalRep.twoPtrValue.ptr1 = part1Ptr; - Tcl_IncrRefCount(part2Ptr); - objPtr->internalRep.twoPtrValue.ptr2 = part2Ptr; + Tcl_IncrRefCount(arrayPtr); + part1Ptr->internalRep.twoPtrValue.ptr1 = arrayPtr; + Tcl_IncrRefCount(part2Ptr); + part1Ptr->internalRep.twoPtrValue.ptr2 = part2Ptr; + part1Ptr->typePtr = &tclParsedVarNameType; - typePtr = part1Ptr->typePtr; - part1 = TclGetString(part1Ptr); - break; - } + part1Ptr = arrayPtr; } } -- cgit v0.12 From a7a2c2e589efa82857ba0a2526acede975aa89d0 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 20 Jul 2016 17:39:04 +0000 Subject: Streamline TclObjLookupVarEx --- generic/tclVar.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/generic/tclVar.c b/generic/tclVar.c index 20fce82..55eb436 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -501,15 +501,13 @@ TclObjLookupVarEx( * is set to NULL. */ { Interp *iPtr = (Interp *) interp; + CallFrame *varFramePtr = iPtr->varFramePtr; register Var *varPtr; /* Points to the variable's in-frame Var * structure. */ - const char *part1; - int index, len; - int parsed = 0; - const Tcl_ObjType *typePtr = part1Ptr->typePtr; const char *errMsg = NULL; - CallFrame *varFramePtr = iPtr->varFramePtr; - const char *part2 = part2Ptr? TclGetString(part2Ptr):NULL; + int index, parsed = 0; + const Tcl_ObjType *typePtr = part1Ptr->typePtr; + *arrayPtrPtr = NULL; if (typePtr == &localVarNameType) { @@ -525,7 +523,7 @@ TclObjLookupVarEx( */ Tcl_Obj *namePtr = part1Ptr->internalRep.twoPtrValue.ptr1; - Tcl_Obj *checkNamePtr = localName(iPtr->varFramePtr, localIndex); + Tcl_Obj *checkNamePtr = localName(varFramePtr, localIndex); if ((!namePtr && (checkNamePtr == part1Ptr)) || (namePtr && (checkNamePtr == namePtr))) { @@ -565,15 +563,21 @@ TclObjLookupVarEx( } parsed = 1; } - part1 = TclGetStringFromObj(part1Ptr, &len); - if (!parsed && len && (*(part1 + len - 1) == ')')) { + if (!parsed) { + /* * part1Ptr is possibly an unparsed array element. */ - part2 = strchr(part1, '('); - if (part2) { + int len; + const char *part1 = TclGetStringFromObj(part1Ptr, &len); + + if (len > 1 && (part1[len - 1] == ')')) { + + const char *part2 = strchr(part1, '('); + + if (part2) { Tcl_Obj *arrayPtr; if (part2Ptr != NULL) { @@ -598,6 +602,7 @@ TclObjLookupVarEx( part1Ptr->typePtr = &tclParsedVarNameType; part1Ptr = arrayPtr; + } } } @@ -607,8 +612,6 @@ TclObjLookupVarEx( * the cached types if possible. */ - TclFreeIntRep(part1Ptr); - varPtr = TclLookupSimpleVar(interp, part1Ptr, flags, createPart1, &errMsg, &index); if (varPtr == NULL) { @@ -624,11 +627,12 @@ TclObjLookupVarEx( * Cache the newly found variable if possible. */ + TclFreeIntRep(part1Ptr); if (index >= 0) { /* * An indexed local variable. */ - Tcl_Obj *cachedNamePtr = localName(iPtr->varFramePtr, index); + Tcl_Obj *cachedNamePtr = localName(varFramePtr, index); part1Ptr->typePtr = &localVarNameType; if (part1Ptr != cachedNamePtr) { -- cgit v0.12 From 5ad954783e49a00f738e29083586df9f8c9411e0 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 20 Jul 2016 20:39:16 +0000 Subject: Stop internals intrusion into lists. --- generic/tclExecute.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f1205b0..a2a465a 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5283,23 +5283,10 @@ TEBCresume( toIdx = objc-1; } if (fromIdx == 0 && toIdx != objc-1 && !Tcl_IsShared(valuePtr)) { - /* - * BEWARE! This is looking inside the implementation of the - * list type. - */ - - List *listPtr = valuePtr->internalRep.twoPtrValue.ptr1; - - if (listPtr->refCount == 1) { - for (index=toIdx+1; indexelemCount = toIdx+1; - listPtr->canonicalFlag = 1; - TclInvalidateStringRep(valuePtr); - TRACE_APPEND(("%.30s\n", O2S(valuePtr))); - NEXT_INST_F(9, 0, 0); - } + Tcl_ListObjReplace(interp, valuePtr, + toIdx + 1, LIST_MAX, 0, NULL); + TRACE_APPEND(("%.30s\n", O2S(valuePtr))); + NEXT_INST_F(9, 0, 0); } objResultPtr = Tcl_NewListObj(toIdx-fromIdx+1, objv+fromIdx); } else { -- cgit v0.12 From 3e6a6753f751ed2cec8c6119d295e4ae7be26852 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 24 Jul 2016 12:45:07 +0000 Subject: Make a few tests more resilient to differences in the semantics of pipes between operating systems. --- doc/chan.n | 12 ++++++++++++ tests/zlib.test | 12 ++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/doc/chan.n b/doc/chan.n index 7ea0d19..cc53d3b 100644 --- a/doc/chan.n +++ b/doc/chan.n @@ -547,6 +547,18 @@ this, spawn with "2>@" or ">@" redirection operators onto the write side of a pipe, and then immediately close it in the parent. This is necessary to get an EOF on the read side once the child has exited or otherwise closed its output. +.RS +.PP +Note that the pipe buffering semantics can vary at the operating system level +substantially; it is not safe to assume that a write performed on the output +side of the pipe will appear instantly to the input side. This is a +fundamental difference and Tcl cannot conceal it. The overall stream semantics +\fIare\fR compatible, so blocking reads and writes will not see most of the +differences, but the details of what exactly gets written when are not. This +is most likely to show up when using pipelines for testing; care should be +taken to ensure that deadlocks do not occur and that potential short reads are +allowed for. +.RE .VE 8.6 .TP \fBchan pop \fIchannelId\fR diff --git a/tests/zlib.test b/tests/zlib.test index c9e5f10..8a040d8 100644 --- a/tests/zlib.test +++ b/tests/zlib.test @@ -251,9 +251,10 @@ test zlib-8.8 {transformation and fconfigure} -setup { } -constraints zlib -body { zlib push compress $outSide -dictionary $spdyDict fconfigure $outSide -blocking 0 -translation binary -buffering none - fconfigure $inSide -blocking 0 -translation binary + fconfigure $inSide -blocking 1 -translation binary puts -nonewline $outSide $spdyHeaders chan pop $outSide + chan close $outSide set compressed [read $inSide] catch {zlib decompress $compressed} err opt list [string length [zlib compress $spdyHeaders]] \ @@ -269,10 +270,11 @@ test zlib-8.9 {transformation and fconfigure} -setup { } -constraints zlib -body { zlib push compress $outSide -dictionary $spdyDict fconfigure $outSide -blocking 0 -translation binary -buffering none - fconfigure $inSide -blocking 0 -translation binary + fconfigure $inSide -blocking 1 -translation binary puts -nonewline $outSide $spdyHeaders set result [fconfigure $outSide -checksum] chan pop $outSide + chan close $outSide $strm put -dictionary $spdyDict [read $inSide] lappend result [string length $spdyHeaders] [string length [$strm get]] } -cleanup { @@ -285,9 +287,10 @@ test zlib-8.10 {transformation and fconfigure} -setup { } -constraints {zlib recentZlib} -body { zlib push deflate $outSide -dictionary $spdyDict fconfigure $outSide -blocking 0 -translation binary -buffering none - fconfigure $inSide -blocking 0 -translation binary + fconfigure $inSide -blocking 1 -translation binary puts -nonewline $outSide $spdyHeaders chan pop $outSide + chan close $outSide set compressed [read $inSide] catch { zlib inflate $compressed @@ -306,9 +309,10 @@ test zlib-8.11 {transformation and fconfigure} -setup { } -constraints zlib -body { zlib push deflate $outSide -dictionary $spdyDict fconfigure $outSide -blocking 0 -translation binary -buffering none - fconfigure $inSide -blocking 0 -translation binary + fconfigure $inSide -blocking 1 -translation binary puts -nonewline $outSide $spdyHeaders chan pop $outSide + chan close $outSide $strm put -dictionary $spdyDict [read $inSide] list [string length $spdyHeaders] [string length [$strm get]] } -cleanup { -- cgit v0.12 From f6a4d71bada6d59b1daf550d919038e8e34ba666 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 24 Jul 2016 13:09:40 +0000 Subject: [6a19dedc2e] "Clarified" what the units are that [chan copy] uses for -size and that synchronous copying returns. --- doc/chan.n | 14 ++++++++------ doc/fcopy.n | 12 +++++++++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/doc/chan.n b/doc/chan.n index 7ea0d19..36d56f8 100644 --- a/doc/chan.n +++ b/doc/chan.n @@ -287,12 +287,14 @@ slow destinations like network sockets. .RS .PP The \fBchan copy\fR command transfers data from \fIinputChan\fR until -end of file or \fIsize\fR bytes have been transferred. If no -\fB\-size\fR argument is given, then the copy goes until end of file. -All the data read from \fIinputChan\fR is copied to \fIoutputChan\fR. -Without the \fB\-command\fR option, \fBchan copy\fR blocks until the -copy is complete and returns the number of bytes written to -\fIoutputChan\fR. +end of file or \fIsize\fR bytes or characters have been transferred; +\fIsize\fR is in bytes if the two channels are using the same encoding, +and is in characters otherwise. If no \fB\-size\fR argument is given, +then the copy goes until end of file. All the data read from +\fIinputChan\fR is copied to \fIoutputChan\fR. Without the +\fB\-command\fR option, \fBchan copy\fR blocks until the copy is +complete and returns the number of bytes or characters (using the same +rules as for the \fB\-size\fR option) written to \fIoutputChan\fR. .PP The \fB\-command\fR argument makes \fBchan copy\fR work in the background. In this case it returns immediately and the diff --git a/doc/fcopy.n b/doc/fcopy.n index e5dd1d6..d39c803 100644 --- a/doc/fcopy.n +++ b/doc/fcopy.n @@ -25,12 +25,15 @@ network sockets. .PP The \fBfcopy\fR command transfers data from \fIinchan\fR until end of file -or \fIsize\fR bytes have been -transferred. If no \fB\-size\fR argument is given, +or \fIsize\fR bytes or characters have been +transferred; \fIsize\fR is in bytes if the two channels are using the +same encoding, and is in characters otherwise. +If no \fB\-size\fR argument is given, then the copy goes until end of file. All the data read from \fIinchan\fR is copied to \fIoutchan\fR. Without the \fB\-command\fR option, \fBfcopy\fR blocks until the copy is complete -and returns the number of bytes written to \fIoutchan\fR. +and returns the number of bytes or characters (using the same rules as +for the \fB\-size\fR option) written to \fIoutchan\fR. .PP The \fB\-command\fR argument makes \fBfcopy\fR work in the background. In this case it returns immediately and the \fIcallback\fR is invoked @@ -174,3 +177,6 @@ vwait done eof(n), fblocked(n), fconfigure(n), file(n) .SH KEYWORDS blocking, channel, end of line, end of file, nonblocking, read, translation +'\" Local Variables: +'\" mode: nroff +'\" End: -- cgit v0.12