diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-05-01 20:28:44 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-05-01 20:28:44 (GMT) |
commit | 5ff932037188b0812fe6e2bc53298b36c66c6341 (patch) | |
tree | 2ff6cde0139c9f18d82222a2beb3f35c133da01c | |
parent | 190852002f644f02a6e13c6a7c9017c3f21e1003 (diff) | |
download | tcl-5ff932037188b0812fe6e2bc53298b36c66c6341.zip tcl-5ff932037188b0812fe6e2bc53298b36c66c6341.tar.gz tcl-5ff932037188b0812fe6e2bc53298b36c66c6341.tar.bz2 |
More progress
-rw-r--r-- | generic/tclCmdMZ.c | 6 | ||||
-rw-r--r-- | generic/tclDisassemble.c | 4 | ||||
-rw-r--r-- | generic/tclEncoding.c | 2 | ||||
-rw-r--r-- | generic/tclInt.h | 11 | ||||
-rw-r--r-- | generic/tclStringObj.c | 15 | ||||
-rw-r--r-- | generic/tclStubInit.c | 9 | ||||
-rw-r--r-- | generic/tclUtf.c | 2 | ||||
-rw-r--r-- | tests/utf.test | 4 |
8 files changed, 15 insertions, 38 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 46eae76..00bb418 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -2932,7 +2932,7 @@ StringLowerCmd( const char *start, *end; Tcl_Obj *resultPtr; - length1 = Tcl_NumUtfChars(string1, length1) - 1; + length1 = TclNumUtfChars(string1, length1) - 1; if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) { return TCL_ERROR; } @@ -3017,7 +3017,7 @@ StringUpperCmd( const char *start, *end; Tcl_Obj *resultPtr; - length1 = Tcl_NumUtfChars(string1, length1) - 1; + length1 = TclNumUtfChars(string1, length1) - 1; if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) { return TCL_ERROR; } @@ -3102,7 +3102,7 @@ StringTitleCmd( const char *start, *end; Tcl_Obj *resultPtr; - length1 = Tcl_NumUtfChars(string1, length1) - 1; + length1 = TclNumUtfChars(string1, length1) - 1; if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index 8f041da..1d46203 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -1199,10 +1199,10 @@ DisassembleByteCodeAsDicts( */ Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("scriptfrom", -1), - Tcl_NewWideIntObj(Tcl_NumUtfChars(codePtr->source, + Tcl_NewWideIntObj(TclNumUtfChars(codePtr->source, sourceOffset))); Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("scriptto", -1), - Tcl_NewWideIntObj(Tcl_NumUtfChars(codePtr->source, + Tcl_NewWideIntObj(TclNumUtfChars(codePtr->source, sourceOffset + sourceLength - 1))); Tcl_DictObjPut(NULL, cmd, Tcl_NewStringObj("script", -1), Tcl_NewStringObj(codePtr->source+sourceOffset, sourceLength)); diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 51d6c98..7aaf68b 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1630,7 +1630,7 @@ Tcl_UtfToExternalDStringEx( } else { /* Caller wants error message on failure */ if (result != TCL_OK && interp != NULL) { - int pos = Tcl_NumUtfChars(srcStart, nBytesProcessed); + int pos = TclNumUtfChars(srcStart, nBytesProcessed); int ucs4; char buf[TCL_INTEGER_SPACE]; Tcl_UtfToUniChar(&srcStart[nBytesProcessed], &ucs4); diff --git a/generic/tclInt.h b/generic/tclInt.h index cb2fa20..774a2f0 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3461,17 +3461,6 @@ MODULE_SCOPE void TclAppendUnicodeToObj(Tcl_Obj *, const int *, int); MODULE_SCOPE int TclUniCharNcasecmp(const int *, const int *, unsigned long); MODULE_SCOPE int TclUniCharCaseMatch(const int *, const int *, int); MODULE_SCOPE int TclUniCharNcmp(const int *, const int *, unsigned long); -#undef Tcl_NumUtfChars -#define Tcl_NumUtfChars TclNumUtfChars -#undef Tcl_GetCharLength -#define Tcl_GetCharLength TclGetCharLength -#undef Tcl_UtfAtIndex -#define Tcl_UtfAtIndex TclUtfAtIndex -#undef Tcl_GetRange -#define Tcl_GetRange TclGetRange -#undef Tcl_GetUniChar -#define Tcl_GetUniChar TclGetUniChar - /* * Many parsing tasks need a common definition of whitespace. diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 013015e..148951f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -631,7 +631,6 @@ TclGetCharLength( } #if !defined(TCL_NO_DEPRECATED) -#undef Tcl_GetCharLength int Tcl_GetCharLength( Tcl_Obj *objPtr) /* The String object to get the num chars @@ -664,7 +663,7 @@ Tcl_GetCharLength( (void) Tcl_GetByteArrayFromObj(objPtr, &numChars); } else { Tcl_GetString(objPtr); - numChars = Tcl_NumUtfChars(objPtr->bytes, objPtr->length); + numChars = TclNumUtfChars(objPtr->bytes, objPtr->length); } return numChars; } @@ -731,7 +730,6 @@ TclCheckEmptyString( */ #if !defined(TCL_NO_DEPRECATED) -#undef Tcl_GetUniChar int Tcl_GetUniChar( Tcl_Obj *objPtr, /* The object to get the Unicode charater @@ -983,7 +981,6 @@ TclGetUnicodeFromObj( */ #if !defined(TCL_NO_DEPRECATED) -#undef Tcl_GetRange Tcl_Obj * Tcl_GetRange( Tcl_Obj *objPtr, /* The Tcl object to find the range of. */ @@ -1015,7 +1012,7 @@ Tcl_GetRange( return Tcl_NewByteArrayObj(bytes + first, last - first + 1); } - int numChars = Tcl_NumUtfChars(objPtr->bytes, objPtr->length); + int numChars = TclNumUtfChars(objPtr->bytes, objPtr->length); if (last < 0 || last >= numChars) { last = numChars - 1; @@ -1024,8 +1021,8 @@ Tcl_GetRange( TclNewObj(newObjPtr); return newObjPtr; } - const char *begin = Tcl_UtfAtIndex(objPtr->bytes, first); - const char *end = Tcl_UtfAtIndex(objPtr->bytes, last + 1); + const char *begin = TclUtfAtIndex(objPtr->bytes, first); + const char *end = TclUtfAtIndex(objPtr->bytes, last + 1); return Tcl_NewStringObj(begin, end - begin); } #endif @@ -3935,8 +3932,8 @@ TclStringCmp( if ((reqlength < 0) && !nocase) { memCmpFn = (memCmpFn_t)(void *)TclpUtfNcmp2; } else { - s1len = Tcl_NumUtfChars(s1, s1len); - s2len = Tcl_NumUtfChars(s2, s2len); + s1len = TclNumUtfChars(s1, s1len); + s2len = TclNumUtfChars(s2, s2len); memCmpFn = (memCmpFn_t)(void *) (nocase ? Tcl_UtfNcasecmp : Tcl_UtfNcmp); } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index c98b37e..cf130c3 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -48,8 +48,6 @@ #undef Tcl_UniCharCaseMatch #undef Tcl_UniCharLen #undef Tcl_UniCharNcmp -#undef Tcl_GetRange -#undef Tcl_GetUniChar #undef Tcl_DumpActiveMemory #undef Tcl_ValidateAllMemory #undef Tcl_FindHashEntry @@ -78,11 +76,6 @@ #undef Tcl_MacOSXOpenBundleResources #undef TclWinConvertWSAError #undef TclWinConvertError -#undef Tcl_NumUtfChars -#undef Tcl_GetCharLength -#undef Tcl_UtfAtIndex -#undef Tcl_GetRange -#undef Tcl_GetUniChar #undef TclObjInterpProc #if defined(_WIN32) || defined(__CYGWIN__) @@ -97,7 +90,7 @@ static void uniCodePanic(void) { } # define Tcl_GetUnicode (unsigned short *(*)(Tcl_Obj *))(void *)uniCodePanic # define Tcl_GetUnicodeFromObj (unsigned short *(*)(Tcl_Obj *, int *))(void *)uniCodePanic -# define TclGetUnicodeFromObj (unsigned short *(*)(Tcl_Obj *, ptrdiff_t *))(void *)uniCodePanic +# define TclGetUnicodeFromObj (unsigned short *(*)(Tcl_Obj *, void *))(void *)uniCodePanic # define Tcl_NewUnicodeObj (Tcl_Obj *(*)(const unsigned short *, int))(void *)uniCodePanic # define Tcl_SetUnicodeObj (void(*)(Tcl_Obj *, const unsigned short *, int))(void *)uniCodePanic # define Tcl_AppendUnicodeToObj (void(*)(Tcl_Obj *, const unsigned short *, int))(void *)uniCodePanic diff --git a/generic/tclUtf.c b/generic/tclUtf.c index e3ee84a..1ac7475 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -850,7 +850,6 @@ TclNumUtfChars( } #if !defined(TCL_NO_DEPRECATED) -#undef Tcl_NumUtfChars int Tcl_NumUtfChars( const char *src, /* The UTF-8 string to measure. */ @@ -1232,7 +1231,6 @@ TclUtfAtIndex( } #if !defined(TCL_NO_DEPRECATED) -#undef Tcl_UtfAtIndex const char * Tcl_UtfAtIndex( const char *src, /* The UTF-8 string. */ diff --git a/tests/utf.test b/tests/utf.test index fec469b..d86c8dc 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -164,9 +164,9 @@ test utf-4.10 {Tcl_NumUtfChars: #x00, calc len, overcomplete} {testnumutfchars t test utf-4.11 {Tcl_NumUtfChars: 3 bytes of 4-byte UTF-8 characater} {testnumutfchars testbytestring} { testnumutfchars [testbytestring \xF0\x9F\x92\xA9] end-1 } 3 -test utf-4.12 {Tcl_NumUtfChars: #4-byte UTF-8 character} {testnumutfchars testbytestring} { +test utf-4.12 {Tcl_NumUtfChars: #4-byte UTF-8 character} {testnumutfchars testbytestring deprecated} { testnumutfchars [testbytestring \xF0\x9F\x92\xA9] end -} 1 +} 2 test utf-4.13 {Tcl_NumUtfChars: end of string} {testnumutfchars testbytestring} { testnumutfchars foobar[testbytestring \xF2\xC2\xA0] end } 8 |