diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-12-11 08:49:10 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-12-11 08:49:10 (GMT) |
commit | 93c2250b76cfde6cbc1f1401ce8ddbd3a2897399 (patch) | |
tree | 7eaf719658cc851ca8f0e2903fd64fad1d4f6948 /generic | |
parent | 0cbbe5eeb5a312da166ebe21b7800fb47353621b (diff) | |
download | tk-93c2250b76cfde6cbc1f1401ce8ddbd3a2897399.zip tk-93c2250b76cfde6cbc1f1401ce8ddbd3a2897399.tar.gz tk-93c2250b76cfde6cbc1f1401ce8ddbd3a2897399.tar.bz2 |
After TIP #481 reaches Tcl9.0, TkGetStringFromObj() becomes obsolete. This commit shows how.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkCanvLine.c | 2 | ||||
-rw-r--r-- | generic/tkCanvPoly.c | 2 | ||||
-rw-r--r-- | generic/tkCanvText.c | 4 | ||||
-rw-r--r-- | generic/tkCanvas.c | 2 | ||||
-rw-r--r-- | generic/tkClipboard.c | 2 | ||||
-rw-r--r-- | generic/tkCmds.c | 2 | ||||
-rw-r--r-- | generic/tkConfig.c | 2 | ||||
-rw-r--r-- | generic/tkEntry.c | 4 | ||||
-rw-r--r-- | generic/tkFileFilter.c | 6 | ||||
-rw-r--r-- | generic/tkFont.c | 4 | ||||
-rw-r--r-- | generic/tkFrame.c | 4 | ||||
-rw-r--r-- | generic/tkGrab.c | 2 | ||||
-rw-r--r-- | generic/tkGrid.c | 2 | ||||
-rw-r--r-- | generic/tkImgGIF.c | 4 | ||||
-rw-r--r-- | generic/tkImgListFormat.c | 2 | ||||
-rw-r--r-- | generic/tkImgPNG.c | 14 | ||||
-rw-r--r-- | generic/tkImgPPM.c | 2 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 10 | ||||
-rw-r--r-- | generic/tkImgSVGnano.c | 14 | ||||
-rw-r--r-- | generic/tkInt.h | 11 | ||||
-rw-r--r-- | generic/tkListbox.c | 12 | ||||
-rw-r--r-- | generic/tkMenu.c | 4 | ||||
-rw-r--r-- | generic/tkPack.c | 2 | ||||
-rw-r--r-- | generic/tkScrollbar.c | 2 | ||||
-rw-r--r-- | generic/tkSelect.c | 2 | ||||
-rw-r--r-- | generic/tkText.c | 12 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 2 | ||||
-rw-r--r-- | generic/tkTextMark.c | 4 | ||||
-rw-r--r-- | generic/tkTextTag.c | 2 | ||||
-rw-r--r-- | generic/tkUtil.c | 17 | ||||
-rw-r--r-- | generic/tkWindow.c | 2 | ||||
-rw-r--r-- | generic/ttk/ttkEntry.c | 6 |
32 files changed, 69 insertions, 93 deletions
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index eab1813..e7e8904 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -1760,7 +1760,7 @@ GetLineIndex( return TCL_OK; } - string = TkGetStringFromObj(obj, &length); + string = Tcl_GetStringFromObj(obj, &length); if (string[0] == '@') { int i; diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index cafd7ae..1620914 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -1690,7 +1690,7 @@ GetPolygonIndex( return TCL_OK; } - string = TkGetStringFromObj(obj, &length); + string = Tcl_GetStringFromObj(obj, &length); if (string[0] == '@') { int i; diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 873c2eb..3f4a3a9 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -1020,7 +1020,7 @@ TextInsert( const char *string; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; - string = TkGetStringFromObj(obj, &byteCount); + string = Tcl_GetStringFromObj(obj, &byteCount); text = textPtr->text; @@ -1399,7 +1399,7 @@ GetTextIndex( return TCL_OK; } - string = TkGetStringFromObj(obj, &length); + string = Tcl_GetStringFromObj(obj, &length); c = string[0]; if ((c == 'i') diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 125c762..a8b9734 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -1257,7 +1257,7 @@ CanvasWidgetCmd( result = TCL_ERROR; goto done; } - arg = TkGetStringFromObj(objv[2], &length); + arg = Tcl_GetStringFromObj(objv[2], &length); c = arg[0]; /* diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index 89e8df3..a972230 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -454,7 +454,7 @@ Tk_ClipboardObjCmd( TkSizeT length; for (i = 2; i < objc - 1; i++) { - string = TkGetStringFromObj(objv[i], &length); + string = Tcl_GetStringFromObj(objv[i], &length); if (string[0] != '-') { break; } diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 2b02f93..e57f21e 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -1862,7 +1862,7 @@ TkGetDisplayOf( if (objc < 1) { return 0; } - string = TkGetStringFromObj(objv[0], &length); + string = Tcl_GetStringFromObj(objv[0], &length); if ((length >= 2) && (strncmp(string, "-displayof", length) == 0)) { if (objc < 2) { diff --git a/generic/tkConfig.c b/generic/tkConfig.c index b590ab9..a3ccb50 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -663,7 +663,7 @@ DoObjConfig( } if (internalPtr != NULL) { if (valuePtr != NULL) { - value = TkGetStringFromObj(valuePtr, &length); + value = Tcl_GetStringFromObj(valuePtr, &length); newStr = (char *)ckalloc(length + 1); strcpy(newStr, value); } else { diff --git a/generic/tkEntry.c b/generic/tkEntry.c index e3a6048..0e7f87c 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -2690,7 +2690,7 @@ GetEntryIndex( return TCL_OK; } - string = TkGetStringFromObj(indexObj, &length); + string = Tcl_GetStringFromObj(indexObj, &length); switch (string[0]) { case 'a': @@ -4433,7 +4433,7 @@ SpinboxInvoke( Tcl_ListObjGetElements(interp, sbPtr->listObj, &listc, &listv); for (i = 0; i < listc; i++) { - bytes = TkGetStringFromObj(listv[i], &elemLen); + bytes = Tcl_GetStringFromObj(listv[i], &elemLen); if ((length == elemLen) && (memcmp(bytes, entryPtr->string, length) == 0)) { diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c index 32f6d06..8a84f8e 100644 --- a/generic/tkFileFilter.c +++ b/generic/tkFileFilter.c @@ -263,7 +263,7 @@ AddClause( for (i=0; i<ostypeCount; i++) { TkSizeT len; - const char *strType = TkGetStringFromObj(ostypeList[i], &len); + const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len); /* * If len is < 4, it is definitely an error. If equal or longer, @@ -323,7 +323,7 @@ AddClause( for (i=0; i<globCount; i++) { GlobPattern *globPtr = (GlobPattern *)ckalloc(sizeof(GlobPattern)); TkSizeT len; - const char *str = TkGetStringFromObj(globList[i], &len); + const char *str = Tcl_GetStringFromObj(globList[i], &len); len = (len + 1) * sizeof(char); if (str[0] && str[0] != '*') { @@ -377,7 +377,7 @@ AddClause( Tcl_DString osTypeDS; TkSizeT len; MacFileType *mfPtr = (MacFileType *)ckalloc(sizeof(MacFileType)); - const char *strType = TkGetStringFromObj(ostypeList[i], &len); + const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len); char *string; /* diff --git a/generic/tkFont.c b/generic/tkFont.c index 2838e22..6664cbb 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -733,7 +733,7 @@ Tk_FontObjCmd( if (tkfont == NULL) { return TCL_ERROR; } - string = TkGetStringFromObj(objv[3 + skip], &length); + string = Tcl_GetStringFromObj(objv[3 + skip], &length); Tcl_SetObjResult(interp, Tcl_NewWideIntObj( Tk_TextWidth(tkfont, string, length))); Tk_FreeFont(tkfont); @@ -3344,7 +3344,7 @@ Tk_TextLayoutToPostscript( sprintf(uindex, "%04X", ch); /* endianness? */ glyphname = Tcl_GetVar2(interp, "::tk::psglyphs", uindex, 0); if (glyphname) { - ps = TkGetStringFromObj(psObj, &len); + ps = Tcl_GetStringFromObj(psObj, &len); if (ps[len-1] == '(') { /* * In-place edit. Ewww! diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 9db25ce..9dbee48 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -547,7 +547,7 @@ CreateFrame( className = colormapName = screenName = visualName = useOption = NULL; colormap = None; for (i = 2; i < objc; i += 2) { - arg = TkGetStringFromObj(objv[i], &length); + arg = Tcl_GetStringFromObj(objv[i], &length); if (length < 2) { continue; } @@ -820,7 +820,7 @@ FrameWidgetObjCmd( */ for (i = 2; i < objc; i++) { - const char *arg = TkGetStringFromObj(objv[i], &length); + const char *arg = Tcl_GetStringFromObj(objv[i], &length); if (length < 2) { continue; diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 93e3550..c1955a0 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -215,7 +215,7 @@ Tk_GrabObjCmd( * First check for a window name or "-global" as the first argument. */ - arg = TkGetStringFromObj(objv[1], &len); + arg = Tcl_GetStringFromObj(objv[1], &len); if (arg[0] == '.') { /* [grab window] */ if (objc != 2) { diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 1c55274..1ca3fa7 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -2986,7 +2986,7 @@ ConfigureContent( TkSizeT length; char prevChar = firstChar; - string = TkGetStringFromObj(objv[i], &length); + string = Tcl_GetStringFromObj(objv[i], &length); firstChar = string[0]; if (firstChar == '.') { diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 825d446..cf9a8ac 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -765,7 +765,7 @@ StringMatchGIF( (void)format; (void)dummy; - data = TkGetByteArrayFromObj(dataObj, &length); + data = Tcl_GetByteArrayFromObj(dataObj, &length); /* * Header is a minimum of 10 bytes. @@ -833,7 +833,7 @@ StringReadGIF( MFile handle, *hdlPtr = &handle; TkSizeT length; const char *xferFormat; - unsigned char *data = TkGetByteArrayFromObj(dataObj, &length); + unsigned char *data = Tcl_GetByteArrayFromObj(dataObj, &length); mInit(data, hdlPtr, length); diff --git a/generic/tkImgListFormat.c b/generic/tkImgListFormat.c index 5505ae9..98a56cf 100644 --- a/generic/tkImgListFormat.c +++ b/generic/tkImgListFormat.c @@ -781,7 +781,7 @@ ParseColor( * Find out which color format we have */ - specString = TkGetStringFromObj(specObj, &charCount); + specString = Tcl_GetStringFromObj(specObj, &charCount); if (charCount == 0) { /* Empty string */ diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c index a7ee743..8895a9d 100644 --- a/generic/tkImgPNG.c +++ b/generic/tkImgPNG.c @@ -319,7 +319,7 @@ InitPNGImage( Tcl_IncrRefCount(objPtr); pngPtr->objDataPtr = objPtr; pngPtr->strDataBuf = - TkGetByteArrayFromObj(objPtr, &pngPtr->strDataLen); + Tcl_GetByteArrayFromObj(objPtr, &pngPtr->strDataLen); } /* @@ -1263,7 +1263,7 @@ ReadIHDR( */ if (mismatch && pngPtr->strDataBuf) { - pngPtr->strDataBuf = TkGetByteArrayFromObj(pngPtr->objDataPtr, + pngPtr->strDataBuf = Tcl_GetByteArrayFromObj(pngPtr->objDataPtr, &pngPtr->strDataLen); pngPtr->base64Data = pngPtr->strDataBuf; @@ -2146,12 +2146,12 @@ ReadIDAT( */ getNextLine: - TkGetByteArrayFromObj(pngPtr->thisLineObj, &len1); + Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, &len1); if (Tcl_ZlibStreamGet(pngPtr->stream, pngPtr->thisLineObj, pngPtr->phaseSize - len1) == TCL_ERROR) { return TCL_ERROR; } - TkGetByteArrayFromObj(pngPtr->thisLineObj, &len2); + Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, &len2); if (len2 == (TkSizeT)pngPtr->phaseSize) { if (pngPtr->phase > 7) { @@ -2775,7 +2775,7 @@ StringMatchPNG( InitPNGImage(NULL, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE); - png.strDataBuf = TkGetByteArrayFromObj(pObjData, &png.strDataLen); + png.strDataBuf = Tcl_GetByteArrayFromObj(pObjData, &png.strDataLen); if (ReadIHDR(interp, &png) == TCL_OK) { *widthPtr = png.block.width; @@ -2877,7 +2877,7 @@ WriteData( TkSizeT objSz; unsigned char *destPtr; - TkGetByteArrayFromObj(pngPtr->objDataPtr, &objSz); + Tcl_GetByteArrayFromObj(pngPtr->objDataPtr, &objSz); if (objSz + srcSz > INT_MAX) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -3238,7 +3238,7 @@ WriteIDAT( outputObj = Tcl_NewObj(); (void) Tcl_ZlibStreamGet(pngPtr->stream, outputObj, -1); - outputBytes = TkGetByteArrayFromObj(outputObj, &outputSize); + outputBytes = Tcl_GetByteArrayFromObj(outputObj, &outputSize); result = WriteChunk(interp, pngPtr, CHUNK_IDAT, outputBytes, outputSize); Tcl_DecrRefCount(outputObj); return result; diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c index 53e4f92..7f2c4cd 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -767,7 +767,7 @@ ReadPPMStringHeader( TkSizeT dataSize; unsigned char *dataBuffer; - dataBuffer = TkGetByteArrayFromObj(dataPtr, &dataSize); + dataBuffer = Tcl_GetByteArrayFromObj(dataPtr, &dataSize); /* * Read 4 space-separated fields from the string, ignoring comments (any diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index e7b367e..82c715d 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -457,7 +457,7 @@ ImgPhotoCmd( Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } - arg = TkGetStringFromObj(objv[2], &length); + arg = Tcl_GetStringFromObj(objv[2], &length); if (strncmp(arg,"-data", length) == 0) { if (modelPtr->dataString) { Tcl_SetObjResult(interp, modelPtr->dataString); @@ -506,7 +506,7 @@ ImgPhotoCmd( return TCL_OK; } else if (objc == 3) { - const char *arg = TkGetStringFromObj(objv[2], &length); + const char *arg = Tcl_GetStringFromObj(objv[2], &length); if (length > 1 && !strncmp(arg, "-data", length)) { Tcl_AppendResult(interp, "-data {} {} {}", NULL); @@ -1503,7 +1503,7 @@ ParseSubcommandOptions( * optPtr->name. */ - expandedOption = option = TkGetStringFromObj(objv[index], &length); + expandedOption = option = Tcl_GetStringFromObj(objv[index], &length); if (option[0] != '-') { if (optPtr->name == NULL) { optPtr->name = objv[index]; @@ -1781,7 +1781,7 @@ ImgPhotoConfigureModel( args = (const char **)ckalloc((objc + 1) * sizeof(char *)); for (i = 0, j = 0; i < objc; i++,j++) { - args[j] = TkGetStringFromObj(objv[i], &length); + args[j] = Tcl_GetStringFromObj(objv[i], &length); if ((length > 1) && (args[j][0] == '-')) { if ((args[j][1] == 'd') && !strncmp(args[j], "-data", length)) { @@ -1862,7 +1862,7 @@ ImgPhotoConfigureModel( */ TkSizeT bytesize; - (void) TkGetByteArrayFromObj(data, &bytesize); + (void) Tcl_GetByteArrayFromObj(data, &bytesize); if (bytesize) { Tcl_IncrRefCount(data); } else { diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c index db4cc61..5ed249a 100644 --- a/generic/tkImgSVGnano.c +++ b/generic/tkImgSVGnano.c @@ -179,7 +179,7 @@ FileMatchSVG( Tcl_DecrRefCount(dataObj); return 0; } - data = TkGetStringFromObj(dataObj, &length); + data = Tcl_GetStringFromObj(dataObj, &length); /* should have a '<svg' and a '>' in the first 4k */ if ((memchr(data, '>', length) == NULL) || (MemMem(data, length, "<svg", 4) == NULL)) { @@ -191,7 +191,7 @@ FileMatchSVG( Tcl_DecrRefCount(dataObj); return 0; } - data = TkGetStringFromObj(dataObj, &length); + data = Tcl_GetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); Tcl_DecrRefCount(dataObj); if (nsvgImage != NULL) { @@ -254,7 +254,7 @@ FileReadSVG( Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "READ_ERROR", NULL); return TCL_ERROR; } - data = TkGetStringFromObj(dataObj, &length); + data = Tcl_GetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); Tcl_DecrRefCount(dataObj); @@ -297,7 +297,7 @@ StringMatchSVG( NSVGimage *nsvgImage; CleanCache(interp); - data = TkGetStringFromObj(dataObj, &length); + data = Tcl_GetStringFromObj(dataObj, &length); /* should have a '<svg' and a '>' in the first 4k */ testLength = (length > 4096) ? 4096 : length; if ((memchr(data, '>', testLength) == NULL) || @@ -353,7 +353,7 @@ StringReadSVG( NSVGimage *nsvgImage = GetCachedSVG(interp, dataObj, formatObj, &ropts); if (nsvgImage == NULL) { - data = TkGetStringFromObj(dataObj, &length); + data = Tcl_GetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); } @@ -754,7 +754,7 @@ CacheSVG( if (cachePtr != NULL) { cachePtr->dataOrChan = dataOrChan; if (formatObj != NULL) { - data = TkGetStringFromObj(formatObj, &length); + data = Tcl_GetStringFromObj(formatObj, &length); Tcl_DStringAppend(&cachePtr->formatString, data, length); } cachePtr->nsvgImage = nsvgImage; @@ -795,7 +795,7 @@ GetCachedSVG( if ((cachePtr != NULL) && (cachePtr->nsvgImage != NULL) && (cachePtr->dataOrChan == dataOrChan)) { if (formatObj != NULL) { - data = TkGetStringFromObj(formatObj, &length); + data = Tcl_GetStringFromObj(formatObj, &length); if (strcmp(data, Tcl_DStringValue(&cachePtr->formatString)) == 0) { nsvgImage = cachePtr->nsvgImage; *ropts = cachePtr->ropts; diff --git a/generic/tkInt.h b/generic/tkInt.h index be1fa7b..c93d8e7 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1420,17 +1420,6 @@ MODULE_SCOPE void TkUnixSetXftClipRegion(Region clipRegion); MODULE_SCOPE const char *TkUtfPrev(const char *, const char *); #endif -#if TCL_MAJOR_VERSION > 8 -#define TkGetStringFromObj(objPtr, lenPtr) \ - (((objPtr)->bytes ? 0 : Tcl_GetString(objPtr)), \ - *(lenPtr) = (objPtr)->length, (objPtr)->bytes) -MODULE_SCOPE unsigned char *TkGetByteArrayFromObj(Tcl_Obj *objPtr, - size_t *lengthPtr); -#else -#define TkGetStringFromObj Tcl_GetStringFromObj -#define TkGetByteArrayFromObj Tcl_GetByteArrayFromObj -#endif - /* * Unsupported commands. */ diff --git a/generic/tkListbox.c b/generic/tkListbox.c index dc15b8f..8de96b6 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -1116,7 +1116,7 @@ ListboxBboxSubCmd( return result; } - stringRep = TkGetStringFromObj(el, &stringLen); + stringRep = Tcl_GetStringFromObj(el, &stringLen); Tk_GetFontMetrics(listPtr->tkfont, &fm); pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen); @@ -2079,7 +2079,7 @@ DisplayListbox( */ Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement); - stringRep = TkGetStringFromObj(curElement, &stringLen); + stringRep = Tcl_GetStringFromObj(curElement, &stringLen); textWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen); Tk_GetFontMetrics(listPtr->tkfont, &fm); @@ -2263,7 +2263,7 @@ ListboxComputeGeometry( if (result != TCL_OK) { continue; } - text = TkGetStringFromObj(element, &textLength); + text = Tcl_GetStringFromObj(element, &textLength); Tk_GetFontMetrics(listPtr->tkfont, &fm); pixelWidth = Tk_TextWidth(listPtr->tkfont, text, textLength); if (pixelWidth > listPtr->maxWidth) { @@ -2341,7 +2341,7 @@ ListboxInsertSubCmd( * if so, update our notion of "widest." */ - stringRep = TkGetStringFromObj(objv[i], &length); + stringRep = Tcl_GetStringFromObj(objv[i], &length); pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, length); if (pixelWidth > listPtr->maxWidth) { listPtr->maxWidth = pixelWidth; @@ -2500,7 +2500,7 @@ ListboxDeleteSubCmd( if (widthChanged == 0) { Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &element); - stringRep = TkGetStringFromObj(element, &length); + stringRep = Tcl_GetStringFromObj(element, &length); pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, length); if (pixelWidth == listPtr->maxWidth) { widthChanged = 1; @@ -3148,7 +3148,7 @@ ListboxFetchSelection( } Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement); - stringRep = TkGetStringFromObj(curElement, &stringLen); + stringRep = Tcl_GetStringFromObj(curElement, &stringLen); Tcl_DStringAppend(&selection, stringRep, stringLen); needNewline = 1; } diff --git a/generic/tkMenu.c b/generic/tkMenu.c index db95f09..a7e6363 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -1710,12 +1710,12 @@ PostProcessEntry( if (mePtr->labelPtr == NULL) { mePtr->labelLength = 0; } else { - (void)TkGetStringFromObj(mePtr->labelPtr, &mePtr->labelLength); + (void)Tcl_GetStringFromObj(mePtr->labelPtr, &mePtr->labelLength); } if (mePtr->accelPtr == NULL) { mePtr->accelLength = 0; } else { - (void)TkGetStringFromObj(mePtr->accelPtr, &mePtr->accelLength); + (void)Tcl_GetStringFromObj(mePtr->accelPtr, &mePtr->accelLength); } /* diff --git a/generic/tkPack.c b/generic/tkPack.c index 18f3107..ac5d73f 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -1181,7 +1181,7 @@ PackAfter( for (index = 0 ; index < optionCount; index++) { Tcl_Obj *curOptPtr = options[index]; TkSizeT length; - const char *curOpt = TkGetStringFromObj(curOptPtr, &length); + const char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length); c = curOpt[0]; diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index e4d6dac..0b09b84 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -271,7 +271,7 @@ ScrollbarWidgetObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "activate element"); goto error; } - c = TkGetStringFromObj(objv[2], &len)[0]; + c = Tcl_GetStringFromObj(objv[2], &len)[0]; oldActiveField = scrollPtr->activeField; if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow1") == 0)) { scrollPtr->activeField = TOP_ARROW; diff --git a/generic/tkSelect.c b/generic/tkSelect.c index a100121..449dc1d 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -900,7 +900,7 @@ Tk_SelectionObjCmd( } else { format = XA_STRING; } - string = TkGetStringFromObj(objs[1], &cmdLength); + string = Tcl_GetStringFromObj(objs[1], &cmdLength); if (cmdLength == 0) { Tk_DeleteSelHandler(tkwin, selection, target); } else { diff --git a/generic/tkText.c b/generic/tkText.c index c1e2129..09a110d 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -865,7 +865,7 @@ TextWidgetObjCmd( for (i = 2; i < objc-2; i++) { int value; TkSizeT length; - const char *option = TkGetStringFromObj(objv[i], &length); + const char *option = Tcl_GetStringFromObj(objv[i], &length); char c; if (length < 2 || option[0] != '-') { @@ -1275,12 +1275,12 @@ TextWidgetObjCmd( i = 2; if (objc > 3) { - name = TkGetStringFromObj(objv[i], &length); + name = Tcl_GetStringFromObj(objv[i], &length); if (length > 1 && name[0] == '-') { if (strncmp("-displaychars", name, length) == 0) { i++; visible = 1; - name = TkGetStringFromObj(objv[i], &length); + name = Tcl_GetStringFromObj(objv[i], &length); } if ((i < objc-1) && (length == 2) && !strcmp("--", name)) { i++; @@ -2636,7 +2636,7 @@ InsertChars( int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; - const char *string = TkGetStringFromObj(stringPtr, &length); + const char *string = Tcl_GetStringFromObj(stringPtr, &length); if (sharedTextPtr == NULL) { sharedTextPtr = textPtr->sharedTextPtr; @@ -4759,7 +4759,7 @@ TextDumpCmd( if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) { return TCL_ERROR; } - str = TkGetStringFromObj(objv[arg], &length); + str = Tcl_GetStringFromObj(objv[arg], &length); if (strncmp(str, "end", length) == 0) { atEnd = 1; } @@ -5828,7 +5828,7 @@ SearchCore( * it has dual purpose. */ - pattern = TkGetStringFromObj(patObj, &matchLength); + pattern = Tcl_GetStringFromObj(patObj, &matchLength); nl = strchr(pattern, '\n'); /* diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 11f741b..d14a25d 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -6182,7 +6182,7 @@ TkTextYviewCmd( pickPlace = 0; if (Tcl_GetString(objv[2])[0] == '-') { const char *switchStr = - TkGetStringFromObj(objv[2], &switchLength); + Tcl_GetStringFromObj(objv[2], &switchLength); if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace", (unsigned) switchLength) == 0)) { diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index 5b30448..5d4b5d5 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.c @@ -133,7 +133,7 @@ TkTextMarkCmd( Tcl_WrongNumArgs(interp, 3, objv, "markName ?gravity?"); return TCL_ERROR; } - str = TkGetStringFromObj(objv[3], &length); + str = Tcl_GetStringFromObj(objv[3], &length); if (length == 6 && !strcmp(str, "insert")) { markPtr = textPtr->insertMarkPtr; } else if (length == 7 && !strcmp(str, "current")) { @@ -160,7 +160,7 @@ TkTextMarkCmd( Tcl_SetObjResult(interp, Tcl_NewStringObj(typeStr, -1)); return TCL_OK; } - str = TkGetStringFromObj(objv[4],&length); + str = Tcl_GetStringFromObj(objv[4],&length); c = str[0]; if ((c == 'l') && (strncmp(str, "left", length) == 0)) { newTypePtr = &tkTextLeftMarkType; diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index c9d111a..1ffa602 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -1111,7 +1111,7 @@ FindTag( TkSizeT len; const char *str; - str = TkGetStringFromObj(tagName, &len); + str = Tcl_GetStringFromObj(tagName, &len); if (len == 3 && !strcmp(str, "sel")) { return textPtr->selTagPtr; } diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 701df53..1e9c334 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -731,7 +731,7 @@ Tk_GetScrollInfoObj( * scroll, if any. */ { TkSizeT length; - const char *arg = TkGetStringFromObj(objv[2], &length); + const char *arg = Tcl_GetStringFromObj(objv[2], &length); #define ArgPfxEq(str) \ ((arg[0] == str[0]) && !strncmp(arg, str, length)) @@ -759,7 +759,7 @@ Tk_GetScrollInfoObj( *dblPtr = d; } - arg = TkGetStringFromObj(objv[4], &length); + arg = Tcl_GetStringFromObj(objv[4], &length); if (ArgPfxEq("pages")) { return TK_SCROLL_PAGES; } else if (ArgPfxEq("units")) { @@ -1312,19 +1312,6 @@ TkUtfPrev( } #endif - -#if TCL_MAJOR_VERSION > 8 -unsigned char * -TkGetByteArrayFromObj( - Tcl_Obj *objPtr, - size_t *lengthPtr -) { - unsigned char *result = Tcl_GetByteArrayFromObj(objPtr, NULL); - *lengthPtr = *(size_t *) objPtr->internalRep.twoPtrValue.ptr1; - return result; -} -#endif /* TCL_MAJOR_VERSION > 8 */ - /* * Local Variables: * mode: c diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 2c69215..5d5ea20 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -3201,7 +3201,7 @@ Initialize( { TkSizeT numBytes; - const char *bytes = TkGetStringFromObj(nameObj, &numBytes); + const char *bytes = Tcl_GetStringFromObj(nameObj, &numBytes); classObj = Tcl_NewStringObj(bytes, numBytes); diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 6e4a3f0..cc6c6af 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -325,7 +325,7 @@ static void EntryUpdateTextLayout(Entry *entryPtr) 0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES, &entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight); } else { - text = TkGetStringFromObj(entryPtr->entry.placeholderObj, &length); + text = Tcl_GetStringFromObj(entryPtr->entry.placeholderObj, &length); entryPtr->entry.textLayout = Tk_ComputeTextLayout( Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj), text, length, @@ -1312,7 +1312,7 @@ static void EntryDisplay(void *clientData, Drawable d) } /* Use placeholder text width */ leftIndex = 0; - (void)TkGetStringFromObj(entryPtr->entry.placeholderObj, &rightIndex); + (void)Tcl_GetStringFromObj(entryPtr->entry.placeholderObj, &rightIndex); } else { foregroundObj = es.foregroundObj; } @@ -1400,7 +1400,7 @@ EntryIndex( return TCL_OK; } - string = TkGetStringFromObj(indexObj, &length); + string = Tcl_GetStringFromObj(indexObj, &length); if (strncmp(string, "insert", length) == 0) { *indexPtr = entryPtr->entry.insertPos; |