summaryrefslogtreecommitdiffstats
path: root/generic/tkTest.c
diff options
context:
space:
mode:
authordgp <dgp@noemail.net>2002-08-05 04:30:37 (GMT)
committerdgp <dgp@noemail.net>2002-08-05 04:30:37 (GMT)
commit2ad35b1f85c0b9aebda5d00fdb5a4507b8bc6e69 (patch)
tree7d072949961c0e2749f8fc33c73bf1d093c3d635 /generic/tkTest.c
parent5e3b455efa8d24e25a42bb2b12fb7c4b1496034a (diff)
downloadtk-2ad35b1f85c0b9aebda5d00fdb5a4507b8bc6e69.zip
tk-2ad35b1f85c0b9aebda5d00fdb5a4507b8bc6e69.tar.gz
tk-2ad35b1f85c0b9aebda5d00fdb5a4507b8bc6e69.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) FossilOrigin-Name: 5603f01aa35a127f83db9bb68f3b1ff9e5bb64de
Diffstat (limited to 'generic/tkTest.c')
-rw-r--r--generic/tkTest.c55
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;