diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-13 21:00:28 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-13 21:00:28 (GMT) |
commit | 261bde3156d50771907d0e386439fd241874b9eb (patch) | |
tree | 9de88c6c9cb22c4cd7db19f5995f880ba4906d7f | |
parent | 4b48c76e1c40761ebe4173552178854265fb50c6 (diff) | |
parent | bce65c12f657a40e26fc4b42de6047d98ee7e012 (diff) | |
download | tcl-261bde3156d50771907d0e386439fd241874b9eb.zip tcl-261bde3156d50771907d0e386439fd241874b9eb.tar.gz tcl-261bde3156d50771907d0e386439fd241874b9eb.tar.bz2 |
Eliminate dependency in test-suite on Unicode functions. Merge tip-548. Fix build with -DTCL_NO_DEPRECATED
-rw-r--r-- | generic/tclCmdMZ.c | 58 | ||||
-rw-r--r-- | generic/tclDate.c | 24 | ||||
-rw-r--r-- | generic/tclExecute.c | 18 | ||||
-rw-r--r-- | generic/tclGetDate.y | 18 | ||||
-rw-r--r-- | generic/tclInt.decls | 9 | ||||
-rw-r--r-- | generic/tclIntDecls.h | 11 | ||||
-rw-r--r-- | generic/tclRegexp.c | 2 | ||||
-rw-r--r-- | generic/tclStringObj.c | 38 | ||||
-rw-r--r-- | generic/tclStubInit.c | 4 | ||||
-rw-r--r-- | generic/tclTestObj.c | 42 | ||||
-rw-r--r-- | generic/tclUtil.c | 4 | ||||
-rw-r--r-- | tests/chanio.test | 3 | ||||
-rw-r--r-- | tests/io.test | 5 | ||||
-rw-r--r-- | tests/stringObj.test | 4 | ||||
-rw-r--r-- | tests/utf.test | 16 |
15 files changed, 98 insertions, 158 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ae98648..8706fb6 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -606,9 +606,9 @@ Tcl_RegsubObjCmd( nocase = (cflags & TCL_REG_NOCASE); strCmpFn = nocase ? Tcl_UniCharNcasecmp : Tcl_UniCharNcmp; - wsrc = TclGetUnicodeFromObj(objv[0], &slen); - wstring = TclGetUnicodeFromObj(objv[1], &wlen); - wsubspec = TclGetUnicodeFromObj(objv[2], &wsublen); + wsrc = Tcl_GetUnicodeFromObj(objv[0], &slen); + wstring = Tcl_GetUnicodeFromObj(objv[1], &wlen); + wsubspec = Tcl_GetUnicodeFromObj(objv[2], &wsublen); wend = wstring + wlen - (slen ? slen - 1 : 0); result = TCL_OK; @@ -622,8 +622,8 @@ Tcl_RegsubObjCmd( resultPtr = Tcl_NewUnicodeObj(wstring, 0); Tcl_IncrRefCount(resultPtr); for (; wstring < wend; wstring++) { - TclAppendUnicodeToObj(resultPtr, wsubspec, wsublen); - TclAppendUnicodeToObj(resultPtr, wstring, 1); + Tcl_AppendUnicodeToObj(resultPtr, wsubspec, wsublen); + Tcl_AppendUnicodeToObj(resultPtr, wstring, 1); numMatches++; } wlen = 0; @@ -640,14 +640,14 @@ Tcl_RegsubObjCmd( Tcl_IncrRefCount(resultPtr); } if (p != wstring) { - TclAppendUnicodeToObj(resultPtr, p, wstring - p); + Tcl_AppendUnicodeToObj(resultPtr, p, wstring - p); p = wstring + slen; } else { p += slen; } wstring = p - 1; - TclAppendUnicodeToObj(resultPtr, wsubspec, wsublen); + Tcl_AppendUnicodeToObj(resultPtr, wsubspec, wsublen); numMatches++; } } @@ -699,14 +699,14 @@ Tcl_RegsubObjCmd( } else { objPtr = objv[1]; } - wstring = TclGetUnicodeFromObj(objPtr, &wlen); + wstring = Tcl_GetUnicodeFromObj(objPtr, &wlen); if (objv[2] == objv[0]) { subPtr = Tcl_DuplicateObj(objv[2]); } else { subPtr = objv[2]; } if (!command) { - wsubspec = TclGetUnicodeFromObj(subPtr, &wsublen); + wsubspec = Tcl_GetUnicodeFromObj(subPtr, &wsublen); } result = TCL_OK; @@ -750,7 +750,7 @@ Tcl_RegsubObjCmd( * specified. */ - TclAppendUnicodeToObj(resultPtr, wstring, offset); + Tcl_AppendUnicodeToObj(resultPtr, wstring, offset); } } numMatches++; @@ -763,7 +763,7 @@ Tcl_RegsubObjCmd( Tcl_RegExpGetInfo(regExpr, &info); start = info.matches[0].start; end = info.matches[0].end; - TclAppendUnicodeToObj(resultPtr, wstring + offset, start); + Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, start); /* * In command-prefix mode, the substitutions are added as quoted @@ -826,7 +826,7 @@ Tcl_RegsubObjCmd( * the user code. */ - wstring = TclGetUnicodeFromObj(objPtr, &wlen); + wstring = Tcl_GetUnicodeFromObj(objPtr, &wlen); offset += end; if (end == 0 || start == end) { @@ -838,7 +838,7 @@ Tcl_RegsubObjCmd( */ if (offset < wlen) { - TclAppendUnicodeToObj(resultPtr, wstring + offset, 1); + Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1); } offset++; } @@ -867,7 +867,7 @@ Tcl_RegsubObjCmd( idx = ch - '0'; } else if ((ch == '\\') || (ch == '&')) { *wsrc = ch; - TclAppendUnicodeToObj(resultPtr, wfirstChar, + Tcl_AppendUnicodeToObj(resultPtr, wfirstChar, wsrc - wfirstChar + 1); *wsrc = '\\'; wfirstChar = wsrc + 2; @@ -881,7 +881,7 @@ Tcl_RegsubObjCmd( } if (wfirstChar != wsrc) { - TclAppendUnicodeToObj(resultPtr, wfirstChar, + Tcl_AppendUnicodeToObj(resultPtr, wfirstChar, wsrc - wfirstChar); } @@ -889,7 +889,7 @@ Tcl_RegsubObjCmd( subStart = info.matches[idx].start; subEnd = info.matches[idx].end; if ((subStart >= 0) && (subEnd >= 0)) { - TclAppendUnicodeToObj(resultPtr, + Tcl_AppendUnicodeToObj(resultPtr, wstring + offset + subStart, subEnd - subStart); } } @@ -901,7 +901,7 @@ Tcl_RegsubObjCmd( } if (wfirstChar != wsrc) { - TclAppendUnicodeToObj(resultPtr, wfirstChar, wsrc - wfirstChar); + Tcl_AppendUnicodeToObj(resultPtr, wfirstChar, wsrc - wfirstChar); } if (end == 0) { @@ -911,7 +911,7 @@ Tcl_RegsubObjCmd( */ if (offset < wlen) { - TclAppendUnicodeToObj(resultPtr, wstring + offset, 1); + Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1); } offset++; } else { @@ -923,7 +923,7 @@ Tcl_RegsubObjCmd( */ if (offset < wlen) { - TclAppendUnicodeToObj(resultPtr, wstring + offset, 1); + Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1); } offset++; } @@ -948,7 +948,7 @@ Tcl_RegsubObjCmd( resultPtr = objv[1]; Tcl_IncrRefCount(resultPtr); } else if (offset < wlen) { - TclAppendUnicodeToObj(resultPtr, wstring + offset, wlen - offset); + Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, wlen - offset); } if (objc == 4) { if (Tcl_ObjSetVar2(interp, objv[3], NULL, resultPtr, @@ -2080,7 +2080,7 @@ StringMapCmd( } else { sourceObj = objv[objc-1]; } - ustring1 = TclGetUnicodeFromObj(sourceObj, &length1); + ustring1 = Tcl_GetUnicodeFromObj(sourceObj, &length1); if (length1 == 0) { /* * Empty input string, just stop now. @@ -2109,7 +2109,7 @@ StringMapCmd( int mapLen, u2lc; Tcl_UniChar *mapString; - ustring2 = TclGetUnicodeFromObj(mapElemv[0], &length2); + ustring2 = Tcl_GetUnicodeFromObj(mapElemv[0], &length2); p = ustring1; if ((length2 > length1) || (length2 == 0)) { /* @@ -2118,7 +2118,7 @@ StringMapCmd( ustring1 = end; } else { - mapString = TclGetUnicodeFromObj(mapElemv[1], &mapLen); + mapString = Tcl_GetUnicodeFromObj(mapElemv[1], &mapLen); u2lc = (nocase ? Tcl_UniCharToLower(*ustring2) : 0); for (; ustring1 < end; ustring1++) { if (((*ustring1 == *ustring2) || @@ -2126,14 +2126,14 @@ StringMapCmd( (length2==1 || strCmpFn(ustring1, ustring2, (unsigned long) length2) == 0)) { if (p != ustring1) { - TclAppendUnicodeToObj(resultPtr, p, ustring1-p); + Tcl_AppendUnicodeToObj(resultPtr, p, ustring1-p); p = ustring1 + length2; } else { p += length2; } ustring1 = p - 1; - TclAppendUnicodeToObj(resultPtr, mapString, mapLen); + Tcl_AppendUnicodeToObj(resultPtr, mapString, mapLen); } } } @@ -2154,7 +2154,7 @@ StringMapCmd( u2lc = TclStackAlloc(interp, mapElemc * sizeof(int)); } for (index = 0; index < mapElemc; index++) { - mapStrings[index] = TclGetUnicodeFromObj(mapElemv[index], + mapStrings[index] = Tcl_GetUnicodeFromObj(mapElemv[index], mapLens+index); if (nocase && ((index % 2) == 0)) { u2lc[index/2] = Tcl_UniCharToLower(*mapStrings[index]); @@ -2178,7 +2178,7 @@ StringMapCmd( * Put the skipped chars onto the result first. */ - TclAppendUnicodeToObj(resultPtr, p, ustring1-p); + Tcl_AppendUnicodeToObj(resultPtr, p, ustring1-p); p = ustring1 + length2; } else { p += length2; @@ -2194,7 +2194,7 @@ StringMapCmd( * Append the map value to the unicode string. */ - TclAppendUnicodeToObj(resultPtr, + Tcl_AppendUnicodeToObj(resultPtr, mapStrings[index+1], mapLens[index+1]); break; } @@ -2211,7 +2211,7 @@ StringMapCmd( * Put the rest of the unmapped chars onto result. */ - TclAppendUnicodeToObj(resultPtr, p, ustring1 - p); + Tcl_AppendUnicodeToObj(resultPtr, p, ustring1 - p); } Tcl_SetObjResult(interp, resultPtr); done: diff --git a/generic/tclDate.c b/generic/tclDate.c index 32c71de..bf8a150 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -95,6 +95,17 @@ #endif /* _MSC_VER */ /* + * Meridian: am, pm, or 24-hour style. + */ + +typedef enum _MERIDIAN { + MERam, MERpm, MER24 +} MERIDIAN; + + + + +/* * yyparse will accept a 'struct DateInfo' as its parameter; that's where the * parsed fields will be returned. */ @@ -112,7 +123,7 @@ typedef struct DateInfo { time_t dateHour; time_t dateMinutes; time_t dateSeconds; - int dateMeridian; + MERIDIAN dateMeridian; int dateHaveTime; time_t dateTimezone; @@ -199,17 +210,6 @@ typedef enum _DSTMODE { DSTon, DSToff, DSTmaybe } DSTMODE; -/* - * Meridian: am, pm, or 24-hour style. - */ - -typedef enum _MERIDIAN { - MERam, MERpm, MER24 -} MERIDIAN; - - - - # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus # define YY_NULLPTR nullptr diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 962a1aa..faf5865 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5420,12 +5420,12 @@ TEBCresume( objResultPtr = value3Ptr; goto doneStringMap; } - ustring1 = TclGetUnicodeFromObj(valuePtr, &length); + ustring1 = Tcl_GetUnicodeFromObj(valuePtr, &length); if (length == 0) { objResultPtr = valuePtr; goto doneStringMap; } - ustring2 = TclGetUnicodeFromObj(value2Ptr, &length2); + ustring2 = Tcl_GetUnicodeFromObj(value2Ptr, &length2); if (length2 > length || length2 == 0) { objResultPtr = valuePtr; goto doneStringMap; @@ -5437,7 +5437,7 @@ TEBCresume( } goto doneStringMap; } - ustring3 = TclGetUnicodeFromObj(value3Ptr, &length3); + ustring3 = Tcl_GetUnicodeFromObj(value3Ptr, &length3); objResultPtr = Tcl_NewUnicodeObj(ustring1, 0); p = ustring1; @@ -5447,14 +5447,14 @@ TEBCresume( memcmp(ustring1, ustring2, sizeof(Tcl_UniChar) * length2) == 0)) { if (p != ustring1) { - TclAppendUnicodeToObj(objResultPtr, p, ustring1-p); + Tcl_AppendUnicodeToObj(objResultPtr, p, ustring1-p); p = ustring1 + length2; } else { p += length2; } ustring1 = p - 1; - TclAppendUnicodeToObj(objResultPtr, ustring3, length3); + Tcl_AppendUnicodeToObj(objResultPtr, ustring3, length3); } } if (p != ustring1) { @@ -5462,7 +5462,7 @@ TEBCresume( * Put the rest of the unmapped chars onto result. */ - TclAppendUnicodeToObj(objResultPtr, p, ustring1 - p); + Tcl_AppendUnicodeToObj(objResultPtr, p, ustring1 - p); } doneStringMap: TRACE_WITH_OBJ(("%.20s %.20s %.20s => ", @@ -5490,7 +5490,7 @@ TEBCresume( valuePtr = OBJ_AT_TOS; TRACE(("%s \"%.30s\" => ", tclStringClassTable[opnd].name, O2S(valuePtr))); - ustring1 = TclGetUnicodeFromObj(valuePtr, &length); + ustring1 = Tcl_GetUnicodeFromObj(valuePtr, &length); match = 1; if (length > 0) { end = ustring1 + length; @@ -5519,8 +5519,8 @@ TEBCresume( || TclHasIntRep(value2Ptr, &tclStringType)) { Tcl_UniChar *ustring1, *ustring2; - ustring1 = TclGetUnicodeFromObj(valuePtr, &length); - ustring2 = TclGetUnicodeFromObj(value2Ptr, &length2); + ustring1 = Tcl_GetUnicodeFromObj(valuePtr, &length); + ustring2 = Tcl_GetUnicodeFromObj(value2Ptr, &length2); match = TclUniCharMatch(ustring1, length, ustring2, length2, nocase); } else if (TclIsPureByteArray(valuePtr) && !nocase) { diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 59f85bd..d67c32a 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -46,6 +46,14 @@ #endif /* _MSC_VER */ /* + * Meridian: am, pm, or 24-hour style. + */ + +typedef enum _MERIDIAN { + MERam, MERpm, MER24 +} MERIDIAN; + +/* * yyparse will accept a 'struct DateInfo' as its parameter; that's where the * parsed fields will be returned. */ @@ -63,7 +71,7 @@ typedef struct DateInfo { time_t dateHour; time_t dateMinutes; time_t dateSeconds; - int dateMeridian; + MERIDIAN dateMeridian; int dateHaveTime; time_t dateTimezone; @@ -150,14 +158,6 @@ typedef enum _DSTMODE { DSTon, DSToff, DSTmaybe } DSTMODE; -/* - * Meridian: am, pm, or 24-hour style. - */ - -typedef enum _MERIDIAN { - MERam, MERpm, MER24 -} MERIDIAN; - %} %union { diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 49fa228..556da28 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -1034,15 +1034,6 @@ declare 258 { Tcl_Obj *TclpCreateTemporaryDirectory(Tcl_Obj *dirObj, Tcl_Obj *basenameObj) } -# TIP 548 -declare 259 { - Tcl_UniChar *TclGetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr) -} -declare 260 { - void TclAppendUnicodeToObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode, - int length) -} - ############################################################################## diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 721d34d..16bcdf8 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -658,11 +658,6 @@ EXTERN void TclStaticPackage(Tcl_Interp *interp, /* 258 */ EXTERN Tcl_Obj * TclpCreateTemporaryDirectory(Tcl_Obj *dirObj, Tcl_Obj *basenameObj); -/* 259 */ -EXTERN Tcl_UniChar * TclGetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr); -/* 260 */ -EXTERN void TclAppendUnicodeToObj(Tcl_Obj *objPtr, - const Tcl_UniChar *unicode, int length); typedef struct TclIntStubs { int magic; @@ -927,8 +922,6 @@ typedef struct TclIntStubs { int (*tclPtrUnsetVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags); /* 256 */ void (*tclStaticPackage) (Tcl_Interp *interp, const char *pkgName, Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc); /* 257 */ Tcl_Obj * (*tclpCreateTemporaryDirectory) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj); /* 258 */ - Tcl_UniChar * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 259 */ - void (*tclAppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int length); /* 260 */ } TclIntStubs; extern const TclIntStubs *tclIntStubsPtr; @@ -1374,10 +1367,6 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclStaticPackage) /* 257 */ #define TclpCreateTemporaryDirectory \ (tclIntStubsPtr->tclpCreateTemporaryDirectory) /* 258 */ -#define TclGetUnicodeFromObj \ - (tclIntStubsPtr->tclGetUnicodeFromObj) /* 259 */ -#define TclAppendUnicodeToObj \ - (tclIntStubsPtr->tclAppendUnicodeToObj) /* 260 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index d3f21a9..d3f7428 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -482,7 +482,7 @@ Tcl_RegExpExecObj( regexpPtr->string = NULL; regexpPtr->objPtr = textObj; - udata = TclGetUnicodeFromObj(textObj, &length); + udata = Tcl_GetUnicodeFromObj(textObj, &length); if (offset > length) { offset = length; diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 95891c5..1b4f225 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -613,14 +613,14 @@ Tcl_GetUnicode( Tcl_Obj *objPtr) /* The object to find the unicode string * for. */ { - return TclGetUnicodeFromObj(objPtr, NULL); + return Tcl_GetUnicodeFromObj(objPtr, NULL); } #endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- * - * TclGetUnicodeFromObj -- + * Tcl_GetUnicodeFromObj -- * * Get the Unicode form of the String object with length. If the object * is not already a String object, it will be converted to one. If the @@ -637,7 +637,7 @@ Tcl_GetUnicode( */ Tcl_UniChar * -TclGetUnicodeFromObj( +Tcl_GetUnicodeFromObj( Tcl_Obj *objPtr, /* The object to find the unicode string * for. */ int *lengthPtr) /* If non-NULL, the location where the string @@ -1234,7 +1234,7 @@ Tcl_AppendToObj( /* *---------------------------------------------------------------------- * - * TclAppendUnicodeToObj -- + * Tcl_AppendUnicodeToObj -- * * This function appends a Unicode string to an object in the most * efficient manner possible. Length must be >= 0. @@ -1249,7 +1249,7 @@ Tcl_AppendToObj( */ void -TclAppendUnicodeToObj( +Tcl_AppendUnicodeToObj( Tcl_Obj *objPtr, /* Points to the object to append to. */ const Tcl_UniChar *unicode, /* The unicode string to append to the * object. */ @@ -1393,7 +1393,7 @@ Tcl_AppendObjToObj( if (TclHasIntRep(appendObjPtr, &tclStringType)) { Tcl_UniChar *unicode = - TclGetUnicodeFromObj(appendObjPtr, &numChars); + Tcl_GetUnicodeFromObj(appendObjPtr, &numChars); AppendUnicodeToUnicodeRep(objPtr, unicode, numChars); } else { @@ -2873,7 +2873,7 @@ TclStringRepeat( Tcl_GetByteArrayFromObj(objPtr, &length); } else if (unichar) { /* Result will be pure Tcl_UniChar array. Pre-size it. */ - TclGetUnicodeFromObj(objPtr, &length); + Tcl_GetUnicodeFromObj(objPtr, &length); } else { /* Result will be concat of string reps. Pre-size it. */ Tcl_GetStringFromObj(objPtr, &length); @@ -2934,7 +2934,7 @@ TclStringRepeat( Tcl_AppendObjToObj(objResultPtr, objResultPtr); done *= 2; } - TclAppendUnicodeToObj(objResultPtr, Tcl_GetUnicode(objResultPtr), + Tcl_AppendUnicodeToObj(objResultPtr, Tcl_GetUnicode(objResultPtr), (count - done) * length); } else { /* @@ -3091,7 +3091,7 @@ TclStringCat( if ((objPtr->bytes == NULL) || (objPtr->length)) { int numChars; - TclGetUnicodeFromObj(objPtr, &numChars); /* PANIC? */ + Tcl_GetUnicodeFromObj(objPtr, &numChars); /* PANIC? */ if (numChars) { last = objc - oc; if (length == 0) { @@ -3241,7 +3241,7 @@ TclStringCat( objResultPtr = *objv++; objc--; /* Ugly interface! Force resize of the unicode array. */ - TclGetUnicodeFromObj(objResultPtr, &start); + Tcl_GetUnicodeFromObj(objResultPtr, &start); Tcl_InvalidateStringRep(objResultPtr); if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { @@ -3277,7 +3277,7 @@ TclStringCat( if ((objPtr->bytes == NULL) || (objPtr->length)) { int more; - Tcl_UniChar *src = TclGetUnicodeFromObj(objPtr, &more); + Tcl_UniChar *src = Tcl_GetUnicodeFromObj(objPtr, &more); memcpy(dst, src, more * sizeof(Tcl_UniChar)); dst += more; } @@ -3400,8 +3400,8 @@ TclStringCmp( */ if (nocase) { - s1 = (char *) TclGetUnicodeFromObj(value1Ptr, &s1len); - s2 = (char *) TclGetUnicodeFromObj(value2Ptr, &s2len); + s1 = (char *) Tcl_GetUnicodeFromObj(value1Ptr, &s1len); + s2 = (char *) Tcl_GetUnicodeFromObj(value2Ptr, &s2len); memCmpFn = (memCmpFn_t)Tcl_UniCharNcasecmp; } else { s1len = Tcl_GetCharLength(value1Ptr); @@ -3611,9 +3611,9 @@ TclStringFirst( { Tcl_UniChar *check, *end, *uh; - Tcl_UniChar *un = TclGetUnicodeFromObj(needle, &ln); + Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); - uh = TclGetUnicodeFromObj(haystack, &lh); + uh = Tcl_GetUnicodeFromObj(haystack, &lh); if ((lh < ln) || (start > lh - ln)) { /* Don't start the loop if there cannot be a valid answer */ return -1; @@ -3690,8 +3690,8 @@ TclStringLast( } { - Tcl_UniChar *check, *uh = TclGetUnicodeFromObj(haystack, &lh); - Tcl_UniChar *un = TclGetUnicodeFromObj(needle, &ln); + Tcl_UniChar *check, *uh = Tcl_GetUnicodeFromObj(haystack, &lh); + Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); if (last >= lh) { last = lh - 1; @@ -3987,7 +3987,7 @@ TclStringReplace( /* The traditional implementation... */ { int numChars; - Tcl_UniChar *ustring = TclGetUnicodeFromObj(objPtr, &numChars); + Tcl_UniChar *ustring = Tcl_GetUnicodeFromObj(objPtr, &numChars); /* TODO: Is there an in-place option worth pursuing here? */ @@ -3996,7 +3996,7 @@ TclStringReplace( Tcl_AppendObjToObj(result, insertPtr); } if (first + count < numChars) { - TclAppendUnicodeToObj(result, ustring + first + count, + Tcl_AppendUnicodeToObj(result, ustring + first + count, numChars - first - count); } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index f825b61..01b0303 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -472,8 +472,6 @@ static int uniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsig # define TclpLocaltime_unix TclpLocaltime # define TclpGmtime_unix TclpGmtime # define TclOldFreeObj TclFreeObj -# define Tcl_GetUnicodeFromObj TclGetUnicodeFromObj -# define Tcl_AppendUnicodeToObj TclAppendUnicodeToObj static int seekOld( @@ -779,8 +777,6 @@ static const TclIntStubs tclIntStubs = { TclPtrUnsetVar, /* 256 */ TclStaticPackage, /* 257 */ TclpCreateTemporaryDirectory, /* 258 */ - TclGetUnicodeFromObj, /* 259 */ - TclAppendUnicodeToObj, /* 260 */ }; static const TclIntPlatStubs tclIntPlatStubs = { diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index a8b7e9f..699c503 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -1178,8 +1178,7 @@ TeststringobjCmd( Tcl_Obj **varPtr; static const char *const options[] = { "append", "appendstrings", "get", "get2", "length", "length2", - "set", "set2", "setlength", "maxchars", "getunicode", - "appendself", "appendself2", NULL + "set", "set2", "setlength", "maxchars", "appendself", NULL }; if (objc < 3) { @@ -1344,13 +1343,7 @@ TeststringobjCmd( } Tcl_SetIntObj(Tcl_GetObjResult(interp), length); break; - case 10: /* getunicode */ - if (objc != 3) { - goto wrongNumArgs; - } - TclGetUnicodeFromObj(varPtr[varIndex], NULL); - break; - case 11: /* appendself */ + case 10: /* appendself */ if (objc != 4) { goto wrongNumArgs; } @@ -1381,37 +1374,6 @@ TeststringobjCmd( Tcl_AppendToObj(varPtr[varIndex], string + i, length - i); Tcl_SetObjResult(interp, varPtr[varIndex]); break; - case 12: /* appendself2 */ - if (objc != 4) { - goto wrongNumArgs; - } - if (varPtr[varIndex] == NULL) { - SetVarToObj(varPtr, varIndex, Tcl_NewObj()); - } - - /* - * If the object bound to variable "varIndex" is shared, we must - * "copy on write" and append to a copy of the object. - */ - - if (Tcl_IsShared(varPtr[varIndex])) { - SetVarToObj(varPtr, varIndex, Tcl_DuplicateObj(varPtr[varIndex])); - } - - unicode = TclGetUnicodeFromObj(varPtr[varIndex], &length); - - if (Tcl_GetIntFromObj(interp, objv[3], &i) != TCL_OK) { - return TCL_ERROR; - } - if ((i < 0) || (i > length)) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "index value out of range", -1)); - return TCL_ERROR; - } - - TclAppendUnicodeToObj(varPtr[varIndex], unicode + i, length - i); - Tcl_SetObjResult(interp, varPtr[varIndex]); - break; } return TCL_OK; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index ae76ded..35e686f 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2663,8 +2663,8 @@ TclStringMatchObj( if (TclHasIntRep(strObj, &tclStringType) || (strObj->typePtr == NULL)) { Tcl_UniChar *udata, *uptn; - udata = TclGetUnicodeFromObj(strObj, &length); - uptn = TclGetUnicodeFromObj(ptnObj, &plen); + udata = Tcl_GetUnicodeFromObj(strObj, &length); + uptn = Tcl_GetUnicodeFromObj(ptnObj, &plen); match = TclUniCharMatch(udata, length, uptn, plen, flags); } else if (TclIsPureByteArray(strObj) && TclIsPureByteArray(ptnObj) && !flags) { diff --git a/tests/chanio.test b/tests/chanio.test index 1439fe4..4b71fef 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -43,6 +43,7 @@ namespace eval ::tcl::test::io { testConstraint testfevent [llength [info commands testfevent]] testConstraint testchannelevent [llength [info commands testchannelevent]] testConstraint testmainthread [llength [info commands testmainthread]] + testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] # You need a *very* special environment to do some tests. In particular, # many file systems do not support large-files... @@ -2790,7 +2791,7 @@ test chan-io-29.34 {Tcl_Chan Close, async flush on chan close, using sockets} -s chan puts $s $l } } -} -constraints {socket tempNotMac fileevent} -body { +} -constraints {socket tempNotMac fileevent knownMsvcBug} -body { proc accept {s a p} { variable x chan event $s readable [namespace code [list readit $s]] diff --git a/tests/io.test b/tests/io.test index 39deab6..6d9e1c3 100644 --- a/tests/io.test +++ b/tests/io.test @@ -43,6 +43,7 @@ testConstraint testfevent [llength [info commands testfevent]] testConstraint testchannelevent [llength [info commands testchannelevent]] testConstraint testmainthread [llength [info commands testmainthread]] testConstraint testobj [llength [info commands testobj]] +testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] # You need a *very* special environment to do some tests. In # particular, many file systems do not support large-files... @@ -2228,7 +2229,7 @@ test io-27.5 {FlushChannel, implicit flush when buffer fills and on close} \ set path(pipe) [makeFile {} pipe] set path(output) [makeFile {} output] test io-27.6 {FlushChannel, async flushing, async close} \ - {stdio asyncPipeClose openpipe} { + {stdio asyncPipeClose openpipe knownMsvcBug} { # This test may fail on old Unix systems (seen on IRIX64 6.5) with # obsolete gettimeofday() calls. See Tcl Bugs 3530533, 1942197. file delete $path(pipe) @@ -2832,7 +2833,7 @@ test io-29.31 {Tcl_WriteChars, background flush} {stdio openpipe} { set result } ok test io-29.32 {Tcl_WriteChars, background flush to slow reader} \ - {stdio asyncPipeClose openpipe} { + {stdio asyncPipeClose openpipe knownMsvcBug} { # This test may fail on old Unix systems (seen on IRIX64 6.5) with # obsolete gettimeofday() calls. See Tcl Bugs 3530533, 1942197. file delete $path(pipe) diff --git a/tests/stringObj.test b/tests/stringObj.test index 769486a..cc9d123 100644 --- a/tests/stringObj.test +++ b/tests/stringObj.test @@ -439,9 +439,9 @@ test stringObj-13.8 {Tcl_GetCharLength with identity nulls} {testobj testbytestr test stringObj-14.1 {Tcl_SetObjLength on pure unicode object} testobj { teststringobj set 1 foo - teststringobj getunicode 1 + teststringobj maxchars 1 teststringobj append 1 bar -1 - teststringobj getunicode 1 + teststringobj maxchars 1 teststringobj append 1 bar -1 teststringobj setlength 1 0 teststringobj append 1 bar -1 diff --git a/tests/utf.test b/tests/utf.test index dc1a435..f75d19e 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -471,8 +471,8 @@ test utf-25.1 {Tcl_UniCharNcasecmp} -constraints teststringobj \ -body { teststringobj set 1 a teststringobj set 2 b - teststringobj getunicode 1 - teststringobj getunicode 2 + teststringobj maxchars 1 + teststringobj maxchars 2 string compare -nocase [teststringobj get 1] [teststringobj get 2] } \ -cleanup { @@ -486,8 +486,8 @@ test utf-25.2 {Tcl_UniCharNcasecmp} -constraints teststringobj \ -body { teststringobj set 1 b teststringobj set 2 a - teststringobj getunicode 1 - teststringobj getunicode 2 + teststringobj maxchars 1 + teststringobj maxchars 2 string compare -nocase [teststringobj get 1] [teststringobj get 2] } \ -cleanup { @@ -501,8 +501,8 @@ test utf-25.3 {Tcl_UniCharNcasecmp} -constraints teststringobj \ -body { teststringobj set 1 B teststringobj set 2 a - teststringobj getunicode 1 - teststringobj getunicode 2 + teststringobj maxchars 1 + teststringobj maxchars 2 string compare -nocase [teststringobj get 1] [teststringobj get 2] } \ -cleanup { @@ -517,8 +517,8 @@ test utf-25.4 {Tcl_UniCharNcasecmp} -constraints teststringobj \ -body { teststringobj set 1 aBcB teststringobj set 2 abca - teststringobj getunicode 1 - teststringobj getunicode 2 + teststringobj maxchars 1 + teststringobj maxchars 2 string compare -nocase [teststringobj get 1] [teststringobj get 2] } \ -cleanup { |