From 08118cf0531836d38a11540a687c8a92842014d5 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Wed, 17 Feb 2010 19:21:15 +0000 Subject: CONSTify everything related to Tk_ConfigSpec --- ChangeLog | 27 +++++++++++++++++++++++++++ carbon/tkMacOSXScrlbr.c | 18 ++---------------- doc/CanvTkwin.3 | 10 +++++----- doc/ConfigWidg.3 | 6 +++--- doc/CrtItemType.3 | 4 ++-- generic/tk.decls | 10 +++++----- generic/tk.h | 4 ++-- generic/tkCanvArc.c | 4 ++-- generic/tkCanvBmap.c | 4 ++-- generic/tkCanvImg.c | 4 ++-- generic/tkCanvLine.c | 4 ++-- generic/tkCanvPoly.c | 4 ++-- generic/tkCanvPs.c | 4 ++-- generic/tkCanvText.c | 4 ++-- generic/tkCanvWind.c | 4 ++-- generic/tkCanvas.c | 4 ++-- generic/tkDecls.h | 21 +++++++++++---------- generic/tkImgBmap.c | 4 ++-- generic/tkImgPhoto.c | 4 ++-- generic/tkOldConfig.c | 40 ++++++++++++++++++++-------------------- generic/tkRectOval.c | 4 ++-- generic/tkScrollbar.c | 20 ++++++++++---------- generic/tkScrollbar.h | 12 ++++-------- macosx/tkMacOSXScrlbr.c | 18 ++---------------- win/tkWinScrlbr.c | 14 ++------------ 25 files changed, 119 insertions(+), 133 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ca15d4..4e26c25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2010-02-17 Jan Nijtmans + + * generic/tk.decls CONSTify everything related to Tk_ConfigSpec + * generic/tk.h + * generic/tkCanvArc.c Many tables can now be put in const memory + * generic/tkCanvas.c + * generic/tkCanvBmap.c + * generic/tkCanvImg.c + * generic/tkCanvLine.c + * generic/tkCanvPoly.c + * generic/tkCanvPs.c + * generic/tkCanvText.c + * generic/tkCanvWind.c + * generic/tkImgBmap.c + * generic/tkImgPhoto.c + * generic/tkOldConfig.c + * generic/tkRectOval.c + * generic/tkScrollbar.c + * generic/tkScrollbar.h + * generic/tkDecls.h (regenerated) + * doc/CanvTkwin.3 + * doc/ConfigWidg.3 + * doc/CrtItemType.3 + * win/tkWinScrlbr.c + * carbon/tkMacOSXScrlbr.c + * macosx/tkMacOSXScrlbr.c + 2010-02-16 Jan Nijtmans * generic/tkWindow.c Reverted rename from tkStubs to tkConstStubs diff --git a/carbon/tkMacOSXScrlbr.c b/carbon/tkMacOSXScrlbr.c index 6a9f5a1..21c5083 100644 --- a/carbon/tkMacOSXScrlbr.c +++ b/carbon/tkMacOSXScrlbr.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: tkMacOSXScrlbr.c,v 1.2 2010/01/13 23:08:12 nijtmans Exp $ + * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.3 2010/02/17 19:21:17 nijtmans Exp $ */ #include "tkMacOSXPrivate.h" @@ -70,13 +70,6 @@ static ScrollbarMetrics metrics[2] = { }; /* - * This variable holds the default width for a scrollbar in string form for - * use in a Tk_ConfigSpec. - */ - -static char defWidth[TCL_INTEGER_SPACE]; - -/* * Forward declarations for procedures defined later in this file: */ @@ -127,7 +120,6 @@ TkMacOSXInitScrollbarMetrics(void) ThemeTrackDrawInfo info = {0, {0, 0, height, width}, 0, 1, 0, 0, kThemeTrackShowThumb, kThemeTrackActive, 0, {{1, 0}}}; Rect bounds; - Tk_ConfigSpec *specPtr; ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &metrics[0].width); ChkErr(GetThemeMetric, kThemeMetricScrollBarMinThumbHeight, @@ -148,13 +140,7 @@ TkMacOSXInitScrollbarMetrics(void) metrics[1].minHeight = metrics[1].minThumbHeight + metrics[1].topArrowHeight + metrics[1].bottomArrowHeight; - sprintf(defWidth, "%ld", metrics[0].width); - for (specPtr = tkpScrollbarConfigSpecs; specPtr->type != TK_CONFIG_END; - specPtr++) { - if (specPtr->offset == Tk_Offset(TkScrollbar, width)) { - specPtr->defValue = defWidth; - } - } + sprintf(tkDefScrollbarWidth, "%ld", metrics[0].width); } /* diff --git a/doc/CanvTkwin.3 b/doc/CanvTkwin.3 index dbbc3df..4ea6620 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.9 2008/11/01 12:25:14 dkf Exp $ +'\" RCS: @(#) $Id: CanvTkwin.3,v 1.10 2010/02/17 19:21:17 nijtmans Exp $ '\" .so man.macros .TH Tk_CanvasTkwin 3 4.1 Tk "Tk Library Procedures" @@ -145,14 +145,14 @@ structure for the \fB\-tags\fR option. The code typically looks like this: .PP .CS -static Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc, +static const Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL }; -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { ... - {TK_CONFIG_CUSTOM, "\-tags", (char *) NULL, (char *) NULL, - (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, + {TK_CONFIG_CUSTOM, "\-tags", NULL, NULL, + NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, ... }; .CE diff --git a/doc/ConfigWidg.3 b/doc/ConfigWidg.3 index 14f4c96..1dd5b6e 100644 --- a/doc/ConfigWidg.3 +++ b/doc/ConfigWidg.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: ConfigWidg.3,v 1.24 2009/05/04 09:12:33 dkf Exp $ +'\" RCS: @(#) $Id: ConfigWidg.3,v 1.25 2010/02/17 19:21:17 nijtmans Exp $ '\" .so man.macros .TH Tk_ConfigureWidget 3 4.1 Tk "Tk Library Procedures" @@ -27,12 +27,12 @@ int .sp \fBTk_FreeOptions(\fIspecs, widgRec, display, flags\fB)\fR .SH ARGUMENTS -.AS Tk_ConfigSpec *widgRec in/out +.AS char *widgRec in/out .AP Tcl_Interp *interp in Interpreter to use for returning error messages. .AP Tk_Window tkwin in Window used to represent widget (needed to set up X resources). -.AP Tk_ConfigSpec *specs in +.AP "const Tk_ConfigSpec" *specs in Pointer to table specifying legal configuration options for this widget. .AP int argc in diff --git a/doc/CrtItemType.3 b/doc/CrtItemType.3 index a271be2..d97717d 100644 --- a/doc/CrtItemType.3 +++ b/doc/CrtItemType.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: CrtItemType.3,v 1.15 2009/01/06 21:58:15 nijtmans Exp $ +'\" RCS: @(#) $Id: CrtItemType.3,v 1.16 2010/02/17 19:21:17 nijtmans Exp $ '\" .so man.macros .TH Tk_CreateItemType 3 4.0 Tk "Tk Library Procedures" @@ -68,7 +68,7 @@ typedef struct Tk_ItemType { const char *\fIname\fR; int \fIitemSize\fR; Tk_ItemCreateProc *\fIcreateProc\fR; - Tk_ConfigSpec *\fIconfigSpecs\fR; + const Tk_ConfigSpec *\fIconfigSpecs\fR; Tk_ItemConfigureProc *\fIconfigProc\fR; Tk_ItemCoordProc *\fIcoordProc\fR; Tk_ItemDeleteProc *\fIdeleteProc\fR; diff --git a/generic/tk.decls b/generic/tk.decls index a68864c..e05b320 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.51 2010/02/05 22:45:03 nijtmans Exp $ +# RCS: @(#) $Id: tk.decls,v 1.52 2010/02/17 19:21:15 nijtmans Exp $ library tk @@ -136,17 +136,17 @@ declare 26 generic { } declare 27 generic { int Tk_ConfigureInfo(Tcl_Interp *interp, - Tk_Window tkwin, Tk_ConfigSpec *specs, + Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags) } declare 28 generic { int Tk_ConfigureValue(Tcl_Interp *interp, - Tk_Window tkwin, Tk_ConfigSpec *specs, + Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags) } declare 29 generic { int Tk_ConfigureWidget(Tcl_Interp *interp, - Tk_Window tkwin, Tk_ConfigSpec *specs, + Tk_Window tkwin, const Tk_ConfigSpec *specs, int argc, CONST84 char **argv, char *widgRec, int flags) } @@ -318,7 +318,7 @@ declare 73 generic { void Tk_FreeImage(Tk_Image image) } declare 74 generic { - void Tk_FreeOptions(Tk_ConfigSpec *specs, + void Tk_FreeOptions(const Tk_ConfigSpec *specs, char *widgRec, Display *display, int needFlags) } declare 75 generic { diff --git a/generic/tk.h b/generic/tk.h index 0512b1d..d154e86 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.132 2009/09/04 09:39:54 dkf Exp $ + * RCS: @(#) $Id: tk.h,v 1.133 2010/02/17 19:21:16 nijtmans Exp $ */ #ifndef _TK @@ -1031,7 +1031,7 @@ typedef struct Tk_ItemType { Tk_ItemCreateProc *createProc; /* Procedure to create a new item of this * type. */ - Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for + CONST86 Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for * this type. Used for returning configuration * info. */ Tk_ItemConfigureProc *configProc; diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index cb829fa..96bc03c 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.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: tkCanvArc.c,v 1.21 2010/01/18 20:43:38 nijtmans Exp $ + * RCS: @(#) $Id: tkCanvArc.c,v 1.22 2010/02/17 19:21:16 nijtmans Exp $ */ #include "tkInt.h" @@ -104,7 +104,7 @@ static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, (ClientData) NULL }; -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, NULL, Tk_Offset(ArcItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index 9599598..256cc64 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.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: tkCanvBmap.c,v 1.18 2010/01/18 20:43:38 nijtmans Exp $ + * RCS: @(#) $Id: tkCanvBmap.c,v 1.19 2010/02/17 19:21:15 nijtmans Exp $ */ #include "tkInt.h" @@ -49,7 +49,7 @@ static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL }; -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_COLOR, "-activebackground", NULL, NULL, NULL, Tk_Offset(BitmapItem, activeBgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activebitmap", NULL, NULL, diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index 8d6d809..5141dbe 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.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: tkCanvImg.c,v 1.16 2010/01/18 20:43:38 nijtmans Exp $ + * RCS: @(#) $Id: tkCanvImg.c,v 1.17 2010/02/17 19:21:16 nijtmans Exp $ */ #include "tkInt.h" @@ -52,7 +52,7 @@ static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL }; -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-activeimage", NULL, NULL, NULL, Tk_Offset(ImageItem, activeImageString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index 0533640..0752354 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.31 2010/01/18 20:43:38 nijtmans Exp $ + * RCS: @(#) $Id: tkCanvLine.c,v 1.32 2010/02/17 19:21:16 nijtmans Exp $ */ #include "tkInt.h" @@ -157,7 +157,7 @@ static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, (ClientData) NULL }; -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, NULL, Tk_Offset(LineItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 257f4f4..9f09c3c 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.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: tkCanvPoly.c,v 1.25 2010/01/18 20:43:38 nijtmans Exp $ + * RCS: @(#) $Id: tkCanvPoly.c,v 1.26 2010/02/17 19:21:16 nijtmans Exp $ */ #include "tkInt.h" @@ -76,7 +76,7 @@ static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, (ClientData) NULL }; -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, NULL, Tk_Offset(PolygonItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index 9c297e4..1af0a3a 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.29 2010/01/18 20:43:38 nijtmans Exp $ + * RCS: @(#) $Id: tkCanvPs.c,v 1.30 2010/02/17 19:21:17 nijtmans Exp $ */ #include "tkInt.h" @@ -94,7 +94,7 @@ typedef struct TkPostscriptInfo { * canvas "postscript" command and fill in TkPostscriptInfo structures. */ -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-colormap", NULL, NULL, "", Tk_Offset(TkPostscriptInfo, colorVar), 0, NULL}, {TK_CONFIG_STRING, "-colormode", NULL, NULL, diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index e05c905..d5f1ae2 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.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: tkCanvText.c,v 1.37 2010/01/18 20:43:38 nijtmans Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.38 2010/02/17 19:21:16 nijtmans Exp $ */ #include "tkInt.h" @@ -95,7 +95,7 @@ static const Tk_CustomOption offsetOption = { TkOffsetParseProc, TkOffsetPrintProc, (ClientData) (TK_OFFSET_RELATIVE) }; -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_COLOR, "-activefill", NULL, NULL, NULL, Tk_Offset(TextItem, activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index b4653c3..031879f 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.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: tkCanvWind.c,v 1.21 2010/01/18 20:43:38 nijtmans Exp $ + * RCS: @(#) $Id: tkCanvWind.c,v 1.22 2010/02/17 19:21:16 nijtmans Exp $ */ #include "tkInt.h" @@ -46,7 +46,7 @@ static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL }; -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, "center", Tk_Offset(WindowItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_PIXELS, "-height", NULL, NULL, diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index ade1374..4e39367 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.64 2010/01/19 22:10:03 dkf Exp $ + * RCS: @(#) $Id: tkCanvas.c,v 1.65 2010/02/17 19:21:16 nijtmans Exp $ */ /* #define USE_OLD_TAG_SEARCH 1 */ @@ -116,7 +116,7 @@ static const Tk_CustomOption offsetOption = { * Information used for argv parsing. */ -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_BORDER, "-background", "background", "Background", DEF_CANVAS_BG_COLOR, Tk_Offset(TkCanvas, bgBorder), TK_CONFIG_COLOR_ONLY, NULL}, diff --git a/generic/tkDecls.h b/generic/tkDecls.h index e1f270a..8c0184e 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.45 2010/02/05 10:56:43 nijtmans Exp $ + * RCS: @(#) $Id: tkDecls.h,v 1.46 2010/02/17 19:21:16 nijtmans Exp $ */ #ifndef _TKDECLS @@ -204,14 +204,14 @@ EXTERN int Tk_ClipboardClear(Tcl_Interp *interp, #define Tk_ConfigureInfo_TCL_DECLARED /* 27 */ EXTERN int Tk_ConfigureInfo(Tcl_Interp *interp, Tk_Window tkwin, - Tk_ConfigSpec *specs, char *widgRec, + const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); #endif #ifndef Tk_ConfigureValue_TCL_DECLARED #define Tk_ConfigureValue_TCL_DECLARED /* 28 */ EXTERN int Tk_ConfigureValue(Tcl_Interp *interp, - Tk_Window tkwin, Tk_ConfigSpec *specs, + Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); #endif @@ -219,7 +219,7 @@ EXTERN int Tk_ConfigureValue(Tcl_Interp *interp, #define Tk_ConfigureWidget_TCL_DECLARED /* 29 */ EXTERN int Tk_ConfigureWidget(Tcl_Interp *interp, - Tk_Window tkwin, Tk_ConfigSpec *specs, + Tk_Window tkwin, const Tk_ConfigSpec *specs, int argc, CONST84 char **argv, char *widgRec, int flags); #endif @@ -496,8 +496,9 @@ EXTERN void Tk_FreeImage(Tk_Image image); #ifndef Tk_FreeOptions_TCL_DECLARED #define Tk_FreeOptions_TCL_DECLARED /* 74 */ -EXTERN void Tk_FreeOptions(Tk_ConfigSpec *specs, char *widgRec, - Display *display, int needFlags); +EXTERN void Tk_FreeOptions(const Tk_ConfigSpec *specs, + char *widgRec, Display *display, + int needFlags); #endif #ifndef Tk_FreePixmap_TCL_DECLARED #define Tk_FreePixmap_TCL_DECLARED @@ -1730,9 +1731,9 @@ typedef struct TkStubs { void (*tk_ClearSelection) (Tk_Window tkwin, Atom selection); /* 24 */ int (*tk_ClipboardAppend) (Tcl_Interp *interp, Tk_Window tkwin, Atom target, Atom format, const char *buffer); /* 25 */ int (*tk_ClipboardClear) (Tcl_Interp *interp, Tk_Window tkwin); /* 26 */ - int (*tk_ConfigureInfo) (Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 27 */ - int (*tk_ConfigureValue) (Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 28 */ - int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specs, int argc, CONST84 char **argv, char *widgRec, int flags); /* 29 */ + int (*tk_ConfigureInfo) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 27 */ + int (*tk_ConfigureValue) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 28 */ + int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, int argc, CONST84 char **argv, char *widgRec, int flags); /* 29 */ void (*tk_ConfigureWindow) (Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr); /* 30 */ Tk_TextLayout (*tk_ComputeTextLayout) (Tk_Font font, const char *str, int numChars, int wrapLength, Tk_Justify justify, int flags, int *widthPtr, int *heightPtr); /* 31 */ Tk_Window (*tk_CoordsToWindow) (int rootX, int rootY, Tk_Window tkwin); /* 32 */ @@ -1777,7 +1778,7 @@ typedef struct TkStubs { void (*tk_FreeFont) (Tk_Font f); /* 71 */ void (*tk_FreeGC) (Display *display, GC gc); /* 72 */ void (*tk_FreeImage) (Tk_Image image); /* 73 */ - void (*tk_FreeOptions) (Tk_ConfigSpec *specs, char *widgRec, Display *display, int needFlags); /* 74 */ + void (*tk_FreeOptions) (const Tk_ConfigSpec *specs, char *widgRec, Display *display, int needFlags); /* 74 */ void (*tk_FreePixmap) (Display *display, Pixmap pixmap); /* 75 */ void (*tk_FreeTextLayout) (Tk_TextLayout textLayout); /* 76 */ void (*tk_FreeXId) (Display *display, XID xid); /* 77 */ diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index bec7a93..32eb536 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.31 2010/02/13 13:47:49 nijtmans Exp $ + * RCS: @(#) $Id: tkImgBmap.c,v 1.32 2010/02/17 19:21:16 nijtmans Exp $ */ #include "tkInt.h" @@ -108,7 +108,7 @@ Tk_ImageType tkBitmapImageType = { * Information used for parsing configuration specs: */ -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_UID, "-background", NULL, NULL, "", Tk_Offset(BitmapMaster, bgUid), 0, NULL}, {TK_CONFIG_STRING, "-data", NULL, NULL, diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 8e0f6e3..9066456 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.95 2010/02/13 13:47:49 nijtmans Exp $ + * RCS: @(#) $Id: tkImgPhoto.c,v 1.96 2010/02/17 19:21:16 nijtmans Exp $ */ #include "tkImgPhoto.h" @@ -152,7 +152,7 @@ static Tcl_ThreadDataKey dataKey; * Information used for parsing configuration specifications: */ -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-file", NULL, NULL, NULL, Tk_Offset(PhotoMaster, fileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_DOUBLE, "-gamma", NULL, NULL, diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 7ce1c36..9f0655e 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.29 2010/01/22 14:17:53 nijtmans Exp $ + * RCS: @(#) $Id: tkOldConfig.c,v 1.30 2010/02/17 19:21:17 nijtmans Exp $ */ #include "tkInt.h" @@ -38,9 +38,9 @@ static Tk_ConfigSpec * FindConfigSpec(Tcl_Interp *interp, Tk_ConfigSpec *specs, const char *argvName, int needFlags, int hateFlags); static char * FormatConfigInfo(Tcl_Interp *interp, Tk_Window tkwin, - Tk_ConfigSpec *specPtr, char *widgRec); + const Tk_ConfigSpec *specPtr, char *widgRec); static const char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin, - Tk_ConfigSpec *specPtr, char *widgRec, + const Tk_ConfigSpec *specPtr, char *widgRec, char *buffer, Tcl_FreeProc **freeProcPtr); static Tk_ConfigSpec * GetCachedSpecs(Tcl_Interp *interp, const Tk_ConfigSpec *staticSpecs); @@ -74,7 +74,7 @@ Tk_ConfigureWidget( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window containing widget (needed to set up * X resources). */ - Tk_ConfigSpec *specs, /* Describes legal options. */ + const Tk_ConfigSpec *specs, /* Describes legal options. */ int argc, /* Number of elements in argv. */ const char **argv, /* Command-line options. */ char *widgRec, /* Record whose fields are to be modified. @@ -84,7 +84,7 @@ Tk_ConfigureWidget( * considered. Also, may have * TK_CONFIG_ARGV_ONLY set. */ { - register Tk_ConfigSpec *specPtr; + register Tk_ConfigSpec *specPtr, *staticSpecs; Tk_Uid value; /* Value of option from database. */ int needFlags; /* Specs must contain this set of flags or * else they are not considered. */ @@ -112,7 +112,7 @@ Tk_ConfigureWidget( * Get the build of the config for this interpreter. */ - specs = GetCachedSpecs(interp, specs); + staticSpecs = GetCachedSpecs(interp, specs); /* * Pass one: scan through all of the arguments, processing those that @@ -127,7 +127,7 @@ Tk_ConfigureWidget( } else { arg = *argv; } - specPtr = FindConfigSpec(interp, specs, arg, needFlags, hateFlags); + specPtr = FindConfigSpec(interp, staticSpecs, arg, needFlags, hateFlags); if (specPtr == NULL) { return TCL_ERROR; } @@ -165,7 +165,7 @@ Tk_ConfigureWidget( */ if (!(flags & TK_CONFIG_ARGV_ONLY)) { - for (specPtr=specs; specPtr->type!=TK_CONFIG_END; specPtr++) { + for (specPtr = staticSpecs; specPtr->type != TK_CONFIG_END; specPtr++) { if ((specPtr->specFlags & TK_CONFIG_OPTION_SPECIFIED) || (specPtr->argvName == NULL) || (specPtr->type == TK_CONFIG_SYNONYM)) { @@ -593,7 +593,7 @@ int Tk_ConfigureInfo( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window corresponding to widgRec. */ - Tk_ConfigSpec *specs, /* Describes legal options. */ + const Tk_ConfigSpec *specs, /* Describes legal options. */ char *widgRec, /* Record whose fields contain current values * for options. */ const char *argvName, /* If non-NULL, indicates a single option @@ -603,7 +603,7 @@ Tk_ConfigureInfo( * be present in config specs for them to be * considered. */ { - register Tk_ConfigSpec *specPtr; + register Tk_ConfigSpec *specPtr, *staticSpecs; int needFlags, hateFlags; char *list; const char *leader = "{"; @@ -619,7 +619,7 @@ Tk_ConfigureInfo( * Get the build of the config for this interpreter. */ - specs = GetCachedSpecs(interp, specs); + staticSpecs = GetCachedSpecs(interp, specs); /* * If information is only wanted for a single configuration spec, then @@ -628,7 +628,7 @@ Tk_ConfigureInfo( Tcl_ResetResult(interp); if (argvName != NULL) { - specPtr = FindConfigSpec(interp, specs, argvName, needFlags,hateFlags); + specPtr = FindConfigSpec(interp, staticSpecs, argvName, needFlags,hateFlags); if (specPtr == NULL) { return TCL_ERROR; } @@ -643,7 +643,7 @@ Tk_ConfigureInfo( * information. */ - for (specPtr = specs; specPtr->type != TK_CONFIG_END; specPtr++) { + for (specPtr = staticSpecs; specPtr->type != TK_CONFIG_END; specPtr++) { if ((argvName != NULL) && (specPtr->argvName != argvName)) { continue; } @@ -685,7 +685,7 @@ FormatConfigInfo( Tcl_Interp *interp, /* Interpreter to use for things like * floating-point precision. */ Tk_Window tkwin, /* Window corresponding to widget. */ - register Tk_ConfigSpec *specPtr, + register const Tk_ConfigSpec *specPtr, /* Pointer to information describing * option. */ char *widgRec) /* Pointer to record holding current values of @@ -752,7 +752,7 @@ static const char * FormatConfigValue( Tcl_Interp *interp, /* Interpreter for use in real conversions. */ Tk_Window tkwin, /* Window corresponding to widget. */ - Tk_ConfigSpec *specPtr, /* Pointer to information describing option. + const Tk_ConfigSpec *specPtr, /* Pointer to information describing option. * Must not point to a synonym option. */ char *widgRec, /* Pointer to record holding current values of * info for widget. */ @@ -904,7 +904,7 @@ int Tk_ConfigureValue( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window corresponding to widgRec. */ - Tk_ConfigSpec *specs, /* Describes legal options. */ + const Tk_ConfigSpec *specs, /* Describes legal options. */ char *widgRec, /* Record whose fields contain current values * for options. */ const char *argvName, /* Gives the command-line name for the option @@ -930,9 +930,9 @@ Tk_ConfigureValue( * Get the build of the config for this interpreter. */ - specs = GetCachedSpecs(interp, specs); + specPtr = GetCachedSpecs(interp, specs); - specPtr = FindConfigSpec(interp, specs, argvName, needFlags, hateFlags); + specPtr = FindConfigSpec(interp, specPtr, argvName, needFlags, hateFlags); if (specPtr == NULL) { return TCL_ERROR; } @@ -973,7 +973,7 @@ Tk_ConfigureValue( /* ARGSUSED */ void Tk_FreeOptions( - Tk_ConfigSpec *specs, /* Describes legal options. */ + const Tk_ConfigSpec *specs, /* Describes legal options. */ char *widgRec, /* Record whose fields contain current values * for options. */ Display *display, /* X display; needed for freeing some @@ -982,7 +982,7 @@ Tk_FreeOptions( * be present in config specs for them to be * considered. */ { - register Tk_ConfigSpec *specPtr; + register const Tk_ConfigSpec *specPtr; char *ptr; for (specPtr = specs; specPtr->type != TK_CONFIG_END; specPtr++) { diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index beb04f8..d300259 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.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: tkRectOval.c,v 1.21 2010/01/18 20:43:38 nijtmans Exp $ + * RCS: @(#) $Id: tkRectOval.c,v 1.22 2010/02/17 19:21:16 nijtmans Exp $ */ #include "tkInt.h" @@ -60,7 +60,7 @@ static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, (ClientData) NULL }; -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, NULL, Tk_Offset(RectOvalItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 04e3333..fc93574 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.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: tkScrollbar.c,v 1.19 2010/02/16 21:12:56 nijtmans Exp $ + * RCS: @(#) $Id: tkScrollbar.c,v 1.20 2010/02/17 19:21:16 nijtmans Exp $ */ #include "tkInt.h" @@ -26,14 +26,14 @@ static const Tk_CustomOption orientOption = { TkOrientParseProc, TkOrientPrintProc, (ClientData) NULL }; -/* static space for "-width" default value */ -static char defScrollbarWidth[TCL_INTEGER_SPACE] = DEF_SCROLLBAR_WIDTH; +/* non-const space for "-width" default value for scrollbars */ +char tkDefScrollbarWidth[TCL_INTEGER_SPACE] = DEF_SCROLLBAR_WIDTH; /* * Information used for argv parsing. */ -Tk_ConfigSpec tkpScrollbarConfigSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_SCROLLBAR_ACTIVE_BG_COLOR, Tk_Offset(TkScrollbar, activeBorder), TK_CONFIG_COLOR_ONLY, NULL}, @@ -90,7 +90,7 @@ Tk_ConfigSpec tkpScrollbarConfigSpecs[] = { DEF_SCROLLBAR_TROUGH_MONO, Tk_Offset(TkScrollbar, troughColorPtr), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_PIXELS, "-width", "width", "Width", - defScrollbarWidth, Tk_Offset(TkScrollbar, width), 0, NULL}, + tkDefScrollbarWidth, Tk_Offset(TkScrollbar, width), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; @@ -284,15 +284,15 @@ ScrollbarWidgetCmd( goto error; } result = Tk_ConfigureValue(interp, scrollPtr->tkwin, - tkpScrollbarConfigSpecs, (char *) scrollPtr, argv[2], 0); + configSpecs, (char *) scrollPtr, argv[2], 0); } else if ((c == 'c') && (strncmp(argv[1], "configure", length) == 0) && (length >= 2)) { if (argc == 2) { result = Tk_ConfigureInfo(interp, scrollPtr->tkwin, - tkpScrollbarConfigSpecs, (char *) scrollPtr, NULL, 0); + configSpecs, (char *) scrollPtr, NULL, 0); } else if (argc == 3) { result = Tk_ConfigureInfo(interp, scrollPtr->tkwin, - tkpScrollbarConfigSpecs, (char *) scrollPtr, argv[2], 0); + configSpecs, (char *) scrollPtr, argv[2], 0); } else { result = ConfigureScrollbar(interp, scrollPtr, argc-2, argv+2, TK_CONFIG_ARGV_ONLY); @@ -529,7 +529,7 @@ ConfigureScrollbar( const char **argv, /* Arguments. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { - if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, tkpScrollbarConfigSpecs, + if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs, argc, argv, (char *) scrollPtr, flags) != TCL_OK) { return TCL_ERROR; } @@ -604,7 +604,7 @@ TkScrollbarEventProc( * Tk_FreeOptions handle all the standard option-related stuff. */ - Tk_FreeOptions(tkpScrollbarConfigSpecs, (char *) scrollPtr, + Tk_FreeOptions(configSpecs, (char *) scrollPtr, scrollPtr->display, 0); Tcl_EventuallyFree(scrollPtr, TCL_DYNAMIC); } else if (eventPtr->type == ConfigureNotify) { diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h index 11ea5c6..e9e52b4 100644 --- a/generic/tkScrollbar.h +++ b/generic/tkScrollbar.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: tkScrollbar.h,v 1.9 2010/01/13 23:08:08 nijtmans Exp $ + * RCS: @(#) $Id: tkScrollbar.h,v 1.10 2010/02/17 19:21:16 nijtmans Exp $ */ #ifndef _TKSCROLLBAR @@ -164,16 +164,12 @@ typedef struct TkScrollbar { #define GOT_FOCUS 4 /* - * Declaration of scrollbar class functions structure. + * Declaration of scrollbar class functions structure + * and default scrollbar width, for use in configSpec. */ MODULE_SCOPE const Tk_ClassProcs tkpScrollbarProcs; - -/* - * Declaration of scrollbar configuration options. - */ - -MODULE_SCOPE Tk_ConfigSpec tkpScrollbarConfigSpecs[]; +MODULE_SCOPE char tkDefScrollbarWidth[TCL_INTEGER_SPACE]; /* * Declaration of functions used in the implementation of the scrollbar diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index fffc058..aabc719 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.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: tkMacOSXScrlbr.c,v 1.32 2010/01/13 23:08:12 nijtmans Exp $ + * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.33 2010/02/17 19:21:18 nijtmans Exp $ */ #include "tkMacOSXPrivate.h" @@ -45,13 +45,6 @@ static ScrollbarMetrics metrics[2] = { }; /* - * This variable holds the default width for a scrollbar in string form for - * use in a Tk_ConfigSpec. - */ - -static char defWidth[TCL_INTEGER_SPACE]; - -/* * Declarations for functions defined in this file. */ @@ -189,7 +182,6 @@ UpdateScrollbarMetrics(void) .trackInfo.scrollbar = {.viewsize = 1, .pressState = 0}, }; CGRect bounds; - Tk_ConfigSpec *specPtr; ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &metrics[0].width); ChkErr(GetThemeMetric, kThemeMetricScrollBarMinThumbHeight, @@ -212,13 +204,7 @@ UpdateScrollbarMetrics(void) metrics[1].minHeight = metrics[1].minThumbHeight + metrics[1].topArrowHeight + metrics[1].bottomArrowHeight; - sprintf(defWidth, "%d", (int)(metrics[0].width)); - for (specPtr = tkpScrollbarConfigSpecs; specPtr->type != TK_CONFIG_END; - specPtr++) { - if (specPtr->offset == Tk_Offset(TkScrollbar, width)) { - specPtr->defValue = defWidth; - } - } + sprintf(tkDefScrollbarWidth, "%d", (int)(metrics[0].width)); } /* diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index 9e848c7..b4f8259 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.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: tkWinScrlbr.c,v 1.19 2010/02/16 21:12:56 nijtmans Exp $ + * RCS: @(#) $Id: tkWinScrlbr.c,v 1.20 2010/02/17 19:21:17 nijtmans Exp $ */ #include "tkWinInt.h" @@ -357,23 +357,13 @@ void UpdateScrollbarMetrics(void) { int arrowWidth = GetSystemMetrics(SM_CXVSCROLL); - const Tk_ConfigSpec *specPtr; hArrowWidth = GetSystemMetrics(SM_CXHSCROLL); hThumb = GetSystemMetrics(SM_CXHTHUMB); vArrowHeight = GetSystemMetrics(SM_CYVSCROLL); vThumb = GetSystemMetrics(SM_CYVTHUMB); - for (specPtr = tkpScrollbarConfigSpecs; specPtr->type != TK_CONFIG_END; - specPtr++) { - /* Make sure that the default value belonging to the "-width" - * option of TkScrollbar points to static non-const space, - * otherwise the following sprintf results in a crash! - */ - if (specPtr->offset == Tk_Offset(TkScrollbar, width)) { - sprintf((char *)specPtr->defValue, "%d", arrowWidth); - } - } + sprintf(tkDefScrollbarWidth, "%d", arrowWidth); } /* -- cgit v0.12