From 96addf51edd7f37edbb7e136cbd44e397b2d7315 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Wed, 15 Oct 2008 06:41:06 +0000 Subject: Add "const" to many internal const tables, so those will be put by the C-compiler in the TEXT segment in stead of the DATA segment. This makes those table sharable in shared libraries. --- ChangeLog | 14 ++++++++++++++ generic/tk3d.c | 6 +++--- generic/tkBitmap.c | 4 ++-- generic/tkColor.c | 4 ++-- generic/tkConfig.c | 4 ++-- generic/tkCursor.c | 4 ++-- generic/tkFont.c | 10 +++++----- generic/tkInt.h | 18 +++++++++--------- generic/tkObj.c | 8 ++++---- generic/tkStyle.c | 4 ++-- generic/tkTextIndex.c | 4 ++-- generic/tkUtil.c | 4 ++-- 12 files changed, 49 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index a765a27..d02bf55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2008-10-15 Jan Nijtmans + + * generic/tkInt.h: Add "const" to many internal + * generic/tk3d.c: const tables, so those will be + * generic/tkBitmap.c: put by the C-compiler in the + * generic/tkColor.c: TEXT segment in stead of the + * generic/tkConfig.c: DATA segment. This makes those + * generic/tkCursor.c: table sharable in shared libraries. + * generic/tkFont.c: + * generic/tkObj.c: + * generic/tkStyle.c: + * generic/tkTextIndex.c: + * generic/tkUtil.c: + 2008-10-14 Donal K. Fellows * generic/tkObj.c (TkNewWindowObj): Added utility function for making diff --git a/generic/tk3d.c b/generic/tk3d.c index c36631a..905e68d 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.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: tk3d.c,v 1.20 2008/04/27 22:38:55 dkf Exp $ + * RCS: @(#) $Id: tk3d.c,v 1.21 2008/10/15 06:41:06 nijtmans Exp $ */ #include "tkInt.h" @@ -21,7 +21,7 @@ * by Tk_GetReliefFromObj. */ -static const char *reliefStrings[] = { +static const char *const reliefStrings[] = { "flat", "groove", "raised", "ridge", "solid", "sunken", NULL }; @@ -47,7 +47,7 @@ static void ShiftLine(XPoint *p1Ptr, XPoint *p2Ptr, * is set. */ -Tcl_ObjType tkBorderObjType = { +const Tcl_ObjType tkBorderObjType = { "border", /* name */ FreeBorderObjProc, /* freeIntRepProc */ DupBorderObjProc, /* dupIntRepProc */ diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index 841cea4..8449e2f 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.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: tkBitmap.c,v 1.21 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkBitmap.c,v 1.22 2008/10/15 06:41:06 nijtmans Exp $ */ #include "tkInt.h" @@ -122,7 +122,7 @@ static void InitBitmapObj(Tcl_Obj *objPtr); * field of the Tcl_Obj points to a TkBitmap object. */ -Tcl_ObjType tkBitmapObjType = { +const Tcl_ObjType tkBitmapObjType = { "bitmap", /* name */ FreeBitmapObjProc, /* freeIntRepProc */ DupBitmapObjProc, /* dupIntRepProc */ diff --git a/generic/tkColor.c b/generic/tkColor.c index 8fbb85e..518e4e0 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.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: tkColor.c,v 1.17 2008/04/27 22:38:55 dkf Exp $ + * RCS: @(#) $Id: tkColor.c,v 1.18 2008/10/15 06:41:06 nijtmans Exp $ */ #include "tkInt.h" @@ -53,7 +53,7 @@ static void InitColorObj(Tcl_Obj *objPtr); * of the Tcl_Obj points to a TkColor object. */ -Tcl_ObjType tkColorObjType = { +const Tcl_ObjType tkColorObjType = { "color", /* name */ FreeColorObjProc, /* freeIntRepProc */ DupColorObjProc, /* dupIntRepProc */ diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 8482871..201f204 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.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: tkConfig.c,v 1.28 2008/10/05 18:22:21 dkf Exp $ + * RCS: @(#) $Id: tkConfig.c,v 1.29 2008/10/15 06:41:06 nijtmans Exp $ */ /* @@ -136,7 +136,7 @@ static int SetOptionFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); * the internalPtr2 field points to the entry that matched. */ -Tcl_ObjType tkOptionObjType = { +const Tcl_ObjType tkOptionObjType = { "option", /* name */ NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ diff --git a/generic/tkCursor.c b/generic/tkCursor.c index d4e112d..8d46854 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.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: tkCursor.c,v 1.19 2008/04/27 22:38:56 dkf Exp $ + * RCS: @(#) $Id: tkCursor.c,v 1.20 2008/10/15 06:41:06 nijtmans Exp $ */ #include "tkInt.h" @@ -56,7 +56,7 @@ static void InitCursorObj(Tcl_Obj *objPtr); * option is set. */ -Tcl_ObjType tkCursorObjType = { +Tcl_ObjType const tkCursorObjType = { "cursor", /* name */ FreeCursorObjProc, /* freeIntRepProc */ DupCursorObjProc, /* dupIntRepProc */ diff --git a/generic/tkFont.c b/generic/tkFont.c index e0b3b09..4caace0 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.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: tkFont.c,v 1.46 2008/10/05 21:23:25 dkf Exp $ + * RCS: @(#) $Id: tkFont.c,v 1.47 2008/10/15 06:41:06 nijtmans Exp $ */ #include "tkInt.h" @@ -165,7 +165,7 @@ static const TkStateMap xlfdSetwidthMap[] = { * configuring a set of font attributes. */ -static const char *fontOpt[] = { +static const char *const fontOpt[] = { "-family", "-size", "-weight", @@ -347,7 +347,7 @@ static void UpdateDependentFonts(TkFontInfo *fiPtr, * font object points to the TkFont structure for the font, or NULL. */ -Tcl_ObjType tkFontObjType = { +const Tcl_ObjType tkFontObjType = { "font", /* name */ FreeFontObjProc, /* freeIntRepProc */ DupFontObjProc, /* dupIntRepProc */ @@ -474,7 +474,7 @@ Tk_FontObjCmd( int index; Tk_Window tkwin; TkFontInfo *fiPtr; - static const char *optionStrings[] = { + static const char *const optionStrings[] = { "actual", "configure", "create", "delete", "families", "measure", "metrics", "names", NULL @@ -741,7 +741,7 @@ Tk_FontObjCmd( Tk_Font tkfont; int skip, index, i; const TkFontMetrics *fmPtr; - static const char *switches[] = { + static const char *const switches[] = { "-ascent", "-descent", "-linespace", "-fixed", NULL }; diff --git a/generic/tkInt.h b/generic/tkInt.h index 03ad61d..ac46234 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.84 2008/10/14 13:24:32 dkf Exp $ + * RCS: $Id: tkInt.h,v 1.85 2008/10/15 06:41:06 nijtmans Exp $ */ #ifndef _TKINT @@ -931,14 +931,14 @@ extern TkDisplay *tkDisplayList; * be properly registered with Tcl: */ -MODULE_SCOPE Tcl_ObjType tkBorderObjType; -MODULE_SCOPE Tcl_ObjType tkBitmapObjType; -MODULE_SCOPE Tcl_ObjType tkColorObjType; -MODULE_SCOPE Tcl_ObjType tkCursorObjType; -MODULE_SCOPE Tcl_ObjType tkFontObjType; -MODULE_SCOPE Tcl_ObjType tkOptionObjType; -MODULE_SCOPE Tcl_ObjType tkStateKeyObjType; -MODULE_SCOPE Tcl_ObjType tkTextIndexType; +MODULE_SCOPE const Tcl_ObjType tkBorderObjType; +MODULE_SCOPE const Tcl_ObjType tkBitmapObjType; +MODULE_SCOPE const Tcl_ObjType tkColorObjType; +MODULE_SCOPE const Tcl_ObjType tkCursorObjType; +MODULE_SCOPE const Tcl_ObjType tkFontObjType; +MODULE_SCOPE const Tcl_ObjType tkOptionObjType; +MODULE_SCOPE const Tcl_ObjType tkStateKeyObjType; +MODULE_SCOPE const Tcl_ObjType tkTextIndexType; /* * Miscellaneous variables shared among Tk modules but not exported to the diff --git a/generic/tkObj.c b/generic/tkObj.c index 647ea8b..41cc589 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.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: tkObj.c,v 1.21 2008/10/14 13:24:32 dkf Exp $ + * RCS: @(#) $Id: tkObj.c,v 1.22 2008/10/15 06:41:06 nijtmans Exp $ */ #include "tkInt.h" @@ -87,7 +87,7 @@ static int SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); * initial display-independant settings. */ -static Tcl_ObjType pixelObjType = { +static const Tcl_ObjType pixelObjType = { "pixel", /* name */ FreePixelInternalRep, /* freeIntRepProc */ DupPixelInternalRep, /* dupIntRepProc */ @@ -101,7 +101,7 @@ static Tcl_ObjType pixelObjType = { * initial display-independant settings. */ -static Tcl_ObjType mmObjType = { +static const Tcl_ObjType mmObjType = { "mm", /* name */ FreeMMInternalRep, /* freeIntRepProc */ DupMMInternalRep, /* dupIntRepProc */ @@ -114,7 +114,7 @@ static Tcl_ObjType mmObjType = { * Tcl object. */ -static Tcl_ObjType windowObjType = { +static const Tcl_ObjType windowObjType = { "window", /* name */ FreeWindowInternalRep, /* freeIntRepProc */ DupWindowInternalRep, /* dupIntRepProc */ diff --git a/generic/tkStyle.c b/generic/tkStyle.c index 24464c0..b4815a5 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.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: tkStyle.c,v 1.9 2008/04/27 22:38:58 dkf Exp $ + * RCS: @(#) $Id: tkStyle.c,v 1.10 2008/10/15 06:41:06 nijtmans Exp $ */ #include "tkInt.h" @@ -152,7 +152,7 @@ static int SetStyleFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); * object points to the Style structure for the stylefont, or NULL. */ -static Tcl_ObjType styleObjType = { +static const Tcl_ObjType styleObjType = { "style", /* name */ FreeStyleObjProc, /* freeIntRepProc */ DupStyleObjProc, /* dupIntRepProc */ diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index a0cce5c..b9763d6 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.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: tkTextIndex.c,v 1.30 2008/10/05 18:22:22 dkf Exp $ + * RCS: @(#) $Id: tkTextIndex.c,v 1.31 2008/10/15 06:41:06 nijtmans Exp $ */ #include "default.h" @@ -72,7 +72,7 @@ static void UpdateStringOfTextIndex(Tcl_Obj *objPtr); * text widgets internally. */ -Tcl_ObjType tkTextIndexType = { +const Tcl_ObjType tkTextIndexType = { "textindex", /* name */ FreeTextIndexInternalRep, /* freeIntRepProc */ DupTextIndexInternalRep, /* dupIntRepProc */ diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 0aff912..5786362 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.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: tkUtil.c,v 1.21 2007/12/13 15:24:21 dgp Exp $ + * RCS: @(#) $Id: tkUtil.c,v 1.22 2008/10/15 06:41:06 nijtmans Exp $ */ #include "tkInt.h" @@ -20,7 +20,7 @@ * object, used for quickly finding a mapping in a TkStateMap. */ -Tcl_ObjType tkStateKeyObjType = { +const Tcl_ObjType tkStateKeyObjType = { "statekey", /* name */ NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ -- cgit v0.12