summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2002-08-05 04:30:37 (GMT)
committerdgp <dgp@users.sourceforge.net>2002-08-05 04:30:37 (GMT)
commitb5333ac3910c2299be88875fe833d76136a92fc0 (patch)
tree7d072949961c0e2749f8fc33c73bf1d093c3d635 /unix
parent54f11088e5bee7a0f06235e8b67cdde9dfa614d4 (diff)
downloadtk-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 'unix')
-rw-r--r--unix/tkUnixConfig.c6
-rw-r--r--unix/tkUnixCursor.c6
-rw-r--r--unix/tkUnixEmbed.c6
-rw-r--r--unix/tkUnixFont.c9
-rw-r--r--unix/tkUnixSelect.c4
-rw-r--r--unix/tkUnixSend.c38
-rw-r--r--unix/tkUnixWm.c12
7 files changed, 42 insertions, 39 deletions
diff --git a/unix/tkUnixConfig.c b/unix/tkUnixConfig.c
index 26f7dd1..601ae98 100644
--- a/unix/tkUnixConfig.c
+++ b/unix/tkUnixConfig.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixConfig.c,v 1.2 1999/04/16 01:51:45 stanton Exp $
+ * RCS: @(#) $Id: tkUnixConfig.c,v 1.3 2002/08/05 04:30:40 dgp Exp $
*/
#include "tk.h"
@@ -38,8 +38,8 @@
Tcl_Obj *
TkpGetSystemDefault(tkwin, dbName, className)
Tk_Window tkwin; /* A window to use. */
- char *dbName; /* The option database name. */
- char *className; /* The name of the option class. */
+ CONST char *dbName; /* The option database name. */
+ CONST char *className; /* The name of the option class. */
{
return NULL;
}
diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c
index 16dd52e..3ac51c5 100644
--- a/unix/tkUnixCursor.c
+++ b/unix/tkUnixCursor.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixCursor.c,v 1.5 2002/01/25 21:09:37 dgp Exp $
+ * RCS: @(#) $Id: tkUnixCursor.c,v 1.6 2002/08/05 04:30:40 dgp Exp $
*/
#include "tkPort.h"
@@ -352,8 +352,8 @@ TkCursor *
TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
fgColor, bgColor)
Tk_Window tkwin; /* Window in which cursor will be used. */
- char *source; /* Bitmap data for cursor shape. */
- char *mask; /* Bitmap data for cursor mask. */
+ CONST char *source; /* Bitmap data for cursor shape. */
+ CONST char *mask; /* Bitmap data for cursor mask. */
int width, height; /* Dimensions of cursor. */
int xHot, yHot; /* Location of hot-spot in cursor. */
XColor fgColor; /* Foreground color for cursor. */
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index 6020fc3..6cf9159 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixEmbed.c,v 1.5 2002/06/14 22:25:12 jenglish Exp $
+ * RCS: @(#) $Id: tkUnixEmbed.c,v 1.6 2002/08/05 04:30:41 dgp Exp $
*/
#include "tkInt.h"
@@ -101,7 +101,7 @@ TkpUseWindow(interp, tkwin, string)
* if string is bogus. */
Tk_Window tkwin; /* Tk window that does not yet have an
* associated X window. */
- char *string; /* String identifying an X window to use
+ CONST char *string; /* String identifying an X window to use
* for tkwin; must be an integer value. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -882,7 +882,7 @@ TkpTestembedCmd(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. */
{
int all;
Container *containerPtr;
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 2c39433..5f5b881 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixFont.c,v 1.14 2002/06/26 23:02:45 dgp Exp $
+ * RCS: @(#) $Id: tkUnixFont.c,v 1.15 2002/08/05 04:30:41 dgp Exp $
*/
#include "tkUnixInt.h"
@@ -202,7 +202,7 @@ static void FontPkgCleanup _ANSI_ARGS_((ClientData clientData));
static FontFamily * AllocFontFamily _ANSI_ARGS_((Display *display,
XFontStruct *fontStructPtr, int base));
static SubFont * CanUseFallback _ANSI_ARGS_((UnixFont *fontPtr,
- char *fallbackName, int ch));
+ CONST char *fallbackName, int ch));
static SubFont * CanUseFallbackWithAliases _ANSI_ARGS_((
UnixFont *fontPtr, char *fallbackName,
int ch, Tcl_DString *nameTriedPtr));
@@ -1802,7 +1802,8 @@ FindSubFontForChar(fontPtr, ch)
int ch; /* The Unicode character to be displayed. */
{
int i, j, k, numNames;
- char *faceName, *fallback;
+ Tk_Uid faceName;
+ char *fallback;
char **aliases, **nameList, **anyFallbacks;
char ***fontFallbacks;
SubFont *subFontPtr;
@@ -2221,7 +2222,7 @@ static SubFont *
CanUseFallback(fontPtr, faceName, ch)
UnixFont *fontPtr; /* The font object that will own the new
* screen font. */
- char *faceName; /* Desired face name for new screen font. */
+ CONST char *faceName; /* Desired face name for new screen font. */
int ch; /* The Unicode character that the new
* screen font must be able to display. */
{
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index a0e1d3e..bffce13 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixSelect.c,v 1.8 2002/04/12 09:21:49 hobbs Exp $
+ * RCS: @(#) $Id: tkUnixSelect.c,v 1.9 2002/08/05 04:30:41 dgp Exp $
*/
#include "tkInt.h"
@@ -1497,7 +1497,7 @@ SelCvtFromX(propPtr, numValues, type, tkwin)
{
char *result;
int resultSpace, curSize, fieldSize;
- char *atomName;
+ CONST char *atomName;
/*
* Convert each long in the property to a string value, which is
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index 8525afa..25f712f 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixSend.c,v 1.9 2002/07/18 16:02:48 rmax Exp $
+ * RCS: @(#) $Id: tkUnixSend.c,v 1.10 2002/08/05 04:30:41 dgp Exp $
*/
#include "tkPort.h"
@@ -85,7 +85,7 @@ typedef struct PendingCommand {
int serial; /* Serial number expected in
* result. */
TkDisplay *dispPtr; /* Display being used for communication. */
- char *target; /* Name of interpreter command is
+ CONST char *target; /* Name of interpreter command is
* being sent to. */
Window commWindow; /* Target's communication window. */
Tcl_Interp *interp; /* Interpreter from which the send
@@ -224,12 +224,12 @@ static void AppendPropCarefully _ANSI_ARGS_((Display *display,
int length, PendingCommand *pendingPtr));
static void DeleteProc _ANSI_ARGS_((ClientData clientData));
static void RegAddName _ANSI_ARGS_((NameRegistry *regPtr,
- char *name, Window commWindow));
+ CONST char *name, Window commWindow));
static void RegClose _ANSI_ARGS_((NameRegistry *regPtr));
static void RegDeleteName _ANSI_ARGS_((NameRegistry *regPtr,
- char *name));
+ CONST char *name));
static Window RegFindName _ANSI_ARGS_((NameRegistry *regPtr,
- char *name));
+ CONST char *name));
static NameRegistry * RegOpen _ANSI_ARGS_((Tcl_Interp *interp,
TkDisplay *dispPtr, int lock));
static void SendEventProc _ANSI_ARGS_((ClientData clientData,
@@ -241,7 +241,7 @@ static Tk_RestrictAction SendRestrictProc _ANSI_ARGS_((ClientData clientData,
static int ServerSecure _ANSI_ARGS_((TkDisplay *dispPtr));
static void UpdateCommWindow _ANSI_ARGS_((TkDisplay *dispPtr));
static int ValidateName _ANSI_ARGS_((TkDisplay *dispPtr,
- char *name, Window commWindow, int oldOK));
+ CONST char *name, Window commWindow, int oldOK));
/*
*----------------------------------------------------------------------
@@ -365,7 +365,7 @@ static Window
RegFindName(regPtr, name)
NameRegistry *regPtr; /* Pointer to a registry opened with a
* previous call to RegOpen. */
- char *name; /* Name of an application. */
+ CONST char *name; /* Name of an application. */
{
char *p, *entry;
unsigned int id;
@@ -416,7 +416,7 @@ static void
RegDeleteName(regPtr, name)
NameRegistry *regPtr; /* Pointer to a registry opened with a
* previous call to RegOpen. */
- char *name; /* Name of an application. */
+ CONST char *name; /* Name of an application. */
{
char *p, *entry, *entryName;
int count;
@@ -476,7 +476,7 @@ static void
RegAddName(regPtr, name, commWindow)
NameRegistry *regPtr; /* Pointer to a registry opened with a
* previous call to RegOpen. */
- char *name; /* Name of an application. The caller
+ CONST char *name; /* Name of an application. The caller
* must ensure that this name isn't
* already registered. */
Window commWindow; /* X identifier for comm. window of
@@ -590,7 +590,7 @@ static int
ValidateName(dispPtr, name, commWindow, oldOK)
TkDisplay *dispPtr; /* Display for which to perform the
* validation. */
- char *name; /* The name of an application. */
+ CONST char *name; /* The name of an application. */
Window commWindow; /* X identifier for the application's
* comm. window. */
int oldOK; /* Non-zero means that we should consider
@@ -735,12 +735,12 @@ ServerSecure(dispPtr)
*--------------------------------------------------------------
*/
-char *
+CONST char *
Tk_SetAppName(tkwin, name)
Tk_Window tkwin; /* Token for any window in the application
* to be named: it is just used to identify
* the application and the display. */
- char *name; /* The name that will be used to
+ CONST char *name; /* The name that will be used to
* refer to the interpreter in later
* "send" commands. Must be globally
* unique. */
@@ -751,7 +751,7 @@ Tk_SetAppName(tkwin, name)
TkDisplay *dispPtr = winPtr->dispPtr;
NameRegistry *regPtr;
Tcl_Interp *interp;
- char *actualName;
+ CONST char *actualName;
Tcl_DString dString;
int offset, i;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
@@ -816,15 +816,17 @@ Tk_SetAppName(tkwin, name)
* set" compiler warnings. */
for (i = 1; ; i++) {
if (i > 1) {
+ char *copy;
if (i == 2) {
Tcl_DStringInit(&dString);
Tcl_DStringAppend(&dString, name, -1);
Tcl_DStringAppend(&dString, " #", 2);
offset = Tcl_DStringLength(&dString);
- Tcl_DStringSetLength(&dString, offset+10);
- actualName = Tcl_DStringValue(&dString);
+ Tcl_DStringSetLength(&dString, offset+TCL_INTEGER_SPACE);
+ copy = Tcl_DStringValue(&dString);
+ actualName = copy;
}
- sprintf(actualName + offset, "%d", i);
+ sprintf(copy + offset, "%d", i);
}
w = RegFindName(regPtr, actualName);
if (w == None) {
@@ -896,13 +898,13 @@ Tk_SendCmd(clientData, interp, argc, argv)
* dispPtr field is used). */
Tcl_Interp *interp; /* Current interpreter. */
int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+ CONST char **argv; /* Argument strings. */
{
TkWindow *winPtr;
Window commWindow;
PendingCommand pending;
register RegisteredInterp *riPtr;
- char *destName;
+ CONST char *destName;
int result, c, async, i, firstArg;
size_t length;
Tk_RestrictProc *prevRestrictProc;
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index a3cd0bf..e73d092 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixWm.c,v 1.29 2002/08/02 15:12:23 dgp Exp $
+ * RCS: @(#) $Id: tkUnixWm.c,v 1.30 2002/08/05 04:30:41 dgp Exp $
*/
#include "tkPort.h"
@@ -605,7 +605,7 @@ TkWmMapWindow(winPtr)
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
XTextProperty textProp;
- char *string;
+ Tk_Uid string;
if (wmPtr->flags & WM_NEVER_MAPPED) {
Tcl_DString ds;
@@ -1856,7 +1856,7 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
}
if (objc == 3) {
if (wmPtr->hints.flags & IconPixmapHint) {
- Tcl_SetResult(interp,
+ Tcl_SetResult(interp, (char *)
Tk_NameOfBitmap(winPtr->display, wmPtr->hints.icon_pixmap),
TCL_STATIC);
}
@@ -1976,7 +1976,7 @@ WmIconmaskCmd(tkwin, winPtr, interp, objc, objv)
}
if (objc == 3) {
if (wmPtr->hints.flags & IconMaskHint) {
- Tcl_SetResult(interp,
+ Tcl_SetResult(interp, (char *)
Tk_NameOfBitmap(winPtr->display, wmPtr->hints.icon_mask),
TCL_STATIC);
}
@@ -2928,7 +2928,7 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv)
return TCL_ERROR;
}
if (objc == 3) {
- Tcl_SetResult(interp,
+ Tcl_SetResult(interp, (char *)
((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid),
TCL_STATIC);
return TCL_OK;
@@ -5261,7 +5261,7 @@ TkWmProtocolEventProc(winPtr, eventPtr)
register ProtocolHandler *protPtr;
Atom protocol;
int result;
- char *protocolName;
+ CONST char *protocolName;
Tcl_Interp *interp;
wmPtr = winPtr->wmInfoPtr;