Skip to content

Commit 4217d9d

Browse files
author
jan.nijtmans
committed
Use more Tcl_CreateObjCommand2() internally. Those commands can handle a longer argument list.
1 parent 3c59146 commit 4217d9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+252
-255
lines changed

generic/tkButton.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ static char * ButtonTextVarProc(void *clientData,
533533
static char * ButtonVarProc(void *clientData,
534534
Tcl_Interp *interp, const char *name1,
535535
const char *name2, int flags);
536-
static Tcl_ObjCmdProc ButtonWidgetObjCmd;
536+
static Tcl_ObjCmdProc2 ButtonWidgetObjCmd;
537537
static int ConfigureButton(Tcl_Interp *interp, TkButton *butPtr,
538538
Tcl_Size objc, Tcl_Obj *const objv[]);
539539
static void DestroyButton(TkButton *butPtr);
@@ -670,7 +670,7 @@ ButtonCreate(
670670
butPtr->tkwin = tkwin;
671671
butPtr->display = Tk_Display(tkwin);
672672
butPtr->interp = interp;
673-
butPtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(tkwin),
673+
butPtr->widgetCmd = Tcl_CreateObjCommand2(interp, Tk_PathName(tkwin),
674674
ButtonWidgetObjCmd, butPtr, ButtonCmdDeletedProc);
675675
butPtr->type = type;
676676
butPtr->optionTable = optionTable;
@@ -767,7 +767,7 @@ static int
767767
ButtonWidgetObjCmd(
768768
void *clientData, /* Information about button widget. */
769769
Tcl_Interp *interp, /* Current interpreter. */
770-
int objc, /* Number of arguments. */
770+
Tcl_Size objc, /* Number of arguments. */
771771
Tcl_Obj *const objv[]) /* Argument values. */
772772
{
773773
TkButton *butPtr = (TkButton *)clientData;

generic/tkCanvas.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static void CanvasSetOrigin(TkCanvas *canvasPtr,
237237
int xOrigin, int yOrigin);
238238
static void CanvasUpdateScrollbars(TkCanvas *canvasPtr);
239239
static int CanvasWidgetCmd(void *clientData,
240-
Tcl_Interp *interp, int objc,
240+
Tcl_Interp *interp, Tcl_Size objc,
241241
Tcl_Obj *const *objv);
242242
static void CanvasWorldChanged(void *instanceData);
243243
static int ConfigureCanvas(Tcl_Interp *interp,
@@ -673,7 +673,7 @@ Tk_CanvasObjCmd(
673673
canvasPtr->tkwin = newWin;
674674
canvasPtr->display = Tk_Display(newWin);
675675
canvasPtr->interp = interp;
676-
canvasPtr->widgetCmd = Tcl_CreateObjCommand(interp,
676+
canvasPtr->widgetCmd = Tcl_CreateObjCommand2(interp,
677677
Tk_PathName(canvasPtr->tkwin), CanvasWidgetCmd, canvasPtr,
678678
CanvasCmdDeletedProc);
679679
canvasPtr->firstItemPtr = NULL;
@@ -793,7 +793,7 @@ static int
793793
CanvasWidgetCmd(
794794
void *clientData, /* Information about canvas widget. */
795795
Tcl_Interp *interp, /* Current interpreter. */
796-
int objc, /* Number of arguments. */
796+
Tcl_Size objc, /* Number of arguments. */
797797
Tcl_Obj *const objv[]) /* Argument objects. */
798798
{
799799
TkCanvas *canvasPtr = (TkCanvas *)clientData;

generic/tkCanvas.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ typedef struct TkCanvas {
290290
*/
291291

292292
MODULE_SCOPE int TkCanvPostscriptObjCmd(TkCanvas *canvasPtr,
293-
Tcl_Interp *interp, Tcl_Size argc, Tcl_Obj *const objv[]);
293+
Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]);
294294
MODULE_SCOPE int TkCanvTranslatePath(TkCanvas *canvPtr,
295295
int numVertex, double *coordPtr, int closed,
296296
XPoint *outPtr);

generic/tkConsole.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ static int ConsoleHandle(void *instanceData, int direction,
5151
void **handlePtr);
5252
static int ConsoleInput(void *instanceData, char *buf, int toRead,
5353
int *errorCode);
54-
static Tcl_ObjCmdProc ConsoleObjCmd;
54+
static Tcl_ObjCmdProc2 ConsoleObjCmd;
5555
static int ConsoleOutput(void *instanceData, const char *buf,
5656
int toWrite, int *errorCode);
5757
static void ConsoleWatch(void *instanceData, int mask);
5858
static void DeleteConsoleInterp(void *clientData);
5959
static void InterpDeleteProc(void *clientData, Tcl_Interp *interp);
60-
static Tcl_ObjCmdProc InterpreterObjCmd;
60+
static Tcl_ObjCmdProc2 InterpreterObjCmd;
6161

6262
/*
6363
* This structure describes the channel type structure for file based IO:
@@ -421,7 +421,7 @@ Tk_CreateConsoleWindow(
421421
* Add console commands to the interp
422422
*/
423423

424-
token = Tcl_CreateObjCommand(interp, "console", ConsoleObjCmd, info,
424+
token = Tcl_CreateObjCommand2(interp, "console", ConsoleObjCmd, info,
425425
ConsoleDeleteProc);
426426
info->refCount++;
427427

@@ -430,7 +430,7 @@ Tk_CreateConsoleWindow(
430430
* in the consoleInterp. The ref held by the consoleInterp delete
431431
* handler takes care of us.
432432
*/
433-
Tcl_CreateObjCommand(consoleInterp, "consoleinterp", InterpreterObjCmd,
433+
Tcl_CreateObjCommand2(consoleInterp, "consoleinterp", InterpreterObjCmd,
434434
info, NULL);
435435

436436
mainWindow = Tk_MainWindow(interp);
@@ -692,7 +692,7 @@ static int
692692
ConsoleObjCmd(
693693
void *clientData, /* Access to the console interp */
694694
Tcl_Interp *interp, /* Current interpreter */
695-
int objc, /* Number of arguments */
695+
Tcl_Size objc, /* Number of arguments */
696696
Tcl_Obj *const objv[]) /* Argument objects */
697697
{
698698
int index, result;
@@ -784,7 +784,7 @@ static int
784784
InterpreterObjCmd(
785785
void *clientData, /* */
786786
Tcl_Interp *interp, /* Current interpreter */
787-
int objc, /* Number of arguments */
787+
Tcl_Size objc, /* Number of arguments */
788788
Tcl_Obj *const objv[]) /* Argument objects */
789789
{
790790
int index, result = TCL_OK;

generic/tkEntry.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ static int EntryValueChanged(Entry *entryPtr,
434434
const char *newValue);
435435
static void EntryVisibleRange(Entry *entryPtr,
436436
double *firstPtr, double *lastPtr);
437-
static Tcl_ObjCmdProc EntryWidgetObjCmd;
437+
static Tcl_ObjCmdProc2 EntryWidgetObjCmd;
438438
static void EntryWorldChanged(void *instanceData);
439439
static int GetEntryIndex(Tcl_Interp *interp, Entry *entryPtr,
440440
Tcl_Obj *indexObj, Tcl_Size *indexPtr);
@@ -444,7 +444,7 @@ static int InsertChars(Entry *entryPtr, Tcl_Size index, Tcl_Obj *obj);
444444
* These forward declarations are the spinbox specific ones:
445445
*/
446446

447-
static Tcl_ObjCmdProc SpinboxWidgetObjCmd;
447+
static Tcl_ObjCmdProc2 SpinboxWidgetObjCmd;
448448
static int GetSpinboxElement(Spinbox *sbPtr, int x, int y);
449449
static int SpinboxInvoke(Tcl_Interp *interp, Spinbox *sbPtr,
450450
int element);
@@ -522,7 +522,7 @@ Tk_EntryObjCmd(
522522
entryPtr->tkwin = tkwin;
523523
entryPtr->display = Tk_Display(tkwin);
524524
entryPtr->interp = interp;
525-
entryPtr->widgetCmd = Tcl_CreateObjCommand(interp,
525+
entryPtr->widgetCmd = Tcl_CreateObjCommand2(interp,
526526
Tk_PathName(entryPtr->tkwin), EntryWidgetObjCmd, entryPtr,
527527
EntryCmdDeletedProc);
528528
entryPtr->optionTable = optionTable;
@@ -596,7 +596,7 @@ static int
596596
EntryWidgetObjCmd(
597597
void *clientData, /* Information about entry widget. */
598598
Tcl_Interp *interp, /* Current interpreter. */
599-
int objc, /* Number of arguments. */
599+
Tcl_Size objc, /* Number of arguments. */
600600
Tcl_Obj *const objv[]) /* Argument objects. */
601601
{
602602
Entry *entryPtr = (Entry *)clientData;
@@ -3771,7 +3771,7 @@ Tk_SpinboxObjCmd(
37713771
entryPtr->tkwin = tkwin;
37723772
entryPtr->display = Tk_Display(tkwin);
37733773
entryPtr->interp = interp;
3774-
entryPtr->widgetCmd = Tcl_CreateObjCommand(interp,
3774+
entryPtr->widgetCmd = Tcl_CreateObjCommand2(interp,
37753775
Tk_PathName(entryPtr->tkwin), SpinboxWidgetObjCmd, sbPtr,
37763776
EntryCmdDeletedProc);
37773777
entryPtr->optionTable = optionTable;
@@ -3863,7 +3863,7 @@ static int
38633863
SpinboxWidgetObjCmd(
38643864
void *clientData, /* Information about spinbox widget. */
38653865
Tcl_Interp *interp, /* Current interpreter. */
3866-
int objc, /* Number of arguments. */
3866+
Tcl_Size objc, /* Number of arguments. */
38673867
Tcl_Obj *const objv[]) /* Argument objects. */
38683868
{
38693869
Entry *entryPtr = (Entry *)clientData;

generic/tkFrame.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static void FrameRequestProc(void *clientData,
339339
Tk_Window tkwin);
340340
static void FrameStructureProc(void *clientData,
341341
XEvent *eventPtr);
342-
static Tcl_ObjCmdProc FrameWidgetObjCmd;
342+
static Tcl_ObjCmdProc2 FrameWidgetObjCmd;
343343
static void FrameWorldChanged(void *instanceData);
344344
static void MapFrame(void *clientData);
345345

@@ -621,7 +621,7 @@ TkCreateFrame(
621621
framePtr->tkwin = newWin;
622622
framePtr->display = Tk_Display(newWin);
623623
framePtr->interp = interp;
624-
framePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(newWin),
624+
framePtr->widgetCmd = Tcl_CreateObjCommand2(interp, Tk_PathName(newWin),
625625
FrameWidgetObjCmd, framePtr, FrameCmdDeletedProc);
626626
framePtr->optionTable = optionTable;
627627
framePtr->type = type;
@@ -697,7 +697,7 @@ static int
697697
FrameWidgetObjCmd(
698698
void *clientData, /* Information about frame widget. */
699699
Tcl_Interp *interp, /* Current interpreter. */
700-
int objc, /* Number of arguments. */
700+
Tcl_Size objc, /* Number of arguments. */
701701
Tcl_Obj *const objv[]) /* Argument objects. */
702702
{
703703
static const char *const frameOptions[] = {
@@ -2098,7 +2098,7 @@ TkToplevelWindowForCommand(
20982098
if (Tcl_GetCommandInfo(interp, cmdName, &cmdInfo) == 0) {
20992099
return NULL;
21002100
}
2101-
if (cmdInfo.objProc != FrameWidgetObjCmd) {
2101+
if (cmdInfo.objProc2 != FrameWidgetObjCmd) {
21022102
return NULL;
21032103
}
21042104
framePtr = (Frame *)cmdInfo.objClientData;

generic/tkIcu.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int
6565
startEndOfCmd(
6666
void *clientData,
6767
Tcl_Interp *interp,
68-
int objc,
68+
Tcl_Size objc,
6969
Tcl_Obj *const objv[])
7070
{
7171
Tcl_DString ds;
@@ -304,15 +304,15 @@ Icu_Init(
304304
Tcl_MutexUnlock(&icu_mutex);
305305

306306
if (icu_fns.lib != NULL) {
307-
Tcl_CreateObjCommand(interp, "::tk::startOfCluster", startEndOfCmd,
307+
Tcl_CreateObjCommand2(interp, "::tk::startOfCluster", startEndOfCmd,
308308
INT2PTR(0), icuCleanup);
309-
Tcl_CreateObjCommand(interp, "::tk::startOfNextWord", startEndOfCmd,
309+
Tcl_CreateObjCommand2(interp, "::tk::startOfNextWord", startEndOfCmd,
310310
INT2PTR(FLAG_WORD|FLAG_FOLLOWING), icuCleanup);
311-
Tcl_CreateObjCommand(interp, "::tk::startOfPreviousWord", startEndOfCmd,
311+
Tcl_CreateObjCommand2(interp, "::tk::startOfPreviousWord", startEndOfCmd,
312312
INT2PTR(FLAG_WORD), icuCleanup);
313-
Tcl_CreateObjCommand(interp, "::tk::endOfCluster", startEndOfCmd,
313+
Tcl_CreateObjCommand2(interp, "::tk::endOfCluster", startEndOfCmd,
314314
INT2PTR(FLAG_FOLLOWING), icuCleanup);
315-
Tcl_CreateObjCommand(interp, "::tk::endOfWord", startEndOfCmd,
315+
Tcl_CreateObjCommand2(interp, "::tk::endOfWord", startEndOfCmd,
316316
INT2PTR(FLAG_WORD|FLAG_FOLLOWING|FLAG_SPACE), icuCleanup);
317317
icu_fns.nopen += 5;
318318
}

generic/tkImgBmap.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ typedef struct ParseInfo {
145145
* Prototypes for procedures used only locally in this file:
146146
*/
147147

148-
static int ImgBmapCmd(void *clientData, Tcl_Interp *interp,
149-
int objc, Tcl_Obj *const objv[]);
148+
static Tcl_ObjCmdProc2 ImgBmapCmd;
150149
static void ImgBmapCmdDeletedProc(void *clientData);
151150
static void ImgBmapConfigureInstance(BitmapInstance *instancePtr);
152151
static int ImgBmapConfigureModel(BitmapModel *modelPtr,
@@ -187,7 +186,7 @@ ImgBmapCreate(
187186

188187
modelPtr->tkModel = model;
189188
modelPtr->interp = interp;
190-
modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd,
189+
modelPtr->imageCmd = Tcl_CreateObjCommand2(interp, name, ImgBmapCmd,
191190
modelPtr, ImgBmapCmdDeletedProc);
192191
modelPtr->width = modelPtr->height = 0;
193192
modelPtr->data = NULL;
@@ -742,7 +741,7 @@ static int
742741
ImgBmapCmd(
743742
void *clientData, /* Information about the image model. */
744743
Tcl_Interp *interp, /* Current interpreter. */
745-
int objc, /* Number of arguments. */
744+
Tcl_Size objc, /* Number of arguments. */
746745
Tcl_Obj *const objv[]) /* Argument objects. */
747746
{
748747
static const char *const bmapOptions[] = {"cget", "configure", NULL};

generic/tkImgPhoto.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ static const Tk_ConfigSpec configSpecs[] = {
185185
*/
186186

187187
static void PhotoFormatThreadExitProc(void *clientData);
188-
static int ImgPhotoCmd(void *clientData, Tcl_Interp *interp,
189-
int objc, Tcl_Obj *const objv[]);
188+
static Tcl_ObjCmdProc2 ImgPhotoCmd;
190189
static int ParseSubcommandOptions(
191190
struct SubcommandOptions *optPtr,
192191
Tcl_Interp *interp, int allowedOptions,
@@ -370,7 +369,7 @@ ImgPhotoCreate(
370369
memset(modelPtr, 0, sizeof(PhotoModel));
371370
modelPtr->tkModel = model;
372371
modelPtr->interp = interp;
373-
modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
372+
modelPtr->imageCmd = Tcl_CreateObjCommand2(interp, name, ImgPhotoCmd,
374373
modelPtr, ImgPhotoCmdDeletedProc);
375374
modelPtr->palette = NULL;
376375
modelPtr->pix32 = NULL;
@@ -412,7 +411,7 @@ static int
412411
ImgPhotoCmd(
413412
void *clientData, /* Information about photo model. */
414413
Tcl_Interp *interp, /* Current interpreter. */
415-
int objc, /* Number of arguments. */
414+
Tcl_Size objc, /* Number of arguments. */
416415
Tcl_Obj *const objv[]) /* Argument objects. */
417416
{
418417
static const char *const photoOptions[] = {

generic/tkInt.decls

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ declare 31 {
135135
}
136136
declare 32 {
137137
TkCursor *TkGetCursorByName(Tcl_Interp *interp,
138-
Tk_Window tkwin, Tk_Uid string)
138+
Tk_Window tkwin, const char *string)
139139
}
140140
declare 33 {
141141
const char *TkGetDefaultScreenName(Tcl_Interp *interp,

generic/tkInt.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ MODULE_SCOPE Tcl_ObjCmdProc Tk_RaiseObjCmd;
11681168
MODULE_SCOPE Tcl_ObjCmdProc Tk_ScaleObjCmd;
11691169
MODULE_SCOPE Tcl_ObjCmdProc Tk_ScrollbarObjCmd;
11701170
MODULE_SCOPE Tcl_ObjCmdProc Tk_SelectionObjCmd;
1171-
MODULE_SCOPE Tcl_ObjCmdProc Tk_SendObjCmd;
1171+
MODULE_SCOPE Tcl_ObjCmdProc2 Tk_SendObjCmd;
11721172
MODULE_SCOPE Tcl_ObjCmdProc Tk_SpinboxObjCmd;
11731173
MODULE_SCOPE Tcl_ObjCmdProc Tk_TextObjCmd;
11741174
MODULE_SCOPE Tcl_ObjCmdProc Tk_TkwaitObjCmd;

generic/tkIntDecls.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ EXTERN void TkGetButtPoints(double p1[], double p2[],
133133
double m2[]);
134134
/* 32 */
135135
EXTERN TkCursor * TkGetCursorByName(Tcl_Interp *interp,
136-
Tk_Window tkwin, Tk_Uid string);
136+
Tk_Window tkwin, const char *string);
137137
/* 33 */
138138
EXTERN const char * TkGetDefaultScreenName(Tcl_Interp *interp,
139139
const char *screenName);
@@ -582,7 +582,7 @@ typedef struct TkIntStubs {
582582
void (*tkpFreeCursor) (TkCursor *cursorPtr); /* 29 */
583583
char * (*tkGetBitmapData) (Tcl_Interp *interp, const char *string, const char *fileName, int *widthPtr, int *heightPtr, int *hotXPtr, int *hotYPtr); /* 30 */
584584
void (*tkGetButtPoints) (double p1[], double p2[], double width, int project, double m1[], double m2[]); /* 31 */
585-
TkCursor * (*tkGetCursorByName) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid string); /* 32 */
585+
TkCursor * (*tkGetCursorByName) (Tcl_Interp *interp, Tk_Window tkwin, const char *string); /* 32 */
586586
const char * (*tkGetDefaultScreenName) (Tcl_Interp *interp, const char *screenName); /* 33 */
587587
TkDisplay * (*tkGetDisplay) (Display *display); /* 34 */
588588
Tcl_Size (*tkGetDisplayOf) (Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window *tkwinPtr); /* 35 */

generic/tkListbox.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ static int ListboxSelect(Listbox *listPtr,
409409
int first, int last, int select);
410410
static void ListboxUpdateHScrollbar(Listbox *listPtr);
411411
static void ListboxUpdateVScrollbar(Listbox *listPtr);
412-
static Tcl_ObjCmdProc ListboxWidgetObjCmd;
412+
static Tcl_ObjCmdProc2 ListboxWidgetObjCmd;
413413
static int ListboxBboxSubCmd(Tcl_Interp *interp,
414414
Listbox *listPtr, int index);
415415
static int ListboxSelectionSubCmd(Tcl_Interp *interp,
@@ -519,7 +519,7 @@ Tk_ListboxObjCmd(
519519
listPtr->tkwin = tkwin;
520520
listPtr->display = Tk_Display(tkwin);
521521
listPtr->interp = interp;
522-
listPtr->widgetCmd = Tcl_CreateObjCommand(interp,
522+
listPtr->widgetCmd = Tcl_CreateObjCommand2(interp,
523523
Tk_PathName(listPtr->tkwin), ListboxWidgetObjCmd, listPtr,
524524
ListboxCmdDeletedProc);
525525
listPtr->optionTable = optionTables->listboxOptionTable;
@@ -591,7 +591,7 @@ static int
591591
ListboxWidgetObjCmd(
592592
void *clientData, /* Information about listbox widget. */
593593
Tcl_Interp *interp, /* Current interpreter. */
594-
int objc, /* Number of arguments. */
594+
Tcl_Size objc, /* Number of arguments. */
595595
Tcl_Obj *const objv[]) /* Arguments as Tcl_Obj's. */
596596
{
597597
Listbox *listPtr = (Listbox *)clientData;

generic/tkMenu.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ static TkMenuEntry * MenuNewEntry(TkMenu *menuPtr, Tcl_Size index, int type);
349349
static char * MenuVarProc(void *clientData,
350350
Tcl_Interp *interp, const char *name1,
351351
const char *name2, int flags);
352-
static Tcl_ObjCmdProc MenuWidgetObjCmd;
352+
static Tcl_ObjCmdProc2 MenuWidgetObjCmd;
353353
static void MenuWorldChanged(void *instanceData);
354354
static int PostProcessEntry(TkMenuEntry *mePtr);
355355
static void RecursivelyDeleteMenu(TkMenu *menuPtr);
@@ -443,7 +443,7 @@ Tk_MenuObjCmd(
443443
menuPtr->tkwin = newWin;
444444
menuPtr->display = Tk_Display(newWin);
445445
menuPtr->interp = interp;
446-
menuPtr->widgetCmd = Tcl_CreateObjCommand(interp,
446+
menuPtr->widgetCmd = Tcl_CreateObjCommand2(interp,
447447
Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr,
448448
MenuCmdDeletedProc);
449449
menuPtr->active = TCL_INDEX_NONE;
@@ -608,7 +608,7 @@ static int
608608
MenuWidgetObjCmd(
609609
void *clientData, /* Information about menu widget. */
610610
Tcl_Interp *interp, /* Current interpreter. */
611-
int objc, /* Number of arguments. */
611+
Tcl_Size objc, /* Number of arguments. */
612612
Tcl_Obj *const objv[]) /* Argument strings. */
613613
{
614614
TkMenu *menuPtr = (TkMenu *)clientData;

0 commit comments

Comments
 (0)