summaryrefslogtreecommitdiffstats
path: root/generic/tkTest.c
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2020-05-24 15:44:22 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2020-05-24 15:44:22 (GMT)
commite9d72bbaa4a4cef256b3d3480ed1136b8651d019 (patch)
tree5b555bb43f3c32b4ff86fe07b3b06f5000ade4d9 /generic/tkTest.c
parenta48a5b55179978d3f31371c90d9be6eaa6931f17 (diff)
parentad1ded4a7f409e06bd6e1b33da463e6c7cd844af (diff)
downloadtk-e9d72bbaa4a4cef256b3d3480ed1136b8651d019.zip
tk-e9d72bbaa4a4cef256b3d3480ed1136b8651d019.tar.gz
tk-e9d72bbaa4a4cef256b3d3480ed1136b8651d019.tar.bz2
Merge trunk
Diffstat (limited to 'generic/tkTest.c')
-rw-r--r--generic/tkTest.c273
1 files changed, 150 insertions, 123 deletions
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 2061893..97b33fc 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -31,9 +31,9 @@
#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#include "tkScrollbar.h"
-#define APP_IS_DRAWING TkTestAppIsDrawing()
+#define LOG_DISPLAY TkTestLogDisplay()
#else
-#define APP_IS_DRAWING 0
+#define LOG_DISPLAY 1
#endif
#ifdef __UNIX__
@@ -48,7 +48,14 @@
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
+#ifdef __cplusplus
+extern "C" {
+#endif
EXTERN int Tktest_Init(Tcl_Interp *interp);
+#ifdef __cplusplus
+}
+#endif
+
/*
* The following data structure represents the master for a test image:
*/
@@ -218,7 +225,7 @@ static int TestPhotoStringMatchCmd(ClientData dummy,
*
* Tktest_Init --
*
- * This function performs intialization for the Tk test suite exensions.
+ * This function performs initialization for the Tk test suite extensions.
*
* Results:
* Returns a standard Tcl completion code, and leaves an error message in
@@ -332,7 +339,6 @@ Tktest_Init(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestbitmapObjCmd(
ClientData clientData, /* Main window for application. */
@@ -340,6 +346,7 @@ TestbitmapObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
+ (void)clientData;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "bitmap");
@@ -367,7 +374,6 @@ TestbitmapObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestborderObjCmd(
ClientData clientData, /* Main window for application. */
@@ -375,6 +381,7 @@ TestborderObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
+ (void)clientData;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "border");
@@ -402,7 +409,6 @@ TestborderObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestcolorObjCmd(
ClientData clientData, /* Main window for application. */
@@ -410,6 +416,8 @@ TestcolorObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
+ (void)clientData;
+
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "color");
return TCL_ERROR;
@@ -436,7 +444,6 @@ TestcolorObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestcursorObjCmd(
ClientData clientData, /* Main window for application. */
@@ -444,6 +451,8 @@ TestcursorObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
+ (void)clientData;
+
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "cursor");
return TCL_ERROR;
@@ -471,7 +480,6 @@ TestcursorObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestdeleteappsObjCmd(
ClientData clientData, /* Main window for application. */
@@ -480,6 +488,10 @@ TestdeleteappsObjCmd(
Tcl_Obj *const objv[]) /* Argument strings. */
{
NewApp *nextPtr;
+ (void)clientData;
+ (void)interp;
+ (void)objc;
+ (void)objv;
while (newAppPtr != NULL) {
nextPtr = newAppPtr->nextPtr;
@@ -508,7 +520,6 @@ TestdeleteappsObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestobjconfigObjCmd(
ClientData clientData, /* Main window for application. */
@@ -537,7 +548,7 @@ TestobjconfigObjCmd(
CustomOptionFree,
INT2PTR(1)
};
- Tk_Window mainWin = clientData;
+ Tk_Window mainWin = (Tk_Window)clientData;
Tk_Window tkwin;
int index, result = TCL_OK;
@@ -556,9 +567,9 @@ TestobjconfigObjCmd(
} ExtensionWidgetRecord;
static const Tk_OptionSpec baseSpecs[] = {
{TK_OPTION_STRING, "-one", "one", "One", "one",
- Tk_Offset(ExtensionWidgetRecord, base1ObjPtr), -1, 0, NULL, 0},
+ offsetof(ExtensionWidgetRecord, base1ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING, "-two", "two", "Two", "two",
- Tk_Offset(ExtensionWidgetRecord, base2ObjPtr), -1, 0, NULL, 0},
+ offsetof(ExtensionWidgetRecord, base2ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
@@ -600,50 +611,50 @@ TestobjconfigObjCmd(
};
static const Tk_OptionSpec typesSpecs[] = {
{TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1",
- Tk_Offset(TypesRecord, booleanPtr), -1, 0, 0, 0x1},
+ offsetof(TypesRecord, booleanPtr), TCL_INDEX_NONE, 0, 0, 0x1},
{TK_OPTION_INT, "-integer", "integer", "Integer", "7",
- Tk_Offset(TypesRecord, integerPtr), -1, 0, 0, 0x2},
+ offsetof(TypesRecord, integerPtr), TCL_INDEX_NONE, 0, 0, 0x2},
{TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159",
- Tk_Offset(TypesRecord, doublePtr), -1, 0, 0, 0x4},
+ offsetof(TypesRecord, doublePtr), TCL_INDEX_NONE, 0, 0, 0x4},
{TK_OPTION_STRING, "-string", "string", "String",
- "foo", Tk_Offset(TypesRecord, stringPtr), -1,
+ "foo", offsetof(TypesRecord, stringPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x8},
{TK_OPTION_STRING_TABLE,
"-stringtable", "StringTable", "stringTable",
- "one", Tk_Offset(TypesRecord, stringTablePtr), -1,
+ "one", offsetof(TypesRecord, stringTablePtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, stringTable, 0x10},
{TK_OPTION_COLOR, "-color", "color", "Color",
- "red", Tk_Offset(TypesRecord, colorPtr), -1,
+ "red", offsetof(TypesRecord, colorPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, "black", 0x20},
{TK_OPTION_FONT, "-font", "font", "Font", "Helvetica 12",
- Tk_Offset(TypesRecord, fontPtr), -1,
+ offsetof(TypesRecord, fontPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x40},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50",
- Tk_Offset(TypesRecord, bitmapPtr), -1,
+ offsetof(TypesRecord, bitmapPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x80},
{TK_OPTION_BORDER, "-border", "border", "Border",
- "blue", Tk_Offset(TypesRecord, borderPtr), -1,
+ "blue", offsetof(TypesRecord, borderPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, "white", 0x100},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised",
- Tk_Offset(TypesRecord, reliefPtr), -1,
+ offsetof(TypesRecord, reliefPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x200},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm",
- Tk_Offset(TypesRecord, cursorPtr), -1,
+ offsetof(TypesRecord, cursorPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x400},
{TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left",
- Tk_Offset(TypesRecord, justifyPtr), -1,
+ offsetof(TypesRecord, justifyPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x800},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL,
- Tk_Offset(TypesRecord, anchorPtr), -1,
+ offsetof(TypesRecord, anchorPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x1000},
{TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel",
- "1", Tk_Offset(TypesRecord, pixelPtr), -1,
+ "1", offsetof(TypesRecord, pixelPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, 0, 0x2000},
{TK_OPTION_CUSTOM, "-custom", NULL, NULL,
- "", Tk_Offset(TypesRecord, customPtr), -1,
+ "", offsetof(TypesRecord, customPtr), TCL_INDEX_NONE,
TK_CONFIG_NULL_OK, &CustomOption, 0x4000},
{TK_OPTION_SYNONYM, "-synonym", NULL, NULL,
- NULL, 0, -1, 0, "-color", 0x8000},
+ NULL, 0, TCL_INDEX_NONE, 0, "-color", 0x8000},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
@@ -651,14 +662,14 @@ TestobjconfigObjCmd(
optionTable = Tk_CreateOptionTable(interp, typesSpecs);
tables[index] = optionTable;
- tkwin = Tk_CreateWindowFromPath(interp, clientData,
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
Tk_SetClass(tkwin, "Test");
- recordPtr = ckalloc(sizeof(TypesRecord));
+ recordPtr = (TypesRecord *)ckalloc(sizeof(TypesRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -706,7 +717,7 @@ TestobjconfigObjCmd(
Tk_Window tkwin;
Tk_OptionTable optionTable;
- tkwin = Tk_CreateWindowFromPath(interp, clientData,
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
@@ -715,7 +726,7 @@ TestobjconfigObjCmd(
optionTable = Tk_CreateOptionTable(interp, baseSpecs);
tables[index] = optionTable;
- recordPtr = ckalloc(sizeof(ExtensionWidgetRecord));
+ recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -745,21 +756,21 @@ TestobjconfigObjCmd(
ExtensionWidgetRecord *recordPtr;
static const Tk_OptionSpec extensionSpecs[] = {
{TK_OPTION_STRING, "-three", "three", "Three", "three",
- Tk_Offset(ExtensionWidgetRecord, extension3ObjPtr), -1, 0, NULL, 0},
+ offsetof(ExtensionWidgetRecord, extension3ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING, "-four", "four", "Four", "four",
- Tk_Offset(ExtensionWidgetRecord, extension4ObjPtr), -1, 0, NULL, 0},
+ offsetof(ExtensionWidgetRecord, extension4ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING, "-two", "two", "Two", "two and a half",
- Tk_Offset(ExtensionWidgetRecord, base2ObjPtr), -1, 0, NULL, 0},
+ offsetof(ExtensionWidgetRecord, base2ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING,
"-oneAgain", "oneAgain", "OneAgain", "one again",
- Tk_Offset(ExtensionWidgetRecord, extension5ObjPtr), -1, 0, NULL, 0},
- {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0,
+ offsetof(ExtensionWidgetRecord, extension5ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
(ClientData) baseSpecs, 0}
};
Tk_Window tkwin;
Tk_OptionTable optionTable;
- tkwin = Tk_CreateWindowFromPath(interp, clientData,
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
@@ -768,7 +779,7 @@ TestobjconfigObjCmd(
optionTable = Tk_CreateOptionTable(interp, extensionSpecs);
tables[index] = optionTable;
- recordPtr = ckalloc(sizeof(ExtensionWidgetRecord));
+ recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -801,7 +812,7 @@ TestobjconfigObjCmd(
ErrorWidgetRecord widgetRecord;
static const Tk_OptionSpec errorSpecs[] = {
{TK_OPTION_INT, "-int", "integer", "Integer", "bogus",
- Tk_Offset(ErrorWidgetRecord, intPtr), 0, 0, NULL, 0},
+ offsetof(ErrorWidgetRecord, intPtr), 0, 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
@@ -875,53 +886,53 @@ TestobjconfigObjCmd(
};
static const Tk_OptionSpec internalSpecs[] = {
{TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1",
- -1, Tk_Offset(InternalRecord, boolean), 0, 0, 0x1},
+ TCL_INDEX_NONE, offsetof(InternalRecord, boolean), 0, 0, 0x1},
{TK_OPTION_INT, "-integer", "integer", "Integer", "148962237",
- -1, Tk_Offset(InternalRecord, integer), 0, 0, 0x2},
+ TCL_INDEX_NONE, offsetof(InternalRecord, integer), 0, 0, 0x2},
{TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159",
- -1, Tk_Offset(InternalRecord, doubleValue), 0, 0, 0x4},
+ TCL_INDEX_NONE, offsetof(InternalRecord, doubleValue), 0, 0, 0x4},
{TK_OPTION_STRING, "-string", "string", "String", "foo",
- -1, Tk_Offset(InternalRecord, string),
+ TCL_INDEX_NONE, offsetof(InternalRecord, string),
TK_CONFIG_NULL_OK, 0, 0x8},
{TK_OPTION_STRING_TABLE,
"-stringtable", "StringTable", "stringTable", "one",
- -1, Tk_Offset(InternalRecord, index),
+ TCL_INDEX_NONE, offsetof(InternalRecord, index),
TK_CONFIG_NULL_OK, internalStringTable, 0x10},
{TK_OPTION_COLOR, "-color", "color", "Color", "red",
- -1, Tk_Offset(InternalRecord, colorPtr),
+ TCL_INDEX_NONE, offsetof(InternalRecord, colorPtr),
TK_CONFIG_NULL_OK, "black", 0x20},
{TK_OPTION_FONT, "-font", "font", "Font", "Helvetica 12",
- -1, Tk_Offset(InternalRecord, tkfont),
+ TCL_INDEX_NONE, offsetof(InternalRecord, tkfont),
TK_CONFIG_NULL_OK, 0, 0x40},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50",
- -1, Tk_Offset(InternalRecord, bitmap),
+ TCL_INDEX_NONE, offsetof(InternalRecord, bitmap),
TK_CONFIG_NULL_OK, 0, 0x80},
{TK_OPTION_BORDER, "-border", "border", "Border", "blue",
- -1, Tk_Offset(InternalRecord, border),
+ TCL_INDEX_NONE, offsetof(InternalRecord, border),
TK_CONFIG_NULL_OK, "white", 0x100},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised",
- -1, Tk_Offset(InternalRecord, relief),
+ TCL_INDEX_NONE, offsetof(InternalRecord, relief),
TK_CONFIG_NULL_OK, 0, 0x200},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm",
- -1, Tk_Offset(InternalRecord, cursor),
+ TCL_INDEX_NONE, offsetof(InternalRecord, cursor),
TK_CONFIG_NULL_OK, 0, 0x400},
{TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left",
- -1, Tk_Offset(InternalRecord, justify),
+ TCL_INDEX_NONE, offsetof(InternalRecord, justify),
TK_CONFIG_NULL_OK, 0, 0x800},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL,
- -1, Tk_Offset(InternalRecord, anchor),
+ TCL_INDEX_NONE, offsetof(InternalRecord, anchor),
TK_CONFIG_NULL_OK, 0, 0x1000},
{TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel", "1",
- -1, Tk_Offset(InternalRecord, pixels),
+ TCL_INDEX_NONE, offsetof(InternalRecord, pixels),
TK_CONFIG_NULL_OK, 0, 0x2000},
{TK_OPTION_WINDOW, "-window", "window", "Window", NULL,
- -1, Tk_Offset(InternalRecord, tkwin),
+ TCL_INDEX_NONE, offsetof(InternalRecord, tkwin),
TK_CONFIG_NULL_OK, 0, 0},
{TK_OPTION_CUSTOM, "-custom", NULL, NULL, "",
- -1, Tk_Offset(InternalRecord, custom),
+ TCL_INDEX_NONE, offsetof(InternalRecord, custom),
TK_CONFIG_NULL_OK, &CustomOption, 0x4000},
{TK_OPTION_SYNONYM, "-synonym", NULL, NULL,
- NULL, -1, -1, 0, "-color", 0x8000},
+ NULL, TCL_INDEX_NONE, TCL_INDEX_NONE, 0, "-color", 0x8000},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
@@ -929,14 +940,14 @@ TestobjconfigObjCmd(
optionTable = Tk_CreateOptionTable(interp, internalSpecs);
tables[index] = optionTable;
- tkwin = Tk_CreateWindowFromPath(interp, clientData,
+ tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
Tk_SetClass(tkwin, "Test");
- recordPtr = ckalloc(sizeof(InternalRecord));
+ recordPtr = (InternalRecord *)ckalloc(sizeof(InternalRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -992,15 +1003,15 @@ TestobjconfigObjCmd(
FiveRecord *recordPtr;
static const Tk_OptionSpec smallSpecs[] = {
{TK_OPTION_INT, "-one", "one", "One", "1",
- Tk_Offset(FiveRecord, one), -1, 0, NULL, 0},
+ offsetof(FiveRecord, one), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_INT, "-two", "two", "Two", "2",
- Tk_Offset(FiveRecord, two), -1, 0, NULL, 0},
+ offsetof(FiveRecord, two), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_INT, "-three", "three", "Three", "3",
- Tk_Offset(FiveRecord, three), -1, 0, NULL, 0},
+ offsetof(FiveRecord, three), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_INT, "-four", "four", "Four", "4",
- Tk_Offset(FiveRecord, four), -1, 0, NULL, 0},
+ offsetof(FiveRecord, four), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING, "-five", NULL, NULL, NULL,
- Tk_Offset(FiveRecord, five), -1, 0, NULL, 0},
+ offsetof(FiveRecord, five), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
@@ -1009,7 +1020,7 @@ TestobjconfigObjCmd(
return TCL_ERROR;
}
- recordPtr = ckalloc(sizeof(FiveRecord));
+ recordPtr = (FiveRecord *)ckalloc(sizeof(FiveRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
smallSpecs);
@@ -1046,7 +1057,7 @@ TestobjconfigObjCmd(
NotEnoughRecord record;
static const Tk_OptionSpec errorSpecs[] = {
{TK_OPTION_INT, "-foo", "foo", "Foo", "0",
- Tk_Offset(NotEnoughRecord, fooObjPtr), 0, 0, NULL, 0},
+ offsetof(NotEnoughRecord, fooObjPtr), 0, 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tcl_Obj *newObjPtr = Tcl_NewStringObj("-foo", -1);
@@ -1077,18 +1088,18 @@ TestobjconfigObjCmd(
SlaveRecord *recordPtr;
static const Tk_OptionSpec slaveSpecs[] = {
{TK_OPTION_WINDOW, "-window", "window", "Window", ".bar",
- Tk_Offset(SlaveRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0},
+ offsetof(SlaveRecord, windowPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_Window tkwin = Tk_CreateWindowFromPath(interp,
- clientData, Tcl_GetString(objv[2]), NULL);
+ (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
Tk_SetClass(tkwin, "Test");
- recordPtr = ckalloc(sizeof(SlaveRecord));
+ recordPtr = (SlaveRecord *)ckalloc(sizeof(SlaveRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
slaveSpecs);
@@ -1141,7 +1152,6 @@ TestobjconfigObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TrivialConfigObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1158,7 +1168,7 @@ TrivialConfigObjCmd(
};
Tcl_Obj *resultObjPtr;
int index, mask;
- TrivialCommandHeader *headerPtr = clientData;
+ TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData;
Tk_Window tkwin = headerPtr->tkwin;
Tk_SavedOptions saved;
@@ -1212,7 +1222,7 @@ TrivialConfigObjCmd(
headerPtr->optionTable, objc - 2, objv + 2,
tkwin, NULL, &mask);
if (result == TCL_OK) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(mask));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(mask));
}
}
break;
@@ -1222,7 +1232,7 @@ TrivialConfigObjCmd(
tkwin, &saved, &mask);
Tk_FreeSavedOptions(&saved);
if (result == TCL_OK) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(mask));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(mask));
}
break;
}
@@ -1253,7 +1263,7 @@ static void
TrivialCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TrivialCommandHeader *headerPtr = clientData;
+ TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData;
Tk_Window tkwin = headerPtr->tkwin;
if (tkwin != NULL) {
@@ -1292,7 +1302,7 @@ TrivialEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TrivialCommandHeader *headerPtr = clientData;
+ TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData;
if (eventPtr->type == DestroyNotify) {
if (headerPtr->tkwin != NULL) {
@@ -1324,7 +1334,6 @@ TrivialEventProc(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestfontObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1338,7 +1347,7 @@ TestfontObjCmd(
Tk_Window tkwin;
Tk_Font tkfont;
- tkwin = clientData;
+ tkwin = (Tk_Window)clientData;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "option fontName");
@@ -1384,7 +1393,6 @@ TestfontObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ImageCreate(
Tcl_Interp *interp, /* Interpreter for application containing
@@ -1402,6 +1410,7 @@ ImageCreate(
TImageMaster *timPtr;
const char *varName;
int i;
+ (void)typePtr;
varName = "log";
for (i = 0; i < objc; i += 2) {
@@ -1418,14 +1427,14 @@ ImageCreate(
varName = Tcl_GetString(objv[i+1]);
}
- timPtr = ckalloc(sizeof(TImageMaster));
+ timPtr = (TImageMaster *)ckalloc(sizeof(TImageMaster));
timPtr->master = master;
timPtr->interp = interp;
timPtr->width = 30;
timPtr->height = 15;
- timPtr->imageName = ckalloc(strlen(name) + 1);
+ timPtr->imageName = (char *)ckalloc(strlen(name) + 1);
strcpy(timPtr->imageName, name);
- timPtr->varName = ckalloc(strlen(varName) + 1);
+ timPtr->varName = (char *)ckalloc(strlen(varName) + 1);
strcpy(timPtr->varName, varName);
Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL);
*clientDataPtr = timPtr;
@@ -1450,7 +1459,6 @@ ImageCreate(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ImageObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1458,7 +1466,7 @@ ImageObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- TImageMaster *timPtr = clientData;
+ TImageMaster *timPtr = (TImageMaster *)clientData;
int x, y, width, height;
if (objc < 2) {
@@ -1513,7 +1521,7 @@ ImageGet(
* used. */
ClientData clientData) /* Pointer to TImageMaster for image. */
{
- TImageMaster *timPtr = clientData;
+ TImageMaster *timPtr = (TImageMaster *)clientData;
TImageInstance *instPtr;
char buffer[100];
XGCValues gcValues;
@@ -1522,7 +1530,7 @@ ImageGet(
Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer,
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
- instPtr = ckalloc(sizeof(TImageInstance));
+ instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance));
instPtr->masterPtr = timPtr;
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
@@ -1560,31 +1568,42 @@ ImageDisplay(
/* Coordinates in drawable corresponding to
* imageX and imageY. */
{
- TImageInstance *instPtr = clientData;
+ TImageInstance *instPtr = (TImageInstance *)clientData;
char buffer[200 + TCL_INTEGER_SPACE * 6];
/*
* The purpose of the test image type is to track the calls to an image
* display proc and record the parameters passed in each call. On macOS
- * these tests will fail because of the asynchronous drawing. The low
- * level graphics calls below which are supposed to draw a rectangle will
- * not draw anything to the screen because the idle task will not be
- * processed inside of the drawRect method and hence will not be able to
- * obtain a valid graphics context. Instead, the window will be marked as
- * needing display, and will be redrawn during a future asynchronous call
- * to drawRect. This will generate an other call to this display proc,
- * and the recorded data will show extra calls, causing the test to fail.
- * To avoid this, we can set the [NSApp simulateDrawing] flag, which will
- * cause all low level drawing routines to return immediately and not
- * schedule the window for drawing later. This flag is cleared by the
- * next call to XSync, which is called by the update command.
+ * a display proc must be run inside of the drawRect method of an NSView
+ * in order for the graphics operations to have any effect. To deal with
+ * this, whenever a display proc is called outside of any drawRect method
+ * it schedules a redraw of the NSView by calling [view setNeedsDisplay:YES].
+ * This will trigger a later call to the view's drawRect method which will
+ * run the display proc a second time.
+ *
+ * This complicates testing, since it can result in more calls to the display
+ * proc than are expected by the test. It can also result in an inconsistent
+ * number of calls unless the test waits until the call to drawRect actually
+ * occurs before validating its results.
+ *
+ * In an attempt to work around this, this display proc only logs those
+ * calls which occur within a drawRect method. This means that tests must
+ * be written so as to ensure that the drawRect method is run before
+ * results are validated. In practice it usually suffices to run update
+ * idletasks (to run the display proc the first time) followed by update
+ * (to run the display proc in drawRect).
+ *
+ * This also has the consequence that the image changed command will log
+ * different results on Aqua than on other systems, because when the image
+ * is redisplayed in the drawRect method the entire image will be drawn,
+ * not just the changed portion. Tests must account for this.
*/
- sprintf(buffer, "%s display %d %d %d %d",
- instPtr->masterPtr->imageName, imageX, imageY, width, height);
- if (!APP_IS_DRAWING) {
+ if (LOG_DISPLAY) {
+ sprintf(buffer, "%s display %d %d %d %d",
+ instPtr->masterPtr->imageName, imageX, imageY, width, height);
Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName,
- NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
}
if (width > (instPtr->masterPtr->width - imageX)) {
width = instPtr->masterPtr->width - imageX;
@@ -1624,7 +1643,7 @@ ImageFree(
ClientData clientData, /* Pointer to TImageInstance for instance. */
Display *display) /* Display where image was to be drawn. */
{
- TImageInstance *instPtr = clientData;
+ TImageInstance *instPtr = (TImageInstance *)clientData;
char buffer[200];
sprintf(buffer, "%s free", instPtr->masterPtr->imageName);
@@ -1658,7 +1677,7 @@ ImageDelete(
* this function is called, no more instances
* exist. */
{
- TImageMaster *timPtr = clientData;
+ TImageMaster *timPtr = (TImageMaster *)clientData;
char buffer[100];
sprintf(buffer, "%s delete", timPtr->imageName);
@@ -1689,7 +1708,6 @@ ImageDelete(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestmakeexistObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1697,7 +1715,7 @@ TestmakeexistObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- Tk_Window mainWin = clientData;
+ Tk_Window mainWin = (Tk_Window)clientData;
int i;
Tk_Window tkwin;
@@ -1730,7 +1748,6 @@ TestmakeexistObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
#if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__))
static int
TestmenubarObjCmd(
@@ -1740,7 +1757,7 @@ TestmenubarObjCmd(
Tcl_Obj *const objv[]) /* Argument strings. */
{
#ifdef __UNIX__
- Tk_Window mainWin = clientData;
+ Tk_Window mainWin = (Tk_Window)clientData;
Tk_Window tkwin, menubar;
if (objc < 2) {
@@ -1800,13 +1817,14 @@ TestmenubarObjCmd(
#if defined(_WIN32)
static int
TestmetricsObjCmd(
- ClientData clientData, /* Main window for application. */
+ ClientData dummy, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
char buf[TCL_INTEGER_SPACE];
int val;
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
@@ -1845,7 +1863,6 @@ TestmetricsObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestpropObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1853,7 +1870,7 @@ TestpropObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- Tk_Window mainWin = clientData;
+ Tk_Window mainWin = (Tk_Window)clientData;
int result, actualFormat;
unsigned long bytesAfter, length, value;
Atom actualType, propName;
@@ -1922,10 +1939,9 @@ TestpropObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestprintfObjCmd(
- ClientData clientData, /* Not used */
+ ClientData dummy, /* Not used */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
@@ -1937,6 +1953,7 @@ TestprintfObjCmd(
#else
long long longLongInt;
#endif
+ (void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "wideint");
@@ -1978,7 +1995,6 @@ TestprintfObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestwrapperObjCmd(
ClientData clientData, /* Main window for application. */
@@ -1994,7 +2010,7 @@ TestwrapperObjCmd(
return TCL_ERROR;
}
- tkwin = clientData;
+ tkwin = (Tk_Window)clientData;
winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[1]), tkwin);
if (winPtr == NULL) {
return TCL_ERROR;
@@ -2039,7 +2055,7 @@ TestwrapperObjCmd(
static int
CustomOptionSet(
- ClientData clientData,
+ ClientData dummy,
Tcl_Interp *interp,
Tk_Window tkwin,
Tcl_Obj **value,
@@ -2050,6 +2066,8 @@ CustomOptionSet(
{
int objEmpty;
char *newStr, *string, *internalPtr;
+ (void)dummy;
+ (void)tkwin;
objEmpty = 0;
@@ -2086,7 +2104,7 @@ CustomOptionSet(
if (internalPtr != NULL) {
if (*value != NULL) {
string = Tcl_GetString(*value);
- newStr = ckalloc((*value)->length + 1);
+ newStr = (char *)ckalloc((*value)->length + 1);
strcpy(newStr, string);
} else {
newStr = NULL;
@@ -2100,31 +2118,40 @@ CustomOptionSet(
static Tcl_Obj *
CustomOptionGet(
- ClientData clientData,
+ ClientData dummy,
Tk_Window tkwin,
char *recordPtr,
int internalOffset)
{
+ (void)dummy;
+ (void)tkwin;
+
return (Tcl_NewStringObj(*(char **)(recordPtr + internalOffset), -1));
}
static void
CustomOptionRestore(
- ClientData clientData,
+ ClientData dummy,
Tk_Window tkwin,
char *internalPtr,
char *saveInternalPtr)
{
+ (void)dummy;
+ (void)tkwin;
+
*(char **)internalPtr = *(char **)saveInternalPtr;
return;
}
static void
CustomOptionFree(
- ClientData clientData,
+ ClientData dummy,
Tk_Window tkwin,
char *internalPtr)
{
+ (void)dummy;
+ (void)tkwin;
+
if (*(char **)internalPtr != NULL) {
ckfree(*(char **)internalPtr);
}
@@ -2150,7 +2177,6 @@ CustomOptionFree(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
TestPhotoStringMatchCmd(
ClientData clientData, /* Main window for application. */
@@ -2161,14 +2187,15 @@ TestPhotoStringMatchCmd(
Tcl_Obj *dummy = NULL;
Tcl_Obj *resultObj[2];
int width, height;
+ (void)clientData;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "imageData");
return TCL_ERROR;
}
if (TkDebugPhotoStringMatchDef(interp, objv[1], dummy, &width, &height)) {
- resultObj[0] = Tcl_NewIntObj(width);
- resultObj[1] = Tcl_NewIntObj(height);
+ resultObj[0] = Tcl_NewWideIntObj(width);
+ resultObj[1] = Tcl_NewWideIntObj(height);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, resultObj));
return TCL_OK;
} else {