Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | make some internal tables const |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | core-8-5-branch |
Files: | files | file ages | folders |
SHA1: |
a1af7fc26085b8c9597f42d836d323b8 |
User & Date: | jan.nijtmans 2012-04-18 18:22:03 |
Context
2012-04-20
| ||
12:23 | Use vroot size in stead of screen size for clipping window coordinates in ::tk::PlaceWindow. Use ::tk::PlaceWindow in dialog.tcl, in stead of dumplicating the code there. check-in: 9fc800bf user: jan.nijtmans tags: core-8-5-branch | |
2012-04-18
| ||
18:24 | merge-mark check-in: 7c924dcf user: jan.nijtmans tags: trunk | |
18:22 | make some internal tables const check-in: a1af7fc2 user: jan.nijtmans tags: core-8-5-branch | |
18:08 | make some more internal tables CONST check-in: aa726163 user: jan.nijtmans tags: core-8-4-branch | |
12:30 | compiler warnings check-in: e0d15594 user: dgp tags: core-8-5-branch | |
Changes
Changes to generic/tkAtom.c.
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "tkInt.h" /* * The following are a list of the predefined atom strings. They should match * those found in xatom.h */ | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "tkInt.h" /* * The following are a list of the predefined atom strings. They should match * those found in xatom.h */ static const char *atomNameArray[] = { "PRIMARY", "SECONDARY", "ARC", "ATOM", "BITMAP", "CARDINAL", "COLORMAP", "CURSOR", "CUT_BUFFER0", "CUT_BUFFER1", "CUT_BUFFER2", "CUT_BUFFER3", "CUT_BUFFER4", "CUT_BUFFER5", "CUT_BUFFER6", "CUT_BUFFER7", "DRAWABLE", "FONT", "INTEGER", "PIXMAP", "POINT", |
︙ | ︙ | |||
186 187 188 189 190 191 192 | Atom atom; dispPtr->atomInit = 1; Tcl_InitHashTable(&dispPtr->nameTable, TCL_STRING_KEYS); Tcl_InitHashTable(&dispPtr->atomTable, TCL_ONE_WORD_KEYS); for (atom = 1; atom <= XA_LAST_PREDEFINED; atom++) { | | | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | Atom atom; dispPtr->atomInit = 1; Tcl_InitHashTable(&dispPtr->nameTable, TCL_STRING_KEYS); Tcl_InitHashTable(&dispPtr->atomTable, TCL_ONE_WORD_KEYS); for (atom = 1; atom <= XA_LAST_PREDEFINED; atom++) { const char *name; int isNew; hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, INT2PTR(atom)); if (hPtr != NULL) { continue; } |
︙ | ︙ |
Changes to generic/tkEntry.c.
︙ | ︙ | |||
31 32 33 34 35 36 37 | * A comparison function for double values. For Spinboxes. */ #define MIN_DBL_VAL 1E-9 #define DOUBLES_EQ(d1, d2) (fabs((d1) - (d2)) < MIN_DBL_VAL) | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | * A comparison function for double values. For Spinboxes. */ #define MIN_DBL_VAL 1E-9 #define DOUBLES_EQ(d1, d2) (fabs((d1) - (d2)) < MIN_DBL_VAL) static CONST char *stateStrings[] = { "disabled", "normal", "readonly", NULL }; /* * Definitions for -validate option values: */ static CONST char *validateStrings[] = { "all", "key", "focus", "focusin", "focusout", "none", NULL }; enum validateType { VALIDATE_ALL, VALIDATE_KEY, VALIDATE_FOCUS, VALIDATE_FOCUSIN, VALIDATE_FOCUSOUT, VALIDATE_NONE, /* * These extra enums are for use with EntryValidateChange |
︙ | ︙ |
Changes to generic/tkFrame.c.
︙ | ︙ | |||
158 159 160 161 162 163 164 | enum labelanchor { LABELANCHOR_E, LABELANCHOR_EN, LABELANCHOR_ES, LABELANCHOR_N, LABELANCHOR_NE, LABELANCHOR_NW, LABELANCHOR_S, LABELANCHOR_SE, LABELANCHOR_SW, LABELANCHOR_W, LABELANCHOR_WN, LABELANCHOR_WS }; | | | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | enum labelanchor { LABELANCHOR_E, LABELANCHOR_EN, LABELANCHOR_ES, LABELANCHOR_N, LABELANCHOR_NE, LABELANCHOR_NW, LABELANCHOR_S, LABELANCHOR_SE, LABELANCHOR_SW, LABELANCHOR_W, LABELANCHOR_WN, LABELANCHOR_WS }; static CONST char *labelAnchorStrings[] = { "e", "en", "es", "n", "ne", "nw", "s", "se", "sw", "w", "wn", "ws", NULL }; /* * Information used for parsing configuration options. There are one common * table used by all and one table for each widget class. |
︙ | ︙ | |||
281 282 283 284 285 286 287 | NULL, 0, 0, 0, (ClientData) commonOptSpec, 0} }; /* * Class names for widgets, indexed by FrameType. */ | | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | NULL, 0, 0, 0, (ClientData) commonOptSpec, 0} }; /* * Class names for widgets, indexed by FrameType. */ static CONST char *classNames[] = {"Frame", "Toplevel", "Labelframe"}; /* * The following table maps from FrameType to the option template for that * class of widgets. */ static const Tk_OptionSpec * const optionSpecs[] = { frameOptSpec, toplevelOptSpec, labelframeOptSpec }; /* * Forward declarations for functions defined later in this file: */ static void ComputeFrameGeometry(Frame *framePtr); |
︙ | ︙ |
Changes to generic/tkImgBmap.c.
︙ | ︙ | |||
1127 1128 1129 1130 1131 1132 1133 | * The bit order of bitmaps in Tk is the opposite of the bit order that * postscript uses. (In Tk, the least significant bit is on the right side * of the bitmap and in postscript the least significant bit is shown on * the left.) The following array is used to reverse the order of bits * within a byte so that the bits will be in the order postscript expects. */ | | | 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 | * The bit order of bitmaps in Tk is the opposite of the bit order that * postscript uses. (In Tk, the least significant bit is on the right side * of the bitmap and in postscript the least significant bit is shown on * the left.) The following array is used to reverse the order of bits * within a byte so that the bits will be in the order postscript expects. */ static const unsigned char bit_reverse[] = { 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, |
︙ | ︙ |
Changes to generic/tkImgPhoto.c.
︙ | ︙ | |||
270 271 272 273 274 275 276 | #define OPT_ZOOM 0x100 /* * List of option names. The order here must match the order of declarations * of the OPT_* constants above. */ | | | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | #define OPT_ZOOM 0x100 /* * List of option names. The order here must match the order of declarations * of the OPT_* constants above. */ static const char *const optionNames[] = { "-background", "-compositingrule", "-format", "-from", "-grayscale", "-shrink", "-subsample", |
︙ | ︙ | |||
1626 1627 1628 1629 1630 1631 1632 | * index in objv; this variable is updated by * this function. */ int objc, /* Number of arguments in objv[]. */ Tcl_Obj *const objv[]) /* Arguments to be parsed. */ { int index, c, bit, currentBit, length; int values[4], numValues, maxValues, argIndex; | | > | 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 | * index in objv; this variable is updated by * this function. */ int objc, /* Number of arguments in objv[]. */ Tcl_Obj *const objv[]) /* Arguments to be parsed. */ { int index, c, bit, currentBit, length; int values[4], numValues, maxValues, argIndex; char *option; const char *const *listPtr; for (index = *optIndexPtr; index < objc; *optIndexPtr = ++index) { /* * We can have one value specified without an option; it goes into * optPtr->name. */ |
︙ | ︙ |
Changes to generic/tkListbox.c.
︙ | ︙ | |||
207 208 209 210 211 212 213 | * below. */ enum state { STATE_DISABLED, STATE_NORMAL }; | | | | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | * below. */ enum state { STATE_DISABLED, STATE_NORMAL }; static CONST char *stateStrings[] = { "disabled", "normal", NULL }; enum activeStyle { ACTIVE_STYLE_DOTBOX, ACTIVE_STYLE_NONE, ACTIVE_STYLE_UNDERLINE }; static CONST char *activeStyleStrings[] = { "dotbox", "none", "underline", NULL }; /* * The optionSpecs table defines the valid configuration options for the * listbox widget. */ |
︙ | ︙ |
Changes to generic/tkMenubutton.c.
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "default.h" /* * The following table defines the legal values for the -direction option. It * is used together with the "enum direction" declaration in tkMenubutton.h. */ | | | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #include "default.h" /* * The following table defines the legal values for the -direction option. It * is used together with the "enum direction" declaration in tkMenubutton.h. */ static CONST char *directionStrings[] = { "above", "below", "flush", "left", "right", NULL }; /* * The following table defines the legal values for the -state option. It is * used together with the "enum state" declaration in tkMenubutton.h. */ static CONST char *stateStrings[] = { "active", "disabled", "normal", NULL }; /* * The following table defines the legal values for the -compound option. It * is used with the "enum compound" declaration in tkMenuButton.h */ static CONST char *compoundStrings[] = { "bottom", "center", "left", "none", "right", "top", NULL }; /* * Information used for parsing configuration specs: */ |
︙ | ︙ |
Changes to generic/tkPanedWindow.c.
︙ | ︙ | |||
31 32 33 34 35 36 37 | #define STICK_SOUTH 4 #define STICK_WEST 8 /* * The following table defines the legal values for the -orient option. */ | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #define STICK_SOUTH 4 #define STICK_WEST 8 /* * The following table defines the legal values for the -orient option. */ static CONST char *orientStrings[] = { "horizontal", "vertical", NULL }; enum orient { ORIENT_HORIZONTAL, ORIENT_VERTICAL }; /* * The following table defines the legal values for the -stretch option. */ static const char *stretchStrings[] = { "always", "first", "last", "middle", "never", NULL }; enum stretch { STRETCH_ALWAYS, /* Always give extra space to this pane. */ STRETCH_FIRST, /* Give extra space to pane if it is first. */ STRETCH_LAST, /* Give extra space to pane if it is last. */ |
︙ | ︙ |
Changes to generic/tkPlace.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | * borders of master window. * BM_OUTSIDE: relative distances computed using outside area that * includes all borders of master. * BM_IGNORE: border issues are ignored: place relative to master's * actual window size. */ | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * borders of master window. * BM_OUTSIDE: relative distances computed using outside area that * includes all borders of master. * BM_IGNORE: border issues are ignored: place relative to master's * actual window size. */ static CONST char *borderModeStrings[] = { "inside", "outside", "ignore", NULL }; typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode; /* * For each window whose geometry is managed by the placer there is a |
︙ | ︙ |
Changes to generic/tkScale.c.
︙ | ︙ | |||
22 23 24 25 26 27 28 | #include "tkScale.h" /* * The following table defines the legal values for the -orient option. It is * used together with the "enum orient" declaration in tkScale.h. */ | | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include "tkScale.h" /* * The following table defines the legal values for the -orient option. It is * used together with the "enum orient" declaration in tkScale.h. */ static CONST char *orientStrings[] = { "horizontal", "vertical", NULL }; /* * The following table defines the legal values for the -state option. It is * used together with the "enum state" declaration in tkScale.h. */ static CONST char *stateStrings[] = { "active", "disabled", "normal", NULL }; static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_SCALE_ACTIVE_BG_COLOR, -1, Tk_Offset(TkScale, activeBorder), 0, (ClientData) DEF_SCALE_ACTIVE_BG_MONO, 0}, |
︙ | ︙ |
Changes to generic/tkTest.c.
︙ | ︙ | |||
693 694 695 696 697 698 699 | Tcl_Obj *justifyPtr; Tcl_Obj *anchorPtr; Tcl_Obj *pixelPtr; Tcl_Obj *mmPtr; Tcl_Obj *customPtr; } TypesRecord; TypesRecord *recordPtr; | | | 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | Tcl_Obj *justifyPtr; Tcl_Obj *anchorPtr; Tcl_Obj *pixelPtr; Tcl_Obj *mmPtr; Tcl_Obj *customPtr; } TypesRecord; TypesRecord *recordPtr; static const char *stringTable[] = { "one", "two", "three", "four", NULL }; static const Tk_OptionSpec typesSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", Tk_Offset(TypesRecord, booleanPtr), -1, 0, 0, 0x1}, {TK_OPTION_INT, "-integer", "integer", "Integer", "7", Tk_Offset(TypesRecord, integerPtr), -1, 0, 0, 0x2}, |
︙ | ︙ | |||
966 967 968 969 970 971 972 | Tk_Anchor anchor; int pixels; double mm; Tk_Window tkwin; char *custom; } InternalRecord; InternalRecord *recordPtr; | | | 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 | Tk_Anchor anchor; int pixels; double mm; Tk_Window tkwin; char *custom; } InternalRecord; InternalRecord *recordPtr; static const char *internalStringTable[] = { "one", "two", "three", "four", NULL }; static const Tk_OptionSpec internalSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", -1, Tk_Offset(InternalRecord, boolean), 0, 0, 0x1}, {TK_OPTION_INT, "-integer", "integer", "Integer", "148962237", -1, Tk_Offset(InternalRecord, integer), 0, 0, 0x2}, |
︙ | ︙ |
Changes to generic/tkText.c.
︙ | ︙ | |||
44 45 46 47 48 49 50 | /* * The 'TkTextState' enum in tkText.h is used to define a type for the -state * option of the Text widget. These values are used as indices into the string * table below. */ | | | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | /* * The 'TkTextState' enum in tkText.h is used to define a type for the -state * option of the Text widget. These values are used as indices into the string * table below. */ static const char *stateStrings[] = { "disabled", "normal", NULL }; /* * The 'TkWrapMode' enum in tkText.h is used to define a type for the -wrap * option of the Text widget. These values are used as indices into the string * table below. */ static const char *wrapStrings[] = { "char", "none", "word", NULL }; /* * The 'TkTextTabStyle' enum in tkText.h is used to define a type for the * -tabstyle option of the Text widget. These values are used as indices into * the string table below. */ static const char *tabStyleStrings[] = { "tabular", "wordprocessor", NULL }; /* * The following functions and custom option type are used to define the * "line" option type, and thereby handle the text widget '-startline', * '-endline' configuration options which are of that type. |
︙ | ︙ |
Changes to generic/tkTextImage.c.
︙ | ︙ | |||
65 66 67 68 69 70 71 | EmbImageCheckProc /* checkProc */ }; /* * Definitions for alignment values: */ | | | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | EmbImageCheckProc /* checkProc */ }; /* * Definitions for alignment values: */ static const char *alignStrings[] = { "baseline", "bottom", "center", "top", NULL }; typedef enum { ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_TOP } alignMode; |
︙ | ︙ |
Changes to generic/tkTextTag.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | /* * The 'TkWrapMode' enum in tkText.h is used to define a type for the -wrap * option of tags in a Text widget. These values are used as indices into the * string table below. Tags are allowed an empty wrap value, but the widget as * a whole is not. */ | | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | /* * The 'TkWrapMode' enum in tkText.h is used to define a type for the -wrap * option of tags in a Text widget. These values are used as indices into the * string table below. Tags are allowed an empty wrap value, but the widget as * a whole is not. */ static const char *wrapStrings[] = { "char", "none", "word", "", NULL }; /* * The 'TkTextTabStyle' enum in tkText.h is used to define a type for the * -tabstyle option of the Text widget. These values are used as indices into * the string table below. Tags are allowed an empty wrap value, but the * widget as a whole is not. */ static const char *tabStyleStrings[] = { "tabular", "wordprocessor", "", NULL }; static const Tk_OptionSpec tagOptionSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, NULL, -1, Tk_Offset(TkTextTag, border), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BITMAP, "-bgstipple", NULL, NULL, |
︙ | ︙ |
Changes to generic/tkTextWind.c.
︙ | ︙ | |||
81 82 83 84 85 86 87 | EmbWinCheckProc /* checkProc */ }; /* * Definitions for alignment values: */ | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | EmbWinCheckProc /* checkProc */ }; /* * Definitions for alignment values: */ static const char *alignStrings[] = { "baseline", "bottom", "center", "top", NULL }; typedef enum { ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_TOP } alignMode; |
︙ | ︙ |