From 131b229726d38a119f46c849610e2b1830904708 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 3 Nov 2022 21:38:17 +0000 Subject: Get rid of TK_CONFIG_OBJS flag (and change signature of Tk_ConfigureWidgets) --- doc/ConfigWidg.3 | 36 +++++++++++------------ doc/CrtItemType.3 | 23 --------------- generic/tk.decls | 2 +- generic/tkCanvArc.c | 4 +-- generic/tkCanvBmap.c | 4 +-- generic/tkCanvImg.c | 4 +-- generic/tkCanvLine.c | 4 +-- generic/tkCanvPoly.c | 4 +-- generic/tkCanvPs.c | 4 +-- generic/tkCanvText.c | 4 +-- generic/tkCanvWind.c | 4 +-- generic/tkCanvas.c | 81 +++++++-------------------------------------------- generic/tkDecls.h | 6 ++-- generic/tkImgBmap.c | 2 +- generic/tkImgPhoto.c | 2 +- generic/tkMessage.c | 3 +- generic/tkOldConfig.c | 32 +++++--------------- generic/tkRectOval.c | 6 ++-- generic/tkScrollbar.c | 2 +- 19 files changed, 63 insertions(+), 164 deletions(-) diff --git a/doc/ConfigWidg.3 b/doc/ConfigWidg.3 index e29daa8..7954f14 100644 --- a/doc/ConfigWidg.3 +++ b/doc/ConfigWidg.3 @@ -15,7 +15,7 @@ Tk_ConfigureWidget, Tk_ConfigureInfo, Tk_ConfigureValue, Tk_FreeOptions \- proce \fB#include \fR .sp int -\fBTk_ConfigureWidget(\fIinterp, tkwin, specs, argc, argv, widgRec, flags\fB)\fR +\fBTk_ConfigureWidget(\fIinterp, tkwin, specs, objc, objv, widgRec, flags\fB)\fR .sp int \fBTk_ConfigureInfo(\fIinterp, tkwin, specs, widgRec, argvName, flags\fB)\fR @@ -33,9 +33,9 @@ Window used to represent widget (needed to set up X resources). .AP "const Tk_ConfigSpec" *specs in Pointer to table specifying legal configuration options for this widget. -.AP int argc in -Number of arguments in \fIargv\fR. -.AP "const char" **argv in +.AP int objc in +Number of arguments in \fIobjv\fR. +.AP "Tcl_Obj *const *" objv in Command-line options for configuring widget. .AP char *widgRec in/out Points to widget record structure. Fields in this structure get @@ -75,16 +75,16 @@ It is typically invoked when widgets are created, and again when the \fBconfigure\fR command is invoked for a widget. Although intended primarily for widgets, \fBTk_ConfigureWidget\fR -can be used in other situations where \fIargc-argv\fR information +can be used in other situations where \fIobjc-objv\fR information is to be used to fill in a record structure, such as configuring graphical elements for a canvas widget or entries of a menu. .PP \fBTk_ConfigureWidget\fR processes a table specifying the configuration options that are supported -(\fIspecs\fR) and a collection of command-line arguments (\fIargc\fR and -\fIargv\fR) to fill in fields of a record (\fIwidgRec\fR). +(\fIspecs\fR) and a collection of command-line arguments (\fIobjc\fR and +\fIobjv\fR) to fill in fields of a record (\fIwidgRec\fR). It uses the option database and defaults specified in \fIspecs\fR -to fill in fields of \fIwidgRec\fR that are not specified in \fIargv\fR. +to fill in fields of \fIwidgRec\fR that are not specified in \fIobjv\fR. \fBTk_ConfigureWidget\fR normally returns the value \fBTCL_OK\fR; in this case it does not modify \fIinterp\fR. If an error @@ -120,12 +120,12 @@ The \fIargvName\fR field is a string such as .QW \-font or .QW \-bg , -which is compared with the values in \fIargv\fR (if \fIargvName\fR is +which is compared with the values in \fIobjv\fR (if \fIargvName\fR is NULL it means this is a grouped entry; see \fBGROUPED ENTRIES\fR below). The \fIdbName\fR and \fIdbClass\fR fields are used to look up a value for this option in the option database. The \fIdefValue\fR field specifies a default value for this configuration option if no -value is specified in either \fIargv\fR or the option database. +value is specified in either \fIobjv\fR or the option database. \fIOffset\fR indicates where in \fIwidgRec\fR to store information about this option, and \fIspecFlags\fR contains additional information to control the processing of this configuration option (see FLAGS @@ -133,14 +133,14 @@ below). The last field, \fIcustomPtr\fR, is only used if \fItype\fR is \fBTK_CONFIG_CUSTOM\fR; see CUSTOM OPTION TYPES below. .PP -\fBTk_ConfigureWidget\fR first processes \fIargv\fR to see which +\fBTk_ConfigureWidget\fR first processes \fIobjv\fR to see which (if any) configuration options are specified there. \fIArgv\fR must contain an even number of fields; the first of each pair of fields must match the \fIargvName\fR of some entry in \fIspecs\fR (unique abbreviations are acceptable), and the second field of the pair contains the value for that configuration option. If there are entries in \fIspec\fR for which -there were no matching entries in \fIargv\fR, +there were no matching entries in \fIobjv\fR, \fBTk_ConfigureWidget\fR uses the \fIdbName\fR and \fIdbClass\fR fields of the \fIspecs\fR entry to probe the option database; if a value is found, then it is used as the value for the option. @@ -149,7 +149,7 @@ Finally, if no entry is found in the option database, the value for the configuration option. If the \fIdefValue\fR is NULL, or if the \fBTK_CONFIG_DONT_SET_DEFAULT\fR bit is set in \fIflags\fR, then there is no default value and this \fIspecs\fR entry -will be ignored if no value is specified in \fIargv\fR or the +will be ignored if no value is specified in \fIobjv\fR or the option database. .PP Once a string value has been determined for a configuration option, @@ -333,13 +333,13 @@ freed by passing it to \fBTcl_Free\fR. .TP \fBTK_CONFIG_SYNONYM\fR This \fItype\fR value identifies special entries in \fIspecs\fR that -are synonyms for other entries. If an \fIargv\fR value matches the +are synonyms for other entries. If an \fIobjv\fR value matches the \fIargvName\fR of a \fBTK_CONFIG_SYNONYM\fR entry, the entry is not used directly. Instead, \fBTk_ConfigureWidget\fR searches \fIspecs\fR for another entry whose \fIargvName\fR is the same as the \fIdbName\fR field in the \fBTK_CONFIG_SYNONYM\fR entry; this new entry is used just -as if its \fIargvName\fR had matched the \fIargv\fR value. The -synonym mechanism allows multiple \fIargv\fR values to be used for +as if its \fIargvName\fR had matched the \fIobjv\fR value. The +synonym mechanism allows multiple \fIobjv\fR values to be used for a single configuration option, such as .QW \-background and @@ -384,7 +384,7 @@ First, if the \fIflags\fR argument to \fBTk_ConfigureWidget\fR has the \fBTK_CONFIG_ARGV_ONLY\fR bit set (i.e., \fIflags\fR | \fBTK_CONFIG_ARGV_ONLY\fR != 0), then the option database and \fIdefValue\fR fields are not used. In this case, if an entry in -\fIspecs\fR does not match a field in \fIargv\fR then nothing happens: +\fIspecs\fR does not match a field in \fIobjv\fR then nothing happens: the corresponding target is not modified. This feature is useful when the goal is to modify certain configuration options while leaving others in their current state, such as when a \fBconfigure\fR @@ -433,7 +433,7 @@ once, save the value, and provide it before calling This bit is deprecated. It used to be set and cleared by \fBTk_ConfigureWidget\fR so that callers could detect what entries were specified in -\fIargv\fR, but it was removed because it was inherently +\fIobjv\fR, but it was removed because it was inherently thread-unsafe. Code that wishes to detect what options were specified should use \fBTk_SetOptions\fR instead. .PP diff --git a/doc/CrtItemType.3 b/doc/CrtItemType.3 index cd270f4..c46ad2d 100644 --- a/doc/CrtItemType.3 +++ b/doc/CrtItemType.3 @@ -180,14 +180,6 @@ is redrawn, rather than only when the bounding box of the item overlaps the area being redrawn. This is used by window items, for example, which need to unmap subwindows that are not on the screen. .TP -\fBTK_CONFIG_OBJS\fR -. -Indicates that operations which would otherwise take a string (or array of -strings) actually take a Tcl_Obj reference (or an array of such references). -The operations to which this applies are the \fIconfigProc\fR, the -\fIcoordProc\fR, the \fIcreateProc\fR, the \fIindexProc\fR and the -\fIinsertProc\fR. -.TP \fBTK_MOVABLE_POINTS\fR .VS 8.6 Indicates that the item supports the \fIdCharsProc\fR, \fIindexProc\fR and @@ -229,9 +221,6 @@ Tk has already initialized the item's header (the first The \fIobjc\fR and \fIobjv\fR arguments describe all of the arguments to the \fBcreate\fR command after the \fItype\fR argument. -Note that if \fBTK_CONFIG_OBJS\fR is not set in the -\fItypePtr\->alwaysRedraw\fR field, the \fIobjv\fR parameter will actually -contain a pointer to an array of constant strings. For example, in the widget command: .PP .CS @@ -285,9 +274,6 @@ The \fIinterp\fR argument identifies the interpreter in which the widget command was invoked, \fIcanvas\fR is a handle for the canvas widget, and \fIitemPtr\fR is a pointer to the item being configured. \fIobjc\fR and \fIobjv\fR contain the configuration options. -Note that if \fBTK_CONFIG_OBJS\fR is not set in the -\fItypePtr\->alwaysRedraw\fR field, the \fIobjv\fR parameter will actually -contain a pointer to an array of constant strings. For example, if the following command is invoked: .PP .CS @@ -324,9 +310,6 @@ typedef int \fBTk_ItemCoordProc\fR( The arguments \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR all have the standard meanings, and \fIobjc\fR and \fIobjv\fR describe the coordinate arguments. -Note that if \fBTK_CONFIG_OBJS\fR is not set in the -\fItypePtr\->alwaysRedraw\fR field, the \fIobjv\fR parameter will actually -contain a pointer to an array of constant strings. For example, if the following widget command is invoked: .PP .CS @@ -616,9 +599,6 @@ have the usual meaning. \fIindexObj\fR contains a textual description of an index, and \fIindexPtr\fR points to an integer value that should be filled in with a numerical index. -Note that if \fBTK_CONFIG_OBJS\fR is not set in the -\fItypePtr\->alwaysRedraw\fR field, the \fIindexObj\fR parameter will -actually contain a pointer to a constant string. It is up to the type manager to decide what forms of index are supported (e.g., numbers, \fBinsert\fR, \fBsel.first\fR, \fBend\fR, etc.). @@ -702,9 +682,6 @@ typedef void \fBTk_ItemInsertProc\fR( previous call to \fItypePtr\->insertProc\fR, and \fIobj\fR contains new text to insert just before the character given by \fIindex\fR. -Note that if \fBTK_CONFIG_OBJS\fR is not set in the -\fItypePtr\->alwaysRedraw\fR field, the \fIobj\fR parameter will -actually contain a pointer to a constant string to be inserted. If the item supports modification of the coordinates list by this .PP The type manager should insert the text and recompute the bounding diff --git a/generic/tk.decls b/generic/tk.decls index 1075977..68da8b5 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -146,7 +146,7 @@ declare 28 { declare 29 { int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, - Tcl_Size argc, const char **argv, char *widgRec, + Tcl_Size objc, Tcl_Obj *const *objv, void *widgRec, int flags) } declare 30 { diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index cfb5d0c..b1c109e 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -234,7 +234,7 @@ Tk_ItemType tkArcType = { ArcCoords, /* coordProc */ DeleteArc, /* deleteProc */ DisplayArc, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ ArcToPoint, /* pointProc */ ArcToArea, /* areaProc */ ArcToPostscript, /* postscriptProc */ @@ -452,7 +452,7 @@ ConfigureArc( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **) objv, (char *) arcPtr, flags|TK_CONFIG_OBJS)) { + objv, arcPtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index 6a6de42..d75f869 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -128,7 +128,7 @@ Tk_ItemType tkBitmapType = { BitmapCoords, /* coordProc */ DeleteBitmap, /* deleteProc */ DisplayBitmap, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ BitmapToPoint, /* pointProc */ BitmapToArea, /* areaProc */ BitmapToPostscript, /* postscriptProc */ @@ -324,7 +324,7 @@ ConfigureBitmap( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **) objv, (char *) bmapPtr, flags|TK_CONFIG_OBJS)) { + objv, bmapPtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index b51a785..9aef37b 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.c @@ -116,7 +116,7 @@ Tk_ItemType tkImageType = { ImageCoords, /* coordProc */ DeleteImage, /* deleteProc */ DisplayImage, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ ImageToPoint, /* pointProc */ ImageToArea, /* areaProc */ ImageToPostscript, /* postscriptProc */ @@ -302,7 +302,7 @@ ConfigureImage( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **) objv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) { + objv, imgPtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index 21b4ada..ace8643 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -230,7 +230,7 @@ Tk_ItemType tkLineType = { LineCoords, /* coordProc */ DeleteLine, /* deleteProc */ DisplayLine, /* displayProc */ - TK_CONFIG_OBJS | TK_MOVABLE_POINTS, /* flags */ + TK_MOVABLE_POINTS, /* flags */ LineToPoint, /* pointProc */ LineToArea, /* areaProc */ LineToPostscript, /* postscriptProc */ @@ -482,7 +482,7 @@ ConfigureLine( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **) objv, (char *) linePtr, flags|TK_CONFIG_OBJS)) { + objv, linePtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index eda1c22..24054a8 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -199,7 +199,7 @@ Tk_ItemType tkPolygonType = { PolygonCoords, /* coordProc */ DeletePolygon, /* deleteProc */ DisplayPolygon, /* displayProc */ - TK_CONFIG_OBJS | TK_MOVABLE_POINTS, /* flags */ + TK_MOVABLE_POINTS, /* flags */ PolygonToPoint, /* pointProc */ PolygonToArea, /* areaProc */ PolygonToPostscript, /* postscriptProc */ @@ -446,7 +446,7 @@ ConfigurePolygon( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **) objv, (char *) polyPtr, flags|TK_CONFIG_OBJS)) { + objv, polyPtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index 05555ae..500558b 100644 --- a/generic/tkCanvPs.c +++ b/generic/tkCanvPs.c @@ -236,8 +236,8 @@ TkCanvPostscriptObjCmd( psInfo.prolog = 1; psInfo.tkwin = tkwin; Tcl_InitHashTable(&psInfo.fontTable, TCL_STRING_KEYS); - result = Tk_ConfigureWidget(interp, tkwin, configSpecs, objc-2, (const char **)objv+2, - (char *) &psInfo, TK_CONFIG_ARGV_ONLY|TK_CONFIG_OBJS); + result = Tk_ConfigureWidget(interp, tkwin, configSpecs, objc-2, objv+2, + &psInfo, TK_CONFIG_ARGV_ONLY); if (result != TCL_OK) { goto cleanup; } diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index f08e388..a222e48 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -278,7 +278,7 @@ Tk_ItemType tkTextType = { TextCoords, /* coordProc */ DeleteText, /* deleteProc */ DisplayCanvText, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ TextToPoint, /* pointProc */ TextToArea, /* areaProc */ TextToPostscript, /* postscriptProc */ @@ -500,7 +500,7 @@ ConfigureText( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **) objv, (char *) textPtr, flags|TK_CONFIG_OBJS)) { + objv, textPtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index 2ef4a82..4691e63 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -120,7 +120,7 @@ Tk_ItemType tkWindowType = { WinItemCoords, /* coordProc */ DeleteWinItem, /* deleteProc */ DisplayWinItem, /* displayProc */ - 1|TK_CONFIG_OBJS, /* flags */ + 1, /* flags */ WinItemToPoint, /* pointProc */ WinItemToArea, /* areaProc */ WinItemToPostscript, /* postscriptProc */ @@ -316,7 +316,7 @@ ConfigureWinItem( oldWindow = winItemPtr->tkwin; canvasTkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, canvasTkwin, configSpecs, objc, - (const char **) objv, (char *) winItemPtr, flags|TK_CONFIG_OBJS)) { + objv, winItemPtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index c77d33e..82ab17e 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -334,25 +334,9 @@ ItemConfigure( Tcl_Obj *const objv[]) { Tcl_Interp *interp = canvasPtr->interp; - int result; - if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) { - result = itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objc, objv, TK_CONFIG_ARGV_ONLY); - } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - const char **args = TkGetStringsFromObjs(objc, objv); - - result = itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objc, (Tcl_Obj **) args, TK_CONFIG_ARGV_ONLY); - if (args != NULL) { - ckfree(args); - } -#endif - } - return result; + return itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr, + itemPtr, objc, objv, TK_CONFIG_ARGV_ONLY); } static inline int @@ -389,21 +373,9 @@ ItemCoords( if (itemPtr->typePtr->coordProc == NULL) { result = TCL_OK; - } else if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) { - result = itemPtr->typePtr->coordProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objc, objv); } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - const char **args = TkGetStringsFromObjs(objc, objv); - result = itemPtr->typePtr->coordProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objc, (Tcl_Obj **) args); - if (args != NULL) { - ckfree(args); - } -#endif + itemPtr, objc, objv); } return result; } @@ -417,25 +389,9 @@ ItemCreate( Tcl_Obj *const objv[]) { Tcl_Interp *interp = canvasPtr->interp; - int result; - if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) { - result = itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr, + return itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3); - } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - const char **args = TkGetStringsFromObjs(objc-3, objv+3); - - result = itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objc-3, (Tcl_Obj **) args); - if (args != NULL) { - ckfree(args); - } -#endif - } - return result; } static inline void @@ -489,17 +445,9 @@ ItemIndex( if (itemPtr->typePtr->indexProc == NULL) { return TCL_OK; - } else if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) { - return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objPtr, indexPtr); - } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, (Tcl_Obj *) Tcl_GetString(objPtr), indexPtr); -#endif } + return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr, + itemPtr, objPtr, indexPtr); } static inline void @@ -509,17 +457,8 @@ ItemInsert( int beforeThis, Tcl_Obj *toInsert) { - if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) { - itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr, - beforeThis, toInsert); - } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr, - beforeThis, (Tcl_Obj *) Tcl_GetString(toInsert)); -#endif - } + itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr, + beforeThis, toInsert); } static inline int @@ -2325,8 +2264,8 @@ ConfigureCanvas( Tk_State old_canvas_state=canvasPtr->canvas_state; if (Tk_ConfigureWidget(interp, canvasPtr->tkwin, configSpecs, - objc, (const char **) objv, (char *) canvasPtr, - flags|TK_CONFIG_OBJS) != TCL_OK) { + objc, objv, canvasPtr, + flags) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 706d91a..f3c6fb2 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -142,8 +142,8 @@ EXTERN int Tk_ConfigureValue(Tcl_Interp *interp, /* 29 */ EXTERN int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, - Tcl_Size argc, const char **argv, - char *widgRec, int flags); + Tcl_Size objc, Tcl_Obj *const *objv, + void *widgRec, int flags); /* 30 */ EXTERN void Tk_ConfigureWindow(Tk_Window tkwin, unsigned int valueMask, @@ -966,7 +966,7 @@ typedef struct TkStubs { int (*tk_ClipboardClear) (Tcl_Interp *interp, Tk_Window tkwin); /* 26 */ int (*tk_ConfigureInfo) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 27 */ int (*tk_ConfigureValue) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 28 */ - int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, Tcl_Size argc, const char **argv, char *widgRec, int flags); /* 29 */ + int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, Tcl_Size objc, Tcl_Obj *const *objv, void *widgRec, int flags); /* 29 */ void (*tk_ConfigureWindow) (Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr); /* 30 */ Tk_TextLayout (*tk_ComputeTextLayout) (Tk_Font font, const char *str, Tcl_Size numChars, int wrapLength, Tk_Justify justify, int flags, int *widthPtr, int *heightPtr); /* 31 */ Tk_Window (*tk_CoordsToWindow) (int rootX, int rootY, Tk_Window tkwin); /* 32 */ diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index 3ff3a81..6cdd704 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -240,7 +240,7 @@ ImgBmapConfigureModel( int maskWidth, maskHeight, dummy1, dummy2; if (Tk_ConfigureWidget(modelPtr->interp, Tk_MainWindow(modelPtr->interp), - configSpecs, objc, (const char **) objv, (char *) modelPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { + configSpecs, objc, objv, modelPtr, flags) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 6b92831..992f4bd 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -2052,7 +2052,7 @@ ImgPhotoConfigureModel( */ if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs, - objc, (const char **)objv, (char *) modelPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { + objc, objv, modelPtr, flags) != TCL_OK) { goto errorExit; } diff --git a/generic/tkMessage.c b/generic/tkMessage.c index a5c3a2f..814e96f 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -442,10 +442,9 @@ ConfigureMessage( * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ - int flags) /* Flags to pass to Tk_ConfigureWidget. */ + TCL_UNUSED(int)) /* Flags to pass to Tk_ConfigureWidget. */ { Tk_SavedOptions savedOptions; - (void)flags; /* * Eliminate any existing trace on a variable monitored by the message. diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index cc52e8c..3770cbd 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -57,7 +57,7 @@ static void DeleteSpecCacheTable(ClientData clientData, * will hold an error message. * * Side effects: - * The fields of widgRec get filled in with information from argc/argv + * The fields of widgRec get filled in with information from objc/objv * and the option database. Old information in widgRec's fields gets * recycled. A copy of the spec-table is taken with (some of) the char* * fields converted into Tk_Uid fields; this copy will be released when @@ -72,9 +72,9 @@ Tk_ConfigureWidget( Tk_Window tkwin, /* Window containing widget (needed to set up * X resources). */ const Tk_ConfigSpec *specs, /* Describes legal options. */ - Tcl_Size argc, /* Number of elements in argv. */ - const char **argv, /* Command-line options. */ - char *widgRec, /* Record whose fields are to be modified. + Tcl_Size objc, /* Number of elements in objv. */ + Tcl_Obj *const *objv, /* Command-line options. */ + void *widgRec, /* Record whose fields are to be modified. * Values must be properly initialized. */ int flags) /* Used to specify additional flags that must * be present in config specs for them to be @@ -121,18 +121,10 @@ Tk_ConfigureWidget( * match entries in the specs. */ - for ( ; argc > 0; argc -= 2, argv += 2) { + for ( ; objc > 0; objc -= 2, objv += 2) { const char *arg; - if (flags & TK_CONFIG_OBJS) { - arg = Tcl_GetString((Tcl_Obj *) *argv); - } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - arg = *argv; -#endif - } + arg = Tcl_GetString(*objv); specPtr = FindConfigSpec(interp, staticSpecs, arg, needFlags, hateFlags); if (specPtr == NULL) { return TCL_ERROR; @@ -142,21 +134,13 @@ Tk_ConfigureWidget( * Process the entry. */ - if (argc < 2) { + if (objc < 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "value for \"%s\" missing", arg)); Tcl_SetErrorCode(interp, "TK", "VALUE_MISSING", NULL); return TCL_ERROR; } - if (flags & TK_CONFIG_OBJS) { - arg = Tcl_GetString((Tcl_Obj *) argv[1]); - } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - arg = argv[1]; -#endif - } + arg = Tcl_GetString(objv[1]); if (DoConfig(interp, tkwin, specPtr, arg, 0, widgRec) != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (processing \"%.40s\" option)",specPtr->argvName)); diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index e0d591c..3f307aa 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -171,7 +171,7 @@ Tk_ItemType tkRectangleType = { RectOvalCoords, /* coordProc */ DeleteRectOval, /* deleteProc */ DisplayRectOval, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ RectToPoint, /* pointProc */ RectToArea, /* areaProc */ RectOvalToPostscript, /* postscriptProc */ @@ -196,7 +196,7 @@ Tk_ItemType tkOvalType = { RectOvalCoords, /* coordProc */ DeleteRectOval, /* deleteProc */ DisplayRectOval, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ OvalToPoint, /* pointProc */ OvalToArea, /* areaProc */ RectOvalToPostscript, /* postscriptProc */ @@ -416,7 +416,7 @@ ConfigureRectOval( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **)objv, (char *) rectOvalPtr, flags|TK_CONFIG_OBJS)) { + objv, rectOvalPtr, flags)) { return TCL_ERROR; } state = itemPtr->state; diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 48e6de1..e0e3c0c 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -532,7 +532,7 @@ ConfigureScrollbar( int flags) /* Flags to pass to Tk_ConfigureWidget. */ { if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs, objc, - (const char **)objv, (char *) scrollPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { + objv, (char *) scrollPtr, flags) != TCL_OK) { return TCL_ERROR; } -- cgit v0.12