diff options
Diffstat (limited to 'generic/tkOldTest.c')
-rw-r--r-- | generic/tkOldTest.c | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c index 2e931b1..cfbce23 100644 --- a/generic/tkOldTest.c +++ b/generic/tkOldTest.c @@ -16,12 +16,6 @@ */ #define USE_OLD_IMAGE -#ifndef USE_TCL_STUBS -# define USE_TCL_STUBS -#endif -#ifndef USE_TK_STUBS -# define USE_TK_STUBS -#endif #include "tkInt.h" /* @@ -73,8 +67,7 @@ static Tk_ImageType imageType = { ImageFree, /* freeProc */ ImageDelete, /* deleteProc */ NULL, /* postscriptPtr */ - NULL, /* nextPtr */ - NULL + NULL /* nextPtr */ }; /* @@ -82,7 +75,8 @@ static Tk_ImageType imageType = { */ static int ImageCmd(ClientData dummy, - Tcl_Interp *interp, int argc, const char **argv); + Tcl_Interp *interp, int argc, CONST char **argv); +MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp); /* @@ -148,7 +142,7 @@ ImageCreate( * will be returned in later callbacks. */ { TImageMaster *timPtr; - const char *varName; + char *varName; int i; varName = "log"; @@ -166,17 +160,17 @@ ImageCreate( varName = argv[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((unsigned) (strlen(name) + 1)); + timPtr->imageName = (char *) ckalloc((unsigned) (strlen(name) + 1)); strcpy(timPtr->imageName, name); - timPtr->varName = ckalloc((unsigned) (strlen(varName) + 1)); + timPtr->varName = (char *) ckalloc((unsigned) (strlen(varName) + 1)); strcpy(timPtr->varName, varName); - Tcl_CreateCommand(interp, name, ImageCmd, timPtr, NULL); - *clientDataPtr = timPtr; + Tcl_CreateCommand(interp, name, ImageCmd, (ClientData) timPtr, NULL); + *clientDataPtr = (ClientData) timPtr; Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15); return TCL_OK; } @@ -204,14 +198,14 @@ ImageCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + CONST char **argv) /* Argument strings. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *) clientData; int x, y, width, height; if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", - argv[0], "option ?arg ...?", NULL); + argv[0], "option ?arg arg ...?", NULL); return TCL_ERROR; } if (strcmp(argv[1], "changed") == 0) { @@ -262,21 +256,21 @@ ImageGet( * used. */ ClientData clientData) /* Pointer to TImageMaster for image. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *) clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; sprintf(buffer, "%s get", timPtr->imageName); - Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, + Tcl_SetVar(timPtr->interp, timPtr->varName, 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; instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues); - return instPtr; + return (ClientData) instPtr; } /* @@ -309,14 +303,14 @@ ImageDisplay( /* Coordinates in drawable corresponding to * imageX and imageY. */ { - TImageInstance *instPtr = clientData; + TImageInstance *instPtr = (TImageInstance *) clientData; char buffer[200 + TCL_INTEGER_SPACE * 6]; sprintf(buffer, "%s display %d %d %d %d %d %d", instPtr->masterPtr->imageName, imageX, imageY, width, height, drawableX, drawableY); - Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL, - buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); + Tcl_SetVar(instPtr->masterPtr->interp, instPtr->masterPtr->varName, buffer, + TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); if (width > (instPtr->masterPtr->width - imageX)) { width = instPtr->masterPtr->width - imageX; } @@ -354,15 +348,15 @@ 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); - Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL, - buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); + Tcl_SetVar(instPtr->masterPtr->interp, instPtr->masterPtr->varName, buffer, + TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); Tk_FreeColor(instPtr->fg); Tk_FreeGC(display, instPtr->gc); - ckfree(instPtr); + ckfree((char *) instPtr); } /* @@ -388,17 +382,17 @@ 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); - Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, + Tcl_SetVar(timPtr->interp, timPtr->varName, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); Tcl_DeleteCommand(timPtr->interp, timPtr->imageName); ckfree(timPtr->imageName); ckfree(timPtr->varName); - ckfree(timPtr); + ckfree((char *) timPtr); } /* |