From cfe62cbebc1beaa8564e7f7e4075c7b99763ac10 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Tue, 28 Oct 2008 22:33:06 +0000 Subject: CONSTify TkPrintPadAmount, TkCreateFrame, TkCreateMainWindow and Tk_ParseArgv. move TkSelGetSelection to internal stub table (needed in tkWinTest.c) --- ChangeLog | 20 ++++++++++++++++++++ generic/tk.decls | 4 ++-- generic/tk.h | 34 +++++++++++++++++----------------- generic/tkArgv.c | 18 +++++++++--------- generic/tkAtom.c | 8 ++++---- generic/tkClipboard.c | 6 +++--- generic/tkDecls.h | 6 +++--- generic/tkEntry.c | 8 ++++---- generic/tkFrame.c | 14 +++++++------- generic/tkImgPhoto.c | 15 ++++++++------- generic/tkInt.decls | 11 ++++++++--- generic/tkInt.h | 4 ++-- generic/tkIntDecls.h | 26 ++++++++++++++++++++------ generic/tkPack.c | 4 ++-- generic/tkSelect.c | 6 +++--- generic/tkSelect.h | 5 +---- generic/tkStubInit.c | 3 ++- generic/tkVisual.c | 8 ++++---- generic/tkWindow.c | 8 ++++---- win/tkWinTest.c | 21 +++++++++------------ 20 files changed, 132 insertions(+), 97 deletions(-) diff --git a/ChangeLog b/ChangeLog index a625bfc..78f99af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2008-10-28 Jan Nijtmans + + * generic/tk.h: Add "const" to a few struct member fields. + * generic/tkInt.h CONSTify TkPrintPadAmount + * generic/tkSelect.h move TkSelGetSelection to tkInt.decls + * generic/tk.decls CONSTify Tk_ParseArgv + * generic/tkInt.decls CONSTify TkCreateFrame and TkCreateMainWindow + * generic/tkDecls.h: (regenerated) + * generic/tkIntDecls.h: (regenerated) + * generic/tkArgv.c + * generic/tkAtom.c + * generic/tkEntry.c + * generic/tkFrame.c + * generic/tkImgPhoto.c + * generic/tkPack.c + * generic/tkSelect.c + * generic/tkVisual.c + * generic/tkWindow.c + * win/tkWinTest.c fix compilation under mingw32 + 2008-10-28 Joe English * library/ttk/cursors.tcl, library/ttk/combobox.tcl, diff --git a/generic/tk.decls b/generic/tk.decls index 540a925..262b922 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.40 2008/10/22 20:56:43 nijtmans Exp $ +# RCS: @(#) $Id: tk.decls,v 1.41 2008/10/28 22:33:06 nijtmans Exp $ library tk @@ -563,7 +563,7 @@ declare 142 generic { declare 143 generic { int Tk_ParseArgv(Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, CONST84 char **argv, - Tk_ArgvInfo *argTable, int flags) + const Tk_ArgvInfo *argTable, int flags) } declare 144 generic { void Tk_PhotoPutBlock_NoComposite(Tk_PhotoHandle handle, diff --git a/generic/tk.h b/generic/tk.h index 01d05e0..98df8f8 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -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: tk.h,v 1.120 2008/10/23 16:15:27 dgp Exp $ + * RCS: @(#) $Id: tk.h,v 1.121 2008/10/28 22:33:06 nijtmans Exp $ */ #ifndef _TK @@ -86,7 +86,7 @@ extern "C" { # undef TCL_STORAGE_CLASS # define TCL_STORAGE_CLASS DLLEXPORT #endif - + /* * Decide whether or not to use input methods. */ @@ -338,7 +338,7 @@ typedef struct Tk_ConfigSpec { int type; /* Type of option, such as TK_CONFIG_COLOR; * see definitions below. Last option in table * must have type TK_CONFIG_END. */ - char *argvName; /* Switch used to specify option in argv. NULL + const char *argvName; /* Switch used to specify option in argv. NULL * means this spec is part of a group. */ Tk_Uid dbName; /* Name for option in option database. */ Tk_Uid dbClass; /* Class for option in database. */ @@ -398,14 +398,14 @@ typedef enum { */ typedef struct { - char *key; /* The key string that flags the option in the + const char *key; /* The key string that flags the option in the * argv array. */ int type; /* Indicates option type; see below. */ char *src; /* Value to be used in setting dst; usage * depends on type. */ char *dst; /* Address of value to be modified; usage * depends on type. */ - char *help; /* Documentation message describing this + const char *help; /* Documentation message describing this * option. */ } Tk_ArgvInfo; @@ -676,7 +676,7 @@ typedef struct { } XActivateDeactivateEvent; typedef XActivateDeactivateEvent XActivateEvent; typedef XActivateDeactivateEvent XDeactivateEvent; - + /* *-------------------------------------------------------------- * @@ -873,7 +873,7 @@ typedef struct Tk_FakeWin { #define TK_WIN_MANAGED 0x10000 #define TK_TOP_HIERARCHY 0x20000 #define TK_PROP_PROPCHANGE 0x40000 - + /* *-------------------------------------------------------------- * @@ -1107,7 +1107,7 @@ typedef struct Tk_CanvasTextInfo { * should be displayed in focusItemPtr. * Read-only to items.*/ } Tk_CanvasTextInfo; - + /* * Structures used for Dashing and Outline. */ @@ -1161,7 +1161,7 @@ typedef struct Tk_Outline { Pixmap disabledStipple; /* Outline Stipple pattern if state is * disabled. */ } Tk_Outline; - + /* *-------------------------------------------------------------- * @@ -1227,7 +1227,7 @@ struct Tk_ImageType { * manager. */ char *reserved; /* reserved for future expansion */ }; - + /* *-------------------------------------------------------------- * @@ -1313,7 +1313,7 @@ typedef int (Tk_ImageStringWriteProc) (Tcl_Interp *interp, Tcl_Obj *format, */ struct Tk_PhotoImageFormat { - char *name; /* Name of image file format */ + const char *name; /* Name of image file format */ Tk_ImageFileMatchProc *fileMatchProc; /* Procedure to call to determine whether an * image file matches this format. */ @@ -1343,7 +1343,7 @@ struct Tk_PhotoImageFormat { #define Tk_CreateImageType Tk_CreateOldImageType #define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat #endif - + /* *-------------------------------------------------------------- * @@ -1411,7 +1411,7 @@ typedef struct Tk_ElementSpec { #define TK_ELEMENT_STATE_DISABLED 1<<1 #define TK_ELEMENT_STATE_FOCUS 1<<2 #define TK_ELEMENT_STATE_PRESSED 1<<3 - + /* *-------------------------------------------------------------- * @@ -1474,7 +1474,7 @@ EXTERN const char * Tk_PkgInitStubsCheck (Tcl_Interp *interp, #define Tk_InitImageArgs(interp, argc, argv) /**/ - + /* *-------------------------------------------------------------- * @@ -1488,13 +1488,13 @@ typedef void (Tk_EventProc) (ClientData clientData, XEvent *eventPtr); typedef int (Tk_GenericProc) (ClientData clientData, XEvent *eventPtr); typedef int (Tk_ClientMessageProc) (Tk_Window tkwin, XEvent *eventPtr); typedef int (Tk_GetSelProc) (ClientData clientData, Tcl_Interp *interp, - char *portion); + CONST86 char *portion); typedef void (Tk_LostSelProc) (ClientData clientData); typedef Tk_RestrictAction (Tk_RestrictProc) (ClientData clientData, XEvent *eventPtr); typedef int (Tk_SelectionProc) (ClientData clientData, int offset, char *buffer, int maxBytes); - + /* *-------------------------------------------------------------- * @@ -1564,7 +1564,7 @@ typedef int (Tk_SelectionProc) (ClientData clientData, int offset, #endif #endif /* _TK */ - + /* * Local Variables: * mode: c diff --git a/generic/tkArgv.c b/generic/tkArgv.c index 95fbe21..2935183 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.15 2008/10/03 13:13:31 dkf Exp $ + * RCS: @(#) $Id: tkArgv.c,v 1.16 2008/10/28 22:33:06 nijtmans Exp $ */ #include "tkInt.h" @@ -30,7 +30,7 @@ static Tk_ArgvInfo defaultTable[] = { * Forward declarations for functions defined in this file: */ -static void PrintUsage(Tcl_Interp *interp, Tk_ArgvInfo *argTable, +static void PrintUsage(Tcl_Interp *interp, const Tk_ArgvInfo *argTable, int flags); /* @@ -65,14 +65,14 @@ Tk_ParseArgv( * hold # args left in argv at end. */ const char **argv, /* Array of arguments. Modified to hold those * that couldn't be processed here. */ - Tk_ArgvInfo *argTable, /* Array of option descriptions */ + const Tk_ArgvInfo *argTable, /* Array of option descriptions */ int flags) /* Or'ed combination of various flag bits, * such as TK_ARGV_NO_DEFAULTS. */ { - register Tk_ArgvInfo *infoPtr; + register const Tk_ArgvInfo *infoPtr; /* Pointer to the current entry in the table * of argument descriptions. */ - Tk_ArgvInfo *matchPtr; /* Descriptor that matches current argument. */ + const Tk_ArgvInfo *matchPtr; /* Descriptor that matches current argument. */ const char *curArg; /* Current argument */ register char c; /* Second character of current arg (used for * quick check for matching; use 2nd char. @@ -228,7 +228,7 @@ Tk_ParseArgv( } break; case TK_ARGV_FUNC: { - typedef int (ArgvFunc)(char *, char *, const char *); + typedef int (ArgvFunc)(char *, const char *, const char *); ArgvFunc *handlerProc = (ArgvFunc *) infoPtr->src; if ((*handlerProc)(infoPtr->dst, infoPtr->key, argv[srcIndex])) { @@ -238,7 +238,7 @@ Tk_ParseArgv( break; } case TK_ARGV_GENFUNC: { - typedef int (ArgvGenFunc)(char *, Tcl_Interp *, char *, int, + typedef int (ArgvGenFunc)(char *, Tcl_Interp *, const char *, int, const char **); ArgvGenFunc *handlerProc = (ArgvGenFunc *) infoPtr->src; @@ -330,13 +330,13 @@ static void PrintUsage( Tcl_Interp *interp, /* Place information in this interp's result * area. */ - Tk_ArgvInfo *argTable, /* Array of command-specific argument + const Tk_ArgvInfo *argTable, /* Array of command-specific argument * descriptions. */ int flags) /* If the TK_ARGV_NO_DEFAULTS bit is set in * this word, then don't generate information * for default options. */ { - register Tk_ArgvInfo *infoPtr; + register const Tk_ArgvInfo *infoPtr; size_t width, i, numSpaces; char tmp[TCL_DOUBLE_SPACE]; diff --git a/generic/tkAtom.c b/generic/tkAtom.c index 1028ea0..145de4d 100644 --- a/generic/tkAtom.c +++ b/generic/tkAtom.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: tkAtom.c,v 1.8 2008/04/27 22:38:55 dkf Exp $ + * RCS: @(#) $Id: tkAtom.c,v 1.9 2008/10/28 22:33:06 nijtmans Exp $ */ #include "tkInt.h" @@ -22,7 +22,7 @@ * those found in xatom.h */ -static char * atomNameArray[] = { +static const char * atomNameArray[] = { "PRIMARY", "SECONDARY", "ARC", "ATOM", "BITMAP", "CARDINAL", "COLORMAP", "CURSOR", "CUT_BUFFER0", @@ -139,7 +139,7 @@ Tk_GetAtomName( hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, (char *) atom); if (hPtr == NULL) { - char *name; + const char *name; Tk_ErrorHandler handler; int isNew, mustFree; @@ -192,7 +192,7 @@ AtomInit( Tcl_InitHashTable(&dispPtr->atomTable, TCL_ONE_WORD_KEYS); for (atom = 1; atom <= XA_LAST_PREDEFINED; atom++) { - char *name; + const char *name; int isNew; hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, (char *) atom); diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index ce49319..8649636 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.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: tkClipboard.c,v 1.21 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkClipboard.c,v 1.22 2008/10/28 22:33:06 nijtmans Exp $ */ #include "tkInt.h" @@ -29,7 +29,7 @@ static int ClipboardWindowHandler(ClientData clientData, int offset, char *buffer, int maxBytes); static void ClipboardLostSel(ClientData clientData); static int ClipboardGetProc(ClientData clientData, - Tcl_Interp *interp, char *portion); + Tcl_Interp *interp, const char *portion); /* *---------------------------------------------------------------------- @@ -704,7 +704,7 @@ ClipboardGetProc( * selection. */ Tcl_Interp *interp, /* Interpreter used for error reporting (not * used). */ - char *portion) /* New information to be appended. */ + const char *portion) /* New information to be appended. */ { Tcl_DStringAppend((Tcl_DString *) clientData, portion, -1); return TCL_OK; diff --git a/generic/tkDecls.h b/generic/tkDecls.h index f6c8067..a888168 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.35 2008/10/22 20:56:43 nijtmans Exp $ + * RCS: @(#) $Id: tkDecls.h,v 1.36 2008/10/28 22:33:06 nijtmans Exp $ */ #ifndef _TKDECLS @@ -907,7 +907,7 @@ EXTERN void Tk_OwnSelection (Tk_Window tkwin, Atom selection, /* 143 */ EXTERN int Tk_ParseArgv (Tcl_Interp * interp, Tk_Window tkwin, int * argcPtr, CONST84 char ** argv, - Tk_ArgvInfo * argTable, int flags); + const Tk_ArgvInfo * argTable, int flags); #endif #ifndef Tk_PhotoPutBlock_NoComposite_TCL_DECLARED #define Tk_PhotoPutBlock_NoComposite_TCL_DECLARED @@ -1849,7 +1849,7 @@ typedef struct TkStubs { CONST84_RETURN char * (*tk_NameOfRelief) (int relief); /* 140 */ Tk_Window (*tk_NameToWindow) (Tcl_Interp * interp, const char * pathName, Tk_Window tkwin); /* 141 */ void (*tk_OwnSelection) (Tk_Window tkwin, Atom selection, Tk_LostSelProc * proc, ClientData clientData); /* 142 */ - int (*tk_ParseArgv) (Tcl_Interp * interp, Tk_Window tkwin, int * argcPtr, CONST84 char ** argv, Tk_ArgvInfo * argTable, int flags); /* 143 */ + int (*tk_ParseArgv) (Tcl_Interp * interp, Tk_Window tkwin, int * argcPtr, CONST84 char ** argv, const Tk_ArgvInfo * argTable, int flags); /* 143 */ void (*tk_PhotoPutBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height); /* 144 */ void (*tk_PhotoPutZoomedBlock_NoComposite) (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) (Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr); /* 146 */ diff --git a/generic/tkEntry.c b/generic/tkEntry.c index fdb8eb3..6cb3a1c 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.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: tkEntry.c,v 1.53 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.54 2008/10/28 22:33:06 nijtmans Exp $ */ #include "tkInt.h" @@ -37,7 +37,7 @@ #define DOUBLES_EQ(d1, d2) (fabs((d1) - (d2)) < MIN_DBL_VAL) -static char *const stateStrings[] = { +static const char *const stateStrings[] = { "disabled", "normal", "readonly", NULL }; @@ -45,7 +45,7 @@ static char *const stateStrings[] = { * Definitions for -validate option values: */ -static char *const validateStrings[] = { +static const char *const validateStrings[] = { "all", "key", "focus", "focusin", "focusout", "none", NULL }; enum validateType { @@ -4172,7 +4172,7 @@ SpinboxInvoke( * "down" button. */ { Entry *entryPtr = (Entry *) sbPtr; - char *type; + const char *type; int code, up; Tcl_DString script; diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 1bf96b0..64749d1 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.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: tkFrame.c,v 1.34 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.35 2008/10/28 22:33:06 nijtmans Exp $ */ #include "default.h" @@ -164,7 +164,7 @@ enum labelanchor { LABELANCHOR_W, LABELANCHOR_WN, LABELANCHOR_WS }; -static char *labelAnchorStrings[] = { +static const char *labelAnchorStrings[] = { "e", "en", "es", "n", "ne", "nw", "s", "se", "sw", "w", "wn", "ws", NULL }; @@ -283,7 +283,7 @@ static const Tk_OptionSpec labelframeOptSpec[] = { * Class names for widgets, indexed by FrameType. */ -static char *classNames[] = {"Frame", "Toplevel", "Labelframe"}; +static const char *const classNames[] = {"Frame", "Toplevel", "Labelframe"}; /* * The following table maps from FrameType to the option template for that @@ -305,7 +305,7 @@ static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr, int objc, Tcl_Obj *const objv[]); static int CreateFrame(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const argv[], - enum FrameType type, char *appName); + enum FrameType type, const char *appName); static void DestroyFrame(char *memPtr); static void DestroyFramePartly(Frame *framePtr); static void DisplayFrame(ClientData clientData); @@ -418,10 +418,10 @@ TkCreateFrame( ClientData clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - char **argv, /* Argument strings. */ + const char *const *argv, /* Argument strings. */ int toplevel, /* Non-zero means create a toplevel window, * zero means create a frame. */ - char *appName) /* Should only be non-NULL if there is no main + const char *appName) /* Should only be non-NULL if there is no main * window associated with the interpreter. * Gives the base name to use for the new * application. */ @@ -450,7 +450,7 @@ CreateFrame( int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects. */ enum FrameType type, /* What widget type to create. */ - char *appName) /* Should only be non-NULL if there are no + const char *appName) /* Should only be non-NULL if there are no * Main window associated with the * interpreter. Gives the base name to use for * the new application. */ diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index b09682d..aefcf50 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -17,7 +17,7 @@ * Department of Computer Science, * Australian National University. * - * RCS: @(#) $Id: tkImgPhoto.c,v 1.83 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkImgPhoto.c,v 1.84 2008/10/28 22:33:06 nijtmans Exp $ */ #include "tkImgPhoto.h" @@ -77,7 +77,7 @@ struct SubcommandOptions { * of the OPT_* constants above. */ -static char *optionNames[] = { +static const char *optionNames[] = { "-background", "-compositingrule", "-format", @@ -229,13 +229,13 @@ PhotoFormatThreadExitProc( while (tsdPtr->oldFormatList != NULL) { freePtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr; - ckfree(freePtr->name); + ckfree((char *) freePtr->name); ckfree((char *) freePtr); } while (tsdPtr->formatList != NULL) { freePtr = tsdPtr->formatList; tsdPtr->formatList = tsdPtr->formatList->nextPtr; - ckfree(freePtr->name); + ckfree((char *) freePtr->name); ckfree((char *) freePtr); } } @@ -278,7 +278,7 @@ Tk_CreateOldPhotoImageFormat( copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; copyPtr->name = ckalloc((unsigned) (strlen(formatPtr->name) + 1)); - strcpy(copyPtr->name, formatPtr->name); + strcpy((char *) copyPtr->name, formatPtr->name); copyPtr->nextPtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = copyPtr; } @@ -302,7 +302,7 @@ Tk_CreatePhotoImageFormat( copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; copyPtr->name = ckalloc((unsigned) (strlen(formatPtr->name) + 1)); - strcpy(copyPtr->name, formatPtr->name); + strcpy((char *)copyPtr->name, formatPtr->name); if (isupper((unsigned char) *formatPtr->name)) { copyPtr->nextPtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = copyPtr; @@ -1401,7 +1401,8 @@ ParseSubcommandOptions( { int index, c, bit, currentBit, length; int values[4], numValues, maxValues, argIndex; - char *option, **listPtr; + char *option; + const char **listPtr; for (index = *optIndexPtr; index < objc; *optIndexPtr = ++index) { /* diff --git a/generic/tkInt.decls b/generic/tkInt.decls index f6890f6..1046450 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -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: tkInt.decls,v 1.46 2008/10/22 20:56:43 nijtmans Exp $ +# RCS: @(#) $Id: tkInt.decls,v 1.47 2008/10/28 22:33:06 nijtmans Exp $ library tk @@ -72,11 +72,11 @@ declare 12 generic { } declare 13 generic { int TkCreateFrame(ClientData clientData, Tcl_Interp *interp, - int argc, char **argv, int toplevel, char *appName) + int argc, CONST86 char *const *argv, int toplevel, const char *appName) } declare 14 generic { Tk_Window TkCreateMainWindow(Tcl_Interp *interp, - const char *screenName, char *baseName) + const char *screenName, const char *baseName) } declare 15 generic { Time TkCurrentTime(TkDisplay *dispPtr) @@ -514,6 +514,11 @@ declare 157 generic { int TkpTesttextCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv) } +declare 158 generic { + int TkSelGetSelection(Tcl_Interp *interp, Tk_Window tkwin, + Atom selection, Atom target, Tk_GetSelProc *proc, + ClientData clientData) +} ############################################################################## diff --git a/generic/tkInt.h b/generic/tkInt.h index 7a378aa..d4fc5e8 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.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: tkInt.h,v 1.88 2008/10/20 12:22:50 dkf Exp $ + * RCS: $Id: tkInt.h,v 1.89 2008/10/28 22:33:06 nijtmans Exp $ */ #ifndef _TKINT @@ -1184,7 +1184,7 @@ MODULE_SCOPE void TkpBuildRegionFromAlphaData(TkRegion region, unsigned height, unsigned char *dataPtr, unsigned pixelStride, unsigned lineStride); MODULE_SCOPE void TkPrintPadAmount(Tcl_Interp *interp, - char *buffer, int pad1, int pad2); + const char *buffer, int pad1, int pad2); MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *pad1Ptr, int *pad2Ptr); diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index 9e49dba..7665567 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.36 2008/10/22 20:56:43 nijtmans Exp $ + * RCS: @(#) $Id: tkIntDecls.h,v 1.37 2008/10/28 22:33:06 nijtmans Exp $ */ #ifndef _TKINTDECLS @@ -120,14 +120,16 @@ EXTERN TkCursor * TkCreateCursorFromData (Tk_Window tkwin, #define TkCreateFrame_TCL_DECLARED /* 13 */ EXTERN int TkCreateFrame (ClientData clientData, - Tcl_Interp * interp, int argc, char ** argv, - int toplevel, char * appName); + Tcl_Interp * interp, int argc, + CONST86 char *const * argv, int toplevel, + const char * appName); #endif #ifndef TkCreateMainWindow_TCL_DECLARED #define TkCreateMainWindow_TCL_DECLARED /* 14 */ EXTERN Tk_Window TkCreateMainWindow (Tcl_Interp * interp, - const char * screenName, char * baseName); + const char * screenName, + const char * baseName); #endif #ifndef TkCurrentTime_TCL_DECLARED #define TkCurrentTime_TCL_DECLARED @@ -953,6 +955,13 @@ EXTERN int TkpTesttextCmd (ClientData dummy, Tcl_Interp * interp, int argc, const char ** argv); #endif +#ifndef TkSelGetSelection_TCL_DECLARED +#define TkSelGetSelection_TCL_DECLARED +/* 158 */ +EXTERN int TkSelGetSelection (Tcl_Interp * interp, + Tk_Window tkwin, Atom selection, Atom target, + Tk_GetSelProc * proc, ClientData clientData); +#endif typedef struct TkIntStubs { int magic; @@ -971,8 +980,8 @@ typedef struct TkIntStubs { int (*tkCopyAndGlobalEval) (Tcl_Interp * interp, char * script); /* 10 */ unsigned long (*tkCreateBindingProcedure) (Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, const char * eventString, TkBindEvalProc * evalProc, TkBindFreeProc * freeProc, ClientData clientData); /* 11 */ TkCursor * (*tkCreateCursorFromData) (Tk_Window tkwin, const char * source, const char * mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg); /* 12 */ - int (*tkCreateFrame) (ClientData clientData, Tcl_Interp * interp, int argc, char ** argv, int toplevel, char * appName); /* 13 */ - Tk_Window (*tkCreateMainWindow) (Tcl_Interp * interp, const char * screenName, char * baseName); /* 14 */ + int (*tkCreateFrame) (ClientData clientData, Tcl_Interp * interp, int argc, CONST86 char *const * argv, int toplevel, const char * appName); /* 13 */ + Tk_Window (*tkCreateMainWindow) (Tcl_Interp * interp, const char * screenName, const char * baseName); /* 14 */ Time (*tkCurrentTime) (TkDisplay * dispPtr); /* 15 */ void (*tkDeleteAllImages) (TkMainInfo * mainPtr); /* 16 */ void (*tkDoConfigureNotify) (TkWindow * winPtr); /* 17 */ @@ -1215,6 +1224,7 @@ typedef struct TkIntStubs { void *reserved155; int (*tkpTestembedCmd) (ClientData clientData, Tcl_Interp * interp, int argc, const char ** argv); /* 156 */ int (*tkpTesttextCmd) (ClientData dummy, Tcl_Interp * interp, int argc, const char ** argv); /* 157 */ + int (*tkSelGetSelection) (Tcl_Interp * interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc * proc, ClientData clientData); /* 158 */ } TkIntStubs; #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) @@ -1884,6 +1894,10 @@ extern const TkIntStubs *tkIntStubsPtr; #define TkpTesttextCmd \ (tkIntStubsPtr->tkpTesttextCmd) /* 157 */ #endif +#ifndef TkSelGetSelection +#define TkSelGetSelection \ + (tkIntStubsPtr->tkSelGetSelection) /* 158 */ +#endif #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ diff --git a/generic/tkPack.c b/generic/tkPack.c index d7e192e..42fe12b 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.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: tkPack.c,v 1.29 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkPack.c,v 1.30 2008/10/28 22:33:06 nijtmans Exp $ */ #include "tkInt.h" @@ -151,7 +151,7 @@ void TkPrintPadAmount( Tcl_Interp *interp, /* The interpreter into which the result is * written. */ - char *switchName, /* One of "padx", "pady", "ipadx" or "ipady" */ + const char *switchName, /* One of "padx", "pady", "ipadx" or "ipady" */ int halfSpace, /* The left or top padding amount */ int allSpace) /* The total amount of padding */ { diff --git a/generic/tkSelect.c b/generic/tkSelect.c index c2a78ca..f510478 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.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: tkSelect.c,v 1.24 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkSelect.c,v 1.25 2008/10/28 22:33:06 nijtmans Exp $ */ #include "tkInt.h" @@ -67,7 +67,7 @@ static int HandleTclCommand(ClientData clientData, int offset, char *buffer, int maxBytes); static void LostSelection(ClientData clientData); static int SelGetProc(ClientData clientData, - Tcl_Interp *interp, char *portion); + Tcl_Interp *interp, const char *portion); /* *-------------------------------------------------------------- @@ -1290,7 +1290,7 @@ SelGetProc( * selection. */ Tcl_Interp *interp, /* Interpreter used for error reporting (not * used). */ - char *portion) /* New information to be appended. */ + const char *portion) /* New information to be appended. */ { Tcl_DStringAppend(clientData, portion, -1); return TCL_OK; diff --git a/generic/tkSelect.h b/generic/tkSelect.h index 921754c..beb413d 100644 --- a/generic/tkSelect.h +++ b/generic/tkSelect.h @@ -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: tkSelect.h,v 1.10 2008/09/03 06:01:52 dgp Exp $ + * RCS: @(#) $Id: tkSelect.h,v 1.11 2008/10/28 22:33:06 nijtmans Exp $ */ #ifndef _TKSELECT @@ -161,9 +161,6 @@ MODULE_SCOPE void TkSelClearSelection(Tk_Window tkwin, XEvent *eventPtr); MODULE_SCOPE int TkSelDefaultSelection(TkSelectionInfo *infoPtr, Atom target, char *buffer, int maxBytes, Atom *typePtr); -MODULE_SCOPE int TkSelGetSelection(Tcl_Interp *interp, Tk_Window tkwin, - Atom selection, Atom target, Tk_GetSelProc *proc, - ClientData clientData); #ifndef TkSelUpdateClipboard MODULE_SCOPE void TkSelUpdateClipboard(TkWindow *winPtr, TkClipboardTarget *targetPtr); diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index e9f9c7d..6de9d44 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.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: tkStubInit.c,v 1.64 2008/08/19 15:52:12 georgeps Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.65 2008/10/28 22:33:06 nijtmans Exp $ */ #include "tkInt.h" @@ -309,6 +309,7 @@ static const TkIntStubs tkIntStubs = { NULL, /* 155 */ TkpTestembedCmd, /* 156 */ TkpTesttextCmd, /* 157 */ + TkSelGetSelection, /* 158 */ }; static const TkIntPlatStubs tkIntPlatStubs = { diff --git a/generic/tkVisual.c b/generic/tkVisual.c index e0e100a..c2a9622 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.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: tkVisual.c,v 1.11 2008/04/27 22:38:58 dkf Exp $ + * RCS: @(#) $Id: tkVisual.c,v 1.12 2008/10/28 22:33:06 nijtmans Exp $ */ #include "tkInt.h" @@ -22,12 +22,12 @@ */ typedef struct VisualDictionary { - char *name; /* Textual name of class. */ + const char *name; /* Textual name of class. */ int minLength; /* Minimum # characters that must be specified * for an unambiguous match. */ int class; /* X symbol for class. */ } VisualDictionary; -static VisualDictionary visualNames[] = { +static const VisualDictionary visualNames[] = { {"best", 1, 0}, {"directcolor", 2, DirectColor}, {"grayscale", 1, GrayScale}, @@ -104,7 +104,7 @@ Tk_GetVisual( ptrdiff_t length; int c, numVisuals, prio, bestPrio, i; const char *p; - VisualDictionary *dictPtr; + const VisualDictionary *dictPtr; TkColormap *cmapPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 87e93c9..87bb2f7 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.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: tkWindow.c,v 1.97 2008/10/18 14:22:21 dkf Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.98 2008/10/28 22:33:06 nijtmans Exp $ */ #include "tkInt.h" @@ -96,7 +96,7 @@ static XSetWindowAttributes defAtts= { */ typedef struct { - char *name; /* Name of command. */ + const char *name; /* Name of command. */ Tcl_CmdProc *cmdProc; /* Command's string-based function. */ Tcl_ObjCmdProc *objProc; /* Command's object-based function. */ int isSafe; /* If !0, this command will be exposed in a @@ -854,7 +854,7 @@ TkCreateMainWindow( const char *screenName, /* Name of screen on which to create window. * Empty or NULL string means use DISPLAY * environment variable. */ - char *baseName) /* Base name for application; usually of the + const char *baseName) /* Base name for application; usually of the * form "prog instance". */ { Tk_Window tkwin; @@ -2935,7 +2935,7 @@ Initialize( char *p; int argc, code; const char **argv; - char *args[20]; + const char *args[20]; const char *argString = NULL; Tcl_DString class; ThreadSpecificData *tsdPtr; diff --git a/win/tkWinTest.c b/win/tkWinTest.c index 18c72f8..0882dc8 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.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: tkWinTest.c,v 1.18 2008/10/28 17:44:38 dgp Exp $ + * RCS: @(#) $Id: tkWinTest.c,v 1.19 2008/10/28 22:33:07 nijtmans Exp $ */ #include "tkWinInt.h" @@ -34,7 +34,7 @@ static int TestgetwindowinfoObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp); -Tk_GetSelProc SetSelectionResult; +static Tk_GetSelProc SetSelectionResult; /* @@ -194,9 +194,6 @@ TestclipboardObjCmd( Tcl_Obj *const objv[]) /* Argument values. */ { Tk_Window tkwin = (Tk_Window) clientData; - HGLOBAL handle; - char *data; - int code = TCL_OK; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -356,7 +353,7 @@ TestwineventCmd( /* * testfindwindow title ?class? * Find a Windows window using the FindWindow API call. This takes the window - * title and optionally the window class and if found returns the HWND and + * title and optionally the window class and if found returns the HWND and * raises an error if the window is not found. * eg: testfindwindow Console TkTopLevel * Can find the console window if it is visible. @@ -392,7 +389,7 @@ TestfindwindowObjCmd( Tcl_SetObjResult(interp, Tcl_NewLongObj((long)hwnd)); } return r; - + } static BOOL CALLBACK @@ -423,7 +420,7 @@ TestgetwindowinfoObjCmd( if (Tcl_GetLongFromObj(interp, objv[1], (long *)&hwnd) != TCL_OK) return TCL_ERROR; - + if (tkWinProcs->useWide) { cch = GetClassNameW(hwnd, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR)); classObj = Tcl_NewUnicodeObj((LPWSTR)buf, cch); @@ -435,14 +432,14 @@ TestgetwindowinfoObjCmd( Tcl_SetResult(interp, "failed to get class name: ", TCL_STATIC); AppendSystemError(interp, GetLastError()); return TCL_ERROR; - } + } resObj = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("class", -1)); Tcl_ListObjAppendElement(interp, resObj, classObj); Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("id", -1)); - Tcl_ListObjAppendElement(interp, resObj, + Tcl_ListObjAppendElement(interp, resObj, Tcl_NewLongObj(GetWindowLong(hwnd, GWL_ID))); cch = tkWinProcs->getWindowText(hwnd, (LPTSTR)buf, cchBuf); @@ -455,7 +452,7 @@ TestgetwindowinfoObjCmd( Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("text", -1)); Tcl_ListObjAppendElement(interp, resObj, textObj); Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("parent", -1)); - Tcl_ListObjAppendElement(interp, resObj, + Tcl_ListObjAppendElement(interp, resObj, Tcl_NewLongObj((long)GetParent(hwnd))); childrenObj = Tcl_NewListObj(0, NULL); @@ -465,7 +462,7 @@ TestgetwindowinfoObjCmd( Tcl_SetObjResult(interp, resObj); return TCL_OK; -} +} /* * Local Variables: -- cgit v0.12