From 54873af19f269ce0bf55cb91d31e0ff4aa43eb29 Mon Sep 17 00:00:00 2001 From: "nijtmans@users.sourceforge.net" Date: Tue, 19 Jun 2012 09:55:18 +0000 Subject: SetOptions.3: minor doc fix make various other tables CONST (All backported from Tk 8.6) --- doc/SetOptions.3 | 187 +++++++++++++++++++++++------------------------- generic/tkButton.c | 20 +++--- generic/tkConsole.c | 4 +- generic/tkEntry.c | 8 +-- generic/tkFrame.c | 12 ++-- generic/tkImgGIF.c | 2 +- generic/tkListbox.c | 8 +-- generic/tkMenu.c | 18 ++--- generic/tkMenubutton.c | 8 +-- generic/tkMessage.c | 2 +- generic/tkOldConfig.c | 6 +- generic/tkPanedWindow.c | 14 ++-- generic/tkPlace.c | 2 +- generic/tkScale.c | 6 +- generic/tkSquare.c | 2 +- generic/tkTest.c | 20 +++--- generic/tkTextDisp.c | 8 +-- unix/tkUnixSelect.c | 2 +- unix/tkUnixWm.c | 8 +-- 19 files changed, 165 insertions(+), 172 deletions(-) diff --git a/doc/SetOptions.3 b/doc/SetOptions.3 index f0d5fba..0679432 100644 --- a/doc/SetOptions.3 +++ b/doc/SetOptions.3 @@ -45,7 +45,7 @@ A Tcl interpreter. Most procedures use this only for returning error messages; if it is NULL then no error messages are returned. For \fBTk_CreateOptionTable\fR the value cannot be NULL; it gives the interpreter in which the option table will be used. -.AP Tk_OptionSpec *templatePtr in +.AP "CONST Tk_OptionSpec" *templatePtr in Points to an array of static information that describes the configuration options that are supported. Used to build a Tk_OptionTable. The information pointed to by this argument must exist for the lifetime of the Tk_OptionTable. @@ -57,7 +57,7 @@ Points to structure in which values of configuration options are stored; fields of this record are modified by procedures such as \fBTk_SetOptions\fR and read by procedures such as \fBTk_GetOptionValue\fR. .AP Tk_Window tkwin in -For options such as TK_OPTION_COLOR, this argument indicates +For options such as \fBTK_OPTION_COLOR\fR, this argument indicates the window in which the option will be used. If \fIoptionTable\fR uses no window-dependent options, then a NULL value may be supplied for this argument. @@ -101,7 +101,7 @@ which information about a particular widget or object is stored. .PP Note: the easiest way to learn how to use these procedures is to look at a working example. In Tk, the simplest example is the code -that implements the button family of widgets, which is an \fBtkButton.c\fR. +that implements the button family of widgets, which is in \fBtkButton.c\fR. Other examples are in \fBtkSquare.c\fR and \fBtkMenu.c\fR. .PP In order to use these procedures, the code that implements the widget @@ -136,10 +136,10 @@ uses the information in the option table to choose an appropriate default for each option, then it stores the default value directly into the widget record, overwriting any information that was already present in the widget record. \fBTk_InitOptions\fR normally -returns TCL_OK. If an error occurred while setting the default values -(e.g., because a default value was erroneous) then TCL_ERROR is returned +returns \fBTCL_OK\fR. If an error occurred while setting the default values +(e.g., because a default value was erroneous) then \fBTCL_ERROR\fR is returned and an error message is left in \fIinterp\fR's result if \fIinterp\fR -isn't NULL. +is not NULL. .PP \fBTk_SetOptions\fR is invoked to modify configuration options based on information specified in a Tcl command. The command might be one that @@ -151,13 +151,13 @@ an option and the second object gives the new value for that option. \fBTk_SetOptions\fR looks up each name in \fIoptionTable\fR, checks that the new value of the option conforms to the type in \fIoptionTable\fR, and stores the value of the option into the widget record given by -\fIrecordPtr\fR. \fBTk_SetOptions\fR normally returns TCL_OK. If +\fIrecordPtr\fR. \fBTk_SetOptions\fR normally returns \fBTCL_OK\fR. If an error occurred (such as an unknown option name or an illegal option -value) then TCL_ERROR is returned and an error message is left in -\fIinterp\fR's result if \fIinterp\fR isn't NULL. +value) then \fBTCL_ERROR\fR is returned and an error message is left in +\fIinterp\fR's result if \fIinterp\fR is not NULL. .PP \fBTk_SetOptions\fR has two additional features. First, if the -\fImaskPtr\fR argument isn't NULL then it points to an integer +\fImaskPtr\fR argument is not NULL then it points to an integer value that is filled in with information about the options that were modified. For each option in the template passed to \fBTk_CreateOptionTable\fR there is a \fItypeMask\fR field. The @@ -170,8 +170,8 @@ that bit set. Another bit might indicate that the geometry of the widget must be recomputed, and so on. \fBTk_SetOptions\fR OR's together the \fItypeMask\fR fields from all the options that were modified and returns this value at *\fImaskPtr\fR; the caller can then use this information -to optimize itself so that, for example, it doesn't redisplay the widget -if the modified options don't affect the widget's appearance. +to optimize itself so that, for example, it does not redisplay the widget +if the modified options do not affect the widget's appearance. .PP The second additional feature of \fBTk_SetOptions\fR has to do with error recovery. If an error occurs while processing configuration options, this @@ -241,7 +241,6 @@ The \fBTk_Offset\fR macro is provided as a safe way of generating the Tk_OptionSpec structures. It takes two arguments: the name of a type of record, and the name of a field in that record. It returns the byte offset of the named field in records of the given type. - .SH "TEMPLATES" .PP The array of Tk_OptionSpec structures passed to \fBTk_CreateOptionTable\fR @@ -250,20 +249,20 @@ supported by a particular class of widgets. Each structure specifies one configuration option and has the following fields: .CS typedef struct { - Tk_OptionType \fItype\fR; - char *\fIoptionName\fR; - char *\fIdbName\fR; - char *\fIdbClass\fR; - char *\fIdefValue\fR; - int \fIobjOffset\fR; - int \fIinternalOffset\fR; - int \fIflags\fR; - ClientData \fIclientData\fR; - int \fItypeMask\fR; -} Tk_OptionSpec; + Tk_OptionType \fItype\fR; + char *\fIoptionName\fR; + char *\fIdbName\fR; + char *\fIdbClass\fR; + char *\fIdefValue\fR; + int \fIobjOffset\fR; + int \fIinternalOffset\fR; + int \fIflags\fR; + ClientData \fIclientData\fR; + int \fItypeMask\fR; +} \fBTk_OptionSpec\fR; .CE The \fItype\fR field indicates what kind of configuration option this is -(e.g. TK_OPTION_COLOR for a color value, or TK_OPTION_INT for +(e.g. \fBTK_OPTION_COLOR\fR for a color value, or \fBTK_OPTION_INT\fR for an integer value). \fIType\fR determines how the value of the option is parsed (more on this below). The \fIoptionName\fR field is a string such as \fB\-font\fR or \fB\-bg\fR; @@ -283,7 +282,7 @@ The \fIflags\fR field contains additional information to control the processing of this configuration option (see below for details). \fIClientData\fR provides additional type-specific data needed -by certain types. For instance, for TK_OPTION_COLOR types, +by certain types. For instance, for \fBTK_OPTION_COLOR\fR types, \fIclientData\fR is a string giving the default value to use on monochrome displays. See the descriptions of the different types below for details. @@ -300,22 +299,22 @@ If the \fIinternalOffset\fR field of the Tk_OptionSpec is greater than or equal to zero, then the value of the option is stored in a type-specific internal form at the location in the widget record given by \fIinternalOffset\fR. For example, if the option's type is -TK_OPTION_INT then the internal form is an integer. If the +\fBTK_OPTION_INT\fR then the internal form is an integer. If the \fIobjOffset\fR or \fIinternalOffset\fR field is negative then the value is not stored in that form. At least one of the offsets must be greater than or equal to zero. .PP The \fIflags\fR field consists of one or more bits ORed together. At -present only a single flag is supported: TK_OPTION_NULL_OK. If +present only a single flag is supported: \fBTK_OPTION_NULL_OK\fR. If this bit is set for an option then an empty string will be accepted as the value for the option and the resulting internal form will be a NULL pointer, a zero value, or \fBNone\fR, depending on the type of the option. If the flag is not set then empty strings will result in errors. -TK_OPTION_NULL_OK is typically used to allow a +\fBTK_OPTION_NULL_OK\fR is typically used to allow a feature to be turned off entirely, e.g. set a cursor value to \fBNone\fR so that a window simply inherits its parent's cursor. -Not all option types support the TK_OPTION_NULL_OK +Not all option types support the \fBTK_OPTION_NULL_OK\fR flag; for those that do, there is an explicit indication of that fact in the descriptions below. .PP @@ -337,7 +336,7 @@ returned by \fBTk_GetAnchorFromObj\fR. The value must be a standard Tk bitmap name. The internal form is a Pixmap token like the ones returned by \fBTk_AllocBitmapFromObj\fR. This option type requires \fItkwin\fR to be supplied to procedures -such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag. +such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag. .TP \fBTK_OPTION_BOOLEAN\fR The value must be a standard boolean value such as \fBtrue\fR or @@ -348,14 +347,14 @@ The value must be a standard color name such as \fBred\fR or \fB#ff8080\fR. The internal form is a Tk_3DBorder token like the ones returned by \fBTk_Alloc3DBorderFromObj\fR. This option type requires \fItkwin\fR to be supplied to procedures -such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag. +such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag. .TP \fBTK_OPTION_COLOR\fR The value must be a standard color name such as \fBred\fR or \fB#ff8080\fR. The internal form is an (XColor *) token like the ones returned by \fBTk_AllocColorFromObj\fR. This option type requires \fItkwin\fR to be supplied to procedures -such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag. +such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag. .TP \fBTK_OPTION_CURSOR\fR The value must be a standard cursor name such as \fBcross\fR or \fB@foo\fR. @@ -364,25 +363,25 @@ The internal form is a Tk_Cursor token like the ones returned by This option type requires \fItkwin\fR to be supplied to procedures such as \fBTk_SetOptions\fR, and when the option is set the cursor for the window is changed by calling \fBXDefineCursor\fR. This -option type also supports the TK_OPTION_NULL_OK flag. +option type also supports the \fBTK_OPTION_NULL_OK\fR flag. .TP \fBTK_OPTION_CUSTOM\fR This option allows applications to define new option types. The clientData field of the entry points to a structure defining the new -option type. See the section CUSTOM OPTION TYPES below for details. +option type. See the section \fBCUSTOM OPTION TYPES\fR below for details. .TP \fBTK_OPTION_DOUBLE\fR The string value must be a floating-point number in the format accepted by \fBstrtol\fR. The internal form is a C -\fBdouble\fR value. This option type supports the TK_OPTION_NULL_OK +\fBdouble\fR value. This option type supports the \fBTK_OPTION_NULL_OK\fR flag; if a NULL value is set, the internal representation is set to zero. .TP \fBTK_OPTION_END\fR Marks the end of the template. There must be a Tk_OptionSpec structure -with \fItype\fR TK_OPTION_END at the end of each template. If the -\fIclientData\fR field of this structure isn't NULL, then it points to +with \fItype\fR \fBTK_OPTION_END\fR at the end of each template. If the +\fIclientData\fR field of this structure is not NULL, then it points to an additional array of Tk_OptionSpec's, which is itself terminated by -another TK_OPTION_END entry. Templates may be chained arbitrarily +another \fBTK_OPTION_END\fR entry. Templates may be chained arbitrarily deeply. This feature allows common options to be shared by several widget classes. .TP @@ -391,7 +390,7 @@ The value must be a standard font name such as \fBTimes 16\fR. The internal form is a Tk_Font handle like the ones returned by \fBTk_AllocFontFromObj\fR. This option type requires \fItkwin\fR to be supplied to procedures -such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag. +such as \fBTk_SetOptions\fR, and it supports the \fBTK_OPTION_NULL_OK\fR flag. .TP \fBTK_OPTION_INT\fR The string value must be an integer in the format accepted by @@ -408,23 +407,23 @@ The internal form is a Tk_Justify like the values returned by The value must specify a screen distance such as \fB2i\fR or \fB6.4\fR. The internal form is an integer value giving a distance in pixels, like the values returned by -\fBTk_GetPixelsFromObj\fR. Note: if the \fIobjOffset\fR field isn't +\fBTk_GetPixelsFromObj\fR. Note: if the \fIobjOffset\fR field is not used then information about the original value of this option will be lost. See \fBOBJOFFSET VS. INTERNALOFFSET\fR below for details. This option -type supports the TK_OPTION_NULL_OK flag; if a NULL value is set, the +type supports the \fBTK_OPTION_NULL_OK\fR flag; if a NULL value is set, the internal representation is set to zero. .TP \fBTK_OPTION_RELIEF\fR The value must be standard relief such as \fBraised\fR. The internal form is an integer relief value such as -TK_RELIEF_RAISED. This option type supports the TK_OPTION_NULL_OK +\fBTK_RELIEF_RAISED\fR. This option type supports the \fBTK_OPTION_NULL_OK\fR flag; if the empty string is specified as the value for the option, -the integer relief value is set to TK_RELIEF_NULL. +the integer relief value is set to \fBTK_RELIEF_NULL\fR. .TP \fBTK_OPTION_STRING\fR The value may be any string. The internal form is a (char *) pointer that points to a dynamically allocated copy of the value. -This option type supports the TK_OPTION_NULL_OK flag. +This option type supports the \fBTK_OPTION_NULL_OK\fR flag. .TP \fBTK_OPTION_STRING_TABLE\fR For this type, \fIclientData\fR is a pointer to an array of strings @@ -432,23 +431,21 @@ suitable for passing to \fBTcl_GetIndexFromObj\fR. The value must be one of the strings in the table, or a unique abbreviation of one of the strings. The internal form is an integer giving the index into the table of the matching string, like the return value -from \fBTcl_GetStringFromObj\fR. +from \fBTcl_GetStringFromObj\fR. .TP \fBTK_OPTION_SYNONYM\fR This type is used to provide alternative names for an option (for example, \fB\-bg\fR is often used as a synonym for \fB\-background\fR). -The \fBclientData\fR field is a (char *) pointer that gives -the name of another option in the same table. Whenever the -synonym option is used, the information from the other option -will be used instead. +The \fBclientData\fR field is a string that gives the name of another +option in the same table. Whenever the synonym option is used, the +information from the other option will be used instead. .TP \fBTK_OPTION_WINDOW\fR The value must be a window path name. The internal form is a \fBTk_Window\fR token for the window. This option type requires \fItkwin\fR to be supplied to procedures such as \fBTk_SetOptions\fR (in order to identify the application), -and it supports the TK_OPTION_NULL_OK flag. - +and it supports the \fBTK_OPTION_NULL_OK\fR flag. .SH "STORAGE MANAGEMENT ISSUES" .PP If a field of a widget record has its offset stored in the \fIobjOffset\fR @@ -457,8 +454,8 @@ procedures described here will handle all of the storage allocation and resource management issues associated with the field. When the value of an option is changed, \fBTk_SetOptions\fR (or \fBTk_FreeSavedOptions\fR) will automatically free any resources associated with the old value, such as -Tk_Fonts for TK_OPTION_FONT options or dynamically allocated memory for -TK_OPTION_STRING options. For an option stored as an object using the +Tk_Fonts for \fBTK_OPTION_FONT\fR options or dynamically allocated memory for +\fBTK_OPTION_STRING\fR options. For an option stored as an object using the \fIobjOffset\fR field of a Tk_OptionSpec, the widget record shares the object pointed to by the \fIobjv\fR value from the call to \fBTk_SetOptions\fR. The reference count for this object is incremented @@ -472,38 +469,36 @@ However, the widget code is responsible for storing NULL or \fBNone\fR in all pointer and token fields before invoking \fBTk_InitOptions\fR. This is needed to allow proper cleanup in the rare case where an error occurs in \fBTk_InitOptions\fR. - .SH "OBJOFFSET VS. INTERNALOFFSET" .PP In most cases it is simplest to use the \fIinternalOffset\fR field of a Tk_OptionSpec structure and not the \fIobjOffset\fR field. This makes the internal form of the value immediately available to the -widget code so the value doesn't have to be extracted from an object +widget code so the value does not have to be extracted from an object each time it is used. However, there are two cases where the \fIobjOffset\fR field is useful. The first case is for -TK_OPTION_PIXELS options. In this case, the internal form is +\fBTK_OPTION_PIXELS\fR options. In this case, the internal form is an integer pixel value that is valid only for a particular screen. If the value of the option is retrieved, it will be returned as a simple number. For example, after the command \fB.b configure \-borderwidth 2m\fR, the command \fB.b configure \-borderwidth\fR might return 7, which is the integer pixel value corresponding to \fB2m\fR. Unfortunately, this loses -the original screen-independent value. Thus for TK_OPTION_PIXELS options +the original screen-independent value. Thus for \fBTK_OPTION_PIXELS\fR options it is better to use the \fIobjOffset\fR field. In this case the original value of the option is retained in the object and can be returned when the option is retrieved. In most cases it is convenient to use the -\fIinternalOffset\fR field field as well, so that the integer value is +\fIinternalOffset\fR field as well, so that the integer value is immediately available for use in the widget code (alternatively, \fBTk_GetPixelsFromObj\fR can be used to extract the integer value from the object whenever it is needed). Note: the problem of losing information -on retrievals exists only for TK_OPTION_PIXELS options. +on retrievals exists only for \fBTK_OPTION_PIXELS\fR options. .PP The second reason to use the \fIobjOffset\fR field is in order to implement new types of options not supported by these procedures. -To implement a new type of option, you can use TK_OPTION_STRING as +To implement a new type of option, you can use \fBTK_OPTION_STRING\fR as the type in the Tk_OptionSpec structure and set the \fIobjOffset\fR field but not the \fIinternalOffset\fR field. Then, after calling \fBTk_SetOptions\fR, convert the object to internal form yourself. - .SH "CUSTOM OPTION TYPES" .PP Applications can extend the built-in configuration types with @@ -512,40 +507,40 @@ free, and restore saved copies of the type and creating a structure pointing to those procedures: .CS typedef struct Tk_ObjCustomOption { - char *name; - Tk_CustomOptionSetProc *\fIsetProc\fR; - Tk_CustomOptionGetProc *\fIgetProc\fR; - Tk_CustomOptionRestoreProc *\fIrestoreProc\fR; - Tk_CustomOptionFreeProc *\fIfreeProc\fR; - ClientData \fIclientData\fR; -} Tk_ObjCustomOption; + char *name; + Tk_CustomOptionSetProc *\fIsetProc\fR; + Tk_CustomOptionGetProc *\fIgetProc\fR; + Tk_CustomOptionRestoreProc *\fIrestoreProc\fR; + Tk_CustomOptionFreeProc *\fIfreeProc\fR; + ClientData \fIclientData\fR; +} \fBTk_ObjCustomOption\fR; -typedef int Tk_CustomOptionSetProc( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR, - Tk_Window \fItkwin\fR, - Tcl_Obj **\fIvaluePtr\fR, - char *\fIrecordPtr\fR, - int \fIinternalOffset\fR, - char *\fIsaveInternalPtr\fR, - int \fIflags\fR); +typedef int \fBTk_CustomOptionSetProc\fR( + ClientData \fIclientData\fR, + Tcl_Interp *\fIinterp\fR, + Tk_Window \fItkwin\fR, + Tcl_Obj **\fIvaluePtr\fR, + char *\fIrecordPtr\fR, + int \fIinternalOffset\fR, + char *\fIsaveInternalPtr\fR, + int \fIflags\fR); -typedef Tcl_Obj *Tk_CustomOptionGetProc( - ClientData \fIclientData\fR, - Tk_Window \fItkwin\fR, - char *\fIrecordPtr\fR, - int \fIinternalOffset\fR); +typedef Tcl_Obj *\fBTk_CustomOptionGetProc\fR( + ClientData \fIclientData\fR, + Tk_Window \fItkwin\fR, + char *\fIrecordPtr\fR, + int \fIinternalOffset\fR); -typedef void Tk_CustomOptionRestoreProc( - ClientData \fIclientData\fR, - Tk_Window \fItkwin\fR, - char *\fIinternalPtr\fR, - char *\fIsaveInternalPtr\fR); +typedef void \fBTk_CustomOptionRestoreProc\fR( + ClientData \fIclientData\fR, + Tk_Window \fItkwin\fR, + char *\fIinternalPtr\fR, + char *\fIsaveInternalPtr\fR); -typedef void Tk_CustomOptionFreeProc( - ClientData \fIclientData\fR, - Tk_Window \fItkwin\fR, - char *\fIinternalPtr\fR); +typedef void \fBTk_CustomOptionFreeProc\fR( + ClientData \fIclientData\fR, + Tk_Window \fItkwin\fR, + char *\fIinternalPtr\fR); .CE .PP The Tk_ObjCustomOption structure contains six fields: a name @@ -581,7 +576,7 @@ value is stored as a (Tcl_Obj *) in the widget record), the Tcl_Obj pointer referenced by \fIvaluePtr\fR is the pointer that will be stored at the objOffset for the option. \fISetProc\fR may modify the value if necessary; for example, \fIsetProc\fR may change the value to -NULL to support the TK_OPTION_NULL_OK flag. +NULL to support the \fBTK_OPTION_NULL_OK\fR flag. .TP \fIrecordPtr\fR A pointer to the start of the widget record to modify. @@ -602,8 +597,8 @@ A copy of the \fIflags\fR field in the Tk_OptionSpec structure for the option .RE .PP -\fISetProc\fR returns a standard Tcl result: TCL_OK to indicate successful -processing, or TCL_ERROR to indicate a failure of any kind. An error +\fISetProc\fR returns a standard Tcl result: \fBTCL_OK\fR to indicate successful +processing, or \fBTCL_ERROR\fR to indicate a failure of any kind. An error message may be left in the Tcl interpreter given by \fIinterp\fR in the case of an error. .PP @@ -643,8 +638,6 @@ structure. \fITkwin\fR is a copy of the \fItkwin\fR argument to is a pointer to the location where the internal representation of the option value is stored. The \fIfreeProc\fR must free any storage associated with the option. \fIFreeProc\fR has no return value. - - .SH KEYWORDS anchor, bitmap, boolean, border, color, configuration option, cursor, double, font, integer, justify, diff --git a/generic/tkButton.c b/generic/tkButton.c index e844cec..9a261e9 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -25,14 +25,14 @@ static Tcl_ThreadDataKey dataKey; * in tkButton.h. */ -static CONST char *classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"}; +static CONST char *CONST classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"}; /* * The following table defines the legal values for the -default option. * It is used together with the "enum defaultValue" declaration in tkButton.h. */ -static CONST char *defaultStrings[] = { +static CONST char *CONST defaultStrings[] = { "active", "disabled", "normal", (char *) NULL }; @@ -41,7 +41,7 @@ static CONST char *defaultStrings[] = { * It is used together with the "enum state" declaration in tkButton.h. */ -static CONST char *stateStrings[] = { +static CONST char *CONST stateStrings[] = { "active", "disabled", "normal", (char *) NULL }; @@ -50,7 +50,7 @@ static CONST char *stateStrings[] = { * It is used with the "enum compound" declaration in tkButton.h */ -static CONST char *compoundStrings[] = { +static CONST char *CONST compoundStrings[] = { "bottom", "center", "left", "none", "right", "top", (char *) NULL }; @@ -61,7 +61,7 @@ char tkDefButtonBorderWidth[TCL_INTEGER_SPACE] = DEF_BUTTON_BORDER_WIDTH; * separate table for each of the four widget classes. */ -static Tk_OptionSpec labelOptionSpecs[] = { +static CONST Tk_OptionSpec labelOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder), 0, (ClientData) DEF_BUTTON_ACTIVE_BG_MONO, 0}, @@ -147,7 +147,7 @@ static Tk_OptionSpec labelOptionSpecs[] = { (char *) NULL, 0, 0, 0, 0} }; -static Tk_OptionSpec buttonOptionSpecs[] = { +static CONST Tk_OptionSpec buttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder), 0, (ClientData) DEF_BUTTON_ACTIVE_BG_MONO, 0}, @@ -249,7 +249,7 @@ static Tk_OptionSpec buttonOptionSpecs[] = { (char *) NULL, 0, -1, 0, 0, 0} }; -static Tk_OptionSpec checkbuttonOptionSpecs[] = { +static CONST Tk_OptionSpec checkbuttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder), 0, (ClientData) DEF_BUTTON_ACTIVE_BG_MONO, 0}, @@ -358,7 +358,7 @@ static Tk_OptionSpec checkbuttonOptionSpecs[] = { (char *) NULL, 0, -1, 0, 0, 0} }; -static Tk_OptionSpec radiobuttonOptionSpecs[] = { +static CONST Tk_OptionSpec radiobuttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder), 0, (ClientData) DEF_BUTTON_ACTIVE_BG_MONO, 0}, @@ -472,7 +472,7 @@ static Tk_OptionSpec radiobuttonOptionSpecs[] = { * class of widgets. */ -static Tk_OptionSpec *optionSpecs[] = { +static CONST Tk_OptionSpec *CONST optionSpecs[] = { labelOptionSpecs, buttonOptionSpecs, checkbuttonOptionSpecs, @@ -631,7 +631,7 @@ ButtonCreate(clientData, interp, objc, objv, type) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->defaultsInitialized) { - TkpButtonSetDefaults(optionSpecs[type]); + TkpButtonSetDefaults(NULL); tsdPtr->defaultsInitialized = 1; } diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 307b9b5..af6e76a 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -351,9 +351,9 @@ Tk_CreateConsoleWindow(interp) int haveConsoleChannel = 1; #ifdef MAC_TCL - static const char *initCmd = "if {[catch {source $tk_library:console.tcl}]} {source -rsrc console}"; + static CONST char *initCmd = "if {[catch {source $tk_library:console.tcl}]} {source -rsrc console}"; #else - static const char *initCmd = "source $tk_library/console.tcl"; + static CONST char *initCmd = "source $tk_library/console.tcl"; #endif /* Init an interp with Tcl and Tk */ diff --git a/generic/tkEntry.c b/generic/tkEntry.c index c6eed1b..996af63 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -35,7 +35,7 @@ #define DOUBLES_EQ(d1, d2) (fabs((d1) - (d2)) < MIN_DBL_VAL) -static CONST char *stateStrings[] = { +static CONST char *CONST stateStrings[] = { "disabled", "normal", "readonly", (char *) NULL }; @@ -43,7 +43,7 @@ static CONST char *stateStrings[] = { * Definitions for -validate option values: */ -static CONST char *validateStrings[] = { +static CONST char *CONST validateStrings[] = { "all", "key", "focus", "focusin", "focusout", "none", (char *) NULL }; enum validateType { @@ -61,7 +61,7 @@ enum validateType { * Information used for Entry objv parsing. */ -static Tk_OptionSpec entryOptSpec[] = { +static CONST Tk_OptionSpec entryOptSpec[] = { {TK_OPTION_BORDER, "-background", "background", "Background", DEF_ENTRY_BG_COLOR, -1, Tk_Offset(Entry, normalBorder), 0, (ClientData) DEF_ENTRY_BG_MONO, 0}, @@ -189,7 +189,7 @@ static Tk_OptionSpec entryOptSpec[] = { #define DEF_SPINBOX_VALUES "" #define DEF_SPINBOX_WRAP "0" -static Tk_OptionSpec sbOptSpec[] = { +static CONST Tk_OptionSpec sbOptSpec[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Background", DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(Spinbox, activeBorder), 0, (ClientData) DEF_BUTTON_ACTIVE_BG_MONO, 0}, diff --git a/generic/tkFrame.c b/generic/tkFrame.c index a416b22..e7a6dbe 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -170,7 +170,7 @@ enum labelanchor { LABELANCHOR_W, LABELANCHOR_WN, LABELANCHOR_WS }; -static CONST char *labelAnchorStrings[] = { +static CONST char *CONST labelAnchorStrings[] = { "e", "en", "es", "n", "ne", "nw", "s", "se", "sw", "w", "wn", "ws", (char *) NULL }; @@ -180,7 +180,7 @@ static CONST char *labelAnchorStrings[] = { * one common table used by all and one table for each widget class. */ -static Tk_OptionSpec commonOptSpec[] = { +static CONST Tk_OptionSpec commonOptSpec[] = { {TK_OPTION_BORDER, "-background", "background", "Background", DEF_FRAME_BG_COLOR, -1, Tk_Offset(Frame, border), TK_OPTION_NULL_OK, (ClientData) DEF_FRAME_BG_MONO, 0}, @@ -226,7 +226,7 @@ static Tk_OptionSpec commonOptSpec[] = { (char *) NULL, 0, 0, 0, 0, 0} }; -static Tk_OptionSpec frameOptSpec[] = { +static CONST Tk_OptionSpec frameOptSpec[] = { {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL, (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", @@ -242,7 +242,7 @@ static Tk_OptionSpec frameOptSpec[] = { (char *) NULL, 0, 0, 0, (ClientData) commonOptSpec, 0} }; -static Tk_OptionSpec toplevelOptSpec[] = { +static CONST Tk_OptionSpec toplevelOptSpec[] = { {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL, (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", @@ -267,7 +267,7 @@ static Tk_OptionSpec toplevelOptSpec[] = { (char *) NULL, 0, 0, 0, (ClientData) commonOptSpec, 0} }; -static Tk_OptionSpec labelframeOptSpec[] = { +static CONST Tk_OptionSpec labelframeOptSpec[] = { {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL, (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", @@ -309,7 +309,7 @@ static CONST char *classNames[] = {"Frame", "Toplevel", "Labelframe"}; * that class of widgets. */ -static Tk_OptionSpec *optionSpecs[] = { +static CONST Tk_OptionSpec *CONST optionSpecs[] = { frameOptSpec, toplevelOptSpec, labelframeOptSpec diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index bbb3178..d46f9f9 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -2096,7 +2096,7 @@ compress(init_bits, handle, readValue) out_clear_init = (init_bits <= 3) ? 9 : (out_bump_init-1); #ifdef MIGIF_DEBUGGING_ENVARS { - const char *ocienv; + CONST char *ocienv; ocienv = getenv("MIGIF_OUT_CLEAR_INIT"); if (ocienv) { out_clear_init = atoi(ocienv); diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 6f8156f..103cd9d 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -210,7 +210,7 @@ enum state { STATE_DISABLED, STATE_NORMAL }; -static CONST char *stateStrings[] = { +static CONST char *CONST stateStrings[] = { "disabled", "normal", (char *) NULL }; @@ -218,7 +218,7 @@ enum activeStyle { ACTIVE_STYLE_DOTBOX, ACTIVE_STYLE_NONE, ACTIVE_STYLE_UNDERLINE }; -static CONST char *activeStyleStrings[] = { +static CONST char *CONST activeStyleStrings[] = { "dotbox", "none", "underline", (char *) NULL }; @@ -226,7 +226,7 @@ static CONST char *activeStyleStrings[] = { * The optionSpecs table defines the valid configuration options for the * listbox widget */ -static Tk_OptionSpec optionSpecs[] = { +static CONST Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-activestyle", "activeStyle", "ActiveStyle", DEF_LISTBOX_ACTIVE_STYLE, -1, Tk_Offset(Listbox, activeStyle), 0, (ClientData) activeStyleStrings, 0}, @@ -307,7 +307,7 @@ static Tk_OptionSpec optionSpecs[] = { * The itemAttrOptionSpecs table defines the valid configuration options for * listbox items */ -static Tk_OptionSpec itemAttrOptionSpecs[] = { +static CONST Tk_OptionSpec itemAttrOptionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", (char *)NULL, -1, Tk_Offset(ItemAttr, border), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 19031c5..4bcc46f 100755 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -113,11 +113,11 @@ static CONST char *menuEntryTypeStrings[] = { * It is used with the "enum compound" declaration in tkMenu.h */ -static const char *compoundStrings[] = { +static CONST char *CONST compoundStrings[] = { "bottom", "center", "left", "none", "right", "top", (char *) NULL }; -static Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = { +static CONST Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-activebackground", (char *) NULL, (char *) NULL, DEF_MENU_ENTRY_ACTIVE_BG, Tk_Offset(TkMenuEntry, activeBorderPtr), -1, TK_OPTION_NULL_OK}, @@ -166,14 +166,14 @@ static Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = { {TK_OPTION_END} }; -static Tk_OptionSpec tkSeparatorEntryConfigSpecs[] = { +static CONST Tk_OptionSpec tkSeparatorEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-background", (char *) NULL, (char *) NULL, DEF_MENU_ENTRY_BG, Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK}, {TK_OPTION_END} }; -static Tk_OptionSpec tkCheckButtonEntryConfigSpecs[] = { +static CONST Tk_OptionSpec tkCheckButtonEntryConfigSpecs[] = { {TK_OPTION_BOOLEAN, "-indicatoron", (char *) NULL, (char *) NULL, DEF_MENU_ENTRY_INDICATOR, -1, Tk_Offset(TkMenuEntry, indicatorOn)}, @@ -196,7 +196,7 @@ static Tk_OptionSpec tkCheckButtonEntryConfigSpecs[] = { (char *) NULL, 0, -1, 0, (ClientData) tkBasicMenuEntryConfigSpecs} }; -static Tk_OptionSpec tkRadioButtonEntryConfigSpecs[] = { +static CONST Tk_OptionSpec tkRadioButtonEntryConfigSpecs[] = { {TK_OPTION_BOOLEAN, "-indicatoron", (char *) NULL, (char *) NULL, DEF_MENU_ENTRY_INDICATOR, -1, Tk_Offset(TkMenuEntry, indicatorOn)}, @@ -216,7 +216,7 @@ static Tk_OptionSpec tkRadioButtonEntryConfigSpecs[] = { (char *) NULL, 0, -1, 0, (ClientData) tkBasicMenuEntryConfigSpecs} }; -static Tk_OptionSpec tkCascadeEntryConfigSpecs[] = { +static CONST Tk_OptionSpec tkCascadeEntryConfigSpecs[] = { {TK_OPTION_STRING, "-menu", (char *) NULL, (char *) NULL, DEF_MENU_ENTRY_MENU, Tk_Offset(TkMenuEntry, namePtr), -1, TK_OPTION_NULL_OK}, @@ -224,7 +224,7 @@ static Tk_OptionSpec tkCascadeEntryConfigSpecs[] = { (char *) NULL, 0, -1, 0, (ClientData) tkBasicMenuEntryConfigSpecs} }; -static Tk_OptionSpec tkTearoffEntryConfigSpecs[] = { +static CONST Tk_OptionSpec tkTearoffEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-background", (char *) NULL, (char *) NULL, DEF_MENU_ENTRY_BG, Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK}, @@ -234,7 +234,7 @@ static Tk_OptionSpec tkTearoffEntryConfigSpecs[] = { {TK_OPTION_END} }; -static Tk_OptionSpec *specsArray[] = { +static CONST Tk_OptionSpec *CONST specsArray[] = { tkCascadeEntryConfigSpecs, tkCheckButtonEntryConfigSpecs, tkBasicMenuEntryConfigSpecs, tkRadioButtonEntryConfigSpecs, tkSeparatorEntryConfigSpecs, tkTearoffEntryConfigSpecs}; @@ -246,7 +246,7 @@ static Tk_OptionSpec *specsArray[] = { static CONST char *menuTypeStrings[] = {"normal", "tearoff", "menubar", (char *) NULL}; -static Tk_OptionSpec tkMenuConfigSpecs[] = { +static CONST Tk_OptionSpec tkMenuConfigSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_MENU_ACTIVE_BG_COLOR, Tk_Offset(TkMenu, activeBorderPtr), -1, 0, diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 7e9a11a..0e85308 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -21,7 +21,7 @@ * in tkMenubutton.h. */ -static CONST char *directionStrings[] = { +static CONST char *CONST directionStrings[] = { "above", "below", "flush", "left", "right", (char *) NULL }; @@ -30,7 +30,7 @@ static CONST char *directionStrings[] = { * It is used together with the "enum state" declaration in tkMenubutton.h. */ -static CONST char *stateStrings[] = { +static CONST char *CONST stateStrings[] = { "active", "disabled", "normal", (char *) NULL }; @@ -39,7 +39,7 @@ static CONST char *stateStrings[] = { * It is used with the "enum compound" declaration in tkMenuButton.h */ -static CONST char *compoundStrings[] = { +static CONST char *CONST compoundStrings[] = { "bottom", "center", "left", "none", "right", "top", (char *) NULL }; @@ -47,7 +47,7 @@ static CONST char *compoundStrings[] = { * Information used for parsing configuration specs: */ -static Tk_OptionSpec optionSpecs[] = { +static CONST Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_MENUBUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkMenuButton, activeBorder), 0, diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 8fb5c36..0b3f36d 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -108,7 +108,7 @@ typedef struct { * Information used for argv parsing. */ -static Tk_OptionSpec optionSpecs[] = { +static CONST Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_MESSAGE_ANCHOR, -1, Tk_Offset(Message, anchor), 0, 0, 0}, {TK_OPTION_INT, "-aspect", "aspect", "Aspect", DEF_MESSAGE_ASPECT, diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index bbb673f..6c6303d 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -44,7 +44,7 @@ static CONST char * FormatConfigValue _ANSI_ARGS_((Tcl_Interp *interp, char *widgRec, char *buffer, Tcl_FreeProc **freeProcPtr)); static Tk_ConfigSpec * GetCachedSpecs _ANSI_ARGS_((Tcl_Interp *interp, - const Tk_ConfigSpec *staticSpecs)); + CONST Tk_ConfigSpec *staticSpecs)); static void DeleteSpecCacheTable _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp)); @@ -1074,7 +1074,7 @@ Tk_FreeOptions(specs, widgRec, display, needFlags) static Tk_ConfigSpec * GetCachedSpecs(interp, staticSpecs) Tcl_Interp *interp; /* Interpreter in which to store the cache. */ - const Tk_ConfigSpec *staticSpecs; + CONST Tk_ConfigSpec *staticSpecs; /* Value to cache a copy of; it is also used * as a key into the cache. */ { @@ -1107,7 +1107,7 @@ GetCachedSpecs(interp, staticSpecs) &isNew); if (isNew) { unsigned int entrySpace = sizeof(Tk_ConfigSpec); - const Tk_ConfigSpec *staticSpecPtr; + CONST Tk_ConfigSpec *staticSpecPtr; Tk_ConfigSpec *specPtr; /* diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 09106dd..a876ae8 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -34,7 +34,7 @@ * The following table defines the legal values for the -orient option. */ -static CONST char *orientStrings[] = { +static CONST char *CONST orientStrings[] = { "horizontal", "vertical", (char *) NULL }; @@ -234,7 +234,7 @@ static Tk_ObjCustomOption stickyOption = { 0 }; -static Tk_OptionSpec optionSpecs[] = { +static CONST Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", DEF_PANEDWINDOW_BG_COLOR, -1, Tk_Offset(PanedWindow, background), 0, (ClientData) DEF_PANEDWINDOW_BG_MONO}, @@ -286,7 +286,7 @@ static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_END} }; -static Tk_OptionSpec slaveOptionSpecs[] = { +static CONST Tk_OptionSpec slaveOptionSpecs[] = { {TK_OPTION_WINDOW, "-after", (char *) NULL, (char *) NULL, DEF_PANEDWINDOW_PANE_AFTER, -1, Tk_Offset(Slave, after), TK_OPTION_NULL_OK, 0, 0}, @@ -1368,7 +1368,7 @@ DisplayPanedWindow(clientData) Pixmap pixmap; Tk_Window tkwin = pwPtr->tkwin; int i, sashWidth, sashHeight; - const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); + CONST int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); pwPtr->flags &= ~REDRAW_PENDING; if ((pwPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { @@ -1639,7 +1639,7 @@ ArrangePanes(clientData) int internalBW; int paneDynSize, paneDynMinSize, pwHeight, pwWidth, pwSize; int stretchReserve, stretchAmount; - const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); + CONST int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); pwPtr->flags &= ~(REQUESTED_RELAYOUT|RESIZE_PENDING); @@ -2039,7 +2039,7 @@ ComputeGeometry(pwPtr) int sashWidth, sashOffset, handleOffset; int reqWidth, reqHeight, dim; Slave *slavePtr; - const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); + CONST int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); pwPtr->flags |= REQUESTED_RELAYOUT; @@ -2447,7 +2447,7 @@ MoveSash(pwPtr, sash, diff) Slave *slavePtr; int stretchReserve = 0; int nextSash = sash + 1; - const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); + CONST int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); if (diff == 0) return; diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 6178d26..4c7f0f4 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -79,7 +79,7 @@ typedef struct Slave { */ #define IN_MASK 1 -static Tk_OptionSpec optionSpecs[] = { +static CONST Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", -1, Tk_Offset(Slave, anchor), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", -1, diff --git a/generic/tkScale.c b/generic/tkScale.c index 9b582fe..1c5c6f3 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -30,7 +30,7 @@ * It is used together with the "enum orient" declaration in tkScale.h. */ -static CONST char *orientStrings[] = { +static CONST char *CONST orientStrings[] = { "horizontal", "vertical", (char *) NULL }; @@ -39,11 +39,11 @@ static CONST char *orientStrings[] = { * It is used together with the "enum state" declaration in tkScale.h. */ -static CONST char *stateStrings[] = { +static CONST char *CONST stateStrings[] = { "active", "disabled", "normal", (char *) NULL }; -static Tk_OptionSpec optionSpecs[] = { +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}, diff --git a/generic/tkSquare.c b/generic/tkSquare.c index 435b841..9f07b27 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -58,7 +58,7 @@ typedef struct { * Information used for argv parsing. */ -static Tk_OptionSpec optionSpecs[] = { +static CONST Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", "#d9d9d9", Tk_Offset(Square, bgBorderPtr), -1, 0, (ClientData) "white"}, diff --git a/generic/tkTest.c b/generic/tkTest.c index fdd70b7..6cb776c 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -649,7 +649,7 @@ TestobjconfigObjCmd(clientData, interp, objc, objv) * created by commands below; indexed * with same values as "options" * array. */ - static Tk_ObjCustomOption CustomOption = { + static CONST Tk_ObjCustomOption CustomOption = { "custom option", CustomOptionSet, CustomOptionGet, @@ -674,7 +674,7 @@ TestobjconfigObjCmd(clientData, interp, objc, objv) Tcl_Obj *extension4ObjPtr; Tcl_Obj *extension5ObjPtr; } ExtensionWidgetRecord; - static Tk_OptionSpec baseSpecs[] = { + static CONST Tk_OptionSpec baseSpecs[] = { {TK_OPTION_STRING, "-one", "one", "One", "one", Tk_Offset(ExtensionWidgetRecord, base1ObjPtr), -1}, @@ -717,9 +717,9 @@ TestobjconfigObjCmd(clientData, interp, objc, objv) Tcl_Obj *customPtr; } TypesRecord; TypesRecord *recordPtr; - static CONST char *stringTable[] = {"one", "two", "three", "four", + static CONST char *CONST stringTable[] = {"one", "two", "three", "four", (char *) NULL}; - static Tk_OptionSpec typesSpecs[] = { + static CONST Tk_OptionSpec typesSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", Tk_Offset(TypesRecord, booleanPtr), -1, 0, 0, 0x1}, @@ -893,7 +893,7 @@ TestobjconfigObjCmd(clientData, interp, objc, objv) case CHAIN2: { ExtensionWidgetRecord *recordPtr; - static Tk_OptionSpec extensionSpecs[] = { + static CONST Tk_OptionSpec extensionSpecs[] = { {TK_OPTION_STRING, "-three", "three", "Three", "three", Tk_Offset(ExtensionWidgetRecord, extension3ObjPtr), @@ -961,7 +961,7 @@ TestobjconfigObjCmd(clientData, interp, objc, objv) Tcl_Obj *intPtr; } ErrorWidgetRecord; ErrorWidgetRecord widgetRecord; - static Tk_OptionSpec errorSpecs[] = { + static CONST Tk_OptionSpec errorSpecs[] = { {TK_OPTION_INT, "-int", "integer", "Integer", "bogus", Tk_Offset(ErrorWidgetRecord, intPtr)}, @@ -1035,7 +1035,7 @@ TestobjconfigObjCmd(clientData, interp, objc, objv) static CONST char *internalStringTable[] = { "one", "two", "three", "four", (char *) NULL }; - static Tk_OptionSpec internalSpecs[] = { + static CONST Tk_OptionSpec internalSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", -1, Tk_Offset(InternalRecord, boolean), 0, 0, 0x1}, @@ -1173,7 +1173,7 @@ TestobjconfigObjCmd(clientData, interp, objc, objv) Tcl_Obj *five; } FiveRecord; FiveRecord *recordPtr; - static Tk_OptionSpec smallSpecs[] = { + static CONST Tk_OptionSpec smallSpecs[] = { {TK_OPTION_INT, "-one", "one", "One", "1", @@ -1239,7 +1239,7 @@ TestobjconfigObjCmd(clientData, interp, objc, objv) Tcl_Obj *fooObjPtr; } NotEnoughRecord; NotEnoughRecord record; - static Tk_OptionSpec errorSpecs[] = { + static CONST Tk_OptionSpec errorSpecs[] = { {TK_OPTION_INT, "-foo", "foo", "Foo", "0", Tk_Offset(NotEnoughRecord, fooObjPtr)}, @@ -1274,7 +1274,7 @@ TestobjconfigObjCmd(clientData, interp, objc, objv) Tcl_Obj *windowPtr; } SlaveRecord; SlaveRecord *recordPtr; - static Tk_OptionSpec slaveSpecs[] = { + static CONST Tk_OptionSpec slaveSpecs[] = { {TK_OPTION_WINDOW, "-window", "window", "Window", ".bar", Tk_Offset(SlaveRecord, windowPtr), -1, diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index cd5d90f..4637b5c 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -1693,9 +1693,9 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap) Display *display; int height, x; #ifndef TK_NO_DOUBLE_BUFFERING - const int y = 0; + CONST int y = 0; #else - const int y = dlPtr->y; + CONST int y = dlPtr->y; #endif /* TK_NO_DOUBLE_BUFFERING */ if (dlPtr->chunkPtr == NULL) return; @@ -1875,9 +1875,9 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap) StyleValues *sValuePtr; Display *display; #ifndef TK_NO_DOUBLE_BUFFERING - const int y = 0; + CONST int y = 0; #else - const int y = dlPtr->y; + CONST int y = dlPtr->y; #endif /* TK_NO_DOUBLE_BUFFERING */ /* diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c index 5eedd5d..17ba36c 100644 --- a/unix/tkUnixSelect.c +++ b/unix/tkUnixSelect.c @@ -1414,7 +1414,7 @@ SelCvtToX(string, type, tkwin, numLongsPtr) int *numLongsPtr; /* Number of 32-bit words contained in the * result. */ { - const char **field; + CONST char **field; int numFields, i; long *propPtr; diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 1ab5980..cb5b643 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -4487,7 +4487,7 @@ UpdateTitle(winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr; Atom XA_UTF8_STRING = Tk_InternAtom((Tk_Window) winPtr, "UTF8_STRING"); - const char *string; + CONST char *string; Tcl_DString ds; /* @@ -4502,7 +4502,7 @@ UpdateTitle(winPtr) XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window, Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_NAME"), XA_UTF8_STRING, 8, PropModeReplace, - (const unsigned char*)string, (signed int)strlen(string)); + (CONST unsigned char*)string, (signed int)strlen(string)); /* * Set icon name: @@ -4516,7 +4516,7 @@ UpdateTitle(winPtr) XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window, Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_ICON_NAME"), XA_UTF8_STRING, 8, PropModeReplace, - (const unsigned char*)wmPtr->iconName, + (CONST unsigned char*)wmPtr->iconName, (signed int)strlen(wmPtr->iconName)); } } @@ -4969,7 +4969,7 @@ GetNetWmType(winPtr) &bytesAfter, &propertyValue)) { atoms = (Atom *)propertyValue; for (n = 0; n < count; ++n) { - const char *name = Tk_GetAtomName(tkwin, atoms[n]); + CONST char *name = Tk_GetAtomName(tkwin, atoms[n]); if (strncmp("_NET_WM_WINDOW_TYPE_", name, 20) == 0) { Tcl_ExternalToUtfDString(NULL, name+20, -1, &ds); Tcl_UtfToLower(Tcl_DStringValue(&ds)); -- cgit v0.12