From 390585bc36d575c11753e5b95e1ab4fe8ea04b3b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 7 Mar 2024 15:58:24 +0000 Subject: [PATCH] Another round of int -> Tcl_Size changes --- generic/tkBind.c | 8 ++-- generic/tkBusy.c | 8 ++-- generic/tkButton.c | 12 +++--- generic/tkConsole.c | 6 +-- generic/tkEntry.c | 28 ++++++-------- generic/tkFrame.c | 20 +++++----- generic/tkGrid.c | 57 ++++++++++++++--------------- generic/tkImgListFormat.c | 14 +++---- generic/tkListbox.c | 77 ++++++++++++++++++++------------------- generic/tkMenu.c | 4 +- generic/tkMenubutton.c | 4 +- generic/tkMessage.c | 4 +- generic/tkOldTest.c | 28 +++++++------- generic/tkPanedWindow.c | 3 -- generic/tkScale.c | 4 +- generic/tkScrollbar.c | 7 ++-- generic/tkSquare.c | 3 +- generic/tkTest.c | 64 ++++++++------------------------ generic/ttk/ttkWidget.h | 3 +- unix/tkUnixSysTray.c | 11 +++--- 20 files changed, 153 insertions(+), 212 deletions(-) diff --git a/generic/tkBind.c b/generic/tkBind.c index 6c83dd06e..8f91ff38e 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -734,7 +734,7 @@ static int GetVirtualEvent(Tcl_Interp *interp, VirtualEventTable *vetPtr, Tcl_Obj *virtName); static Tk_Uid GetVirtualEventUid(Tcl_Interp *interp, char *virtString); static int HandleEventGenerate(Tcl_Interp *interp, Tk_Window main, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static void InitVirtualEventTable(VirtualEventTable *vetPtr); static PatSeq * MatchPatterns(TkDisplay *dispPtr, Tk_BindingTable bindPtr, PSList *psList, PSList *psSuccList, unsigned patIndex, const Event *eventPtr, @@ -3896,7 +3896,7 @@ static int HandleEventGenerate( Tcl_Interp *interp, /* Interp for errors return and name lookup. */ Tk_Window mainWin, /* Main window associated with interp. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { union { XEvent general; XVirtualEvent virt; } event; @@ -3916,7 +3916,7 @@ HandleEventGenerate( unsigned count; unsigned flags; int number; - unsigned i; + Tcl_Size i; static const char *const fieldStrings[] = { "-when", "-above", "-borderwidth", "-button", @@ -4026,7 +4026,7 @@ HandleEventGenerate( warp = 0; pos = TCL_QUEUE_TAIL; - for (i = 2; i < (unsigned) objc; i += 2) { + for (i = 2; i < objc; i += 2) { Tcl_Obj *optionPtr, *valuePtr; #if defined(_MSC_VER) /* Work around MSVC compiler optimization bug, see [d93c8175fd]. */ diff --git a/generic/tkBusy.c b/generic/tkBusy.c index 5825b1649..9cac37c8b 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -43,7 +43,7 @@ static void BusyGeometryProc(void *clientData, static void BusyCustodyProc(void *clientData, Tk_Window tkwin); static int ConfigureBusy(Tcl_Interp *interp, Busy *busyPtr, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static Busy * CreateBusy(Tcl_Interp *interp, Tk_Window tkRef); static Tcl_FreeProc DestroyBusy; static void DoConfigureNotify(Tk_FakeWin *winPtr); @@ -53,7 +53,7 @@ static Busy * GetBusy(Tcl_Interp *interp, Tcl_Obj *const windowObj); static int HoldBusy(Tcl_HashTable *busyTablePtr, Tcl_Interp *interp, Tcl_Obj *const windowObj, - int configObjc, Tcl_Obj *const configObjv[]); + Tcl_Size configObjc, Tcl_Obj *const configObjv[]); static void MakeTransparentWindowExist(Tk_Window tkwin, Window parent); static inline Tk_Window NextChild(Tk_Window tkwin); @@ -640,7 +640,7 @@ static int ConfigureBusy( Tcl_Interp *interp, Busy *busyPtr, - int objc, + Tcl_Size objc, Tcl_Obj *const objv[]) { Tk_Cursor oldCursor = busyPtr->cursor; @@ -731,7 +731,7 @@ HoldBusy( Tcl_HashTable *busyTablePtr,/* Busy hash table. */ Tcl_Interp *interp, /* Interpreter to report errors to. */ Tcl_Obj *const windowObj, /* Window name. */ - int configObjc, /* Option pairs. */ + Tcl_Size configObjc, /* Option pairs. */ Tcl_Obj *const configObjv[]) { Tk_Window tkwin; diff --git a/generic/tkButton.c b/generic/tkButton.c index 1dec2fe04..fce0f0a26 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -514,7 +514,7 @@ static const enum command map[][8] = { static void ButtonCmdDeletedProc(void *clientData); static int ButtonCreate(void *clientData, - Tcl_Interp *interp, int objc, + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], int type); static void ButtonEventProc(void *clientData, XEvent *eventPtr); @@ -533,11 +533,9 @@ static char * ButtonTextVarProc(void *clientData, static char * ButtonVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); -static int ButtonWidgetObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc ButtonWidgetObjCmd; static int ConfigureButton(Tcl_Interp *interp, TkButton *butPtr, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static void DestroyButton(TkButton *butPtr); /* @@ -621,7 +619,7 @@ static int ButtonCreate( TCL_UNUSED(void *), /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument values. */ int type) /* Type of button to create: TYPE_LABEL, * TYPE_BUTTON, TYPE_CHECK_BUTTON, or @@ -1029,7 +1027,7 @@ ConfigureButton( Tcl_Interp *interp, /* Used for error reporting. */ TkButton *butPtr, /* Information about widget; may or may * not already have values for some fields. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { Tk_SavedOptions savedOptions; diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 734a5ee8d..4b71a3c27 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -51,15 +51,13 @@ static int ConsoleHandle(void *instanceData, int direction, void **handlePtr); static int ConsoleInput(void *instanceData, char *buf, int toRead, int *errorCode); -static int ConsoleObjCmd(void *clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc ConsoleObjCmd; static int ConsoleOutput(void *instanceData, const char *buf, int toWrite, int *errorCode); static void ConsoleWatch(void *instanceData, int mask); static void DeleteConsoleInterp(void *clientData); static void InterpDeleteProc(void *clientData, Tcl_Interp *interp); -static int InterpreterObjCmd(void *clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc InterpreterObjCmd; /* * This structure describes the channel type structure for file based IO: diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 3d7d05694..dfb2ce233 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -406,7 +406,7 @@ static const char *const selElementNames[] = { */ static int ConfigureEntry(Tcl_Interp *interp, Entry *entryPtr, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static int DeleteChars(Entry *entryPtr, Tcl_Size index, Tcl_Size count); static Tcl_FreeProc DestroyEntry; static void DisplayEntry(void *clientData); @@ -437,9 +437,7 @@ static int EntryValueChanged(Entry *entryPtr, const char *newValue); static void EntryVisibleRange(Entry *entryPtr, double *firstPtr, double *lastPtr); -static int EntryWidgetObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc EntryWidgetObjCmd; static void EntryWorldChanged(void *instanceData); static int GetEntryIndex(Tcl_Interp *interp, Entry *entryPtr, Tcl_Obj *indexObj, Tcl_Size *indexPtr); @@ -449,9 +447,7 @@ static int InsertChars(Entry *entryPtr, Tcl_Size index, const char *string); * These forward declarations are the spinbox specific ones: */ -static int SpinboxWidgetObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc SpinboxWidgetObjCmd; static int GetSpinboxElement(Spinbox *sbPtr, int x, int y); static int SpinboxInvoke(Tcl_Interp *interp, Spinbox *sbPtr, int element); @@ -1051,7 +1047,7 @@ DestroyEntry( * Tk_FreeOptions handle all the standard option-related stuff. */ - ckfree((char *)entryPtr->string); + ckfree((void *)entryPtr->string); if (entryPtr->textVarName != NULL) { Tcl_UntraceVar2(entryPtr->interp, entryPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, @@ -1066,7 +1062,7 @@ DestroyEntry( } Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler); if (entryPtr->displayString != entryPtr->string) { - ckfree((char *)entryPtr->displayString); + ckfree((void *)entryPtr->displayString); } if (entryPtr->type == TK_SPINBOX) { Spinbox *sbPtr = (Spinbox *) entryPtr; @@ -1113,7 +1109,7 @@ ConfigureEntry( Tcl_Interp *interp, /* Used for error reporting. */ Entry *entryPtr, /* Information about widget; may or may not * already have values for some fields. */ - int objc, /* Number of valid entries in argv. */ + Tcl_Size objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_SavedOptions savedOptions; @@ -1400,7 +1396,7 @@ ConfigureEntry( } snprintf(sbPtr->formatBuf, formatSpace, sbPtr->valueFormat, dvalue); - /* + /* * No check for error return here as well, because any possible * error will be trapped below when attempting tracing. */ @@ -1980,7 +1976,7 @@ EntryComputeGeometry( char *p; if (entryPtr->displayString != entryPtr->string) { - ckfree((char *)entryPtr->displayString); + ckfree((void *)entryPtr->displayString); entryPtr->displayString = entryPtr->string; entryPtr->numDisplayBytes = entryPtr->numBytes; } @@ -2188,7 +2184,7 @@ InsertChars( return TCL_OK; } - ckfree((char *)string); + ckfree((void *)string); entryPtr->string = newStr; /* @@ -2294,7 +2290,7 @@ DeleteChars( } ckfree(toDelete); - ckfree((char *)entryPtr->string); + ckfree((void *)entryPtr->string); entryPtr->string = newStr; entryPtr->numChars -= count; entryPtr->numBytes -= byteCount; @@ -2484,13 +2480,13 @@ EntrySetValue( if (entryPtr->flags & VALIDATE_ABORT) { entryPtr->flags &= ~VALIDATE_ABORT; - ckfree((char *)value); + ckfree((void *)value); return; } } oldSource = entryPtr->string; - ckfree((char *)entryPtr->string); + ckfree((void *)entryPtr->string); if (malloced) { entryPtr->string = value; diff --git a/generic/tkFrame.c b/generic/tkFrame.c index b3135c1a5..103b2ac89 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -328,9 +328,9 @@ static const Tk_OptionSpec *const optionSpecs[] = { static void ComputeFrameGeometry(Frame *framePtr); static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static int CreateFrame(void *clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[], + Tcl_Size objc, Tcl_Obj *const objv[], enum FrameType type, const char *appName); static Tcl_FreeProc DestroyFrame; static void DestroyFramePartly(Frame *framePtr); @@ -350,9 +350,7 @@ static void FrameRequestProc(void *clientData, Tk_Window tkwin); static void FrameStructureProc(void *clientData, XEvent *eventPtr); -static int FrameWidgetObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc FrameWidgetObjCmd; static void FrameWorldChanged(void *instanceData); static void MapFrame(void *clientData); @@ -504,7 +502,7 @@ static int CreateFrame( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects. */ enum FrameType type, /* What widget type to create. */ const char *appName) /* Should only be non-NULL if there are no @@ -518,8 +516,8 @@ CreateFrame( Tk_Window newWin; const char *className, *screenName, *visualName, *colormapName; const char *arg, *useOption; - int i, depth; - Tcl_Size length; + int depth; + Tcl_Size i, length; unsigned int mask; Colormap colormap; Visual *visual; @@ -774,8 +772,8 @@ FrameWidgetObjCmd( }; Frame *framePtr = (Frame *)clientData; int result = TCL_OK, index; - int c, i; - Tcl_Size length; + int c; + Tcl_Size i, length; Tcl_Obj *objPtr; if (objc < 2) { @@ -982,7 +980,7 @@ ConfigureFrame( Tcl_Interp *interp, /* Used for error reporting. */ Frame *framePtr, /* Information about widget; may or may not * already have values for some fields. */ - int objc, /* Number of valid entries in objv. */ + Tcl_Size objc, /* Number of valid entries in objv. */ Tcl_Obj *const objv[]) /* Arguments. */ { Tk_SavedOptions savedOptions; diff --git a/generic/tkGrid.c b/generic/tkGrid.c index bc8f19a94..50068b531 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -255,37 +255,37 @@ typedef struct UniformGroup { static void AdjustForSticky(Gridder *contentPtr, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); -static int AdjustOffsets(int width, int elements, +static int AdjustOffsets(int width, Tcl_Size elements, SlotInfo *slotPtr); static void ArrangeGrid(void *clientData); -static int CheckSlotData(Gridder *containerPtr, int slot, +static int CheckSlotData(Gridder *containerPtr, Tcl_Size slot, int slotType, int checkOnly); static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static Tcl_FreeProc DestroyGrid; static Gridder * GetGrid(Tk_Window tkwin); static int GridAnchorCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static int GridBboxCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static int GridForgetRemoveCommand(Tk_Window tkwin, - Tcl_Interp *interp, int objc, + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridInfoCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static int GridLocationCommand(Tk_Window tkwin, - Tcl_Interp *interp, int objc, + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridPropagateCommand(Tk_Window tkwin, - Tcl_Interp *interp, int objc, + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridRowColumnConfigureCommand(Tk_Window tkwin, - Tcl_Interp *interp, int objc, + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridSizeCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static int GridContentCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static void GridStructureProc(void *clientData, XEvent *eventPtr); static void GridLostContentProc(void *clientData, @@ -442,7 +442,7 @@ static int GridAnchorCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -511,7 +511,7 @@ static int GridBboxCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -641,12 +641,12 @@ static int GridForgetRemoveCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window content; Gridder *contentPtr; - int i; + Tcl_Size i; const char *string = Tcl_GetString(objv[1]); char c = string[0]; @@ -731,7 +731,7 @@ static int GridInfoCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Gridder *contentPtr; @@ -793,7 +793,7 @@ static int GridLocationCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -886,7 +886,7 @@ static int GridPropagateCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -974,7 +974,7 @@ static int GridRowColumnConfigureCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container, content; @@ -986,8 +986,7 @@ GridRowColumnConfigureCommand( Tcl_Size lObjc; /* Number of items in index list */ Tcl_Obj **lObjv; /* array of indices */ int ok; /* temporary TCL result code */ - int i, first, last; - Tcl_Size j; + Tcl_Size i, j, first, last; const char *string; static const char *const optionStrings[] = { "-minsize", "-pad", "-uniform", "-weight", NULL @@ -1308,7 +1307,7 @@ static int GridSizeCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -1359,7 +1358,7 @@ static int GridContentCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -1510,10 +1509,10 @@ GridLostContentProc( static int AdjustOffsets( int size, /* The total layout size (in pixels). */ - int slots, /* Number of slots. */ + Tcl_Size slots, /* Number of slots. */ SlotInfo *slotPtr) /* Pointer to slot array. */ { - int slot; /* Current slot. */ + Tcl_Size slot; /* Current slot. */ int diff; /* Extra pixels needed to add to the layout. */ int totalWeight; /* Sum of the weights for all the slots. */ int weight; /* Sum of the weights so far. */ @@ -2628,11 +2627,11 @@ SetContentRow( static int CheckSlotData( Gridder *containerPtr, /* The geometry container for this grid. */ - int slot, /* Which slot to look at. */ + Tcl_Size slot, /* Which slot to look at. */ int slotType, /* ROW or COLUMN. */ int checkOnly) /* Don't allocate new space if true. */ { - int numSlot; /* Number of slots already allocated (Space) */ + Tcl_Size numSlot; /* Number of slots already allocated (Space) */ int end; /* Last used constraint. */ /* @@ -2954,7 +2953,7 @@ ConfigureContent( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Any window in application containing * content. Used to look up content names. */ - int objc, /* Number of elements in argv. */ + Tcl_Size objc, /* Number of elements in argv. */ Tcl_Obj *const objv[]) /* Argument objects: contains one or more * window names followed by any number of * "option value" pairs. Caller must make sure diff --git a/generic/tkImgListFormat.c b/generic/tkImgListFormat.c index 0fc96418d..2c3405e66 100644 --- a/generic/tkImgListFormat.c +++ b/generic/tkImgListFormat.c @@ -121,7 +121,7 @@ static const char *const formatOptionNames[] = { */ static int ParseFormatOptions(Tcl_Interp *interp, int allowedOptions, - int objc, Tcl_Obj *const objv[], int *indexPtr, + Tcl_Size objc, Tcl_Obj *const objv[], Tcl_Size *indexPtr, struct FormatOptions *optPtr); static Tcl_Obj *GetBadOptMsg(const char *badValue, int allowedOpts); static int StringMatchDef(Tcl_Obj *data, Tcl_Obj *formatString, @@ -190,16 +190,17 @@ ParseFormatOptions( Tcl_Interp *interp, /* For error messages */ int allowedOptions, /* Bitfield specifying which options are * to be considered allowed */ - int objc, /* Number of elements in argv[] */ + Tcl_Size objc, /* Number of elements in argv[] */ Tcl_Obj *const objv[], /* The arguments to parse */ - int *indexPtr, /* Index giving the first element to + Tcl_Size *indexPtr, /* Index giving the first element to * parse. The value is updated to the * index where parsing ended */ struct FormatOptions *optPtr) /* Parsed option values are written to * this struct */ { - int index, optIndex, first, typeIndex; + Tcl_Size optIndex, index; + int first, typeIndex; const char *option; first = 1; @@ -477,7 +478,7 @@ StringReadDef( Display *display; Colormap colormap; struct FormatOptions opts; - int optIndex; + Tcl_Size optIndex; /* * Parse format suboptions @@ -627,8 +628,7 @@ StringWriteDef( { int greenOffset, blueOffset, alphaOffset, hasAlpha; Tcl_Obj *result, **objv = NULL; - Tcl_Size objc; - int allowedOpts, optIndex; + Tcl_Size objc, allowedOpts, optIndex; struct FormatOptions opts; /* diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 35fb494d3..4a2ea5ffb 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -383,10 +383,10 @@ enum indices { static void ChangeListboxOffset(Listbox *listPtr, int offset); static void ChangeListboxView(Listbox *listPtr, int index); static int ConfigureListbox(Tcl_Interp *interp, Listbox *listPtr, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static int ConfigureListboxItem(Tcl_Interp *interp, - Listbox *listPtr, ItemAttr *attrs, int objc, - Tcl_Obj *const objv[], int index); + Listbox *listPtr, ItemAttr *attrs, Tcl_Size objc, + Tcl_Obj *const objv[], Tcl_Size index); static int ListboxDeleteSubCmd(Listbox *listPtr, int first, int last); static Tcl_FreeProc DestroyListbox; @@ -394,9 +394,9 @@ static void DestroyListboxOptionTables(void *clientData, Tcl_Interp *interp); static void DisplayListbox(void *clientData); static int GetListboxIndex(Tcl_Interp *interp, Listbox *listPtr, - Tcl_Obj *index, int endIsSize, int *indexPtr); + Tcl_Obj *index, int endIsSize, Tcl_Size *indexPtr); static int ListboxInsertSubCmd(Listbox *listPtr, - int index, int objc, Tcl_Obj *const objv[]); + Tcl_Size index, Tcl_Size objc, Tcl_Obj *const objv[]); static void ListboxCmdDeletedProc(void *clientData); static void ListboxComputeGeometry(Listbox *listPtr, int fontChanged, int maxIsStale, int updateGrid); @@ -413,17 +413,15 @@ static int ListboxSelect(Listbox *listPtr, int first, int last, int select); static void ListboxUpdateHScrollbar(Listbox *listPtr); static void ListboxUpdateVScrollbar(Listbox *listPtr); -static int ListboxWidgetObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc ListboxWidgetObjCmd; static int ListboxBboxSubCmd(Tcl_Interp *interp, Listbox *listPtr, int index); static int ListboxSelectionSubCmd(Tcl_Interp *interp, - Listbox *listPtr, int objc, Tcl_Obj *const objv[]); + Listbox *listPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int ListboxXviewSubCmd(Tcl_Interp *interp, - Listbox *listPtr, int objc, Tcl_Obj *const objv[]); + Listbox *listPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int ListboxYviewSubCmd(Tcl_Interp *interp, - Listbox *listPtr, int objc, Tcl_Obj *const objv[]); + Listbox *listPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static ItemAttr * ListboxGetItemAttributes(Tcl_Interp *interp, Listbox *listPtr, int index); static void ListboxWorldChanged(void *instanceData); @@ -432,7 +430,7 @@ static char * ListboxListVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void MigrateHashEntries(Tcl_HashTable *table, - int first, int last, int offset); + Tcl_Size first, Tcl_Size last, Tcl_Size offset); static int GetMaxOffset(Listbox *listPtr); /* @@ -601,7 +599,8 @@ ListboxWidgetObjCmd( Tcl_Obj *const objv[]) /* Arguments as Tcl_Obj's. */ { Listbox *listPtr = (Listbox *)clientData; - int cmdIndex, index; + int cmdIndex; + Tcl_Size index; int result = TCL_OK; Tcl_Obj *objPtr; @@ -643,7 +642,7 @@ ListboxWidgetObjCmd( break; } - if (index >= (int)listPtr->nElements) { + if (index >= listPtr->nElements) { index = listPtr->nElements-1; } if (index < 0) { @@ -730,7 +729,7 @@ ListboxWidgetObjCmd( } case COMMAND_DELETE: { - int first, last; + Tcl_Size first, last; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?"); @@ -772,8 +771,7 @@ ListboxWidgetObjCmd( } case COMMAND_GET: { - int first, last; - Tcl_Size listLen; + Tcl_Size listLen, first, last; Tcl_Obj **elemPtrs; if (objc != 3 && objc != 4) { @@ -1154,10 +1152,11 @@ static int ListboxSelectionSubCmd( Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */ Listbox *listPtr, /* Information about the listbox */ - int objc, /* Number of arguments in the objv array */ + Tcl_Size objc, /* Number of arguments in the objv array */ Tcl_Obj *const objv[]) /* Array of arguments to the procedure */ { - int selCmdIndex, first, last; + int selCmdIndex; + Tcl_Size first, last; int result = TCL_OK; if (objc != 4 && objc != 5) { @@ -1244,7 +1243,7 @@ static int ListboxXviewSubCmd( Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */ Listbox *listPtr, /* Information about the listbox */ - int objc, /* Number of arguments in the objv array */ + Tcl_Size objc, /* Number of arguments in the objv array */ Tcl_Obj *const objv[]) /* Array of arguments to the procedure */ { int index, count, windowWidth, windowUnits; @@ -1322,10 +1321,11 @@ static int ListboxYviewSubCmd( Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */ Listbox *listPtr, /* Information about the listbox */ - int objc, /* Number of arguments in the objv array */ + Tcl_Size objc, /* Number of arguments in the objv array */ Tcl_Obj *const objv[]) /* Array of arguments to the procedure */ { - int index, count; + Tcl_Size index; + int count; double fraction; if (objc == 2) { @@ -1354,7 +1354,7 @@ ListboxYviewSubCmd( } else { switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { case TK_SCROLL_MOVETO: - index = (int) (listPtr->nElements*fraction + 0.5); + index = (Tcl_Size)(listPtr->nElements*fraction + 0.5); break; case TK_SCROLL_PAGES: if (listPtr->fullLines > 2) { @@ -1555,7 +1555,7 @@ ConfigureListbox( Tcl_Interp *interp, /* Used for error reporting. */ Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ - int objc, /* Number of valid entries in argv. */ + Tcl_Size objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ { Tk_SavedOptions savedOptions; @@ -1716,9 +1716,9 @@ ConfigureListboxItem( Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ ItemAttr *attrs, /* Information about the item to configure */ - int objc, /* Number of valid entries in argv. */ + Tcl_Size objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ - int index) /* Index of the listbox item being configure */ + Tcl_Size index) /* Index of the listbox item being configure */ { Tk_SavedOptions savedOptions; @@ -2318,13 +2318,13 @@ ListboxComputeGeometry( static int ListboxInsertSubCmd( Listbox *listPtr, /* Listbox that is to get the new elements. */ - int index, /* Add the new elements before this + Tcl_Size index, /* Add the new elements before this * element. */ - int objc, /* Number of new elements to add. */ + Tcl_Size objc, /* Number of new elements to add. */ Tcl_Obj *const objv[]) /* New elements (one per entry). */ { - int i, oldMaxWidth, pixelWidth, result; - Tcl_Size length; + int oldMaxWidth, pixelWidth, result; + Tcl_Size i, length; Tcl_Obj *newListObj; const char *stringRep; @@ -2728,10 +2728,10 @@ GetListboxIndex( int lastOK, /* If 1, "end" refers to the number of entries * in the listbox. If 0, "end" refers to 1 * less than the number of entries. */ - int *indexPtr) /* Where to store converted index. */ + Tcl_Size *indexPtr) /* Where to store converted index. */ { - int result, index; - Tcl_Size idx; + int result; + Tcl_Size idx, index; char *stringRep; result = TkGetIntForIndex(indexObj, listPtr->nElements - 1, lastOK, &idx); @@ -2739,7 +2739,7 @@ GetListboxIndex( if ((idx != TCL_INDEX_NONE) && (idx > listPtr->nElements)) { idx = listPtr->nElements; } - *indexPtr = (int)idx; + *indexPtr = idx; return TCL_OK; } @@ -3585,11 +3585,12 @@ ListboxListVarProc( static void MigrateHashEntries( Tcl_HashTable *table, - int first, - int last, - int offset) + Tcl_Size first, + Tcl_Size last, + Tcl_Size offset) { - int i, isNew; + Tcl_Size i; + int isNew; Tcl_HashEntry *entry; void *clientData; diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 3a7280e60..7819b11d9 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -349,9 +349,7 @@ static TkMenuEntry * MenuNewEntry(TkMenu *menuPtr, Tcl_Size index, int type); static char * MenuVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); -static int MenuWidgetObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc MenuWidgetObjCmd; static void MenuWorldChanged(void *instanceData); static int PostProcessEntry(TkMenuEntry *mePtr); static void RecursivelyDeleteMenu(TkMenu *menuPtr); diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 4b127246e..3f1f4e731 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -164,9 +164,7 @@ static void MenuButtonImageProc(void *clientData, static char * MenuButtonTextVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); -static int MenuButtonWidgetObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc MenuButtonWidgetObjCmd; static int ConfigureMenuButton(Tcl_Interp *interp, TkMenuButton *mbPtr, int objc, Tcl_Obj *const objv[]); diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 4fb0439cf..0f70b41f6 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -185,9 +185,7 @@ static void MessageEventProc(void *clientData, static char * MessageTextVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); -static int MessageWidgetObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc MessageWidgetObjCmd; static void MessageWorldChanged(void *instanceData); static void ComputeMessageGeometry(Message *msgPtr); static int ConfigureMessage(Tcl_Interp *interp, Message *msgPtr, diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c index d13595824..82b8ef2bc 100644 --- a/generic/tkOldTest.c +++ b/generic/tkOldTest.c @@ -60,15 +60,15 @@ typedef struct TImageInstance { static int ImageCreate(Tcl_Interp *interp, char *name, Tcl_Size argc, char **argv, Tk_ImageType *typePtr, Tk_ImageModel model, - ClientData *clientDataPtr); -static ClientData ImageGet(Tk_Window tkwin, ClientData clientData); -static void ImageDisplay(ClientData clientData, + void **clientDataPtr); +static void *ImageGet(Tk_Window tkwin, void *clientData); +static void ImageDisplay(void *clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); -static void ImageFree(ClientData clientData, Display *display); -static void ImageDelete(ClientData clientData); +static void ImageFree(void *clientData, Display *display); +static void ImageDelete(void *clientData); static Tk_ImageType imageType = { "oldtest", /* name */ @@ -86,9 +86,7 @@ static Tk_ImageType imageType = { * Forward declarations for functions defined later in this file: */ -static int ImageObjCmd(ClientData dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); +static Tcl_ObjCmdProc ImageObjCmd; #endif /* @@ -152,7 +150,7 @@ ImageCreate( Tk_ImageType *typePtr, /* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ - ClientData *clientDataPtr) /* Store manager's token for image here; it + void **clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { TImageModel *timPtr; @@ -209,7 +207,7 @@ ImageCreate( static int ImageObjCmd( - ClientData clientData, /* Main window for application. */ + void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -263,11 +261,11 @@ ImageObjCmd( *---------------------------------------------------------------------- */ -static ClientData +static void * ImageGet( Tk_Window tkwin, /* Token for window in which image will be * used. */ - ClientData clientData) /* Pointer to TImageModel for image. */ + void *clientData) /* Pointer to TImageModel for image. */ { TImageModel *timPtr = (TImageModel *)clientData; TImageInstance *instPtr; @@ -306,7 +304,7 @@ ImageGet( static void ImageDisplay( - ClientData clientData, /* Pointer to TImageInstance for image. */ + void *clientData, /* Pointer to TImageInstance for image. */ Display *display, /* Display to use for drawing. */ Drawable drawable, /* Where to redraw image. */ int imageX, int imageY, /* Origin of area to redraw, relative to @@ -358,7 +356,7 @@ ImageDisplay( static void ImageFree( - ClientData clientData, /* Pointer to TImageInstance for instance. */ + void *clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { TImageInstance *instPtr = (TImageInstance *)clientData; @@ -391,7 +389,7 @@ ImageFree( static void ImageDelete( - ClientData clientData) /* Pointer to TImageModel for image. When + void *clientData) /* Pointer to TImageModel for image. When * this function is called, no more instances * exist. */ { diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index c83d10015..d7f2d4535 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -183,9 +183,6 @@ typedef struct PanedWindow { * Forward declarations for functions defined later in this file: */ -int Tk_PanedWindowObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); static void PanedWindowCmdDeletedProc(void *clientData); static int ConfigurePanedWindow(Tcl_Interp *interp, PanedWindow *pwPtr, int objc, diff --git a/generic/tkScale.c b/generic/tkScale.c index 9748b2af8..eeda9cd85 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -161,9 +161,7 @@ static void ScaleEventProc(void *clientData, static char * ScaleVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); -static int ScaleWidgetObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc ScaleWidgetObjCmd; static void ScaleWorldChanged(void *instanceData); static void ScaleSetVariable(TkScale *scalePtr); diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index a776488a3..04a416892 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -97,11 +97,10 @@ static const Tk_ConfigSpec configSpecs[] = { */ static int ConfigureScrollbar(Tcl_Interp *interp, - TkScrollbar *scrollPtr, int objc, + TkScrollbar *scrollPtr, Tcl_Size objc, Tcl_Obj *const objv[], int flags); static void ScrollbarCmdDeletedProc(void *clientData); -static int ScrollbarWidgetObjCmd(void *clientData, - Tcl_Interp *, int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc ScrollbarWidgetObjCmd; /* *-------------------------------------------------------------- @@ -527,7 +526,7 @@ ConfigureScrollbar( TkScrollbar *scrollPtr, /* Information about widget; may or may not * already have values for some fields. */ - int objc, /* Number of valid entries in argv. */ + Tcl_Size objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { diff --git a/generic/tkSquare.c b/generic/tkSquare.c index f115c936b..708adbe6a 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -102,8 +102,7 @@ static void SquareDisplay(void *clientData); static void KeepInWindow(Square *squarePtr); static void SquareObjEventProc(void *clientData, XEvent *eventPtr); -static int SquareWidgetObjCmd(void *clientData, - Tcl_Interp *, int objc, Tcl_Obj * const objv[]); +static Tcl_ObjCmdProc SquareWidgetObjCmd; /* *-------------------------------------------------------------- diff --git a/generic/tkTest.c b/generic/tkTest.c index bafd7e6fe..4f16baaa1 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -155,67 +155,35 @@ typedef struct TrivialCommandHeader { * Forward declarations for functions defined later in this file: */ -static int ImageObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); -static int TestbitmapObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); -static int TestborderObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); -static int TestcolorObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); -static int TestcursorObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); -static int TestdeleteappsObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); -static int TestfontObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestmakeexistObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc ImageObjCmd; +static Tcl_ObjCmdProc TestbitmapObjCmd; +static Tcl_ObjCmdProc TestborderObjCmd; +static Tcl_ObjCmdProc TestcolorObjCmd; +static Tcl_ObjCmdProc TestcursorObjCmd; +static Tcl_ObjCmdProc TestdeleteappsObjCmd; +static Tcl_ObjCmdProc TestfontObjCmd; +static Tcl_ObjCmdProc TestmakeexistObjCmd; #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) -static int TestmenubarObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc TestmenubarObjCmd; #endif #if defined(_WIN32) -static int TestmetricsObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); +static Tcl_ObjCmdProc TestmetricsObjCmd; #endif -static int TestobjconfigObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); +static Tcl_ObjCmdProc TestobjconfigObjCmd; static Tk_CustomOptionSetProc CustomOptionSet; static Tk_CustomOptionGetProc CustomOptionGet; static Tk_CustomOptionRestoreProc CustomOptionRestore; static Tk_CustomOptionFreeProc CustomOptionFree; -static int TestpropObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); -static int TestprintfObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); +static Tcl_ObjCmdProc TestpropObjCmd; +static Tcl_ObjCmdProc TestprintfObjCmd; #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) -static int TestwrapperObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); +static Tcl_ObjCmdProc TestwrapperObjCmd; #endif static void TrivialCmdDeletedProc(void *clientData); -static int TrivialConfigObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); +static Tcl_ObjCmdProc TrivialConfigObjCmd; static void TrivialEventProc(void *clientData, XEvent *eventPtr); -static int TestPhotoStringMatchCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj * const objv[]); +static Tcl_ObjCmdProc TestPhotoStringMatchCmd; /* *---------------------------------------------------------------------- diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h index 6f8d5b0cf..3f2042655 100644 --- a/generic/ttk/ttkWidget.h +++ b/generic/ttk/ttkWidget.h @@ -104,8 +104,7 @@ MODULE_SCOPE int TtkWidgetStyleCommand( /* Widget constructor: */ -MODULE_SCOPE int TtkWidgetConstructorObjCmd( - void *, Tcl_Interp*, Tcl_Size, Tcl_Obj*const[]); +MODULE_SCOPE Tcl_ObjCmdProc2 TtkWidgetConstructorObjCmd; #if TCL_MAJOR_VERSION > 8 #define RegisterWidget(interp, name, specPtr) \ diff --git a/unix/tkUnixSysTray.c b/unix/tkUnixSysTray.c index e4fc49353..b4914e5e8 100644 --- a/unix/tkUnixSysTray.c +++ b/unix/tkUnixSysTray.c @@ -200,11 +200,10 @@ typedef struct { static Tcl_ObjCmdProc TrayIconCreateCmd; static Tcl_ObjCmdProc TrayIconObjectCmd; -static int TrayIconConfigureMethod(DockIcon *icon, Tcl_Interp* interp, - int objc, Tcl_Obj *const objv[], - int addflags); -static int PostBalloon(DockIcon* icon, const char * utf8msg, - long timeout); +static int TrayIconConfigureMethod(DockIcon *icon, Tcl_Interp *interp, + Tcl_Size objc, Tcl_Obj *const objv[], int addflags); +static int PostBalloon(DockIcon* icon, const char *utf8msg, + long timeout); static void CancelBalloon(DockIcon* icon, int msgid); static int QueryTrayOrientation(DockIcon* icon); @@ -1492,7 +1491,7 @@ static int TrayIconConfigureMethod( DockIcon *icon, Tcl_Interp* interp, - int objc, + Tcl_Size objc, Tcl_Obj *const objv[], int addflags) {