From 8dcd0c3affd7c9e7220daa443f906abb7842aeb4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 5 Apr 2022 13:48:10 +0000 Subject: Make Tk 8.7 work with both TIP #613 and TIP #618 --- generic/tkConfig.c | 10 ++++++---- generic/tkInt.h | 5 +---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/generic/tkConfig.c b/generic/tkConfig.c index e9db3b9..2ad05e4 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -85,6 +85,8 @@ typedef struct TkOption { #define OPTION_NEEDS_FREEING 1 +#define INDEX_NULL_OK (32+4) /* Combination of TCL_INDEX_NULL_OK (TIP #613) and TCL_NULL_OK (TIP #618) */ + /* * One of the following exists for each Tk_OptionSpec array that has been * passed to Tk_CreateOptionTable. @@ -735,7 +737,7 @@ DoObjConfig( } else { if (Tcl_GetIndexFromObjStruct(interp, valuePtr, optionPtr->specPtr->clientData, sizeof(char *), - optionPtr->specPtr->optionName+1, (nullOK ? TCL_INDEX_NULL_OK : 0), &newValue) != TCL_OK) { + optionPtr->specPtr->optionName+1, (nullOK ? INDEX_NULL_OK : 0), &newValue) != TCL_OK) { return TCL_ERROR; } } @@ -842,7 +844,7 @@ DoObjConfig( valuePtr = NULL; newRelief = TK_RELIEF_NULL; } else if (Tcl_GetIndexFromObj(interp, valuePtr, tkReliefStrings, - "relief", (nullOK ? TCL_INDEX_NULL_OK : 0), &newRelief) != TCL_OK) { + "relief", (nullOK ? INDEX_NULL_OK : 0), &newRelief) != TCL_OK) { return TCL_ERROR; } if (internalPtr != NULL) { @@ -877,7 +879,7 @@ DoObjConfig( valuePtr = NULL; newJustify = -1; } else if (Tcl_GetIndexFromObj(interp, valuePtr, tkJustifyStrings, - "justification", (nullOK ? TCL_INDEX_NULL_OK : 0), &newJustify) != TCL_OK) { + "justification", (nullOK ? INDEX_NULL_OK : 0), &newJustify) != TCL_OK) { return TCL_ERROR; } if (internalPtr != NULL) { @@ -893,7 +895,7 @@ DoObjConfig( valuePtr = NULL; newAnchor = -1; } else if (Tcl_GetIndexFromObj(interp, valuePtr, tkAnchorStrings, - "anchor", (nullOK ? TCL_INDEX_NULL_OK : 0), &newAnchor) != TCL_OK) { + "anchor", (nullOK ? INDEX_NULL_OK : 0), &newAnchor) != TCL_OK) { return TCL_ERROR; } if (internalPtr != NULL) { diff --git a/generic/tkInt.h b/generic/tkInt.h index eb9d971..4efe9e0 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -134,15 +134,12 @@ /* * Fallback in case Tk is linked against a Tcl version not having TIP #585 - * (TCL_INDEX_TEMP_TABLE) or not having TIP #613 (TCL_INDEX_NULL_OK). + * (TCL_INDEX_TEMP_TABLE) */ #if !defined(TCL_INDEX_TEMP_TABLE) # define TCL_INDEX_TEMP_TABLE 2 #endif -#if !defined(TCL_INDEX_NULL_OK) -# define TCL_INDEX_NULL_OK 4 -#endif #ifndef TCL_Z_MODIFIER # if defined(_WIN64) -- cgit v0.12