From 4dc2505e43d0504fe3d016def13f263c76b20a53 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 4 Nov 2016 21:29:30 +0000 Subject: First draft refactoring the [string first] functionality. --- generic/tclExecute.c | 4 +++ generic/tclInt.h | 2 ++ generic/tclStringObj.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 83b83f1..5ea199d 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5720,6 +5720,9 @@ TEBCresume( NEXT_INST_V(1, 3, 1); case INST_STR_FIND: +#if 1 + match = TclStringFind(OBJ_UNDER_TOS, OBJ_AT_TOS, 0); +#else ustring1 = Tcl_GetUnicodeFromObj(OBJ_AT_TOS, &length); /* Haystack */ ustring2 = Tcl_GetUnicodeFromObj(OBJ_UNDER_TOS, &length2);/* Needle */ @@ -5734,6 +5737,7 @@ TEBCresume( } } } +#endif TRACE(("%.20s %.20s => %d\n", O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match)); diff --git a/generic/tclInt.h b/generic/tclInt.h index 8a647f0..26592f9 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3138,6 +3138,8 @@ MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr, MODULE_SCOPE int TclStringCatObjv(Tcl_Interp *interp, int inPlace, int objc, Tcl_Obj *const objv[], Tcl_Obj **objPtrPtr); +MODULE_SCOPE int TclStringFind(Tcl_Obj *needle, Tcl_Obj *haystack, + unsigned int start); MODULE_SCOPE int TclStringMatch(const char *str, int strLen, const char *pattern, int ptnLen, int flags); MODULE_SCOPE int TclStringMatchObj(Tcl_Obj *stringObj, diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index b486106..6e1529c 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2841,6 +2841,90 @@ TclStringCatObjv( /* *--------------------------------------------------------------------------- * + * TclStringFind -- + * + * Implements the [string first] operation. + * + * Results: + * If needle is found as a substring of haystack, the index of the + * first instance of such a find is returned. If needle is not present + * as a substring of haystack, -1 is returned. + * + * Side effects: + * needle and haystack may have their Tcl_ObjType changed. + * + *--------------------------------------------------------------------------- + */ + +int +TclStringFind( + Tcl_Obj *needle, + Tcl_Obj *haystack, + unsigned int start) +{ + int ln, lh; + + if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) { + unsigned char *end, *try, *bh; + unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln); + + if (ln == 0) { + /* + * We don't find empty substrings. Bizarre! + * + * TODO: When we one day make this a true substring + * finder, change this to "return 0" + */ + return -1; + } + + bh = Tcl_GetByteArrayFromObj(haystack, &lh); + end = bh + lh; + + try = bh + start; + while (try + ln <= end) { + try = memchr(try, bn[0], end - try); + + if (try == NULL) { + return -1; + } + if (0 == memcmp(try+1, bn+1, ln-1)) { + return (try - bh); + } + try++; + } + return -1; + } + + /* TODO: Detect and optimize case with single byte chars only */ + + { + Tcl_UniChar *try, *end, *uh; + Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); + + if (ln == 0) { + /* See above */ + return -1; + } + + uh = Tcl_GetUnicodeFromObj(haystack, &lh); + end = uh + lh; + + try = uh + start; + while (try + ln <= end) { + if ((*try == *un) + && (0 == memcmp(try+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) { + return (try - uh); + } + try++; + } + return -1; + } +} + +/* + *--------------------------------------------------------------------------- + * * TclStringObjReverse -- * * Implements the [string reverse] operation. -- cgit v0.12 From 1571dc01bb35c5a3255f68feb7f92f12ddad3654 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 7 Nov 2016 19:28:25 +0000 Subject: Implement direct eval [string first] with the refactored engine. --- generic/tclCmdMZ.c | 78 +++++++----------------------------------------------- 1 file changed, 9 insertions(+), 69 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 10c2ef3..be77b1f 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1176,8 +1176,7 @@ StringFirstCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tcl_UniChar *needleStr, *haystackStr; - int match, start, needleLen, haystackLen; + int start = 0; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -1185,82 +1184,23 @@ StringFirstCmd( return TCL_ERROR; } - /* - * We are searching haystackStr for the sequence needleStr. - */ - - match = -1; - start = 0; - haystackLen = -1; - - needleStr = Tcl_GetUnicodeFromObj(objv[1], &needleLen); - haystackStr = Tcl_GetUnicodeFromObj(objv[2], &haystackLen); - if (objc == 4) { - /* - * If a startIndex is specified, we will need to fast forward to that - * point in the string before we think about a match. - */ + int size = Tcl_GetCharLength(objv[2]); - if (TclGetIntForIndexM(interp, objv[3], haystackLen-1, - &start) != TCL_OK){ + if (TCL_OK != TclGetIntForIndexM(interp, objv[3], size - 1, &start)) { return TCL_ERROR; } - /* - * Reread to prevent shimmering problems. - */ - - needleStr = Tcl_GetUnicodeFromObj(objv[1], &needleLen); - haystackStr = Tcl_GetUnicodeFromObj(objv[2], &haystackLen); - - if (start >= haystackLen) { - goto str_first_done; - } else if (start > 0) { - haystackStr += start; - haystackLen -= start; - } else if (start < 0) { - /* - * Invalid start index mapped to string start; Bug #423581 - */ - + if (start < 0) { start = 0; } - } - - /* - * If the length of the needle is more than the length of the haystack, it - * cannot be contained in there so we can avoid searching. [Bug 2960021] - */ - - if (needleLen > 0 && needleLen <= haystackLen) { - register Tcl_UniChar *p, *end; - - end = haystackStr + haystackLen - needleLen + 1; - for (p = haystackStr; p < end; p++) { - /* - * Scan forward to find the first character. - */ - - if ((*p == *needleStr) && (memcmp(needleStr, p, - sizeof(Tcl_UniChar) * (size_t)needleLen) == 0)) { - match = p - haystackStr; - break; - } + if (start >= size) { + Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); + return TCL_OK; } } - - /* - * Compute the character index of the matching string by counting the - * number of characters before the match. - */ - - if ((match != -1) && (objc == 4)) { - match += start; - } - - str_first_done: - Tcl_SetObjResult(interp, Tcl_NewIntObj(match)); + Tcl_SetObjResult(interp, Tcl_NewIntObj(TclStringFind(objv[1], + objv[2], start))); return TCL_OK; } -- cgit v0.12 From dc11ffbbdb8b86b68b1c857612ef4d6ea57115dc Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 7 Nov 2016 19:41:15 +0000 Subject: Consolidate the "find empty string" cases. --- generic/tclStringObj.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 6e1529c..0c0121e 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2862,22 +2862,22 @@ TclStringFind( Tcl_Obj *haystack, unsigned int start) { - int ln, lh; + int lh, ln = Tcl_GetCharLength(needle); + + if (ln == 0) { + /* + * We don't find empty substrings. Bizarre! + * + * TODO: When we one day make this a true substring + * finder, change this to "return 0" + */ + return -1; + } if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) { unsigned char *end, *try, *bh; unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln); - if (ln == 0) { - /* - * We don't find empty substrings. Bizarre! - * - * TODO: When we one day make this a true substring - * finder, change this to "return 0" - */ - return -1; - } - bh = Tcl_GetByteArrayFromObj(haystack, &lh); end = bh + lh; @@ -2902,11 +2902,6 @@ TclStringFind( Tcl_UniChar *try, *end, *uh; Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); - if (ln == 0) { - /* See above */ - return -1; - } - uh = Tcl_GetUnicodeFromObj(haystack, &lh); end = uh + lh; -- cgit v0.12 From 790b302275b213db52a57206eed6821f165f8d64 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 7 Nov 2016 20:04:22 +0000 Subject: Optimize case of all single-byte chars. --- generic/tclStringObj.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 0c0121e..edba881 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2896,9 +2896,27 @@ TclStringFind( return -1; } - /* TODO: Detect and optimize case with single byte chars only */ + lh = Tcl_GetCharLength(haystack); + if (haystack->bytes && (lh == haystack->length)) { + /* haystack is all single-byte chars */ - { + if (needle->bytes && (ln == needle->length)) { + /* needle is also all single-byte chars */ + char *found = strstr(haystack->bytes + start, needle->bytes); + + if (found) { + return (found - haystack->bytes); + } else { + return -1; + } + } else { + /* + * Cannot find substring with a multi-byte char inside + * a string with no multi-byte chars. + */ + return -1; + } + } else { Tcl_UniChar *try, *end, *uh; Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); -- cgit v0.12 From 37fb43ad48ee8d158656f4daab42d79a02f03756 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 7 Nov 2016 20:18:30 +0000 Subject: Purge disabled code. --- generic/tclExecute.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 5ea199d..a44451f 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5720,24 +5720,7 @@ TEBCresume( NEXT_INST_V(1, 3, 1); case INST_STR_FIND: -#if 1 match = TclStringFind(OBJ_UNDER_TOS, OBJ_AT_TOS, 0); -#else - ustring1 = Tcl_GetUnicodeFromObj(OBJ_AT_TOS, &length); /* Haystack */ - ustring2 = Tcl_GetUnicodeFromObj(OBJ_UNDER_TOS, &length2);/* Needle */ - - match = -1; - if (length2 > 0 && length2 <= length) { - end = ustring1 + length - length2 + 1; - for (p=ustring1 ; p %d\n", O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match)); -- cgit v0.12 From 3555752d45183e123a7bc2a5e8695e243bcb9d77 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 8 Nov 2016 02:56:11 +0000 Subject: Route all [string last] operations through a common implementation. --- generic/tclCmdMZ.c | 67 +++++-------------------------- generic/tclExecute.c | 15 +------ generic/tclInt.h | 4 +- generic/tclStringObj.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++- tests/string.test | 4 +- 5 files changed, 122 insertions(+), 74 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index be77b1f..e9a6933 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1229,76 +1229,31 @@ StringLastCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tcl_UniChar *needleStr, *haystackStr, *p; - int match, start, needleLen, haystackLen; + int last = INT_MAX - 1; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, - "needleString haystackString ?startIndex?"); + "needleString haystackString ?lastIndex?"); return TCL_ERROR; } - /* - * We are searching haystackString for the sequence needleString. - */ - - match = -1; - start = 0; - haystackLen = -1; - - needleStr = Tcl_GetUnicodeFromObj(objv[1], &needleLen); - haystackStr = Tcl_GetUnicodeFromObj(objv[2], &haystackLen); - if (objc == 4) { - /* - * If a startIndex is specified, we will need to restrict the string - * range to that char index in the string - */ + int size = Tcl_GetCharLength(objv[2]); - if (TclGetIntForIndexM(interp, objv[3], haystackLen-1, - &start) != TCL_OK){ + if (TCL_OK != TclGetIntForIndexM(interp, objv[3], size - 1, &last)) { return TCL_ERROR; } - /* - * Reread to prevent shimmering problems. - */ - - needleStr = Tcl_GetUnicodeFromObj(objv[1], &needleLen); - haystackStr = Tcl_GetUnicodeFromObj(objv[2], &haystackLen); - - if (start < 0) { - goto str_last_done; - } else if (start < haystackLen) { - p = haystackStr + start + 1 - needleLen; - } else { - p = haystackStr + haystackLen - needleLen; + if (last < 0) { + Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); + return TCL_OK; } - } else { - p = haystackStr + haystackLen - needleLen; - } - - /* - * If the length of the needle is more than the length of the haystack, it - * cannot be contained in there so we can avoid searching. [Bug 2960021] - */ - - if (needleLen > 0 && needleLen <= haystackLen) { - for (; p >= haystackStr; p--) { - /* - * Scan backwards to find the first character. - */ - - if ((*p == *needleStr) && !memcmp(needleStr, p, - sizeof(Tcl_UniChar) * (size_t)needleLen)) { - match = p - haystackStr; - break; - } + if (last >= size) { + last = size - 1; } } - - str_last_done: - Tcl_SetObjResult(interp, Tcl_NewIntObj(match)); + Tcl_SetObjResult(interp, Tcl_NewIntObj(TclStringLast(objv[1], + objv[2], last))); return TCL_OK; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index a44451f..0d48071 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5728,23 +5728,10 @@ TEBCresume( NEXT_INST_F(1, 2, 1); case INST_STR_FIND_LAST: - ustring1 = Tcl_GetUnicodeFromObj(OBJ_AT_TOS, &length); /* Haystack */ - ustring2 = Tcl_GetUnicodeFromObj(OBJ_UNDER_TOS, &length2);/* Needle */ - - match = -1; - if (length2 > 0 && length2 <= length) { - for (p=ustring1+length-length2 ; p>=ustring1 ; p--) { - if ((*p == *ustring2) && - memcmp(ustring2,p,sizeof(Tcl_UniChar)*length2) == 0) { - match = p - ustring1; - break; - } - } - } + match = TclStringLast(OBJ_UNDER_TOS, OBJ_AT_TOS, INT_MAX - 1); TRACE(("%.20s %.20s => %d\n", O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match)); - TclNewIntObj(objResultPtr, match); NEXT_INST_F(1, 2, 1); diff --git a/generic/tclInt.h b/generic/tclInt.h index 26592f9..e468f3d 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3139,7 +3139,9 @@ MODULE_SCOPE int TclStringCatObjv(Tcl_Interp *interp, int inPlace, int objc, Tcl_Obj *const objv[], Tcl_Obj **objPtrPtr); MODULE_SCOPE int TclStringFind(Tcl_Obj *needle, Tcl_Obj *haystack, - unsigned int start); + int start); +MODULE_SCOPE int TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack, + int last); MODULE_SCOPE int TclStringMatch(const char *str, int strLen, const char *pattern, int ptnLen, int flags); MODULE_SCOPE int TclStringMatchObj(Tcl_Obj *stringObj, diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index edba881..f7791fe 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2860,7 +2860,7 @@ int TclStringFind( Tcl_Obj *needle, Tcl_Obj *haystack, - unsigned int start) + int start) { int lh, ln = Tcl_GetCharLength(needle); @@ -2938,6 +2938,110 @@ TclStringFind( /* *--------------------------------------------------------------------------- * + * TclStringLast -- + * + * Implements the [string last] operation. + * + * Results: + * If needle is found as a substring of haystack, the index of the + * last instance of such a find is returned. If needle is not present + * as a substring of haystack, -1 is returned. + * + * Side effects: + * needle and haystack may have their Tcl_ObjType changed. + * + *--------------------------------------------------------------------------- + */ + +int +TclStringLast( + Tcl_Obj *needle, + Tcl_Obj *haystack, + int last) +{ + int lh, ln = Tcl_GetCharLength(needle); + + if (ln == 0) { + /* + * We don't find empty substrings. Bizarre! + * + * TODO: When we one day make this a true substring + * finder, change this to "return 0" + */ + return -1; + } + + if (ln > last + 1) { + return -1; + } + + if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) { + unsigned char *try, *bh; + unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln); + + bh = Tcl_GetByteArrayFromObj(haystack, &lh); + + if (last + 1 > lh) { + last = lh - 1; + } + try = bh + last + 1 - ln; + while (try >= bh) { + if ((*try == bn[0]) + && (0 == memcmp(try+1, bn+1, ln-1))) { + return (try - bh); + } + try--; + } + return -1; + } + + lh = Tcl_GetCharLength(haystack); + if (last + 1 > lh) { + last = lh - 1; + } + if (haystack->bytes && (lh == haystack->length)) { + /* haystack is all single-byte chars */ + + if (needle->bytes && (ln == needle->length)) { + /* needle is also all single-byte chars */ + + char *try = haystack->bytes + last + 1 - ln; + while (try >= haystack->bytes) { + if ((*try == needle->bytes[0]) + && (0 == memcmp(try+1, needle->bytes + 1, ln - 1))) { + return (try - haystack->bytes); + } + try--; + } + return -1; + } else { + /* + * Cannot find substring with a multi-byte char inside + * a string with no multi-byte chars. + */ + return -1; + } + } else { + Tcl_UniChar *try, *uh; + Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); + + uh = Tcl_GetUnicodeFromObj(haystack, &lh); + + try = uh + last + 1 - ln; + while (try >= uh) { + if ((*try == un[0]) + && (0 == memcmp(try+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) { + return (try - uh); + } + try--; + } + return -1; + } +} + +/* + *--------------------------------------------------------------------------- + * * TclStringObjReverse -- * * Implements the [string reverse] operation. diff --git a/tests/string.test b/tests/string.test index 5fdb510..11cbcff 100644 --- a/tests/string.test +++ b/tests/string.test @@ -756,13 +756,13 @@ catch {rename largest_int {}} test string-7.1 {string last, too few args} { list [catch {string last a} msg] $msg -} {1 {wrong # args: should be "string last needleString haystackString ?startIndex?"}} +} {1 {wrong # args: should be "string last needleString haystackString ?lastIndex?"}} test string-7.2 {string last, bad args} { list [catch {string last a b c} msg] $msg } {1 {bad index "c": must be integer?[+-]integer? or end?[+-]integer?}} test string-7.3 {string last, too many args} { list [catch {string last a b c d} msg] $msg -} {1 {wrong # args: should be "string last needleString haystackString ?startIndex?"}} +} {1 {wrong # args: should be "string last needleString haystackString ?lastIndex?"}} test string-7.4 {string last} { string la xxx xxxx123xx345x678 } 1 -- cgit v0.12 From 31647bcceb33c217f63d5687c3e12c63fd3bb47e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 10 Nov 2016 14:19:28 +0000 Subject: On OSX, there is a conflict with the "define panic" and definitions in "mach.h". --- generic/tcl.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tcl.h b/generic/tcl.h index 3037ceb..a8ebaed 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2631,7 +2631,9 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); # define Tcl_Ckrealloc Tcl_Realloc # define Tcl_Return Tcl_SetResult # define Tcl_TildeSubst Tcl_TranslateFileName +#ifndef MAC_OSX_TCL /* On OSX, there is a conflict with "mach.h" */ # define panic Tcl_Panic +#endif # define panicVA Tcl_PanicVA #endif /* !TCL_NO_DEPRECATED */ -- cgit v0.12 From 2020e9be615124cc00df46a0b44031c4b1f70590 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 11 Nov 2016 10:53:10 +0000 Subject: Fix [79614fb8b61983ac8ef30ea8752c310465798fc7|79614fb8b6]: "glob", "encoding system" and encoding-free filesystems --- generic/tclEncoding.c | 3 ++- generic/tclIOUtil.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 54a49aa..6c16827 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -979,7 +979,7 @@ Tcl_GetEncodingNames( * Side effects: * The reference count of the new system encoding is incremented. The * reference count of the old system encoding is decremented and it may - * be freed. + * be freed. All VFS cached information is invalidated. * *------------------------------------------------------------------------ */ @@ -1010,6 +1010,7 @@ Tcl_SetSystemEncoding( FreeEncoding(systemEncoding); systemEncoding = encoding; Tcl_MutexUnlock(&encodingMutex); + Tcl_FSMountsChanged(NULL); return TCL_OK; } diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 82ffd88..e1c5709 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -699,8 +699,8 @@ FsGetFirstFilesystem(void) } /* - * The epoch can be changed both by filesystems being added or removed and by - * env(HOME) changing. + * The epoch can be changed by filesystems being added or removed, by changing + * the "system encoding" and by env(HOME) changing. */ int -- cgit v0.12 From 92b58040ddd7b06cec6453eafddde7742308295b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 11 Nov 2016 14:53:58 +0000 Subject: Fix harmless gcc warning message: using "unsigned" doesn't serve any purpose, actually. --- generic/tclInt.decls | 2 +- generic/tclIntPlatDecls.h | 12 ++++++------ generic/tclTest.c | 6 +++--- unix/tclUnixCompat.c | 4 ++-- win/tclWin32Dll.c | 4 ++-- win/tclWinTime.c | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/generic/tclInt.decls b/generic/tclInt.decls index c00dff1..8314925 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -1246,7 +1246,7 @@ declare 19 macosx { } declare 29 {win unix} { - int TclWinCPUID(unsigned int index, unsigned int *regs) + int TclWinCPUID(int index, int *regs) } # Added in 8.6; core of TclpOpenTemporaryFile declare 30 {win unix} { diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index ac06787..494d6f1 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -98,7 +98,7 @@ EXTERN int TclUnixCopyFile(const char *src, const char *dst, /* Slot 27 is reserved */ /* Slot 28 is reserved */ /* 29 */ -EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); +EXTERN int TclWinCPUID(int index, int *regs); /* 30 */ EXTERN int TclUnixOpenTemporaryFile(Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, @@ -173,7 +173,7 @@ EXTERN void TclWinFlushDirtyChannels(void); /* 28 */ EXTERN void TclWinResetInterfaces(void); /* 29 */ -EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); +EXTERN int TclWinCPUID(int index, int *regs); /* 30 */ EXTERN int TclUnixOpenTemporaryFile(Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, @@ -247,7 +247,7 @@ EXTERN void TclMacOSXNotifierAddRunLoopMode( /* Slot 27 is reserved */ /* Slot 28 is reserved */ /* 29 */ -EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); +EXTERN int TclWinCPUID(int index, int *regs); /* 30 */ EXTERN int TclUnixOpenTemporaryFile(Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, @@ -288,7 +288,7 @@ typedef struct TclIntPlatStubs { void (*reserved26)(void); void (*reserved27)(void); void (*reserved28)(void); - int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ + int (*tclWinCPUID) (int index, int *regs); /* 29 */ int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */ #endif /* UNIX */ #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ @@ -321,7 +321,7 @@ typedef struct TclIntPlatStubs { void (*tclWinSetInterfaces) (int wide); /* 26 */ void (*tclWinFlushDirtyChannels) (void); /* 27 */ void (*tclWinResetInterfaces) (void); /* 28 */ - int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ + int (*tclWinCPUID) (int index, int *regs); /* 29 */ int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ @@ -354,7 +354,7 @@ typedef struct TclIntPlatStubs { void (*reserved26)(void); void (*reserved27)(void); void (*reserved28)(void); - int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ + int (*tclWinCPUID) (int index, int *regs); /* 29 */ int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */ #endif /* MACOSX */ } TclIntPlatStubs; diff --git a/generic/tclTest.c b/generic/tclTest.c index 47d85e1..e30c4d0 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -6751,7 +6751,7 @@ TestcpuidCmd( Tcl_Obj *const * objv) /* Parameter vector */ { int status, index, i; - unsigned int regs[4]; + int regs[4]; Tcl_Obj *regsObjs[4]; if (objc != 2) { @@ -6761,14 +6761,14 @@ TestcpuidCmd( if (Tcl_GetIntFromObj(interp, objv[1], &index) != TCL_OK) { return TCL_ERROR; } - status = TclWinCPUID((unsigned) index, regs); + status = TclWinCPUID(index, regs); if (status != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj("operation not available", -1)); return status; } for (i=0 ; i<4 ; ++i) { - regsObjs[i] = Tcl_NewIntObj((int) regs[i]); + regsObjs[i] = Tcl_NewIntObj(regs[i]); } Tcl_SetObjResult(interp, Tcl_NewListObj(4, regsObjs)); return TCL_OK; diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index 1247061..ea6067e 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -988,8 +988,8 @@ CopyString( int TclWinCPUID( - unsigned int index, /* Which CPUID value to retrieve. */ - unsigned int *regsPtr) /* Registers after the CPUID. */ + int index, /* Which CPUID value to retrieve. */ + int *regsPtr) /* Registers after the CPUID. */ { int status = TCL_ERROR; diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 688fa8d..d8a8717 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -603,8 +603,8 @@ Tcl_WinTCharToUtf( int TclWinCPUID( - unsigned int index, /* Which CPUID value to retrieve. */ - unsigned int *regsPtr) /* Registers after the CPUID. */ + int index, /* Which CPUID value to retrieve. */ + int *regsPtr) /* Registers after the CPUID. */ { int status = TCL_ERROR; diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 7b5c18a..f4e08fa 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -341,7 +341,7 @@ NativeGetTime( */ SYSTEM_INFO systemInfo; - unsigned int regs[4]; + int regs[4]; GetSystemInfo(&systemInfo); if (TclWinCPUID(0, regs) == TCL_OK -- cgit v0.12 From bc5ffbb3b250f36262778ceb51c070bf1c8e7d8d Mon Sep 17 00:00:00 2001 From: venkat Date: Sat, 12 Nov 2016 11:18:31 +0000 Subject: Update to tzdata2016i from IETF --- library/tzdata/Antarctica/Casey | 1 + library/tzdata/Europe/Malta | 28 +++--- library/tzdata/Europe/Rome | 33 +++---- library/tzdata/Pacific/Tongatapu | 185 +++++++++++++++++++++++++++++++++++++-- 4 files changed, 208 insertions(+), 39 deletions(-) diff --git a/library/tzdata/Antarctica/Casey b/library/tzdata/Antarctica/Casey index 3035ab9..beb0f9e 100644 --- a/library/tzdata/Antarctica/Casey +++ b/library/tzdata/Antarctica/Casey @@ -7,4 +7,5 @@ set TZData(:Antarctica/Casey) { {1267714800 28800 0 +08} {1319738400 39600 0 +11} {1329843600 28800 0 +08} + {1477065600 39600 0 +11} } diff --git a/library/tzdata/Europe/Malta b/library/tzdata/Europe/Malta index b84f68e..0ebe2f6 100644 --- a/library/tzdata/Europe/Malta +++ b/library/tzdata/Europe/Malta @@ -3,23 +3,23 @@ set TZData(:Europe/Malta) { {-9223372036854775808 3484 0 LMT} {-2403478684 3600 0 CET} - {-1690851600 7200 1 CEST} - {-1680483600 3600 0 CET} + {-1690765200 7200 1 CEST} + {-1680487200 3600 0 CET} {-1664758800 7200 1 CEST} - {-1649034000 3600 0 CET} + {-1648951200 3600 0 CET} {-1635123600 7200 1 CEST} - {-1616979600 3600 0 CET} + {-1616896800 3600 0 CET} {-1604278800 7200 1 CEST} - {-1585530000 3600 0 CET} + {-1585533600 3600 0 CET} {-1571014800 7200 1 CEST} - {-1555290000 3600 0 CET} + {-1555293600 3600 0 CET} {-932432400 7200 1 CEST} {-857257200 3600 0 CET} {-844556400 7200 1 CEST} {-828226800 3600 0 CET} - {-812502000 7200 1 CEST} - {-796777200 3600 0 CET} - {-781052400 7200 0 CEST} + {-812588400 7200 1 CEST} + {-798073200 3600 0 CET} + {-781052400 7200 1 CEST} {-766717200 3600 0 CET} {-750898800 7200 1 CEST} {-733359600 3600 0 CET} @@ -30,17 +30,17 @@ set TZData(:Europe/Malta) { {-114051600 7200 1 CEST} {-103168800 3600 0 CET} {-81997200 7200 1 CEST} - {-71719200 3600 0 CET} + {-71715600 3600 0 CET} {-50547600 7200 1 CEST} - {-40269600 3600 0 CET} + {-40266000 3600 0 CET} {-18493200 7200 1 CEST} - {-8215200 3600 0 CET} + {-8211600 3600 0 CET} {12956400 7200 1 CEST} - {23234400 3600 0 CET} + {23238000 3600 0 CET} {43801200 7200 1 CEST} {54687600 3600 0 CET} {75855600 7200 1 CEST} - {86738400 3600 0 CET} + {86742000 3600 0 CET} {102380400 7200 0 CEST} {118105200 3600 0 CET} {135730800 7200 1 CEST} diff --git a/library/tzdata/Europe/Rome b/library/tzdata/Europe/Rome index 64948b8..f53340c 100644 --- a/library/tzdata/Europe/Rome +++ b/library/tzdata/Europe/Rome @@ -3,24 +3,25 @@ set TZData(:Europe/Rome) { {-9223372036854775808 2996 0 LMT} {-3259097396 2996 0 RMT} - {-2403564596 3600 0 CET} - {-1690851600 7200 1 CEST} - {-1680483600 3600 0 CET} + {-2403565200 3600 0 CET} + {-1690765200 7200 1 CEST} + {-1680487200 3600 0 CET} {-1664758800 7200 1 CEST} - {-1649034000 3600 0 CET} + {-1648951200 3600 0 CET} {-1635123600 7200 1 CEST} - {-1616979600 3600 0 CET} + {-1616896800 3600 0 CET} {-1604278800 7200 1 CEST} - {-1585530000 3600 0 CET} + {-1585533600 3600 0 CET} {-1571014800 7200 1 CEST} - {-1555290000 3600 0 CET} + {-1555293600 3600 0 CET} {-932432400 7200 1 CEST} {-857257200 3600 0 CET} {-844556400 7200 1 CEST} + {-830307600 7200 0 CEST} {-828226800 3600 0 CET} {-812502000 7200 1 CEST} - {-804819600 3600 0 CET} - {-798080400 3600 0 CET} + {-807152400 7200 0 CEST} + {-798073200 3600 0 CET} {-781052400 7200 1 CEST} {-766717200 3600 0 CET} {-750898800 7200 1 CEST} @@ -32,21 +33,21 @@ set TZData(:Europe/Rome) { {-114051600 7200 1 CEST} {-103168800 3600 0 CET} {-81997200 7200 1 CEST} - {-71719200 3600 0 CET} + {-71715600 3600 0 CET} {-50547600 7200 1 CEST} - {-40269600 3600 0 CET} + {-40266000 3600 0 CET} {-18493200 7200 1 CEST} - {-8215200 3600 0 CET} + {-8211600 3600 0 CET} {12956400 7200 1 CEST} - {23234400 3600 0 CET} + {23238000 3600 0 CET} {43801200 7200 1 CEST} {54687600 3600 0 CET} {75855600 7200 1 CEST} - {86738400 3600 0 CET} + {86742000 3600 0 CET} {107910000 7200 1 CEST} - {118188000 3600 0 CET} + {118191600 3600 0 CET} {138754800 7200 1 CEST} - {149637600 3600 0 CET} + {149641200 3600 0 CET} {170809200 7200 1 CEST} {181090800 3600 0 CET} {202258800 7200 1 CEST} diff --git a/library/tzdata/Pacific/Tongatapu b/library/tzdata/Pacific/Tongatapu index da9f857..731b4f6 100644 --- a/library/tzdata/Pacific/Tongatapu +++ b/library/tzdata/Pacific/Tongatapu @@ -2,13 +2,180 @@ set TZData(:Pacific/Tongatapu) { {-9223372036854775808 44360 0 LMT} - {-2177497160 44400 0 TOT} - {-915193200 46800 0 TOT} - {915102000 46800 0 TOT} - {939214800 50400 1 TOST} - {953384400 46800 0 TOT} - {973342800 50400 1 TOST} - {980596800 46800 0 TOT} - {1004792400 50400 1 TOST} - {1012046400 46800 0 TOT} + {-2177497160 44400 0 +1220} + {-915193200 46800 0 +13} + {915102000 46800 0 +13} + {939214800 50400 1 +14} + {953384400 46800 0 +13} + {973342800 50400 1 +14} + {980596800 46800 0 +13} + {1004792400 50400 1 +14} + {1012046400 46800 0 +13} + {1478350800 50400 1 +14} + {1484398800 46800 0 +13} + {1509800400 50400 1 +14} + {1516453200 46800 0 +13} + {1541250000 50400 1 +14} + {1547902800 46800 0 +13} + {1572699600 50400 1 +14} + {1579352400 46800 0 +13} + {1604149200 50400 1 +14} + {1610802000 46800 0 +13} + {1636203600 50400 1 +14} + {1642251600 46800 0 +13} + {1667653200 50400 1 +14} + {1673701200 46800 0 +13} + {1699102800 50400 1 +14} + {1705755600 46800 0 +13} + {1730552400 50400 1 +14} + {1737205200 46800 0 +13} + {1762002000 50400 1 +14} + {1768654800 46800 0 +13} + {1793451600 50400 1 +14} + {1800104400 46800 0 +13} + {1825506000 50400 1 +14} + {1831554000 46800 0 +13} + {1856955600 50400 1 +14} + {1863608400 46800 0 +13} + {1888405200 50400 1 +14} + {1895058000 46800 0 +13} + {1919854800 50400 1 +14} + {1926507600 46800 0 +13} + {1951304400 50400 1 +14} + {1957957200 46800 0 +13} + {1983358800 50400 1 +14} + {1989406800 46800 0 +13} + {2014808400 50400 1 +14} + {2020856400 46800 0 +13} + {2046258000 50400 1 +14} + {2052910800 46800 0 +13} + {2077707600 50400 1 +14} + {2084360400 46800 0 +13} + {2109157200 50400 1 +14} + {2115810000 46800 0 +13} + {2140606800 50400 1 +14} + {2147259600 46800 0 +13} + {2172661200 50400 1 +14} + {2178709200 46800 0 +13} + {2204110800 50400 1 +14} + {2210158800 46800 0 +13} + {2235560400 50400 1 +14} + {2242213200 46800 0 +13} + {2267010000 50400 1 +14} + {2273662800 46800 0 +13} + {2298459600 50400 1 +14} + {2305112400 46800 0 +13} + {2329909200 50400 1 +14} + {2336562000 46800 0 +13} + {2361963600 50400 1 +14} + {2368011600 46800 0 +13} + {2393413200 50400 1 +14} + {2400066000 46800 0 +13} + {2424862800 50400 1 +14} + {2431515600 46800 0 +13} + {2456312400 50400 1 +14} + {2462965200 46800 0 +13} + {2487762000 50400 1 +14} + {2494414800 46800 0 +13} + {2519816400 50400 1 +14} + {2525864400 46800 0 +13} + {2551266000 50400 1 +14} + {2557314000 46800 0 +13} + {2582715600 50400 1 +14} + {2589368400 46800 0 +13} + {2614165200 50400 1 +14} + {2620818000 46800 0 +13} + {2645614800 50400 1 +14} + {2652267600 46800 0 +13} + {2677064400 50400 1 +14} + {2683717200 46800 0 +13} + {2709118800 50400 1 +14} + {2715166800 46800 0 +13} + {2740568400 50400 1 +14} + {2747221200 46800 0 +13} + {2772018000 50400 1 +14} + {2778670800 46800 0 +13} + {2803467600 50400 1 +14} + {2810120400 46800 0 +13} + {2834917200 50400 1 +14} + {2841570000 46800 0 +13} + {2866971600 50400 1 +14} + {2873019600 46800 0 +13} + {2898421200 50400 1 +14} + {2904469200 46800 0 +13} + {2929870800 50400 1 +14} + {2936523600 46800 0 +13} + {2961320400 50400 1 +14} + {2967973200 46800 0 +13} + {2992770000 50400 1 +14} + {2999422800 46800 0 +13} + {3024219600 50400 1 +14} + {3030872400 46800 0 +13} + {3056274000 50400 1 +14} + {3062322000 46800 0 +13} + {3087723600 50400 1 +14} + {3093771600 46800 0 +13} + {3119173200 50400 1 +14} + {3125826000 46800 0 +13} + {3150622800 50400 1 +14} + {3157275600 46800 0 +13} + {3182072400 50400 1 +14} + {3188725200 46800 0 +13} + {3213522000 50400 1 +14} + {3220174800 46800 0 +13} + {3245576400 50400 1 +14} + {3251624400 46800 0 +13} + {3277026000 50400 1 +14} + {3283678800 46800 0 +13} + {3308475600 50400 1 +14} + {3315128400 46800 0 +13} + {3339925200 50400 1 +14} + {3346578000 46800 0 +13} + {3371374800 50400 1 +14} + {3378027600 46800 0 +13} + {3403429200 50400 1 +14} + {3409477200 46800 0 +13} + {3434878800 50400 1 +14} + {3440926800 46800 0 +13} + {3466328400 50400 1 +14} + {3472981200 46800 0 +13} + {3497778000 50400 1 +14} + {3504430800 46800 0 +13} + {3529227600 50400 1 +14} + {3535880400 46800 0 +13} + {3560677200 50400 1 +14} + {3567330000 46800 0 +13} + {3592731600 50400 1 +14} + {3598779600 46800 0 +13} + {3624181200 50400 1 +14} + {3630834000 46800 0 +13} + {3655630800 50400 1 +14} + {3662283600 46800 0 +13} + {3687080400 50400 1 +14} + {3693733200 46800 0 +13} + {3718530000 50400 1 +14} + {3725182800 46800 0 +13} + {3750584400 50400 1 +14} + {3756632400 46800 0 +13} + {3782034000 50400 1 +14} + {3788082000 46800 0 +13} + {3813483600 50400 1 +14} + {3820136400 46800 0 +13} + {3844933200 50400 1 +14} + {3851586000 46800 0 +13} + {3876382800 50400 1 +14} + {3883035600 46800 0 +13} + {3907832400 50400 1 +14} + {3914485200 46800 0 +13} + {3939886800 50400 1 +14} + {3945934800 46800 0 +13} + {3971336400 50400 1 +14} + {3977384400 46800 0 +13} + {4002786000 50400 1 +14} + {4009438800 46800 0 +13} + {4034235600 50400 1 +14} + {4040888400 46800 0 +13} + {4065685200 50400 1 +14} + {4072338000 46800 0 +13} + {4097134800 50400 1 +14} } -- cgit v0.12