summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.decls16
-rw-r--r--generic/tkArgv.c13
-rw-r--r--generic/tkBind.c4
-rw-r--r--generic/tkCanvLine.c4
-rw-r--r--generic/tkCanvPs.c12
-rw-r--r--generic/tkCanvUtil.c10
-rw-r--r--generic/tkCanvas.c57
-rw-r--r--generic/tkDecls.h31
-rw-r--r--generic/tkEntry.c85
-rw-r--r--generic/tkGet.c6
-rw-r--r--generic/tkImgBmap.c5
-rw-r--r--generic/tkImgPhoto.c6
-rw-r--r--generic/tkInt.decls11
-rw-r--r--generic/tkIntDecls.h19
-rw-r--r--generic/tkIntXlibDecls.h6
-rw-r--r--generic/tkMain.c14
-rw-r--r--generic/tkMenu.c4
-rw-r--r--generic/tkMenubutton.c6
-rw-r--r--generic/tkMessage.c6
-rw-r--r--generic/tkOldConfig.c9
-rw-r--r--generic/tkOption.c13
-rw-r--r--generic/tkText.c8
-rw-r--r--generic/tkText.h4
-rw-r--r--generic/tkTextTag.c6
-rw-r--r--generic/tkWindow.c22
25 files changed, 199 insertions, 178 deletions
diff --git a/generic/tk.decls b/generic/tk.decls
index 3d99766..1b7132d 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -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: tk.decls,v 1.15 2001/09/26 20:25:17 pspjuth Exp $
+# RCS: @(#) $Id: tk.decls,v 1.16 2002/01/25 21:09:36 dgp Exp $
library tk
@@ -55,8 +55,8 @@ declare 4 generic {
}
declare 5 generic {
- void Tk_AddOption (Tk_Window tkwin, char *name, \
- char *value, int priority)
+ void Tk_AddOption (Tk_Window tkwin, CONST char *name, \
+ CONST char *value, int priority)
}
declare 6 generic {
@@ -78,7 +78,7 @@ declare 8 generic {
declare 9 generic {
int Tk_CanvasGetCoord (Tcl_Interp *interp, \
- Tk_Canvas canvas, char *str, double *doublePtr)
+ Tk_Canvas canvas, CONST char *str, double *doublePtr)
}
declare 10 generic {
@@ -528,7 +528,7 @@ declare 103 generic {
declare 104 generic {
int Tk_GetPixels (Tcl_Interp *interp, \
- Tk_Window tkwin, char *str, int *intPtr)
+ Tk_Window tkwin, CONST char *str, int *intPtr)
}
declare 105 generic {
@@ -551,7 +551,7 @@ declare 108 generic {
declare 109 generic {
int Tk_GetScreenMM (Tcl_Interp *interp, \
- Tk_Window tkwin, char *str, double *doublePtr)
+ Tk_Window tkwin, CONST char *str, double *doublePtr)
}
declare 110 generic {
@@ -692,7 +692,7 @@ declare 140 generic {
declare 141 generic {
Tk_Window Tk_NameToWindow (Tcl_Interp *interp, \
- char *pathName, Tk_Window tkwin)
+ CONST char *pathName, Tk_Window tkwin)
}
declare 142 generic {
@@ -703,7 +703,7 @@ declare 142 generic {
declare 143 generic {
int Tk_ParseArgv (Tcl_Interp *interp, \
- Tk_Window tkwin, int *argcPtr, char **argv, \
+ Tk_Window tkwin, int *argcPtr, CONST char **argv, \
Tk_ArgvInfo *argTable, int flags)
}
diff --git a/generic/tkArgv.c b/generic/tkArgv.c
index 7f35368..a0c8143 100644
--- a/generic/tkArgv.c
+++ b/generic/tkArgv.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkArgv.c,v 1.3 1999/04/16 01:51:10 stanton Exp $
+ * RCS: @(#) $Id: tkArgv.c,v 1.4 2002/01/25 21:09:36 dgp Exp $
*/
#include "tkPort.h"
@@ -67,7 +67,7 @@ Tk_ParseArgv(interp, tkwin, argcPtr, argv, argTable, flags)
* NULL means ignore Tk option specs. */
int *argcPtr; /* Number of arguments in argv. Modified
* to hold # args left in argv at end. */
- char **argv; /* Array of arguments. Modified to hold
+ CONST char **argv; /* Array of arguments. Modified to hold
* those that couldn't be processed here. */
Tk_ArgvInfo *argTable; /* Array of option descriptions */
int flags; /* Or'ed combination of various flag bits,
@@ -77,7 +77,7 @@ Tk_ParseArgv(interp, tkwin, argcPtr, argv, argTable, flags)
/* Pointer to the current entry in the
* table of argument descriptions. */
Tk_ArgvInfo *matchPtr; /* Descriptor that matches current argument. */
- char *curArg; /* Current argument */
+ CONST char *curArg; /* Current argument */
register char c; /* Second character of current arg (used for
* quick check for matching; use 2nd char.
* because first char. will almost always
@@ -202,7 +202,7 @@ Tk_ParseArgv(interp, tkwin, argcPtr, argv, argTable, flags)
if (argc == 0) {
goto missingArg;
} else {
- *((char **)infoPtr->dst) = argv[srcIndex];
+ *((CONST char **)infoPtr->dst) = argv[srcIndex];
srcIndex++;
argc--;
}
@@ -239,7 +239,8 @@ Tk_ParseArgv(interp, tkwin, argcPtr, argv, argTable, flags)
}
break;
case TK_ARGV_FUNC: {
- typedef int (ArgvFunc)_ANSI_ARGS_((char *, char *, char *));
+ typedef int (ArgvFunc) _ANSI_ARGS_ ((char *, char *,
+ CONST char *));
ArgvFunc *handlerProc;
handlerProc = (ArgvFunc *) infoPtr->src;
@@ -252,7 +253,7 @@ Tk_ParseArgv(interp, tkwin, argcPtr, argv, argTable, flags)
}
case TK_ARGV_GENFUNC: {
typedef int (ArgvGenFunc)_ANSI_ARGS_((char *, Tcl_Interp *,
- char *, int, char **));
+ char *, int, CONST char **));
ArgvGenFunc *handlerProc;
handlerProc = (ArgvGenFunc *) infoPtr->src;
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 77592a9..fa6a31a 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.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: tkBind.c,v 1.20 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkBind.c,v 1.21 2002/01/25 21:09:36 dgp Exp $
*/
#include "tkPort.h"
@@ -2941,7 +2941,7 @@ DeleteVirtualEvent(interp, vetPtr, virtString, eventString)
eventPSPtr = FindSequence(interp, &vetPtr->patternTable, NULL,
eventString, 0, 0, &eventMask);
if (eventPSPtr == NULL) {
- char *string;
+ CONST char *string;
string = Tcl_GetStringResult(interp);
return (string[0] != '\0') ? TCL_ERROR : TCL_OK;
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 9a0c369..1263249 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvLine.c,v 1.9 2001/07/03 06:03:44 hobbs Exp $
+ * RCS: @(#) $Id: tkCanvLine.c,v 1.10 2002/01/25 21:09:36 dgp Exp $
*/
#include <stdio.h>
@@ -1872,7 +1872,7 @@ ParseArrowShape(clientData, interp, tkwin, value, recordPtr, offset)
LineItem *linePtr = (LineItem *) recordPtr;
double a, b, c;
int argc;
- char **argv = NULL;
+ CONST char **argv = NULL;
if (offset != Tk_Offset(LineItem, arrowShapeA)) {
panic("ParseArrowShape received bogus offset");
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 940b754..ea6ec2a 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.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: tkCanvPs.c,v 1.7 2000/04/25 01:03:06 hobbs Exp $
+ * RCS: @(#) $Id: tkCanvPs.c,v 1.8 2002/01/25 21:09:36 dgp Exp $
*/
#include "tkInt.h"
@@ -128,7 +128,7 @@ static CONST char * CONST prolog[]= {
\n\
% This is a standard prolog for Postscript generated by Tk's canvas\n\
% widget.\n\
-% RCS: @(#) $Id: tkCanvPs.c,v 1.7 2000/04/25 01:03:06 hobbs Exp $\n\
+% RCS: @(#) $Id: tkCanvPs.c,v 1.8 2002/01/25 21:09:36 dgp Exp $\n\
\n\
% The definitions below just define all of the variables used in\n\
% any of the procedures here. This is needed for obscure reasons\n\
@@ -470,7 +470,8 @@ TkCanvPostscriptCmd(canvasPtr, interp, argc, argv)
int result;
Tk_Item *itemPtr;
#define STRING_LENGTH 400
- char string[STRING_LENGTH+1], *p;
+ char string[STRING_LENGTH+1];
+ CONST char *p;
time_t now;
size_t length;
Tk_Window tkwin = canvasPtr->tkwin;
@@ -967,7 +968,7 @@ Tk_PostscriptColor(interp, psInfo, colorPtr)
*/
if (psInfoPtr->colorVar != NULL) {
- char *cmdString;
+ CONST char *cmdString;
cmdString = Tcl_GetVar2(interp, psInfoPtr->colorVar,
Tk_NameOfColor(colorPtr), 0);
@@ -1047,9 +1048,10 @@ Tk_PostscriptFont(interp, psInfo, tkfont)
Tcl_DStringInit(&ds);
if (psInfoPtr->fontVar != NULL) {
- char *list, **argv;
+ CONST char *list;
int argc;
double size;
+ CONST char **argv;
char *name;
name = Tk_NameOfFont(tkfont);
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index 5ec5eb7..87aadc9 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvUtil.c,v 1.5 1999/12/16 21:57:35 hobbs Exp $
+ * RCS: @(#) $Id: tkCanvUtil.c,v 1.6 2002/01/25 21:09:36 dgp Exp $
*/
#include "tkInt.h"
@@ -189,7 +189,7 @@ int
Tk_CanvasGetCoord(interp, canvas, string, doublePtr)
Tcl_Interp *interp; /* Interpreter for error reporting. */
Tk_Canvas canvas; /* Canvas to which coordinate applies. */
- char *string; /* Describes coordinate (any screen
+ CONST char *string; /* Describes coordinate (any screen
* coordinate form may be used here). */
double *doublePtr; /* Place to store converted coordinate. */
{
@@ -376,7 +376,7 @@ Tk_CanvasTagsParseProc(clientData, interp, tkwin, value, widgRec, offset)
{
register Tk_Item *itemPtr = (Tk_Item *) widgRec;
int argc, i;
- char **argv;
+ CONST char **argv;
Tk_Uid *newPtr;
/*
@@ -454,7 +454,7 @@ Tk_CanvasTagsPrintProc(clientData, tkwin, widgRec, offset, freeProcPtr)
return (char *) itemPtr->tagPtr[0];
}
*freeProcPtr = TCL_DYNAMIC;
- return Tcl_Merge(itemPtr->numTags, (char **) itemPtr->tagPtr);
+ return Tcl_Merge(itemPtr->numTags, (CONST char **) itemPtr->tagPtr);
}
@@ -777,7 +777,7 @@ Tk_GetDash(interp, value, dash)
* store dash information. */
{
int argc, i;
- char **largv, **argv = NULL;
+ CONST char **largv, **argv = NULL;
char *pt;
if ((value==(char *) NULL) || (*value==0) ) {
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index e77c0f9..5b7d92c 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.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: tkCanvas.c,v 1.17 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkCanvas.c,v 1.18 2002/01/25 21:09:36 dgp Exp $
*/
/* #define USE_OLD_TAG_SEARCH 1 */
@@ -299,9 +299,8 @@ static Tk_Item * NextItem _ANSI_ARGS_((TagSearch *searchPtr));
#endif /* USE_OLD_TAG_SEARCH */
static void PickCurrentItem _ANSI_ARGS_((TkCanvas *canvasPtr,
XEvent *eventPtr));
-static void PrintScrollFractions _ANSI_ARGS_((int screen1,
- int screen2, int object1, int object2,
- char *string));
+static Tcl_Obj * ScrollFractions _ANSI_ARGS_((int screen1,
+ int screen2, int object1, int object2));
#ifdef USE_OLD_TAG_SEARCH
static void RelinkItems _ANSI_ARGS_((TkCanvas *canvasPtr,
Tcl_Obj *tag, Tk_Item *prevPtr));
@@ -776,7 +775,7 @@ CanvasWidgetCmd(clientData, interp, argc, argv)
command = Tk_GetBinding(interp, canvasPtr->bindingTable,
object, Tcl_GetStringFromObj(argv[3], NULL));
if (command == NULL) {
- char *string;
+ CONST char *string;
string = Tcl_GetStringResult(interp);
/*
@@ -1816,10 +1815,11 @@ CanvasWidgetCmd(clientData, interp, argc, argv)
double fraction;
if (argc == 2) {
- PrintScrollFractions(canvasPtr->xOrigin + canvasPtr->inset,
+ Tcl_SetObjResult(interp, ScrollFractions(
+ canvasPtr->xOrigin + canvasPtr->inset,
canvasPtr->xOrigin + Tk_Width(canvasPtr->tkwin)
- canvasPtr->inset, canvasPtr->scrollX1,
- canvasPtr->scrollX2, Tcl_GetStringResult(interp));
+ canvasPtr->scrollX2));
} else {
char **args = GetStringsFromObjs(argc, argv);
type = Tk_GetScrollInfo(interp, argc, args, &fraction, &count);
@@ -1859,10 +1859,11 @@ CanvasWidgetCmd(clientData, interp, argc, argv)
double fraction;
if (argc == 2) {
- PrintScrollFractions(canvasPtr->yOrigin + canvasPtr->inset,
+ Tcl_SetObjResult(interp,ScrollFractions(\
+ canvasPtr->yOrigin + canvasPtr->inset,
canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin)
- canvasPtr->inset, canvasPtr->scrollY1,
- canvasPtr->scrollY2, Tcl_GetStringResult(interp));
+ canvasPtr->scrollY2));
} else {
char **args = GetStringsFromObjs(argc, argv);
type = Tk_GetScrollInfo(interp, argc, args, &fraction, &count);
@@ -2062,7 +2063,7 @@ ConfigureCanvas(interp, canvasPtr, argc, argv, flags)
canvasPtr->scrollY2 = 0;
if (canvasPtr->regionString != NULL) {
int argc2;
- char **argv2;
+ CONST char **argv2;
if (Tcl_SplitList(canvasPtr->interp, canvasPtr->regionString,
&argc2, &argv2) != TCL_OK) {
@@ -5205,12 +5206,12 @@ GridAlign(coord, spacing)
/*
*----------------------------------------------------------------------
*
- * PrintScrollFractions --
+ * ScrollFractions --
*
* Given the range that's visible in the window and the "100%
- * range" for what's in the canvas, print a string containing
- * the scroll fractions. This procedure is used for both x
- * and y scrolling.
+ * range" for what's in the canvas, return a list of two
+ * doubles representing the scroll fractions. This procedure
+ * is used for both x and y scrolling.
*
* Results:
* The memory pointed to by string is modified to hold
@@ -5223,17 +5224,15 @@ GridAlign(coord, spacing)
*----------------------------------------------------------------------
*/
-static void
-PrintScrollFractions(screen1, screen2, object1, object2, string)
+static Tcl_Obj *
+ScrollFractions(screen1, screen2, object1, object2)
int screen1; /* Lowest coordinate visible in the window. */
int screen2; /* Highest coordinate visible in the window. */
int object1; /* Lowest coordinate in the object. */
int object2; /* Highest coordinate in the object. */
- char *string; /* Two real numbers get printed here. Must
- * have enough storage for two %g
- * conversions. */
{
double range, f1, f2;
+ char buffer[2*TCL_DOUBLE_SPACE+2];
range = object2 - object1;
if (range <= 0) {
@@ -5252,7 +5251,8 @@ PrintScrollFractions(screen1, screen2, object1, object2, string)
f2 = f1;
}
}
- sprintf(string, "%g %g", f1, f2);
+ sprintf(buffer, "%g %g", f1, f2);
+ return Tcl_NewStringObj(buffer, -1);
}
/*
@@ -5281,7 +5281,6 @@ CanvasUpdateScrollbars(canvasPtr)
TkCanvas *canvasPtr; /* Information about canvas. */
{
int result;
- char buffer[200];
Tcl_Interp *interp;
int xOrigin, yOrigin, inset, width, height, scrollX1, scrollX2,
scrollY1, scrollY2;
@@ -5313,9 +5312,11 @@ CanvasUpdateScrollbars(canvasPtr)
scrollY2 = canvasPtr->scrollY2;
canvasPtr->flags &= ~UPDATE_SCROLLBARS;
if (canvasPtr->xScrollCmd != NULL) {
- PrintScrollFractions(xOrigin + inset, xOrigin + width - inset,
- scrollX1, scrollX2, buffer);
- result = Tcl_VarEval(interp, xScrollCmd, " ", buffer, (char *) NULL);
+ Tcl_Obj *fractions = ScrollFractions(xOrigin + inset,
+ xOrigin + width - inset, scrollX1, scrollX2);
+ result = Tcl_VarEval(interp, xScrollCmd, " ",
+ Tcl_GetString(fractions), (char *) NULL);
+ Tcl_DecrRefCount(fractions);
if (result != TCL_OK) {
Tcl_BackgroundError(interp);
}
@@ -5324,9 +5325,11 @@ CanvasUpdateScrollbars(canvasPtr)
}
if (yScrollCmd != NULL) {
- PrintScrollFractions(yOrigin + inset, yOrigin + height - inset,
- scrollY1, scrollY2, buffer);
- result = Tcl_VarEval(interp, yScrollCmd, " ", buffer, (char *) NULL);
+ Tcl_Obj *fractions = ScrollFractions(yOrigin + inset,
+ yOrigin + height - inset, scrollY1, scrollY2);
+ result = Tcl_VarEval(interp, yScrollCmd, " ",
+ Tcl_GetString(fractions), (char *) NULL);
+ Tcl_DecrRefCount(fractions);
if (result != TCL_OK) {
Tcl_BackgroundError(interp);
}
diff --git a/generic/tkDecls.h b/generic/tkDecls.h
index a60433b..73f97a2 100644
--- a/generic/tkDecls.h
+++ b/generic/tkDecls.h
@@ -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: tkDecls.h,v 1.15 2001/09/26 20:25:17 pspjuth Exp $
+ * RCS: @(#) $Id: tkDecls.h,v 1.16 2002/01/25 21:09:36 dgp Exp $
*/
#ifndef _TKDECLS
@@ -50,7 +50,8 @@ EXTERN void Tk_3DVerticalBevel _ANSI_ARGS_((Tk_Window tkwin,
int relief));
/* 5 */
EXTERN void Tk_AddOption _ANSI_ARGS_((Tk_Window tkwin,
- char * name, char * value, int priority));
+ CONST char * name, CONST char * value,
+ int priority));
/* 6 */
EXTERN void Tk_BindEvent _ANSI_ARGS_((
Tk_BindingTable bindingTable,
@@ -66,7 +67,7 @@ EXTERN void Tk_CanvasEventuallyRedraw _ANSI_ARGS_((
int y2));
/* 9 */
EXTERN int Tk_CanvasGetCoord _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Canvas canvas, char * str,
+ Tk_Canvas canvas, CONST char * str,
double * doublePtr));
/* 10 */
EXTERN Tk_CanvasTextInfo * Tk_CanvasGetTextInfo _ANSI_ARGS_((
@@ -391,7 +392,8 @@ EXTERN Tk_Uid Tk_GetOption _ANSI_ARGS_((Tk_Window tkwin,
char * name, char * className));
/* 104 */
EXTERN int Tk_GetPixels _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, char * str, int * intPtr));
+ Tk_Window tkwin, CONST char * str,
+ int * intPtr));
/* 105 */
EXTERN Pixmap Tk_GetPixmap _ANSI_ARGS_((Display * display,
Drawable d, int width, int height, int depth));
@@ -407,7 +409,7 @@ EXTERN int Tk_GetScrollInfo _ANSI_ARGS_((Tcl_Interp * interp,
int * intPtr));
/* 109 */
EXTERN int Tk_GetScreenMM _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, char * str,
+ Tk_Window tkwin, CONST char * str,
double * doublePtr));
/* 110 */
EXTERN int Tk_GetSelection _ANSI_ARGS_((Tcl_Interp * interp,
@@ -497,15 +499,16 @@ EXTERN char * Tk_NameOfJustify _ANSI_ARGS_((Tk_Justify justify));
EXTERN char * Tk_NameOfRelief _ANSI_ARGS_((int relief));
/* 141 */
EXTERN Tk_Window Tk_NameToWindow _ANSI_ARGS_((Tcl_Interp * interp,
- char * pathName, Tk_Window tkwin));
+ CONST char * pathName, Tk_Window tkwin));
/* 142 */
EXTERN void Tk_OwnSelection _ANSI_ARGS_((Tk_Window tkwin,
Atom selection, Tk_LostSelProc * proc,
ClientData clientData));
/* 143 */
EXTERN int Tk_ParseArgv _ANSI_ARGS_((Tcl_Interp * interp,
- Tk_Window tkwin, int * argcPtr, char ** argv,
- Tk_ArgvInfo * argTable, int flags));
+ Tk_Window tkwin, int * argcPtr,
+ CONST char ** argv, Tk_ArgvInfo * argTable,
+ int flags));
/* 144 */
EXTERN void Tk_PhotoPutBlock _ANSI_ARGS_((Tk_PhotoHandle handle,
Tk_PhotoImageBlock * blockPtr, int x, int y,
@@ -857,11 +860,11 @@ typedef struct TkStubs {
GC (*tk_3DBorderGC) _ANSI_ARGS_((Tk_Window tkwin, Tk_3DBorder border, int which)); /* 2 */
void (*tk_3DHorizontalBevel) _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int leftIn, int rightIn, int topBevel, int relief)); /* 3 */
void (*tk_3DVerticalBevel) _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int leftBevel, int relief)); /* 4 */
- void (*tk_AddOption) _ANSI_ARGS_((Tk_Window tkwin, char * name, char * value, int priority)); /* 5 */
+ void (*tk_AddOption) _ANSI_ARGS_((Tk_Window tkwin, CONST char * name, CONST char * value, int priority)); /* 5 */
void (*tk_BindEvent) _ANSI_ARGS_((Tk_BindingTable bindingTable, XEvent * eventPtr, Tk_Window tkwin, int numObjects, ClientData * objectPtr)); /* 6 */
void (*tk_CanvasDrawableCoords) _ANSI_ARGS_((Tk_Canvas canvas, double x, double y, short * drawableXPtr, short * drawableYPtr)); /* 7 */
void (*tk_CanvasEventuallyRedraw) _ANSI_ARGS_((Tk_Canvas canvas, int x1, int y1, int x2, int y2)); /* 8 */
- int (*tk_CanvasGetCoord) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, char * str, double * doublePtr)); /* 9 */
+ int (*tk_CanvasGetCoord) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, CONST char * str, double * doublePtr)); /* 9 */
Tk_CanvasTextInfo * (*tk_CanvasGetTextInfo) _ANSI_ARGS_((Tk_Canvas canvas)); /* 10 */
int (*tk_CanvasPsBitmap) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, Pixmap bitmap, int x, int y, int width, int height)); /* 11 */
int (*tk_CanvasPsColor) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, XColor * colorPtr)); /* 12 */
@@ -956,12 +959,12 @@ typedef struct TkStubs {
int (*tk_GetJustify) _ANSI_ARGS_((Tcl_Interp * interp, char * str, Tk_Justify * justifyPtr)); /* 101 */
int (*tk_GetNumMainWindows) _ANSI_ARGS_((void)); /* 102 */
Tk_Uid (*tk_GetOption) _ANSI_ARGS_((Tk_Window tkwin, char * name, char * className)); /* 103 */
- int (*tk_GetPixels) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, char * str, int * intPtr)); /* 104 */
+ int (*tk_GetPixels) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * str, int * intPtr)); /* 104 */
Pixmap (*tk_GetPixmap) _ANSI_ARGS_((Display * display, Drawable d, int width, int height, int depth)); /* 105 */
int (*tk_GetRelief) _ANSI_ARGS_((Tcl_Interp * interp, char * name, int * reliefPtr)); /* 106 */
void (*tk_GetRootCoords) _ANSI_ARGS_((Tk_Window tkwin, int * xPtr, int * yPtr)); /* 107 */
int (*tk_GetScrollInfo) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, double * dblPtr, int * intPtr)); /* 108 */
- int (*tk_GetScreenMM) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, char * str, double * doublePtr)); /* 109 */
+ int (*tk_GetScreenMM) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, CONST char * str, double * doublePtr)); /* 109 */
int (*tk_GetSelection) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc * proc, ClientData clientData)); /* 110 */
Tk_Uid (*tk_GetUid) _ANSI_ARGS_((CONST char * str)); /* 111 */
Visual * (*tk_GetVisual) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, char * str, int * depthPtr, Colormap * colormapPtr)); /* 112 */
@@ -993,9 +996,9 @@ typedef struct TkStubs {
char * (*tk_NameOfJoinStyle) _ANSI_ARGS_((int join)); /* 138 */
char * (*tk_NameOfJustify) _ANSI_ARGS_((Tk_Justify justify)); /* 139 */
char * (*tk_NameOfRelief) _ANSI_ARGS_((int relief)); /* 140 */
- Tk_Window (*tk_NameToWindow) _ANSI_ARGS_((Tcl_Interp * interp, char * pathName, Tk_Window tkwin)); /* 141 */
+ Tk_Window (*tk_NameToWindow) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * pathName, Tk_Window tkwin)); /* 141 */
void (*tk_OwnSelection) _ANSI_ARGS_((Tk_Window tkwin, Atom selection, Tk_LostSelProc * proc, ClientData clientData)); /* 142 */
- int (*tk_ParseArgv) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, int * argcPtr, char ** argv, Tk_ArgvInfo * argTable, int flags)); /* 143 */
+ int (*tk_ParseArgv) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, int * argcPtr, CONST char ** argv, Tk_ArgvInfo * argTable, int flags)); /* 143 */
void (*tk_PhotoPutBlock) _ANSI_ARGS_((Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height)); /* 144 */
void (*tk_PhotoPutZoomedBlock) _ANSI_ARGS_((Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY)); /* 145 */
int (*tk_PhotoGetImage) _ANSI_ARGS_((Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr)); /* 146 */
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index a2a2a24..9ccc16a 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.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: tkEntry.c,v 1.25 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkEntry.c,v 1.26 2002/01/25 21:09:37 dgp Exp $
*/
#include "tkInt.h"
@@ -45,7 +45,7 @@ typedef struct {
* Fields that are set by widget commands other than "configure".
*/
- char *string; /* Pointer to storage for string;
+ CONST char *string; /* Pointer to storage for string;
* NULL-terminated; malloc-ed. */
int insertPos; /* Character index before which next typed
* character will be inserted. */
@@ -134,7 +134,7 @@ typedef struct {
* configuration settings above.
*/
- char *displayString; /* String to use when displaying. This may
+ CONST char *displayString; /* String to use when displaying. This may
* be a pointer to string, or a pointer to
* malloced memory with the same character
* length as string but whose characters
@@ -690,7 +690,7 @@ static void EntryLostSelection _ANSI_ARGS_((
static void EventuallyRedraw _ANSI_ARGS_((Entry *entryPtr));
static void EntryScanTo _ANSI_ARGS_((Entry *entryPtr, int y));
static void EntrySetValue _ANSI_ARGS_((Entry *entryPtr,
- char *value));
+ CONST char *value));
static void EntrySelectTo _ANSI_ARGS_((
Entry *entryPtr, int index));
static char * EntryTextVarProc _ANSI_ARGS_((ClientData clientData,
@@ -700,12 +700,13 @@ static void EntryUpdateScrollbar _ANSI_ARGS_((Entry *entryPtr));
static int EntryValidate _ANSI_ARGS_((Entry *entryPtr,
char *cmd));
static int EntryValidateChange _ANSI_ARGS_((Entry *entryPtr,
- char *change, char *new, int index, int type));
+ char *change, CONST char *new, int index,
+ int type));
static void ExpandPercents _ANSI_ARGS_((Entry *entryPtr,
- CONST char *before, char *change, char *new,
+ CONST char *before, char *change, CONST char *new,
int index, int type, Tcl_DString *dsPtr));
static void EntryValueChanged _ANSI_ARGS_((Entry *entryPtr,
- char *newValue));
+ CONST char *newValue));
static void EntryVisibleRange _ANSI_ARGS_((Entry *entryPtr,
double *firstPtr, double *lastPtr));
static int EntryWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
@@ -770,6 +771,7 @@ Tk_EntryObjCmd(clientData, interp, objc, objv)
register Entry *entryPtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
+ char *tmp;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?");
@@ -807,8 +809,9 @@ Tk_EntryObjCmd(clientData, interp, objc, objv)
(ClientData) entryPtr, EntryCmdDeletedProc);
entryPtr->optionTable = optionTable;
entryPtr->type = TK_ENTRY;
- entryPtr->string = (char *) ckalloc(1);
- entryPtr->string[0] = '\0';
+ tmp = (char *) ckalloc(1);
+ tmp[0] = '\0';
+ entryPtr->string = tmp;
entryPtr->selectFirst = -1;
entryPtr->selectLast = -1;
@@ -984,7 +987,7 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
goto error;
}
- Tcl_SetResult(interp, entryPtr->string, TCL_STATIC);
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
break;
}
@@ -1325,7 +1328,7 @@ DestroyEntry(memPtr)
* stuff.
*/
- ckfree(entryPtr->string);
+ ckfree((char *)entryPtr->string);
if (entryPtr->textVarName != NULL) {
Tcl_UntraceVar(entryPtr->interp, entryPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
@@ -1339,7 +1342,7 @@ DestroyEntry(memPtr)
}
Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler);
if (entryPtr->displayString != entryPtr->string) {
- ckfree(entryPtr->displayString);
+ ckfree((char *)entryPtr->displayString);
}
if (entryPtr->type == TK_SPINBOX) {
Spinbox *sbPtr = (Spinbox *) entryPtr;
@@ -1634,7 +1637,7 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
*/
if (entryPtr->textVarName != NULL) {
- char *value;
+ CONST char *value;
value = Tcl_GetVar(interp, entryPtr->textVarName, TCL_GLOBAL_ONLY);
if (value == NULL) {
@@ -2081,7 +2084,7 @@ EntryComputeGeometry(entryPtr)
char *p;
if (entryPtr->displayString != entryPtr->string) {
- ckfree(entryPtr->displayString);
+ ckfree((char *)entryPtr->displayString);
entryPtr->displayString = entryPtr->string;
entryPtr->numDisplayBytes = entryPtr->numBytes;
}
@@ -2107,10 +2110,9 @@ EntryComputeGeometry(entryPtr)
size = Tcl_UniCharToUtf(ch, buf);
entryPtr->numDisplayBytes = entryPtr->numChars * size;
- entryPtr->displayString =
- (char *) ckalloc((unsigned) (entryPtr->numDisplayBytes + 1));
+ p = (char *) ckalloc((unsigned) (entryPtr->numDisplayBytes + 1));
+ entryPtr->displayString = p;
- p = entryPtr->displayString;
for (i = entryPtr->numChars; --i >= 0; ) {
p += Tcl_UniCharToUtf(ch, p);
}
@@ -2214,7 +2216,8 @@ InsertChars(entryPtr, index, value)
* string). */
{
int byteIndex, byteCount, oldChars, charsAdded, newByteCount;
- char *new, *string;
+ CONST char *string;
+ char *new;
string = entryPtr->string;
byteIndex = Tcl_UtfAtIndex(string, index) - string;
@@ -2237,7 +2240,7 @@ InsertChars(entryPtr, index, value)
return;
}
- ckfree(string);
+ ckfree((char *)string);
entryPtr->string = new;
/*
@@ -2311,7 +2314,8 @@ DeleteChars(entryPtr, index, count)
int count; /* How many characters to delete. */
{
int byteIndex, byteCount, newByteCount;
- char *new, *string, *todelete;
+ CONST char *string;
+ char *new, *todelete;
if ((index + count) > entryPtr->numChars) {
count = entryPtr->numChars - index;
@@ -2343,7 +2347,7 @@ DeleteChars(entryPtr, index, count)
}
ckfree(todelete);
- ckfree(entryPtr->string);
+ ckfree((char *)entryPtr->string);
entryPtr->string = new;
entryPtr->numChars -= count;
entryPtr->numBytes -= byteCount;
@@ -2423,7 +2427,7 @@ DeleteChars(entryPtr, index, count)
static void
EntryValueChanged(entryPtr, newValue)
Entry *entryPtr; /* Entry whose value just changed. */
- char *newValue; /* If this value is not NULL, we first
+ CONST char *newValue; /* If this value is not NULL, we first
* force the value of the entry to this */
{
if (newValue != NULL) {
@@ -2483,9 +2487,9 @@ EntryValueChanged(entryPtr, newValue)
static void
EntrySetValue(entryPtr, value)
Entry *entryPtr; /* Entry whose value is to be changed. */
- char *value; /* New text to display in entry. */
+ CONST char *value; /* New text to display in entry. */
{
- char *oldSource;
+ CONST char *oldSource;
int code, valueLen, malloced = 0;
if (strcmp(value, entryPtr->string) == 0) {
@@ -2501,9 +2505,9 @@ EntrySetValue(entryPtr, value)
* point to volatile memory, like the value of the -textvar
* which may get freed during validation
*/
- oldSource = (char *) ckalloc((unsigned) (valueLen + 1));
- strcpy(oldSource, value);
- value = oldSource;
+ char *tmp = (char *) ckalloc((unsigned) (valueLen + 1));
+ strcpy(tmp, value);
+ value = tmp;
malloced = 1;
entryPtr->flags |= VALIDATE_VAR;
@@ -2516,19 +2520,20 @@ EntrySetValue(entryPtr, value)
*/
if (entryPtr->flags & VALIDATE_ABORT) {
entryPtr->flags &= ~VALIDATE_ABORT;
- ckfree(value);
+ ckfree((char *)value);
return;
}
}
oldSource = entryPtr->string;
- ckfree(entryPtr->string);
+ ckfree((char *)entryPtr->string);
if (malloced) {
entryPtr->string = value;
} else {
- entryPtr->string = (char *) ckalloc((unsigned) (valueLen + 1));
- strcpy(entryPtr->string, value);
+ char *tmp = (char *) ckalloc((unsigned) (valueLen + 1));
+ strcpy(tmp, value);
+ entryPtr->string = tmp;
}
entryPtr->numBytes = valueLen;
entryPtr->numChars = Tcl_NumUtfChars(value, valueLen);
@@ -2955,7 +2960,7 @@ EntryFetchSelection(clientData, offset, buffer, maxBytes)
{
Entry *entryPtr = (Entry *) clientData;
int byteCount;
- char *string;
+ CONST char *string;
CONST char *selStart, *selEnd;
if ((entryPtr->selectFirst < 0) || !(entryPtr->exportSelection)) {
@@ -3276,7 +3281,7 @@ EntryTextVarProc(clientData, interp, name1, name2, flags)
int flags; /* Information about what happened. */
{
Entry *entryPtr = (Entry *) clientData;
- char *value;
+ CONST char *value;
/*
* If the variable is unset, then immediately recreate it unless
@@ -3393,7 +3398,7 @@ EntryValidateChange(entryPtr, change, new, index, type)
register Entry *entryPtr; /* Entry that needs validation. */
char *change; /* Characters to be added/deleted
* (NULL-terminated string). */
- char *new; /* Potential new value of entry string */
+ CONST char *new; /* Potential new value of entry string */
int index; /* index of insert/delete, -1 otherwise */
int type; /* forced, delete, insert,
* focusin or focusout */
@@ -3532,7 +3537,7 @@ ExpandPercents(entryPtr, before, change, new, index, type, dsPtr)
* expressions to be replaced. */
char *change; /* Characters to added/deleted
* (NULL-terminated string). */
- char *new; /* Potential new value of entry string */
+ CONST char *new; /* Potential new value of entry string */
int index; /* index of insert/delete */
int type; /* INSERT or DELETE */
Tcl_DString *dsPtr; /* Dynamic string in which to append
@@ -3695,6 +3700,7 @@ Tk_SpinboxObjCmd(clientData, interp, objc, objv)
register Spinbox *sbPtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
+ char *tmp;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?");
@@ -3733,8 +3739,9 @@ Tk_SpinboxObjCmd(clientData, interp, objc, objv)
(ClientData) sbPtr, EntryCmdDeletedProc);
entryPtr->optionTable = optionTable;
entryPtr->type = TK_SPINBOX;
- entryPtr->string = (char *) ckalloc(1);
- entryPtr->string[0] = '\0';
+ tmp = (char *) ckalloc(1);
+ tmp[0] = '\0';
+ entryPtr->string = tmp;
entryPtr->selectFirst = -1;
entryPtr->selectLast = -1;
@@ -3929,7 +3936,7 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
goto error;
}
- Tcl_SetResult(interp, entryPtr->string, TCL_STATIC);
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
break;
}
@@ -4217,7 +4224,7 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
if (objc == 3) {
EntryValueChanged(entryPtr, Tcl_GetString(objv[2]));
}
- Tcl_SetResult(interp, entryPtr->string, TCL_STATIC);
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
break;
}
diff --git a/generic/tkGet.c b/generic/tkGet.c
index 7beeff7..24b130d 100644
--- a/generic/tkGet.c
+++ b/generic/tkGet.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: tkGet.c,v 1.7 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkGet.c,v 1.8 2002/01/25 21:09:37 dgp Exp $
*/
#include "tkInt.h"
@@ -548,7 +548,7 @@ Tk_GetScreenMM(interp, tkwin, string, doublePtr)
Tk_Window tkwin; /* Window whose screen determines conversion
* from centimeters and other absolute
* units. */
- char *string; /* String describing a screen distance. */
+ CONST char *string; /* String describing a screen distance. */
double *doublePtr; /* Place to store converted result. */
{
char *end;
@@ -624,7 +624,7 @@ Tk_GetPixels(interp, tkwin, string, intPtr)
Tk_Window tkwin; /* Window whose screen determines conversion
* from centimeters and other absolute
* units. */
- char *string; /* String describing a number of pixels. */
+ CONST char *string; /* String describing a number of pixels. */
int *intPtr; /* Place to store converted result. */
{
double d;
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index 847d4b8..726f5da 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkImgBmap.c,v 1.13 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkImgBmap.c,v 1.14 2002/01/25 21:09:37 dgp Exp $
*/
#include "tkInt.h"
@@ -498,7 +498,8 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
int *hotXPtr, *hotYPtr; /* Position of hot spot or -1,-1. */
{
int width, height, numBytes, hotX, hotY;
- char *p, *end, *expandedFileName;
+ CONST char *expandedFileName;
+ char *p, *end;
ParseInfo pi;
char *data = NULL;
Tcl_DString buffer;
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index bfbd254..59f6087 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -15,7 +15,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPhoto.c,v 1.26 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.27 2002/01/25 21:09:37 dgp Exp $
*/
#include "tkInt.h"
@@ -578,8 +578,8 @@ ImgPhotoCmd(clientData, interp, objc, objv)
int dataWidth, dataHeight;
struct SubcommandOptions options;
int listArgc;
- char **listArgv;
- char **srcArgv;
+ CONST char **listArgv;
+ CONST char **srcArgv;
unsigned char *pixelPtr;
Tk_PhotoImageBlock block;
Tk_Window tkwin;
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 4a0593e..38f7dd4 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -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: tkInt.decls,v 1.23 2001/12/04 03:07:43 mdejong Exp $
+# RCS: @(#) $Id: tkInt.decls,v 1.24 2002/01/25 21:09:37 dgp Exp $
library tk
@@ -178,7 +178,8 @@ declare 32 generic {
}
declare 33 generic {
- char * TkGetDefaultScreenName (Tcl_Interp *interp, char *screenName)
+ CONST char * TkGetDefaultScreenName (Tcl_Interp *interp, \
+ CONST char *screenName)
}
declare 34 generic {
@@ -287,7 +288,7 @@ declare 57 generic {
}
declare 58 generic {
- void TkpDisplayWarning (char *msg, char *title)
+ void TkpDisplayWarning (CONST char *msg, CONST char *title)
}
declare 59 generic {
@@ -328,7 +329,7 @@ declare 67 generic {
}
declare 68 generic {
- TkDisplay * TkpOpenDisplay (char *display_name)
+ TkDisplay * TkpOpenDisplay (CONST char *display_name)
}
declare 69 generic {
@@ -1366,7 +1367,7 @@ declare 61 win {
}
declare 62 win {
- void XSetCommand (Display* d, Window w, char** c, int i)
+ void XSetCommand (Display* d, Window w, CONST char** c, int i)
}
declare 63 win {
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index 003b4b7..e98e518 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -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: tkIntDecls.h,v 1.15 2001/12/04 03:07:43 mdejong Exp $
+ * RCS: @(#) $Id: tkIntDecls.h,v 1.16 2002/01/25 21:09:37 dgp Exp $
*/
#ifndef _TKINTDECLS
@@ -141,8 +141,8 @@ EXTERN void TkGetButtPoints _ANSI_ARGS_((double p1[],
EXTERN TkCursor * TkGetCursorByName _ANSI_ARGS_((Tcl_Interp * interp,
Tk_Window tkwin, Tk_Uid string));
/* 33 */
-EXTERN char * TkGetDefaultScreenName _ANSI_ARGS_((
- Tcl_Interp * interp, char * screenName));
+EXTERN CONST char * TkGetDefaultScreenName _ANSI_ARGS_((
+ Tcl_Interp * interp, CONST char * screenName));
/* 34 */
EXTERN TkDisplay * TkGetDisplay _ANSI_ARGS_((Display * display));
/* 35 */
@@ -214,8 +214,8 @@ EXTERN void TkpCloseDisplay _ANSI_ARGS_((TkDisplay * dispPtr));
EXTERN void TkpClaimFocus _ANSI_ARGS_((TkWindow * topLevelPtr,
int force));
/* 58 */
-EXTERN void TkpDisplayWarning _ANSI_ARGS_((char * msg,
- char * title));
+EXTERN void TkpDisplayWarning _ANSI_ARGS_((CONST char * msg,
+ CONST char * title));
/* 59 */
EXTERN void TkpGetAppName _ANSI_ARGS_((Tcl_Interp * interp,
Tcl_DString * name));
@@ -241,7 +241,8 @@ EXTERN Window TkpMakeWindow _ANSI_ARGS_((TkWindow * winPtr,
EXTERN void TkpMenuNotifyToplevelCreate _ANSI_ARGS_((
Tcl_Interp * interp1, char * menuName));
/* 68 */
-EXTERN TkDisplay * TkpOpenDisplay _ANSI_ARGS_((char * display_name));
+EXTERN TkDisplay * TkpOpenDisplay _ANSI_ARGS_((
+ CONST char * display_name));
/* 69 */
EXTERN int TkPointerEvent _ANSI_ARGS_((XEvent * eventPtr,
TkWindow * winPtr));
@@ -520,7 +521,7 @@ typedef struct TkIntStubs {
char * (*tkGetBitmapData) _ANSI_ARGS_((Tcl_Interp * interp, char * string, char * fileName, int * widthPtr, int * heightPtr, int * hotXPtr, int * hotYPtr)); /* 30 */
void (*tkGetButtPoints) _ANSI_ARGS_((double p1[], double p2[], double width, int project, double m1[], double m2[])); /* 31 */
TkCursor * (*tkGetCursorByName) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_Uid string)); /* 32 */
- char * (*tkGetDefaultScreenName) _ANSI_ARGS_((Tcl_Interp * interp, char * screenName)); /* 33 */
+ CONST char * (*tkGetDefaultScreenName) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * screenName)); /* 33 */
TkDisplay * (*tkGetDisplay) _ANSI_ARGS_((Display * display)); /* 34 */
int (*tkGetDisplayOf) _ANSI_ARGS_((Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], Tk_Window * tkwinPtr)); /* 35 */
TkWindow * (*tkGetFocusWin) _ANSI_ARGS_((TkWindow * winPtr)); /* 36 */
@@ -545,7 +546,7 @@ typedef struct TkIntStubs {
int (*tkpChangeFocus) _ANSI_ARGS_((TkWindow * winPtr, int force)); /* 55 */
void (*tkpCloseDisplay) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 56 */
void (*tkpClaimFocus) _ANSI_ARGS_((TkWindow * topLevelPtr, int force)); /* 57 */
- void (*tkpDisplayWarning) _ANSI_ARGS_((char * msg, char * title)); /* 58 */
+ void (*tkpDisplayWarning) _ANSI_ARGS_((CONST char * msg, CONST char * title)); /* 58 */
void (*tkpGetAppName) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * name)); /* 59 */
TkWindow * (*tkpGetOtherWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 60 */
TkWindow * (*tkpGetWrapperWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 61 */
@@ -555,7 +556,7 @@ typedef struct TkIntStubs {
void (*tkpMakeMenuWindow) _ANSI_ARGS_((Tk_Window tkwin, int transient)); /* 65 */
Window (*tkpMakeWindow) _ANSI_ARGS_((TkWindow * winPtr, Window parent)); /* 66 */
void (*tkpMenuNotifyToplevelCreate) _ANSI_ARGS_((Tcl_Interp * interp1, char * menuName)); /* 67 */
- TkDisplay * (*tkpOpenDisplay) _ANSI_ARGS_((char * display_name)); /* 68 */
+ TkDisplay * (*tkpOpenDisplay) _ANSI_ARGS_((CONST char * display_name)); /* 68 */
int (*tkPointerEvent) _ANSI_ARGS_((XEvent * eventPtr, TkWindow * winPtr)); /* 69 */
int (*tkPolygonToArea) _ANSI_ARGS_((double * polyPtr, int numPoints, double * rectPtr)); /* 70 */
double (*tkPolygonToPoint) _ANSI_ARGS_((double * polyPtr, int numPoints, double * pointPtr)); /* 71 */
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index 36cdcf9..8597d98 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -9,7 +9,7 @@
* Copyright (c) 1998-1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tkIntXlibDecls.h,v 1.13 2000/02/10 08:52:34 hobbs Exp $
+ * RCS: @(#) $Id: tkIntXlibDecls.h,v 1.14 2002/01/25 21:09:37 dgp Exp $
*/
#ifndef _TKINTXLIBDECLS
@@ -231,7 +231,7 @@ EXTERN Status XSendEvent _ANSI_ARGS_((Display* d, Window w, Bool b,
long l, XEvent* x));
/* 62 */
EXTERN void XSetCommand _ANSI_ARGS_((Display* d, Window w,
- char** c, int i));
+ CONST char** c, int i));
/* 63 */
EXTERN void XSetIconName _ANSI_ARGS_((Display* d, Window w,
_Xconst char* c));
@@ -720,7 +720,7 @@ typedef struct TkIntXlibStubs {
void (*xResizeWindow) _ANSI_ARGS_((Display* d, Window w, unsigned int ui1, unsigned int ui2)); /* 59 */
void (*xSelectInput) _ANSI_ARGS_((Display* d, Window w, long l)); /* 60 */
Status (*xSendEvent) _ANSI_ARGS_((Display* d, Window w, Bool b, long l, XEvent* x)); /* 61 */
- void (*xSetCommand) _ANSI_ARGS_((Display* d, Window w, char** c, int i)); /* 62 */
+ void (*xSetCommand) _ANSI_ARGS_((Display* d, Window w, CONST char** c, int i)); /* 62 */
void (*xSetIconName) _ANSI_ARGS_((Display* d, Window w, _Xconst char* c)); /* 63 */
void (*xSetInputFocus) _ANSI_ARGS_((Display* d, Window w, int i, Time t)); /* 64 */
void (*xSetSelectionOwner) _ANSI_ARGS_((Display* d, Atom a, Window w, Time t)); /* 65 */
diff --git a/generic/tkMain.c b/generic/tkMain.c
index c2ea87a..d5c6acb 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.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: tkMain.c,v 1.11 2002/01/15 21:29:12 dgp Exp $
+ * RCS: @(#) $Id: tkMain.c,v 1.12 2002/01/25 21:09:37 dgp Exp $
*/
#include <ctype.h>
@@ -62,8 +62,6 @@ extern int isatty _ANSI_ARGS_((int fd));
#endif
extern char * strrchr _ANSI_ARGS_((CONST char *string, int c));
#endif
-extern void TkpDisplayWarning _ANSI_ARGS_((char *msg,
- char *title));
/*
* Forward declarations for procedures defined later in this file.
@@ -165,7 +163,7 @@ Tk_MainEx(argc, argv, appInitProc, interp)
* and "argv".
*/
- args = Tcl_Merge(argc-1, argv+1);
+ args = Tcl_Merge(argc-1, (CONST char **)argv+1);
Tcl_ExternalToUtfDString(NULL, args, -1, &argString);
Tcl_SetVar(interp, "argv", Tcl_DStringValue(&argString), TCL_GLOBAL_ONLY);
Tcl_DStringFree(&argString);
@@ -409,12 +407,12 @@ Prompt(interp, partial)
* exists a partial command, so use
* the secondary prompt. */
{
- char *promptCmd;
+ Tcl_Obj *promptCmd;
int code;
Tcl_Channel outChannel, errChannel;
- promptCmd = Tcl_GetVar(interp,
- partial ? "tcl_prompt2" : "tcl_prompt1", TCL_GLOBAL_ONLY);
+ promptCmd = Tcl_GetVar2Ex(interp,
+ partial ? "tcl_prompt2" : "tcl_prompt1", NULL, TCL_GLOBAL_ONLY);
if (promptCmd == NULL) {
defaultPrompt:
if (!partial) {
@@ -431,7 +429,7 @@ defaultPrompt:
}
}
} else {
- code = Tcl_Eval(interp, promptCmd);
+ code = Tcl_EvalObjEx(interp, promptCmd, TCL_EVAL_GLOBAL);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
"\n (script that generates prompt)");
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index ff45455..773b1e2 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.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: tkMenu.c,v 1.14 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkMenu.c,v 1.15 2002/01/25 21:09:37 dgp Exp $
*/
/*
@@ -2469,7 +2469,7 @@ MenuVarProc(clientData, interp, name1, name2, flags)
{
TkMenuEntry *mePtr = (TkMenuEntry *) clientData;
TkMenu *menuPtr;
- char *value;
+ CONST char *value;
char *name = Tcl_GetStringFromObj(mePtr->namePtr, NULL);
char *onValue;
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index 05559d7..dd86ae0 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMenubutton.c,v 1.9 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkMenubutton.c,v 1.10 2002/01/25 21:09:37 dgp Exp $
*/
#include "tkMenubutton.h"
@@ -627,7 +627,7 @@ ConfigureMenuButton(interp, mbPtr, objc, objv)
* current value.
*/
- char *value;
+ CONST char *value;
value = Tcl_GetVar(interp, mbPtr->textVarName, TCL_GLOBAL_ONLY);
if (value == NULL) {
@@ -872,7 +872,7 @@ MenuButtonTextVarProc(clientData, interp, name1, name2, flags)
int flags; /* Information about what happened. */
{
register TkMenuButton *mbPtr = (TkMenuButton *) clientData;
- char *value;
+ CONST char *value;
/*
* If the variable is unset, then immediately recreate it unless
diff --git a/generic/tkMessage.c b/generic/tkMessage.c
index 051ee57..648f939 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.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: tkMessage.c,v 1.11 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkMessage.c,v 1.12 2002/01/25 21:09:37 dgp Exp $
*/
#include "tkPort.h"
@@ -479,7 +479,7 @@ ConfigureMessage(interp, msgPtr, objc, objv, flags)
*/
if (msgPtr->textVarName != NULL) {
- char *value;
+ CONST char *value;
value = Tcl_GetVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY);
if (value == NULL) {
@@ -852,7 +852,7 @@ MessageTextVarProc(clientData, interp, name1, name2, flags)
int flags; /* Information about what happened. */
{
register Message *msgPtr = (Message *) clientData;
- char *value;
+ CONST char *value;
/*
* If the variable is unset, then immediately recreate it unless
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 61b1258..1f206fb 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.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: tkOldConfig.c,v 1.9 2000/05/17 21:17:21 ericm Exp $
+ * RCS: @(#) $Id: tkOldConfig.c,v 1.10 2002/01/25 21:09:37 dgp Exp $
*/
#include "tkPort.h"
@@ -707,7 +707,8 @@ FormatConfigInfo(interp, tkwin, specPtr, widgRec)
char *widgRec; /* Pointer to record holding current
* values of info for widget. */
{
- char *argv[6], *result;
+ CONST char *argv[6];
+ char *result;
char buffer[200];
Tcl_FreeProc *freeProc = (Tcl_FreeProc *) NULL;
@@ -735,9 +736,9 @@ FormatConfigInfo(interp, tkwin, specPtr, widgRec)
result = Tcl_Merge(5, argv);
if (freeProc != NULL) {
if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
- ckfree(argv[4]);
+ ckfree((char *)argv[4]);
} else {
- (*freeProc)(argv[4]);
+ (*freeProc)((char *)argv[4]);
}
}
return result;
diff --git a/generic/tkOption.c b/generic/tkOption.c
index f9d9935..173eef0 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.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: tkOption.c,v 1.9 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkOption.c,v 1.10 2002/01/25 21:09:37 dgp Exp $
*/
#include "tkPort.h"
@@ -262,8 +262,8 @@ void
Tk_AddOption(tkwin, name, value, priority)
Tk_Window tkwin; /* Window token; option will be associated
* with main window for this window. */
- char *name; /* Multi-element name of option. */
- char *value; /* String value for option. */
+ CONST char *name; /* Multi-element name of option. */
+ CONST char *value; /* String value for option. */
int priority; /* Overall priority level to use for
* this option, such as TK_USER_DEFAULT_PRIO
* or TK_INTERACTIVE_PRIO. Must be between
@@ -273,8 +273,8 @@ Tk_AddOption(tkwin, name, value, priority)
register ElArray **arrayPtrPtr;
register Element *elPtr;
Element newEl;
- register char *p;
- char *field;
+ register CONST char *p;
+ CONST char *field;
int count, firstField, length;
#define TMP_SIZE 100
char tmp[TMP_SIZE+1];
@@ -1091,7 +1091,8 @@ ReadOptionFile(interp, tkwin, fileName, priority)
* or TK_INTERACTIVE_PRIO. Must be between
* 0 and TK_MAX_PRIO. */
{
- char *realName, *buffer;
+ CONST char *realName;
+ char *buffer;
int result, bufferSize;
Tcl_Channel chan;
Tcl_DString newName;
diff --git a/generic/tkText.c b/generic/tkText.c
index cd8e78c..f749deb 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.c,v 1.24 2002/01/17 03:35:00 dgp Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.25 2002/01/25 21:09:37 dgp Exp $
*/
#include "default.h"
@@ -676,7 +676,7 @@ TextWidgetCmd(clientData, interp, argc, argv)
} else if ((c == 'i') && (strncmp(argv[1], "insert", length) == 0)
&& (length >= 3)) {
int i, j, numTags;
- char **tagNames;
+ CONST char **tagNames;
TkTextTag **oldTagArrayPtr;
if (argc < 4) {
@@ -2125,7 +2125,7 @@ TkTextGetTabs(interp, tkwin, string)
* the text manual entry for details. */
{
int argc, i, count, c;
- char **argv;
+ CONST char **argv;
TkTextTabArray *tabArrayPtr;
TkTextTab *tabPtr;
Tcl_UniChar ch;
@@ -2458,7 +2458,7 @@ DumpSegment(interp, key, value, command, index, what)
Tcl_AppendElement(interp, buffer);
return TCL_OK;
} else {
- char *argv[4];
+ CONST char *argv[4];
char *list;
int result;
argv[0] = key;
diff --git a/generic/tkText.h b/generic/tkText.h
index 8afbea8..79e5220 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.h,v 1.9 2001/12/05 18:18:22 hobbs Exp $
+ * RCS: @(#) $Id: tkText.h,v 1.10 2002/01/25 21:09:37 dgp Exp $
*/
#ifndef _TKTEXT
@@ -834,7 +834,7 @@ EXTERN int TkTextDLineInfo _ANSI_ARGS_((TkText *textPtr,
TkTextIndex *indexPtr, int *xPtr, int *yPtr,
int *widthPtr, int *heightPtr, int *basePtr));
EXTERN TkTextTag * TkTextCreateTag _ANSI_ARGS_((TkText *textPtr,
- char *tagName));
+ CONST char *tagName));
EXTERN void TkTextFreeDInfo _ANSI_ARGS_((TkText *textPtr));
EXTERN void TkTextFreeTag _ANSI_ARGS_((TkText *textPtr,
TkTextTag *tagPtr));
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index 689de37..8f1d71f 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.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: tkTextTag.c,v 1.6 2001/11/13 00:19:05 hobbs Exp $
+ * RCS: @(#) $Id: tkTextTag.c,v 1.7 2002/01/25 21:09:37 dgp Exp $
*/
#include "default.h"
@@ -250,7 +250,7 @@ TkTextTagCmd(textPtr, interp, argc, argv)
command = Tk_GetBinding(interp, textPtr->bindingTable,
(ClientData) tagPtr, argv[4]);
if (command == NULL) {
- char *string = Tcl_GetStringResult(interp);
+ CONST char *string = Tcl_GetStringResult(interp);
/*
* Ignore missing binding errors. This is a special hack
@@ -804,7 +804,7 @@ TkTextTagCmd(textPtr, interp, argc, argv)
TkTextTag *
TkTextCreateTag(textPtr, tagName)
TkText *textPtr; /* Widget in which tag is being used. */
- char *tagName; /* Name of desired tag. */
+ CONST char *tagName; /* Name of desired tag. */
{
register TkTextTag *tagPtr;
Tcl_HashEntry *hPtr;
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index ae02e35..c77e482 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.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: tkWindow.c,v 1.40 2001/10/16 21:45:28 hobbs Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.41 2002/01/25 21:09:37 dgp Exp $
*/
#include "tkPort.h"
@@ -206,7 +206,7 @@ static Tk_Window CreateTopLevelWindow _ANSI_ARGS_((Tcl_Interp *interp,
static void DeleteWindowsExitProc _ANSI_ARGS_((
ClientData clientData));
static TkDisplay * GetScreen _ANSI_ARGS_((Tcl_Interp *interp,
- char *screenName, int *screenPtr));
+ CONST char *screenName, int *screenPtr));
static int Initialize _ANSI_ARGS_((Tcl_Interp *interp));
static int NameWindow _ANSI_ARGS_((Tcl_Interp *interp,
TkWindow *winPtr, TkWindow *parentPtr,
@@ -356,12 +356,12 @@ CreateTopLevelWindow(interp, parent, name, screenName, flags)
static TkDisplay *
GetScreen(interp, screenName, screenPtr)
Tcl_Interp *interp; /* Place to leave error message. */
- char *screenName; /* Name for screen. NULL or empty means
+ CONST char *screenName; /* Name for screen. NULL or empty means
* use DISPLAY envariable. */
int *screenPtr; /* Where to store screen number. */
{
register TkDisplay *dispPtr;
- char *p;
+ CONST char *p;
int screenId;
size_t length;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
@@ -2209,7 +2209,7 @@ Tk_SetClassProcs(tkwin, procs, instanceData)
Tk_Window
Tk_NameToWindow(interp, pathName, tkwin)
Tcl_Interp *interp; /* Where to report errors. */
- char *pathName; /* Path name of window. */
+ CONST char *pathName; /* Path name of window. */
Tk_Window tkwin; /* Token for window: name is assumed to
* belong to the same main window as tkwin. */
{
@@ -2830,7 +2830,9 @@ Initialize(interp)
{
char *p;
int argc, code;
- char **argv, *args[20];
+ CONST char **argv;
+ char *args[20];
+ CONST char *argString = NULL;
Tcl_DString class;
ThreadSpecificData *tsdPtr;
@@ -2940,7 +2942,7 @@ Initialize(interp)
* cross interp refcounting and changing the code below.
*/
- p = Tcl_GetStringResult(master);
+ argString = Tcl_GetStringResult(master);
} else {
/*
* If there is an "argv" variable, get its value, extract out
@@ -2948,13 +2950,13 @@ Initialize(interp)
* the arguments that we used.
*/
- p = Tcl_GetVar2(interp, "argv", (char *) NULL, TCL_GLOBAL_ONLY);
+ argString = Tcl_GetVar2(interp, "argv", (char *) NULL, TCL_GLOBAL_ONLY);
}
argv = NULL;
- if (p != NULL) {
+ if (argString != NULL) {
char buffer[TCL_INTEGER_SPACE];
- if (Tcl_SplitList(interp, p, &argc, &argv) != TCL_OK) {
+ if (Tcl_SplitList(interp, argString, &argc, &argv) != TCL_OK) {
argError:
Tcl_AddErrorInfo(interp,
"\n (processing arguments in argv variable)");