diff options
author | dgp <dgp@users.sourceforge.net> | 2002-08-05 04:30:37 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2002-08-05 04:30:37 (GMT) |
commit | b5333ac3910c2299be88875fe833d76136a92fc0 (patch) | |
tree | 7d072949961c0e2749f8fc33c73bf1d093c3d635 /generic/tkTest.c | |
parent | 54f11088e5bee7a0f06235e8b67cdde9dfa614d4 (diff) | |
download | tk-b5333ac3910c2299be88875fe833d76136a92fc0.zip tk-b5333ac3910c2299be88875fe833d76136a92fc0.tar.gz tk-b5333ac3910c2299be88875fe833d76136a92fc0.tar.bz2 |
Applied companion patch for Tcl Patch 585105,
updating Tk to use Tcl 8.4's fully CONST-ified
interface, and fully CONSTifying Tk at the
same time.
This patch includes purging Tk of its last
direct access to interp->result. [Bug 589853]
The substantial changes include copying
event sequence strings into Tcl_DStrings
in tkBind.c, and copying [text] indices into
Tcl_DStrings because parsing them involved
overwriting them. If this causes performance
trouble, that can be resolved by further
converting them to Tcl_Obj's.
The #defines USE_NON_CONST and USE_COMPAT_CONST
have the same effect for Tk as they do for Tcl.
(They actually change tcl.h)
Diffstat (limited to 'generic/tkTest.c')
-rw-r--r-- | generic/tkTest.c | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/generic/tkTest.c b/generic/tkTest.c index d58aac1..8104f2e 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTest.c,v 1.18 2002/07/15 16:56:32 dgp Exp $ + * RCS: @(#) $Id: tkTest.c,v 1.19 2002/08/05 04:30:40 dgp Exp $ */ #include "tkInt.h" @@ -157,9 +157,9 @@ static int CBindingEvalProc _ANSI_ARGS_((ClientData clientData, static void CBindingFreeProc _ANSI_ARGS_((ClientData clientData)); int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp)); static int ImageCmd _ANSI_ARGS_((ClientData dummy, - Tcl_Interp *interp, int argc, char **argv)); + Tcl_Interp *interp, int argc, CONST char **argv)); static int TestcbindCmd _ANSI_ARGS_((ClientData dummy, - Tcl_Interp *interp, int argc, char **argv)); + Tcl_Interp *interp, int argc, CONST char **argv)); static int TestbitmapObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])); @@ -173,17 +173,17 @@ static int TestcursorObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])); static int TestdeleteappsCmd _ANSI_ARGS_((ClientData dummy, - Tcl_Interp *interp, int argc, char **argv)); + Tcl_Interp *interp, int argc, CONST char **argv)); static int TestfontObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static int TestmakeexistCmd _ANSI_ARGS_((ClientData dummy, - Tcl_Interp *interp, int argc, char **argv)); + Tcl_Interp *interp, int argc, CONST char **argv)); static int TestmenubarCmd _ANSI_ARGS_((ClientData dummy, - Tcl_Interp *interp, int argc, char **argv)); + Tcl_Interp *interp, int argc, CONST char **argv)); #if defined(__WIN32__) || defined(MAC_TCL) static int TestmetricsCmd _ANSI_ARGS_((ClientData dummy, - Tcl_Interp *interp, int argc, char **argv)); + Tcl_Interp *interp, int argc, CONST char **argv)); #endif static int TestobjconfigObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, @@ -200,14 +200,14 @@ static void CustomOptionRestore _ANSI_ARGS_((ClientData clientData, static void CustomOptionFree _ANSI_ARGS_((ClientData clientData, Tk_Window tkwin, char *internalPtr)); static int TestpropCmd _ANSI_ARGS_((ClientData dummy, - Tcl_Interp *interp, int argc, char **argv)); + Tcl_Interp *interp, int argc, CONST char **argv)); static int TestsendCmd _ANSI_ARGS_((ClientData dummy, - Tcl_Interp *interp, int argc, char **argv)); + Tcl_Interp *interp, int argc, CONST char **argv)); static int TesttextCmd _ANSI_ARGS_((ClientData dummy, - Tcl_Interp *interp, int argc, char **argv)); + Tcl_Interp *interp, int argc, CONST char **argv)); #if !(defined(__WIN32__) || defined(MAC_TCL)) static int TestwrapperCmd _ANSI_ARGS_((ClientData dummy, - Tcl_Interp *interp, int argc, char **argv)); + Tcl_Interp *interp, int argc, CONST char **argv)); #endif static void TrivialCmdDeletedProc _ANSI_ARGS_(( ClientData clientData)); @@ -340,7 +340,7 @@ TestcbindCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window for application. */ Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + CONST char **argv; /* Argument strings. */ { TkWindow *winPtr; Tk_Window tkwin; @@ -589,7 +589,7 @@ TestdeleteappsCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window for application. */ Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + CONST char **argv; /* Argument strings. */ { NewApp *nextPtr; @@ -1700,7 +1700,7 @@ ImageCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window for application. */ Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + CONST char **argv; /* Argument strings. */ { TImageMaster *timPtr = (TImageMaster *) clientData; int x, y, width, height; @@ -1923,7 +1923,7 @@ TestmakeexistCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window for application. */ Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + CONST char **argv; /* Argument strings. */ { Tk_Window mainWin = (Tk_Window) clientData; int i; @@ -1964,7 +1964,7 @@ TestmenubarCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window for application. */ Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + CONST char **argv; /* Argument strings. */ { #ifdef __UNIX__ Tk_Window mainWin = (Tk_Window) clientData; @@ -2032,7 +2032,7 @@ TestmetricsCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window for application. */ Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + CONST char **argv; /* Argument strings. */ { char buf[TCL_INTEGER_SPACE]; @@ -2062,7 +2062,7 @@ TestmetricsCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window for application. */ Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + CONST char **argv; /* Argument strings. */ { Tk_Window tkwin = (Tk_Window) clientData; TkWindow *winPtr; @@ -2117,7 +2117,7 @@ TestpropCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window for application. */ Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + CONST char **argv; /* Argument strings. */ { Tk_Window mainWin = (Tk_Window) clientData; int result, actualFormat; @@ -2196,7 +2196,7 @@ TestsendCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window for application. */ Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + CONST char **argv; /* Argument strings. */ { TkWindow *winPtr = (TkWindow *) clientData; @@ -2254,14 +2254,21 @@ TestsendCmd(clientData, interp, argc, argv) if (argv[4][0] == 0) { XDeleteProperty(winPtr->dispPtr->display, w, propName); } else { - for (p = argv[4]; *p != 0; p++) { + Tcl_DString tmp; + + Tcl_DStringInit(&tmp); + for (p = Tcl_DStringAppend(&tmp, argv[4], strlen(argv[4])); + *p != 0; p++) { if (*p == '\n') { *p = 0; } } + XChangeProperty(winPtr->dispPtr->display, w, propName, XA_STRING, 8, PropModeReplace, - (unsigned char *) argv[4], p-argv[4]); + (unsigned char *) Tcl_DStringValue(&tmp), + p-Tcl_DStringValue(&tmp)); + Tcl_DStringFree(&tmp); } } } else if (strcmp(argv[1], "serial") == 0) { @@ -2301,7 +2308,7 @@ TesttextCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window for application. */ Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + CONST char **argv; /* Argument strings. */ { TkText *textPtr; size_t len; @@ -2382,7 +2389,7 @@ TestwrapperCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window for application. */ Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + CONST char **argv; /* Argument strings. */ { TkWindow *winPtr, *wrapperPtr; Tk_Window tkwin; |