summaryrefslogtreecommitdiffstats
path: root/generic/tkOldTest.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkOldTest.c')
-rw-r--r--generic/tkOldTest.c72
1 files changed, 37 insertions, 35 deletions
diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c
index b4d7f04..82b8ef2 100644
--- a/generic/tkOldTest.c
+++ b/generic/tkOldTest.c
@@ -6,9 +6,9 @@
* interfaces. These commands are not normally included in Tcl/Tk
* applications; they're only used for testing.
*
- * Copyright (c) 1993-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 Scriptics Corporation.
+ * Copyright © 1993-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
* Contributions by Don Porter, NIST, 2007. (not subject to US copyright)
*
* See the file "license.terms" for information on usage and redistribution of
@@ -28,6 +28,7 @@
#include "tkWinInt.h"
#endif
+#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
/*
* The following data structure represents the model for a test image:
*/
@@ -57,17 +58,17 @@ typedef struct TImageInstance {
*/
static int ImageCreate(Tcl_Interp *interp,
- char *name, int argc, char **argv,
+ 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 */
@@ -85,10 +86,8 @@ 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
/*
*----------------------------------------------------------------------
@@ -110,13 +109,16 @@ static int ImageObjCmd(ClientData dummy,
int
TkOldTestInit(
- Tcl_Interp *interp)
+ Tcl_Interp *dummy)
{
static int initialized = 0;
+ (void)dummy;
if (!initialized) {
initialized = 1;
+#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
Tk_CreateImageType(&imageType);
+#endif
}
return TCL_OK;
}
@@ -136,25 +138,25 @@ TkOldTestInit(
*
*----------------------------------------------------------------------
*/
-
- /* ARGSUSED */
+#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
static int
ImageCreate(
Tcl_Interp *interp, /* Interpreter for application containing
* image. */
char *name, /* Name to use for image. */
- int argc, /* Number of arguments. */
+ Tcl_Size argc, /* Number of arguments. */
char **argv, /* Argument strings for options (doesn't
* include image name or type). */
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;
const char *varName;
- int i;
+ Tcl_Size i;
+ (void)typePtr;
varName = "log";
for (i = 0; i < argc; i += 2) {
@@ -171,14 +173,14 @@ ImageCreate(
varName = argv[i+1];
}
- timPtr = ckalloc(sizeof(TImageModel));
+ timPtr = (TImageModel *)ckalloc(sizeof(TImageModel));
timPtr->model = model;
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;
@@ -203,15 +205,14 @@ ImageCreate(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
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. */
{
- TImageModel *timPtr = clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
int x, y, width, height;
if (objc < 2) {
@@ -260,13 +261,13 @@ 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 = clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
TImageInstance *instPtr;
char buffer[100];
XGCValues gcValues;
@@ -275,7 +276,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->modelPtr = timPtr;
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
@@ -303,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
@@ -313,7 +314,7 @@ ImageDisplay(
/* Coordinates in drawable corresponding to
* imageX and imageY. */
{
- TImageInstance *instPtr = clientData;
+ TImageInstance *instPtr = (TImageInstance *)clientData;
char buffer[200 + TCL_INTEGER_SPACE * 6];
snprintf(buffer, sizeof(buffer), "%s display %d %d %d %d %d %d",
@@ -355,10 +356,10 @@ 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 = clientData;
+ TImageInstance *instPtr = (TImageInstance *)clientData;
char buffer[200];
snprintf(buffer, sizeof(buffer), "%s free", instPtr->modelPtr->imageName);
@@ -388,11 +389,11 @@ 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. */
{
- TImageModel *timPtr = clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
char buffer[100];
snprintf(buffer, sizeof(buffer), "%s delete", timPtr->imageName);
@@ -404,6 +405,7 @@ ImageDelete(
ckfree(timPtr->varName);
ckfree(timPtr);
}
+#endif
/*
* Local Variables: