diff options
45 files changed, 334 insertions, 240 deletions
@@ -1,3 +1,75 @@ +2002-01-25 Don Porter <dgp@users.sourceforge.net> + + * doc/AddOption.3: + * doc/CanvTkWin.3: + * doc/GetPixels.3: + * doc/Name.3: + * doc/ParseArgv.3: + * generic/tk.decls (Tk_AddOption,Tk_CanvasGetCoord,Tk_GetPixels, + Tk_GetScreenMM,Tk_NameToWindow,Tk_ParseArgv): + * generic/tkArgv.c (Tk_ParseArgv): + * generic/tkCanvLine.c (ParseArrowShape): + * generic/tkCanvUtil.c (Tk_CanvasGetCoord,Tk_CanvasTagsParseProc, + Tk_CanvasTagsPrintProc,Tk_GetDash): + * generic/tkCanvas.c (ConfigureCanvas): + * generic/tkGet.c (Tk_GetPixels,Tk_GetScreenMM): + * generic/tkImgPhoto.c (ImgPhotoCmd): + * generic/tkMain.c (Tk_MainEx): + * generic/tkOldConfig.c (FormatConfigInfo): + * generic/tkOption.c (Tk_AddOption): + * generic/tkText.c (TextWidgetCmd,TkTextGetTabs,DumpSegment): + * generic/tkText.h (TkTextCreateTag): + * generic/tkTextTag.c (TkTextCreateTag): + * generic/tkWindow.c (Tk_NameToWindow,Initialize): + * mac/tkMacCursor.c (FindCursorByName,TkGetCursorByName): + * mac/tkMacWm.c (Tk_WmCmd): + * unix/tkUnixCursor.c (TkGetCursorByName): + * unix/tkUnixSend.c (ValidateName): + * unix/tkUnixWm.c (Tk_WmCmd): + * win/tkWinCursor.c (TkGetCursorByName): + * win/tkWinWm.c (Tk_WmCmd): Updated callers of Tcl_SplitList and + Tcl_Merge. + * generic/tkDecls.h: make genstubs + ***POTENTIAL INCOMPATIBILITY*** + Includes a source incompatibility in the argv argument of Tcl_ParseArgv. + + * generic/tkBind.c (DeleteVirtualEvent): + * generic/tkCanvas.c (ScrollFractions,CanvasWidgetCmd, + CanvasUpdateScrollbars): + * generic/tkTestTag.c (TkTextTagCmd): Updated callers of + Tcl_GetStringResult. Rewrote PrintScrollFractions to + ScrollFractions to stop scribbling directly on interp->result. + + * generic/tkInt.decls (TkGetDefaultScreenName,TkpDisplayWarning, + TkpOpenDisplay): + * generic/tkCanvPs.c (Tk_PostscriptColor,Tk_PostscriptFont): + * generic/tkEntry.c (EntrySetValue,EntryValidateChange,ExpandPercents, + EntryValueChanged,Tk_EntryObjCmd,DestroyEntry,ConfigureEntry, + EntryComputeGeometry,InsertChars,DeleteChars,EntryFetchSelection, + EntryTextVarProc,Tk_SpinBoxObjCmd,SpinboxWidgetObjCmd): + * generic/tkMain.c (Prompt): + * generic/tkMenu.c (MenuVarProc): + * generic/tkMenubutton.c (ConfigureMenuButton,MenuButtonTextVarProc): + * generic/tkMessage.c (ConfigureMessage,MessageTextVarProc): + * generic/tkWindow.c (GetScreen,Initialize): + * mac/tkMacInit.c (TkpInit,TkpDisplayWarning): + * mac/tkMacXStubs.c (TkGetDefaultScreenName,TkpOpenDisplay): + * unix/tkUnix.c (TkGetDefaultScreenName): + * unix/tkUnixEvent.c (TkpOpenDisplay): + * unix/tkUnixInit.c (TkpGetAppName,TkpDisplayWarning): + * unix/tkUnixSend.c (SendEventProc): + * win/tkWinInit.c (TkpGetAppName,TkpDisplayWarning): + * win/tkWinX.c (TkGetDefaultScreenName,TkpOpenDisplay): Updated + callers of Tcl_GetVar, Tcl_GetVar2 + * generic/tkIntDecls.h: make genstubs + + * generic/tkCanvPs.c (TkCanvPostscriptCmd): + * generic/tkImgBmap.c (TkGetBitmapData): + * generic/tkOption.c (ReadOptionFile): + * mac/tkMacInit.c (TkpInit,TkpGetAppName): + * win/tkWinInit.c (TkpGetAppName): Updated callers of + Tcl_SplitPath, Tcl_JoinPath, and Tcl_TranslateFileName. + 2002-01-18 Mo DeJong <mdejong@users.sourceforge.net> * tests/wm.test: Rewrite stackorder tests that diff --git a/doc/AddOption.3 b/doc/AddOption.3 index d6c7ca5..940904b 100644 --- a/doc/AddOption.3 +++ b/doc/AddOption.3 @@ -2,7 +2,7 @@ '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" -'\" RCS: @(#) $Id: AddOption.3,v 1.1 2000/04/24 19:00:14 ericm Exp $ +'\" RCS: @(#) $Id: AddOption.3,v 1.2 2002/01/25 21:09:36 dgp Exp $ '\" '\" .so man.macros @@ -19,9 +19,9 @@ void .SH ARGUMENTS .AP Tk_Window tkwin in Token for window. -.AP char *name in +.AP "CONST char" *name in Multi-element name of option. -.AP char *value in +.AP "CONST char" *value in Value of option. .AP int priority in Overall priority level to use for option. diff --git a/doc/CanvTkwin.3 b/doc/CanvTkwin.3 index bc9490c..927b73e 100644 --- a/doc/CanvTkwin.3 +++ b/doc/CanvTkwin.3 @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: CanvTkwin.3,v 1.2 1998/09/14 18:22:45 stanton Exp $ +'\" RCS: @(#) $Id: CanvTkwin.3,v 1.3 2002/01/25 21:09:36 dgp Exp $ '\" .so man.macros .TH Tk_CanvasTkwin 3 4.1 Tk "Tk Library Procedures" @@ -38,7 +38,7 @@ Tk_OptionPrintProc *\fBTk_CanvasTagsPrintProc\fR; A token that identifies a canvas widget. .AP Tcl_Interp *interp in/out Interpreter to use for error reporting. -.AP char *string in +.AP "CONST char" *string in Textual description of a canvas coordinate. .AP double *doublePtr out Points to place to store a converted coordinate. diff --git a/doc/GetPixels.3 b/doc/GetPixels.3 index 3df2985..7330018 100644 --- a/doc/GetPixels.3 +++ b/doc/GetPixels.3 @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: GetPixels.3,v 1.3 1999/04/16 01:51:08 stanton Exp $ +'\" RCS: @(#) $Id: GetPixels.3,v 1.4 2002/01/25 21:09:36 dgp Exp $ '\" .so man.macros .TH Tk_GetPixelsFromObj 3 8.1 Tk "Tk Library Procedures" @@ -42,7 +42,7 @@ units and pixels. .AP Tcl_Obj *objPtr in/out String value specifies a distance on the screen; internal rep will be modified to cache converted distance. -.AP char *string in +.AP "CONST char" *string in Same as \fIobjPtr\fR except specification of distance is passed as a string. .VE @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: Name.3,v 1.2 1998/09/14 18:22:52 stanton Exp $ +'\" RCS: @(#) $Id: Name.3,v 1.3 2002/01/25 21:09:36 dgp Exp $ '\" .so man.macros .TH Tk_Name 3 "" Tk "Tk Library Procedures" @@ -30,7 +30,7 @@ Tk_Window Token for window. .AP Tcl_Interp *interp out Interpreter to use for error reporting. -.AP char *pathName in +.AP "CONST char" *pathName in Character string containing path name of window. .BE diff --git a/doc/ParseArgv.3 b/doc/ParseArgv.3 index 2ed9034..10152c1 100644 --- a/doc/ParseArgv.3 +++ b/doc/ParseArgv.3 @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: ParseArgv.3,v 1.2 1998/09/14 18:22:53 stanton Exp $ +'\" RCS: @(#) $Id: ParseArgv.3,v 1.3 2002/01/25 21:09:36 dgp Exp $ '\" .so man.macros .TH Tk_ParseArgv 3 "" Tk "Tk Library Procedures" @@ -28,7 +28,7 @@ no Tk options will be processed. .AP int argcPtr in/out Pointer to number of arguments in argv; gets modified to hold number of unprocessed arguments that remain after the call. -.AP char **argv in/out +.AP "CONST char" **argv in/out Command line arguments passed to main program. Modified to hold unprocessed arguments that remain after the call. .AP Tk_ArgvInfo *argTable in 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)"); diff --git a/mac/tkMacCursor.c b/mac/tkMacCursor.c index f03f207..1a5ded8 100644 --- a/mac/tkMacCursor.c +++ b/mac/tkMacCursor.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: tkMacCursor.c,v 1.5 1999/04/16 01:51:30 stanton Exp $ + * RCS: @(#) $Id: tkMacCursor.c,v 1.6 2002/01/25 21:09:37 dgp Exp $ */ #include "tkPort.h" @@ -80,7 +80,7 @@ static int gTkOwnsCursor = true; /* A boolean indicating whether */ static void FindCursorByName _ANSI_ARGS_ ((TkMacCursor *macCursorPtr, - char *string)); + CONST char *string)); /* *---------------------------------------------------------------------- @@ -105,7 +105,7 @@ static void FindCursorByName _ANSI_ARGS_ ((TkMacCursor *macCursorPtr, void FindCursorByName( TkMacCursor *macCursorPtr, - char *string) + CONST char *string) { Handle resource; Str255 curName; @@ -200,7 +200,7 @@ TkGetCursorByName( FindCursorByName(macCursorPtr, string); if (macCursorPtr->macCursor == NULL) { - char **argv; + CONST char **argv; int argc, err; /* diff --git a/mac/tkMacInit.c b/mac/tkMacInit.c index 9e70594..e461073 100644 --- a/mac/tkMacInit.c +++ b/mac/tkMacInit.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: tkMacInit.c,v 1.5 2001/12/27 22:45:10 das Exp $ + * RCS: @(#) $Id: tkMacInit.c,v 1.6 2002/01/25 21:09:37 dgp Exp $ */ #include <Resources.h> @@ -54,7 +54,7 @@ int TkpInit( Tcl_Interp *interp) /* Interp to initialize. */ { - char *libDir, *tempPath; + CONST char *libDir, *tempPath; Tcl_DString path, ds; int result; @@ -115,7 +115,7 @@ tkInit"; tempPath = TclGetEnv("EXT_FOLDER", &ds); if ((tempPath != NULL) && (tempPath[0] != '\0')) { Tcl_DString libPath; - char *argv[3]; + CONST char *argv[3]; argv[0] = tempPath; argv[1] = "Tool Command Language"; @@ -169,7 +169,7 @@ TkpGetAppName( Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */ { int argc; - char **argv = NULL, *name, *p; + CONST char **argv = NULL, *name, *p; Handle h = NULL; h = GetNamedResource('STR ', "\pTk App Name"); @@ -222,8 +222,8 @@ TkpGetAppName( void TkpDisplayWarning( - char *msg, /* Message to be displayed. */ - char *title) /* Title of warning. */ + CONST char *msg, /* Message to be displayed. */ + CONST char *title) /* Title of warning. */ { Tcl_DString ds; Tcl_DStringInit(&ds); diff --git a/mac/tkMacWm.c b/mac/tkMacWm.c index f96daab..6a7e8c0 100644 --- a/mac/tkMacWm.c +++ b/mac/tkMacWm.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: tkMacWm.c,v 1.13 2001/12/05 01:30:44 das Exp $ + * RCS: @(#) $Id: tkMacWm.c,v 1.14 2002/01/25 21:09:37 dgp Exp $ */ #include <Gestalt.h> @@ -194,7 +194,7 @@ typedef struct TkWmInfo { ProtocolHandler *protPtr; /* First in list of protocol handlers for * this window (NULL means none). */ int cmdArgc; /* Number of elements in cmdArgv below. */ - char **cmdArgv; /* Array of strings to store in the + CONST char **cmdArgv; /* Array of strings to store in the * WM_COMMAND property. NULL means nothing * available. */ char *clientMachine; /* String to store in WM_CLIENT_MACHINE @@ -814,7 +814,7 @@ Tk_WmCmd( TkWindow **cmapList; TkWindow *winPtr2; int i, windowArgc, gotToplevel = 0; - char **windowArgv; + CONST char **windowArgv; if ((argc != 3) && (argc != 4)) { Tcl_AppendResult(interp, "wrong # arguments: must be \"", @@ -880,7 +880,7 @@ Tk_WmCmd( } else if ((c == 'c') && (strncmp(argv[1], "command", length) == 0) && (length >= 3)) { int cmdArgc; - char **cmdArgv; + CONST char **cmdArgv; if ((argc != 3) && (argc != 4)) { Tcl_AppendResult(interp, "wrong # arguments: must be \"", @@ -4231,7 +4231,7 @@ TkUnsupported1Cmd( } else { int foundOne = 0; int attrArgc, i; - char **attrArgv = NULL; + CONST char **attrArgv = NULL; if (Tcl_SplitList(interp, argv[4], &attrArgc, &attrArgv) != TCL_OK) { wmPtr->macClass = oldClass; diff --git a/mac/tkMacXStubs.c b/mac/tkMacXStubs.c index 7fd822e..8661392 100644 --- a/mac/tkMacXStubs.c +++ b/mac/tkMacXStubs.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: tkMacXStubs.c,v 1.10 2000/02/10 09:00:31 jingham Exp $ + * RCS: @(#) $Id: tkMacXStubs.c,v 1.11 2002/01/25 21:09:37 dgp Exp $ */ #include "tkInt.h" @@ -90,7 +90,7 @@ int _XInitImageFuncPtrs _ANSI_ARGS_((XImage *image)); TkDisplay * TkpOpenDisplay( - char *display_name) + CONST char *display_name) { Display *display; Screen *screen; @@ -793,10 +793,10 @@ XCreateIC( *---------------------------------------------------------------------- */ -char * +CONST char * TkGetDefaultScreenName( Tcl_Interp *interp, /* Not used. */ - char *screenName) /* If NULL, use default string. */ + CONST char *screenName) /* If NULL, use default string. */ { if ((screenName == NULL) || (screenName[0] == '\0')) { screenName = macScreenName; diff --git a/unix/tkUnix.c b/unix/tkUnix.c index 769a0b7..0d6ecc5 100644 --- a/unix/tkUnix.c +++ b/unix/tkUnix.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: tkUnix.c,v 1.4 1999/04/16 01:51:45 stanton Exp $ + * RCS: @(#) $Id: tkUnix.c,v 1.5 2002/01/25 21:09:37 dgp Exp $ */ #include <tkInt.h> @@ -68,10 +68,10 @@ TkGetServerInfo(interp, tkwin) *---------------------------------------------------------------------- */ -char * +CONST char * TkGetDefaultScreenName(interp, screenName) Tcl_Interp *interp; /* Interp used to find environment variables. */ - char *screenName; /* Screen name from command line, or NULL. */ + CONST char *screenName; /* Screen name from command line, or NULL. */ { if ((screenName == NULL) || (screenName[0] == '\0')) { screenName = Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY); diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c index 8755a3c..16dd52e 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.4 1999/04/16 01:51:45 stanton Exp $ + * RCS: @(#) $Id: tkUnixCursor.c,v 1.5 2002/01/25 21:09:37 dgp Exp $ */ #include "tkPort.h" @@ -154,7 +154,7 @@ TkGetCursorByName(interp, tkwin, string) TkUnixCursor *cursorPtr = NULL; Cursor cursor = None; int argc; - char **argv = NULL; + CONST char **argv = NULL; Pixmap source = None; Pixmap mask = None; Display *display = Tk_Display(tkwin); diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index 4353154..d2682a7 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.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: tkUnixEvent.c,v 1.3 1999/04/16 01:51:46 stanton Exp $ + * RCS: @(#) $Id: tkUnixEvent.c,v 1.4 2002/01/25 21:09:37 dgp Exp $ */ #include "tkInt.h" @@ -118,7 +118,7 @@ DisplayExitHandler(clientData) TkDisplay * TkpOpenDisplay(display_name) - char *display_name; + CONST char *display_name; { TkDisplay *dispPtr; Display *display = XOpenDisplay(display_name); diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c index 5aa68ef..825b0c1 100644 --- a/unix/tkUnixInit.c +++ b/unix/tkUnixInit.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: tkUnixInit.c,v 1.4 1999/04/16 01:51:46 stanton Exp $ + * RCS: @(#) $Id: tkUnixInit.c,v 1.5 2002/01/25 21:09:37 dgp Exp $ */ #include "tkInt.h" @@ -71,7 +71,7 @@ TkpGetAppName(interp, namePtr) Tcl_Interp *interp; Tcl_DString *namePtr; /* A previously initialized Tcl_DString. */ { - char *p, *name; + CONST char *p, *name; name = Tcl_GetVar(interp, "argv0", TCL_GLOBAL_ONLY); if ((name == NULL) || (*name == 0)) { @@ -104,8 +104,8 @@ TkpGetAppName(interp, namePtr) void TkpDisplayWarning(msg, title) - char *msg; /* Message to be displayed. */ - char *title; /* Title of warning. */ + CONST char *msg; /* Message to be displayed. */ + CONST char *title; /* Title of warning. */ { Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR); if (errChannel) { diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index 597911f..14c8a7e 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.4 1999/04/16 01:51:47 stanton Exp $ + * RCS: @(#) $Id: tkUnixSend.c,v 1.5 2002/01/25 21:09:37 dgp Exp $ */ #include "tkPort.h" @@ -603,7 +603,7 @@ ValidateName(dispPtr, name, commWindow, oldOK) Atom actualType; char *property; Tk_ErrorHandler handler; - char **argv; + CONST char **argv; property = NULL; @@ -1508,7 +1508,7 @@ SendEventProc(clientData, eventPtr) Tcl_DStringAppend(&reply, Tcl_GetStringResult(remoteInterp), -1); if (result == TCL_ERROR) { - char *varValue; + CONST char *varValue; varValue = Tcl_GetVar2(remoteInterp, "errorInfo", (char *) NULL, TCL_GLOBAL_ONLY); diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index d03fb43..ed1a18a 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.11 2001/12/13 01:58:46 hobbs Exp $ + * RCS: @(#) $Id: tkUnixWm.c,v 1.12 2002/01/25 21:09:37 dgp Exp $ */ #include "tkPort.h" @@ -196,7 +196,7 @@ typedef struct TkWmInfo { ProtocolHandler *protPtr; /* First in list of protocol handlers for * this window (NULL means none). */ int cmdArgc; /* Number of elements in cmdArgv below. */ - char **cmdArgv; /* Array of strings to store in the + CONST char **cmdArgv; /* Array of strings to store in the * WM_COMMAND property. NULL means nothing * available. */ char *clientMachine; /* String to store in WM_CLIENT_MACHINE @@ -920,7 +920,8 @@ Tk_WmCmd(clientData, interp, argc, argv) Window *cmapList; TkWindow *winPtr2; int count, i, windowArgc, gotToplevel; - char buffer[20], **windowArgv; + CONST char **windowArgv; + char buffer[20]; if ((argc != 3) && (argc != 4)) { Tcl_AppendResult(interp, "wrong # arguments: must be \"", @@ -993,7 +994,7 @@ Tk_WmCmd(clientData, interp, argc, argv) } else if ((c == 'c') && (strncmp(argv[1], "command", length) == 0) && (length >= 3)) { int cmdArgc; - char **cmdArgv; + CONST char **cmdArgv; if ((argc != 3) && (argc != 4)) { Tcl_AppendResult(interp, "wrong # arguments: must be \"", diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c index 0d200e0..6bcb8ba 100644 --- a/win/tkWinCursor.c +++ b/win/tkWinCursor.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: tkWinCursor.c,v 1.4 1999/12/16 21:59:35 hobbs Exp $ + * RCS: @(#) $Id: tkWinCursor.c,v 1.5 2002/01/25 21:09:37 dgp Exp $ */ #include "tkWinInt.h" @@ -111,7 +111,7 @@ TkGetCursorByName(interp, tkwin, string) } if (string[0] == '@') { int argc; - char **argv = NULL; + CONST char **argv = NULL; if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) { return NULL; } diff --git a/win/tkWinInit.c b/win/tkWinInit.c index eb87599..ad3006a 100644 --- a/win/tkWinInit.c +++ b/win/tkWinInit.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: tkWinInit.c,v 1.6 2001/12/28 23:09:12 hobbs Exp $ + * RCS: @(#) $Id: tkWinInit.c,v 1.7 2002/01/25 21:09:37 dgp Exp $ */ #include "tkWinInt.h" @@ -76,7 +76,7 @@ TkpGetAppName(interp, namePtr) Tcl_DString *namePtr; /* A previously initialized Tcl_DString. */ { int argc; - char **argv = NULL, *name, *p; + CONST char **argv = NULL, *name, *p; name = Tcl_GetVar(interp, "argv0", TCL_GLOBAL_ONLY); if (name != NULL) { @@ -119,8 +119,8 @@ TkpGetAppName(interp, namePtr) void TkpDisplayWarning(msg, title) - char *msg; /* Message to be displayed. */ - char *title; /* Title of warning. */ + CONST char *msg; /* Message to be displayed. */ + CONST char *title; /* Title of warning. */ { Tcl_Encoding unicodeEncoding = Tcl_GetEncoding(NULL, "unicode"); Tcl_DString msgString, titleString; diff --git a/win/tkWinWm.c b/win/tkWinWm.c index cab514f..e68e177 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.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: tkWinWm.c,v 1.33 2001/12/28 23:44:19 hobbs Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.34 2002/01/25 21:09:37 dgp Exp $ */ #include "tkWinInt.h" @@ -240,7 +240,7 @@ typedef struct TkWmInfo { ProtocolHandler *protPtr; /* First in list of protocol handlers for * this window (NULL means none). */ int cmdArgc; /* Number of elements in cmdArgv below. */ - char **cmdArgv; /* Array of strings to store in the + CONST char **cmdArgv; /* Array of strings to store in the * WM_COMMAND property. NULL means nothing * available. */ char *clientMachine; /* String to store in WM_CLIENT_MACHINE @@ -2209,7 +2209,7 @@ Tk_WmCmd(clientData, interp, argc, argv) TkWindow **cmapList; TkWindow *winPtr2; int i, windowArgc, gotToplevel; - char **windowArgv; + CONST char **windowArgv; if ((argc != 3) && (argc != 4)) { Tcl_AppendResult(interp, "wrong # arguments: must be \"", @@ -2278,7 +2278,7 @@ Tk_WmCmd(clientData, interp, argc, argv) } else if ((c == 'c') && (strncmp(argv[1], "command", length) == 0) && (length >= 3)) { int cmdArgc; - char **cmdArgv; + CONST char **cmdArgv; if ((argc != 3) && (argc != 4)) { Tcl_AppendResult(interp, "wrong # arguments: must be \"", diff --git a/win/tkWinX.c b/win/tkWinX.c index d277fc7..e17a8fb 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.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: tkWinX.c,v 1.17 2001/12/28 23:43:24 hobbs Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.18 2002/01/25 21:09:37 dgp Exp $ */ #include "tkWinInt.h" @@ -325,10 +325,10 @@ TkWinGetPlatformId() *---------------------------------------------------------------------- */ -char * +CONST char * TkGetDefaultScreenName(interp, screenName) Tcl_Interp *interp; /* Not used. */ - char *screenName; /* If NULL, use default string. */ + CONST char *screenName; /* If NULL, use default string. */ { if ((screenName == NULL) || (screenName[0] == '\0')) { screenName = winScreenName; @@ -355,7 +355,7 @@ TkGetDefaultScreenName(interp, screenName) TkDisplay * TkpOpenDisplay(display_name) - char *display_name; + CONST char *display_name; { Screen *screen; HDC dc; |