diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-03-14 08:32:07 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-03-14 08:32:07 (GMT) |
commit | fa083c8aaf7ff3d22de606e25adb0b598dba0dd6 (patch) | |
tree | 51134cd671ebf8759cc2b4ff148cd7d9d3797725 | |
parent | 6eb17d212faf798cf9cd89c85467d8f8893ca614 (diff) | |
download | tk-fa083c8aaf7ff3d22de606e25adb0b598dba0dd6.zip tk-fa083c8aaf7ff3d22de606e25adb0b598dba0dd6.tar.gz tk-fa083c8aaf7ff3d22de606e25adb0b598dba0dd6.tar.bz2 |
Better approach, using "Tk" prefix for UTF-32 versions of API
-rw-r--r-- | generic/tkCanvText.c | 12 | ||||
-rw-r--r-- | generic/tkEntry.c | 14 | ||||
-rw-r--r-- | generic/tkFont.c | 20 | ||||
-rw-r--r-- | generic/tkIcu.c | 2 | ||||
-rw-r--r-- | generic/tkInt.h | 29 | ||||
-rw-r--r-- | generic/tkMessage.c | 4 | ||||
-rw-r--r-- | generic/tkSelect.c | 6 | ||||
-rw-r--r-- | generic/tkText.c | 18 | ||||
-rw-r--r-- | generic/tkTextIndex.c | 13 | ||||
-rw-r--r-- | generic/ttk/ttkEntry.c | 24 | ||||
-rw-r--r-- | macosx/tkMacOSXFont.c | 14 | ||||
-rw-r--r-- | unix/tkUnixMenu.c | 4 | ||||
-rw-r--r-- | win/tkWinMenu.c | 10 |
13 files changed, 76 insertions, 94 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 8e85946..3f02158 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -594,7 +594,7 @@ ConfigureText( */ textPtr->numBytes = strlen(textPtr->text); - textPtr->numChars = Tcl_NumUtfChars(textPtr->text, textPtr->numBytes); + textPtr->numChars = TkNumUtfChars(textPtr->text, textPtr->numBytes); if (textInfoPtr->selItemPtr == itemPtr) { if (textInfoPtr->selectFirst >= textPtr->numChars) { @@ -1119,7 +1119,7 @@ TextInsert( ckfree(text); textPtr->text = newStr; - charsAdded = Tcl_NumUtfChars(string, byteCount); + charsAdded = TkNumUtfChars(string, byteCount); textPtr->numChars += charsAdded; textPtr->numBytes += byteCount; @@ -1189,8 +1189,8 @@ TextDeleteChars( } charsRemoved = last + 1 - first; - byteIndex = Tcl_UtfAtIndex(text, first) - text; - byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved) + byteIndex = TkUtfAtIndex(text, first) - text; + byteCount = TkUtfAtIndex(text + byteIndex, charsRemoved) - (text + byteIndex); newStr = (char *)ckalloc(textPtr->numBytes + 1 - byteCount); @@ -1612,8 +1612,8 @@ GetSelText( return 0; } text = textPtr->text; - selStart = Tcl_UtfAtIndex(text, textInfoPtr->selectFirst); - selEnd = Tcl_UtfAtIndex(selStart, + selStart = TkUtfAtIndex(text, textInfoPtr->selectFirst); + selEnd = TkUtfAtIndex(selStart, textInfoPtr->selectLast + 1 - textInfoPtr->selectFirst); if (selEnd <= selStart + offset) { return 0; diff --git a/generic/tkEntry.c b/generic/tkEntry.c index dfb2ce2..404836c 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -2164,7 +2164,7 @@ InsertChars( char *newStr; string = entryPtr->string; - byteIndex = Tcl_UtfAtIndex(string, index) - string; + byteIndex = TkUtfAtIndex(string, index) - string; byteCount = strlen(value); if (byteCount == 0) { return TCL_OK; @@ -2197,7 +2197,7 @@ InsertChars( */ oldChars = entryPtr->numChars; - entryPtr->numChars = Tcl_NumUtfChars(newStr, TCL_INDEX_NONE); + entryPtr->numChars = TkNumUtfChars(newStr, TCL_INDEX_NONE); charsAdded = entryPtr->numChars - oldChars; entryPtr->numBytes += byteCount; @@ -2268,8 +2268,8 @@ DeleteChars( } string = entryPtr->string; - byteIndex = Tcl_UtfAtIndex(string, index) - string; - byteCount = Tcl_UtfAtIndex(string + byteIndex, count) - (string+byteIndex); + byteIndex = TkUtfAtIndex(string, index) - string; + byteCount = TkUtfAtIndex(string + byteIndex, count) - (string+byteIndex); newByteCount = entryPtr->numBytes + 1 - byteCount; newStr = (char *)ckalloc(newByteCount); @@ -2497,7 +2497,7 @@ EntrySetValue( entryPtr->string = tmp; } entryPtr->numBytes = valueLen; - entryPtr->numChars = Tcl_NumUtfChars(value, valueLen); + entryPtr->numChars = TkNumUtfChars(value, valueLen); if (entryPtr->displayString == oldSource) { entryPtr->displayString = entryPtr->string; @@ -2927,8 +2927,8 @@ EntryFetchSelection( return -1; } string = entryPtr->displayString; - selStart = Tcl_UtfAtIndex(string, entryPtr->selectFirst); - selEnd = Tcl_UtfAtIndex(selStart, + selStart = TkUtfAtIndex(string, entryPtr->selectFirst); + selEnd = TkUtfAtIndex(selStart, entryPtr->selectLast - entryPtr->selectFirst); if (selEnd <= selStart + offset) { return 0; diff --git a/generic/tkFont.c b/generic/tkFont.c index 0f77a91..840d9b6 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -2013,7 +2013,7 @@ Tk_ComputeTextLayout( height = fmPtr->ascent + fmPtr->descent; if (numChars < 0) { - numChars = Tcl_NumUtfChars(string, TCL_INDEX_NONE); + numChars = TkNumUtfChars(string, TCL_INDEX_NONE); } if (wrapLength == 0) { wrapLength = -1; @@ -2036,7 +2036,7 @@ Tk_ComputeTextLayout( curX = 0; - endp = Tcl_UtfAtIndex(string, numChars); + endp = TkUtfAtIndex(string, numChars); special = string; flags &= TK_IGNORE_TABS | TK_IGNORE_NEWLINES; @@ -2153,7 +2153,7 @@ Tk_ComputeTextLayout( bytesThisChunk = Tk_MeasureChars(tkfont, end, bytesThisChunk, -1, 0, &chunkPtr->totalWidth); chunkPtr->numBytes += bytesThisChunk; - chunkPtr->numChars += Tcl_NumUtfChars(end, bytesThisChunk); + chunkPtr->numChars += TkNumUtfChars(end, bytesThisChunk); chunkPtr->totalWidth += curX; } } @@ -2345,14 +2345,14 @@ Tk_DrawTextLayout( firstChar = 0; firstByte = chunkPtr->start; } else { - firstByte = Tcl_UtfAtIndex(chunkPtr->start, firstChar); + firstByte = TkUtfAtIndex(chunkPtr->start, firstChar); Tk_MeasureChars(layoutPtr->tkfont, chunkPtr->start, firstByte - chunkPtr->start, -1, 0, &drawX); } if (lastChar < numDisplayChars) { numDisplayChars = lastChar; } - lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars); + lastByte = TkUtfAtIndex(chunkPtr->start, numDisplayChars); #ifdef TK_DRAW_IN_CONTEXT TkpDrawCharsInContext(display, drawable, gc, layoutPtr->tkfont, chunkPtr->start, chunkPtr->numBytes, @@ -2415,14 +2415,14 @@ TkDrawAngledTextLayout( firstChar = 0; firstByte = chunkPtr->start; } else { - firstByte = Tcl_UtfAtIndex(chunkPtr->start, firstChar); + firstByte = TkUtfAtIndex(chunkPtr->start, firstChar); Tk_MeasureChars(layoutPtr->tkfont, chunkPtr->start, firstByte - chunkPtr->start, -1, 0, &drawX); } if (lastChar < numDisplayChars) { numDisplayChars = lastChar; } - lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars); + lastByte = TkUtfAtIndex(chunkPtr->start, numDisplayChars); #ifdef TK_DRAW_IN_CONTEXT dx = cosA * (chunkPtr->x) + sinA * (chunkPtr->y); dy = -sinA * (chunkPtr->x) + cosA * (chunkPtr->y); @@ -2675,7 +2675,7 @@ Tk_PointToChar( } n = Tk_MeasureChars((Tk_Font) fontPtr, chunkPtr->start, chunkPtr->numBytes, x - chunkPtr->x, 0, &dummy); - return numChars + Tcl_NumUtfChars(chunkPtr->start, n); + return numChars + TkNumUtfChars(chunkPtr->start, n); } numChars += chunkPtr->numChars; lastPtr = chunkPtr; @@ -2784,7 +2784,7 @@ Tk_CharBbox( goto check; } } else if (index < chunkPtr->numChars) { - end = Tcl_UtfAtIndex(chunkPtr->start, index); + end = TkUtfAtIndex(chunkPtr->start, index); if (xPtr != NULL) { Tk_MeasureChars(tkfont, chunkPtr->start, end - chunkPtr->start, -1, 0, &x); @@ -3859,7 +3859,7 @@ NewChunk( *layoutPtrPtr = layoutPtr; *maxPtr = maxChunks; } - numChars = Tcl_NumUtfChars(start, numBytes); + numChars = TkNumUtfChars(start, numBytes); chunkPtr = &layoutPtr->chunks[layoutPtr->numChunks]; chunkPtr->start = start; chunkPtr->numBytes = numBytes; diff --git a/generic/tkIcu.c b/generic/tkIcu.c index c11f78a..257003c 100644 --- a/generic/tkIcu.c +++ b/generic/tkIcu.c @@ -92,7 +92,7 @@ startEndOfCmd( str = Tcl_GetStringFromObj(objv[1], &len); Tcl_UtfToChar16DString(str, len, &ds); len = Tcl_DStringLength(&ds)/2; - Tcl_Size ulen = Tcl_GetCharLength(objv[1]); + Tcl_Size ulen = TkGetCharLength(objv[1]); if (TkGetIntForIndex(objv[2], ulen-1, 0, &idx) != TCL_OK) { Tcl_DStringFree(&ds); Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\": must be integer?[+-]integer?, end?[+-]integer?, or \"\"", Tcl_GetString(objv[2]))); diff --git a/generic/tkInt.h b/generic/tkInt.h index 8df2375..b96edba 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -83,34 +83,19 @@ # define TCL_COMBINE 0 #endif -#undef TclNumUtfChars -#undef TclUtfAtIndex -#undef Tcl_NumUtfChars -#undef Tcl_GetCharLength -#undef Tcl_UtfAtIndex +/* Make available UTF-32 versions of the API, even though we compile with TCL_UTF_MAX=3 */ #if TCL_MAJOR_VERSION > 8 -# define TclNumUtfChars \ - (tclStubsPtr->tclNumUtfChars) /* 312 */ -# define TclUtfAtIndex \ - (tclStubsPtr->tclUtfAtIndex) /* 325 */ -# define Tcl_NumUtfChars \ - (tclStubsPtr->tcl_NumUtfChars) /* 669 */ -# define Tcl_GetCharLength \ - (tclStubsPtr->tcl_GetCharLength) /* 670 */ -# define Tcl_UtfAtIndex \ - (tclStubsPtr->tcl_UtfAtIndex) /* 671 */ +# define TkNumUtfChars (tclStubsPtr->tcl_NumUtfChars) /* 669 */ +# define TkGetCharLength (tclStubsPtr->tcl_GetCharLength) /* 670 */ +# define TkUtfAtIndex (tclStubsPtr->tcl_UtfAtIndex) /* 671 */ #else -# define TclNumUtfChars \ - (tclStubsPtr->tcl_NumUtfChars) /* 312 */ -# define TclUtfAtIndex \ - (tclStubsPtr->tcl_UtfAtIndex) /* 325 */ -# define Tcl_NumUtfChars (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ +# define TkNumUtfChars (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ ((Tcl_Size (*)(const char *, Tcl_Size))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[669])) \ : (tclStubsPtr->tcl_NumUtfChars) /* 312 */) -# define Tcl_GetCharLength (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ +# define TkGetCharLength (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ ((Tcl_Size (*)(Tcl_Obj *))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[670])) \ : (tclStubsPtr->tcl_GetCharLength) /* 380 */) -# define Tcl_UtfAtIndex (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ +# define TkUtfAtIndex (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ ((const char *(*)(const char *, Tcl_Size))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[671])) \ : (tclStubsPtr->tcl_UtfAtIndex) /* 325 */) #endif diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 0f70b41..fd36e62 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -501,7 +501,7 @@ ConfigureMessage( * be specified to Tk_ConfigureWidget. */ - msgPtr->numChars = Tcl_NumUtfChars(msgPtr->string, TCL_INDEX_NONE); + msgPtr->numChars = TkNumUtfChars(msgPtr->string, TCL_INDEX_NONE); if (msgPtr->highlightWidth < 0) { msgPtr->highlightWidth = 0; @@ -902,7 +902,7 @@ MessageTextVarProc( if (msgPtr->string != NULL) { ckfree(msgPtr->string); } - msgPtr->numChars = Tcl_NumUtfChars(value, TCL_INDEX_NONE); + msgPtr->numChars = TkNumUtfChars(value, TCL_INDEX_NONE); msgPtr->string = (char *)ckalloc(strlen(value) + 1); strcpy(msgPtr->string, value); ComputeMessageGeometry(msgPtr); diff --git a/generic/tkSelect.c b/generic/tkSelect.c index ef15a7e..9a36b5b 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -1401,15 +1401,15 @@ HandleTclCommand( if (cmdInfoPtr->interp != NULL) { if (length <= maxBytes) { - cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, TCL_INDEX_NONE); + cmdInfoPtr->charOffset += TkNumUtfChars(string, TCL_INDEX_NONE); cmdInfoPtr->buffer[0] = '\0'; } else { - Tcl_UniChar ch = 0; + int ch = 0; p = string; string += count; numChars = 0; while (p < string) { - p += Tcl_UtfToUniChar(p, &ch); + p += TkUtfToUniChar(p, &ch); numChars++; } cmdInfoPtr->charOffset += numChars; diff --git a/generic/tkText.c b/generic/tkText.c index 8e6c9c1..b186e18 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -1461,7 +1461,7 @@ TextWidgetObjCmd( insertLength = 0; for (j = 4; j < objc; j += 2) { - insertLength += Tcl_GetCharLength(objv[j]); + insertLength += TkGetCharLength(objv[j]); } /* @@ -4092,12 +4092,12 @@ TextSearchIndexInLine( if (searchSpecPtr->exact) { index += leftToScan; } else { - index += Tcl_NumUtfChars(segPtr->body.chars, leftToScan); + index += TkNumUtfChars(segPtr->body.chars, leftToScan); } } else if (searchSpecPtr->exact) { index += segPtr->size; } else { - index += Tcl_NumUtfChars(segPtr->body.chars, -1); + index += TkNumUtfChars(segPtr->body.chars, -1); } } leftToScan -= segPtr->size; @@ -4222,7 +4222,7 @@ TextSearchAddNextLine( Tcl_GetString(theLine); *lenPtr = theLine->length; } else { - *lenPtr = Tcl_GetCharLength(theLine); + *lenPtr = TkGetCharLength(theLine); } } return linePtr; @@ -4292,7 +4292,7 @@ TextSearchFoundMatch( if (searchSpecPtr->exact) { const char *startOfLine = Tcl_GetString(theLine); - numChars = Tcl_NumUtfChars(startOfLine + matchOffset, matchLength); + numChars = TkNumUtfChars(startOfLine + matchOffset, matchLength); } else { numChars = matchLength; } @@ -4351,13 +4351,13 @@ TextSearchFoundMatch( if (searchSpecPtr->exact) { matchOffset += segPtr->size; } else { - matchOffset += Tcl_NumUtfChars(segPtr->body.chars, -1); + matchOffset += TkNumUtfChars(segPtr->body.chars, -1); } } else { if (searchSpecPtr->exact) { leftToScan -= (int)segPtr->size; } else { - leftToScan -= Tcl_NumUtfChars(segPtr->body.chars, -1); + leftToScan -= TkNumUtfChars(segPtr->body.chars, -1); } } curIndex.byteIndex += segPtr->size; @@ -4442,13 +4442,13 @@ TextSearchFoundMatch( continue; } else if (!searchSpecPtr->searchElide && TkTextIsElided(textPtr, &curIndex, NULL)) { - numChars += Tcl_NumUtfChars(segPtr->body.chars, -1); + numChars += TkNumUtfChars(segPtr->body.chars, -1); continue; } if (searchSpecPtr->exact) { leftToScan -= segPtr->size; } else { - leftToScan -= Tcl_NumUtfChars(segPtr->body.chars, -1); + leftToScan -= TkNumUtfChars(segPtr->body.chars, -1); } } diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 31a95a7..c62a198 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -494,7 +494,7 @@ TkTextMakeCharIndex( TkTextSegment *segPtr; char *p, *start, *end; int index, offset; - Tcl_UniChar ch = 0; + int ch = 0; indexPtr->tree = tree; if (lineIndex < 0) { @@ -541,7 +541,7 @@ TkTextMakeCharIndex( return indexPtr; } charIndex--; - offset = Tcl_UtfToUniChar(p, &ch); + offset = TkUtfToUniChar(p, &ch); index += offset; } } else { @@ -1129,7 +1129,7 @@ TkTextPrintIndex( break; } if (segPtr->typePtr == &tkTextCharType) { - charIndex += Tcl_NumUtfChars(segPtr->body.chars, segPtr->size); + charIndex += TkNumUtfChars(segPtr->body.chars, segPtr->size); } else { charIndex += segPtr->size; } @@ -1137,7 +1137,7 @@ TkTextPrintIndex( } if (segPtr->typePtr == &tkTextCharType) { - charIndex += Tcl_NumUtfChars(segPtr->body.chars, numBytes); + charIndex += TkNumUtfChars(segPtr->body.chars, numBytes); } else { charIndex += numBytes; } @@ -1948,7 +1948,7 @@ TkTextIndexCount( } count += byteLen - i; if (i) { - count += Tcl_NumUtfChars(segPtr->body.chars + byteOffset + count += TkNumUtfChars(segPtr->body.chars + byteOffset + (byteLen - i), i); } } else { @@ -2210,9 +2210,6 @@ TkTextIndexBackChars( if (p == start) { break; } - if ((sizeof(Tcl_UniChar) == 2) && (unsigned)(UCHAR(*p) - 0xF0) <= 5) { - charCount--; /* Characters > U+FFFF count as 2 here */ - } if (charCount != 0) { charCount--; } diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 756e41c..25add27 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -369,8 +369,8 @@ EntryFetchSelection( } string = entryPtr->entry.displayString; - selStart = Tcl_UtfAtIndex(string, entryPtr->entry.selectFirst); - selEnd = Tcl_UtfAtIndex(selStart, + selStart = TkUtfAtIndex(string, entryPtr->entry.selectFirst); + selEnd = TkUtfAtIndex(selStart, entryPtr->entry.selectLast - entryPtr->entry.selectFirst); if (selEnd <= selStart + offset) { return 0; @@ -488,11 +488,11 @@ ExpandPercents( break; case 'S': /* string to be inserted/deleted, if any */ if (reason == VALIDATE_INSERT) { - string = Tcl_UtfAtIndex(newValue, index); - stringLength = Tcl_UtfAtIndex(string, count) - string; + string = TkUtfAtIndex(newValue, index); + stringLength = TkUtfAtIndex(string, count) - string; } else if (reason == VALIDATE_DELETE) { - string = Tcl_UtfAtIndex(entryPtr->entry.string, index); - stringLength = Tcl_UtfAtIndex(string, count) - string; + string = TkUtfAtIndex(entryPtr->entry.string, index); + stringLength = TkUtfAtIndex(string, count) - string; } else { string = ""; stringLength = 0; @@ -740,7 +740,7 @@ static void EntryStoreValue(Entry *entryPtr, const char *value) { size_t numBytes = strlen(value); - Tcl_Size numChars = Tcl_NumUtfChars(value, numBytes); + Tcl_Size numChars = TkNumUtfChars(value, numBytes); if (entryPtr->core.flags & VALIDATING) entryPtr->core.flags |= VALIDATION_SET_VALUE; @@ -845,9 +845,9 @@ InsertChars( const char *value) /* New characters to add */ { char *string = entryPtr->entry.string; - size_t byteIndex = Tcl_UtfAtIndex(string, index) - string; + size_t byteIndex = TkUtfAtIndex(string, index) - string; size_t byteCount = strlen(value); - int charsAdded = Tcl_NumUtfChars(value, byteCount); + int charsAdded = TkNumUtfChars(value, byteCount); size_t newByteCount = entryPtr->entry.numBytes + byteCount + 1; char *newBytes; int code; @@ -899,8 +899,8 @@ DeleteChars( return TCL_OK; } - byteIndex = Tcl_UtfAtIndex(string, index) - string; - byteCount = Tcl_UtfAtIndex(string+byteIndex, count) - (string+byteIndex); + byteIndex = TkUtfAtIndex(string, index) - string; + byteCount = TkUtfAtIndex(string+byteIndex, count) - (string+byteIndex); newByteCount = entryPtr->entry.numBytes + 1 - byteCount; newBytes = (char *)ckalloc(newByteCount); @@ -1314,7 +1314,7 @@ static void EntryDisplay(void *clientData, Drawable d) if ((*(entryPtr->entry.displayString) == '\0') && (entryPtr->entry.placeholderObj != NULL)) { /* No text displayed, but -placeholder is given */ - if (Tcl_GetCharLength(es.placeholderForegroundObj) > 0) { + if (TkGetCharLength(es.placeholderForegroundObj) > 0) { foregroundObj = es.placeholderForegroundObj; } else { foregroundObj = es.foregroundObj; diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 32a4855..e39d7c0 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -460,7 +460,7 @@ startOfClusterObjCmd( if (stringArg == NULL) { return TCL_ERROR; } - Tcl_Size ulen = Tcl_GetCharLength(objv[1]); + Tcl_Size ulen = TkGetCharLength(objv[1]); S = [[TKNSString alloc] initWithTclUtfBytes:stringArg length:len]; len = [S length]; if (TkGetIntForIndex(objv[2], ulen - 1, 0, &idx) != TCL_OK) { @@ -517,7 +517,7 @@ endOfClusterObjCmd( if (stringArg == NULL) { return TCL_ERROR; } - Tcl_Size ulen = Tcl_GetCharLength(objv[1]); + Tcl_Size ulen = TkGetCharLength(objv[1]); S = [[TKNSString alloc] initWithTclUtfBytes:stringArg length:len]; len = [S length]; if (TkGetIntForIndex(objv[2], ulen - 1, 0, &idx) != TCL_OK) { @@ -1066,8 +1066,8 @@ TkpMeasureCharsInContext( attributes:fontPtr->nsAttributes]; typesetter = CTTypesetterCreateWithAttributedString( (CFAttributedStringRef)attributedString); - start = TclNumUtfChars(source, rangeStart); - len = TclNumUtfChars(source + rangeStart, rangeLength); + start = Tcl_NumUtfChars(source, rangeStart); + len = Tcl_NumUtfChars(source + rangeStart, rangeLength); if (start > 0) { range.length = start; line = CTTypesetterCreateLine(typesetter, range); @@ -1168,7 +1168,7 @@ TkpMeasureCharsInContext( [attributedString release]; [string release]; length = ceil(width - offset); - fit = (TclUtfAtIndex(source, index) - source) - rangeStart; + fit = (Tcl_UtfAtIndex(source, index) - source) - rangeStart; done: #ifdef TK_MAC_DEBUG_FONTS TkMacOSXDbgMsg("measure: source=\"%s\" range=\"%.*s\" maxLength=%d " @@ -1367,8 +1367,8 @@ TkpDrawAngledCharsInContext( -textX, -textY); } CGContextConcatCTM(context, t); - start = TclNumUtfChars(source, rangeStart); - length = TclNumUtfChars(source, rangeStart + rangeLength) - start; + start = Tcl_NumUtfChars(source, rangeStart); + length = Tcl_NumUtfChars(source, rangeStart + rangeLength) - start; line = CTTypesetterCreateLine(typesetter, CFRangeMake(start, length)); if (start > 0) { diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index 4ae343c..08d45b0 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -860,13 +860,13 @@ DrawMenuUnderline( if (mePtr->labelPtr != NULL) { int len; - len = Tcl_GetCharLength(mePtr->labelPtr); + len = TkGetCharLength(mePtr->labelPtr); if (mePtr->underline < len && mePtr->underline >= -len) { int activeBorderWidth, leftEdge, ch; const char *label, *start, *end; label = Tcl_GetString(mePtr->labelPtr); - start = Tcl_UtfAtIndex(label, (mePtr->underline < 0) ? mePtr->underline + len : mePtr->underline); + start = TkUtfAtIndex(label, (mePtr->underline < 0) ? mePtr->underline + len : mePtr->underline); end = start + TkUtfToUniChar(start, &ch); Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index c102e14..0175514 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -509,7 +509,7 @@ GetEntryText( : Tcl_GetString(mePtr->accelPtr); const char *p, *next; Tcl_DString itemString; - Tcl_UniChar ch = 0; + int ch = 0; /* * We have to construct the string with an ampersand preceeding the @@ -526,7 +526,7 @@ GetEntryText( if (*p == '&') { Tcl_DStringAppend(&itemString, "&", 1); } - next = p + Tcl_UtfToUniChar(p, &ch); + next = p + TkUtfToUniChar(p, &ch); Tcl_DStringAppend(&itemString, p, (int) (next - p)); } ch = 0; @@ -536,7 +536,7 @@ GetEntryText( if (*p == '&') { Tcl_DStringAppend(&itemString, "&", 1); } - next = p + Tcl_UtfToUniChar(p, &ch); + next = p + TkUtfToUniChar(p, &ch); Tcl_DStringAppend(&itemString, p, (int) (next - p)); } } @@ -2102,13 +2102,13 @@ DrawMenuUnderline( if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; - len = Tcl_GetCharLength(mePtr->labelPtr); + len = TkGetCharLength(mePtr->labelPtr); if (mePtr->underline < len) { const char *label, *start, *end; int ch; label = Tcl_GetString(mePtr->labelPtr); - start = Tcl_UtfAtIndex(label, mePtr->underline); + start = TkUtfAtIndex(label, mePtr->underline); end = start + TkUtfToUniChar(start, &ch); Tk_UnderlineChars(menuPtr->display, d, gc, tkfont, label, x + mePtr->indicatorSpace, |