summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-04-27 22:38:54 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-04-27 22:38:54 (GMT)
commit4513cb9f431ea8c6b151913a016ec6c75bcac559 (patch)
tree681f7c2354a3726da3ab7da646d316c1275f540d
parent1876f5f7ee429456ad89540bcf659c092245bf1b (diff)
downloadtk-4513cb9f431ea8c6b151913a016ec6c75bcac559.zip
tk-4513cb9f431ea8c6b151913a016ec6c75bcac559.tar.gz
tk-4513cb9f431ea8c6b151913a016ec6c75bcac559.tar.bz2
Get rid of pre-C89-isms (esp. CONST vs const).
-rw-r--r--ChangeLog8
-rw-r--r--generic/tk3d.c10
-rw-r--r--generic/tkArgv.c12
-rw-r--r--generic/tkAtom.c6
-rw-r--r--generic/tkCanvArc.c48
-rw-r--r--generic/tkCanvBmap.c32
-rw-r--r--generic/tkCanvImg.c30
-rw-r--r--generic/tkCanvLine.c68
-rw-r--r--generic/tkCanvPoly.c44
-rw-r--r--generic/tkCanvPs.c12
-rw-r--r--generic/tkCanvText.c36
-rw-r--r--generic/tkCanvUtil.c210
-rw-r--r--generic/tkCanvWind.c37
-rw-r--r--generic/tkCanvas.c152
-rw-r--r--generic/tkClipboard.c46
-rw-r--r--generic/tkColor.c38
-rw-r--r--generic/tkConfig.c42
-rw-r--r--generic/tkConsole.c164
-rw-r--r--generic/tkCursor.c53
-rw-r--r--generic/tkEntry.c216
-rw-r--r--generic/tkFileFilter.c59
-rw-r--r--generic/tkFocus.c125
-rw-r--r--generic/tkFont.c98
-rw-r--r--generic/tkFrame.c177
-rw-r--r--generic/tkGeometry.c26
-rw-r--r--generic/tkGet.c32
-rw-r--r--generic/tkGrab.c29
-rw-r--r--generic/tkGrid.c122
-rw-r--r--generic/tkImage.c47
-rw-r--r--generic/tkImgBmap.c49
-rw-r--r--generic/tkImgGIF.c325
-rw-r--r--generic/tkImgPPM.c14
-rw-r--r--generic/tkImgPhoto.c102
-rw-r--r--generic/tkMain.c31
-rw-r--r--generic/tkMenu.c131
-rw-r--r--generic/tkMenubutton.c77
-rw-r--r--generic/tkMessage.c66
-rw-r--r--generic/tkObj.c12
-rw-r--r--generic/tkOldConfig.c44
-rw-r--r--generic/tkOldTest.c22
-rw-r--r--generic/tkOption.c77
-rw-r--r--generic/tkPack.c118
-rw-r--r--generic/tkPanedWindow.c124
-rw-r--r--generic/tkPlace.c44
-rw-r--r--generic/tkRectOval.c61
-rw-r--r--generic/tkScale.c62
-rw-r--r--generic/tkScrollbar.c38
-rw-r--r--generic/tkSelect.c52
-rw-r--r--generic/tkSquare.c44
-rw-r--r--generic/tkStubInit.c6
-rw-r--r--generic/tkStubLib.c16
-rw-r--r--generic/tkStyle.c103
-rw-r--r--generic/tkTest.c74
-rw-r--r--generic/tkText.c188
-rw-r--r--generic/tkTextDisp.c64
-rw-r--r--generic/tkTextIndex.c92
-rw-r--r--generic/tkTextTag.c42
-rw-r--r--generic/tkVisual.c8
-rw-r--r--generic/tkWindow.c103
-rw-r--r--generic/ttk/ttkButton.c6
-rw-r--r--generic/ttk/ttkImage.c4
-rw-r--r--generic/ttk/ttkInit.c4
-rw-r--r--generic/ttk/ttkNotebook.c20
-rw-r--r--generic/ttk/ttkPanedwindow.c18
-rw-r--r--generic/ttk/ttkProgress.c10
-rw-r--r--generic/ttk/ttkScale.c8
-rw-r--r--generic/ttk/ttkScrollbar.c10
-rw-r--r--generic/ttk/ttkTheme.c30
-rw-r--r--generic/ttk/ttkTrace.c6
-rw-r--r--generic/ttk/ttkTreeview.c6
-rw-r--r--generic/ttk/ttkWidget.c16
-rw-r--r--macosx/tkMacOSXBitmap.c12
-rw-r--r--macosx/tkMacOSXConfig.c6
-rw-r--r--macosx/tkMacOSXCursor.c162
-rw-r--r--macosx/tkMacOSXDialog.c821
-rw-r--r--macosx/tkMacOSXEmbed.c500
-rw-r--r--macosx/tkMacOSXInit.c129
-rw-r--r--macosx/tkMacOSXSend.c395
-rw-r--r--macosx/tkMacOSXWm.c1638
-rw-r--r--macosx/tkMacOSXXStubs.c277
-rw-r--r--unix/tkAppInit.c8
-rw-r--r--unix/tkUnix.c6
-rw-r--r--unix/tkUnixConfig.c6
-rw-r--r--unix/tkUnixCursor.c34
-rw-r--r--unix/tkUnixDialog.c16
-rw-r--r--unix/tkUnixEmbed.c6
-rw-r--r--unix/tkUnixEvent.c4
-rw-r--r--unix/tkUnixFont.c123
-rw-r--r--unix/tkUnixInit.c9
-rw-r--r--unix/tkUnixMenu.c52
-rw-r--r--unix/tkUnixRFont.c12
-rw-r--r--unix/tkUnixSend.c109
-rw-r--r--unix/tkUnixWm.c197
-rw-r--r--unix/tkUnixXId.c22
-rw-r--r--win/stubs.c2
-rw-r--r--win/tkWinConfig.c6
-rw-r--r--win/tkWinCursor.c8
-rw-r--r--win/tkWinDialog.c38
-rw-r--r--win/tkWinDraw.c4
-rw-r--r--win/tkWinEmbed.c6
-rw-r--r--win/tkWinFont.c100
-rw-r--r--win/tkWinInit.c8
-rw-r--r--win/tkWinTest.c18
-rw-r--r--win/tkWinWindow.c4
-rw-r--r--win/tkWinWm.c172
-rw-r--r--win/tkWinX.c12
-rw-r--r--win/ttkWinXPTheme.c63
-rw-r--r--win/winMain.c6
108 files changed, 4644 insertions, 4653 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a6f4c6..b954a8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-04-27 Donal K. Fellows <dkf@users.sf.net>
+
+ * */*.c: A large tranche of getting rid of pre-C89-isms; if your
+ compiler doesn't support things like proper function declarations,
+ 'void' and 'const', borrow a proper one when building Tcl. (The header
+ files allow building things that link against Tcl with really ancient
+ compilers still; the requirement is just when building Tcl itself.)
+
2008-04-25 Joe English <jenglish@users.sourceforge.net>
* library/ttk/treeview.tcl: BUGFIX: [$tv selection] takes
diff --git a/generic/tk3d.c b/generic/tk3d.c
index 3922fc8..c36631a 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.19 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tk3d.c,v 1.20 2008/04/27 22:38:55 dkf Exp $
*/
#include "tkInt.h"
@@ -21,7 +21,7 @@
* by Tk_GetReliefFromObj.
*/
-static CONST char *reliefStrings[] = {
+static const char *reliefStrings[] = {
"flat", "groove", "raised", "ridge", "solid", "sunken", NULL
};
@@ -320,7 +320,7 @@ Tk_Draw3DRectangle(
*--------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_NameOf3DBorder(
Tk_3DBorder border) /* Token for border. */
{
@@ -645,7 +645,7 @@ Tk_GetReliefFromObj(
int
Tk_GetRelief(
Tcl_Interp *interp, /* For error messages. */
- CONST char *name, /* Name of a relief type. */
+ const char *name, /* Name of a relief type. */
int *reliefPtr) /* Where to store converted relief. */
{
char c;
@@ -694,7 +694,7 @@ Tk_GetRelief(
*--------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_NameOfRelief(
int relief) /* One of TK_RELIEF_FLAT, TK_RELIEF_RAISED, or
* TK_RELIEF_SUNKEN. */
diff --git a/generic/tkArgv.c b/generic/tkArgv.c
index 0e60295..039b4d1 100644
--- a/generic/tkArgv.c
+++ b/generic/tkArgv.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkArgv.c,v 1.13 2008/04/07 22:27:41 hobbs Exp $
+ * RCS: @(#) $Id: tkArgv.c,v 1.14 2008/04/27 22:38:55 dkf Exp $
*/
#include "tkInt.h"
@@ -63,7 +63,7 @@ Tk_ParseArgv(
* means ignore Tk option specs. */
int *argcPtr, /* Number of arguments in argv. Modified to
* hold # args left in argv at end. */
- CONST char **argv, /* Array of arguments. Modified to hold those
+ const char **argv, /* Array of arguments. Modified to hold those
* that couldn't be processed here. */
Tk_ArgvInfo *argTable, /* Array of option descriptions */
int flags) /* Or'ed combination of various flag bits,
@@ -73,7 +73,7 @@ Tk_ParseArgv(
/* Pointer to the current entry in the table
* of argument descriptions. */
Tk_ArgvInfo *matchPtr; /* Descriptor that matches current argument. */
- CONST char *curArg; /* Current argument */
+ const char *curArg; /* Current argument */
register char c; /* Second character of current arg (used for
* quick check for matching; use 2nd char.
* because first char. will almost always be
@@ -195,7 +195,7 @@ Tk_ParseArgv(
if (argc == 0) {
goto missingArg;
}
- *((CONST char **)infoPtr->dst) = argv[srcIndex];
+ *((const char **)infoPtr->dst) = argv[srcIndex];
srcIndex++;
argc--;
break;
@@ -228,7 +228,7 @@ Tk_ParseArgv(
}
break;
case TK_ARGV_FUNC: {
- typedef int (ArgvFunc)(char *, char *, CONST char *);
+ typedef int (ArgvFunc)(char *, char *, const char *);
ArgvFunc *handlerProc = (ArgvFunc *) infoPtr->src;
if ((*handlerProc)(infoPtr->dst, infoPtr->key, argv[srcIndex])) {
@@ -239,7 +239,7 @@ Tk_ParseArgv(
}
case TK_ARGV_GENFUNC: {
typedef int (ArgvGenFunc)(char *, Tcl_Interp *, char *, int,
- CONST char **);
+ const char **);
ArgvGenFunc *handlerProc = (ArgvGenFunc *) infoPtr->src;
argc = (*handlerProc)(infoPtr->dst, interp, infoPtr->key,
diff --git a/generic/tkAtom.c b/generic/tkAtom.c
index ae35527..1028ea0 100644
--- a/generic/tkAtom.c
+++ b/generic/tkAtom.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkAtom.c,v 1.7 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkAtom.c,v 1.8 2008/04/27 22:38:55 dkf Exp $
*/
#include "tkInt.h"
@@ -78,7 +78,7 @@ Atom
Tk_InternAtom(
Tk_Window tkwin, /* Window token; map name to atom for this
* window's display. */
- CONST char *name) /* Name to turn into atom. */
+ const char *name) /* Name to turn into atom. */
{
register TkDisplay *dispPtr;
register Tcl_HashEntry *hPtr;
@@ -123,7 +123,7 @@ Tk_InternAtom(
*--------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_GetAtomName(
Tk_Window tkwin, /* Window token; map atom to name relative to
* this window's display. */
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index db323d1..eb2217f 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.16 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkCanvArc.c,v 1.17 2008/04/27 22:38:55 dkf Exp $
*/
#include <stdio.h>
@@ -81,7 +81,7 @@ typedef struct ArcItem {
*/
static int StyleParseProc(ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *value,
+ Tk_Window tkwin, const char *value,
char *widgRec, int offset);
static char * StylePrintProc(ClientData clientData, Tk_Window tkwin,
char *widgRec, int offset, Tcl_FreeProc **freeProcPtr);
@@ -183,17 +183,17 @@ static Tk_ConfigSpec configSpecs[] = {
static void ComputeArcBbox(Tk_Canvas canvas, ArcItem *arcPtr);
static int ConfigureArc(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags);
+ Tcl_Obj *const objv[], int flags);
static int CreateArc(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void DeleteArc(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display);
static void DisplayArc(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
int x, int y, int width, int height);
static int ArcCoords(Tcl_Interp *interp, Tk_Canvas canvas,
- Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[]);
+ Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]);
static int ArcToArea(Tk_Canvas canvas,
Tk_Item *itemPtr, double *rectPtr);
static double ArcToPoint(Tk_Canvas canvas,
@@ -273,7 +273,7 @@ CreateArc(
Tk_Item *itemPtr, /* Record to hold new item; header has been
* initialized by caller. */
int objc, /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments describing arc. */
+ Tcl_Obj *const objv[]) /* Arguments describing arc. */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
int i;
@@ -351,7 +351,7 @@ ArcCoords(
Tk_Item *itemPtr, /* Item whose coordinates are to be read or
* modified. */
int objc, /* Number of coordinates supplied in objv. */
- Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
+ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
@@ -426,7 +426,7 @@ ConfigureArc(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Arc item to reconfigure. */
int objc, /* Number of elements in objv. */
- Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ Tcl_Obj *const objv[], /* Arguments describing things to configure. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
@@ -442,7 +442,7 @@ ConfigureArc(
tkwin = Tk_CanvasTkwin(canvas);
if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
- (CONST char **) objv, (char *) arcPtr, flags|TK_CONFIG_OBJS)) {
+ (const char **) objv, (char *) arcPtr, flags|TK_CONFIG_OBJS)) {
return TCL_ERROR;
}
@@ -503,7 +503,7 @@ ConfigureArc(
arcPtr->outline.gc = newGC;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
if (state==TK_STATE_HIDDEN) {
ComputeArcBbox(canvas, arcPtr);
@@ -512,7 +512,7 @@ ConfigureArc(
color = arcPtr->fillColor;
stipple = arcPtr->fillStipple;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (arcPtr->activeFillColor!=NULL) {
color = arcPtr->activeFillColor;
}
@@ -653,7 +653,7 @@ ComputeArcBbox(
Tk_State state = arcPtr->header.state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = arcPtr->outline.width;
@@ -664,7 +664,7 @@ ComputeArcBbox(
arcPtr->header.x1 = arcPtr->header.x2 =
arcPtr->header.y1 = arcPtr->header.y2 = -1;
return;
- } else if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *) arcPtr) {
+ } else if (Canvas(canvas)->currentItemPtr == (Tk_Item *) arcPtr) {
if (arcPtr->outline.activeWidth>width) {
width = arcPtr->outline.activeWidth;
}
@@ -796,7 +796,7 @@ DisplayArc(
Pixmap stipple;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
lineWidth = arcPtr->outline.width;
if (lineWidth < 1.0) {
@@ -804,7 +804,7 @@ DisplayArc(
}
dashnumber = arcPtr->outline.dash.number;
stipple = arcPtr->fillStipple;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (arcPtr->outline.activeWidth>lineWidth) {
lineWidth = arcPtr->outline.activeWidth;
}
@@ -972,11 +972,11 @@ ArcToPoint(
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = (double) arcPtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (arcPtr->outline.activeWidth>width) {
width = (double) arcPtr->outline.activeWidth;
}
@@ -1148,10 +1148,10 @@ ArcToArea(
Tk_State state = itemPtr->state;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = (double) arcPtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (arcPtr->outline.activeWidth>width) {
width = (double) arcPtr->outline.activeWidth;
}
@@ -1470,7 +1470,7 @@ ComputeArcOutline(
outlinePtr = arcPtr->outlinePtr;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
/*
@@ -1528,7 +1528,7 @@ ComputeArcOutline(
*/
width = arcPtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *) arcPtr) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *) arcPtr) {
if (arcPtr->outline.activeWidth>arcPtr->outline.width) {
width = arcPtr->outline.activeWidth;
}
@@ -1854,13 +1854,13 @@ ArcToPostscript(
}
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
color = arcPtr->outline.color;
stipple = arcPtr->outline.stipple;
fillColor = arcPtr->fillColor;
fillStipple = arcPtr->fillStipple;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (arcPtr->outline.activeColor!=NULL) {
color = arcPtr->outline.activeColor;
}
@@ -2004,7 +2004,7 @@ StyleParseProc(
ClientData clientData, /* some flags.*/
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_Window tkwin, /* Window containing canvas widget. */
- CONST char *value, /* Value of option. */
+ const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item. */
{
diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c
index da4ba12..72afa99 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.14 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkCanvBmap.c,v 1.15 2008/04/27 22:38:55 dkf Exp $
*/
#include <stdio.h>
@@ -90,7 +90,7 @@ static Tk_ConfigSpec configSpecs[] = {
static int BitmapCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int BitmapToArea(Tk_Canvas canvas,
Tk_Item *itemPtr, double *rectPtr);
static double BitmapToPoint(Tk_Canvas canvas,
@@ -101,10 +101,10 @@ static void ComputeBitmapBbox(Tk_Canvas canvas,
BitmapItem *bmapPtr);
static int ConfigureBitmap(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags);
+ Tcl_Obj *const objv[], int flags);
static int TkcCreateBitmap(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void DeleteBitmap(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display);
static void DisplayBitmap(Tk_Canvas canvas,
@@ -170,7 +170,7 @@ TkcCreateBitmap(
Tk_Item *itemPtr, /* Record to hold new item; header has been
* initialized by caller. */
int objc, /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */
+ Tcl_Obj *const objv[]) /* Arguments describing rectangle. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
int i;
@@ -246,7 +246,7 @@ BitmapCoords(
Tk_Item *itemPtr, /* Item whose coordinates are to be read or
* modified. */
int objc, /* Number of coordinates supplied in objv. */
- Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
+ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
@@ -312,7 +312,7 @@ ConfigureBitmap(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Bitmap item to reconfigure. */
int objc, /* Number of elements in objv. */
- Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ Tcl_Obj *const objv[], /* Arguments describing things to configure. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
@@ -327,7 +327,7 @@ ConfigureBitmap(
tkwin = Tk_CanvasTkwin(canvas);
if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
- (CONST char **) objv, (char *) bmapPtr, flags|TK_CONFIG_OBJS)) {
+ (const char **) objv, (char *) bmapPtr, flags|TK_CONFIG_OBJS)) {
return TCL_ERROR;
}
@@ -347,7 +347,7 @@ ConfigureBitmap(
}
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
if (state == TK_STATE_HIDDEN) {
ComputeBitmapBbox(canvas, bmapPtr);
@@ -356,7 +356,7 @@ ConfigureBitmap(
fgColor = bmapPtr->fgColor;
bgColor = bmapPtr->bgColor;
bitmap = bmapPtr->bitmap;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (bmapPtr->activeFgColor!=NULL) {
fgColor = bmapPtr->activeFgColor;
}
@@ -488,10 +488,10 @@ ComputeBitmapBbox(
Tk_State state = bmapPtr->header.state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
bitmap = bmapPtr->bitmap;
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)bmapPtr) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *)bmapPtr) {
if (bmapPtr->activeBitmap!=None) {
bitmap = bmapPtr->activeBitmap;
}
@@ -598,10 +598,10 @@ DisplayBitmap(
*/
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
bitmap = bmapPtr->bitmap;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (bmapPtr->activeBitmap!=None) {
bitmap = bmapPtr->activeBitmap;
}
@@ -864,12 +864,12 @@ BitmapToPostscript(
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
fgColor = bmapPtr->fgColor;
bgColor = bmapPtr->bgColor;
bitmap = bmapPtr->bitmap;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (bmapPtr->activeFgColor!=NULL) {
fgColor = bmapPtr->activeFgColor;
}
diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c
index 04cbf9e..02cce14 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.11 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkCanvImg.c,v 1.12 2008/04/27 22:38:55 dkf Exp $
*/
#include <stdio.h>
@@ -80,7 +80,7 @@ static void ImageChangedProc(ClientData clientData,
int imgHeight);
static int ImageCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
- Tcl_Obj *CONST argv[]);
+ Tcl_Obj *const argv[]);
static int ImageToArea(Tk_Canvas canvas,
Tk_Item *itemPtr, double *rectPtr);
static double ImageToPoint(Tk_Canvas canvas,
@@ -90,10 +90,10 @@ static int ImageToPostscript(Tcl_Interp *interp,
static void ComputeImageBbox(Tk_Canvas canvas, ImageItem *imgPtr);
static int ConfigureImage(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
- Tcl_Obj *CONST argv[], int flags);
+ Tcl_Obj *const argv[], int flags);
static int CreateImage(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int argc, Tcl_Obj *CONST argv[]);
+ int argc, Tcl_Obj *const argv[]);
static void DeleteImage(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display);
static void DisplayImage(Tk_Canvas canvas,
@@ -159,7 +159,7 @@ CreateImage(
Tk_Item *itemPtr, /* Record to hold new item; header has been
* initialized by caller. */
int objc, /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */
+ Tcl_Obj *const objv[]) /* Arguments describing rectangle. */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
int i;
@@ -231,7 +231,7 @@ ImageCoords(
Tk_Item *itemPtr, /* Item whose coordinates are to be read or
* modified. */
int objc, /* Number of coordinates supplied in objv. */
- Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
+ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
@@ -296,7 +296,7 @@ ConfigureImage(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Image item to reconfigure. */
int objc, /* Number of elements in objv. */
- Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ Tcl_Obj *const objv[], /* Arguments describing things to configure. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
@@ -305,7 +305,7 @@ ConfigureImage(
tkwin = Tk_CanvasTkwin(canvas);
if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
- (CONST char **) objv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) {
+ (const char **) objv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) {
return TCL_ERROR;
}
@@ -439,10 +439,10 @@ ComputeImageBbox(
Tk_State state = imgPtr->header.state;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
image = imgPtr->image;
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)imgPtr) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *)imgPtr) {
if (imgPtr->activeImage != NULL) {
image = imgPtr->activeImage;
}
@@ -542,11 +542,11 @@ DisplayImage(
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
image = imgPtr->image;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (imgPtr->activeImage != NULL) {
image = imgPtr->activeImage;
}
@@ -699,7 +699,7 @@ ImageToPostscript(
* information; 0 means final Postscript is
* being created.*/
{
- ImageItem *imgPtr = (ImageItem *)itemPtr;
+ ImageItem *imgPtr = (ImageItem *) itemPtr;
Tk_Window canvasWin = Tk_CanvasTkwin(canvas);
char buffer[256];
@@ -709,11 +709,11 @@ ImageToPostscript(
Tk_State state = itemPtr->state;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
image = imgPtr->image;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (imgPtr->activeImage != NULL) {
image = imgPtr->activeImage;
}
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index b0e122c..21f7fc5 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.22 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkCanvLine.c,v 1.23 2008/04/27 22:38:55 dkf Exp $
*/
#include <stdio.h>
@@ -82,11 +82,11 @@ static int ArrowheadPostscript(Tcl_Interp *interp,
static void ComputeLineBbox(Tk_Canvas canvas, LineItem *linePtr);
static int ConfigureLine(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags);
+ Tcl_Obj *const objv[], int flags);
static int ConfigureArrows(Tk_Canvas canvas, LineItem *linePtr);
static int CreateLine(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void DeleteLine(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display);
static void DisplayLine(Tk_Canvas canvas,
@@ -97,7 +97,7 @@ static int GetLineIndex(Tcl_Interp *interp,
Tcl_Obj *obj, int *indexPtr);
static int LineCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void LineDeleteCoords(Tk_Canvas canvas,
Tk_Item *itemPtr, int first, int last);
static void LineInsert(Tk_Canvas canvas,
@@ -110,13 +110,13 @@ static int LineToPostscript(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
static int ArrowParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- CONST char *value, char *recordPtr, int offset);
+ const char *value, char *recordPtr, int offset);
static char * ArrowPrintProc(ClientData clientData,
Tk_Window tkwin, char *recordPtr, int offset,
Tcl_FreeProc **freeProcPtr);
static int ParseArrowShape(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- CONST char *value, char *recordPtr, int offset);
+ const char *value, char *recordPtr, int offset);
static char * PrintArrowShape(ClientData clientData,
Tk_Window tkwin, char *recordPtr, int offset,
Tcl_FreeProc **freeProcPtr);
@@ -285,7 +285,7 @@ CreateLine(
Tk_Item *itemPtr, /* Record to hold new item; header has been
* initialized by caller. */
int objc, /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments describing line. */
+ Tcl_Obj *const objv[]) /* Arguments describing line. */
{
LineItem *linePtr = (LineItem *) itemPtr;
int i;
@@ -364,7 +364,7 @@ LineCoords(
Tk_Item *itemPtr, /* Item whose coordinates are to be read or
* modified. */
int objc, /* Number of coordinates supplied in objv. */
- Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
+ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
LineItem *linePtr = (LineItem *) itemPtr;
int i, numPoints;
@@ -477,7 +477,7 @@ ConfigureLine(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Line item to reconfigure. */
int objc, /* Number of elements in objv. */
- Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ Tcl_Obj *const objv[], /* Arguments describing things to configure. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
LineItem *linePtr = (LineItem *) itemPtr;
@@ -489,7 +489,7 @@ ConfigureLine(
tkwin = Tk_CanvasTkwin(canvas);
if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
- (CONST char **) objv, (char *) linePtr, flags|TK_CONFIG_OBJS)) {
+ (const char **) objv, (char *) linePtr, flags|TK_CONFIG_OBJS)) {
return TCL_ERROR;
}
@@ -501,7 +501,7 @@ ConfigureLine(
state = itemPtr->state;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
if (linePtr->outline.activeWidth > linePtr->outline.width ||
@@ -663,7 +663,7 @@ ComputeLineBbox(
Tk_TSOffset *tsoffset;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
if (!(linePtr->numPoints) || (state==TK_STATE_HIDDEN)) {
@@ -675,7 +675,7 @@ ComputeLineBbox(
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *)linePtr) {
if (linePtr->outline.activeWidth>width) {
width = linePtr->outline.activeWidth;
}
@@ -853,10 +853,10 @@ DisplayLine(
}
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
linewidth = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (linePtr->outline.activeWidth != linewidth) {
linewidth = linePtr->outline.activeWidth;
}
@@ -967,7 +967,7 @@ LineInsert(
Tcl_Obj **objv;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
if (!obj || (Tcl_ListObjGetElements(NULL, obj, &objc, &objv) != TCL_OK)
@@ -997,7 +997,7 @@ LineInsert(
for (i=0; i<objc; i++) {
if (Tcl_GetDoubleFromObj(NULL, objv[i],
&newCoordPtr[i + beforeThis]) != TCL_OK) {
- Tcl_ResetResult(((TkCanvas *)canvas)->interp);
+ Tcl_ResetResult(Canvas(canvas)->interp);
ckfree((char *) newCoordPtr);
return;
}
@@ -1099,7 +1099,7 @@ LineInsert(
}
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (linePtr->outline.activeWidth>width) {
width = linePtr->outline.activeWidth;
}
@@ -1152,7 +1152,7 @@ LineDeleteCoords(
Tk_State state = itemPtr->state;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
first &= -2;
@@ -1264,7 +1264,7 @@ LineDeleteCoords(
}
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (linePtr->outline.activeWidth>width) {
width = linePtr->outline.activeWidth;
}
@@ -1331,11 +1331,11 @@ LineToPoint(
*/
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (linePtr->outline.activeWidth>width) {
width = linePtr->outline.activeWidth;
}
@@ -1547,10 +1547,10 @@ LineToArea(
Tk_State state = itemPtr->state;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (linePtr->outline.activeWidth>width) {
width = linePtr->outline.activeWidth;
}
@@ -1863,7 +1863,7 @@ ParseArrowShape(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Used for error reporting. */
Tk_Window tkwin, /* Not used. */
- CONST char *value, /* Textual specification of arrow shape. */
+ const char *value, /* Textual specification of arrow shape. */
char *recordPtr, /* Pointer to item record in which to store
* arrow information. */
int offset) /* Offset of shape information in widget
@@ -1872,7 +1872,7 @@ ParseArrowShape(
LineItem *linePtr = (LineItem *) recordPtr;
double a, b, c;
int argc;
- CONST char **argv = NULL;
+ const char **argv = NULL;
if (offset != Tk_Offset(LineItem, arrowShapeA)) {
Tcl_Panic("ParseArrowShape received bogus offset");
@@ -1967,7 +1967,7 @@ ArrowParseProc(
ClientData clientData, /* some flags.*/
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_Window tkwin, /* Window containing canvas widget. */
- CONST char *value, /* Value of option. */
+ const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item. */
{
@@ -2097,11 +2097,11 @@ ConfigureArrows(
}
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *)linePtr) {
if (linePtr->outline.activeWidth>width) {
width = linePtr->outline.activeWidth;
}
@@ -2250,13 +2250,13 @@ LineToPostscript(
Tk_State state = itemPtr->state;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = linePtr->outline.width;
color = linePtr->outline.color;
stipple = linePtr->outline.stipple;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (linePtr->outline.activeWidth>width) {
width = linePtr->outline.activeWidth;
}
@@ -2422,12 +2422,12 @@ ArrowheadPostscript(
Pixmap stipple;
Tk_State state = linePtr->header.state;
- if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ if (state == TK_STATE_NULL) {
+ state = Canvas(canvas)->canvas_state;
}
stipple = linePtr->outline.stipple;
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *) linePtr) {
if (linePtr->outline.activeStipple!=None) {
stipple = linePtr->outline.activeStipple;
}
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index 1e61367..8050857 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.18 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkCanvPoly.c,v 1.19 2008/04/27 22:38:55 dkf Exp $
*/
#include <stdio.h>
@@ -160,10 +160,10 @@ static void ComputePolygonBbox(Tk_Canvas canvas,
PolygonItem *polyPtr);
static int ConfigurePolygon(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags);
+ Tcl_Obj *const objv[], int flags);
static int CreatePolygon(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void DeletePolygon(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display);
static void DisplayPolygon(Tk_Canvas canvas,
@@ -174,7 +174,7 @@ static int GetPolygonIndex(Tcl_Interp *interp,
Tcl_Obj *obj, int *indexPtr);
static int PolygonCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void PolygonDeleteCoords(Tk_Canvas canvas,
Tk_Item *itemPtr, int first, int last);
static void PolygonInsert(Tk_Canvas canvas,
@@ -253,7 +253,7 @@ CreatePolygon(
Tk_Item *itemPtr, /* Record to hold new item; header has been
* initialized by caller. */
int objc, /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments describing polygon. */
+ Tcl_Obj *const objv[]) /* Arguments describing polygon. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
int i;
@@ -336,7 +336,7 @@ PolygonCoords(
Tk_Item *itemPtr, /* Item whose coordinates are to be read or
* modified. */
int objc, /* Number of coordinates supplied in objv. */
- Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
+ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
int i, numPoints;
@@ -435,7 +435,7 @@ ConfigurePolygon(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Polygon item to reconfigure. */
int objc, /* Number of elements in objv. */
- Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ Tcl_Obj *const objv[], /* Arguments describing things to configure. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
@@ -449,7 +449,7 @@ ConfigurePolygon(
tkwin = Tk_CanvasTkwin(canvas);
if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
- (CONST char **) objv, (char *) polyPtr, flags|TK_CONFIG_OBJS)) {
+ (const char **) objv, (char *) polyPtr, flags|TK_CONFIG_OBJS)) {
return TCL_ERROR;
}
@@ -472,7 +472,7 @@ ConfigurePolygon(
}
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
if (state==TK_STATE_HIDDEN) {
ComputePolygonBbox(canvas, polyPtr);
@@ -495,7 +495,7 @@ ConfigurePolygon(
color = polyPtr->fillColor;
stipple = polyPtr->fillStipple;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (polyPtr->activeFillColor!=NULL) {
color = polyPtr->activeFillColor;
}
@@ -632,7 +632,7 @@ ComputePolygonBbox(
Tk_TSOffset *tsoffset;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = polyPtr->outline.width;
if (polyPtr->coordPtr == NULL || (polyPtr->numPoints < 1) || (state==TK_STATE_HIDDEN)) {
@@ -640,7 +640,7 @@ ComputePolygonBbox(
polyPtr->header.y1 = polyPtr->header.y2 = -1;
return;
}
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)polyPtr) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *)polyPtr) {
if (polyPtr->outline.activeWidth>width) {
width = polyPtr->outline.activeWidth;
}
@@ -894,9 +894,9 @@ DisplayPolygon(
}
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (polyPtr->outline.activeWidth>linewidth) {
linewidth = polyPtr->outline.activeWidth;
}
@@ -1028,7 +1028,7 @@ PolygonInsert(
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
if (!obj || (Tcl_ListObjGetElements(NULL, obj, &objc, &objv) != TCL_OK)
@@ -1129,7 +1129,7 @@ PolygonInsert(
TkIncludePoint(itemPtr, polyPtr->coordPtr+j);
}
width = polyPtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (polyPtr->outline.activeWidth > width) {
width = polyPtr->outline.activeWidth;
}
@@ -1263,10 +1263,10 @@ PolygonToPoint(
bestDist = 1.0e36;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = polyPtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (polyPtr->outline.activeWidth>width) {
width = polyPtr->outline.activeWidth;
}
@@ -1460,11 +1460,11 @@ PolygonToArea(
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = polyPtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (polyPtr->outline.activeWidth>width) {
width = polyPtr->outline.activeWidth;
}
@@ -1820,14 +1820,14 @@ PolygonToPostscript(
}
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = polyPtr->outline.width;
color = polyPtr->outline.color;
stipple = polyPtr->fillStipple;
fillColor = polyPtr->fillColor;
fillStipple = polyPtr->fillStipple;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (polyPtr->outline.activeWidth>width) {
width = polyPtr->outline.activeWidth;
}
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index d8d60a5..a5efd72 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.19 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkCanvPs.c,v 1.20 2008/04/27 22:38:55 dkf Exp $
*/
#include "tkInt.h"
@@ -156,7 +156,7 @@ TkCanvPostscriptCmd(
TkCanvas *canvasPtr, /* Information about canvas widget. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. Caller has already parsed
+ const char **argv) /* Argument strings. Caller has already parsed
* this command enough to know that argv[1] is
* "postscript". */
{
@@ -166,7 +166,7 @@ TkCanvPostscriptCmd(
Tk_Item *itemPtr;
#define STRING_LENGTH 400
char string[STRING_LENGTH+1];
- CONST char *p;
+ const char *p;
time_t now;
size_t length;
Tk_Window tkwin = canvasPtr->tkwin;
@@ -640,7 +640,7 @@ Tk_PostscriptColor(
*/
if (psInfoPtr->colorVar != NULL) {
- CONST char *cmdString;
+ const char *cmdString;
cmdString = Tcl_GetVar2(interp, psInfoPtr->colorVar,
Tk_NameOfColor(colorPtr), 0);
@@ -715,14 +715,14 @@ Tk_PostscriptFont(
*/
if (psInfoPtr->fontVar != NULL) {
- CONST char *name = Tk_NameOfFont(tkfont);
+ const char *name = Tk_NameOfFont(tkfont);
Tcl_Obj **objv;
int objc;
double size;
Tcl_Obj *list = Tcl_GetVar2Ex(interp, psInfoPtr->fontVar, name, 0);
if (list != NULL) {
- CONST char *fontname;
+ const char *fontname;
if (Tcl_ListObjGetElements(interp, list, &objc, &objv) != TCL_OK
|| objc != 2
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index 1dfdc7f..34206ea 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.26 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkCanvText.c,v 1.27 2008/04/27 22:38:55 dkf Exp $
*/
#include <stdio.h>
@@ -139,10 +139,10 @@ static Tk_ConfigSpec configSpecs[] = {
static void ComputeTextBbox(Tk_Canvas canvas, TextItem *textPtr);
static int ConfigureText(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
- Tcl_Obj *CONST objv[], int flags);
+ Tcl_Obj *const objv[], int flags);
static int CreateText(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int argc, Tcl_Obj *CONST objv[]);
+ int argc, Tcl_Obj *const objv[]);
static void DeleteText(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display);
static void DisplayCanvText(Tk_Canvas canvas,
@@ -161,7 +161,7 @@ static void SetTextCursor(Tk_Canvas canvas,
Tk_Item *itemPtr, int index);
static int TextCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- int argc, Tcl_Obj *CONST objv[]);
+ int argc, Tcl_Obj *const objv[]);
static void TextDeleteChars(Tk_Canvas canvas,
Tk_Item *itemPtr, int first, int last);
static void TextInsert(Tk_Canvas canvas,
@@ -228,7 +228,7 @@ CreateText(
Tk_Item *itemPtr, /* Record to hold new item; header has been
* initialized by caller. */
int objc, /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */
+ Tcl_Obj *const objv[]) /* Arguments describing rectangle. */
{
TextItem *textPtr = (TextItem *) itemPtr;
int i;
@@ -322,7 +322,7 @@ TextCoords(
Tk_Item *itemPtr, /* Item whose coordinates are to be read or
* modified. */
int objc, /* Number of coordinates supplied in objv. */
- Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
+ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
TextItem *textPtr = (TextItem *) itemPtr;
@@ -389,7 +389,7 @@ ConfigureText(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Rectangle item to reconfigure. */
int objc, /* Number of elements in objv. */
- Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ Tcl_Obj *const objv[], /* Arguments describing things to configure. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
TextItem *textPtr = (TextItem *) itemPtr;
@@ -405,7 +405,7 @@ ConfigureText(
tkwin = Tk_CanvasTkwin(canvas);
if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
- (CONST char **) objv, (char *) textPtr, flags|TK_CONFIG_OBJS)) {
+ (const char **) objv, (char *) textPtr, flags|TK_CONFIG_OBJS)) {
return TCL_ERROR;
}
@@ -423,12 +423,12 @@ ConfigureText(
}
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
color = textPtr->color;
stipple = textPtr->stipple;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (textPtr->activeColor!=NULL) {
color = textPtr->activeColor;
}
@@ -615,7 +615,7 @@ ComputeTextBbox(
Tk_State state = textPtr->header.state;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
Tk_FreeTextLayout(textPtr->textLayout);
@@ -729,10 +729,10 @@ DisplayCanvText(
textInfoPtr = textPtr->textInfoPtr;
if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
stipple = textPtr->stipple;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (textPtr->activeStipple!=None) {
stipple = textPtr->activeStipple;
}
@@ -1087,7 +1087,7 @@ TextToPoint(
double value;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
textPtr = (TextItem *) itemPtr;
value = (double) Tk_DistanceToTextLayout(textPtr->textLayout,
@@ -1132,7 +1132,7 @@ TextToArea(
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
textPtr = (TextItem *) itemPtr;
@@ -1377,7 +1377,7 @@ GetSelText(
TextItem *textPtr = (TextItem *) itemPtr;
int byteCount;
char *text;
- CONST char *selStart, *selEnd;
+ const char *selStart, *selEnd;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
if ((textInfoPtr->selectFirst < 0) ||
@@ -1438,14 +1438,14 @@ TextToPostscript(
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
color = textPtr->color;
stipple = textPtr->stipple;
if (state == TK_STATE_HIDDEN || textPtr->color == NULL ||
textPtr->text == NULL || *textPtr->text == 0) {
return TCL_OK;
- } else if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ } else if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (textPtr->activeColor!=NULL) {
color = textPtr->activeColor;
}
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index e0c9a3a..5c14d48 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.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: tkCanvUtil.c,v 1.19 2008/03/11 22:31:19 das Exp $
+ * RCS: @(#) $Id: tkCanvUtil.c,v 1.20 2008/04/27 22:38:55 dkf Exp $
*/
#include "tkInt.h"
@@ -47,7 +47,7 @@ static Tk_SmoothMethod tkRawSmoothMethod = {
static void SmoothMethodCleanupProc(ClientData clientData,
Tcl_Interp *interp);
static SmoothAssocData *InitSmoothMethods(Tcl_Interp *interp);
-static int DashConvert(char *l, CONST char *p, int n,
+static int DashConvert(char *l, const char *p, int n,
double width);
static void TranslateAndAppendCoords(TkCanvas *canvPtr,
double x, double y, XPoint *outArr, int numOut);
@@ -75,8 +75,7 @@ Tk_Window
Tk_CanvasTkwin(
Tk_Canvas canvas) /* Token for the canvas. */
{
- TkCanvas *canvasPtr = (TkCanvas *) canvas;
- return canvasPtr->tkwin;
+ return Canvas(canvas)->tkwin;
}
/*
@@ -108,10 +107,9 @@ Tk_CanvasDrawableCoords(
short *drawableXPtr, /* Screen coordinates are stored here. */
short *drawableYPtr)
{
- TkCanvas *canvasPtr = (TkCanvas *) canvas;
double tmp;
- tmp = x - canvasPtr->drawableXOrigin;
+ tmp = x - Canvas(canvas)->drawableXOrigin;
if (tmp > 0) {
tmp += 0.5;
} else {
@@ -125,7 +123,7 @@ Tk_CanvasDrawableCoords(
*drawableXPtr = (short) tmp;
}
- tmp = y - canvasPtr->drawableYOrigin;
+ tmp = y - Canvas(canvas)->drawableYOrigin;
if (tmp > 0) {
tmp += 0.5;
} else {
@@ -168,10 +166,9 @@ Tk_CanvasWindowCoords(
short *screenXPtr, /* Screen coordinates are stored here. */
short *screenYPtr)
{
- TkCanvas *canvasPtr = (TkCanvas *) canvas;
double tmp;
- tmp = x - canvasPtr->xOrigin;
+ tmp = x - Canvas(canvas)->xOrigin;
if (tmp > 0) {
tmp += 0.5;
} else {
@@ -185,7 +182,7 @@ Tk_CanvasWindowCoords(
*screenXPtr = (short) tmp;
}
- tmp = y - canvasPtr->yOrigin;
+ tmp = y - Canvas(canvas)->yOrigin;
if (tmp > 0) {
tmp += 0.5;
} else {
@@ -224,17 +221,15 @@ int
Tk_CanvasGetCoord(
Tcl_Interp *interp, /* Interpreter for error reporting. */
Tk_Canvas canvas, /* Canvas to which coordinate applies. */
- CONST char *string, /* Describes coordinate (any screen coordinate
+ const char *string, /* Describes coordinate (any screen coordinate
* form may be used here). */
double *doublePtr) /* Place to store converted coordinate. */
{
- TkCanvas *canvasPtr = (TkCanvas *) canvas;
-
- if (Tk_GetScreenMM(canvasPtr->interp, canvasPtr->tkwin, string,
+ if (Tk_GetScreenMM(Canvas(canvas)->interp, Canvas(canvas)->tkwin, string,
doublePtr) != TCL_OK) {
return TCL_ERROR;
}
- *doublePtr *= canvasPtr->pixelsPerMM;
+ *doublePtr *= Canvas(canvas)->pixelsPerMM;
return TCL_OK;
}
@@ -266,13 +261,11 @@ Tk_CanvasGetCoordFromObj(
* form may be used here). */
double *doublePtr) /* Place to store converted coordinate. */
{
- TkCanvas *canvasPtr = (TkCanvas *) canvas;
-
- if (Tk_GetMMFromObj(canvasPtr->interp, canvasPtr->tkwin, obj,
+ if (Tk_GetMMFromObj(Canvas(canvas)->interp, Canvas(canvas)->tkwin, obj,
doublePtr) != TCL_OK) {
return TCL_ERROR;
}
- *doublePtr *= canvasPtr->pixelsPerMM;
+ *doublePtr *= Canvas(canvas)->pixelsPerMM;
return TCL_OK;
}
@@ -301,10 +294,9 @@ Tk_CanvasSetStippleOrigin(
* to draw a stippled pattern as part of
* redisplaying the canvas. */
{
- TkCanvas *canvasPtr = (TkCanvas *) canvas;
-
- XSetTSOrigin(canvasPtr->display, gc, -canvasPtr->drawableXOrigin,
- -canvasPtr->drawableYOrigin);
+ XSetTSOrigin(Canvas(canvas)->display, gc,
+ -Canvas(canvas)->drawableXOrigin,
+ -Canvas(canvas)->drawableYOrigin);
}
/*
@@ -333,7 +325,7 @@ Tk_CanvasSetOffset(
* redisplaying the canvas. */
Tk_TSOffset *offset) /* Offset (may be NULL pointer)*/
{
- TkCanvas *canvasPtr = (TkCanvas *) canvas;
+ register TkCanvas *canvasPtr = Canvas(canvas);
int flags = 0;
int x = - canvasPtr->drawableXOrigin;
int y = - canvasPtr->drawableYOrigin;
@@ -377,7 +369,7 @@ Tk_CanvasTextInfo *
Tk_CanvasGetTextInfo(
Tk_Canvas canvas) /* Token for the canvas widget. */
{
- return &((TkCanvas *) canvas)->textInfo;
+ return &Canvas(canvas)->textInfo;
}
/*
@@ -403,13 +395,13 @@ Tk_CanvasTagsParseProc(
ClientData clientData, /* Not used.*/
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_Window tkwin, /* Window containing canvas widget. */
- CONST char *value, /* Value of option (list of tag names). */
+ const char *value, /* Value of option (list of tag names). */
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item (ignored). */
{
register Tk_Item *itemPtr = (Tk_Item *) widgRec;
int argc, i;
- CONST char **argv;
+ const char **argv;
Tk_Uid *newPtr;
/*
@@ -486,7 +478,7 @@ Tk_CanvasTagsPrintProc(
return (char *) itemPtr->tagPtr[0];
}
*freeProcPtr = TCL_DYNAMIC;
- return Tcl_Merge(itemPtr->numTags, (CONST char **) itemPtr->tagPtr);
+ return Tcl_Merge(itemPtr->numTags, (const char **) itemPtr->tagPtr);
}
/*
@@ -512,11 +504,11 @@ TkCanvasDashParseProc(
ClientData clientData, /* Not used.*/
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_Window tkwin, /* Window containing canvas widget. */
- CONST char *value, /* Value of option. */
+ const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item. */
{
- return Tk_GetDash(interp, value, (Tk_Dash *)(widgRec+offset));
+ return Tk_GetDash(interp, value, (Tk_Dash *) (widgRec+offset));
}
/*
@@ -552,8 +544,7 @@ TkCanvasDashPrintProc(
* for return string. */
{
Tk_Dash *dash = (Tk_Dash *) (widgRec+offset);
- char *buffer;
- char *p;
+ char *buffer, *p;
int i = dash->number;
if (i < 0) {
@@ -568,12 +559,12 @@ TkCanvasDashPrintProc(
*freeProcPtr = NULL;
return "";
}
- buffer = (char *)ckalloc((unsigned int) (4*i));
+ buffer = (char *) ckalloc((unsigned int) (4*i));
*freeProcPtr = TCL_DYNAMIC;
p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
sprintf(buffer, "%d", *p++ & 0xff);
- while(--i) {
+ while (--i) {
sprintf(buffer+strlen(buffer), " %d", *p++ & 0xff);
}
return buffer;
@@ -617,8 +608,7 @@ InitSmoothMethods(
ptr->smooth.postscriptProc = tkBezierSmoothMethod.postscriptProc;
ptr->nextPtr = NULL;
- Tcl_SetAssocData(interp, "smoothMethod", SmoothMethodCleanupProc,
- (ClientData) methods);
+ Tcl_SetAssocData(interp, "smoothMethod", SmoothMethodCleanupProc,methods);
return methods;
}
@@ -646,8 +636,7 @@ Tk_CreateSmoothMethod(
Tk_SmoothMethod *smooth)
{
SmoothAssocData *methods, *typePtr2, *prevPtr, *ptr;
- methods = (SmoothAssocData *) Tcl_GetAssocData(interp, "smoothMethod",
- NULL);
+ methods = Tcl_GetAssocData(interp, "smoothMethod", NULL);
/*
* Initialize if we were not previously initialized.
@@ -678,8 +667,7 @@ Tk_CreateSmoothMethod(
ptr->smooth.coordProc = smooth->coordProc;
ptr->smooth.postscriptProc = smooth->postscriptProc;
ptr->nextPtr = methods;
- Tcl_SetAssocData(interp, "smoothMethod", SmoothMethodCleanupProc,
- (ClientData) ptr);
+ Tcl_SetAssocData(interp, "smoothMethod", SmoothMethodCleanupProc, ptr);
}
/*
@@ -705,10 +693,11 @@ SmoothMethodCleanupProc(
* interpreter. */
Tcl_Interp *interp) /* Interpreter that is being deleted. */
{
- SmoothAssocData *ptr, *methods = (SmoothAssocData *) clientData;
+ SmoothAssocData *ptr, *methods = clientData;
while (methods != NULL) {
- methods = (ptr = methods)->nextPtr;
+ ptr = methods;
+ methods = methods->nextPtr;
ckfree((char *) ptr);
}
}
@@ -735,7 +724,7 @@ TkSmoothParseProc(
ClientData clientData, /* some flags.*/
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_Window tkwin, /* Window containing canvas widget. */
- CONST char *value, /* Value of option. */
+ const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item. */
{
@@ -751,8 +740,7 @@ TkSmoothParseProc(
return TCL_OK;
}
length = strlen(value);
- methods = (SmoothAssocData *) Tcl_GetAssocData(interp, "smoothMethod",
- NULL);
+ methods = Tcl_GetAssocData(interp, "smoothMethod", NULL);
/*
* Not initialized yet; fix that now.
@@ -857,15 +845,15 @@ TkSmoothPrintProc(
int
Tk_GetDash(
Tcl_Interp *interp, /* Used for error reporting. */
- CONST char *value, /* Textual specification of dash list. */
+ const char *value, /* Textual specification of dash list. */
Tk_Dash *dash) /* Pointer to record in which to store dash
* information. */
{
int argc, i;
- CONST char **largv, **argv = NULL;
+ const char **largv, **argv = NULL;
char *pt;
- if ((value==NULL) || (*value==0) ) {
+ if ((value == NULL) || (*value == '\0')) {
dash->number = 0;
return TCL_OK;
}
@@ -877,17 +865,16 @@ Tk_GetDash(
switch (*value) {
case '.': case ',': case '-': case '_':
i = DashConvert(NULL, value, -1, 0.0);
- if (i>0) {
- i = strlen(value);
- } else {
+ if (i <= 0) {
goto badDashList;
}
- if (i > (int)sizeof(char *)) {
- dash->pattern.pt = pt = (char *) ckalloc(strlen(value));
+ i = strlen(value);
+ if (i > (int) sizeof(char *)) {
+ dash->pattern.pt = pt = ckalloc(strlen(value));
} else {
pt = dash->pattern.array;
}
- memcpy(pt,value, (unsigned int) i);
+ memcpy(pt, value, (unsigned) i);
dash->number = -i;
return TCL_OK;
}
@@ -897,11 +884,11 @@ Tk_GetDash(
goto badDashList;
}
- if ((unsigned int)ABS(dash->number) > sizeof(char *)) {
+ if ((unsigned) ABS(dash->number) > sizeof(char *)) {
ckfree((char *) dash->pattern.pt);
}
if (argc > (int)sizeof(char *)) {
- dash->pattern.pt = pt = (char *) ckalloc((unsigned int) argc);
+ dash->pattern.pt = pt = ckalloc((unsigned) argc);
} else {
pt = dash->pattern.array;
}
@@ -932,13 +919,12 @@ Tk_GetDash(
badDashList:
Tcl_AppendResult(interp, "bad dash list \"", value,
- "\": must be a list of integers or a format like \"-..\"",
- NULL);
+ "\": must be a list of integers or a format like \"-..\"", NULL);
syntaxError:
if (argv != NULL) {
ckfree((char *) argv);
}
- if ((unsigned int)ABS(dash->number) > sizeof(char *)) {
+ if ((unsigned) ABS(dash->number) > sizeof(char *)) {
ckfree((char *) dash->pattern.pt);
}
dash->number = 0;
@@ -1010,13 +996,13 @@ Tk_DeleteOutline(
if (outline->gc != None) {
Tk_FreeGC(display, outline->gc);
}
- if ((unsigned int)ABS(outline->dash.number) > sizeof(char *)) {
+ if ((unsigned) ABS(outline->dash.number) > sizeof(char *)) {
ckfree((char *) outline->dash.pattern.pt);
}
- if ((unsigned int)ABS(outline->activeDash.number) > sizeof(char *)) {
+ if ((unsigned) ABS(outline->activeDash.number) > sizeof(char *)) {
ckfree((char *) outline->activeDash.pattern.pt);
}
- if ((unsigned int)ABS(outline->disabledDash.number) > sizeof(char *)) {
+ if ((unsigned) ABS(outline->disabledDash.number) > sizeof(char *)) {
ckfree((char *) outline->disabledDash.pattern.pt);
}
if (outline->color != NULL) {
@@ -1094,9 +1080,9 @@ Tk_ConfigOutlineGC(
color = outline->color;
stipple = outline->stipple;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
- if (((TkCanvas *)canvas)->currentItemPtr == item) {
+ if (Canvas(canvas)->currentItemPtr == item) {
if (outline->activeWidth>width) {
width = outline->activeWidth;
}
@@ -1177,7 +1163,7 @@ Tk_ChangeOutlineGC(
Tk_Item *item,
Tk_Outline *outline)
{
- CONST char *p;
+ const char *p;
double width;
Tk_Dash *dash;
XColor *color;
@@ -1192,9 +1178,9 @@ Tk_ChangeOutlineGC(
color = outline->color;
stipple = outline->stipple;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
- if (((TkCanvas *)canvas)->currentItemPtr == item) {
+ if (Canvas(canvas)->currentItemPtr == item) {
if (outline->activeWidth > width) {
width = outline->activeWidth;
}
@@ -1231,25 +1217,25 @@ Tk_ChangeOutlineGC(
int i = -dash->number;
p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
- q = (char *) ckalloc(2*(unsigned int)i);
+ q = (char *) ckalloc(2 * (unsigned) i);
i = DashConvert(q, p, i, width);
- XSetDashes(((TkCanvas *)canvas)->display, outline->gc,
- outline->offset, q, i);
+ XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset, q,i);
ckfree(q);
} else if (dash->number>2 || (dash->number==2 &&
(dash->pattern.array[0]!=dash->pattern.array[1]))) {
- p = (dash->number > (int)sizeof(char *))
+ p = (dash->number > (int) sizeof(char *))
? dash->pattern.pt : dash->pattern.array;
- XSetDashes(((TkCanvas *)canvas)->display, outline->gc,
- outline->offset, p, dash->number);
+ XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset, p,
+ dash->number);
}
if (stipple!=None) {
- int w=0; int h=0;
+ int w = 0; int h = 0;
Tk_TSOffset *tsoffset = &outline->tsoffset;
int flags = tsoffset->flags;
+
if (!(flags & TK_OFFSET_INDEX) &&
(flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE))) {
- Tk_SizeOfBitmap(((TkCanvas *)canvas)->display, stipple, &w, &h);
+ Tk_SizeOfBitmap(Canvas(canvas)->display, stipple, &w, &h);
if (flags & TK_OFFSET_CENTER) {
w /= 2;
} else {
@@ -1311,9 +1297,9 @@ Tk_ResetOutlineGC(
color = outline->color;
stipple = outline->stipple;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
- if (((TkCanvas *)canvas)->currentItemPtr == item) {
+ if (Canvas(canvas)->currentItemPtr == item) {
if (outline->activeWidth>width) {
width = outline->activeWidth;
}
@@ -1354,11 +1340,11 @@ Tk_ResetOutlineGC(
} else {
dashList = 4;
}
- XSetDashes(((TkCanvas *)canvas)->display, outline->gc,
- outline->offset, &dashList , 1);
+ XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset,
+ &dashList , 1);
}
if (stipple != None) {
- XSetTSOrigin(((TkCanvas *)canvas)->display, outline->gc, 0, 0);
+ XSetTSOrigin(Canvas(canvas)->display, outline->gc, 0, 0);
return 1;
}
return 0;
@@ -1388,28 +1374,21 @@ Tk_CanvasPsOutline(
Tk_Item *item,
Tk_Outline *outline)
{
- char string[41];
- char pattern[11];
+ char string[41], pattern[11];
int i;
- char *ptr;
- char *str = string;
- char *lptr = pattern;
- Tcl_Interp *interp = ((TkCanvas *)canvas)->interp;
- double width;
- Tk_Dash *dash;
- XColor *color;
- Pixmap stipple;
+ char *ptr, *str = string, *lptr = pattern;
+ Tcl_Interp *interp = Canvas(canvas)->interp;
+ double width = outline->width;
+ Tk_Dash *dash = &outline->dash;
+ XColor *color = outline->color;
+ Pixmap stipple = outline->stipple;
Tk_State state = item->state;
- width = outline->width;
- dash = &(outline->dash);
- color = outline->color;
- stipple = outline->stipple;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
- if (((TkCanvas *)canvas)->currentItemPtr == item) {
+ if (Canvas(canvas)->currentItemPtr == item) {
if (outline->activeWidth > width) {
width = outline->activeWidth;
}
@@ -1440,12 +1419,12 @@ Tk_CanvasPsOutline(
Tcl_AppendResult(interp, string, NULL);
if (dash->number > 10) {
- str = (char *)ckalloc((unsigned int) (1 + 4*dash->number));
+ str = (char *) ckalloc((unsigned) (1 + 4*dash->number));
} else if (dash->number < -5) {
- str = (char *)ckalloc((unsigned int) (1 - 8*dash->number));
- lptr = (char *)ckalloc((unsigned int) (1 - 2*dash->number));
+ str = (char *) ckalloc((unsigned) (1 - 8*dash->number));
+ lptr = (char *) ckalloc((unsigned) (1 - 2*dash->number));
}
- ptr = ((unsigned int)ABS(dash->number) > sizeof(char *)) ?
+ ptr = ((unsigned) ABS(dash->number) > sizeof(char *)) ?
dash->pattern.pt : dash->pattern.array;
if (dash->number > 0) {
char *ptr0 = ptr;
@@ -1523,7 +1502,7 @@ static int
DashConvert(
char *l, /* Must be at least 2*n chars long, or NULL to
* indicate "just check syntax". */
- CONST char *p, /* String to parse. */
+ const char *p, /* String to parse. */
int n, /* Length of string to parse, or -1 to
* indicate that strlen() should be used. */
double width) /* Width of line. */
@@ -1531,7 +1510,7 @@ DashConvert(
int result = 0;
int size, intWidth;
- if (n<0) {
+ if (n < 0) {
n = strlen(p);
}
intWidth = (int) (width + 0.5);
@@ -1713,7 +1692,7 @@ TkCanvTranslatePath(
double x, y;
x = coordArr[i*2];
- y = coordArr[i*2+1];
+ y = coordArr[i*2 + 1];
if (x<lft || x>rgh || y<top || y>btm) {
break;
}
@@ -1731,10 +1710,10 @@ TkCanvTranslatePath(
* b[]. Initialize a[] to be equal to coordArr[].
*/
- if (numVertex*12 <= (int)(sizeof(staticSpace)/sizeof(staticSpace[0]))) {
+ if (numVertex*12 <= (int) (sizeof(staticSpace) / sizeof(double))) {
tempArr = staticSpace;
} else {
- tempArr = (double *)ckalloc(numVertex*12*sizeof(tempArr[0]));
+ tempArr = (double *) ckalloc(numVertex * 12 * sizeof(double));
}
for (i=0; i<numVertex*2; i++){
tempArr[i] = coordArr[i];
@@ -1770,7 +1749,7 @@ TkCanvTranslatePath(
maxOutput = numVertex*3;
for (j=0; j<4; j++){
double xClip = limit[j];
- int inside = a[0]<xClip;
+ int inside = a[0] < xClip;
double priorY = a[1];
numOutput = 0;
@@ -1781,7 +1760,7 @@ TkCanvTranslatePath(
for (i=0; i<numVertex; i++){
double x = a[i*2];
- double y = a[i*2+1];
+ double y = a[i*2 + 1];
if (x >= xClip) {
/*
@@ -1799,11 +1778,11 @@ TkCanvTranslatePath(
double x0, y0, yN;
assert(i > 0);
- x0 = a[i*2-2];
- y0 = a[i*2-1];
+ x0 = a[i*2 - 2];
+ y0 = a[i*2 - 1];
yN = y0 + (y - y0)*(xClip-x0)/(x-x0);
b[numOutput*2] = -yN;
- b[numOutput*2+1] = xClip;
+ b[numOutput*2 + 1] = xClip;
numOutput++;
assert(numOutput <= maxOutput);
priorY = yN;
@@ -1825,7 +1804,8 @@ TkCanvTranslatePath(
* The current vertex is to the left of xClip
*/
if (!inside) {
- /* If the current vertex is on the left of xClip and one
+ /*
+ * If the current vertex is on the left of xClip and one
* or more prior vertices where to the right, then we have
* to draw a line segment along xClip that extends from
* the spot where we first crossed from left to right to
@@ -1835,19 +1815,19 @@ TkCanvTranslatePath(
double x0, y0, yN;
assert(i > 0);
- x0 = a[i*2-2];
- y0 = a[i*2-1];
+ x0 = a[i*2 - 2];
+ y0 = a[i*2 - 1];
yN = y0 + (y - y0)*(xClip-x0)/(x-x0);
if (yN != priorY) {
b[numOutput*2] = -yN;
- b[numOutput*2+1] = xClip;
+ b[numOutput*2 + 1] = xClip;
numOutput++;
assert(numOutput <= maxOutput);
}
inside = 1;
}
b[numOutput*2] = -y;
- b[numOutput*2+1] = x;
+ b[numOutput*2 + 1] = x;
numOutput++;
assert(numOutput <= maxOutput);
}
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c
index 550a7d3..405c81e 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.16 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkCanvWind.c,v 1.17 2008/04/27 22:38:55 dkf Exp $
*/
#include <stdio.h>
@@ -73,10 +73,10 @@ static void ComputeWindowBbox(Tk_Canvas canvas,
WindowItem *winItemPtr);
static int ConfigureWinItem(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags);
+ Tcl_Obj *const objv[], int flags);
static int CreateWinItem(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void DeleteWinItem(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display);
static void DisplayWinItem(Tk_Canvas canvas,
@@ -89,7 +89,7 @@ static void TranslateWinItem(Tk_Canvas canvas,
Tk_Item *itemPtr, double deltaX, double deltaY);
static int WinItemCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static void WinItemLostSlaveProc(ClientData clientData,
Tk_Window tkwin);
static void WinItemRequestProc(ClientData clientData,
@@ -174,7 +174,7 @@ CreateWinItem(
Tk_Item *itemPtr, /* Record to hold new item; header has been
* initialized by caller. */
int objc, /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments describing window. */
+ Tcl_Obj *const objv[]) /* Arguments describing window. */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
int i;
@@ -202,6 +202,7 @@ CreateWinItem(
i = 1;
} else {
char *arg = Tcl_GetString(objv[1]);
+
i = 2;
if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
i = 1;
@@ -244,7 +245,7 @@ WinItemCoords(
Tk_Item *itemPtr, /* Item whose coordinates are to be read or
* modified. */
int objc, /* Number of coordinates supplied in objv. */
- Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
+ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
@@ -308,7 +309,7 @@ ConfigureWinItem(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Window item to reconfigure. */
int objc, /* Number of elements in objv. */
- Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ Tcl_Obj *const objv[], /* Arguments describing things to configure. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
@@ -318,7 +319,7 @@ ConfigureWinItem(
oldWindow = winItemPtr->tkwin;
canvasTkwin = Tk_CanvasTkwin(canvas);
if (TCL_OK != Tk_ConfigureWidget(interp, canvasTkwin, configSpecs, objc,
- (CONST char **) objv, (char *) winItemPtr, flags|TK_CONFIG_OBJS)) {
+ (const char **) objv, (char *) winItemPtr, flags|TK_CONFIG_OBJS)) {
return TCL_ERROR;
}
@@ -453,7 +454,7 @@ ComputeWindowBbox(
y = (int) (winItemPtr->y + ((winItemPtr->y >= 0) ? 0.5 : - 0.5));
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
if ((winItemPtr->tkwin == NULL) || (state == TK_STATE_HIDDEN)) {
/*
@@ -578,7 +579,7 @@ DisplayWinItem(
return;
}
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
/*
@@ -759,8 +760,7 @@ xerrorhandler(
{
return 0;
}
-#endif
-
+#endif /* X_GetImage */
/*
*--------------------------------------------------------------
@@ -790,8 +790,7 @@ WinItemToPostscript(
* information; 0 means final Postscript is
* being created. */
{
- WindowItem *winItemPtr = (WindowItem *)itemPtr;
-
+ WindowItem *winItemPtr = (WindowItem *) itemPtr;
double x, y;
int width, height;
Tk_Window tkwin = winItemPtr->tkwin;
@@ -890,7 +889,7 @@ CanvasPsWindow(
*/
ximage = XGetImage(Tk_Display(tkwin), Tk_WindowId(tkwin), 0, 0,
- (unsigned int)width, (unsigned int)height, AllPlanes, ZPixmap);
+ (unsigned) width, (unsigned) height, AllPlanes, ZPixmap);
#ifdef X_GetImage
Tk_DeleteErrorHandler(handle);
@@ -900,8 +899,8 @@ CanvasPsWindow(
return TCL_OK;
}
- result = TkPostscriptImage(interp, tkwin,
- ((TkCanvas *)canvas)->psInfo, ximage, 0, 0, width, height);
+ result = TkPostscriptImage(interp, tkwin, Canvas(canvas)->psInfo, ximage,
+ 0, 0, width, height);
XDestroyImage(ximage);
return result;
@@ -1069,11 +1068,11 @@ WinItemLostSlaveProc(
* was stolen away. */
Tk_Window tkwin) /* Tk's handle for the slave window. */
{
- WindowItem *winItemPtr = (WindowItem *) clientData;
+ WindowItem *winItemPtr = clientData;
Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas);
Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask,
- WinItemStructureProc, (ClientData) winItemPtr);
+ WinItemStructureProc, winItemPtr);
if (canvasTkwin != Tk_Parent(winItemPtr->tkwin)) {
Tk_UnmaintainGeometry(winItemPtr->tkwin, canvasTkwin);
}
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index e6cc864..3d5240e 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.47 2008/04/17 14:53:44 dgp Exp $
+ * RCS: @(#) $Id: tkCanvas.c,v 1.48 2008/04/27 22:38:55 dkf Exp $
*/
/* #define USE_OLD_TAG_SEARCH 1 */
@@ -266,12 +266,12 @@ static void CanvasSetOrigin(TkCanvas *canvasPtr,
static void CanvasUpdateScrollbars(TkCanvas *canvasPtr);
static int CanvasWidgetCmd(ClientData clientData,
Tcl_Interp *interp, int argc,
- Tcl_Obj *CONST *argv);
+ Tcl_Obj *const *argv);
static void CanvasWorldChanged(
ClientData instanceData);
static int ConfigureCanvas(Tcl_Interp *interp,
TkCanvas *canvasPtr, int argc,
- Tcl_Obj *CONST *argv, int flags);
+ Tcl_Obj *const *argv, int flags);
static void DestroyCanvas(char *memPtr);
static void DisplayCanvas(ClientData clientData);
static void DoItem(Tcl_Interp *interp,
@@ -280,18 +280,18 @@ static void EventuallyRedrawItem(Tk_Canvas canvas,
Tk_Item *itemPtr);
#ifdef USE_OLD_TAG_SEARCH
static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr,
- int argc, Tcl_Obj *CONST *argv,
+ int argc, Tcl_Obj *const *argv,
Tcl_Obj *newTagObj, int first);
#else /* USE_OLD_TAG_SEARCH */
static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr,
- int argc, Tcl_Obj *CONST *argv,
+ int argc, Tcl_Obj *const *argv,
Tcl_Obj *newTagObj, int first,
TagSearch **searchPtrPtr);
#endif /* USE_OLD_TAG_SEARCH */
static int FindArea(Tcl_Interp *interp, TkCanvas *canvasPtr,
- Tcl_Obj *CONST *argv, Tk_Uid uid, int enclosed);
+ Tcl_Obj *const *argv, Tk_Uid uid, int enclosed);
static double GridAlign(double coord, double spacing);
-static CONST char** TkGetStringsFromObjs(int argc, Tcl_Obj *CONST *objv);
+static const char** TkGetStringsFromObjs(int argc, Tcl_Obj *const *objv);
static void InitCanvas(void);
#ifdef USE_OLD_TAG_SEARCH
static Tk_Item * NextItem(TagSearch *searchPtr);
@@ -377,7 +377,7 @@ Tk_CanvasObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- Tcl_Obj *CONST argv[]) /* Argument objects. */
+ Tcl_Obj *const argv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
TkCanvas *canvasPtr;
@@ -527,9 +527,9 @@ CanvasWidgetCmd(
ClientData clientData, /* Information about canvas widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- TkCanvas *canvasPtr = (TkCanvas *) clientData;
+ TkCanvas *canvasPtr = clientData;
int c, result;
Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent
* compiler warning. */
@@ -541,7 +541,7 @@ CanvasWidgetCmd(
#endif /* USE_OLD_TAG_SEARCH */
int index;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"addtag", "bbox", "bind", "canvasx",
"canvasy", "cget", "configure", "coords",
"create", "dchars", "delete", "dtag",
@@ -778,12 +778,12 @@ CanvasWidgetCmd(
goto done;
}
} else if (objc == 4) {
- CONST char *command;
+ const char *command;
command = Tk_GetBinding(interp, canvasPtr->bindingTable,
object, Tcl_GetString(objv[3]));
if (command == NULL) {
- CONST char *string;
+ const char *string;
string = Tcl_GetStringResult(interp);
@@ -900,7 +900,8 @@ CanvasWidgetCmd(
result = (*itemPtr->typePtr->coordProc)(interp,
(Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3);
} else {
- CONST char **args = TkGetStringsFromObjs(objc-3, objv+3);
+ const char **args = TkGetStringsFromObjs(objc-3, objv+3);
+
result = (*itemPtr->typePtr->coordProc)(interp,
(Tk_Canvas) canvasPtr, itemPtr, objc-3,
(Tcl_Obj **) args);
@@ -977,7 +978,8 @@ CanvasWidgetCmd(
result = (*typePtr->createProc)(interp, (Tk_Canvas) canvasPtr,
itemPtr, objc-3, objv+3);
} else {
- CONST char **args = TkGetStringsFromObjs(objc-3, objv+3);
+ const char **args = TkGetStringsFromObjs(objc-3, objv+3);
+
result = (*typePtr->createProc)(interp, (Tk_Canvas) canvasPtr,
itemPtr, objc-3, (Tcl_Obj **) args);
if (args != NULL) {
@@ -1373,7 +1375,8 @@ CanvasWidgetCmd(
(Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3,
TK_CONFIG_ARGV_ONLY);
} else {
- CONST char **args = TkGetStringsFromObjs(objc-3, objv+3);
+ const char **args = TkGetStringsFromObjs(objc-3, objv+3);
+
result = (*itemPtr->typePtr->configProc)(interp,
(Tk_Canvas) canvasPtr, itemPtr, objc-3,
(Tcl_Obj **) args, TK_CONFIG_ARGV_ONLY);
@@ -1444,7 +1447,7 @@ CanvasWidgetCmd(
break;
}
case CANV_POSTSCRIPT: {
- CONST char **args = TkGetStringsFromObjs(objc, objv);
+ const char **args = TkGetStringsFromObjs(objc, objv);
result = TkCanvPostscriptCmd(canvasPtr, interp, objc, args);
if (args != NULL) {
@@ -1519,7 +1522,7 @@ CanvasWidgetCmd(
}
case CANV_SCAN: {
int x, y, gain = 10;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"mark", "dragto", NULL
};
@@ -1563,7 +1566,7 @@ CanvasWidgetCmd(
}
case CANV_SELECT: {
int index, optionindex;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"adjust", "clear", "from", "item", "to", NULL
};
enum options {
@@ -1696,7 +1699,8 @@ CanvasWidgetCmd(
- canvasPtr->inset, canvasPtr->scrollX1,
canvasPtr->scrollX2));
} else {
- CONST char **args = TkGetStringsFromObjs(objc, objv);
+ const char **args = TkGetStringsFromObjs(objc, objv);
+
type = Tk_GetScrollInfo(interp, objc, args, &fraction, &count);
if (args != NULL) {
ckfree((char *) args);
@@ -1742,7 +1746,8 @@ CanvasWidgetCmd(
- canvasPtr->inset,
canvasPtr->scrollY1, canvasPtr->scrollY2));
} else {
- CONST char **args = TkGetStringsFromObjs(objc, objv);
+ const char **args = TkGetStringsFromObjs(objc, objv);
+
type = Tk_GetScrollInfo(interp, objc, args, &fraction, &count);
if (args != NULL) {
ckfree((char *) args);
@@ -1881,14 +1886,14 @@ ConfigureCanvas(
TkCanvas *canvasPtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in objv. */
- Tcl_Obj *CONST objv[], /* Argument objects. */
+ Tcl_Obj *const objv[], /* Argument objects. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
XGCValues gcValues;
GC newGC;
if (Tk_ConfigureWidget(interp, canvasPtr->tkwin, configSpecs,
- objc, (CONST char **) objv, (char *) canvasPtr,
+ objc, (const char **) objv, (char *) canvasPtr,
flags|TK_CONFIG_OBJS) != TCL_OK) {
return TCL_ERROR;
}
@@ -1941,7 +1946,7 @@ ConfigureCanvas(
canvasPtr->scrollY2 = 0;
if (canvasPtr->regionString != NULL) {
int argc2;
- CONST char **argv2;
+ const char **argv2;
if (Tcl_SplitList(canvasPtr->interp, canvasPtr->regionString,
&argc2, &argv2) != TCL_OK) {
@@ -2023,11 +2028,10 @@ static void
CanvasWorldChanged(
ClientData instanceData) /* Information about widget. */
{
- TkCanvas *canvasPtr;
+ TkCanvas *canvasPtr = (TkCanvas *) instanceData;
Tk_Item *itemPtr;
int result;
- canvasPtr = (TkCanvas *) instanceData;
itemPtr = canvasPtr->firstItemPtr;
for ( ; itemPtr != NULL; itemPtr = itemPtr->nextPtr) {
result = (*itemPtr->typePtr->configProc)(canvasPtr->interp,
@@ -2066,7 +2070,7 @@ static void
DisplayCanvas(
ClientData clientData) /* Information about widget. */
{
- TkCanvas *canvasPtr = (TkCanvas *) clientData;
+ TkCanvas *canvasPtr = clientData;
Tk_Window tkwin = canvasPtr->tkwin;
Tk_Item *itemPtr;
Pixmap pixmap;
@@ -2307,7 +2311,7 @@ CanvasEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TkCanvas *canvasPtr = (TkCanvas *) clientData;
+ TkCanvas *canvasPtr = clientData;
if (eventPtr->type == Expose) {
int x, y;
@@ -2399,7 +2403,7 @@ static void
CanvasCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkCanvas *canvasPtr = (TkCanvas *) clientData;
+ TkCanvas *canvasPtr = clientData;
Tk_Window tkwin = canvasPtr->tkwin;
/*
@@ -2440,7 +2444,7 @@ Tk_CanvasEventuallyRedraw(
int x2, int y2) /* Lower right corner of area to redraw.
* Pixels on edge are not redrawn. */
{
- TkCanvas *canvasPtr = (TkCanvas *) canvas;
+ TkCanvas *canvasPtr = Canvas(canvas);
/*
* If tkwin is NULL, the canvas has been destroyed, so we can't really
@@ -2505,7 +2509,8 @@ EventuallyRedrawItem(
Tk_Canvas canvas, /* Information about widget. */
Tk_Item *itemPtr) /* Item to be redrawn. */
{
- TkCanvas *canvasPtr = (TkCanvas *) canvas;
+ TkCanvas *canvasPtr = Canvas(canvas);
+
if ((itemPtr->x1 >= itemPtr->x2) || (itemPtr->y1 >= itemPtr->y2) ||
(itemPtr->x2 < canvasPtr->xOrigin) ||
(itemPtr->y2 < canvasPtr->yOrigin) ||
@@ -3900,7 +3905,7 @@ FindItems(
TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */
int objc, /* Number of entries in argv. Must be greater
* than zero. */
- Tcl_Obj *CONST *objv, /* Arguments that describe what items to
+ Tcl_Obj *const *objv, /* Arguments that describe what items to
* search for (see user doc on "find" and
* "addtag" options). */
Tcl_Obj *newTag, /* If non-NULL, gives new tag to set on all
@@ -3921,7 +3926,7 @@ FindItems(
Tk_Item *itemPtr;
Tk_Uid uid;
int index, result;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"above", "all", "below", "closest",
"enclosed", "overlapping", "withtag", NULL
};
@@ -4148,7 +4153,7 @@ FindArea(
Tcl_Interp *interp, /* Interpreter for error reporting and result
* storing. */
TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */
- Tcl_Obj *CONST *objv, /* Array of four arguments that give the
+ Tcl_Obj *const *objv, /* Array of four arguments that give the
* coordinates of the rectangular area to
* search. */
Tk_Uid uid, /* If non-NULL, gives new tag to set on all
@@ -4354,9 +4359,9 @@ CanvasBindProc(
ClientData clientData, /* Pointer to canvas structure. */
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
- TkCanvas *canvasPtr = (TkCanvas *) clientData;
+ TkCanvas *canvasPtr = clientData;
- Tcl_Preserve((ClientData) canvasPtr);
+ Tcl_Preserve(canvasPtr);
/*
* This code below keeps track of the current modifier state in
@@ -4433,7 +4438,7 @@ CanvasBindProc(
CanvasDoEvent(canvasPtr, eventPtr);
done:
- Tcl_Release((ClientData) canvasPtr);
+ Tcl_Release(canvasPtr);
}
/*
@@ -4643,8 +4648,8 @@ PickCurrentItem(
#else /* USE_OLD_TAG_SEARCH */
DoItem(NULL, canvasPtr->currentItemPtr, searchUids->currentUid);
#endif /* USE_OLD_TAG_SEA */
- if ((canvasPtr->currentItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT &&
- prevItemPtr != canvasPtr->currentItemPtr)) {
+ if ((canvasPtr->currentItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT
+ && prevItemPtr != canvasPtr->currentItemPtr)) {
(*canvasPtr->currentItemPtr->typePtr->configProc)(canvasPtr->interp,
(Tk_Canvas) canvasPtr, canvasPtr->currentItemPtr, 0, NULL,
TK_CONFIG_ARGV_ONLY);
@@ -4806,14 +4811,14 @@ CanvasDoEvent(
(numObjects * sizeof(ClientData)));
}
#ifdef USE_OLD_TAG_SEARCH
- objectPtr[0] = (ClientData) Tk_GetUid("all");
+ objectPtr[0] = Tk_GetUid("all");
#else /* USE_OLD_TAG_SEARCH */
- objectPtr[0] = (ClientData) searchUids->allUid;
+ objectPtr[0] = searchUids->allUid;
#endif /* USE_OLD_TAG_SEARCH */
for (i = itemPtr->numTags-1; i >= 0; i--) {
- objectPtr[i+1] = (ClientData) itemPtr->tagPtr[i];
+ objectPtr[i+1] = itemPtr->tagPtr[i];
}
- objectPtr[itemPtr->numTags+1] = (ClientData) itemPtr;
+ objectPtr[itemPtr->numTags+1] = itemPtr;
#ifndef USE_OLD_TAG_SEARCH
/*
@@ -4866,7 +4871,7 @@ static void
CanvasBlinkProc(
ClientData clientData) /* Pointer to record describing entry. */
{
- TkCanvas *canvasPtr = (TkCanvas *) clientData;
+ TkCanvas *canvasPtr = clientData;
if (!canvasPtr->textInfo.gotFocus || (canvasPtr->insertOffTime == 0)) {
return;
@@ -4874,13 +4879,11 @@ CanvasBlinkProc(
if (canvasPtr->textInfo.cursorOn) {
canvasPtr->textInfo.cursorOn = 0;
canvasPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
- canvasPtr->insertOffTime, CanvasBlinkProc,
- (ClientData) canvasPtr);
+ canvasPtr->insertOffTime, CanvasBlinkProc, canvasPtr);
} else {
canvasPtr->textInfo.cursorOn = 1;
canvasPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
- canvasPtr->insertOnTime, CanvasBlinkProc,
- (ClientData) canvasPtr);
+ canvasPtr->insertOnTime, CanvasBlinkProc, canvasPtr);
}
if (canvasPtr->textInfo.focusItemPtr != NULL) {
EventuallyRedrawItem((Tk_Canvas) canvasPtr,
@@ -4918,8 +4921,7 @@ CanvasFocusProc(
canvasPtr->textInfo.cursorOn = 1;
if (canvasPtr->insertOffTime != 0) {
canvasPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
- canvasPtr->insertOffTime, CanvasBlinkProc,
- (ClientData) canvasPtr);
+ canvasPtr->insertOffTime, CanvasBlinkProc, canvasPtr);
}
} else {
canvasPtr->textInfo.gotFocus = 0;
@@ -4933,7 +4935,7 @@ CanvasFocusProc(
if (canvasPtr->highlightWidth > 0) {
canvasPtr->flags |= REDRAW_BORDERS;
if (!(canvasPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayCanvas, (ClientData) canvasPtr);
+ Tcl_DoWhenIdle(DisplayCanvas, canvasPtr);
canvasPtr->flags |= REDRAW_PENDING;
}
}
@@ -4976,7 +4978,7 @@ CanvasSelectTo(
if (canvasPtr->textInfo.selItemPtr == NULL) {
Tk_OwnSelection(canvasPtr->tkwin, XA_PRIMARY, CanvasLostSelection,
- (ClientData) canvasPtr);
+ canvasPtr);
} else if (canvasPtr->textInfo.selItemPtr != itemPtr) {
EventuallyRedrawItem((Tk_Canvas) canvasPtr,
canvasPtr->textInfo.selItemPtr);
@@ -5032,7 +5034,7 @@ CanvasFetchSelection(
* not including terminating NULL
* character. */
{
- TkCanvas *canvasPtr = (TkCanvas *) clientData;
+ TkCanvas *canvasPtr = clientData;
if (canvasPtr->textInfo.selItemPtr == NULL) {
return -1;
@@ -5067,7 +5069,7 @@ static void
CanvasLostSelection(
ClientData clientData) /* Information about entry widget. */
{
- TkCanvas *canvasPtr = (TkCanvas *) clientData;
+ TkCanvas *canvasPtr = clientData;
if (canvasPtr->textInfo.selItemPtr != NULL) {
EventuallyRedrawItem((Tk_Canvas) canvasPtr,
@@ -5196,14 +5198,14 @@ CanvasUpdateScrollbars(
*/
interp = canvasPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
xScrollCmd = canvasPtr->xScrollCmd;
if (xScrollCmd != NULL) {
- Tcl_Preserve((ClientData) xScrollCmd);
+ Tcl_Preserve(xScrollCmd);
}
yScrollCmd = canvasPtr->yScrollCmd;
if (yScrollCmd != NULL) {
- Tcl_Preserve((ClientData) yScrollCmd);
+ Tcl_Preserve(yScrollCmd);
}
xOrigin = canvasPtr->xOrigin;
yOrigin = canvasPtr->yOrigin;
@@ -5218,6 +5220,7 @@ CanvasUpdateScrollbars(
if (canvasPtr->xScrollCmd != NULL) {
Tcl_Obj *fractions = ScrollFractions(xOrigin + inset,
xOrigin + width - inset, scrollX1, scrollX2);
+
result = Tcl_VarEval(interp, xScrollCmd, " ", Tcl_GetString(fractions),
NULL);
Tcl_DecrRefCount(fractions);
@@ -5225,12 +5228,13 @@ CanvasUpdateScrollbars(
Tcl_BackgroundError(interp);
}
Tcl_ResetResult(interp);
- Tcl_Release((ClientData) xScrollCmd);
+ Tcl_Release(xScrollCmd);
}
if (yScrollCmd != NULL) {
Tcl_Obj *fractions = ScrollFractions(yOrigin + inset,
yOrigin + height - inset, scrollY1, scrollY2);
+
result = Tcl_VarEval(interp, yScrollCmd, " ", Tcl_GetString(fractions),
NULL);
Tcl_DecrRefCount(fractions);
@@ -5238,9 +5242,9 @@ CanvasUpdateScrollbars(
Tcl_BackgroundError(interp);
}
Tcl_ResetResult(interp);
- Tcl_Release((ClientData) yScrollCmd);
+ Tcl_Release(yScrollCmd);
}
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
/*
@@ -5389,17 +5393,18 @@ CanvasSetOrigin(
*/
/* ARGSUSED */
-static CONST char **
+static const char **
TkGetStringsFromObjs(
int objc,
- Tcl_Obj *CONST objv[])
+ Tcl_Obj *const objv[])
{
register int i;
- CONST char **argv;
+ const char **argv;
+
if (objc <= 0) {
return NULL;
}
- argv = (CONST char **) ckalloc((objc+1) * sizeof(char *));
+ argv = (const char **) ckalloc((objc+1) * sizeof(char *));
for (i = 0; i < objc; i++) {
argv[i] = Tcl_GetString(objv[i]);
}
@@ -5435,8 +5440,7 @@ Tk_CanvasPsColor(
Tk_Canvas canvas, /* Information about canvas. */
XColor *colorPtr) /* Information about color. */
{
- return Tk_PostscriptColor(interp, ((TkCanvas *) canvas)->psInfo,
- colorPtr);
+ return Tk_PostscriptColor(interp, Canvas(canvas)->psInfo, colorPtr);
}
/*
@@ -5469,7 +5473,7 @@ Tk_CanvasPsFont(
Tk_Font tkfont) /* Information about font in which text is to
* be printed. */
{
- return Tk_PostscriptFont(interp, ((TkCanvas *) canvas)->psInfo, tkfont);
+ return Tk_PostscriptFont(interp, Canvas(canvas)->psInfo, tkfont);
}
/*
@@ -5502,9 +5506,8 @@ Tk_CanvasPsBitmap(
* rectangular region to output. */
int width, int height) /* Size of rectangular region. */
{
- return Tk_PostscriptBitmap(interp, ((TkCanvas *) canvas)->tkwin,
- ((TkCanvas *) canvas)->psInfo, bitmap, startX, startY,
- width, height);
+ return Tk_PostscriptBitmap(interp, Canvas(canvas)->tkwin,
+ Canvas(canvas)->psInfo, bitmap, startX, startY, width, height);
}
/*
@@ -5536,8 +5539,8 @@ Tk_CanvasPsStipple(
Tk_Canvas canvas, /* Information about canvas. */
Pixmap bitmap) /* Bitmap to use for stippling. */
{
- return Tk_PostscriptStipple(interp, ((TkCanvas *) canvas)->tkwin,
- ((TkCanvas *) canvas)->psInfo, bitmap);
+ return Tk_PostscriptStipple(interp, Canvas(canvas)->tkwin,
+ Canvas(canvas)->psInfo, bitmap);
}
/*
@@ -5563,7 +5566,7 @@ Tk_CanvasPsY(
* is being generated. */
double y) /* Y-coordinate in canvas coords. */
{
- return Tk_PostscriptY(y, ((TkCanvas *) canvas)->psInfo);
+ return Tk_PostscriptY(y, Canvas(canvas)->psInfo);
}
/*
@@ -5593,8 +5596,7 @@ Tk_CanvasPsPath(
* coordinates giving points for path. */
int numPoints) /* Number of points at *coordPtr. */
{
- Tk_PostscriptPath(interp, ((TkCanvas *) canvas)->psInfo,
- coordPtr, numPoints);
+ Tk_PostscriptPath(interp, Canvas(canvas)->psInfo, coordPtr, numPoints);
}
/*
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index cd0455b..c4e6c23 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkClipboard.c,v 1.18 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkClipboard.c,v 1.19 2008/04/27 22:38:55 dkf Exp $
*/
#include "tkInt.h"
@@ -58,7 +58,7 @@ ClipboardHandler(
char *buffer, /* Place to store converted selection. */
int maxBytes) /* Maximum # of bytes to store at buffer. */
{
- TkClipboardTarget *targetPtr = (TkClipboardTarget*) clientData;
+ TkClipboardTarget *targetPtr = clientData;
TkClipboardBuffer *cbPtr;
char *srcPtr, *destPtr;
size_t count = 0;
@@ -136,9 +136,9 @@ ClipboardAppHandler(
char *buffer, /* Place to store converted selection. */
int maxBytes) /* Maximum # of bytes to store at buffer. */
{
- TkDisplay *dispPtr = (TkDisplay *) clientData;
+ TkDisplay *dispPtr = clientData;
size_t length;
- CONST char *p;
+ const char *p;
p = dispPtr->clipboardAppPtr->winPtr->nameUid;
length = strlen(p);
@@ -207,7 +207,7 @@ static void
ClipboardLostSel(
ClientData clientData) /* Pointer to TkDisplay structure. */
{
- TkDisplay *dispPtr = (TkDisplay*) clientData;
+ TkDisplay *dispPtr = clientData;
dispPtr->clipboardActive = 0;
}
@@ -284,7 +284,7 @@ Tk_ClipboardClear(
if (!dispPtr->clipboardActive) {
Tk_OwnSelection(dispPtr->clipWindow, dispPtr->clipboardAtom,
- ClipboardLostSel, (ClientData) dispPtr);
+ ClipboardLostSel, dispPtr);
dispPtr->clipboardActive = 1;
}
dispPtr->clipboardAppPtr = winPtr->mainPtr;
@@ -326,7 +326,7 @@ Tk_ClipboardAppend(
* clipboard item, e.g. STRING or LENGTH. */
Atom format, /* Format in which the selection information
* should be returned to the requestor. */
- char* buffer) /* NULL terminated string containing the data
+ char *buffer) /* NULL terminated string containing the data
* to be added to the clipboard. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -343,7 +343,7 @@ Tk_ClipboardAppend(
Tk_ClipboardClear(interp, tkwin);
} else if (!dispPtr->clipboardActive) {
Tk_OwnSelection(dispPtr->clipWindow, dispPtr->clipboardAtom,
- ClipboardLostSel, (ClientData) dispPtr);
+ ClipboardLostSel, dispPtr);
dispPtr->clipboardActive = 1;
}
@@ -360,14 +360,14 @@ Tk_ClipboardAppend(
}
}
if (targetPtr == NULL) {
- targetPtr = (TkClipboardTarget*) ckalloc(sizeof(TkClipboardTarget));
+ targetPtr = (TkClipboardTarget *) ckalloc(sizeof(TkClipboardTarget));
targetPtr->type = type;
targetPtr->format = format;
targetPtr->firstBufferPtr = targetPtr->lastBufferPtr = NULL;
targetPtr->nextPtr = dispPtr->clipTargetPtr;
dispPtr->clipTargetPtr = targetPtr;
Tk_CreateSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
- type, ClipboardHandler, (ClientData) targetPtr, format);
+ type, ClipboardHandler, targetPtr, format);
} else if (targetPtr->format != format) {
Tcl_AppendResult(interp, "format \"", Tk_GetAtomName(tkwin, format),
"\" does not match current format \"",
@@ -380,7 +380,7 @@ Tk_ClipboardAppend(
* Append a new buffer to the buffer chain.
*/
- cbPtr = (TkClipboardBuffer*) ckalloc(sizeof(TkClipboardBuffer));
+ cbPtr = (TkClipboardBuffer *) ckalloc(sizeof(TkClipboardBuffer));
cbPtr->nextPtr = NULL;
if (targetPtr->lastBufferPtr != NULL) {
targetPtr->lastBufferPtr->nextPtr = cbPtr;
@@ -393,7 +393,7 @@ Tk_ClipboardAppend(
cbPtr->buffer = (char *) ckalloc((unsigned) (cbPtr->length + 1));
strcpy(cbPtr->buffer, buffer);
- TkSelUpdateClipboard((TkWindow*)(dispPtr->clipWindow), targetPtr);
+ TkSelUpdateClipboard((TkWindow *) dispPtr->clipWindow, targetPtr);
return TCL_OK;
}
@@ -420,12 +420,12 @@ Tk_ClipboardObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument strings. */
+ Tcl_Obj *const objv[]) /* Argument strings. */
{
Tk_Window tkwin = (Tk_Window) clientData;
char *path = NULL;
Atom selection;
- static CONST char *optionStrings[] = { "append", "clear", "get", NULL };
+ static const char *optionStrings[] = { "append", "clear", "get", NULL };
enum options { CLIPBOARD_APPEND, CLIPBOARD_CLEAR, CLIPBOARD_GET };
int index, i;
@@ -445,7 +445,7 @@ Tk_ClipboardObjCmd(
char *targetName = NULL;
char *formatName = NULL;
char *string;
- static CONST char *appendOptionStrings[] = {
+ static const char *appendOptionStrings[] = {
"-displayof", "-format", "-type", NULL
};
enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE };
@@ -516,7 +516,7 @@ Tk_ClipboardObjCmd(
Tcl_GetString(objv[i]));
}
case CLIPBOARD_CLEAR: {
- static CONST char *clearOptionStrings[] = { "-displayof", NULL };
+ static const char *clearOptionStrings[] = { "-displayof", NULL };
enum clearOptions { CLEAR_DISPLAYOF };
int subIndex;
@@ -548,7 +548,7 @@ Tk_ClipboardObjCmd(
Tcl_DString selBytes;
int result;
char *string;
- static CONST char *getOptionStrings[] = {
+ static const char *getOptionStrings[] = {
"-displayof", "-type", NULL
};
enum getOptions { APPEND_DISPLAYOF, APPEND_TYPE };
@@ -647,12 +647,12 @@ TkClipInit(
* and set up an event handler for it.
*/
- dispPtr->clipWindow = Tk_CreateWindow(interp, (Tk_Window) NULL,
- "_clip", DisplayString(dispPtr->display));
+ dispPtr->clipWindow = Tk_CreateWindow(interp, NULL, "_clip",
+ DisplayString(dispPtr->display));
if (dispPtr->clipWindow == NULL) {
return TCL_ERROR;
}
- Tcl_Preserve((ClientData) dispPtr->clipWindow);
+ Tcl_Preserve(dispPtr->clipWindow);
atts.override_redirect = True;
Tk_ChangeWindowAttributes(dispPtr->clipWindow, CWOverrideRedirect, &atts);
Tk_MakeWindowExist(dispPtr->clipWindow);
@@ -673,11 +673,9 @@ TkClipInit(
*/
Tk_CreateSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
- dispPtr->applicationAtom, ClipboardAppHandler,
- (ClientData) dispPtr, XA_STRING);
+ dispPtr->applicationAtom, ClipboardAppHandler, dispPtr,XA_STRING);
Tk_CreateSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
- dispPtr->windowAtom, ClipboardWindowHandler,
- (ClientData) dispPtr, XA_STRING);
+ dispPtr->windowAtom, ClipboardWindowHandler, dispPtr, XA_STRING);
return TCL_OK;
}
diff --git a/generic/tkColor.c b/generic/tkColor.c
index 85593ac..8fbb85e 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.16 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkColor.c,v 1.17 2008/04/27 22:38:55 dkf Exp $
*/
#include "tkInt.h"
@@ -129,8 +129,8 @@ Tk_AllocColorFromObj(
*/
if (tkColPtr != NULL) {
- TkColor *firstColorPtr = (TkColor *)
- Tcl_GetHashValue(tkColPtr->hashPtr);
+ TkColor *firstColorPtr = Tcl_GetHashValue(tkColPtr->hashPtr);
+
FreeColorObjProc(objPtr);
for (tkColPtr = firstColorPtr; tkColPtr != NULL;
tkColPtr = tkColPtr->nextPtr) {
@@ -138,7 +138,7 @@ Tk_AllocColorFromObj(
&& (Tk_Colormap(tkwin) == tkColPtr->colormap)) {
tkColPtr->resourceRefCount++;
tkColPtr->objRefCount++;
- objPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = tkColPtr;
return (XColor *) tkColPtr;
}
}
@@ -149,7 +149,7 @@ Tk_AllocColorFromObj(
*/
tkColPtr = (TkColor *) Tk_GetColor(interp, tkwin, Tcl_GetString(objPtr));
- objPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = tkColPtr;
if (tkColPtr != NULL) {
tkColPtr->objRefCount++;
}
@@ -204,7 +204,7 @@ Tk_GetColor(
nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &isNew);
if (!isNew) {
- existingColPtr = (TkColor *) Tcl_GetHashValue(nameHashPtr);
+ existingColPtr = Tcl_GetHashValue(nameHashPtr);
for (tkColPtr = existingColPtr; tkColPtr != NULL;
tkColPtr = tkColPtr->nextPtr) {
if ((tkColPtr->screen == Tk_Screen(tkwin))
@@ -310,7 +310,7 @@ Tk_GetColorByValue(
valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable,
(char *) &valueKey, &isNew);
if (!isNew) {
- tkColPtr = (TkColor *) Tcl_GetHashValue(valueHashPtr);
+ tkColPtr = Tcl_GetHashValue(valueHashPtr);
tkColPtr->resourceRefCount++;
return &tkColPtr->color;
}
@@ -355,7 +355,7 @@ Tk_GetColorByValue(
*--------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_NameOfColor(
XColor *colorPtr) /* Color whose name is desired. */
{
@@ -364,7 +364,7 @@ Tk_NameOfColor(
if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) {
return tkColPtr->hashPtr->key.string;
} else {
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red,
@@ -415,8 +415,8 @@ Tk_GCForColor(
if (tkColPtr->gc == None) {
gcValues.foreground = tkColPtr->color.pixel;
- tkColPtr->gc = XCreateGC(DisplayOfScreen(tkColPtr->screen),
- drawable, GCForeground, &gcValues);
+ tkColPtr->gc = XCreateGC(DisplayOfScreen(tkColPtr->screen), drawable,
+ GCForeground, &gcValues);
}
return tkColPtr->gc;
}
@@ -474,7 +474,7 @@ Tk_FreeColor(
}
TkpFreeColor(tkColPtr);
- prevPtr = (TkColor *) Tcl_GetHashValue(tkColPtr->hashPtr);
+ prevPtr = Tcl_GetHashValue(tkColPtr->hashPtr);
if (prevPtr == tkColPtr) {
if (tkColPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(tkColPtr->hashPtr);
@@ -553,7 +553,7 @@ static void
FreeColorObjProc(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
- TkColor *tkColPtr = (TkColor *) objPtr->internalRep.twoPtrValue.ptr1;
+ TkColor *tkColPtr = objPtr->internalRep.twoPtrValue.ptr1;
if (tkColPtr != NULL) {
tkColPtr->objRefCount--;
@@ -588,10 +588,10 @@ DupColorObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- TkColor *tkColPtr = (TkColor *) srcObjPtr->internalRep.twoPtrValue.ptr1;
+ TkColor *tkColPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
- dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr;
+ dupObjPtr->internalRep.twoPtrValue.ptr1 = tkColPtr;
if (tkColPtr != NULL) {
tkColPtr->objRefCount++;
@@ -638,7 +638,7 @@ Tk_GetColorFromObj(
* map. If it is, we are done.
*/
- tkColPtr = (TkColor *) objPtr->internalRep.twoPtrValue.ptr1;
+ tkColPtr = objPtr->internalRep.twoPtrValue.ptr1;
if ((tkColPtr != NULL)
&& (tkColPtr->resourceRefCount > 0)
&& (Tk_Screen(tkwin) == tkColPtr->screen)
@@ -664,12 +664,12 @@ Tk_GetColorFromObj(
if (hashPtr == NULL) {
goto error;
}
- for (tkColPtr = (TkColor *) Tcl_GetHashValue(hashPtr);
+ for (tkColPtr = Tcl_GetHashValue(hashPtr);
(tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) {
if ((Tk_Screen(tkwin) == tkColPtr->screen)
&& (Tk_Colormap(tkwin) == tkColPtr->colormap)) {
FreeColorObjProc(objPtr);
- objPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = tkColPtr;
tkColPtr->objRefCount++;
return (XColor *) tkColPtr;
}
@@ -780,7 +780,7 @@ TkDebugColor(
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable, name);
if (hashPtr != NULL) {
- TkColor *tkColPtr = (TkColor *) Tcl_GetHashValue(hashPtr);
+ TkColor *tkColPtr = Tcl_GetHashValue(hashPtr);
if (tkColPtr == NULL) {
Tcl_Panic("TkDebugColor found empty hash table entry");
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 368d0ce..5521615 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.26 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkConfig.c,v 1.27 2008/04/27 22:38:55 dkf Exp $
*/
/*
@@ -50,7 +50,7 @@
*/
typedef struct TkOption {
- CONST Tk_OptionSpec *specPtr;
+ const Tk_OptionSpec *specPtr;
/* The original spec from the template passed
* to Tk_CreateOptionTable.*/
Tk_Uid dbNameUID; /* The Uid form of the option database
@@ -123,7 +123,7 @@ static Tcl_Obj * GetConfigList(char *recordPtr,
Option *optionPtr, Tk_Window tkwin);
static Tcl_Obj * GetObjectForOption(char *recordPtr,
Option *optionPtr, Tk_Window tkwin);
-static Option * GetOption(CONST char *name, OptionTable *tablePtr);
+static Option * GetOption(const char *name, OptionTable *tablePtr);
static Option * GetOptionFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, OptionTable *tablePtr);
static int ObjectIsEmpty(Tcl_Obj *objPtr);
@@ -166,7 +166,7 @@ Tk_OptionTable
Tk_CreateOptionTable(
Tcl_Interp *interp, /* Interpreter associated with the application
* in which this table will be used. */
- CONST Tk_OptionSpec *templatePtr)
+ const Tk_OptionSpec *templatePtr)
/* Static information about the configuration
* options. */
{
@@ -174,7 +174,7 @@ Tk_CreateOptionTable(
Tcl_HashEntry *hashEntryPtr;
int newEntry;
OptionTable *tablePtr;
- CONST Tk_OptionSpec *specPtr, *specPtr2;
+ const Tk_OptionSpec *specPtr, *specPtr2;
Option *optionPtr;
int numOptions, i;
@@ -194,7 +194,7 @@ Tk_CreateOptionTable(
hashTablePtr = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(hashTablePtr, TCL_ONE_WORD_KEYS);
Tcl_SetAssocData(interp, OPTION_HASH_KEY, DestroyOptionHashTable,
- (ClientData) hashTablePtr);
+ hashTablePtr);
}
/*
@@ -270,7 +270,7 @@ Tk_CreateOptionTable(
|| (specPtr->type == TK_OPTION_BORDER))
&& (specPtr->clientData != NULL)) {
optionPtr->extra.monoColorPtr =
- Tcl_NewStringObj((char *) specPtr->clientData, -1);
+ Tcl_NewStringObj(specPtr->clientData, -1);
Tcl_IncrRefCount(optionPtr->extra.monoColorPtr);
}
@@ -278,8 +278,8 @@ Tk_CreateOptionTable(
/*
* Get the custom parsing, etc., functions.
*/
- optionPtr->extra.custom =
- (Tk_ObjCustomOption *) specPtr->clientData;
+
+ optionPtr->extra.custom = specPtr->clientData;
}
}
if (((specPtr->type == TK_OPTION_STRING)
@@ -303,8 +303,8 @@ Tk_CreateOptionTable(
*/
if (specPtr->clientData != NULL) {
- tablePtr->nextPtr = (OptionTable *) Tk_CreateOptionTable(interp,
- (Tk_OptionSpec *) specPtr->clientData);
+ tablePtr->nextPtr = (OptionTable *)
+ Tk_CreateOptionTable(interp, specPtr->clientData);
}
return (Tk_OptionTable) tablePtr;
@@ -385,7 +385,7 @@ DestroyOptionHashTable(
ClientData clientData, /* The hash table we are destroying */
Tcl_Interp *interp) /* The interpreter we are destroying */
{
- Tcl_HashTable *hashTablePtr = (Tcl_HashTable *) clientData;
+ Tcl_HashTable *hashTablePtr = clientData;
Tcl_HashSearch search;
Tcl_HashEntry *hashEntryPtr;
OptionTable *tablePtr;
@@ -634,7 +634,7 @@ DoObjConfig(
Tk_SavedOption internal; /* Used to save the old internal
* representation of the value if
* savedOptionPtr is NULL. */
- CONST Tk_OptionSpec *specPtr;
+ const Tk_OptionSpec *specPtr;
int nullOK;
/*
@@ -735,7 +735,7 @@ DoObjConfig(
int newValue;
if (Tcl_GetIndexFromObj(interp, valuePtr,
- (CONST char **) optionPtr->specPtr->clientData,
+ optionPtr->specPtr->clientData,
optionPtr->specPtr->optionName+1, 0, &newValue) != TCL_OK) {
return TCL_ERROR;
}
@@ -1030,13 +1030,13 @@ ObjectIsEmpty(
static Option *
GetOption(
- CONST char *name, /* String balue to be looked up in the option
+ const char *name, /* String balue to be looked up in the option
* table. */
OptionTable *tablePtr) /* Table in which to look up name. */
{
Option *bestPtr, *optionPtr;
OptionTable *tablePtr2;
- CONST char *p1, *p2;
+ const char *p1, *p2;
int count;
/*
@@ -1184,9 +1184,9 @@ GetOptionFromObj(
*----------------------------------------------------------------------
*/
-CONST Tk_OptionSpec *
+const Tk_OptionSpec *
TkGetOptionSpec(
- CONST char *name, /* String value to be looked up. */
+ const char *name, /* String value to be looked up. */
Tk_OptionTable optionTable) /* Table in which to look up name. */
{
Option *optionPtr;
@@ -1262,7 +1262,7 @@ Tk_SetOptions(
char *recordPtr, /* The record to configure. */
Tk_OptionTable optionTable, /* Describes valid options. */
int objc, /* The number of elements in objv. */
- Tcl_Obj *CONST objv[], /* Contains one or more name-value pairs. */
+ Tcl_Obj *const objv[], /* Contains one or more name-value pairs. */
Tk_Window tkwin, /* Window associated with the thing being
* configured; needed for some options (such
* as colors). */
@@ -1385,7 +1385,7 @@ Tk_RestoreSavedOptions(
* record. */
char *internalPtr; /* Points to internal value of option in
* record. */
- CONST Tk_OptionSpec *specPtr;
+ const Tk_OptionSpec *specPtr;
/*
* Be sure to restore the options in the opposite order they were set.
@@ -1575,7 +1575,7 @@ Tk_FreeConfigOptions(
int count;
Tcl_Obj **oldPtrPtr, *oldPtr;
char *oldInternalPtr;
- CONST Tk_OptionSpec *specPtr;
+ const Tk_OptionSpec *specPtr;
for (tablePtr = (OptionTable *) optionTable; tablePtr != NULL;
tablePtr = tablePtr->nextPtr) {
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 0ea2051..5d0ba6e 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.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: tkConsole.c,v 1.36 2008/04/01 16:30:52 dgp Exp $
+ * RCS: @(#) $Id: tkConsole.c,v 1.37 2008/04/27 22:38:56 dkf Exp $
*/
#include "tk.h"
@@ -48,19 +48,19 @@ typedef struct ChannelData {
static int ConsoleClose(ClientData instanceData, Tcl_Interp *interp);
static void ConsoleDeleteProc(ClientData clientData);
static void ConsoleEventProc(ClientData clientData, XEvent *eventPtr);
-static int ConsoleHandle(ClientData instanceData,
- int direction, ClientData *handlePtr);
-static int ConsoleInput(ClientData instanceData,
- char *buf, int toRead, int *errorCode);
+static int ConsoleHandle(ClientData instanceData, int direction,
+ ClientData *handlePtr);
+static int ConsoleInput(ClientData instanceData, char *buf, int toRead,
+ int *errorCode);
static int ConsoleObjCmd(ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
-static int ConsoleOutput(ClientData instanceData,
- CONST char *buf, int toWrite, int *errorCode);
+ int objc, Tcl_Obj *const objv[]);
+static int ConsoleOutput(ClientData instanceData, const char *buf,
+ int toWrite, int *errorCode);
static void ConsoleWatch(ClientData instanceData, int mask);
static void DeleteConsoleInterp(ClientData clientData);
static void InterpDeleteProc(ClientData clientData, Tcl_Interp *interp);
static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
/*
* This structure describes the channel type structure for file based IO:
@@ -175,7 +175,7 @@ ShouldUseConsoleChannel(
*/
if (fileType == FILE_TYPE_CHAR) {
- dcb.DCBlength = sizeof( DCB ) ;
+ dcb.DCBlength = sizeof(DCB);
if (!GetConsoleMode(handle, &consoleParams) &&
!GetCommState(handle, &dcb)) {
/*
@@ -237,9 +237,12 @@ Tk_InitConsoleChannels(
return;
}
- consoleInitPtr = Tcl_GetThreadData(&consoleInitKey, (int)sizeof(int));
+ consoleInitPtr = Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int));
if (*consoleInitPtr) {
- /* We've already initialized console channels in this thread. */
+ /*
+ * We've already initialized console channels in this thread.
+ */
+
return;
}
*consoleInitPtr = 1;
@@ -250,15 +253,16 @@ Tk_InitConsoleChannels(
if (!(doIn || doOut || doErr)) {
/*
- * No std channels should be tied to the console;
- * Thus, no need to create the console
+ * No std channels should be tied to the console; thus, no need to
+ * create the console.
*/
+
return;
}
/*
- * At least one std channel wants to be tied to the console,
- * so create the interp for it to live in.
+ * At least one std channel wants to be tied to the console, so create the
+ * interp for it to live in.
*/
info = (ConsoleInfo *) ckalloc(sizeof(ConsoleInfo));
@@ -268,18 +272,16 @@ Tk_InitConsoleChannels(
if (doIn) {
ChannelData *data = (ChannelData *) ckalloc(sizeof(ChannelData));
+
data->info = info;
data->info->refCount++;
data->type = TCL_STDIN;
consoleChannel = Tcl_CreateChannel(&consoleChannelType, "console0",
- (ClientData) data, TCL_READABLE);
+ data, TCL_READABLE);
if (consoleChannel != NULL) {
- Tcl_SetChannelOption(NULL, consoleChannel,
- "-translation", "lf");
- Tcl_SetChannelOption(NULL, consoleChannel,
- "-buffering", "none");
- Tcl_SetChannelOption(NULL, consoleChannel,
- "-encoding", "utf-8");
+ Tcl_SetChannelOption(NULL, consoleChannel, "-translation", "lf");
+ Tcl_SetChannelOption(NULL, consoleChannel, "-buffering", "none");
+ Tcl_SetChannelOption(NULL, consoleChannel, "-encoding", "utf-8");
}
Tcl_SetStdChannel(consoleChannel, TCL_STDIN);
Tcl_RegisterChannel(NULL, consoleChannel);
@@ -287,18 +289,16 @@ Tk_InitConsoleChannels(
if (doOut) {
ChannelData *data = (ChannelData *) ckalloc(sizeof(ChannelData));
+
data->info = info;
data->info->refCount++;
data->type = TCL_STDOUT;
consoleChannel = Tcl_CreateChannel(&consoleChannelType, "console1",
- (ClientData) data, TCL_WRITABLE);
+ data, TCL_WRITABLE);
if (consoleChannel != NULL) {
- Tcl_SetChannelOption(NULL, consoleChannel,
- "-translation", "lf");
- Tcl_SetChannelOption(NULL, consoleChannel,
- "-buffering", "none");
- Tcl_SetChannelOption(NULL, consoleChannel,
- "-encoding", "utf-8");
+ Tcl_SetChannelOption(NULL, consoleChannel, "-translation", "lf");
+ Tcl_SetChannelOption(NULL, consoleChannel, "-buffering", "none");
+ Tcl_SetChannelOption(NULL, consoleChannel, "-encoding", "utf-8");
}
Tcl_SetStdChannel(consoleChannel, TCL_STDOUT);
Tcl_RegisterChannel(NULL, consoleChannel);
@@ -306,18 +306,16 @@ Tk_InitConsoleChannels(
if (doErr) {
ChannelData *data = (ChannelData *) ckalloc(sizeof(ChannelData));
+
data->info = info;
data->info->refCount++;
data->type = TCL_STDERR;
consoleChannel = Tcl_CreateChannel(&consoleChannelType, "console2",
- (ClientData) data, TCL_WRITABLE);
+ data, TCL_WRITABLE);
if (consoleChannel != NULL) {
- Tcl_SetChannelOption(NULL, consoleChannel,
- "-translation", "lf");
- Tcl_SetChannelOption(NULL, consoleChannel,
- "-buffering", "none");
- Tcl_SetChannelOption(NULL, consoleChannel,
- "-encoding", "utf-8");
+ Tcl_SetChannelOption(NULL, consoleChannel, "-translation", "lf");
+ Tcl_SetChannelOption(NULL, consoleChannel, "-buffering", "none");
+ Tcl_SetChannelOption(NULL, consoleChannel, "-encoding", "utf-8");
}
Tcl_SetStdChannel(consoleChannel, TCL_STDERR);
Tcl_RegisterChannel(NULL, consoleChannel);
@@ -378,7 +376,7 @@ Tk_CreateConsoleWindow(
}
if (haveConsoleChannel) {
- ChannelData *data = (ChannelData *)Tcl_GetChannelInstanceData(chan);
+ ChannelData *data = (ChannelData *) Tcl_GetChannelInstanceData(chan);
info = data->info;
if (info->consoleInterp) {
/* New ConsoleInfo for a new console window */
@@ -388,21 +386,21 @@ Tk_CreateConsoleWindow(
/* Update any console channels to make use of the new console */
if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDIN))
== &consoleChannelType) {
- data = (ChannelData *)Tcl_GetChannelInstanceData(chan);
+ data = (ChannelData *) Tcl_GetChannelInstanceData(chan);
data->info->refCount--;
data->info = info;
data->info->refCount++;
}
if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDOUT))
== &consoleChannelType) {
- data = (ChannelData *)Tcl_GetChannelInstanceData(chan);
+ data = (ChannelData *) Tcl_GetChannelInstanceData(chan);
data->info->refCount--;
data->info = info;
data->info->refCount++;
}
if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDERR))
== &consoleChannelType) {
- data = (ChannelData *)Tcl_GetChannelInstanceData(chan);
+ data = (ChannelData *) Tcl_GetChannelInstanceData(chan);
data->info->refCount--;
data->info = info;
data->info->refCount++;
@@ -416,17 +414,16 @@ Tk_CreateConsoleWindow(
info->consoleInterp = consoleInterp;
info->interp = interp;
- Tcl_CallWhenDeleted(consoleInterp, InterpDeleteProc, (ClientData) info);
+ Tcl_CallWhenDeleted(consoleInterp, InterpDeleteProc, info);
info->refCount++;
- Tcl_CreateThreadExitHandler(DeleteConsoleInterp,
- (ClientData) consoleInterp);
+ Tcl_CreateThreadExitHandler(DeleteConsoleInterp, consoleInterp);
/*
* Add console commands to the interp
*/
- token = Tcl_CreateObjCommand(interp, "console", ConsoleObjCmd,
- (ClientData) info, ConsoleDeleteProc);
+ token = Tcl_CreateObjCommand(interp, "console", ConsoleObjCmd, info,
+ ConsoleDeleteProc);
info->refCount++;
/*
@@ -435,29 +432,29 @@ Tk_CreateConsoleWindow(
* handler takes care of us.
*/
Tcl_CreateObjCommand(consoleInterp, "consoleinterp", InterpreterObjCmd,
- (ClientData) info, NULL);
+ info, NULL);
mainWindow = Tk_MainWindow(interp);
if (mainWindow) {
Tk_CreateEventHandler(mainWindow, StructureNotifyMask,
- ConsoleEventProc, (ClientData) info);
+ ConsoleEventProc, info);
info->refCount++;
}
- Tcl_Preserve((ClientData) consoleInterp);
+ Tcl_Preserve(consoleInterp);
result = Tcl_GlobalEval(consoleInterp, "source $tk_library/console.tcl");
if (result == TCL_ERROR) {
Tcl_SetReturnOptions(interp,
Tcl_GetReturnOptions(consoleInterp, result));
Tcl_SetObjResult(interp, Tcl_GetObjResult(consoleInterp));
}
- Tcl_Release((ClientData) consoleInterp);
+ Tcl_Release(consoleInterp);
if (result == TCL_ERROR) {
Tcl_DeleteCommandFromToken(interp, token);
mainWindow = Tk_MainWindow(interp);
if (mainWindow) {
Tk_DeleteEventHandler(mainWindow, StructureNotifyMask,
- ConsoleEventProc, (ClientData) info);
+ ConsoleEventProc, info);
if (--info->refCount <= 0) {
ckfree((char *) info);
}
@@ -466,7 +463,7 @@ Tk_CreateConsoleWindow(
}
return TCL_OK;
- error:
+ error:
Tcl_AddErrorInfo(interp, "\n (creating console window)");
if (!Tcl_InterpDeleted(consoleInterp)) {
Tcl_DeleteInterp(consoleInterp);
@@ -495,11 +492,11 @@ Tk_CreateConsoleWindow(
static int
ConsoleOutput(
ClientData instanceData, /* Indicates which device to use. */
- CONST char *buf, /* The data buffer. */
+ const char *buf, /* The data buffer. */
int toWrite, /* How many bytes to write? */
int *errorCode) /* Where to store error code. */
{
- ChannelData *data = (ChannelData *)instanceData;
+ ChannelData *data = instanceData;
ConsoleInfo *info = data->info;
*errorCode = 0;
@@ -510,6 +507,7 @@ ConsoleOutput(
if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) {
Tcl_Obj *cmd = Tcl_NewStringObj("tk::ConsoleOutput", -1);
+
if (data->type == TCL_STDERR) {
Tcl_ListObjAppendElement(NULL, cmd,
Tcl_NewStringObj("stderr", -1));
@@ -517,7 +515,8 @@ ConsoleOutput(
Tcl_ListObjAppendElement(NULL, cmd,
Tcl_NewStringObj("stdout", -1));
}
- Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj(buf, toWrite));
+ Tcl_ListObjAppendElement(NULL, cmd,
+ Tcl_NewStringObj(buf, toWrite));
Tcl_IncrRefCount(cmd);
Tcl_GlobalEvalObj(consoleInterp, cmd);
Tcl_DecrRefCount(cmd);
@@ -576,12 +575,15 @@ ConsoleClose(
ClientData instanceData, /* Unused. */
Tcl_Interp *interp) /* Unused. */
{
- ChannelData *data = (ChannelData *)instanceData;
+ ChannelData *data = instanceData;
ConsoleInfo *info = data->info;
if (info) {
if (--info->refCount <= 0) {
- /* Assuming the Tcl_Interp * fields must already be NULL */
+ /*
+ * Assuming the Tcl_Interp * fields must already be NULL.
+ */
+
ckfree((char *) info);
}
}
@@ -668,10 +670,10 @@ ConsoleObjCmd(
ClientData clientData, /* Access to the console interp */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
- Tcl_Obj *CONST objv[]) /* Argument objects */
+ Tcl_Obj *const objv[]) /* Argument objects */
{
int index, result;
- static CONST char *options[] = {"eval", "hide", "show", "title", NULL};
+ static const char *options[] = {"eval", "hide", "show", "title", NULL};
enum option {CON_EVAL, CON_HIDE, CON_SHOW, CON_TITLE};
Tcl_Obj *cmd = NULL;
ConsoleInfo *info = (ConsoleInfo *) clientData;
@@ -722,12 +724,12 @@ ConsoleObjCmd(
Tcl_IncrRefCount(cmd);
if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) {
- Tcl_Preserve((ClientData) consoleInterp);
+ Tcl_Preserve(consoleInterp);
result = Tcl_GlobalEvalObj(consoleInterp, cmd);
Tcl_SetReturnOptions(interp,
Tcl_GetReturnOptions(consoleInterp, result));
Tcl_SetObjResult(interp, Tcl_GetObjResult(consoleInterp));
- Tcl_Release((ClientData) consoleInterp);
+ Tcl_Release(consoleInterp);
} else {
Tcl_AppendResult(interp, "no active console interp", NULL);
result = TCL_ERROR;
@@ -755,12 +757,12 @@ InterpreterObjCmd(
ClientData clientData, /* */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
- Tcl_Obj *CONST objv[]) /* Argument objects */
+ Tcl_Obj *const objv[]) /* Argument objects */
{
int index, result = TCL_OK;
- static CONST char *options[] = {"eval", "record", NULL};
+ static const char *options[] = {"eval", "record", NULL};
enum option {OTHER_EVAL, OTHER_RECORD};
- ConsoleInfo *info = (ConsoleInfo *) clientData;
+ ConsoleInfo *info = clientData;
Tcl_Interp *otherInterp = info->interp;
if (objc < 2) {
@@ -782,28 +784,32 @@ InterpreterObjCmd(
return TCL_ERROR;
}
- Tcl_Preserve((ClientData) otherInterp);
+ Tcl_Preserve(otherInterp);
switch ((enum option) index) {
case OTHER_EVAL:
result = Tcl_GlobalEvalObj(otherInterp, objv[2]);
+
/*
* TODO: Should exceptions be filtered here?
*/
+
Tcl_SetReturnOptions(interp,
Tcl_GetReturnOptions(otherInterp, result));
Tcl_SetObjResult(interp, Tcl_GetObjResult(otherInterp));
break;
case OTHER_RECORD:
Tcl_RecordAndEvalObj(otherInterp, objv[2], TCL_EVAL_GLOBAL);
+
/*
- * By not setting result, we discard any exceptions or errors here
- * and always return TCL_OK. All the caller wants is the
- * interp result to display, whether that's result or error message.
+ * By not setting result, we discard any exceptions or errors here and
+ * always return TCL_OK. All the caller wants is the interp result to
+ * display, whether that's result or error message.
*/
+
Tcl_SetObjResult(interp, Tcl_GetObjResult(otherInterp));
break;
}
- Tcl_Release((ClientData) otherInterp);
+ Tcl_Release(otherInterp);
return result;
}
@@ -812,8 +818,8 @@ InterpreterObjCmd(
*
* DeleteConsoleInterp --
*
- * Thread exit handler to destroy a console interp when the
- * thread it lives in gets torn down.
+ * Thread exit handler to destroy a console interp when the thread it
+ * lives in gets torn down.
*
*----------------------------------------------------------------------
*/
@@ -822,7 +828,8 @@ static void
DeleteConsoleInterp(
ClientData clientData)
{
- Tcl_Interp *interp = (Tcl_Interp *)clientData;
+ Tcl_Interp *interp = clientData;
+
Tcl_DeleteInterp(interp);
}
@@ -831,8 +838,8 @@ DeleteConsoleInterp(
*
* InterpDeleteProc --
*
- * React when the interp in which the console is displayed is deleted
- * for any reason.
+ * React when the interp in which the console is displayed is deleted for
+ * any reason.
*
* Results:
* None.
@@ -848,11 +855,10 @@ InterpDeleteProc(
ClientData clientData,
Tcl_Interp *interp)
{
- ConsoleInfo *info = (ConsoleInfo *) clientData;
+ ConsoleInfo *info = clientData;
if (info->consoleInterp == interp) {
- Tcl_DeleteThreadExitHandler(DeleteConsoleInterp,
- (ClientData) info->consoleInterp);
+ Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp);
info->consoleInterp = NULL;
}
if (--info->refCount <= 0) {
@@ -881,7 +887,7 @@ static void
ConsoleDeleteProc(
ClientData clientData)
{
- ConsoleInfo *info = (ConsoleInfo *) clientData;
+ ConsoleInfo *info = clientData;
if (info->consoleInterp) {
Tcl_DeleteInterp(info->consoleInterp);
@@ -916,7 +922,7 @@ ConsoleEventProc(
XEvent *eventPtr)
{
if (eventPtr->type == DestroyNotify) {
- ConsoleInfo *info = (ConsoleInfo *) clientData;
+ ConsoleInfo *info = clientData;
Tcl_Interp *consoleInterp = info->consoleInterp;
if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) {
diff --git a/generic/tkCursor.c b/generic/tkCursor.c
index 8837028..d4e112d 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.18 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkCursor.c,v 1.19 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -25,8 +25,8 @@
*/
typedef struct {
- CONST char *source; /* Cursor bits. */
- CONST char *mask; /* Mask bits. */
+ const char *source; /* Cursor bits. */
+ const char *mask; /* Mask bits. */
int width, height; /* Dimensions of cursor (and data and
* mask). */
int xHot, yHot; /* Location of cursor hot-spot. */
@@ -43,8 +43,8 @@ static void DupCursorObjProc(Tcl_Obj *srcObjPtr,
Tcl_Obj *dupObjPtr);
static void FreeCursor(TkCursor *cursorPtr);
static void FreeCursorObjProc(Tcl_Obj *objPtr);
-static TkCursor * TkcGetCursor(Tcl_Interp *interp,
- Tk_Window tkwin, CONST char *name);
+static TkCursor * TkcGetCursor(Tcl_Interp *interp, Tk_Window tkwin,
+ const char *name);
static TkCursor * GetCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr);
static void InitCursorObj(Tcl_Obj *objPtr);
@@ -101,7 +101,7 @@ Tk_AllocCursorFromObj(
if (objPtr->typePtr != &tkCursorObjType) {
InitCursorObj(objPtr);
}
- cursorPtr = (TkCursor *) objPtr->internalRep.twoPtrValue.ptr1;
+ cursorPtr = objPtr->internalRep.twoPtrValue.ptr1;
/*
* If the object currently points to a TkCursor, see if it's the one we
@@ -130,15 +130,15 @@ Tk_AllocCursorFromObj(
*/
if (cursorPtr != NULL) {
- TkCursor *firstCursorPtr = (TkCursor *)
- Tcl_GetHashValue(cursorPtr->hashPtr);
+ TkCursor *firstCursorPtr = Tcl_GetHashValue(cursorPtr->hashPtr);
+
FreeCursorObjProc(objPtr);
for (cursorPtr = firstCursorPtr; cursorPtr != NULL;
cursorPtr = cursorPtr->nextPtr) {
if (Tk_Display(tkwin) == cursorPtr->display) {
cursorPtr->resourceRefCount++;
cursorPtr->objRefCount++;
- objPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = cursorPtr;
return cursorPtr->cursor;
}
}
@@ -149,7 +149,7 @@ Tk_AllocCursorFromObj(
*/
cursorPtr = TkcGetCursor(interp, tkwin, Tcl_GetString(objPtr));
- objPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = cursorPtr;
if (cursorPtr == NULL) {
return None;
}
@@ -189,6 +189,7 @@ Tk_GetCursor(
* details on legal syntax. */
{
TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string);
+
if (cursorPtr == NULL) {
return None;
}
@@ -225,7 +226,7 @@ static TkCursor *
TkcGetCursor(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
Tk_Window tkwin, /* Window in which cursor will be used. */
- CONST char *string) /* Description of cursor. See manual entry for
+ const char *string) /* Description of cursor. See manual entry for
* details on legal syntax. */
{
Tcl_HashEntry *nameHashPtr;
@@ -241,7 +242,7 @@ TkcGetCursor(
nameHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorNameTable,
string, &isNew);
if (!isNew) {
- existingCursorPtr = (TkCursor *) Tcl_GetHashValue(nameHashPtr);
+ existingCursorPtr = Tcl_GetHashValue(nameHashPtr);
for (cursorPtr = existingCursorPtr; cursorPtr != NULL;
cursorPtr = cursorPtr->nextPtr) {
if (Tk_Display(tkwin) == cursorPtr->display) {
@@ -311,8 +312,8 @@ Tk_Cursor
Tk_GetCursorFromData(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
Tk_Window tkwin, /* Window in which cursor will be used. */
- CONST char *source, /* Bitmap data for cursor shape. */
- CONST char *mask, /* Bitmap data for cursor mask. */
+ const char *source, /* Bitmap data for cursor shape. */
+ const char *mask, /* Bitmap data for cursor mask. */
int width, int height, /* Dimensions of cursor. */
int xHot, int yHot, /* Location of hot-spot in cursor. */
Tk_Uid fg, /* Foreground color for cursor. */
@@ -341,7 +342,7 @@ Tk_GetCursorFromData(
dataHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorDataTable,
(char *) &dataKey, &isNew);
if (!isNew) {
- cursorPtr = (TkCursor *) Tcl_GetHashValue(dataHashPtr);
+ cursorPtr = Tcl_GetHashValue(dataHashPtr);
cursorPtr->resourceRefCount++;
return cursorPtr->cursor;
}
@@ -407,7 +408,7 @@ Tk_GetCursorFromData(
*--------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_NameOfCursor(
Display *display, /* Display for which cursor was allocated. */
Tk_Cursor cursor) /* Identifier for cursor whose name is
@@ -428,7 +429,7 @@ Tk_NameOfCursor(
if (idHashPtr == NULL) {
goto printid;
}
- cursorPtr = (TkCursor *) Tcl_GetHashValue(idHashPtr);
+ cursorPtr = Tcl_GetHashValue(idHashPtr);
if (cursorPtr->otherTable != &dispPtr->cursorNameTable) {
goto printid;
}
@@ -465,7 +466,7 @@ FreeCursor(
}
Tcl_DeleteHashEntry(cursorPtr->idHashPtr);
- prevPtr = (TkCursor *) Tcl_GetHashValue(cursorPtr->hashPtr);
+ prevPtr = Tcl_GetHashValue(cursorPtr->hashPtr);
if (prevPtr == cursorPtr) {
if (cursorPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(cursorPtr->hashPtr);
@@ -518,7 +519,7 @@ Tk_FreeCursor(
if (idHashPtr == NULL) {
Tcl_Panic("Tk_FreeCursor received unknown cursor argument");
}
- FreeCursor((TkCursor *) Tcl_GetHashValue(idHashPtr));
+ FreeCursor(Tcl_GetHashValue(idHashPtr));
}
/*
@@ -575,7 +576,7 @@ static void
FreeCursorObjProc(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
- TkCursor *cursorPtr = (TkCursor *) objPtr->internalRep.twoPtrValue.ptr1;
+ TkCursor *cursorPtr = objPtr->internalRep.twoPtrValue.ptr1;
if (cursorPtr != NULL) {
cursorPtr->objRefCount--;
@@ -610,10 +611,10 @@ DupCursorObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- TkCursor *cursorPtr = (TkCursor *) srcObjPtr->internalRep.twoPtrValue.ptr1;
+ TkCursor *cursorPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
- dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr;
+ dupObjPtr->internalRep.twoPtrValue.ptr1 = cursorPtr;
if (cursorPtr != NULL) {
cursorPtr->objRefCount++;
@@ -695,7 +696,7 @@ GetCursorFromObj(
* cached is the one that is needed.
*/
- cursorPtr = (TkCursor *) objPtr->internalRep.twoPtrValue.ptr1;
+ cursorPtr = objPtr->internalRep.twoPtrValue.ptr1;
if ((cursorPtr != NULL) && (Tk_Display(tkwin) == cursorPtr->display)) {
return cursorPtr;
}
@@ -710,11 +711,11 @@ GetCursorFromObj(
if (hashPtr == NULL) {
goto error;
}
- for (cursorPtr = (TkCursor *) Tcl_GetHashValue(hashPtr);
+ for (cursorPtr = Tcl_GetHashValue(hashPtr);
cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) {
if (Tk_Display(tkwin) == cursorPtr->display) {
FreeCursorObjProc(objPtr);
- objPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = cursorPtr;
cursorPtr->objRefCount++;
return cursorPtr;
}
@@ -845,7 +846,7 @@ TkDebugCursor(
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable, name);
if (hashPtr != NULL) {
- cursorPtr = (TkCursor *) Tcl_GetHashValue(hashPtr);
+ cursorPtr = Tcl_GetHashValue(hashPtr);
if (cursorPtr == NULL) {
Tcl_Panic("TkDebugCursor found empty hash table entry");
}
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 62b0806..25126bc 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkEntry.c,v 1.47 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkEntry.c,v 1.48 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -319,7 +319,7 @@ static const Tk_OptionSpec sbOptSpec[] = {
* dispatch the entry widget command.
*/
-static CONST char *entryCmdNames[] = {
+static const char *entryCmdNames[] = {
"bbox", "cget", "configure", "delete", "get", "icursor", "index",
"insert", "scan", "selection", "validate", "xview", NULL
};
@@ -330,7 +330,7 @@ enum entryCmd {
COMMAND_SCAN, COMMAND_SELECTION, COMMAND_VALIDATE, COMMAND_XVIEW
};
-static CONST char *selCmdNames[] = {
+static const char *selCmdNames[] = {
"adjust", "clear", "from", "present", "range", "to", NULL
};
@@ -345,7 +345,7 @@ enum selCmd {
* dispatch the spinbox widget command.
*/
-static CONST char *sbCmdNames[] = {
+static const char *sbCmdNames[] = {
"bbox", "cget", "configure", "delete", "get", "icursor", "identify",
"index", "insert", "invoke", "scan", "selection", "set",
"validate", "xview", NULL
@@ -358,7 +358,7 @@ enum sbCmd {
SB_CMD_SET, SB_CMD_VALIDATE, SB_CMD_XVIEW
};
-static CONST char *sbSelCmdNames[] = {
+static const char *sbSelCmdNames[] = {
"adjust", "clear", "element", "from", "present", "range", "to", NULL
};
@@ -376,7 +376,7 @@ enum sbselCmd {
* modify them, you must modify the strings here.
*/
-static CONST char *selElementNames[] = {
+static const char *selElementNames[] = {
"none", "buttondown", "buttonup", NULL, "entry"
};
@@ -392,7 +392,7 @@ static CONST char *selElementNames[] = {
*/
static int ConfigureEntry(Tcl_Interp *interp, Entry *entryPtr,
- int objc, Tcl_Obj *CONST objv[], int flags);
+ int objc, Tcl_Obj *const objv[], int flags);
static void DeleteChars(Entry *entryPtr, int index, int count);
static void DestroyEntry(char *memPtr);
static void DisplayEntry(ClientData clientData);
@@ -407,25 +407,25 @@ static int EntryFetchSelection(ClientData clientData, int offset,
static void EntryLostSelection(ClientData clientData);
static void EventuallyRedraw(Entry *entryPtr);
static void EntryScanTo(Entry *entryPtr, int y);
-static void EntrySetValue(Entry *entryPtr, CONST char *value);
+static void EntrySetValue(Entry *entryPtr, const char *value);
static void EntrySelectTo(Entry *entryPtr, int index);
static char * EntryTextVarProc(ClientData clientData,
- Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags);
+ Tcl_Interp *interp, const char *name1,
+ const char *name2, int flags);
static void EntryUpdateScrollbar(Entry *entryPtr);
static int EntryValidate(Entry *entryPtr, char *cmd);
static int EntryValidateChange(Entry *entryPtr, char *change,
- CONST char *newStr, int index, int type);
-static void ExpandPercents(Entry *entryPtr, CONST char *before,
- CONST char *change, CONST char *newStr, int index,
+ const char *newStr, int index, int type);
+static void ExpandPercents(Entry *entryPtr, const char *before,
+ const char *change, const char *newStr, int index,
int type, Tcl_DString *dsPtr);
static void EntryValueChanged(Entry *entryPtr,
- CONST char *newValue);
+ const char *newValue);
static void EntryVisibleRange(Entry *entryPtr,
double *firstPtr, double *lastPtr);
static int EntryWidgetObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static void EntryWorldChanged(ClientData instanceData);
static int GetEntryIndex(Tcl_Interp *interp, Entry *entryPtr,
char *string, int *indexPtr);
@@ -437,7 +437,7 @@ static void InsertChars(Entry *entryPtr, int index, char *string);
static int SpinboxWidgetObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int GetSpinboxElement(Spinbox *sbPtr, int x, int y);
static int SpinboxInvoke(Tcl_Interp *interp, Spinbox *sbPtr,
int element);
@@ -476,7 +476,7 @@ Tk_EntryObjCmd(
ClientData clientData, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register Entry *entryPtr;
Tk_OptionTable optionTable;
@@ -515,11 +515,11 @@ Tk_EntryObjCmd(
entryPtr->display = Tk_Display(tkwin);
entryPtr->interp = interp;
entryPtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(entryPtr->tkwin), EntryWidgetObjCmd,
- (ClientData) entryPtr, EntryCmdDeletedProc);
+ Tk_PathName(entryPtr->tkwin), EntryWidgetObjCmd, entryPtr,
+ EntryCmdDeletedProc);
entryPtr->optionTable = optionTable;
entryPtr->type = TK_ENTRY;
- tmp = (char *) ckalloc(1);
+ tmp = ckalloc(1);
tmp[0] = '\0';
entryPtr->string = tmp;
entryPtr->selectFirst = -1;
@@ -543,15 +543,15 @@ Tk_EntryObjCmd(
* otherwise Tk might free it while we still need it.
*/
- Tcl_Preserve((ClientData) entryPtr->tkwin);
+ Tcl_Preserve(entryPtr->tkwin);
Tk_SetClass(entryPtr->tkwin, "Entry");
- Tk_SetClassProcs(entryPtr->tkwin, &entryClass, (ClientData) entryPtr);
+ Tk_SetClassProcs(entryPtr->tkwin, &entryClass, entryPtr);
Tk_CreateEventHandler(entryPtr->tkwin,
ExposureMask|StructureNotifyMask|FocusChangeMask,
- EntryEventProc, (ClientData) entryPtr);
+ EntryEventProc, entryPtr);
Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING,
- EntryFetchSelection, (ClientData) entryPtr, XA_STRING);
+ EntryFetchSelection, entryPtr, XA_STRING);
if ((Tk_InitOptions(interp, (char *) entryPtr, optionTable, tkwin)
!= TCL_OK) ||
@@ -587,9 +587,9 @@ EntryWidgetObjCmd(
ClientData clientData, /* Information about entry widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- Entry *entryPtr = (Entry *) clientData;
+ Entry *entryPtr = clientData;
int cmdIndex, selIndex, result;
Tcl_Obj *objPtr;
@@ -603,13 +603,13 @@ EntryWidgetObjCmd(
* valid command names.
*/
- result = Tcl_GetIndexFromObj(interp, objv[1], entryCmdNames,
- "option", 0, &cmdIndex);
+ result = Tcl_GetIndexFromObj(interp, objv[1], entryCmdNames, "option", 0,
+ &cmdIndex);
if (result != TCL_OK) {
return result;
}
- Tcl_Preserve((ClientData) entryPtr);
+ Tcl_Preserve(entryPtr);
switch ((enum entryCmd) cmdIndex) {
case COMMAND_BBOX: {
int index, x, y, width, height;
@@ -882,7 +882,7 @@ EntryWidgetObjCmd(
if (!(entryPtr->flags & GOT_SELECTION)
&& (entryPtr->exportSelection)) {
Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY,
- EntryLostSelection, (ClientData) entryPtr);
+ EntryLostSelection, entryPtr);
entryPtr->flags |= GOT_SELECTION;
}
EventuallyRedraw(entryPtr);
@@ -980,11 +980,11 @@ EntryWidgetObjCmd(
}
done:
- Tcl_Release((ClientData) entryPtr);
+ Tcl_Release(entryPtr);
return result;
error:
- Tcl_Release((ClientData) entryPtr);
+ Tcl_Release(entryPtr);
return TCL_ERROR;
}
@@ -1021,7 +1021,7 @@ DestroyEntry(
if (entryPtr->textVarName != NULL) {
Tcl_UntraceVar(entryPtr->interp, entryPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- EntryTextVarProc, (ClientData) entryPtr);
+ EntryTextVarProc, entryPtr);
entryPtr->flags &= ~ENTRY_VAR_TRACED;
}
if (entryPtr->textGC != None) {
@@ -1048,7 +1048,7 @@ DestroyEntry(
Tk_FreeTextLayout(entryPtr->textLayout);
Tk_FreeConfigOptions((char *) entryPtr, entryPtr->optionTable,
entryPtr->tkwin);
- Tcl_Release((ClientData) entryPtr->tkwin);
+ Tcl_Release(entryPtr->tkwin);
entryPtr->tkwin = NULL;
ckfree((char *) entryPtr);
@@ -1080,7 +1080,7 @@ ConfigureEntry(
Entry *entryPtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[], /* Argument objects. */
+ Tcl_Obj *const objv[], /* Argument objects. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
Tk_SavedOptions savedOptions;
@@ -1105,7 +1105,7 @@ ConfigureEntry(
&& (entryPtr->flags & ENTRY_VAR_TRACED)) {
Tcl_UntraceVar(interp, entryPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- EntryTextVarProc, (ClientData) entryPtr);
+ EntryTextVarProc, entryPtr);
entryPtr->flags &= ~ENTRY_VAR_TRACED;
}
@@ -1266,7 +1266,7 @@ ConfigureEntry(
&& (entryPtr->selectFirst != -1)
&& !(entryPtr->flags & GOT_SELECTION)) {
Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection,
- (ClientData) entryPtr);
+ entryPtr);
entryPtr->flags |= GOT_SELECTION;
}
@@ -1294,7 +1294,7 @@ ConfigureEntry(
*/
if (entryPtr->textVarName != NULL) {
- CONST char *value;
+ const char *value;
value = Tcl_GetVar(interp, entryPtr->textVarName, TCL_GLOBAL_ONLY);
if (value == NULL) {
@@ -1355,11 +1355,11 @@ ConfigureEntry(
&& !(entryPtr->flags & ENTRY_VAR_TRACED)) {
Tcl_TraceVar(interp, entryPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- EntryTextVarProc, (ClientData) entryPtr);
+ EntryTextVarProc, entryPtr);
entryPtr->flags |= ENTRY_VAR_TRACED;
}
- EntryWorldChanged((ClientData) entryPtr);
+ EntryWorldChanged(entryPtr);
if (error) {
Tcl_SetObjResult(interp, errorResult);
Tcl_DecrRefCount(errorResult);
@@ -1548,7 +1548,7 @@ static void
DisplayEntry(
ClientData clientData) /* Information about window. */
{
- Entry *entryPtr = (Entry *) clientData;
+ Entry *entryPtr = clientData;
Tk_Window tkwin = entryPtr->tkwin;
int baseY, selStartX, selEndX, cursorX;
int showSelection, xBound;
@@ -1575,14 +1575,14 @@ DisplayEntry(
* side-effect of destroying or unmapping the entry widget.
*/
- Tcl_Preserve((ClientData) entryPtr);
+ Tcl_Preserve(entryPtr);
EntryUpdateScrollbar(entryPtr);
if ((entryPtr->flags & ENTRY_DELETED) || !Tk_IsMapped(tkwin)) {
- Tcl_Release((ClientData) entryPtr);
+ Tcl_Release(entryPtr);
return;
}
- Tcl_Release((ClientData) entryPtr);
+ Tcl_Release(entryPtr);
}
#ifndef TK_NO_DOUBLE_BUFFERING
@@ -2011,7 +2011,7 @@ InsertChars(
ptrdiff_t byteIndex;
size_t byteCount, newByteCount;
int oldChars, charsAdded;
- CONST char *string;
+ const char *string;
char *newStr;
string = entryPtr->string;
@@ -2107,7 +2107,7 @@ DeleteChars(
int count) /* How many characters to delete. */
{
int byteIndex, byteCount, newByteCount;
- CONST char *string;
+ const char *string;
char *newStr, *toDelete;
if ((index + count) > entryPtr->numChars) {
@@ -2219,7 +2219,7 @@ DeleteChars(
static void
EntryValueChanged(
Entry *entryPtr, /* Entry whose value just changed. */
- CONST char *newValue) /* If this value is not NULL, we first force
+ const char *newValue) /* If this value is not NULL, we first force
* the value of the entry to this. */
{
if (newValue != NULL) {
@@ -2279,9 +2279,9 @@ EntryValueChanged(
static void
EntrySetValue(
Entry *entryPtr, /* Entry whose value is to be changed. */
- CONST char *value) /* New text to display in entry. */
+ const char *value) /* New text to display in entry. */
{
- CONST char *oldSource;
+ const char *oldSource;
int valueLen, malloced = 0;
if (strcmp(value, entryPtr->string) == 0) {
@@ -2387,10 +2387,10 @@ EntryEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- Entry *entryPtr = (Entry *) clientData;
+ Entry *entryPtr = clientData;
if ((entryPtr->type == TK_SPINBOX) && (eventPtr->type == MotionNotify)) {
- Spinbox *sbPtr = (Spinbox *) clientData;
+ Spinbox *sbPtr = clientData;
int elem;
elem = GetSpinboxElement(sbPtr, eventPtr->xmotion.x,
@@ -2431,11 +2431,11 @@ EntryEventProc(
}
break;
case ConfigureNotify:
- Tcl_Preserve((ClientData) entryPtr);
+ Tcl_Preserve(entryPtr);
entryPtr->flags |= UPDATE_SCROLLBAR;
EntryComputeGeometry(entryPtr);
EventuallyRedraw(entryPtr);
- Tcl_Release((ClientData) entryPtr);
+ Tcl_Release(entryPtr);
break;
case FocusIn:
case FocusOut:
@@ -2468,7 +2468,7 @@ static void
EntryCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- Entry *entryPtr = (Entry *) clientData;
+ Entry *entryPtr = clientData;
/*
* This function could be invoked either because the window was destroyed
@@ -2691,7 +2691,7 @@ EntrySelectTo(
if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection)) {
Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection,
- (ClientData) entryPtr);
+ entryPtr);
entryPtr->flags |= GOT_SELECTION;
}
@@ -2751,10 +2751,10 @@ EntryFetchSelection(
int maxBytes) /* Maximum number of bytes to place at buffer,
* not including terminating NUL character. */
{
- Entry *entryPtr = (Entry *) clientData;
+ Entry *entryPtr = clientData;
int byteCount;
- CONST char *string;
- CONST char *selStart, *selEnd;
+ const char *string;
+ const char *selStart, *selEnd;
if ((entryPtr->selectFirst < 0) || !(entryPtr->exportSelection)) {
return -1;
@@ -2797,7 +2797,7 @@ static void
EntryLostSelection(
ClientData clientData) /* Information about entry widget. */
{
- Entry *entryPtr = (Entry *) clientData;
+ Entry *entryPtr = clientData;
entryPtr->flags &= ~GOT_SELECTION;
@@ -2851,7 +2851,7 @@ EventuallyRedraw(
if (!(entryPtr->flags & REDRAW_PENDING)) {
entryPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayEntry, (ClientData) entryPtr);
+ Tcl_DoWhenIdle(DisplayEntry, entryPtr);
}
}
@@ -2938,7 +2938,7 @@ EntryUpdateScrollbar(
}
interp = entryPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
EntryVisibleRange(entryPtr, &first, &last);
sprintf(args, " %g %g", first, last);
code = Tcl_VarEval(interp, entryPtr->scrollCmd, args, NULL);
@@ -2950,7 +2950,7 @@ EntryUpdateScrollbar(
Tcl_BackgroundError(interp);
}
Tcl_SetResult(interp, NULL, TCL_STATIC);
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
/*
@@ -2975,7 +2975,7 @@ static void
EntryBlinkProc(
ClientData clientData) /* Pointer to record describing entry. */
{
- Entry *entryPtr = (Entry *) clientData;
+ Entry *entryPtr = clientData;
if ((entryPtr->state == STATE_DISABLED) ||
(entryPtr->state == STATE_READONLY) ||
@@ -2985,11 +2985,11 @@ EntryBlinkProc(
if (entryPtr->flags & CURSOR_ON) {
entryPtr->flags &= ~CURSOR_ON;
entryPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
- entryPtr->insertOffTime, EntryBlinkProc, (ClientData) entryPtr);
+ entryPtr->insertOffTime, EntryBlinkProc, entryPtr);
} else {
entryPtr->flags |= CURSOR_ON;
entryPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
- entryPtr->insertOnTime, EntryBlinkProc, (ClientData) entryPtr);
+ entryPtr->insertOnTime, EntryBlinkProc, entryPtr);
}
EventuallyRedraw(entryPtr);
}
@@ -3023,23 +3023,22 @@ EntryFocusProc(
entryPtr->flags |= GOT_FOCUS | CURSOR_ON;
if (entryPtr->insertOffTime != 0) {
entryPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
- entryPtr->insertOnTime, EntryBlinkProc,
- (ClientData) entryPtr);
+ entryPtr->insertOnTime, EntryBlinkProc, entryPtr);
}
if (entryPtr->validate == VALIDATE_ALL ||
- entryPtr->validate == VALIDATE_FOCUS ||
- entryPtr->validate == VALIDATE_FOCUSIN) {
- EntryValidateChange(entryPtr, NULL,
- entryPtr->string, -1, VALIDATE_FOCUSIN);
+ entryPtr->validate == VALIDATE_FOCUS ||
+ entryPtr->validate == VALIDATE_FOCUSIN) {
+ EntryValidateChange(entryPtr, NULL, entryPtr->string, -1,
+ VALIDATE_FOCUSIN);
}
} else {
entryPtr->flags &= ~(GOT_FOCUS | CURSOR_ON);
- entryPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
+ entryPtr->insertBlinkHandler = NULL;
if (entryPtr->validate == VALIDATE_ALL ||
- entryPtr->validate == VALIDATE_FOCUS ||
- entryPtr->validate == VALIDATE_FOCUSOUT) {
- EntryValidateChange(entryPtr, NULL,
- entryPtr->string, -1, VALIDATE_FOCUSOUT);
+ entryPtr->validate == VALIDATE_FOCUS ||
+ entryPtr->validate == VALIDATE_FOCUSOUT) {
+ EntryValidateChange(entryPtr, NULL, entryPtr->string, -1,
+ VALIDATE_FOCUSOUT);
}
}
EventuallyRedraw(entryPtr);
@@ -3067,12 +3066,12 @@ static char *
EntryTextVarProc(
ClientData clientData, /* Information about button. */
Tcl_Interp *interp, /* Interpreter containing variable. */
- CONST char *name1, /* Not used. */
- CONST char *name2, /* Not used. */
+ const char *name1, /* Not used. */
+ const char *name2, /* Not used. */
int flags) /* Information about what happened. */
{
- Entry *entryPtr = (Entry *) clientData;
- CONST char *value;
+ Entry *entryPtr = clientData;
+ const char *value;
if (entryPtr->flags & ENTRY_DELETED) {
/*
@@ -3197,7 +3196,7 @@ EntryValidateChange(
register Entry *entryPtr, /* Entry that needs validation. */
char *change, /* Characters to be added/deleted
* (NUL-terminated string). */
- CONST char *newValue, /* Potential new value of entry string */
+ const char *newValue, /* Potential new value of entry string */
int index, /* index of insert/delete, -1 otherwise */
int type) /* forced, delete, insert, focusin or
* focusout */
@@ -3331,12 +3330,12 @@ EntryValidateChange(
static void
ExpandPercents(
register Entry *entryPtr, /* Entry that needs validation. */
- register CONST char *before,
+ register const char *before,
/* Command containing percent expressions to
* be replaced. */
- CONST char *change, /* Characters to added/deleted (NUL-terminated
+ const char *change, /* Characters to added/deleted (NUL-terminated
* string). */
- CONST char *newValue, /* Potential new value of entry string */
+ const char *newValue, /* Potential new value of entry string */
int index, /* index of insert/delete */
int type, /* INSERT or DELETE */
Tcl_DString *dsPtr) /* Dynamic string in which to append new
@@ -3345,7 +3344,7 @@ ExpandPercents(
int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl
* list element. */
int number, length;
- register CONST char *string;
+ register const char *string;
Tcl_UniChar ch;
char numStorage[2*TCL_INTEGER_SPACE];
@@ -3498,7 +3497,7 @@ Tk_SpinboxObjCmd(
ClientData clientData, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register Entry *entryPtr;
register Spinbox *sbPtr;
@@ -3539,11 +3538,11 @@ Tk_SpinboxObjCmd(
entryPtr->display = Tk_Display(tkwin);
entryPtr->interp = interp;
entryPtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(entryPtr->tkwin), SpinboxWidgetObjCmd,
- (ClientData) sbPtr, EntryCmdDeletedProc);
+ Tk_PathName(entryPtr->tkwin), SpinboxWidgetObjCmd, sbPtr,
+ EntryCmdDeletedProc);
entryPtr->optionTable = optionTable;
entryPtr->type = TK_SPINBOX;
- tmp = (char *) ckalloc(1);
+ tmp = ckalloc(1);
tmp[0] = '\0';
entryPtr->string = tmp;
entryPtr->selectFirst = -1;
@@ -3570,7 +3569,7 @@ Tk_SpinboxObjCmd(
sbPtr->fromValue = 0.0;
sbPtr->toValue = 100.0;
sbPtr->increment = 1.0;
- sbPtr->formatBuf = (char *) ckalloc(TCL_DOUBLE_SPACE);
+ sbPtr->formatBuf = ckalloc(TCL_DOUBLE_SPACE);
sbPtr->bdRelief = TK_RELIEF_FLAT;
sbPtr->buRelief = TK_RELIEF_FLAT;
@@ -3579,15 +3578,15 @@ Tk_SpinboxObjCmd(
* otherwise Tk might free it while we still need it.
*/
- Tcl_Preserve((ClientData) entryPtr->tkwin);
+ Tcl_Preserve(entryPtr->tkwin);
Tk_SetClass(entryPtr->tkwin, "Spinbox");
- Tk_SetClassProcs(entryPtr->tkwin, &entryClass, (ClientData) entryPtr);
+ Tk_SetClassProcs(entryPtr->tkwin, &entryClass, entryPtr);
Tk_CreateEventHandler(entryPtr->tkwin,
PointerMotionMask|ExposureMask|StructureNotifyMask|FocusChangeMask,
- EntryEventProc, (ClientData) entryPtr);
+ EntryEventProc, entryPtr);
Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING,
- EntryFetchSelection, (ClientData) entryPtr, XA_STRING);
+ EntryFetchSelection, entryPtr, XA_STRING);
if (Tk_InitOptions(interp, (char *) sbPtr, optionTable, tkwin)
!= TCL_OK) {
@@ -3601,7 +3600,7 @@ Tk_SpinboxObjCmd(
Tcl_SetResult(interp, Tk_PathName(entryPtr->tkwin), TCL_STATIC);
return TCL_OK;
- error:
+ error:
Tk_DestroyWindow(entryPtr->tkwin);
return TCL_ERROR;
}
@@ -3629,10 +3628,10 @@ SpinboxWidgetObjCmd(
ClientData clientData, /* Information about spinbox widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- Entry *entryPtr = (Entry *) clientData;
- Spinbox *sbPtr = (Spinbox *) clientData;
+ Entry *entryPtr = clientData;
+ Spinbox *sbPtr = clientData;
int cmdIndex, selIndex, result;
Tcl_Obj *objPtr;
@@ -3652,7 +3651,7 @@ SpinboxWidgetObjCmd(
return result;
}
- Tcl_Preserve((ClientData) entryPtr);
+ Tcl_Preserve(entryPtr);
switch ((enum sbCmd) cmdIndex) {
case SB_CMD_BBOX: {
int index, x, y, width, height;
@@ -3669,8 +3668,7 @@ SpinboxWidgetObjCmd(
if ((index == entryPtr->numChars) && (index > 0)) {
index--;
}
- Tk_CharBbox(entryPtr->textLayout, index, &x, &y,
- &width, &height);
+ Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height);
sprintf(buf, "%d %d %d %d", x + entryPtr->layoutX,
y + entryPtr->layoutY, width, height);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
@@ -3695,8 +3693,7 @@ SpinboxWidgetObjCmd(
case SB_CMD_CONFIGURE:
if (objc <= 3) {
objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr,
- entryPtr->optionTable,
- (objc == 3) ? objv[2] : NULL,
+ entryPtr->optionTable, (objc == 3) ? objv[2] : NULL,
entryPtr->tkwin);
if (objPtr == NULL) {
goto error;
@@ -3738,6 +3735,7 @@ SpinboxWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, NULL);
goto error;
}
+ /* FIXME: modification of objresult */
Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
break;
@@ -3766,6 +3764,7 @@ SpinboxWidgetObjCmd(
}
elem = GetSpinboxElement(sbPtr, x, y);
if (elem != SEL_NONE) {
+ /* FIXME: modification of objresult */
Tcl_SetStringObj(Tcl_GetObjResult(interp),
selElementNames[elem], -1);
}
@@ -3962,9 +3961,9 @@ SpinboxWidgetObjCmd(
entryPtr->selectLast = index2;
}
if (!(entryPtr->flags & GOT_SELECTION)
- && (entryPtr->exportSelection)) {
+ && entryPtr->exportSelection) {
Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY,
- EntryLostSelection, (ClientData) entryPtr);
+ EntryLostSelection, entryPtr);
entryPtr->flags |= GOT_SELECTION;
}
EventuallyRedraw(entryPtr);
@@ -3988,6 +3987,7 @@ SpinboxWidgetObjCmd(
goto error;
}
if (objc == 3) {
+ /* FIXME: modification of objresult */
Tcl_SetStringObj(Tcl_GetObjResult(interp),
selElementNames[sbPtr->selElement], -1);
} else {
@@ -4015,6 +4015,7 @@ SpinboxWidgetObjCmd(
if (objc == 3) {
EntryValueChanged(entryPtr, Tcl_GetString(objv[2]));
}
+ /* FIXME: modification of objresult */
Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
break;
@@ -4032,6 +4033,7 @@ SpinboxWidgetObjCmd(
if (entryPtr->validate != VALIDATE_NONE) {
entryPtr->validate = selIndex;
}
+ /* FIXME: modification of objresult */
Tcl_SetObjResult(interp, Tcl_NewBooleanObj((code == TCL_OK)));
break;
}
@@ -4096,11 +4098,11 @@ SpinboxWidgetObjCmd(
}
done:
- Tcl_Release((ClientData) entryPtr);
+ Tcl_Release(entryPtr);
return result;
error:
- Tcl_Release((ClientData) entryPtr);
+ Tcl_Release(entryPtr);
return TCL_ERROR;
}
diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c
index 06e63d6..94cdbcd 100644
--- a/generic/tkFileFilter.c
+++ b/generic/tkFileFilter.c
@@ -9,19 +9,19 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkFileFilter.c,v 1.10 2007/05/09 12:51:30 das Exp $
+ * RCS: @(#) $Id: tkFileFilter.c,v 1.11 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
#include "tkFileFilter.h"
-static int AddClause(Tcl_Interp *interp,
- FileFilter *filterPtr, Tcl_Obj *patternsObj,
- Tcl_Obj *ostypesObj, int isWindows);
+static int AddClause(Tcl_Interp *interp, FileFilter *filterPtr,
+ Tcl_Obj *patternsObj, Tcl_Obj *ostypesObj,
+ int isWindows);
static void FreeClauses(FileFilter *filterPtr);
static void FreeGlobPatterns(FileFilterClause *clausePtr);
static void FreeMacFileTypes(FileFilterClause *clausePtr);
-static FileFilter * GetFilter(FileFilterList *flistPtr, CONST char *name);
+static FileFilter * GetFilter(FileFilterList *flistPtr, const char *name);
/*
*----------------------------------------------------------------------
@@ -169,8 +169,8 @@ TkFreeFileFilters(
toFree = filterPtr;
filterPtr = filterPtr->next;
FreeClauses(toFree);
- ckfree((char*)toFree->name);
- ckfree((char*)toFree);
+ ckfree(toFree->name);
+ ckfree((char *) toFree);
}
flistPtr->filters = NULL;
}
@@ -233,7 +233,7 @@ AddClause(
for (i=0; i<ostypeCount; i++) {
int len;
- CONST char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
+ const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
/*
* If len is < 4, it is definitely an error. If equal or longer,
@@ -273,10 +273,10 @@ AddClause(
* Add the clause into the list of clauses
*/
- clausePtr = (FileFilterClause*)ckalloc(sizeof(FileFilterClause));
- clausePtr->patterns = NULL;
+ clausePtr = (FileFilterClause *) ckalloc(sizeof(FileFilterClause));
+ clausePtr->patterns = NULL;
clausePtr->patternsTail = NULL;
- clausePtr->macTypes = NULL;
+ clausePtr->macTypes = NULL;
clausePtr->macTypesTail = NULL;
if (filterPtr->clauses == NULL) {
@@ -289,39 +289,39 @@ AddClause(
if (globCount > 0 && globList != NULL) {
for (i=0; i<globCount; i++) {
- GlobPattern *globPtr = (GlobPattern*)ckalloc(sizeof(GlobPattern));
+ GlobPattern *globPtr = (GlobPattern *)
+ ckalloc(sizeof(GlobPattern));
int len;
+ const char *str = Tcl_GetStringFromObj(globList[i], &len);
- CONST char *str = Tcl_GetStringFromObj(globList[i], &len);
len = (len + 1) * sizeof(char);
-
if (str[0] && str[0] != '*') {
/*
* Prepend a "*" to patterns that do not have a leading "*"
*/
- globPtr->pattern = (char*)ckalloc((unsigned int) len+1);
+ globPtr->pattern = ckalloc((unsigned) len+1);
globPtr->pattern[0] = '*';
strcpy(globPtr->pattern+1, str);
} else if (isWindows) {
if (strcmp(str, "*") == 0) {
- globPtr->pattern = (char*)ckalloc(4 * sizeof(char));
+ globPtr->pattern = ckalloc(4 * sizeof(char));
strcpy(globPtr->pattern, "*.*");
} else if (strcmp(str, "") == 0) {
/*
* An empty string means "match all files with no
* extensions"
- * BUG: "*." actually matches with all files on Win95
+ * TODO: "*." actually matches with all files on Win95
*/
- globPtr->pattern = (char *) ckalloc(3 * sizeof(char));
+ globPtr->pattern = ckalloc(3 * sizeof(char));
strcpy(globPtr->pattern, "*.");
} else {
- globPtr->pattern = (char *) ckalloc((unsigned int) len);
+ globPtr->pattern = ckalloc((unsigned) len);
strcpy(globPtr->pattern, str);
}
} else {
- globPtr->pattern = (char *) ckalloc((unsigned int) len);
+ globPtr->pattern = ckalloc((unsigned) len);
strcpy(globPtr->pattern, str);
}
@@ -346,7 +346,7 @@ AddClause(
Tcl_DString osTypeDS;
int len;
MacFileType *mfPtr = (MacFileType *) ckalloc(sizeof(MacFileType));
- CONST char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
+ const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
char *string;
/*
@@ -401,11 +401,12 @@ static FileFilter *
GetFilter(
FileFilterList *flistPtr, /* The FileFilterList that contains the newly
* created filter */
- CONST char *name) /* Name of the filter. It is usually displayed
+ const char *name) /* Name of the filter. It is usually displayed
* in the "File Types" listbox in the file
* dialogs. */
{
FileFilter *filterPtr = flistPtr->filters;
+ size_t len;
for (; filterPtr; filterPtr=filterPtr->next) {
if (strcmp(filterPtr->name, name) == 0) {
@@ -416,8 +417,9 @@ GetFilter(
filterPtr = (FileFilter *) ckalloc(sizeof(FileFilter));
filterPtr->clauses = NULL;
filterPtr->clausesTail = NULL;
- filterPtr->name = (char *) ckalloc((strlen(name)+1) * sizeof(char));
- strcpy(filterPtr->name, name);
+ len = (strlen(name) + 1) * sizeof(char);
+ filterPtr->name = ckalloc(len);
+ memcpy(filterPtr->name, name, len);
if (flistPtr->filters == NULL) {
flistPtr->filters = flistPtr->filtersTail = filterPtr;
@@ -436,7 +438,7 @@ GetFilter(
*
* FreeClauses --
*
- * Frees the malloc'ed file type clause
+ * Frees the malloc'ed file type clause.
*
* Results:
* None.
@@ -455,8 +457,8 @@ FreeClauses(
while (clausePtr != NULL) {
FileFilterClause *toFree = clausePtr;
- clausePtr = clausePtr->next;
+ clausePtr = clausePtr->next;
FreeGlobPatterns(toFree);
FreeMacFileTypes(toFree);
ckfree((char *) toFree);
@@ -491,7 +493,7 @@ FreeGlobPatterns(
GlobPattern *toFree = globPtr;
globPtr = globPtr->next;
- ckfree((char *) toFree->pattern);
+ ckfree(toFree->pattern);
ckfree((char *) toFree);
}
clausePtr->patterns = NULL;
@@ -516,12 +518,13 @@ FreeGlobPatterns(
static void
FreeMacFileTypes(
FileFilterClause *clausePtr)/* The clause whose mac types are to be
- * freed */
+ * freed. */
{
MacFileType *mfPtr = clausePtr->macTypes;
while (mfPtr != NULL) {
MacFileType *toFree = mfPtr;
+
mfPtr = mfPtr->next;
ckfree((char *) toFree);
}
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index e524c16..980a8e0 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.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: tkFocus.c,v 1.16 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkFocus.c,v 1.17 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -118,13 +118,13 @@ Tk_FocusObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- static CONST char *focusOptions[] = {
+ static const char *focusOptions[] = {
"-displayof", "-force", "-lastfor", NULL
};
- Tk_Window tkwin = (Tk_Window) clientData;
- TkWindow *winPtr = (TkWindow *) clientData;
+ Tk_Window tkwin = clientData;
+ TkWindow *winPtr = clientData;
TkWindow *newPtr, *focusWinPtr, *topLevelPtr;
ToplevelFocusInfo *tlFocusPtr;
char *windowName;
@@ -216,7 +216,7 @@ Tk_FocusObjCmd(
return TCL_ERROR;
}
for (topLevelPtr = newPtr; topLevelPtr != NULL;
- topLevelPtr = topLevelPtr->parentPtr) {
+ topLevelPtr = topLevelPtr->parentPtr) {
if (!(topLevelPtr->flags & TK_TOP_HIERARCHY)) {
continue;
}
@@ -393,7 +393,7 @@ TkFocusFilterEvent(
* tree, then ignore the event.
*/
- if (TkGrabState(winPtr) == TK_GRAB_EXCLUDED) {
+ if (TkGrabState(winPtr) == TK_GRAB_EXCLUDED) {
return retValue;
}
@@ -500,14 +500,14 @@ TkFocusFilterEvent(
} else if (eventPtr->type == LeaveNotify) {
/*
* If the pointer just left a window for which we automatically
- * claimed the focus on enter, move the focus back to the root
- * window, where it was before we claimed it above. Note:
+ * claimed the focus on enter, move the focus back to the root window,
+ * where it was before we claimed it above. Note:
* dispPtr->implicitWinPtr may not be the same as
- * displayFocusPtr->focusWinPtr (e.g. because the "focus" command
- * was used to redirect the focus after it arrived at
- * dispPtr->implicitWinPtr)!! In addition, we generate events
- * because the window manager won't give us a FocusOut event when
- * we focus on the root.
+ * displayFocusPtr->focusWinPtr (e.g. because the "focus" command was
+ * used to redirect the focus after it arrived at
+ * dispPtr->implicitWinPtr)!! In addition, we generate events because
+ * the window manager won't give us a FocusOut event when we focus on
+ * the root.
*/
if ((dispPtr->implicitWinPtr != NULL)
@@ -573,7 +573,7 @@ TkSetFocusWin(
*/
allMapped = 1;
- for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) {
+ for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) {
if (topLevelPtr == NULL) {
/*
* The window is being deleted. No point in worrying about giving
@@ -599,16 +599,14 @@ TkSetFocusWin(
*/
if (displayFocusPtr->focusOnMapPtr != NULL) {
- Tk_DeleteEventHandler(
- (Tk_Window) displayFocusPtr->focusOnMapPtr,
+ Tk_DeleteEventHandler((Tk_Window) displayFocusPtr->focusOnMapPtr,
StructureNotifyMask, FocusMapProc,
- (ClientData) displayFocusPtr->focusOnMapPtr);
+ displayFocusPtr->focusOnMapPtr);
displayFocusPtr->focusOnMapPtr = NULL;
}
if (!allMapped) {
- Tk_CreateEventHandler((Tk_Window) winPtr,
- VisibilityChangeMask, FocusMapProc,
- (ClientData) winPtr);
+ Tk_CreateEventHandler((Tk_Window) winPtr, VisibilityChangeMask,
+ FocusMapProc, winPtr);
displayFocusPtr->focusOnMapPtr = winPtr;
displayFocusPtr->forceFocus = force;
return;
@@ -943,7 +941,7 @@ FocusMapProc(
ClientData clientData, /* Toplevel window. */
XEvent *eventPtr) /* Information about event. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
DisplayFocusInfo *displayFocusPtr;
if (eventPtr->type == VisibilityNotify) {
@@ -1048,8 +1046,8 @@ TkFocusFree(
*
* TkFocusSplit --
*
- * Adjust focus window for a newly managed toplevel, thus splitting
- * the toplevel into two toplevels.
+ * Adjust focus window for a newly managed toplevel, thus splitting the
+ * toplevel into two toplevels.
*
* Results:
* None.
@@ -1062,29 +1060,29 @@ TkFocusFree(
void
TkFocusSplit(winPtr)
- TkWindow *winPtr; /* Window is the new toplevel
- * Any focus point at or below window
- * must be moved to this new toplevel */
+ TkWindow *winPtr; /* Window is the new toplevel. Any focus point
+ * at or below window must be moved to this
+ * new toplevel. */
{
ToplevelFocusInfo *tlFocusPtr;
DisplayFocusInfo *displayFocusPtr;
- TkWindow *topLevelPtr;
- TkWindow *subWinPtr;
+ TkWindow *topLevelPtr, *subWinPtr;
displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
/*
- * Find the top-level window for winPtr, then find (or create)
- * a record for the top-level. Also see whether winPtr and all its
- * ancestors are mapped.
+ * Find the top-level window for winPtr, then find (or create) a record
+ * for the top-level. Also see whether winPtr and all its ancestors are
+ * mapped.
*/
- for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) {
+ for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) {
if (topLevelPtr == NULL) {
/*
- * The window is being deleted. No point in worrying about
- * giving it the focus.
+ * The window is being deleted. No point in worrying about giving
+ * it the focus.
*/
+
return;
}
if (topLevelPtr->flags & TK_TOP_HIERARCHY) {
@@ -1092,37 +1090,58 @@ TkFocusSplit(winPtr)
}
}
- /* Search all focus records to find child windows of winPtr */
+ /*
+ * Search all focus records to find child windows of winPtr.
+ */
+
for (tlFocusPtr = winPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL;
- tlFocusPtr = tlFocusPtr->nextPtr) {
+ tlFocusPtr = tlFocusPtr->nextPtr) {
if (tlFocusPtr->topLevelPtr == topLevelPtr) {
break;
}
}
if (tlFocusPtr == NULL) {
- /* No focus record for this toplevel, nothing to do. */
+ /*
+ * No focus record for this toplevel, nothing to do.
+ */
+
return;
}
- /* See if current focusWin is child of the new toplevel */
+ /*
+ * See if current focusWin is child of the new toplevel.
+ */
+
for (subWinPtr = tlFocusPtr->focusWinPtr;
- subWinPtr && subWinPtr != winPtr && subWinPtr != topLevelPtr;
- subWinPtr = subWinPtr->parentPtr) {}
+ subWinPtr && subWinPtr != winPtr && subWinPtr != topLevelPtr;
+ subWinPtr = subWinPtr->parentPtr) {
+ /* EMPTY */
+ }
if (subWinPtr == winPtr) {
- /* Move focus to new toplevel */
- ToplevelFocusInfo *newTlFocusPtr;
+ /*
+ * Move focus to new toplevel.
+ */
+
+ ToplevelFocusInfo *newTlFocusPtr = (ToplevelFocusInfo *)
+ ckalloc(sizeof(ToplevelFocusInfo));
- newTlFocusPtr = (ToplevelFocusInfo *) ckalloc(sizeof(ToplevelFocusInfo));
newTlFocusPtr->topLevelPtr = winPtr;
newTlFocusPtr->focusWinPtr = tlFocusPtr->focusWinPtr;
newTlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr;
winPtr->mainPtr->tlFocusPtr = newTlFocusPtr;
- /* Move old toplevel's focus to the toplevel itself */
+
+ /*
+ * Move old toplevel's focus to the toplevel itself.
+ */
+
tlFocusPtr->focusWinPtr = topLevelPtr;
}
- /* If it's not, then let focus progress naturally */
+
+ /*
+ * If it's not, then let focus progress naturally.
+ */
}
/*
@@ -1142,25 +1161,25 @@ TkFocusSplit(winPtr)
*/
void
-TkFocusJoin(winPtr)
- TkWindow *winPtr; /* Window is no longer a toplevel */
+TkFocusJoin(
+ TkWindow *winPtr) /* Window is no longer a toplevel. */
{
- ToplevelFocusInfo *tlFocusPtr;
- ToplevelFocusInfo *tmpPtr;
+ ToplevelFocusInfo *tlFocusPtr, *tmpPtr;
/*
* Remove old toplevel record
*/
+
if (winPtr && winPtr->mainPtr && winPtr->mainPtr->tlFocusPtr
- && winPtr->mainPtr->tlFocusPtr->topLevelPtr == winPtr) {
+ && winPtr->mainPtr->tlFocusPtr->topLevelPtr == winPtr) {
tmpPtr = winPtr->mainPtr->tlFocusPtr;
winPtr->mainPtr->tlFocusPtr = tmpPtr->nextPtr;
ckfree((char *)tmpPtr);
} else {
for (tlFocusPtr = winPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL;
- tlFocusPtr = tlFocusPtr->nextPtr) {
+ tlFocusPtr = tlFocusPtr->nextPtr) {
if (tlFocusPtr->nextPtr &&
- tlFocusPtr->nextPtr->topLevelPtr == winPtr) {
+ tlFocusPtr->nextPtr->topLevelPtr == winPtr) {
tmpPtr = tlFocusPtr->nextPtr;
tlFocusPtr->nextPtr = tmpPtr->nextPtr;
ckfree((char *)tmpPtr);
diff --git a/generic/tkFont.c b/generic/tkFont.c
index f2d2441..a168919 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.42 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkFont.c,v 1.43 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -378,9 +378,8 @@ void
TkFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- TkFontInfo *fiPtr;
+ TkFontInfo *fiPtr = (TkFontInfo *) ckalloc(sizeof(TkFontInfo));
- fiPtr = (TkFontInfo *) ckalloc(sizeof(TkFontInfo));
Tcl_InitHashTable(&fiPtr->fontCache, TCL_STRING_KEYS);
Tcl_InitHashTable(&fiPtr->namedTable, TCL_STRING_KEYS);
fiPtr->mainPtr = mainPtr;
@@ -412,13 +411,11 @@ void
TkFontPkgFree(
TkMainInfo *mainPtr) /* The application being deleted. */
{
- TkFontInfo *fiPtr;
+ TkFontInfo *fiPtr = mainPtr->fontInfoPtr;
Tcl_HashEntry *hPtr, *searchPtr;
Tcl_HashSearch search;
int fontsLeft;
- fiPtr = mainPtr->fontInfoPtr;
-
fontsLeft = 0;
for (searchPtr = Tcl_FirstHashEntry(&fiPtr->fontCache, &search);
searchPtr != NULL;
@@ -445,7 +442,7 @@ TkFontPkgFree(
}
Tcl_DeleteHashTable(&fiPtr->namedTable);
if (fiPtr->updatePending != 0) {
- Tcl_CancelIdleCall(TheWorldHasChanged, (ClientData) fiPtr);
+ Tcl_CancelIdleCall(TheWorldHasChanged, fiPtr);
}
ckfree((char *) fiPtr);
}
@@ -621,7 +618,7 @@ Tk_FontObjCmd(
namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string);
nfPtr = NULL; /* lint. */
if (namedHashPtr != NULL) {
- nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
+ nfPtr = Tcl_GetHashValue(namedHashPtr);
}
if ((namedHashPtr == NULL) || (nfPtr->deletePending != 0)) {
Tcl_AppendResult(interp, "named font \"", string,
@@ -804,7 +801,7 @@ Tk_FontObjCmd(
resultPtr = Tcl_GetObjResult(interp);
namedHashPtr = Tcl_FirstHashEntry(&fiPtr->namedTable, &search);
while (namedHashPtr != NULL) {
- nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
+ nfPtr = Tcl_GetHashValue(namedHashPtr);
if (nfPtr->deletePending == 0) {
string = Tcl_GetHashKey(&fiPtr->namedTable, namedHashPtr);
strPtr = Tcl_NewStringObj(string, -1);
@@ -848,7 +845,7 @@ UpdateDependentFonts(
TkFont *fontPtr;
NamedFont *nfPtr;
- nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
+ nfPtr = Tcl_GetHashValue(namedHashPtr);
if (nfPtr->refCount == 0) {
/*
* Well nobody's using this named font, so don't have to tell any
@@ -860,13 +857,13 @@ UpdateDependentFonts(
cacheHashPtr = Tcl_FirstHashEntry(&fiPtr->fontCache, &search);
while (cacheHashPtr != NULL) {
- for (fontPtr = (TkFont *) Tcl_GetHashValue(cacheHashPtr);
+ for (fontPtr = Tcl_GetHashValue(cacheHashPtr);
fontPtr != NULL; fontPtr = fontPtr->nextPtr) {
if (fontPtr->namedHashPtr == namedHashPtr) {
TkpGetFontFromAttributes(fontPtr, tkwin, &nfPtr->fa);
if (fiPtr->updatePending == 0) {
fiPtr->updatePending = 1;
- Tcl_DoWhenIdle(TheWorldHasChanged, (ClientData) fiPtr);
+ Tcl_DoWhenIdle(TheWorldHasChanged, fiPtr);
}
}
}
@@ -878,11 +875,9 @@ static void
TheWorldHasChanged(
ClientData clientData) /* Info about application's fonts. */
{
- TkFontInfo *fiPtr;
+ TkFontInfo *fiPtr = clientData;
- fiPtr = (TkFontInfo *) clientData;
fiPtr->updatePending = 0;
-
RecomputeWidgets(fiPtr->mainPtr->winPtr);
}
@@ -890,8 +885,9 @@ static void
RecomputeWidgets(
TkWindow *winPtr) /* Window to which command is sent. */
{
- Tk_ClassWorldChangedProc *proc;
- proc = Tk_GetClassProc(winPtr->classProcsPtr, worldChangedProc);
+ Tk_ClassWorldChangedProc *proc =
+ Tk_GetClassProc(winPtr->classProcsPtr, worldChangedProc);
+
if (proc != NULL) {
(*proc)(winPtr->instanceData);
}
@@ -961,7 +957,7 @@ TkCreateNamedFont(
namedHashPtr = Tcl_CreateHashEntry(&fiPtr->namedTable, name, &isNew);
if (!isNew) {
- nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
+ nfPtr = Tcl_GetHashValue(namedHashPtr);
if (nfPtr->deletePending == 0) {
if (interp) {
Tcl_AppendResult(interp, "named font \"", name,
@@ -1006,7 +1002,7 @@ int
TkDeleteNamedFont(
Tcl_Interp *interp, /* Interp for error return (can be NULL). */
Tk_Window tkwin, /* A window associated with interp. */
- CONST char *name) /* Name for the new named font. */
+ const char *name) /* Name for the new named font. */
{
TkFontInfo *fiPtr;
NamedFont *nfPtr;
@@ -1022,7 +1018,7 @@ TkDeleteNamedFont(
}
return TCL_ERROR;
}
- nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
+ nfPtr = Tcl_GetHashValue(namedHashPtr);
if (nfPtr->refCount != 0) {
nfPtr->deletePending = 1;
} else {
@@ -1111,7 +1107,7 @@ Tk_AllocFontFromObj(
SetFontFromAny(interp, objPtr);
}
- oldFontPtr = (TkFont *) objPtr->internalRep.twoPtrValue.ptr1;
+ oldFontPtr = objPtr->internalRep.twoPtrValue.ptr1;
if (oldFontPtr != NULL) {
if (oldFontPtr->resourceRefCount == 0) {
@@ -1141,13 +1137,13 @@ Tk_AllocFontFromObj(
cacheHashPtr = Tcl_CreateHashEntry(&fiPtr->fontCache,
Tcl_GetString(objPtr), &isNew);
}
- firstFontPtr = (TkFont *) Tcl_GetHashValue(cacheHashPtr);
+ firstFontPtr = Tcl_GetHashValue(cacheHashPtr);
for (fontPtr = firstFontPtr; (fontPtr != NULL);
fontPtr = fontPtr->nextPtr) {
if (Tk_Screen(tkwin) == fontPtr->screen) {
fontPtr->resourceRefCount++;
fontPtr->objRefCount++;
- objPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = fontPtr;
return (Tk_Font) fontPtr;
}
}
@@ -1163,7 +1159,7 @@ Tk_AllocFontFromObj(
* Construct a font based on a named font.
*/
- nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
+ nfPtr = Tcl_GetHashValue(namedHashPtr);
nfPtr->refCount++;
fontPtr = TkpGetFontFromAttributes(NULL, tkwin, &nfPtr->fa);
@@ -1242,7 +1238,7 @@ Tk_AllocFontFromObj(
}
}
- objPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = fontPtr;
return (Tk_Font) fontPtr;
}
@@ -1278,7 +1274,7 @@ Tk_GetFontFromObj(
SetFontFromAny(NULL, objPtr);
}
- fontPtr = (TkFont *) objPtr->internalRep.twoPtrValue.ptr1;
+ fontPtr = objPtr->internalRep.twoPtrValue.ptr1;
if (fontPtr != NULL) {
if (fontPtr->resourceRefCount == 0) {
@@ -1306,11 +1302,11 @@ Tk_GetFontFromObj(
hashPtr = Tcl_FindHashEntry(&fiPtr->fontCache, Tcl_GetString(objPtr));
}
if (hashPtr != NULL) {
- for (fontPtr = (TkFont *) Tcl_GetHashValue(hashPtr); fontPtr != NULL;
+ for (fontPtr = Tcl_GetHashValue(hashPtr); fontPtr != NULL;
fontPtr = fontPtr->nextPtr) {
if (Tk_Screen(tkwin) == fontPtr->screen) {
fontPtr->objRefCount++;
- objPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = fontPtr;
return (Tk_Font) fontPtr;
}
}
@@ -1427,7 +1423,7 @@ Tk_FreeFont(
* the named font and free it if no-one else is using it.
*/
- nfPtr = (NamedFont *) Tcl_GetHashValue(fontPtr->namedHashPtr);
+ nfPtr = Tcl_GetHashValue(fontPtr->namedHashPtr);
nfPtr->refCount--;
if ((nfPtr->refCount == 0) && (nfPtr->deletePending != 0)) {
Tcl_DeleteHashEntry(fontPtr->namedHashPtr);
@@ -1435,7 +1431,7 @@ Tk_FreeFont(
}
}
- prevPtr = (TkFont *) Tcl_GetHashValue(fontPtr->cacheHashPtr);
+ prevPtr = Tcl_GetHashValue(fontPtr->cacheHashPtr);
if (prevPtr == fontPtr) {
if (fontPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(fontPtr->cacheHashPtr);
@@ -1505,7 +1501,7 @@ static void
FreeFontObjProc(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
- TkFont *fontPtr = (TkFont *) objPtr->internalRep.twoPtrValue.ptr1;
+ TkFont *fontPtr = objPtr->internalRep.twoPtrValue.ptr1;
if (fontPtr != NULL) {
fontPtr->objRefCount--;
@@ -1539,10 +1535,10 @@ DupFontObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- TkFont *fontPtr = (TkFont *) srcObjPtr->internalRep.twoPtrValue.ptr1;
+ TkFont *fontPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
- dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr;
+ dupObjPtr->internalRep.twoPtrValue.ptr1 = fontPtr;
if (fontPtr != NULL) {
fontPtr->objRefCount++;
@@ -1606,9 +1602,8 @@ Tk_GetFontMetrics(
Tk_FontMetrics *fmPtr) /* Pointer to structure in which font metrics
* for tkfont will be stored. */
{
- TkFont *fontPtr;
+ TkFont *fontPtr = (TkFont *) tkfont;
- fontPtr = (TkFont *) tkfont;
fmPtr->ascent = fontPtr->fm.ascent;
fmPtr->descent = fontPtr->fm.descent;
fmPtr->linespace = fontPtr->fm.ascent + fontPtr->fm.descent;
@@ -1891,8 +1886,8 @@ TkUnderlineCharsInContext(
&endX);
XFillRectangle(display, drawable, gc, x + startX,
- y + fontPtr->underlinePos, (unsigned int) (endX - startX),
- (unsigned int) fontPtr->underlineHeight);
+ y + fontPtr->underlinePos, (unsigned) (endX - startX),
+ (unsigned) fontPtr->underlineHeight);
}
/*
@@ -2232,9 +2227,8 @@ void
Tk_FreeTextLayout(
Tk_TextLayout textLayout) /* The text layout to be released. */
{
- TextLayout *layoutPtr;
+ TextLayout *layoutPtr = (TextLayout *) textLayout;
- layoutPtr = (TextLayout *) textLayout;
if (layoutPtr != NULL) {
ckfree((char *) layoutPtr);
}
@@ -2276,13 +2270,11 @@ Tk_DrawTextLayout(
* draw from the given text item. A number < 0
* means to draw all characters. */
{
- TextLayout *layoutPtr;
+ TextLayout *layoutPtr = (TextLayout *) layout;
int i, numDisplayChars, drawX;
- const char *firstByte;
- const char *lastByte;
+ const char *firstByte, *lastByte;
LayoutChunk *chunkPtr;
- layoutPtr = (TextLayout *) layout;
if (layoutPtr == NULL) {
return;
}
@@ -2307,9 +2299,8 @@ Tk_DrawTextLayout(
numDisplayChars = lastChar;
}
lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
- Tk_DrawChars(display, drawable, gc, layoutPtr->tkfont,
- firstByte, lastByte - firstByte,
- x + chunkPtr->x + drawX, y + chunkPtr->y);
+ Tk_DrawChars(display, drawable, gc, layoutPtr->tkfont, firstByte,
+ lastByte - firstByte, x+chunkPtr->x+drawX, y+chunkPtr->y);
}
firstChar -= chunkPtr->numChars;
lastChar -= chunkPtr->numChars;
@@ -2355,18 +2346,16 @@ Tk_UnderlineTextLayout(
int underline) /* Index of the single character to underline,
* or -1 for no underline. */
{
- TextLayout *layoutPtr;
- TkFont *fontPtr;
int xx, yy, width, height;
if ((Tk_CharBbox(layout, underline, &xx, &yy, &width, &height) != 0)
&& (width != 0)) {
- layoutPtr = (TextLayout *) layout;
- fontPtr = (TkFont *) layoutPtr->tkfont;
+ TextLayout *layoutPtr = (TextLayout *) layout;
+ TkFont *fontPtr = (TkFont *) layoutPtr->tkfont;
XFillRectangle(display, drawable, gc, x + xx,
y + yy + fontPtr->fm.ascent + fontPtr->underlinePos,
- (unsigned int) width, (unsigned int) fontPtr->underlineHeight);
+ (unsigned) width, (unsigned) fontPtr->underlineHeight);
}
}
@@ -2475,8 +2464,7 @@ Tk_PointToChar(
return numChars;
}
n = Tk_MeasureChars((Tk_Font) fontPtr, chunkPtr->start,
- chunkPtr->numBytes, x - chunkPtr->x,
- 0, &dummy);
+ chunkPtr->numBytes, x - chunkPtr->x, 0, &dummy);
return numChars + Tcl_NumUtfChars(chunkPtr->start, n);
}
numChars += chunkPtr->numChars;
@@ -3804,7 +3792,7 @@ TkDebugFont(
hashPtr = Tcl_FindHashEntry(
&((TkWindow *) tkwin)->mainPtr->fontInfoPtr->fontCache, name);
if (hashPtr != NULL) {
- fontPtr = (TkFont *) Tcl_GetHashValue(hashPtr);
+ fontPtr = Tcl_GetHashValue(hashPtr);
if (fontPtr == NULL) {
Tcl_Panic("TkDebugFont found empty hash table entry");
}
@@ -3850,7 +3838,7 @@ TkFontGetFirstTextLayout(
LayoutChunk *chunkPtr;
int numBytesInChunk;
- layoutPtr = (TextLayout *)layout;
+ layoutPtr = (TextLayout *) layout;
if ((layoutPtr==NULL) || (layoutPtr->numChunks==0)
|| (layoutPtr->chunks->numDisplayChars <= 0)) {
dst[0] = '\0';
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 372cbda..1a751ed 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkFrame.c,v 1.31 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkFrame.c,v 1.32 2008/04/27 22:38:56 dkf Exp $
*/
#include "default.h"
@@ -290,7 +290,7 @@ static char *classNames[] = {"Frame", "Toplevel", "Labelframe"};
* class of widgets.
*/
-static const Tk_OptionSpec * const optionSpecs[] = {
+static const Tk_OptionSpec *const optionSpecs[] = {
frameOptSpec,
toplevelOptSpec,
labelframeOptSpec,
@@ -302,9 +302,9 @@ static const Tk_OptionSpec * const optionSpecs[] = {
static void ComputeFrameGeometry(Frame *framePtr);
static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int CreateFrame(ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST argv[],
+ int objc, Tcl_Obj *const argv[],
enum FrameType type, char *appName);
static void DestroyFrame(char *memPtr);
static void DestroyFramePartly(Frame *framePtr);
@@ -320,7 +320,7 @@ static void FrameStructureProc(ClientData clientData,
XEvent *eventPtr);
static int FrameWidgetObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static void FrameWorldChanged(ClientData instanceData);
static void MapFrame(ClientData clientData);
@@ -369,7 +369,7 @@ Tk_FrameObjCmd(
ClientData clientData, /* Either NULL or pointer to option table. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
return CreateFrame(clientData, interp, objc, objv, TYPE_FRAME, NULL);
}
@@ -379,7 +379,7 @@ Tk_ToplevelObjCmd(
ClientData clientData, /* Either NULL or pointer to option table. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
return CreateFrame(clientData, interp, objc, objv, TYPE_TOPLEVEL, NULL);
}
@@ -389,7 +389,7 @@ Tk_LabelframeObjCmd(
ClientData clientData, /* Either NULL or pointer to option table. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
return CreateFrame(clientData, interp, objc, objv, TYPE_LABELFRAME, NULL);
}
@@ -448,7 +448,7 @@ CreateFrame(
ClientData clientData, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[], /* Argument objects. */
+ Tcl_Obj *const objv[], /* Argument objects. */
enum FrameType type, /* What widget type to create. */
char *appName) /* Should only be non-NULL if there are no
* Main window associated with the
@@ -459,7 +459,8 @@ CreateFrame(
Frame *framePtr;
Tk_OptionTable optionTable;
Tk_Window newWin;
- CONST char *className, *screenName, *visualName, *colormapName, *arg, *useOption;
+ const char *className, *screenName, *visualName, *colormapName;
+ const char *arg, *useOption;
int i, c, length, depth;
unsigned int mask;
Colormap colormap;
@@ -614,17 +615,17 @@ CreateFrame(
if (type == TYPE_LABELFRAME) {
framePtr = (Frame *) ckalloc(sizeof(Labelframe));
- memset((void *) framePtr, 0, (sizeof(Labelframe)));
+ memset(framePtr, 0, sizeof(Labelframe));
} else {
framePtr = (Frame *) ckalloc(sizeof(Frame));
- memset((void *) framePtr, 0, (sizeof(Frame)));
+ memset(framePtr, 0, sizeof(Frame));
}
framePtr->tkwin = newWin;
framePtr->display = Tk_Display(newWin);
framePtr->interp = interp;
framePtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(newWin), FrameWidgetObjCmd,
- (ClientData) framePtr, FrameCmdDeletedProc);
+ Tk_PathName(newWin), FrameWidgetObjCmd, framePtr,
+ FrameCmdDeletedProc);
framePtr->optionTable = optionTable;
framePtr->type = type;
framePtr->colormap = colormap;
@@ -633,6 +634,7 @@ CreateFrame(
if (framePtr->type == TYPE_LABELFRAME) {
Labelframe *labelframePtr = (Labelframe *) framePtr;
+
labelframePtr->labelAnchor = LABELANCHOR_NW;
labelframePtr->textGC = None;
}
@@ -641,13 +643,13 @@ CreateFrame(
* Store backreference to frame widget in window structure.
*/
- Tk_SetClassProcs(newWin, &frameClass, (ClientData) framePtr);
+ Tk_SetClassProcs(newWin, &frameClass, framePtr);
mask = ExposureMask | StructureNotifyMask | FocusChangeMask;
if (type == TYPE_TOPLEVEL) {
mask |= ActivateMask;
}
- Tk_CreateEventHandler(newWin, mask, FrameEventProc, (ClientData) framePtr);
+ Tk_CreateEventHandler(newWin, mask, FrameEventProc, framePtr);
if ((Tk_InitOptions(interp, (char *) framePtr, optionTable, newWin)
!= TCL_OK) ||
(ConfigureFrame(interp, framePtr, objc-2, objv+2) != TCL_OK)) {
@@ -663,7 +665,7 @@ CreateFrame(
}
}
if (type == TYPE_TOPLEVEL) {
- Tcl_DoWhenIdle(MapFrame, (ClientData) framePtr);
+ Tcl_DoWhenIdle(MapFrame, framePtr);
}
Tcl_SetResult(interp, Tk_PathName(newWin), TCL_STATIC);
return TCL_OK;
@@ -698,15 +700,15 @@ FrameWidgetObjCmd(
ClientData clientData, /* Information about frame widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- static CONST char *frameOptions[] = {
+ static const char *frameOptions[] = {
"cget", "configure", NULL
};
enum options {
FRAME_CGET, FRAME_CONFIGURE
};
- register Frame *framePtr = (Frame *) clientData;
+ register Frame *framePtr = clientData;
int result = TCL_OK, index;
int c, i, length;
Tcl_Obj *objPtr;
@@ -719,7 +721,7 @@ FrameWidgetObjCmd(
&index) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_Preserve((ClientData) framePtr);
+ Tcl_Preserve(framePtr);
switch ((enum options) index) {
case FRAME_CGET:
if (objc != 3) {
@@ -732,22 +734,19 @@ FrameWidgetObjCmd(
if (objPtr == NULL) {
result = TCL_ERROR;
goto done;
- } else {
- Tcl_SetObjResult(interp, objPtr);
}
+ Tcl_SetObjResult(interp, objPtr);
break;
case FRAME_CONFIGURE:
if (objc <= 3) {
objPtr = Tk_GetOptionInfo(interp, (char *) framePtr,
- framePtr->optionTable,
- (objc == 3) ? objv[2] : NULL,
+ framePtr->optionTable, (objc == 3) ? objv[2] : NULL,
framePtr->tkwin);
if (objPtr == NULL) {
result = TCL_ERROR;
goto done;
- } else {
- Tcl_SetObjResult(interp, objPtr);
}
+ Tcl_SetObjResult(interp, objPtr);
} else {
/*
* Don't allow the options -class, -colormap, -container, -screen,
@@ -773,9 +772,9 @@ FrameWidgetObjCmd(
|| ((c == 'v')
&& (strncmp(arg, "-visual", (unsigned)length) == 0))) {
- #ifdef SUPPORT_CONFIG_EMBEDDED
+#ifdef SUPPORT_CONFIG_EMBEDDED
if (c == 'u') {
- CONST char *string = Tcl_GetString(objv[i+1]);
+ const char *string = Tcl_GetString(objv[i+1]);
if (TkpUseWindow(interp, framePtr->tkwin,
string) != TCL_OK) {
result = TCL_ERROR;
@@ -787,12 +786,12 @@ FrameWidgetObjCmd(
result = TCL_ERROR;
goto done;
}
- #else
+#else
Tcl_AppendResult(interp, "can't modify ", arg,
" option after widget is created", NULL);
result = TCL_ERROR;
goto done;
- #endif
+#endif
}
}
result = ConfigureFrame(interp, framePtr, objc-2, objv+2);
@@ -801,7 +800,7 @@ FrameWidgetObjCmd(
}
done:
- Tcl_Release((ClientData) framePtr);
+ Tcl_Release(framePtr);
return result;
}
@@ -868,8 +867,8 @@ DestroyFramePartly(
if (framePtr->type == TYPE_LABELFRAME && labelframePtr->labelWin != NULL) {
Tk_DeleteEventHandler(labelframePtr->labelWin, StructureNotifyMask,
- FrameStructureProc, (ClientData) framePtr);
- Tk_ManageGeometry(labelframePtr->labelWin, NULL, (ClientData) NULL);
+ FrameStructureProc, framePtr);
+ Tk_ManageGeometry(labelframePtr->labelWin, NULL, NULL);
if (framePtr->tkwin != Tk_Parent(labelframePtr->labelWin)) {
Tk_UnmaintainGeometry(labelframePtr->labelWin, framePtr->tkwin);
}
@@ -907,7 +906,7 @@ ConfigureFrame(
register Frame *framePtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments. */
+ Tcl_Obj *const objv[]) /* Arguments. */
{
Tk_SavedOptions savedOptions;
char *oldMenuName;
@@ -947,7 +946,7 @@ ConfigureFrame(
|| ((oldMenuName != NULL) && (framePtr->menuName == NULL))
|| ((oldMenuName != NULL) && (framePtr->menuName != NULL)
&& strcmp(oldMenuName, framePtr->menuName) != 0))
- && framePtr->type == TYPE_TOPLEVEL) {
+ && framePtr->type == TYPE_TOPLEVEL) {
TkSetWindowMenuBar(interp, framePtr->tkwin, oldMenuName,
framePtr->menuName);
}
@@ -981,7 +980,7 @@ ConfigureFrame(
if (oldWindow != labelframePtr->labelWin) {
if (oldWindow != NULL) {
Tk_DeleteEventHandler(oldWindow, StructureNotifyMask,
- FrameStructureProc, (ClientData) framePtr);
+ FrameStructureProc, framePtr);
Tk_ManageGeometry(oldWindow, NULL, (ClientData) NULL);
Tk_UnmaintainGeometry(oldWindow, framePtr->tkwin);
Tk_UnmapWindow(oldWindow);
@@ -1003,7 +1002,7 @@ ConfigureFrame(
}
sibling = ancestor;
if (Tk_IsTopLevel(ancestor)) {
- badWindow:
+ badWindow:
Tcl_AppendResult(interp, "can't use ",
Tk_PathName(labelframePtr->labelWin),
" as label in this frame", NULL);
@@ -1018,10 +1017,9 @@ ConfigureFrame(
goto badWindow;
}
Tk_CreateEventHandler(labelframePtr->labelWin,
- StructureNotifyMask, FrameStructureProc,
- (ClientData) framePtr);
+ StructureNotifyMask, FrameStructureProc, framePtr);
Tk_ManageGeometry(labelframePtr->labelWin, &frameGeomType,
- (ClientData) framePtr);
+ framePtr);
/*
* If the frame is not parent to the label, make sure the
@@ -1035,8 +1033,7 @@ ConfigureFrame(
}
}
- FrameWorldChanged((ClientData) framePtr);
-
+ FrameWorldChanged(framePtr);
return TCL_OK;
}
@@ -1062,8 +1059,8 @@ static void
FrameWorldChanged(
ClientData instanceData) /* Information about widget. */
{
- Frame *framePtr = (Frame *) instanceData;
- Labelframe *labelframePtr = (Labelframe *) framePtr;
+ Frame *framePtr = instanceData;
+ Labelframe *labelframePtr = instanceData;
Tk_Window tkwin = framePtr->tkwin;
XGCValues gcValues;
GC gc;
@@ -1102,14 +1099,17 @@ FrameWorldChanged(
if (anyTextLabel) {
labelText = Tcl_GetString(labelframePtr->textPtr);
Tk_FreeTextLayout(labelframePtr->textLayout);
- labelframePtr->textLayout = Tk_ComputeTextLayout(labelframePtr->tkfont,
+ labelframePtr->textLayout =
+ Tk_ComputeTextLayout(labelframePtr->tkfont,
labelText, -1, 0, TK_JUSTIFY_CENTER, 0,
- &labelframePtr->labelReqWidth, &labelframePtr->labelReqHeight);
+ &labelframePtr->labelReqWidth,
+ &labelframePtr->labelReqHeight);
labelframePtr->labelReqWidth += 2 * LABELSPACING;
labelframePtr->labelReqHeight += 2 * LABELSPACING;
} else if (anyWindowLabel) {
labelframePtr->labelReqWidth = Tk_ReqWidth(labelframePtr->labelWin);
- labelframePtr->labelReqHeight = Tk_ReqHeight(labelframePtr->labelWin);
+ labelframePtr->labelReqHeight =
+ Tk_ReqHeight(labelframePtr->labelWin);
}
/*
@@ -1202,7 +1202,7 @@ FrameWorldChanged(
if (Tk_IsMapped(tkwin)) {
if (!(framePtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayFrame, (ClientData) framePtr);
+ Tcl_DoWhenIdle(DisplayFrame, framePtr);
}
framePtr->flags |= REDRAW_PENDING;
}
@@ -1239,7 +1239,9 @@ ComputeFrameGeometry(
* We have nothing to do here unless there is a label.
*/
- if (framePtr->type != TYPE_LABELFRAME) return;
+ if (framePtr->type != TYPE_LABELFRAME) {
+ return;
+ }
if (labelframePtr->textPtr == NULL && labelframePtr->labelWin == NULL) {
return;
}
@@ -1371,7 +1373,7 @@ static void
DisplayFrame(
ClientData clientData) /* Information about widget. */
{
- register Frame *framePtr = (Frame *) clientData;
+ register Frame *framePtr = clientData;
register Tk_Window tkwin = framePtr->tkwin;
int bdX1, bdY1, bdX2, bdY2, hlWidth;
Pixmap pixmap;
@@ -1408,7 +1410,9 @@ DisplayFrame(
* If -background is set to "", no interior is drawn.
*/
- if (framePtr->border == NULL) return;
+ if (framePtr->border == NULL) {
+ return;
+ }
if (framePtr->type != TYPE_LABELFRAME) {
/*
@@ -1539,7 +1543,8 @@ DisplayFrame(
|| (labelframePtr->labelBox.height !=
Tk_Height(labelframePtr->labelWin))) {
Tk_MoveResizeWindow(labelframePtr->labelWin,
- labelframePtr->labelBox.x, labelframePtr->labelBox.y,
+ labelframePtr->labelBox.x,
+ labelframePtr->labelBox.y,
labelframePtr->labelBox.width,
labelframePtr->labelBox.height);
}
@@ -1552,7 +1557,6 @@ DisplayFrame(
}
}
-
#ifndef TK_NO_DOUBLE_BUFFERING
/*
* Everything's been redisplayed; now copy the pixmap onto the screen
@@ -1594,7 +1598,7 @@ FrameEventProc(
ClientData clientData, /* Information about window. */
register XEvent *eventPtr) /* Information about event. */
{
- register Frame *framePtr = (Frame *) clientData;
+ register Frame *framePtr = clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
goto redraw;
@@ -1628,15 +1632,15 @@ FrameEventProc(
Tk_DeleteEventHandler(framePtr->tkwin,
ExposureMask|StructureNotifyMask|FocusChangeMask,
- FrameEventProc, (ClientData) framePtr);
+ FrameEventProc, framePtr);
framePtr->tkwin = NULL;
Tcl_DeleteCommandFromToken(framePtr->interp, framePtr->widgetCmd);
}
if (framePtr->flags & REDRAW_PENDING) {
- Tcl_CancelIdleCall(DisplayFrame, (ClientData) framePtr);
+ Tcl_CancelIdleCall(DisplayFrame, framePtr);
}
- Tcl_CancelIdleCall(MapFrame, (ClientData) framePtr);
- Tcl_EventuallyFree((ClientData) framePtr, DestroyFrame);
+ Tcl_CancelIdleCall(MapFrame, framePtr);
+ Tcl_EventuallyFree(framePtr, DestroyFrame);
} else if (eventPtr->type == FocusIn) {
if (eventPtr->xfocus.detail != NotifyInferior) {
framePtr->flags |= GOT_FOCUS;
@@ -1659,7 +1663,7 @@ FrameEventProc(
redraw:
if ((framePtr->tkwin != NULL) && !(framePtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayFrame, (ClientData) framePtr);
+ Tcl_DoWhenIdle(DisplayFrame, framePtr);
framePtr->flags |= REDRAW_PENDING;
}
}
@@ -1686,7 +1690,7 @@ static void
FrameCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- Frame *framePtr = (Frame *) clientData;
+ Frame *framePtr = clientData;
Tk_Window tkwin = framePtr->tkwin;
if (framePtr->menuName != NULL) {
@@ -1737,7 +1741,7 @@ static void
MapFrame(
ClientData clientData) /* Pointer to frame structure. */
{
- Frame *framePtr = (Frame *) clientData;
+ Frame *framePtr = clientData;
/*
* Wait for all other background events to be processed before mapping
@@ -1746,7 +1750,7 @@ MapFrame(
* doesn't get a false idea of its desired geometry.
*/
- Tcl_Preserve((ClientData) framePtr);
+ Tcl_Preserve(framePtr);
while (1) {
if (Tcl_DoOneEvent(TCL_IDLE_EVENTS) == 0) {
break;
@@ -1758,12 +1762,12 @@ MapFrame(
*/
if (framePtr->tkwin == NULL) {
- Tcl_Release((ClientData) framePtr);
+ Tcl_Release(framePtr);
return;
}
}
Tk_MapWindow(framePtr->tkwin);
- Tcl_Release((ClientData) framePtr);
+ Tcl_Release(framePtr);
}
/*
@@ -1792,8 +1796,8 @@ TkInstallFrameMenu(
TkWindow *winPtr = (TkWindow *) tkwin;
if (winPtr->mainPtr != NULL) {
- Frame *framePtr;
- framePtr = (Frame*) winPtr->instanceData;
+ Frame *framePtr = (Frame *) winPtr->instanceData;
+
if (framePtr == NULL) {
Tcl_Panic("TkInstallFrameMenu couldn't get frame pointer");
}
@@ -1825,7 +1829,7 @@ FrameStructureProc(
ClientData clientData, /* Pointer to record describing frame. */
XEvent *eventPtr) /* Describes what just happened. */
{
- Labelframe *labelframePtr = (Labelframe *) clientData;
+ Labelframe *labelframePtr = clientData;
if (eventPtr->type == DestroyNotify) {
/*
@@ -1835,7 +1839,7 @@ FrameStructureProc(
if (labelframePtr->frame.type == TYPE_LABELFRAME) {
labelframePtr->labelWin = NULL;
- FrameWorldChanged((ClientData) labelframePtr);
+ FrameWorldChanged(labelframePtr);
}
}
}
@@ -1863,9 +1867,9 @@ FrameRequestProc(
ClientData clientData, /* Pointer to record for frame. */
Tk_Window tkwin) /* Window that changed its desired size. */
{
- Frame *framePtr = (Frame *) clientData;
+ Frame *framePtr = clientData;
- FrameWorldChanged((ClientData) framePtr);
+ FrameWorldChanged(framePtr);
}
/*
@@ -1891,8 +1895,8 @@ FrameLostSlaveProc(
* stolen away. */
Tk_Window tkwin) /* Tk's handle for the slave window. */
{
- Frame *framePtr = (Frame *) clientData;
- Labelframe *labelframePtr = (Labelframe *) clientData;
+ Frame *framePtr = clientData;
+ Labelframe *labelframePtr = clientData;
/*
* This should only happen in a labelframe but it doesn't hurt to be
@@ -1901,14 +1905,14 @@ FrameLostSlaveProc(
if (labelframePtr->frame.type == TYPE_LABELFRAME) {
Tk_DeleteEventHandler(labelframePtr->labelWin, StructureNotifyMask,
- FrameStructureProc, (ClientData) labelframePtr);
+ FrameStructureProc, labelframePtr);
if (framePtr->tkwin != Tk_Parent(labelframePtr->labelWin)) {
Tk_UnmaintainGeometry(labelframePtr->labelWin, framePtr->tkwin);
}
Tk_UnmapWindow(labelframePtr->labelWin);
labelframePtr->labelWin = NULL;
}
- FrameWorldChanged((ClientData) framePtr);
+ FrameWorldChanged(framePtr);
}
void
@@ -1917,24 +1921,31 @@ TkMapTopFrame (tkwin)
{
Frame *framePtr = ((TkWindow*)tkwin)->instanceData;
Tk_OptionTable optionTable;
+
if (Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_FRAME) {
framePtr->type = TYPE_TOPLEVEL;
- Tcl_DoWhenIdle(MapFrame, (ClientData)framePtr);
+ Tcl_DoWhenIdle(MapFrame, framePtr);
if (framePtr->menuName != NULL) {
TkSetWindowMenuBar(framePtr->interp, framePtr->tkwin, NULL,
- framePtr->menuName);
+ framePtr->menuName);
}
} else if (!Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_TOPLEVEL) {
framePtr->type = TYPE_FRAME;
} else {
- /* Not a frame or toplevel, skip it */
+ /*
+ * Not a frame or toplevel, skip it.
+ */
+
return;
}
+
/*
- * The option table has already been created so
- * the cached pointer will be returned.
+ * The option table has already been created so the cached pointer will be
+ * returned.
*/
- optionTable = Tk_CreateOptionTable(framePtr->interp, optionSpecs[framePtr->type]);
+
+ optionTable = Tk_CreateOptionTable(framePtr->interp,
+ optionSpecs[framePtr->type]);
framePtr->optionTable = optionTable;
}
@@ -1961,7 +1972,7 @@ TkMapTopFrame (tkwin)
Tk_Window
TkToplevelWindowForCommand(
Tcl_Interp *interp,
- CONST char *cmdName)
+ const char *cmdName)
{
Tcl_CmdInfo cmdInfo;
Frame *framePtr;
@@ -1972,7 +1983,7 @@ TkToplevelWindowForCommand(
if (cmdInfo.objProc != FrameWidgetObjCmd) {
return NULL;
}
- framePtr = (Frame *) cmdInfo.objClientData;
+ framePtr = cmdInfo.objClientData;
if (framePtr->type != TYPE_TOPLEVEL) {
return NULL;
}
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index f6f5150..2bd9ea7 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.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: tkGeometry.c,v 1.12 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkGeometry.c,v 1.13 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -86,7 +86,7 @@ void
Tk_ManageGeometry(
Tk_Window tkwin, /* Window whose geometry is to be managed by
* proc. */
- CONST Tk_GeomMgr *mgrPtr, /* Static structure describing the geometry
+ const Tk_GeomMgr *mgrPtr, /* Static structure describing the geometry
* manager. This structure must never go
* away. */
ClientData clientData) /* Arbitrary one-word argument to pass to
@@ -381,7 +381,7 @@ Tk_MaintainGeometry(
hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable,
(char *) master, &isNew);
if (!isNew) {
- masterPtr = (MaintainMaster *) Tcl_GetHashValue(hPtr);
+ masterPtr = Tcl_GetHashValue(hPtr);
} else {
masterPtr = (MaintainMaster *) ckalloc(sizeof(MaintainMaster));
masterPtr->ancestor = master;
@@ -407,7 +407,7 @@ Tk_MaintainGeometry(
slavePtr->nextPtr = masterPtr->slavePtr;
masterPtr->slavePtr = slavePtr;
Tk_CreateEventHandler(slave, StructureNotifyMask, MaintainSlaveProc,
- (ClientData) slavePtr);
+ slavePtr);
/*
* Make sure that there are event handlers registered for all the windows
@@ -420,7 +420,7 @@ Tk_MaintainGeometry(
ancestor = Tk_Parent(ancestor)) {
if (ancestor == masterPtr->ancestor) {
Tk_CreateEventHandler(ancestor, StructureNotifyMask,
- MaintainMasterProc, (ClientData) masterPtr);
+ MaintainMasterProc, masterPtr);
masterPtr->ancestor = Tk_Parent(ancestor);
}
}
@@ -511,7 +511,7 @@ Tk_UnmaintainGeometry(
if (hPtr == NULL) {
return;
}
- masterPtr = (MaintainMaster *) Tcl_GetHashValue(hPtr);
+ masterPtr = Tcl_GetHashValue(hPtr);
slavePtr = masterPtr->slavePtr;
if (slavePtr->slave == slave) {
masterPtr->slavePtr = slavePtr->nextPtr;
@@ -528,20 +528,20 @@ Tk_UnmaintainGeometry(
}
}
Tk_DeleteEventHandler(slavePtr->slave, StructureNotifyMask,
- MaintainSlaveProc, (ClientData) slavePtr);
+ MaintainSlaveProc, slavePtr);
ckfree((char *) slavePtr);
if (masterPtr->slavePtr == NULL) {
if (masterPtr->ancestor != NULL) {
for (ancestor = master; ; ancestor = Tk_Parent(ancestor)) {
Tk_DeleteEventHandler(ancestor, StructureNotifyMask,
- MaintainMasterProc, (ClientData) masterPtr);
+ MaintainMasterProc, masterPtr);
if (ancestor == masterPtr->ancestor) {
break;
}
}
}
if (masterPtr->checkScheduled) {
- Tcl_CancelIdleCall(MaintainCheckProc, (ClientData) masterPtr);
+ Tcl_CancelIdleCall(MaintainCheckProc, masterPtr);
}
Tcl_DeleteHashEntry(hPtr);
ckfree((char *) masterPtr);
@@ -575,7 +575,7 @@ MaintainMasterProc(
* master window. */
XEvent *eventPtr) /* Describes what just happened. */
{
- MaintainMaster *masterPtr = (MaintainMaster *) clientData;
+ MaintainMaster *masterPtr = clientData;
MaintainSlave *slavePtr;
int done;
@@ -584,7 +584,7 @@ MaintainMasterProc(
|| (eventPtr->type == UnmapNotify)) {
if (!masterPtr->checkScheduled) {
masterPtr->checkScheduled = 1;
- Tcl_DoWhenIdle(MaintainCheckProc, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(MaintainCheckProc, masterPtr);
}
} else if (eventPtr->type == DestroyNotify) {
/*
@@ -629,7 +629,7 @@ MaintainSlaveProc(
* master-slave pair. */
XEvent *eventPtr) /* Describes what just happened. */
{
- MaintainSlave *slavePtr = (MaintainSlave *) clientData;
+ MaintainSlave *slavePtr = clientData;
if (eventPtr->type == DestroyNotify) {
Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master);
@@ -661,7 +661,7 @@ MaintainCheckProc(
ClientData clientData) /* Pointer to MaintainMaster structure for the
* master window. */
{
- MaintainMaster *masterPtr = (MaintainMaster *) clientData;
+ MaintainMaster *masterPtr = clientData;
MaintainSlave *slavePtr;
Tk_Window ancestor, parent;
int x, y, map;
diff --git a/generic/tkGet.c b/generic/tkGet.c
index e6b19e2..807f9c2 100644
--- a/generic/tkGet.c
+++ b/generic/tkGet.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: tkGet.c,v 1.13 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkGet.c,v 1.14 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -37,10 +37,10 @@ static void FreeUidThreadExitProc(ClientData clientData);
* used by Tk_GetAnchorFromObj and Tk_GetJustifyFromObj.
*/
-static CONST char *anchorStrings[] = {
+static const char *anchorStrings[] = {
"n", "ne", "e", "se", "s", "sw", "w", "nw", "center", NULL
};
-static CONST char *justifyStrings[] = {
+static const char *justifyStrings[] = {
"left", "right", "center", NULL
};
@@ -103,7 +103,7 @@ Tk_GetAnchorFromObj(
int
Tk_GetAnchor(
Tcl_Interp *interp, /* Use this for error reporting. */
- CONST char *string, /* String describing a direction. */
+ const char *string, /* String describing a direction. */
Tk_Anchor *anchorPtr) /* Where to store Tk_Anchor corresponding to
* string. */
{
@@ -175,7 +175,7 @@ Tk_GetAnchor(
*--------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_NameOfAnchor(
Tk_Anchor anchor) /* Anchor for which identifying string is
* desired. */
@@ -216,7 +216,7 @@ Tk_NameOfAnchor(
int
Tk_GetJoinStyle(
Tcl_Interp *interp, /* Use this for error reporting. */
- CONST char *string, /* String describing a justification style. */
+ const char *string, /* String describing a justification style. */
int *joinPtr) /* Where to store join style corresponding to
* string. */
{
@@ -260,7 +260,7 @@ Tk_GetJoinStyle(
*--------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_NameOfJoinStyle(
int join) /* Join style for which identifying string is
* desired. */
@@ -295,7 +295,7 @@ Tk_NameOfJoinStyle(
int
Tk_GetCapStyle(
Tcl_Interp *interp, /* Use this for error reporting. */
- CONST char *string, /* String describing a justification style. */
+ const char *string, /* String describing a justification style. */
int *capPtr) /* Where to store cap style corresponding to
* string. */
{
@@ -339,7 +339,7 @@ Tk_GetCapStyle(
*--------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_NameOfCapStyle(
int cap) /* Cap style for which identifying string is
* desired. */
@@ -411,7 +411,7 @@ Tk_GetJustifyFromObj(
int
Tk_GetJustify(
Tcl_Interp *interp, /* Use this for error reporting. */
- CONST char *string, /* String describing a justification style. */
+ const char *string, /* String describing a justification style. */
Tk_Justify *justifyPtr) /* Where to store Tk_Justify corresponding to
* string. */
{
@@ -456,7 +456,7 @@ Tk_GetJustify(
*--------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_NameOfJustify(
Tk_Justify justify) /* Justification style for which identifying
* string is desired. */
@@ -491,6 +491,7 @@ FreeUidThreadExitProc(
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
Tcl_DeleteHashTable(&tsdPtr->uidTable);
tsdPtr->initialized = 0;
}
@@ -519,7 +520,7 @@ FreeUidThreadExitProc(
Tk_Uid
Tk_GetUid(
- CONST char *string) /* String to convert. */
+ const char *string) /* String to convert. */
{
int dummy;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
@@ -561,7 +562,7 @@ Tk_GetScreenMM(
Tk_Window tkwin, /* Window whose screen determines conversion
* from centimeters and other absolute
* units. */
- CONST char *string, /* String describing a screen distance. */
+ const char *string, /* String describing a screen distance. */
double *doublePtr) /* Place to store converted result. */
{
char *end;
@@ -635,7 +636,7 @@ Tk_GetPixels(
Tk_Window tkwin, /* Window whose screen determines conversion
* from centimeters and other absolute
* units. */
- CONST char *string, /* String describing a number of pixels. */
+ const char *string, /* String describing a number of pixels. */
int *intPtr) /* Place to store converted result. */
{
double d;
@@ -660,7 +661,6 @@ Tk_GetPixels(
* string.
*
* Results:
-
* The return value is a standard Tcl return result. If TCL_OK is
* returned, then everything went well and the pixel distance is stored
* at *doublePtr; otherwise TCL_ERROR is returned and an error message is
@@ -678,7 +678,7 @@ TkGetDoublePixels(
Tk_Window tkwin, /* Window whose screen determines conversion
* from centimeters and other absolute
* units. */
- CONST char *string, /* String describing a number of pixels. */
+ const char *string, /* String describing a number of pixels. */
double *doublePtr) /* Place to store converted result. */
{
char *end;
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 1369f7c..17e5289 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.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: tkGrab.c,v 1.13 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkGrab.c,v 1.14 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -183,7 +183,7 @@ Tk_GrabObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int globalGrab;
Tk_Window tkwin;
@@ -191,10 +191,10 @@ Tk_GrabObjCmd(
char *arg;
int index;
int len;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"current", "release", "set", "status", NULL
};
- static CONST char *flagStrings[] = {
+ static const char *flagStrings[] = {
"-global", NULL
};
enum options {
@@ -229,7 +229,7 @@ Tk_GrabObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "?-global? window");
return TCL_ERROR;
}
- tkwin = Tk_NameToWindow(interp, arg, (Tk_Window) clientData);
+ tkwin = Tk_NameToWindow(interp, arg, clientData);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -245,8 +245,7 @@ Tk_GrabObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "?-global? window");
return TCL_ERROR;
}
- tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- (Tk_Window) clientData);
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -272,7 +271,7 @@ Tk_GrabObjCmd(
}
if (objc == 3) {
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- (Tk_Window) clientData);
+ clientData);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -298,8 +297,7 @@ Tk_GrabObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "release window");
return TCL_ERROR;
}
- tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- (Tk_Window) clientData);
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData);
if (tkwin == NULL) {
Tcl_ResetResult(interp);
} else {
@@ -316,7 +314,7 @@ Tk_GrabObjCmd(
if (objc == 3) {
globalGrab = 0;
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- (Tk_Window) clientData);
+ clientData);
} else {
globalGrab = 1;
@@ -332,7 +330,7 @@ Tk_GrabObjCmd(
return TCL_ERROR;
}
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[3]),
- (Tk_Window) clientData);
+ clientData);
}
if (tkwin == NULL) {
return TCL_ERROR;
@@ -348,7 +346,7 @@ Tk_GrabObjCmd(
return TCL_ERROR;
}
winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- (Tk_Window) clientData);
+ clientData);
if (winPtr == NULL) {
return TCL_ERROR;
}
@@ -1246,8 +1244,9 @@ EatGrabEvents(
info.display = dispPtr->display;
info.serial = serial;
TkpSync(info.display);
- oldProc = Tk_RestrictEvents(GrabRestrictProc, (ClientData)&info, &oldArg);
+ oldProc = Tk_RestrictEvents(GrabRestrictProc, &info, &oldArg);
while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) {
+ /* EMPTY */
}
Tk_RestrictEvents(oldProc, oldArg, &dummy);
}
@@ -1276,7 +1275,7 @@ GrabRestrictProc(
ClientData arg,
XEvent *eventPtr)
{
- GrabInfo *info = (GrabInfo *) arg;
+ GrabInfo *info = arg;
int mode, diff;
/*
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 29848a8..1400030 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.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: tkGrid.c,v 1.47 2007/05/15 17:01:43 dgp Exp $
+ * RCS: @(#) $Id: tkGrid.c,v 1.48 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -259,31 +259,31 @@ static void ArrangeGrid(ClientData clientData);
static int CheckSlotData(Gridder *masterPtr, int slot,
int slotType, int checkOnly);
static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void DestroyGrid(char *memPtr);
static Gridder * GetGrid(Tk_Window tkwin);
static int GridAnchorCommand(Tk_Window tkwin, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int GridBboxCommand(Tk_Window tkwin, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int GridForgetRemoveCommand(Tk_Window tkwin,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int GridInfoCommand(Tk_Window tkwin, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int GridLocationCommand(Tk_Window tkwin,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int GridPropagateCommand(Tk_Window tkwin,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int GridRowColumnConfigureCommand(Tk_Window tkwin,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int GridSizeCommand(Tk_Window tkwin, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int GridSlavesCommand(Tk_Window tkwin, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void GridStructureProc(ClientData clientData,
XEvent *eventPtr);
static void GridLostSlaveProc(ClientData clientData,
@@ -331,10 +331,10 @@ Tk_GridObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
- static CONST char *optionStrings[] = {
+ Tk_Window tkwin = clientData;
+ static const char *optionStrings[] = {
"anchor", "bbox", "columnconfigure", "configure",
"forget", "info", "location", "propagate", "remove",
"rowconfigure", "size", "slaves", NULL
@@ -426,7 +426,7 @@ GridAnchorCommand(
Tk_Window tkwin, /* Main window of the application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window master;
Gridder *masterPtr;
@@ -467,7 +467,7 @@ GridAnchorCommand(
}
if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
}
}
return TCL_OK;
@@ -494,7 +494,7 @@ GridBboxCommand(
Tk_Window tkwin, /* Main window of the application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window master;
Gridder *masterPtr; /* master grid record */
@@ -624,7 +624,7 @@ GridForgetRemoveCommand(
Tk_Window tkwin, /* Main window of the application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window slave;
Gridder *slavePtr;
@@ -656,7 +656,7 @@ GridForgetRemoveCommand(
slavePtr->iPadY = 0;
slavePtr->doubleBw = 2*Tk_Changes(tkwin)->border_width;
if (slavePtr->flags & REQUESTED_RELAYOUT) {
- Tcl_CancelIdleCall(ArrangeGrid, (ClientData) slavePtr);
+ Tcl_CancelIdleCall(ArrangeGrid, slavePtr);
}
slavePtr->flags = 0;
slavePtr->sticky = 0;
@@ -695,7 +695,7 @@ GridInfoCommand(
Tk_Window tkwin, /* Main window of the application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register Gridder *slavePtr;
Tk_Window slave;
@@ -751,7 +751,7 @@ GridLocationCommand(
Tk_Window tkwin, /* Main window of the application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window master;
Gridder *masterPtr; /* Master grid record. */
@@ -791,8 +791,8 @@ GridLocationCommand(
*/
while (masterPtr->flags & REQUESTED_RELAYOUT) {
- Tcl_CancelIdleCall(ArrangeGrid, (ClientData) masterPtr);
- ArrangeGrid((ClientData) masterPtr);
+ Tcl_CancelIdleCall(ArrangeGrid, masterPtr);
+ ArrangeGrid(masterPtr);
}
SetGridSize(masterPtr);
endX = MAX(gridPtr->columnEnd, gridPtr->columnMax);
@@ -844,7 +844,7 @@ GridPropagateCommand(
Tk_Window tkwin, /* Main window of the application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window master;
Gridder *masterPtr;
@@ -890,7 +890,7 @@ GridPropagateCommand(
}
if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
}
}
return TCL_OK;
@@ -918,7 +918,7 @@ GridRowColumnConfigureCommand(
Tk_Window tkwin, /* Main window of the application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window master, slave;
Gridder *masterPtr, *slavePtr;
@@ -931,7 +931,7 @@ GridRowColumnConfigureCommand(
int ok; /* temporary TCL result code */
int i, j, first, last;
char *string;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"-minsize", "-pad", "-uniform", "-weight", NULL
};
enum options {
@@ -1117,7 +1117,7 @@ GridRowColumnConfigureCommand(
Tcl_GetString(objv[1]), ": \"",
Tcl_GetString(lObjv[j]),
"\" is out of range", NULL);
- Tcl_DecrRefCount(listCopy);
+ Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
}
slotPtr = (slotType == COLUMN) ?
@@ -1132,13 +1132,13 @@ GridRowColumnConfigureCommand(
for (i = 4; i < objc; i += 2) {
if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings,
"option", 0, &index) != TCL_OK) {
- Tcl_DecrRefCount(listCopy);
+ Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
}
if (index == ROWCOL_MINSIZE) {
if (Tk_GetPixelsFromObj(interp, master, objv[i+1],
&size) != TCL_OK) {
- Tcl_DecrRefCount(listCopy);
+ Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
} else {
slotPtr[slot].minSize = size;
@@ -1147,13 +1147,13 @@ GridRowColumnConfigureCommand(
int wt;
if (Tcl_GetIntFromObj(interp,objv[i+1],&wt)!=TCL_OK) {
- Tcl_DecrRefCount(listCopy);
+ Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
} else if (wt < 0) {
Tcl_AppendResult(interp, "invalid arg \"",
Tcl_GetString(objv[i]),
"\": should be non-negative", NULL);
- Tcl_DecrRefCount(listCopy);
+ Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
} else {
slotPtr[slot].weight = wt;
@@ -1168,13 +1168,13 @@ GridRowColumnConfigureCommand(
} else if (index == ROWCOL_PAD) {
if (Tk_GetPixelsFromObj(interp, master, objv[i+1],
&size) != TCL_OK) {
- Tcl_DecrRefCount(listCopy);
+ Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
} else if (size < 0) {
Tcl_AppendResult(interp, "invalid arg \"",
Tcl_GetString(objv[i]),
"\": should be non-negative", NULL);
- Tcl_DecrRefCount(listCopy);
+ Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
} else {
slotPtr[slot].pad = size;
@@ -1221,7 +1221,7 @@ GridRowColumnConfigureCommand(
}
if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
}
return TCL_OK;
}
@@ -1248,7 +1248,7 @@ GridSizeCommand(
Tk_Window tkwin, /* Main window of the application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window master;
Gridder *masterPtr;
@@ -1299,14 +1299,14 @@ GridSlavesCommand(
Tk_Window tkwin, /* Main window of the application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window master;
Gridder *masterPtr; /* master grid record */
Gridder *slavePtr;
int i, value, index;
int row = -1, column = -1;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"-column", "-row", NULL
};
enum options { SLAVES_COLUMN, SLAVES_ROW };
@@ -1385,12 +1385,12 @@ GridReqProc(
Tk_Window tkwin) /* Other Tk-related information about the
* window. */
{
- register Gridder *gridPtr = (Gridder *) clientData;
+ register Gridder *gridPtr = clientData;
gridPtr = gridPtr->masterPtr;
if (gridPtr && !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, (ClientData) gridPtr);
+ Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
}
}
@@ -1417,7 +1417,7 @@ GridLostSlaveProc(
* stolen away. */
Tk_Window tkwin) /* Tk's handle for the slave window. */
{
- register Gridder *slavePtr = (Gridder *) clientData;
+ register Gridder *slavePtr = clientData;
if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
@@ -1675,7 +1675,7 @@ ArrangeGrid(
ClientData clientData) /* Structure describing master whose slaves
* are to be re-layed out. */
{
- register Gridder *masterPtr = (Gridder *) clientData;
+ register Gridder *masterPtr = clientData;
register Gridder *slavePtr;
GridMaster *slotPtr = masterPtr->masterDataPtr;
int abort;
@@ -1711,7 +1711,7 @@ ArrangeGrid(
}
masterPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve((ClientData) masterPtr);
+ Tcl_Preserve(masterPtr);
/*
* Call the constraint engine to fill in the row and column offsets.
@@ -1738,10 +1738,10 @@ ArrangeGrid(
Tk_GeometryRequest(masterPtr->tkwin, width, height);
if (width>1 && height>1) {
masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
}
masterPtr->abortPtr = NULL;
- Tcl_Release((ClientData) masterPtr);
+ Tcl_Release(masterPtr);
return;
}
@@ -1827,7 +1827,7 @@ ArrangeGrid(
}
masterPtr->abortPtr = NULL;
- Tcl_Release((ClientData) masterPtr);
+ Tcl_Release(masterPtr);
}
/*
@@ -2415,7 +2415,7 @@ GetGrid(
gridPtr->padTop = 0;
gridPtr->iPadX = 0;
gridPtr->iPadY = 0;
- gridPtr->doubleBw = 2*Tk_Changes(tkwin)->border_width;
+ gridPtr->doubleBw = 2 * Tk_Changes(tkwin)->border_width;
gridPtr->abortPtr = NULL;
gridPtr->flags = 0;
gridPtr->sticky = 0;
@@ -2423,7 +2423,7 @@ GetGrid(
gridPtr->masterDataPtr = NULL;
Tcl_SetHashValue(hPtr, gridPtr);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- GridStructureProc, (ClientData) gridPtr);
+ GridStructureProc, gridPtr);
return gridPtr;
}
@@ -2717,7 +2717,7 @@ Unlink(
}
if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
}
if (masterPtr->abortPtr != NULL) {
*masterPtr->abortPtr = 1;
@@ -2789,21 +2789,21 @@ GridStructureProc(
* eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- register Gridder *gridPtr = (Gridder *) clientData;
+ register Gridder *gridPtr = clientData;
TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr;
if (eventPtr->type == ConfigureNotify) {
if ((gridPtr->slavePtr != NULL)
&& !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, (ClientData) gridPtr);
+ Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
}
if ((gridPtr->masterPtr != NULL) &&
(gridPtr->doubleBw != 2*Tk_Changes(gridPtr->tkwin)->border_width)) {
if (!(gridPtr->masterPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->doubleBw = 2*Tk_Changes(gridPtr->tkwin)->border_width;
gridPtr->masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, (ClientData) gridPtr->masterPtr);
+ Tcl_DoWhenIdle(ArrangeGrid, gridPtr->masterPtr);
}
}
} else if (eventPtr->type == DestroyNotify) {
@@ -2822,15 +2822,15 @@ GridStructureProc(
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable,
(char *) gridPtr->tkwin));
if (gridPtr->flags & REQUESTED_RELAYOUT) {
- Tcl_CancelIdleCall(ArrangeGrid, (ClientData) gridPtr);
+ Tcl_CancelIdleCall(ArrangeGrid, gridPtr);
}
gridPtr->tkwin = NULL;
- Tcl_EventuallyFree((ClientData) gridPtr, DestroyGrid);
+ Tcl_EventuallyFree(gridPtr, DestroyGrid);
} else if (eventPtr->type == MapNotify) {
if ((gridPtr->slavePtr != NULL)
&& !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, (ClientData) gridPtr);
+ Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
}
} else if (eventPtr->type == UnmapNotify) {
register Gridder *gridPtr2;
@@ -2868,7 +2868,7 @@ ConfigureSlaves(
Tk_Window tkwin, /* Any window in application containing
* slaves. Used to look up slave names. */
int objc, /* Number of elements in argv. */
- Tcl_Obj *CONST objv[]) /* Argument objects: contains one or more
+ Tcl_Obj *const objv[]) /* Argument objects: contains one or more
* window names followed by any number of
* "option value" pairs. Caller must make sure
* that there is at least one window name. */
@@ -2885,7 +2885,7 @@ ConfigureSlaves(
char *lastWindow; /* Use this window to base current row/col
* on */
int numSkip; /* Number of 'x' found */
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"-column", "-columnspan", "-in", "-ipadx", "-ipady",
"-padx", "-pady", "-row", "-rowspan", "-sticky", NULL
};
@@ -3136,7 +3136,7 @@ ConfigureSlaves(
"positive screen distance", NULL);
return TCL_ERROR;
}
- slavePtr->iPadX = tmp*2;
+ slavePtr->iPadX = tmp * 2;
break;
case CONF_IPADY:
if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1],
@@ -3146,7 +3146,7 @@ ConfigureSlaves(
"positive screen distance", NULL);
return TCL_ERROR;
}
- slavePtr->iPadY = tmp*2;
+ slavePtr->iPadY = tmp * 2;
break;
case CONF_PADX:
if (TkParsePadAmount(interp, tkwin, objv[i+1],
@@ -3261,7 +3261,7 @@ ConfigureSlaves(
return TCL_ERROR;
}
- Tk_ManageGeometry(slave, &gridMgrType, (ClientData) slavePtr);
+ Tk_ManageGeometry(slave, &gridMgrType, slavePtr);
/*
* Assign default position information.
@@ -3294,7 +3294,7 @@ ConfigureSlaves(
}
if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
}
}
diff --git a/generic/tkImage.c b/generic/tkImage.c
index 4dd3010..f0f914d 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.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: tkImage.c,v 1.35 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkImage.c,v 1.36 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -154,9 +154,9 @@ Tk_ImageObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument strings. */
+ Tcl_Obj *const objv[]) /* Argument strings. */
{
- static CONST char *imageOptions[] = {
+ static const char *imageOptions[] = {
"create", "delete", "height", "inuse", "names", "type", "types",
"width", NULL
};
@@ -164,7 +164,7 @@ Tk_ImageObjCmd(
IMAGE_CREATE, IMAGE_DELETE, IMAGE_HEIGHT, IMAGE_INUSE, IMAGE_NAMES,
IMAGE_TYPE, IMAGE_TYPES, IMAGE_WIDTH
};
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
int i, isNew, firstOption, index;
Tk_ImageType *typePtr;
ImageMaster *masterPtr;
@@ -271,7 +271,7 @@ Tk_ImageObjCmd(
masterPtr->instancePtr = NULL;
masterPtr->deleted = 0;
masterPtr->winPtr = winPtr->mainPtr->winPtr;
- Tcl_Preserve((ClientData) masterPtr->winPtr);
+ Tcl_Preserve(masterPtr->winPtr);
Tcl_SetHashValue(hPtr, masterPtr);
} else {
/*
@@ -279,7 +279,7 @@ Tk_ImageObjCmd(
* from the master.
*/
- masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ masterPtr = Tcl_GetHashValue(hPtr);
if (masterPtr->typePtr != NULL) {
for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
@@ -313,17 +313,17 @@ Tk_ImageObjCmd(
}
args[objc] = NULL;
}
- Tcl_Preserve((ClientData) masterPtr);
+ Tcl_Preserve(masterPtr);
if ((*typePtr->createProc)(interp, name, objc, args, typePtr,
(Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK) {
EventuallyDeleteImage(masterPtr, 0);
- Tcl_Release((ClientData) masterPtr);
+ Tcl_Release(masterPtr);
if (oldimage) {
ckfree((char *) args);
}
return TCL_ERROR;
}
- Tcl_Release((ClientData) masterPtr);
+ Tcl_Release(masterPtr);
if (oldimage) {
ckfree((char *) args);
}
@@ -345,7 +345,7 @@ Tk_ImageObjCmd(
if (hPtr == NULL) {
goto alreadyDeleted;
}
- masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ masterPtr = Tcl_GetHashValue(hPtr);
if (masterPtr->deleted) {
goto alreadyDeleted;
}
@@ -359,7 +359,7 @@ Tk_ImageObjCmd(
}
hPtr = Tcl_FirstHashEntry(&winPtr->mainPtr->imageTable, &search);
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ masterPtr = Tcl_GetHashValue(hPtr);
if (masterPtr->deleted) {
continue;
}
@@ -402,7 +402,7 @@ Tk_ImageObjCmd(
if (hPtr == NULL) {
goto alreadyDeleted;
}
- masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ masterPtr = Tcl_GetHashValue(hPtr);
if (masterPtr->deleted) {
goto alreadyDeleted;
}
@@ -500,7 +500,7 @@ Tk_ImageChanged(
*----------------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_NameOfImage(
Tk_ImageMaster imageMaster) /* Token for image. */
{
@@ -540,7 +540,7 @@ Tk_GetImage(
* be found. */
Tk_Window tkwin, /* Token for window in which image will be
* used. */
- CONST char *name, /* Name of desired image. */
+ const char *name, /* Name of desired image. */
Tk_ImageChangedProc *changeProc,
/* Function to invoke when redisplay is needed
* because image's pixels or size changed. */
@@ -554,7 +554,7 @@ Tk_GetImage(
if (hPtr == NULL) {
goto noSuchImage;
}
- masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ masterPtr = Tcl_GetHashValue(hPtr);
if (masterPtr->typePtr == NULL) {
goto noSuchImage;
}
@@ -635,7 +635,7 @@ Tk_FreeImage(
if (masterPtr->hPtr != NULL) {
Tcl_DeleteHashEntry(masterPtr->hPtr);
}
- Tcl_Release((ClientData) masterPtr->winPtr);
+ Tcl_Release(masterPtr->winPtr);
ckfree((char *) masterPtr);
}
}
@@ -855,7 +855,7 @@ void
Tk_DeleteImage(
Tcl_Interp *interp, /* Interpreter in which the image was
* created. */
- CONST char *name) /* Name of image. */
+ const char *name) /* Name of image. */
{
Tcl_HashEntry *hPtr;
TkWindow *winPtr;
@@ -868,7 +868,7 @@ Tk_DeleteImage(
if (hPtr == NULL) {
return;
}
- DeleteImage((ImageMaster *)Tcl_GetHashValue(hPtr));
+ DeleteImage(Tcl_GetHashValue(hPtr));
}
/*
@@ -913,7 +913,7 @@ DeleteImage(
if (masterPtr->hPtr != NULL) {
Tcl_DeleteHashEntry(masterPtr->hPtr);
}
- Tcl_Release((ClientData) masterPtr->winPtr);
+ Tcl_Release(masterPtr->winPtr);
ckfree((char *) masterPtr);
} else {
masterPtr->deleted = 1;
@@ -949,8 +949,7 @@ EventuallyDeleteImage(
}
if (!masterPtr->deleted) {
masterPtr->deleted = 1;
- Tcl_EventuallyFree((ClientData) masterPtr,
- (Tcl_FreeProc *)DeleteImage);
+ Tcl_EventuallyFree(masterPtr, (Tcl_FreeProc *) DeleteImage);
}
}
@@ -982,7 +981,7 @@ TkDeleteAllImages(
for (hPtr = Tcl_FirstHashEntry(&mainPtr->imageTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- EventuallyDeleteImage((ImageMaster *) Tcl_GetHashValue(hPtr), 1);
+ EventuallyDeleteImage(Tcl_GetHashValue(hPtr), 1);
}
Tcl_DeleteHashTable(&mainPtr->imageTable);
}
@@ -1011,7 +1010,7 @@ ClientData
Tk_GetImageMasterData(
Tcl_Interp *interp, /* Interpreter in which the image was
* created. */
- CONST char *name, /* Name of image. */
+ const char *name, /* Name of image. */
Tk_ImageType **typePtrPtr) /* Points to location to fill in with pointer
* to type information for image. */
{
@@ -1025,7 +1024,7 @@ Tk_GetImageMasterData(
*typePtrPtr = NULL;
return NULL;
}
- masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr);
+ masterPtr = Tcl_GetHashValue(hPtr);
if (masterPtr->deleted) {
*typePtrPtr = NULL;
return NULL;
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index fc051d9..324ccc4 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.22 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkImgBmap.c,v 1.23 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -77,7 +77,7 @@ typedef struct BitmapInstance {
static int GetByte(Tcl_Channel chan);
static int ImgBmapCreate(Tcl_Interp *interp,
- char *name, int argc, Tcl_Obj *CONST objv[],
+ char *name, int argc, Tcl_Obj *const objv[],
Tk_ImageType *typePtr, Tk_ImageMaster master,
ClientData *clientDataPtr);
static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData);
@@ -147,11 +147,11 @@ typedef struct ParseInfo {
*/
static int ImgBmapCmd(ClientData clientData, Tcl_Interp *interp,
- int argc, Tcl_Obj *CONST objv[]);
+ int argc, Tcl_Obj *const objv[]);
static void ImgBmapCmdDeletedProc(ClientData clientData);
static void ImgBmapConfigureInstance(BitmapInstance *instancePtr);
static int ImgBmapConfigureMaster(BitmapMaster *masterPtr,
- int argc, Tcl_Obj *CONST objv[], int flags);
+ int argc, Tcl_Obj *const objv[], int flags);
static int NextBitmapWord(ParseInfo *parseInfoPtr);
/*
@@ -177,7 +177,7 @@ ImgBmapCreate(
* image. */
char *name, /* Name to use for image. */
int argc, /* Number of arguments. */
- Tcl_Obj *CONST argv[], /* Argument objects for options (doesn't
+ Tcl_Obj *const argv[], /* Argument objects for options (doesn't
* include image name or type). */
Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
Tk_ImageMaster master, /* Token for image, to be used by us in later
@@ -191,7 +191,7 @@ ImgBmapCreate(
masterPtr->tkMaster = master;
masterPtr->interp = interp;
masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd,
- (ClientData) masterPtr, ImgBmapCmdDeletedProc);
+ masterPtr, ImgBmapCmdDeletedProc);
masterPtr->width = masterPtr->height = 0;
masterPtr->data = NULL;
masterPtr->maskData = NULL;
@@ -203,10 +203,10 @@ ImgBmapCreate(
masterPtr->maskDataString = NULL;
masterPtr->instancePtr = NULL;
if (ImgBmapConfigureMaster(masterPtr, argc, argv, 0) != TCL_OK) {
- ImgBmapDelete((ClientData) masterPtr);
+ ImgBmapDelete(masterPtr);
return TCL_ERROR;
}
- *clientDataPtr = (ClientData) masterPtr;
+ *clientDataPtr = masterPtr;
return TCL_OK;
}
@@ -235,22 +235,21 @@ ImgBmapConfigureMaster(
BitmapMaster *masterPtr, /* Pointer to data structure describing
* overall bitmap image to (reconfigure). */
int objc, /* Number of entries in objv. */
- Tcl_Obj *CONST objv[], /* Pairs of configuration options for image. */
+ Tcl_Obj *const objv[], /* Pairs of configuration options for image. */
int flags) /* Flags to pass to Tk_ConfigureWidget, such
* as TK_CONFIG_ARGV_ONLY. */
{
BitmapInstance *instancePtr;
int maskWidth, maskHeight, dummy1, dummy2;
- CONST char **argv = (CONST char **) ckalloc((objc+1) * sizeof(char *));
+ const char **argv = (const char **) ckalloc((objc+1) * sizeof(char *));
for (dummy1 = 0; dummy1 < objc; dummy1++) {
argv[dummy1]=Tcl_GetString(objv[dummy1]);
}
argv[objc] = NULL;
if (Tk_ConfigureWidget(masterPtr->interp, Tk_MainWindow(masterPtr->interp),
- configSpecs, objc, argv, (char *) masterPtr, flags)
- != TCL_OK) {
+ configSpecs, objc, argv, (char *) masterPtr, flags) != TCL_OK) {
ckfree((char *) argv);
return TCL_ERROR;
}
@@ -484,7 +483,7 @@ TkGetBitmapData(
int *hotXPtr, int *hotYPtr) /* Position of hot spot or -1,-1. */
{
int width, height, numBytes, hotX, hotY;
- CONST char *expandedFileName;
+ const char *expandedFileName;
char *p, *end;
ParseInfo pi;
char *data = NULL;
@@ -613,7 +612,7 @@ TkGetBitmapData(
goto error;
}
numBytes = ((width+7)/8) * height;
- data = (char *) ckalloc((unsigned) numBytes);
+ data = ckalloc((unsigned) numBytes);
for (p = data; numBytes > 0; p++, numBytes--) {
if (NextBitmapWord(&pi) != TCL_OK) {
goto error;
@@ -744,10 +743,10 @@ ImgBmapCmd(
ClientData clientData, /* Information about the image master. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- static CONST char *bmapOptions[] = {"cget", "configure", NULL};
- BitmapMaster *masterPtr = (BitmapMaster *) clientData;
+ static const char *bmapOptions[] = {"cget", "configure", NULL};
+ BitmapMaster *masterPtr = clientData;
int index;
if (objc < 2) {
@@ -809,7 +808,7 @@ ImgBmapGet(
ClientData masterData) /* Pointer to our master structure for the
* image. */
{
- BitmapMaster *masterPtr = (BitmapMaster *) masterData;
+ BitmapMaster *masterPtr = masterData;
BitmapInstance *instancePtr;
/*
@@ -821,7 +820,7 @@ ImgBmapGet(
instancePtr = instancePtr->nextPtr) {
if (instancePtr->tkwin == tkwin) {
instancePtr->refCount++;
- return (ClientData) instancePtr;
+ return instancePtr;
}
}
@@ -852,7 +851,7 @@ ImgBmapGet(
masterPtr->height);
}
- return (ClientData) instancePtr;
+ return instancePtr;
}
/*
@@ -884,7 +883,7 @@ ImgBmapDisplay(
/* Coordinates within drawable that correspond
* to imageX and imageY. */
{
- BitmapInstance *instancePtr = (BitmapInstance *) clientData;
+ BitmapInstance *instancePtr = clientData;
int masking;
/*
@@ -938,7 +937,7 @@ ImgBmapFree(
* instance to be displayed. */
Display *display) /* Display containing window that used image. */
{
- BitmapInstance *instancePtr = (BitmapInstance *) clientData;
+ BitmapInstance *instancePtr = clientData;
BitmapInstance *prevPtr;
instancePtr->refCount--;
@@ -1000,7 +999,7 @@ ImgBmapDelete(
ClientData masterData) /* Pointer to BitmapMaster structure for
* image. Must not have any more instances. */
{
- BitmapMaster *masterPtr = (BitmapMaster *) masterData;
+ BitmapMaster *masterPtr = masterData;
if (masterPtr->instancePtr != NULL) {
Tcl_Panic("tried to delete bitmap image when instances still exist");
@@ -1041,7 +1040,7 @@ ImgBmapCmdDeletedProc(
ClientData clientData) /* Pointer to BitmapMaster structure for
* image. */
{
- BitmapMaster *masterPtr = (BitmapMaster *) clientData;
+ BitmapMaster *masterPtr = clientData;
masterPtr->imageCmd = NULL;
if (masterPtr->tkMaster != NULL) {
@@ -1205,7 +1204,7 @@ ImgBmapPostscript(
int x, int y, int width, int height,
int prepass)
{
- BitmapMaster *masterPtr = (BitmapMaster *) clientData;
+ BitmapMaster *masterPtr = clientData;
char buffer[200];
if (prepass) {
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index 9a823bf..69a0c85 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -32,7 +32,7 @@
* This file also contains code from miGIF. See lower down in file for the
* applicable copyright notice for that portion.
*
- * RCS: @(#) $Id: tkImgGIF.c,v 1.43 2008/04/09 21:00:54 nijtmans Exp $
+ * RCS: @(#) $Id: tkImgGIF.c,v 1.44 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -1647,7 +1647,8 @@ color(
int x = (statePtr->alphaOffset != 0);
for (; x<=MAXCOLORMAPSIZE ; x++) {
- if ((statePtr->mapa[x][CM_RED] == red) && (statePtr->mapa[x][CM_GREEN] == green) &&
+ if ((statePtr->mapa[x][CM_RED] == red) &&
+ (statePtr->mapa[x][CM_GREEN] == green) &&
(statePtr->mapa[x][CM_BLUE] == blue)) {
return x;
}
@@ -1663,7 +1664,8 @@ nuevo(
int x = (statePtr->alphaOffset != 0);
for (; x<=statePtr->num ; x++) {
- if ((statePtr->mapa[x][CM_RED] == red) && (statePtr->mapa[x][CM_GREEN] == green) &&
+ if ((statePtr->mapa[x][CM_RED] == red) &&
+ (statePtr->mapa[x][CM_GREEN] == green) &&
(statePtr->mapa[x][CM_BLUE] == blue)) {
return 0;
}
@@ -1739,7 +1741,6 @@ ReadValue(
}
/*
- *
* GIF Image compression - modified 'compress'
*
* Based on: compress.c - File compression ala IEEE Computer, June 1984.
@@ -1750,55 +1751,54 @@ ReadValue(
* Ken Turkowski (decvax!decwrl!turtlevax!ken)
* James A. Woods (decvax!ihnp4!ames!jaw)
* Joe Orost (decvax!vax135!petsd!joe)
- *
*/
#define MAXCODE(n_bits) (((long) 1 << (n_bits)) - 1)
typedef struct {
- int n_bits; /* number of bits/code */
+ int n_bits; /* number of bits/code */
long maxcode; /* maximum code, given n_bits */
- int htab[HSIZE];
- unsigned int codetab[HSIZE];
+ int htab[HSIZE];
+ unsigned int codetab[HSIZE];
+ long hsize; /* for dynamic table sizing */
- long hsize; /* for dynamic table sizing */
+ /*
+ * To save much memory, we overlay the table used by compress() with those
+ * used by decompress(). The tab_prefix table is the same size and type as
+ * the codetab. The tab_suffix table needs 2**GIFBITS characters. We get
+ * this from the beginning of htab. The output stack uses the rest of
+ * htab, and contains characters. There is plenty of room for any possible
+ * stack (stack used to be 8000 characters).
+ */
-/*
- * To save much memory, we overlay the table used by compress() with those
- * used by decompress(). The tab_prefix table is the same size and type
- * as the codetab. The tab_suffix table needs 2**GIFBITS characters. We
- * get this from the beginning of htab. The output stack uses the rest
- * of htab, and contains characters. There is plenty of room for any
- * possible stack (stack used to be 8000 characters).
- */
+ int free_ent; /* first unused entry */
- int free_ent; /* first unused entry */
+ /*
+ * block compression parameters -- after all codes are used up,
+ * and compression rate changes, start over.
+ */
-/*
- * block compression parameters -- after all codes are used up,
- * and compression rate changes, start over.
- */
int clear_flg;
int offset;
- unsigned int in_count; /* length of input */
- unsigned int out_count; /* # of codes output (for debugging) */
+ unsigned int in_count; /* length of input */
+ unsigned int out_count; /* # of codes output (for debugging) */
-/*
- * compress stdin to stdout
- *
- * Algorithm: use open addressing double hashing (no chaining) on the
- * prefix code / next character combination. We do a variant of Knuth's
- * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
- * secondary probe. Here, the modular division first probe is gives way
- * to a faster exclusive-or manipulation. Also do block compression with
- * an adaptive reset, whereby the code table is cleared when the compression
- * ratio decreases, but after the table fills. The variable-length output
- * codes are re-sized at this point, and a special CLEAR code is generated
- * for the decompressor. Late addition: construct the table according to
- * file size for noticeable speed improvement on small files. Please direct
- * questions about this implementation to ames!jaw.
- */
+ /*
+ * compress stdin to stdout
+ *
+ * Algorithm: use open addressing double hashing (no chaining) on the
+ * prefix code / next character combination. We do a variant of Knuth's
+ * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
+ * secondary probe. Here, the modular division first probe is gives way to
+ * a faster exclusive-or manipulation. Also do block compression with an
+ * adaptive reset, whereby the code table is cleared when the compression
+ * ratio decreases, but after the table fills. The variable-length output
+ * codes are re-sized at this point, and a special CLEAR code is generated
+ * for the decompressor. Late addition: construct the table according to
+ * file size for noticeable speed improvement on small files. Please
+ * direct questions about this implementation to ames!jaw.
+ */
int g_init_bits;
Tcl_Channel g_outfile;
@@ -1807,34 +1807,36 @@ typedef struct {
int EOFCode;
unsigned long cur_accum;
- int cur_bits;
+ int cur_bits;
+
+ /*
+ * Number of characters so far in this 'packet'
+ */
-/*
- * Number of characters so far in this 'packet'
- */
int a_count;
-/*
- * Define the storage for the packet accumulator
- */
+ /*
+ * Define the storage for the packet accumulator
+ */
+
unsigned char accum[256];
} GIFState_t;
-static void output _ANSI_ARGS_((GIFState_t *statePtr, long code));
-static void cl_block _ANSI_ARGS_((GIFState_t *statePtr));
-static void cl_hash _ANSI_ARGS_((GIFState_t *statePtr, int hsize));
-static void char_init _ANSI_ARGS_((GIFState_t *statePtr));
-static void char_out _ANSI_ARGS_((GIFState_t *statePtr, int c));
-static void flush_char _ANSI_ARGS_((GIFState_t *statePtr));
-
+static void output(GIFState_t *statePtr, long code);
+static void cl_block(GIFState_t *statePtr);
+static void cl_hash(GIFState_t *statePtr, int hsize);
+static void char_init(GIFState_t *statePtr);
+static void char_out(GIFState_t *statePtr, int c);
+static void flush_char(GIFState_t *statePtr);
static void compress(int initBits, Tcl_Channel handle,
ifunptr readValue, GifWriterState *statePtr);
-
-static void compress(init_bits, handle, readValue, statePtr)
- int init_bits;
- Tcl_Channel handle;
- ifunptr readValue;
- GifWriterState *statePtr;
+
+static void
+compress(
+ int init_bits,
+ Tcl_Channel handle,
+ ifunptr readValue,
+ GifWriterState *statePtr)
{
register long fcode;
register long i = 0;
@@ -1846,16 +1848,19 @@ static void compress(init_bits, handle, readValue, statePtr)
GIFState_t state;
memset(&state, 0, sizeof(state));
+
/*
* Set up the globals: g_init_bits - initial number of bits
- * g_outfile - pointer to output file
+ * g_outfile - pointer to output file
*/
+
state.g_init_bits = init_bits;
state.g_outfile = handle;
/*
- * Set up the necessary values
+ * Set up the necessary values.
*/
+
state.offset = 0;
state.hsize = HSIZE;
state.out_count = 0;
@@ -1872,95 +1877,111 @@ static void compress(init_bits, handle, readValue, statePtr)
ent = readValue(statePtr);
hshift = 0;
- for ( fcode = (long) state.hsize; fcode < 65536L; fcode *= 2L )
- hshift++;
- hshift = 8 - hshift; /* set hash code range bound */
+ for (fcode = (long) state.hsize; fcode < 65536L; fcode *= 2L) {
+ hshift++;
+ }
+ hshift = 8 - hshift; /* set hash code range bound */
hsize_reg = state.hsize;
- cl_hash(&state, (int) hsize_reg); /* clear hash table */
+ cl_hash(&state, (int) hsize_reg); /* clear hash table */
- output(&state, (long)state.ClearCode);
+ output(&state, (long) state.ClearCode);
#ifdef SIGNED_COMPARE_SLOW
- while ( (c = readValue(statePtr) ) != (unsigned) EOF ) {
+ while ((c = readValue(statePtr)) != (unsigned) EOF)
#else
- while ( (c = readValue(statePtr)) != EOF ) {
+ while ((c = readValue(statePtr)) != EOF)
#endif
+ {
+ state.in_count++;
+
+ fcode = (long) (((long) c << GIFBITS) + ent);
+ i = (((long)c << hshift) ^ ent); /* xor hashing */
+
+ if (state.htab[i] == fcode) {
+ ent = state.codetab[i];
+ continue;
+ } else if ((long) state.htab[i] < 0) { /* empty slot */
+ goto nomatch;
+ }
+
+ disp = hsize_reg - i; /* secondary hash (after G.
+ * Knott) */
+ if (i == 0) {
+ disp = 1;
+ }
+
+ probe:
+ if ((i -= disp) < 0) {
+ i += hsize_reg;
+ }
- state.in_count++;
-
- fcode = (long) (((long) c << GIFBITS) + ent);
- i = (((long)c << hshift) ^ ent); /* xor hashing */
-
- if (state.htab[i] == fcode) {
- ent = state.codetab[i];
- continue;
- } else if ( (long) state.htab[i] < 0 ) /* empty slot */
- goto nomatch;
- disp = hsize_reg - i; /* secondary hash (after G. Knott) */
- if ( i == 0 )
- disp = 1;
-probe:
- if ( (i -= disp) < 0 )
- i += hsize_reg;
-
- if (state.htab[i] == fcode) {
- ent = state.codetab[i];
- continue;
- }
- if ( (long) state.htab[i] > 0 )
- goto probe;
-nomatch:
- output (&state, (long) ent);
- state.out_count++;
- ent = c;
+ if (state.htab[i] == fcode) {
+ ent = state.codetab[i];
+ continue;
+ }
+ if ((long) state.htab[i] > 0) {
+ goto probe;
+ }
+
+ nomatch:
+ output(&state, (long) ent);
+ state.out_count++;
+ ent = c;
#ifdef SIGNED_COMPARE_SLOW
- if ( (unsigned) free_ent < (unsigned) ((long)1 << GIFBITS)) {
+ if ((unsigned) free_ent < (unsigned) ((long)1 << GIFBITS))
#else
- if (state.free_ent < ((long)1 << GIFBITS)) {
+ if (state.free_ent < ((long)1 << GIFBITS))
#endif
- state.codetab[i] = state.free_ent++; /* code -> hashtable */
- state.htab[i] = fcode;
- } else
- cl_block(&state);
+ {
+ state.codetab[i] = state.free_ent++; /* code -> hashtable */
+ state.htab[i] = fcode;
+ } else {
+ cl_block(&state);
+ }
}
+
/*
* Put out the final code.
*/
+
output(&state, (long)ent);
state.out_count++;
output(&state, (long) state.EOFCode);
return;
}
-
+
/*****************************************************************
* TAG( output )
*
* Output the given code.
* Inputs:
- * code: A n_bits-bit integer. If == -1, then EOF. This assumes
- * that n_bits =< (long) wordsize - 1.
+ * code: A n_bits-bit integer. If == -1, then EOF. This assumes that
+ * n_bits =< (long) wordsize - 1.
* Outputs:
- * Outputs code to the file.
+ * Outputs code to the file.
* Assumptions:
- * Chars are 8 bits long.
+ * Chars are 8 bits long.
* Algorithm:
- * Maintain a GIFBITS character long buffer (so that 8 codes will
- * fit in it exactly). Use the VAX insv instruction to insert each
+ * Maintain a GIFBITS character long buffer (so that 8 codes will
+ * fit in it exactly). Use the VAX insv instruction to insert each
* code in turn. When the buffer fills up empty it and start over.
*/
static const
-unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F,
- 0x001F, 0x003F, 0x007F, 0x00FF,
- 0x01FF, 0x03FF, 0x07FF, 0x0FFF,
- 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
+unsigned long masks[] = {
+ 0x0000,
+ 0x0001, 0x0003, 0x0007, 0x000F,
+ 0x001F, 0x003F, 0x007F, 0x00FF,
+ 0x01FF, 0x03FF, 0x07FF, 0x0FFF,
+ 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF
+};
static void
-output(statePtr, code)
- GIFState_t *statePtr;
- long code;
+output(
+ GIFState_t *statePtr,
+ long code)
{
statePtr->cur_accum &= masks[statePtr->cur_bits];
@@ -1973,7 +1994,7 @@ output(statePtr, code)
statePtr->cur_bits += statePtr->n_bits;
while (statePtr->cur_bits >= 8 ) {
- char_out(statePtr, (unsigned int)(statePtr->cur_accum & 0xff));
+ char_out(statePtr, (unsigned) (statePtr->cur_accum & 0xff));
statePtr->cur_accum >>= 8;
statePtr->cur_bits -= 8;
}
@@ -1985,7 +2006,8 @@ output(statePtr, code)
if ((statePtr->free_ent > statePtr->maxcode)|| statePtr->clear_flg ) {
if (statePtr->clear_flg) {
- statePtr->maxcode = MAXCODE(statePtr->n_bits = statePtr->g_init_bits);
+ statePtr->maxcode = MAXCODE(
+ statePtr->n_bits = statePtr->g_init_bits);
statePtr->clear_flg = 0;
} else {
statePtr->n_bits++;
@@ -2001,41 +2023,42 @@ output(statePtr, code)
/*
* At EOF, write the rest of the buffer.
*/
- while (statePtr->cur_bits > 0) {
- char_out(statePtr, (unsigned int)(statePtr->cur_accum & 0xff));
+
+ while (statePtr->cur_bits > 0) {
+ char_out(statePtr, (unsigned) (statePtr->cur_accum & 0xff));
statePtr->cur_accum >>= 8;
statePtr->cur_bits -= 8;
}
flush_char(statePtr);
}
}
-
+
/*
* Clear out the hash table
*/
+
static void
-cl_block(statePtr) /* table clear for block compress */
- GIFState_t *statePtr;
+cl_block( /* table clear for block compress */
+ GIFState_t *statePtr)
{
+ cl_hash(statePtr, (int) statePtr->hsize);
+ statePtr->free_ent = statePtr->ClearCode + 2;
+ statePtr->clear_flg = 1;
- cl_hash (statePtr, (int) statePtr->hsize);
- statePtr->free_ent = statePtr->ClearCode + 2;
- statePtr->clear_flg = 1;
-
- output(statePtr, (long) statePtr->ClearCode);
+ output(statePtr, (long) statePtr->ClearCode);
}
-
+
static void
-cl_hash(statePtr, hsize) /* reset code table */
- GIFState_t *statePtr;
- int hsize;
+cl_hash( /* reset code table */
+ GIFState_t *statePtr,
+ int hsize)
{
- register int *htab_p = statePtr->htab+hsize;
+ register int *htab_p = statePtr->htab + hsize;
register long i;
register long m1 = -1;
i = hsize - 16;
- do { /* might use Sys V memset(3) here */
+ do { /* might use Sys V memset(3) here */
*(htab_p-16) = m1;
*(htab_p-15) = m1;
*(htab_p-14) = m1;
@@ -2059,53 +2082,59 @@ cl_hash(statePtr, hsize) /* reset code table */
*--htab_p = m1;
}
}
-
-
-/******************************************************************************
+
+/*
+ *****************************************************************************
*
* GIF Specific routines
*
- ******************************************************************************/
+ *****************************************************************************
+ */
/*
* Set up the 'byte output' routine
*/
+
static void
-char_init(statePtr)
- GIFState_t *statePtr;
+char_init(
+ GIFState_t *statePtr)
{
statePtr->a_count = 0;
statePtr->cur_accum = 0;
statePtr->cur_bits = 0;
}
-
+
/*
* Add a character to the end of the current packet, and if it is 254
* characters, flush the packet to disk.
*/
+
static void
-char_out(statePtr, c)
- GIFState_t *statePtr;
- int c;
+char_out(
+ GIFState_t *statePtr,
+ int c)
{
statePtr->accum[statePtr->a_count++] = c;
if (statePtr->a_count >= 254) {
flush_char(statePtr);
}
}
-
+
/*
* Flush the packet to disk, and reset the accumulator
*/
+
static void
-flush_char(statePtr)
- GIFState_t *statePtr;
+flush_char(
+ GIFState_t *statePtr)
{
unsigned char c;
+
if (statePtr->a_count > 0) {
c = statePtr->a_count;
- Tcl_Write(statePtr->g_outfile, (CONST char *) &c, 1);
- Tcl_Write(statePtr->g_outfile, (CONST char *) statePtr->accum, statePtr->a_count);
+ Tcl_Write(statePtr->g_outfile, (const char *) &c, 1);
+ Tcl_Write(statePtr->g_outfile, (const char *) statePtr->accum,
+ statePtr->a_count);
statePtr->a_count = 0;
}
}
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index 7aeeade..6419072 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -13,7 +13,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPPM.c,v 1.21 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkImgPPM.c,v 1.22 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -36,14 +36,14 @@
* The format record for the PPM file format:
*/
-static int FileMatchPPM(Tcl_Channel chan, CONST char *fileName,
+static int FileMatchPPM(Tcl_Channel chan, const char *fileName,
Tcl_Obj *format, int *widthPtr, int *heightPtr,
Tcl_Interp *interp);
static int FileReadPPM(Tcl_Interp *interp, Tcl_Channel chan,
- CONST char *fileName, Tcl_Obj *format,
+ const char *fileName, Tcl_Obj *format,
Tk_PhotoHandle imageHandle, int destX, int destY,
int width, int height, int srcX, int srcY);
-static int FileWritePPM(Tcl_Interp *interp, CONST char *fileName,
+static int FileWritePPM(Tcl_Interp *interp, const char *fileName,
Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr);
static int StringWritePPM(Tcl_Interp *interp, Tcl_Obj *format,
Tk_PhotoImageBlock *blockPtr);
@@ -95,7 +95,7 @@ static int ReadPPMStringHeader(Tcl_Obj *dataObj, int *widthPtr,
static int
FileMatchPPM(
Tcl_Channel chan, /* The image file, open for reading. */
- CONST char *fileName, /* The name of the image file. */
+ const char *fileName, /* The name of the image file. */
Tcl_Obj *format, /* User-specified format string, or NULL. */
int *widthPtr, int *heightPtr,
/* The dimensions of the image are returned
@@ -131,7 +131,7 @@ static int
FileReadPPM(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
Tcl_Channel chan, /* The image file, open for reading. */
- CONST char *fileName, /* The name of the image file. */
+ const char *fileName, /* The name of the image file. */
Tcl_Obj *format, /* User-specified format string, or NULL. */
Tk_PhotoHandle imageHandle, /* The photo image to write into. */
int destX, int destY, /* Coordinates of top-left pixel in photo
@@ -267,7 +267,7 @@ FileReadPPM(
static int
FileWritePPM(
Tcl_Interp *interp,
- CONST char *fileName,
+ const char *fileName,
Tcl_Obj *format,
Tk_PhotoImageBlock *blockPtr)
{
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index eff0fde..3d7b017 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.76 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.77 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -302,7 +302,7 @@ static char *optionNames[] = {
*/
static int ImgPhotoCreate(Tcl_Interp *interp, char *name,
- int objc, Tcl_Obj *CONST objv[],
+ int objc, Tcl_Obj *const objv[],
Tk_ImageType *typePtr, Tk_ImageMaster master,
ClientData *clientDataPtr);
static ClientData ImgPhotoGet(Tk_Window tkwin, ClientData clientData);
@@ -395,7 +395,7 @@ static int imgPhotoColorHashInitialized;
static void PhotoFormatThreadExitProc(ClientData clientData);
static int ImgPhotoCmd(ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int ParseSubcommandOptions(
struct SubcommandOptions *optPtr,
Tcl_Interp *interp, int allowedOptions,
@@ -579,7 +579,7 @@ ImgPhotoCreate(
* image. */
char *name, /* Name to use for image. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[], /* Argument objects for options (doesn't
+ Tcl_Obj *const objv[], /* Argument objects for options (doesn't
* include image name or type). */
Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
Tk_ImageMaster master, /* Token for image, to be used by us in later
@@ -598,7 +598,7 @@ ImgPhotoCreate(
masterPtr->tkMaster = master;
masterPtr->interp = interp;
masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
- (ClientData) masterPtr, ImgPhotoCmdDeletedProc);
+ masterPtr, ImgPhotoCmdDeletedProc);
masterPtr->palette = NULL;
masterPtr->pix32 = NULL;
masterPtr->instancePtr = NULL;
@@ -609,11 +609,11 @@ ImgPhotoCreate(
*/
if (ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, 0) != TCL_OK) {
- ImgPhotoDelete((ClientData) masterPtr);
+ ImgPhotoDelete(masterPtr);
return TCL_ERROR;
}
- *clientDataPtr = (ClientData) masterPtr;
+ *clientDataPtr = masterPtr;
return TCL_OK;
}
@@ -640,7 +640,7 @@ ImgPhotoCmd(
ClientData clientData, /* Information about photo master. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *photoOptions[] = {
"blank", "cget", "configure", "copy", "data", "get", "put",
@@ -652,7 +652,7 @@ ImgPhotoCmd(
PHOTO_WRITE
};
- PhotoMaster *masterPtr = (PhotoMaster *) clientData;
+ PhotoMaster *masterPtr = clientData;
int result, index, x, y, width, height, dataWidth, dataHeight, listObjc;
struct SubcommandOptions options;
Tcl_Obj **listObjv, **srcObjv;
@@ -1206,7 +1206,7 @@ ImgPhotoCmd(
block.offset[1] = 1;
block.offset[2] = 2;
block.offset[3] = 0;
- result = Tk_PhotoPutBlock(interp, (ClientData)masterPtr, &block,
+ result = Tk_PhotoPutBlock(interp, masterPtr, &block,
options.toX, options.toY, options.toX2 - options.toX,
options.toY2 - options.toY,
TK_PHOTO_COMPOSITE_SET);
@@ -2328,7 +2328,7 @@ ImgPhotoGet(
ClientData masterData) /* Pointer to our master structure for the
* image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) masterData;
+ PhotoMaster *masterPtr = masterData;
PhotoInstance *instancePtr;
Colormap colormap;
int mono, nRed, nGreen, nBlue, numVisuals;
@@ -2378,14 +2378,14 @@ ImgPhotoGet(
* We are resurrecting this instance.
*/
- Tcl_CancelIdleCall(DisposeInstance, (ClientData) instancePtr);
+ Tcl_CancelIdleCall(DisposeInstance, instancePtr);
if (instancePtr->colorTablePtr != NULL) {
FreeColorTable(instancePtr->colorTablePtr, 0);
}
GetColorTable(instancePtr);
}
instancePtr->refCount++;
- return (ClientData) instancePtr;
+ return instancePtr;
}
}
@@ -2489,7 +2489,7 @@ ImgPhotoGet(
masterPtr->width, masterPtr->height);
}
- return (ClientData) instancePtr;
+ return instancePtr;
}
/*
@@ -2760,7 +2760,7 @@ ImgPhotoDisplay(
int drawableX,int drawableY)/* Coordinates within drawable that correspond
* to imageX and imageY. */
{
- PhotoInstance *instancePtr = (PhotoInstance *) clientData;
+ PhotoInstance *instancePtr = clientData;
XVisualInfo visInfo = instancePtr->visualInfo;
/*
@@ -2783,8 +2783,7 @@ ImgPhotoDisplay(
* not properly constrained, which can cause an X error. [Bug 979239]
*/
- handler = Tk_CreateErrorHandler(display, -1, -1, -1, NULL,
- (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);
/*
* Pull the current background from the display to blend with
@@ -2855,7 +2854,7 @@ ImgPhotoFree(
Display *display) /* Display containing window that used
* image. */
{
- PhotoInstance *instancePtr = (PhotoInstance *) clientData;
+ PhotoInstance *instancePtr = clientData;
ColorTable *colorPtr;
instancePtr->refCount -= 1;
@@ -2875,7 +2874,7 @@ ImgPhotoFree(
colorPtr->liveRefCount -= 1;
}
- Tcl_DoWhenIdle(DisposeInstance, (ClientData) instancePtr);
+ Tcl_DoWhenIdle(DisposeInstance, instancePtr);
}
/*
@@ -2900,15 +2899,15 @@ ImgPhotoDelete(
ClientData masterData) /* Pointer to PhotoMaster structure for image.
* Must not have any more instances. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) masterData;
+ PhotoMaster *masterPtr = masterData;
PhotoInstance *instancePtr;
while ((instancePtr = masterPtr->instancePtr) != NULL) {
if (instancePtr->refCount > 0) {
Tcl_Panic("tried to delete photo image when instances still exist");
}
- Tcl_CancelIdleCall(DisposeInstance, (ClientData) instancePtr);
- DisposeInstance((ClientData) instancePtr);
+ Tcl_CancelIdleCall(DisposeInstance, instancePtr);
+ DisposeInstance(instancePtr);
}
masterPtr->tkMaster = NULL;
if (masterPtr->imageCmd != NULL) {
@@ -2952,7 +2951,7 @@ ImgPhotoCmdDeletedProc(
ClientData clientData) /* Pointer to PhotoMaster structure for
* image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) clientData;
+ PhotoMaster *masterPtr = clientData;
masterPtr->imageCmd = NULL;
if (masterPtr->tkMaster != NULL) {
@@ -3350,7 +3349,7 @@ IsValidPalette(
case StaticColor:
numColors = nRed;
if (!mono) {
- numColors *= nGreen*nBlue;
+ numColors *= nGreen * nBlue;
}
if (numColors > (1 << instancePtr->visualInfo.depth)) {
return 0;
@@ -3447,7 +3446,7 @@ GetColorTable(
* Re-use the existing entry.
*/
- colorPtr = (ColorTable *) Tcl_GetHashValue(entry);
+ colorPtr = Tcl_GetHashValue(entry);
} else {
/*
* No color table currently available; need to make one.
@@ -3480,7 +3479,7 @@ GetColorTable(
colorPtr->liveRefCount++;
instancePtr->colorTablePtr = colorPtr;
if (colorPtr->flags & DISPOSE_PENDING) {
- Tcl_CancelIdleCall(DisposeColorTable, (ClientData) colorPtr);
+ Tcl_CancelIdleCall(DisposeColorTable, colorPtr);
colorPtr->flags &= ~DISPOSE_PENDING;
}
@@ -3525,12 +3524,12 @@ FreeColorTable(
if (force) {
if ((colorPtr->flags & DISPOSE_PENDING) != 0) {
- Tcl_CancelIdleCall(DisposeColorTable, (ClientData) colorPtr);
+ Tcl_CancelIdleCall(DisposeColorTable, colorPtr);
colorPtr->flags &= ~DISPOSE_PENDING;
}
- DisposeColorTable((ClientData) colorPtr);
+ DisposeColorTable(colorPtr);
} else if ((colorPtr->flags & DISPOSE_PENDING) == 0) {
- Tcl_DoWhenIdle(DisposeColorTable, (ClientData) colorPtr);
+ Tcl_DoWhenIdle(DisposeColorTable, colorPtr);
colorPtr->flags |= DISPOSE_PENDING;
}
}
@@ -3840,7 +3839,7 @@ DisposeColorTable(
ClientData clientData) /* Pointer to the ColorTable whose
* colors are to be released. */
{
- ColorTable *colorPtr = (ColorTable *) clientData;
+ ColorTable *colorPtr = clientData;
Tcl_HashEntry *entry;
if (colorPtr->pixelMap != NULL) {
@@ -3900,7 +3899,7 @@ ReclaimColors(
entry = Tcl_FirstHashEntry(&imgPhotoColorHash, &srch);
while (entry != NULL) {
- colorPtr = (ColorTable *) Tcl_GetHashValue(entry);
+ colorPtr = Tcl_GetHashValue(entry);
if ((colorPtr->id.display == id->display)
&& (colorPtr->id.colormap == id->colormap)
&& (colorPtr->liveRefCount == 0 )&& (colorPtr->numColors != 0)
@@ -3929,7 +3928,7 @@ ReclaimColors(
entry = Tcl_FirstHashEntry(&imgPhotoColorHash, &srch);
while ((entry != NULL) && (numColors > 0)) {
- colorPtr = (ColorTable *) Tcl_GetHashValue(entry);
+ colorPtr = Tcl_GetHashValue(entry);
if ((colorPtr->id.display == id->display)
&& (colorPtr->id.colormap == id->colormap)
&& (colorPtr->liveRefCount == 0) && (colorPtr->numColors != 0)
@@ -3974,7 +3973,7 @@ DisposeInstance(
ClientData clientData) /* Pointer to the instance whose resources are
* to be released. */
{
- PhotoInstance *instancePtr = (PhotoInstance *) clientData;
+ PhotoInstance *instancePtr = clientData;
PhotoInstance *prevPtr;
if (instancePtr->pixels != None) {
@@ -4273,16 +4272,16 @@ Tk_PhotoHandle
Tk_FindPhoto(
Tcl_Interp *interp, /* Interpreter (application) in which image
* exists. */
- CONST char *imageName) /* Name of the desired photo image. */
+ const char *imageName) /* Name of the desired photo image. */
{
- ClientData clientData;
Tk_ImageType *typePtr;
+ ClientData clientData =
+ Tk_GetImageMasterData(interp, imageName, &typePtr);
- clientData = Tk_GetImageMasterData(interp, imageName, &typePtr);
if (typePtr != &tkPhotoImageType) {
return NULL;
}
- return (Tk_PhotoHandle) clientData;
+ return clientData;
}
/*
@@ -4617,7 +4616,7 @@ Tk_PhotoPutBlock(
if (!sourceIsSimplePhoto && (width == 1) && (height == 1)) {
/*
* Optimize the single pixel case if we can. This speeds up code that
- * builds up large simple-alpha images by single pixels. We don't
+ * builds up large simple-alpha images by single pixels. We don't
* negate COMPLEX_ALPHA in this case. [Bug 1409140]
*/
@@ -4634,7 +4633,7 @@ Tk_PhotoPutBlock(
} else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) {
/*
* Check for partial transparency if alpha pixels are specified, or
- * rescan if we already knew such pixels existed. To restrict this
+ * rescan if we already knew such pixels existed. To restrict this
* Toggle to only checking the changed pixels requires knowing where
* the alpha pixels are.
*/
@@ -4743,7 +4742,7 @@ Tk_PhotoPutZoomedBlock(
}
if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
- && (x < masterPtr->ditherX))) {
+ && (x < masterPtr->ditherX))) {
/*
* The dithering isn't correct past the start of this block.
*/
@@ -4917,7 +4916,7 @@ Tk_PhotoPutZoomedBlock(
if (!sourceIsSimplePhoto && (width == 1) && (height == 1)) {
/*
* Optimize the single pixel case if we can. This speeds up code that
- * builds up large simple-alpha images by single pixels. We don't
+ * builds up large simple-alpha images by single pixels. We don't
* negate COMPLEX_ALPHA in this case. [Bug 1409140]
*/
if (!(masterPtr->flags & COMPLEX_ALPHA)) {
@@ -4933,7 +4932,7 @@ Tk_PhotoPutZoomedBlock(
} else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) {
/*
* Check for partial transparency if alpha pixels are specified, or
- * rescan if we already knew such pixels existed. To restrict this
+ * rescan if we already knew such pixels existed. To restrict this
* Toggle to only checking the changed pixels requires knowing where
* the alpha pixels are.
*/
@@ -5246,7 +5245,7 @@ DitherInstance(
for (x = xStart; x < xEnd; ++x) {
c = (x > 0) ? errPtr[-1] * 7: 0;
if (y > 0) {
- if (x > 0) {
+ if (x > 0) {
c += errPtr[-lineLength-1];
}
c += errPtr[-lineLength] * 5;
@@ -5259,7 +5258,7 @@ DitherInstance(
if ((masterPtr->flags & COLOR_IMAGE) == 0) {
c += srcPtr[0];
} else {
- c += (unsigned)(srcPtr[0] * 11 + srcPtr[1] * 16
+ c += (unsigned) (srcPtr[0] * 11 + srcPtr[1] * 16
+ srcPtr[2] * 5 + 16) >> 5;
}
srcPtr += 4;
@@ -5900,8 +5899,7 @@ PhotoOptionFind(
char *name = Tcl_GetStringFromObj(obj, &length);
char *prevname = NULL;
Tcl_ObjCmdProc *proc = NULL;
- OptionAssocData *list = (OptionAssocData *) Tcl_GetAssocData(interp,
- "photoOption", NULL);
+ OptionAssocData *list = Tcl_GetAssocData(interp, "photoOption", NULL);
while (list != NULL) {
if (strncmp(name, list->name, (unsigned) length) == 0) {
@@ -5951,7 +5949,7 @@ PhotoOptionCleanupProc(
* interpreter. */
Tcl_Interp *interp) /* Interpreter that is being deleted. */
{
- OptionAssocData *list = (OptionAssocData *) clientData;
+ OptionAssocData *list = clientData;
while (list != NULL) {
register OptionAssocData *ptr;
@@ -5981,12 +5979,11 @@ PhotoOptionCleanupProc(
MODULE_SCOPE void
Tk_CreatePhotoOption(
Tcl_Interp *interp, /* Interpreter. */
- CONST char *name, /* Option name. */
+ const char *name, /* Option name. */
Tcl_ObjCmdProc *proc) /* Function to execute command. */
{
OptionAssocData *typePtr2, *prevPtr, *ptr;
- OptionAssocData *list = (OptionAssocData *)
- Tcl_GetAssocData(interp, "photoOption", NULL);
+ OptionAssocData *list = Tcl_GetAssocData(interp, "photoOption", NULL);
/*
* If there's already a photo option with the given name, remove it.
@@ -6008,8 +6005,7 @@ Tk_CreatePhotoOption(
strcpy(&(ptr->name[0]), name);
ptr->command = proc;
ptr->nextPtr = list;
- Tcl_SetAssocData(interp, "photoOption", PhotoOptionCleanupProc,
- (ClientData) ptr);
+ Tcl_SetAssocData(interp, "photoOption", PhotoOptionCleanupProc, ptr);
}
/*
@@ -6041,7 +6037,7 @@ ImgPhotoPostscript(
{
Tk_PhotoImageBlock block;
- Tk_PhotoGetImage((Tk_PhotoHandle) clientData, &block);
+ Tk_PhotoGetImage(clientData, &block);
block.pixelPtr += y * block.pitch + x * block.pixelSize;
return Tk_PostscriptPhoto(interp, &block, psInfo, width, height);
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 9f6a73c..396c93f 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMain.c,v 1.29 2008/04/01 16:30:54 dgp Exp $
+ * RCS: @(#) $Id: tkMain.c,v 1.30 2008/04/27 22:38:56 dkf Exp $
*/
#include <ctype.h>
@@ -56,7 +56,7 @@ static Tcl_ThreadDataKey dataKey;
#if !defined(__WIN32__) && !defined(_WIN32)
extern int isatty(int fd);
-extern char * strrchr(CONST char *string, int c);
+extern char * strrchr(const char *string, int c);
#endif
/*
@@ -96,7 +96,7 @@ Tk_MainEx(
Tcl_Interp *interp)
{
Tcl_Obj *path, *argvPtr;
- CONST char *encodingName;
+ const char *encodingName;
int code, nullStdin = 0;
Tcl_Channel inChannel, outChannel;
ThreadSpecificData *tsdPtr;
@@ -114,12 +114,11 @@ Tk_MainEx(
abort();
}
- tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_FindExecutable(argv[0]);
tsdPtr->interp = interp;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
#if defined(__WIN32__)
Tk_InitConsoleChannels(interp);
@@ -176,7 +175,7 @@ Tk_MainEx(
Tcl_ExternalToUtfDString(NULL, argv[0], -1, &appName);
} else {
int numBytes;
- CONST char *pathName = Tcl_GetStringFromObj(path, &numBytes);
+ const char *pathName = Tcl_GetStringFromObj(path, &numBytes);
Tcl_ExternalToUtfDString(NULL, pathName, numBytes, &appName);
path = Tcl_NewStringObj(Tcl_DStringValue(&appName), -1);
@@ -298,7 +297,7 @@ Tk_MainEx(
inChannel = Tcl_GetStdChannel(TCL_STDIN);
if (inChannel) {
Tcl_CreateChannelHandler(inChannel, TCL_READABLE, StdinProc,
- (ClientData) inChannel);
+ inChannel);
}
if (tsdPtr->tty) {
Prompt(interp, 0);
@@ -320,7 +319,7 @@ Tk_MainEx(
Tk_MainLoop();
Tcl_DeleteInterp(interp);
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
Tcl_SetStartupScript(NULL, NULL);
Tcl_Exit(0);
}
@@ -353,8 +352,8 @@ StdinProc(
static int gotPartial = 0;
char *cmd;
int code, count;
- Tcl_Channel chan = (Tcl_Channel) clientData;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_Channel chan = clientData;
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_Interp *interp = tsdPtr->interp;
@@ -364,13 +363,12 @@ StdinProc(
if (tsdPtr->tty) {
Tcl_Exit(0);
} else {
- Tcl_DeleteChannelHandler(chan, StdinProc, (ClientData) chan);
+ Tcl_DeleteChannelHandler(chan, StdinProc, chan);
}
return;
}
- (void) Tcl_DStringAppend(&tsdPtr->command, Tcl_DStringValue(
- &tsdPtr->line), -1);
+ Tcl_DStringAppend(&tsdPtr->command, Tcl_DStringValue(&tsdPtr->line), -1);
cmd = Tcl_DStringAppend(&tsdPtr->command, "\n", -1);
Tcl_DStringFree(&tsdPtr->line);
if (!Tcl_CommandComplete(cmd)) {
@@ -386,13 +384,12 @@ StdinProc(
* things, this will trash the text of the command being evaluated.
*/
- Tcl_CreateChannelHandler(chan, 0, StdinProc, (ClientData) chan);
+ Tcl_CreateChannelHandler(chan, 0, StdinProc, chan);
code = Tcl_RecordAndEval(interp, cmd, TCL_EVAL_GLOBAL);
chan = Tcl_GetStdChannel(TCL_STDIN);
if (chan) {
- Tcl_CreateChannelHandler(chan, TCL_READABLE, StdinProc,
- (ClientData) chan);
+ Tcl_CreateChannelHandler(chan, TCL_READABLE, StdinProc, chan);
}
Tcl_DStringFree(&tsdPtr->command);
if (Tcl_GetStringResult(interp)[0] != '\0') {
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index a402fc3..1f18cc3 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.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: tkMenu.c,v 1.41 2007/12/13 15:24:15 dgp Exp $
+ * RCS: @(#) $Id: tkMenu.c,v 1.42 2008/04/27 22:38:56 dkf Exp $
*/
/*
@@ -101,7 +101,7 @@ TCL_DECLARE_MUTEX(menuMutex)
char *tkMenuStateStrings[] = {"active", "normal", "disabled", NULL};
-static CONST char *menuEntryTypeStrings[] = {
+static const char *menuEntryTypeStrings[] = {
"cascade", "checkbutton", "command", "radiobutton", "separator", NULL
};
@@ -310,7 +310,7 @@ static const Tk_OptionSpec tkMenuConfigSpecs[] = {
* with MenuWidgetObjCmd.
*/
-static CONST char *menuOptions[] = {
+static const char *menuOptions[] = {
"activate", "add", "cget", "clone", "configure", "delete", "entrycget",
"entryconfigure", "index", "insert", "invoke", "post", "postcascade",
"type", "unpost", "xposition", "yposition", NULL
@@ -329,12 +329,12 @@ enum options {
static int CloneMenu(TkMenu *menuPtr, Tcl_Obj *newMenuName,
Tcl_Obj *newMenuTypeString);
static int ConfigureMenu(Tcl_Interp *interp, TkMenu *menuPtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int ConfigureMenuCloneEntries(Tcl_Interp *interp,
TkMenu *menuPtr, int index,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int ConfigureMenuEntry(TkMenuEntry *mePtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void DeleteMenuCloneEntries(TkMenu *menuPtr,
int first, int last);
static void DestroyMenuHashTable(ClientData clientData,
@@ -349,17 +349,17 @@ static int MenuDoXPosition(Tcl_Interp *interp,
TkMenu *menuPtr, Tcl_Obj *objPtr);
static int MenuAddOrInsert(Tcl_Interp *interp,
TkMenu *menuPtr, Tcl_Obj *indexPtr, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int MenuCmd(ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void MenuCmdDeletedProc(ClientData clientData);
static TkMenuEntry * MenuNewEntry(TkMenu *menuPtr, int index, int type);
static char * MenuVarProc(ClientData clientData,
- Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags);
+ Tcl_Interp *interp, const char *name1,
+ const char *name2, int flags);
static int MenuWidgetObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static void MenuWorldChanged(ClientData instanceData);
static int PostProcessEntry(TkMenuEntry *mePtr);
static void RecursivelyDeleteMenu(TkMenu *menuPtr);
@@ -416,8 +416,7 @@ TkCreateMenuCmd(
optionTablesPtr->entryOptionTables[CHECK_BUTTON_ENTRY] =
Tk_CreateOptionTable(interp, specsArray[CHECK_BUTTON_ENTRY]);
- Tcl_CreateObjCommand(interp, "menu", MenuCmd,
- (ClientData) optionTablesPtr, NULL);
+ Tcl_CreateObjCommand(interp, "menu", MenuCmd, optionTablesPtr, NULL);
if (Tcl_IsSafe(interp)) {
Tcl_HideCommand(interp, "menu", "menu");
@@ -448,7 +447,7 @@ MenuCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument strings. */
+ Tcl_Obj *const objv[]) /* Argument strings. */
{
Tk_Window tkwin = Tk_MainWindow(interp);
Tk_Window newWin;
@@ -456,8 +455,8 @@ MenuCmd(
TkMenuReferences *menuRefPtr;
int i, index, toplevel;
char *windowName;
- static CONST char *typeStringList[] = {"-type", NULL};
- TkMenuOptionTables *optionTablesPtr = (TkMenuOptionTables *) clientData;
+ static const char *typeStringList[] = {"-type", NULL};
+ TkMenuOptionTables *optionTablesPtr = clientData;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?");
@@ -497,8 +496,8 @@ MenuCmd(
menuPtr->display = Tk_Display(newWin);
menuPtr->interp = interp;
menuPtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd,
- (ClientData) menuPtr, MenuCmdDeletedProc);
+ Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr,
+ MenuCmdDeletedProc);
menuPtr->active = -1;
menuPtr->cursorPtr = None;
menuPtr->masterMenuPtr = menuPtr;
@@ -507,10 +506,10 @@ MenuCmd(
TkMenuInitializeDrawingFields(menuPtr);
Tk_SetClass(menuPtr->tkwin, "Menu");
- Tk_SetClassProcs(menuPtr->tkwin, &menuClass, (ClientData) menuPtr);
+ Tk_SetClassProcs(menuPtr->tkwin, &menuClass, menuPtr);
Tk_CreateEventHandler(newWin,
ExposureMask|StructureNotifyMask|ActivateMask,
- TkMenuEventProc, (ClientData) menuPtr);
+ TkMenuEventProc, menuPtr);
if (Tk_InitOptions(interp, (char *) menuPtr,
menuPtr->optionTablesPtr->menuOptionTable, menuPtr->tkwin)
!= TCL_OK) {
@@ -661,9 +660,9 @@ MenuWidgetObjCmd(
ClientData clientData, /* Information about menu widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument strings. */
+ Tcl_Obj *const objv[]) /* Argument strings. */
{
- register TkMenu *menuPtr = (TkMenu *) clientData;
+ register TkMenu *menuPtr = clientData;
register TkMenuEntry *mePtr;
int result = TCL_OK;
int option;
@@ -676,7 +675,7 @@ MenuWidgetObjCmd(
&option) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_Preserve((ClientData) menuPtr);
+ Tcl_Preserve(menuPtr);
switch ((enum options) option) {
case MENU_ACTIVATE: {
@@ -808,10 +807,10 @@ MenuWidgetObjCmd(
goto done;
}
mePtr = menuPtr->entries[index];
- Tcl_Preserve((ClientData) mePtr);
+ Tcl_Preserve(mePtr);
resultPtr = Tk_GetOptionValue(interp, (char *) mePtr,
mePtr->optionTable, objv[3], menuPtr->tkwin);
- Tcl_Release((ClientData) mePtr);
+ Tcl_Release(mePtr);
if (resultPtr == NULL) {
goto error;
}
@@ -833,7 +832,7 @@ MenuWidgetObjCmd(
goto done;
}
mePtr = menuPtr->entries[index];
- Tcl_Preserve((ClientData) mePtr);
+ Tcl_Preserve(mePtr);
if (objc == 3) {
resultPtr = Tk_GetOptionInfo(interp, (char *) mePtr,
mePtr->optionTable, NULL, menuPtr->tkwin);
@@ -856,7 +855,7 @@ MenuWidgetObjCmd(
result = ConfigureMenuCloneEntries(interp, menuPtr, index,
objc-3, objv+3);
}
- Tcl_Release((ClientData) mePtr);
+ Tcl_Release(mePtr);
break;
}
case MENU_INDEX: {
@@ -989,11 +988,11 @@ MenuWidgetObjCmd(
break;
}
done:
- Tcl_Release((ClientData) menuPtr);
+ Tcl_Release(menuPtr);
return result;
error:
- Tcl_Release((ClientData) menuPtr);
+ Tcl_Release(menuPtr);
return TCL_ERROR;
}
@@ -1032,9 +1031,11 @@ TkInvokeMenu(
if (mePtr->state == ENTRY_DISABLED) {
goto done;
}
- Tcl_Preserve((ClientData) mePtr);
+
+ Tcl_Preserve(mePtr);
if (mePtr->type == TEAROFF_ENTRY) {
Tcl_DString ds;
+
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds, "tk::TearOffMenu ", -1);
Tcl_DStringAppend(&ds, Tk_PathName(menuPtr->tkwin), -1);
@@ -1087,7 +1088,8 @@ TkInvokeMenu(
result = Tcl_EvalObjEx(interp, commandPtr, TCL_EVAL_GLOBAL);
Tcl_DecrRefCount(commandPtr);
}
- Tcl_Release((ClientData) mePtr);
+ Tcl_Release(mePtr);
+
done:
return result;
}
@@ -1469,7 +1471,7 @@ DestroyMenuEntry(
Tcl_UntraceVar(menuPtr->interp, varName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- MenuVarProc, (ClientData) mePtr);
+ MenuVarProc, mePtr);
}
TkpDestroyMenuEntry(mePtr);
TkMenuEntryFreeDrawOptions(mePtr);
@@ -1499,7 +1501,7 @@ static void
MenuWorldChanged(
ClientData instanceData) /* Information about widget. */
{
- TkMenu *menuPtr = (TkMenu *) instanceData;
+ TkMenu *menuPtr = instanceData;
int i;
TkMenuConfigureDrawOptions(menuPtr);
@@ -1536,7 +1538,7 @@ ConfigureMenu(
register TkMenu *menuPtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[]) /* Arguments. */
+ Tcl_Obj *const objv[]) /* Arguments. */
{
int i;
TkMenu *menuListPtr, *cleanupPtr;
@@ -1620,8 +1622,7 @@ ConfigureMenu(
&& (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) {
int i;
- Tcl_EventuallyFree((ClientData) menuListPtr->entries[0],
- DestroyMenuEntry);
+ Tcl_EventuallyFree(menuListPtr->entries[0], DestroyMenuEntry);
for (i = 0; i < menuListPtr->numEntries - 1; i++) {
menuListPtr->entries[i] = menuListPtr->entries[i + 1];
@@ -1789,7 +1790,7 @@ PostProcessEntry(
char *imageString = Tcl_GetString(mePtr->imagePtr);
image = Tk_GetImage(menuPtr->interp, menuPtr->tkwin, imageString,
- TkMenuImageProc, (ClientData) mePtr);
+ TkMenuImageProc, mePtr);
if (image == NULL) {
return TCL_ERROR;
}
@@ -1804,7 +1805,7 @@ PostProcessEntry(
char *selectImageString = Tcl_GetString(mePtr->selectImagePtr);
image = Tk_GetImage(menuPtr->interp, menuPtr->tkwin, selectImageString,
- TkMenuSelectImageProc, (ClientData) mePtr);
+ TkMenuSelectImageProc, mePtr);
if (image == NULL) {
return TCL_ERROR;
}
@@ -1871,7 +1872,7 @@ PostProcessEntry(
name = Tcl_GetString(mePtr->namePtr);
Tcl_TraceVar(menuPtr->interp, name,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- MenuVarProc, (ClientData) mePtr);
+ MenuVarProc, mePtr);
}
}
@@ -1902,7 +1903,7 @@ ConfigureMenuEntry(
register TkMenuEntry *mePtr,/* Information about menu entry; may or may
* not already have values for some fields. */
int objc, /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[]) /* Arguments. */
+ Tcl_Obj *const objv[]) /* Arguments. */
{
TkMenu *menuPtr = mePtr->menuPtr;
Tk_SavedOptions errorStruct;
@@ -1920,7 +1921,7 @@ ConfigureMenuEntry(
Tcl_UntraceVar(menuPtr->interp, name,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- MenuVarProc, (ClientData) mePtr);
+ MenuVarProc, mePtr);
}
result = TCL_OK;
@@ -1967,7 +1968,7 @@ ConfigureMenuCloneEntries(
TkMenu *menuPtr, /* Information about whole menu. */
int index, /* Index of mePtr within menuPtr's entries. */
int objc, /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[]) /* Arguments. */
+ Tcl_Obj *const objv[]) /* Arguments. */
{
TkMenuEntry *mePtr;
TkMenu *menuListPtr;
@@ -2195,7 +2196,7 @@ static void
MenuCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkMenu *menuPtr = (TkMenu *) clientData;
+ TkMenu *menuPtr = clientData;
Tk_Window tkwin = menuPtr->tkwin;
/*
@@ -2336,7 +2337,7 @@ MenuAddOrInsert(
Tcl_Obj *indexPtr, /* Object describing index at which to insert.
* NULL means insert at end. */
int objc, /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments to command: first arg is type of
+ Tcl_Obj *const objv[]) /* Arguments to command: first arg is type of
* entry, others are config options. */
{
int type, index;
@@ -2386,7 +2387,7 @@ MenuAddOrInsert(
for (errorMenuPtr = menuPtr->masterMenuPtr;
errorMenuPtr != NULL;
errorMenuPtr = errorMenuPtr->nextInstancePtr) {
- Tcl_EventuallyFree((ClientData) errorMenuPtr->entries[index],
+ Tcl_EventuallyFree(errorMenuPtr->entries[index],
DestroyMenuEntry);
for (i = index; i < errorMenuPtr->numEntries - 1; i++) {
errorMenuPtr->entries[i] = errorMenuPtr->entries[i + 1];
@@ -2474,15 +2475,14 @@ static char *
MenuVarProc(
ClientData clientData, /* Information about menu entry. */
Tcl_Interp *interp, /* Interpreter containing variable. */
- CONST char *name1, /* First part of variable's name. */
- CONST char *name2, /* Second part of variable's name. */
+ const char *name1, /* First part of variable's name. */
+ const char *name2, /* Second part of variable's name. */
int flags) /* Describes what just happened. */
{
- TkMenuEntry *mePtr = (TkMenuEntry *) clientData;
+ TkMenuEntry *mePtr = clientData;
TkMenu *menuPtr;
- CONST char *value;
- char *name;
- char *onValue;
+ const char *value;
+ char *name, *onValue;
if (flags & TCL_INTERP_DESTROYED) {
/*
@@ -2686,7 +2686,7 @@ CloneMenu(
for (i = 0; i < 4; i++) {
Tcl_IncrRefCount(menuDupCommandArray[i]);
}
- Tcl_Preserve((ClientData) menuPtr);
+ Tcl_Preserve(menuPtr);
returnResult = Tcl_EvalObjv(menuPtr->interp, 4, menuDupCommandArray, 0);
for (i = 0; i < 4; i++) {
Tcl_DecrRefCount(menuDupCommandArray[i]);
@@ -2732,8 +2732,8 @@ CloneMenu(
newObjv[1] = Tcl_NewStringObj(Tk_PathName(newMenuPtr->tkwin), -1);
Tcl_IncrRefCount(newObjv[0]);
Tcl_IncrRefCount(newObjv[1]);
- if (Tk_BindtagsObjCmd((ClientData)newMenuPtr->tkwin,
- newMenuPtr->interp, 2, newObjv) == TCL_OK) {
+ if (Tk_BindtagsObjCmd(newMenuPtr->tkwin, newMenuPtr->interp, 2,
+ newObjv) == TCL_OK) {
char *windowName;
Tcl_Obj *bindingsPtr =
Tcl_DuplicateObj(Tcl_GetObjResult(newMenuPtr->interp));
@@ -2758,8 +2758,8 @@ CloneMenu(
Tcl_ListObjReplace(menuPtr->interp, bindingsPtr,
i + 1, 0, 1, &newElementPtr);
newObjv[2] = bindingsPtr;
- Tk_BindtagsObjCmd((ClientData)newMenuPtr->tkwin,
- menuPtr->interp, 3, newObjv);
+ Tk_BindtagsObjCmd(newMenuPtr->tkwin, menuPtr->interp, 3,
+ newObjv);
break;
}
}
@@ -2811,7 +2811,7 @@ CloneMenu(
} else {
returnResult = TCL_ERROR;
}
- Tcl_Release((ClientData) menuPtr);
+ Tcl_Release(menuPtr);
return returnResult;
}
@@ -3271,8 +3271,8 @@ DestroyMenuHashTable(
ClientData clientData, /* The menu hash table we are destroying. */
Tcl_Interp *interp) /* The interpreter we are destroying. */
{
- Tcl_DeleteHashTable((Tcl_HashTable *) clientData);
- ckfree((char *) clientData);
+ Tcl_DeleteHashTable(clientData);
+ ckfree(clientData);
}
/*
@@ -3305,7 +3305,7 @@ TkGetMenuHashTable(
menuTablePtr = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(menuTablePtr, TCL_STRING_KEYS);
Tcl_SetAssocData(interp, MENU_HASH_KEY, DestroyMenuHashTable,
- (ClientData) menuTablePtr);
+ menuTablePtr);
}
return menuTablePtr;
}
@@ -3348,9 +3348,9 @@ TkCreateMenuReferences(
menuRefPtr->topLevelListPtr = NULL;
menuRefPtr->parentEntryPtr = NULL;
menuRefPtr->hashEntryPtr = hashEntryPtr;
- Tcl_SetHashValue(hashEntryPtr, (char *) menuRefPtr);
+ Tcl_SetHashValue(hashEntryPtr, menuRefPtr);
} else {
- menuRefPtr = (TkMenuReferences *) Tcl_GetHashValue(hashEntryPtr);
+ menuRefPtr = Tcl_GetHashValue(hashEntryPtr);
}
return menuRefPtr;
}
@@ -3387,7 +3387,7 @@ TkFindMenuReferences(
menuTablePtr = TkGetMenuHashTable(interp);
hashEntryPtr = Tcl_FindHashEntry(menuTablePtr, pathName);
if (hashEntryPtr != NULL) {
- menuRefPtr = (TkMenuReferences *) Tcl_GetHashValue(hashEntryPtr);
+ menuRefPtr = Tcl_GetHashValue(hashEntryPtr);
}
return menuRefPtr;
}
@@ -3485,8 +3485,7 @@ DeleteMenuCloneEntries(
for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
for (i = last; i >= first; i--) {
- Tcl_EventuallyFree((ClientData) menuListPtr->entries[i],
- DestroyMenuEntry);
+ Tcl_EventuallyFree(menuListPtr->entries[i], DestroyMenuEntry);
}
for (i = last + 1; i < menuListPtr->numEntries; i++) {
j = i - numDeleted;
@@ -3552,7 +3551,7 @@ TkMenuCleanup(
void
TkMenuInit(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!menusInitialized) {
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index 7d3622a..2113f8c 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.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: tkMenubutton.c,v 1.19 2007/12/13 23:08:43 hobbs Exp $
+ * RCS: @(#) $Id: tkMenubutton.c,v 1.20 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -153,7 +153,7 @@ static const Tk_OptionSpec optionSpecs[] = {
* dispatch the scale widget command.
*/
-static CONST char *commandNames[] = {
+static const char *commandNames[] = {
"cget", "configure", NULL
};
@@ -172,14 +172,14 @@ static void MenuButtonImageProc(ClientData clientData,
int x, int y, int width, int height, int imgWidth,
int imgHeight);
static char * MenuButtonTextVarProc(ClientData clientData,
- Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags);
+ Tcl_Interp *interp, const char *name1,
+ const char *name2, int flags);
static int MenuButtonWidgetObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int ConfigureMenuButton(Tcl_Interp *interp,
TkMenuButton *mbPtr, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static void DestroyMenuButton(char *memPtr);
/*
@@ -205,7 +205,7 @@ Tk_MenubuttonObjCmd(
ClientData clientData, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register TkMenuButton *mbPtr;
Tk_OptionTable optionTable;
@@ -236,7 +236,7 @@ Tk_MenubuttonObjCmd(
Tk_SetClass(tkwin, "Menubutton");
mbPtr = TkpCreateMenuButton(tkwin);
- Tk_SetClassProcs(tkwin, &tkpMenubuttonClass, (ClientData) mbPtr);
+ Tk_SetClassProcs(tkwin, &tkpMenubuttonClass, mbPtr);
/*
* Initialize the data structure for the button.
@@ -246,8 +246,8 @@ Tk_MenubuttonObjCmd(
mbPtr->display = Tk_Display (tkwin);
mbPtr->interp = interp;
mbPtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(mbPtr->tkwin), MenuButtonWidgetObjCmd,
- (ClientData) mbPtr, MenuButtonCmdDeletedProc);
+ Tk_PathName(mbPtr->tkwin), MenuButtonWidgetObjCmd, mbPtr,
+ MenuButtonCmdDeletedProc);
mbPtr->optionTable = optionTable;
mbPtr->menuName = NULL;
mbPtr->text = NULL;
@@ -296,7 +296,7 @@ Tk_MenubuttonObjCmd(
Tk_CreateEventHandler(mbPtr->tkwin,
ExposureMask|StructureNotifyMask|FocusChangeMask,
- MenuButtonEventProc, (ClientData) mbPtr);
+ MenuButtonEventProc, mbPtr);
if (Tk_InitOptions(interp, (char *) mbPtr, optionTable, tkwin) != TCL_OK) {
Tk_DestroyWindow(mbPtr->tkwin);
@@ -335,9 +335,9 @@ MenuButtonWidgetObjCmd(
ClientData clientData, /* Information about button widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- register TkMenuButton *mbPtr = (TkMenuButton *) clientData;
+ register TkMenuButton *mbPtr = clientData;
int result, index;
Tcl_Obj *objPtr;
@@ -350,7 +350,7 @@ MenuButtonWidgetObjCmd(
if (result != TCL_OK) {
return result;
}
- Tcl_Preserve((ClientData) mbPtr);
+ Tcl_Preserve(mbPtr);
switch (index) {
case COMMAND_CGET:
@@ -383,11 +383,11 @@ MenuButtonWidgetObjCmd(
}
break;
}
- Tcl_Release((ClientData) mbPtr);
+ Tcl_Release(mbPtr);
return result;
error:
- Tcl_Release((ClientData) mbPtr);
+ Tcl_Release(mbPtr);
return TCL_ERROR;
}
@@ -418,7 +418,7 @@ DestroyMenuButton(
TkpDestroyMenuButton(mbPtr);
if (mbPtr->flags & REDRAW_PENDING) {
- Tcl_CancelIdleCall(TkpDisplayMenuButton, (ClientData) mbPtr);
+ Tcl_CancelIdleCall(TkpDisplayMenuButton, mbPtr);
}
/*
@@ -430,7 +430,7 @@ DestroyMenuButton(
if (mbPtr->textVarName != NULL) {
Tcl_UntraceVar(mbPtr->interp, mbPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- MenuButtonTextVarProc, (ClientData) mbPtr);
+ MenuButtonTextVarProc, mbPtr);
}
if (mbPtr->image != NULL) {
Tk_FreeImage(mbPtr->image);
@@ -455,7 +455,7 @@ DestroyMenuButton(
}
Tk_FreeConfigOptions((char *) mbPtr, mbPtr->optionTable, mbPtr->tkwin);
mbPtr->tkwin = NULL;
- Tcl_EventuallyFree((ClientData) mbPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(mbPtr, TCL_DYNAMIC);
}
/*
@@ -486,7 +486,7 @@ ConfigureMenuButton(
/* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments. */
+ Tcl_Obj *const objv[]) /* Arguments. */
{
Tk_SavedOptions savedOptions;
Tcl_Obj *errorResult = NULL;
@@ -500,7 +500,7 @@ ConfigureMenuButton(
if (mbPtr->textVarName != NULL) {
Tcl_UntraceVar(interp, mbPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- MenuButtonTextVarProc, (ClientData) mbPtr);
+ MenuButtonTextVarProc, mbPtr);
}
/*
@@ -563,8 +563,7 @@ ConfigureMenuButton(
if (mbPtr->imageString != NULL) {
image = Tk_GetImage(mbPtr->interp, mbPtr->tkwin,
- mbPtr->imageString, MenuButtonImageProc,
- (ClientData) mbPtr);
+ mbPtr->imageString, MenuButtonImageProc, mbPtr);
if (image == NULL) {
return TCL_ERROR;
}
@@ -616,7 +615,7 @@ ConfigureMenuButton(
* Set up a trace to watch for any changes in it, create the variable
* if it doesn't exist, and fetch its current value.
*/
- CONST char *value;
+ const char *value;
value = Tcl_GetVar(interp, mbPtr->textVarName, TCL_GLOBAL_ONLY);
if (value == NULL) {
@@ -631,10 +630,10 @@ ConfigureMenuButton(
}
Tcl_TraceVar(interp, mbPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- MenuButtonTextVarProc, (ClientData) mbPtr);
+ MenuButtonTextVarProc, mbPtr);
}
- TkMenuButtonWorldChanged((ClientData) mbPtr);
+ TkMenuButtonWorldChanged(mbPtr);
if (error) {
Tcl_SetObjResult(interp, errorResult);
Tcl_DecrRefCount(errorResult);
@@ -668,9 +667,7 @@ TkMenuButtonWorldChanged(
XGCValues gcValues;
GC gc;
unsigned long mask;
- TkMenuButton *mbPtr;
-
- mbPtr = (TkMenuButton *) instanceData;
+ TkMenuButton *mbPtr = instanceData;
gcValues.font = Tk_FontId(mbPtr->tkfont);
gcValues.foreground = mbPtr->normalFg->pixel;
@@ -743,7 +740,7 @@ TkMenuButtonWorldChanged(
*/
if (Tk_IsMapped(mbPtr->tkwin) && !(mbPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) mbPtr);
+ Tcl_DoWhenIdle(TkpDisplayMenuButton, mbPtr);
mbPtr->flags |= REDRAW_PENDING;
}
}
@@ -771,7 +768,7 @@ MenuButtonEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TkMenuButton *mbPtr = (TkMenuButton *) clientData;
+ TkMenuButton *mbPtr = clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
goto redraw;
} else if (eventPtr->type == ConfigureNotify) {
@@ -802,7 +799,7 @@ MenuButtonEventProc(
redraw:
if ((mbPtr->tkwin != NULL) && !(mbPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) mbPtr);
+ Tcl_DoWhenIdle(TkpDisplayMenuButton, mbPtr);
mbPtr->flags |= REDRAW_PENDING;
}
}
@@ -829,7 +826,7 @@ static void
MenuButtonCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkMenuButton *mbPtr = (TkMenuButton *) clientData;
+ TkMenuButton *mbPtr = clientData;
Tk_Window tkwin = mbPtr->tkwin;
/*
@@ -867,12 +864,12 @@ static char *
MenuButtonTextVarProc(
ClientData clientData, /* Information about button. */
Tcl_Interp *interp, /* Interpreter containing variable. */
- CONST char *name1, /* Name of variable. */
- CONST char *name2, /* Second part of variable name. */
+ const char *name1, /* Name of variable. */
+ const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
- register TkMenuButton *mbPtr = (TkMenuButton *) clientData;
- CONST char *value;
+ register TkMenuButton *mbPtr = clientData;
+ const char *value;
unsigned len;
/*
@@ -905,7 +902,7 @@ MenuButtonTextVarProc(
if ((mbPtr->tkwin != NULL) && Tk_IsMapped(mbPtr->tkwin)
&& !(mbPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) mbPtr);
+ Tcl_DoWhenIdle(TkpDisplayMenuButton, mbPtr);
mbPtr->flags |= REDRAW_PENDING;
}
return NULL;
@@ -938,12 +935,12 @@ MenuButtonImageProc(
* 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- register TkMenuButton *mbPtr = (TkMenuButton *) clientData;
+ register TkMenuButton *mbPtr = clientData;
if (mbPtr->tkwin != NULL) {
TkpComputeMenuButtonGeometry(mbPtr);
if (Tk_IsMapped(mbPtr->tkwin) && !(mbPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) mbPtr);
+ Tcl_DoWhenIdle(TkpDisplayMenuButton, mbPtr);
mbPtr->flags |= REDRAW_PENDING;
}
}
diff --git a/generic/tkMessage.c b/generic/tkMessage.c
index 048bb5c..ff33d48 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.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: tkMessage.c,v 1.19 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkMessage.c,v 1.20 2008/04/27 22:38:56 dkf Exp $
*/
#include "default.h"
@@ -173,15 +173,15 @@ static void MessageCmdDeletedProc(ClientData clientData);
static void MessageEventProc(ClientData clientData,
XEvent *eventPtr);
static char * MessageTextVarProc(ClientData clientData,
- Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags);
+ Tcl_Interp *interp, const char *name1,
+ const char *name2, int flags);
static int MessageWidgetObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static void MessageWorldChanged(ClientData instanceData);
static void ComputeMessageGeometry(Message *msgPtr);
static int ConfigureMessage(Tcl_Interp *interp, Message *msgPtr,
- int objc, Tcl_Obj *CONST objv[], int flags);
+ int objc, Tcl_Obj *const objv[], int flags);
static void DestroyMessage(char *memPtr);
static void DisplayMessage(ClientData clientData);
@@ -217,7 +217,7 @@ Tk_MessageObjCmd(
ClientData clientData, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument strings. */
+ Tcl_Obj *const objv[]) /* Argument strings. */
{
register Message *msgPtr;
Tk_OptionTable optionTable;
@@ -252,8 +252,8 @@ Tk_MessageObjCmd(
msgPtr->display = Tk_Display(tkwin);
msgPtr->interp = interp;
msgPtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(msgPtr->tkwin), MessageWidgetObjCmd,
- (ClientData) msgPtr, MessageCmdDeletedProc);
+ Tk_PathName(msgPtr->tkwin), MessageWidgetObjCmd, msgPtr,
+ MessageCmdDeletedProc);
msgPtr->optionTable = optionTable;
msgPtr->relief = TK_RELIEF_FLAT;
msgPtr->textGC = None;
@@ -263,10 +263,10 @@ Tk_MessageObjCmd(
msgPtr->cursor = None;
Tk_SetClass(msgPtr->tkwin, "Message");
- Tk_SetClassProcs(msgPtr->tkwin, &messageClass, (ClientData) msgPtr);
+ Tk_SetClassProcs(msgPtr->tkwin, &messageClass, msgPtr);
Tk_CreateEventHandler(msgPtr->tkwin,
ExposureMask|StructureNotifyMask|FocusChangeMask,
- MessageEventProc, (ClientData) msgPtr);
+ MessageEventProc, msgPtr);
if (Tk_InitOptions(interp, (char *)msgPtr, optionTable, tkwin) != TCL_OK) {
Tk_DestroyWindow(msgPtr->tkwin);
return TCL_ERROR;
@@ -304,10 +304,10 @@ MessageWidgetObjCmd(
ClientData clientData, /* Information about message widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument strings. */
+ Tcl_Obj *const objv[]) /* Argument strings. */
{
- register Message *msgPtr = (Message *) clientData;
- static CONST char *optionStrings[] = { "cget", "configure", NULL };
+ register Message *msgPtr = clientData;
+ static const char *optionStrings[] = { "cget", "configure", NULL };
enum options { MESSAGE_CGET, MESSAGE_CONFIGURE };
int index;
int result = TCL_OK;
@@ -323,7 +323,7 @@ MessageWidgetObjCmd(
return TCL_ERROR;
}
- Tcl_Preserve((ClientData) msgPtr);
+ Tcl_Preserve(msgPtr);
switch ((enum options) index) {
case MESSAGE_CGET:
@@ -358,7 +358,7 @@ MessageWidgetObjCmd(
break;
}
- Tcl_Release((ClientData) msgPtr);
+ Tcl_Release(msgPtr);
return result;
}
@@ -390,7 +390,7 @@ DestroyMessage(
Tcl_DeleteCommandFromToken(msgPtr->interp, msgPtr->widgetCmd);
if (msgPtr->flags & REDRAW_PENDING) {
- Tcl_CancelIdleCall(DisplayMessage, (ClientData) msgPtr);
+ Tcl_CancelIdleCall(DisplayMessage, msgPtr);
}
/*
@@ -407,7 +407,7 @@ DestroyMessage(
if (msgPtr->textVarName != NULL) {
Tcl_UntraceVar(msgPtr->interp, msgPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- MessageTextVarProc, (ClientData) msgPtr);
+ MessageTextVarProc, msgPtr);
}
Tk_FreeConfigOptions((char *) msgPtr, msgPtr->optionTable, msgPtr->tkwin);
msgPtr->tkwin = NULL;
@@ -440,7 +440,7 @@ ConfigureMessage(
register Message *msgPtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[], /* Arguments. */
+ Tcl_Obj *const objv[], /* Arguments. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
Tk_SavedOptions savedOptions;
@@ -452,7 +452,7 @@ ConfigureMessage(
if (msgPtr->textVarName != NULL) {
Tcl_UntraceVar(interp, msgPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- MessageTextVarProc, (ClientData) msgPtr);
+ MessageTextVarProc, msgPtr);
}
if (Tk_SetOptions(interp, (char *) msgPtr, msgPtr->optionTable, objc, objv,
@@ -468,7 +468,7 @@ ConfigureMessage(
*/
if (msgPtr->textVarName != NULL) {
- CONST char *value;
+ const char *value;
value = Tcl_GetVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY);
if (value == NULL) {
@@ -482,7 +482,7 @@ ConfigureMessage(
}
Tcl_TraceVar(interp, msgPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- MessageTextVarProc, (ClientData) msgPtr);
+ MessageTextVarProc, msgPtr);
}
/*
@@ -498,7 +498,7 @@ ConfigureMessage(
}
Tk_FreeSavedOptions(&savedOptions);
- MessageWorldChanged((ClientData) msgPtr);
+ MessageWorldChanged(msgPtr);
return TCL_OK;
}
@@ -559,7 +559,7 @@ MessageWorldChanged(
ComputeMessageGeometry(msgPtr);
if ((msgPtr->tkwin != NULL) && Tk_IsMapped(msgPtr->tkwin)
&& !(msgPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr);
+ Tcl_DoWhenIdle(DisplayMessage, msgPtr);
msgPtr->flags |= REDRAW_PENDING;
}
}
@@ -668,7 +668,7 @@ static void
DisplayMessage(
ClientData clientData) /* Information about window. */
{
- register Message *msgPtr = (Message *) clientData;
+ register Message *msgPtr = clientData;
register Tk_Window tkwin = msgPtr->tkwin;
int x, y;
int borderWidth = msgPtr->highlightWidth;
@@ -744,13 +744,13 @@ MessageEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- Message *msgPtr = (Message *) clientData;
+ Message *msgPtr = clientData;
if (((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0))
|| (eventPtr->type == ConfigureNotify)) {
goto redraw;
} else if (eventPtr->type == DestroyNotify) {
- DestroyMessage((char *) clientData);
+ DestroyMessage(clientData);
} else if (eventPtr->type == FocusIn) {
if (eventPtr->xfocus.detail != NotifyInferior) {
msgPtr->flags |= GOT_FOCUS;
@@ -770,7 +770,7 @@ MessageEventProc(
redraw:
if ((msgPtr->tkwin != NULL) && !(msgPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr);
+ Tcl_DoWhenIdle(DisplayMessage, msgPtr);
msgPtr->flags |= REDRAW_PENDING;
}
}
@@ -797,7 +797,7 @@ static void
MessageCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- Message *msgPtr = (Message *) clientData;
+ Message *msgPtr = clientData;
/*
* This function could be invoked either because the window was destroyed
@@ -833,12 +833,12 @@ static char *
MessageTextVarProc(
ClientData clientData, /* Information about message. */
Tcl_Interp *interp, /* Interpreter containing variable. */
- CONST char *name1, /* Name of variable. */
- CONST char *name2, /* Second part of variable name. */
+ const char *name1, /* Name of variable. */
+ const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
- register Message *msgPtr = (Message *) clientData;
- CONST char *value;
+ register Message *msgPtr = clientData;
+ const char *value;
/*
* If the variable is unset, then immediately recreate it unless the whole
@@ -870,7 +870,7 @@ MessageTextVarProc(
if ((msgPtr->tkwin != NULL) && Tk_IsMapped(msgPtr->tkwin)
&& !(msgPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr);
+ Tcl_DoWhenIdle(DisplayMessage, msgPtr);
msgPtr->flags |= REDRAW_PENDING;
}
return NULL;
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 15f01ac..ce1c649 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.19 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkObj.c,v 1.20 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -36,7 +36,7 @@ typedef struct PixelRep {
#define SET_COMPLEXPIXEL(objPtr, repPtr) \
(objPtr)->internalRep.twoPtrValue.ptr1 = 0; \
- (objPtr)->internalRep.twoPtrValue.ptr2 = (VOID *) repPtr
+ (objPtr)->internalRep.twoPtrValue.ptr2 = (void *) repPtr
#define GET_COMPLEXPIXEL(objPtr) \
((PixelRep *) (objPtr)->internalRep.twoPtrValue.ptr2)
@@ -476,7 +476,7 @@ DupMMInternalRep(
newPtr->units = oldPtr->units;
newPtr->tkwin = oldPtr->tkwin;
newPtr->returnValue = oldPtr->returnValue;
- copyPtr->internalRep.otherValuePtr = (VOID *) newPtr;
+ copyPtr->internalRep.otherValuePtr = (void *) newPtr;
}
/*
@@ -639,7 +639,7 @@ SetMMFromAny(
mmPtr->tkwin = NULL;
mmPtr->returnValue = d;
- objPtr->internalRep.otherValuePtr = (VOID *) mmPtr;
+ objPtr->internalRep.otherValuePtr = (void *) mmPtr;
return TCL_OK;
}
@@ -747,7 +747,7 @@ SetWindowFromAny(
winPtr->mainPtr = NULL;
winPtr->epoch = 0;
- objPtr->internalRep.otherValuePtr = (VOID*)winPtr;
+ objPtr->internalRep.otherValuePtr = (void *) winPtr;
objPtr->typePtr = &windowObjType;
return TCL_OK;
@@ -783,7 +783,7 @@ DupWindowInternalRep(
newPtr->tkwin = oldPtr->tkwin;
newPtr->mainPtr = oldPtr->mainPtr;
newPtr->epoch = oldPtr->epoch;
- copyPtr->internalRep.otherValuePtr = (VOID *)newPtr;
+ copyPtr->internalRep.otherValuePtr = (void *) newPtr;
copyPtr->typePtr = srcPtr->typePtr;
}
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 8a46c58..37d278d 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.23 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkOldConfig.c,v 1.24 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkPort.h"
@@ -35,11 +35,11 @@ static int DoConfig(Tcl_Interp *interp, Tk_Window tkwin,
Tk_ConfigSpec *specPtr, Tk_Uid value,
int valueIsUid, char *widgRec);
static Tk_ConfigSpec * FindConfigSpec(Tcl_Interp *interp,
- Tk_ConfigSpec *specs, CONST char *argvName,
+ Tk_ConfigSpec *specs, const char *argvName,
int needFlags, int hateFlags);
static char * FormatConfigInfo(Tcl_Interp *interp, Tk_Window tkwin,
Tk_ConfigSpec *specPtr, char *widgRec);
-static CONST char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin,
+static const char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin,
Tk_ConfigSpec *specPtr, char *widgRec,
char *buffer, Tcl_FreeProc **freeProcPtr);
static Tk_ConfigSpec * GetCachedSpecs(Tcl_Interp *interp,
@@ -76,7 +76,7 @@ Tk_ConfigureWidget(
* X resources). */
Tk_ConfigSpec *specs, /* Describes legal options. */
int argc, /* Number of elements in argv. */
- CONST char **argv, /* Command-line options. */
+ const char **argv, /* Command-line options. */
char *widgRec, /* Record whose fields are to be modified.
* Values must be properly initialized. */
int flags) /* Used to specify additional flags that must
@@ -120,7 +120,7 @@ Tk_ConfigureWidget(
*/
for ( ; argc > 0; argc -= 2, argv += 2) {
- CONST char *arg;
+ const char *arg;
if (flags & TK_CONFIG_OBJS) {
arg = Tcl_GetStringFromObj((Tcl_Obj *) *argv, NULL);
@@ -242,7 +242,7 @@ FindConfigSpec(
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_ConfigSpec *specs, /* Pointer to table of configuration
* specifications for a widget. */
- CONST char *argvName, /* Name (suitable for use in a "config"
+ const char *argvName, /* Name (suitable for use in a "config"
* command) identifying particular option. */
int needFlags, /* Flags that must be present in matching
* entry. */
@@ -597,7 +597,7 @@ Tk_ConfigureInfo(
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
+ const char *argvName, /* If non-NULL, indicates a single option
* whose info is to be returned. Otherwise
* info is returned for all options. */
int flags) /* Used to specify additional flags that must
@@ -692,7 +692,7 @@ FormatConfigInfo(
char *widgRec) /* Pointer to record holding current values of
* info for widget. */
{
- CONST char *argv[6];
+ const char *argv[6];
char *result;
char buffer[200];
Tcl_FreeProc *freeProc = NULL;
@@ -721,9 +721,9 @@ FormatConfigInfo(
result = Tcl_Merge(5, argv);
if (freeProc != NULL) {
if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
- ckfree((char *)argv[4]);
+ ckfree((char *) argv[4]);
} else {
- (*freeProc)((char *)argv[4]);
+ (*freeProc)((char *) argv[4]);
}
}
return result;
@@ -749,7 +749,7 @@ FormatConfigInfo(
*----------------------------------------------------------------------
*/
-static CONST char *
+static const char *
FormatConfigValue(
Tcl_Interp *interp, /* Interpreter for use in real conversions. */
Tk_Window tkwin, /* Window corresponding to widget. */
@@ -763,7 +763,7 @@ FormatConfigValue(
* function to free the result, or NULL if
* result is static. */
{
- CONST char *ptr, *result;
+ const char *ptr, *result;
*freeProcPtr = NULL;
ptr = widgRec + specPtr->offset;
@@ -909,7 +909,7 @@ Tk_ConfigureValue(
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
+ const char *argvName, /* Gives the command-line name for the option
* whose value is to be returned. */
int flags) /* Used to specify additional flags that must
* be present in config specs for them to be
@@ -918,7 +918,7 @@ Tk_ConfigureValue(
Tk_ConfigSpec *specPtr;
int needFlags, hateFlags;
Tcl_FreeProc *freeProc;
- CONST char *result;
+ const char *result;
char buffer[200];
needFlags = flags & ~(TK_CONFIG_USER_BIT - 1);
@@ -943,9 +943,9 @@ Tk_ConfigureValue(
Tcl_SetResult(interp, (char *) result, TCL_VOLATILE);
if (freeProc != NULL) {
if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
- ckfree((char *)result);
+ ckfree((char *) result);
} else {
- (*freeProc)((char *)result);
+ (*freeProc)((char *) result);
}
}
return TCL_OK;
@@ -1072,13 +1072,13 @@ GetCachedSpecs(
* self-initializing code.
*/
- specCacheTablePtr = (Tcl_HashTable *)
+ specCacheTablePtr =
Tcl_GetAssocData(interp, "tkConfigSpec.threadTable", NULL);
if (specCacheTablePtr == NULL) {
specCacheTablePtr = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(specCacheTablePtr, TCL_ONE_WORD_KEYS);
Tcl_SetAssocData(interp, "tkConfigSpec.threadTable",
- DeleteSpecCacheTable, (ClientData) specCacheTablePtr);
+ DeleteSpecCacheTable, specCacheTablePtr);
}
/*
@@ -1110,7 +1110,7 @@ GetCachedSpecs(
cachedSpecs = (Tk_ConfigSpec *) ckalloc(entrySpace);
memcpy(cachedSpecs, staticSpecs, entrySpace);
- Tcl_SetHashValue(entryPtr, (ClientData) cachedSpecs);
+ Tcl_SetHashValue(entryPtr, cachedSpecs);
/*
* Finally, go through and replace database names, database classes
@@ -1133,7 +1133,7 @@ GetCachedSpecs(
specPtr->specFlags &= ~TK_CONFIG_OPTION_SPECIFIED;
}
} else {
- cachedSpecs = (Tk_ConfigSpec *) Tcl_GetHashValue(entryPtr);
+ cachedSpecs = Tcl_GetHashValue(entryPtr);
}
return cachedSpecs;
@@ -1161,7 +1161,7 @@ DeleteSpecCacheTable(
ClientData clientData,
Tcl_Interp *interp)
{
- Tcl_HashTable *tablePtr = (Tcl_HashTable *) clientData;
+ Tcl_HashTable *tablePtr = clientData;
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
@@ -1171,7 +1171,7 @@ DeleteSpecCacheTable(
* Someone else deallocates the Tk_Uids themselves.
*/
- ckfree((char *) Tcl_GetHashValue(entryPtr));
+ ckfree(Tcl_GetHashValue(entryPtr));
}
Tcl_DeleteHashTable(tablePtr);
ckfree((char *) tablePtr);
diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c
index 473d92c..cd7ae5b 100644
--- a/generic/tkOldTest.c
+++ b/generic/tkOldTest.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkOldTest.c,v 1.1 2007/05/14 20:58:27 dgp Exp $
+ * RCS: @(#) $Id: tkOldTest.c,v 1.2 2008/04/27 22:38:56 dkf Exp $
*/
#define USE_OLD_IMAGE
@@ -77,7 +77,7 @@ static Tk_ImageType imageType = {
*/
static int ImageCmd(ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv);
+ Tcl_Interp *interp, int argc, const char **argv);
MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp);
@@ -171,8 +171,8 @@ ImageCreate(
strcpy(timPtr->imageName, name);
timPtr->varName = (char *) ckalloc((unsigned) (strlen(varName) + 1));
strcpy(timPtr->varName, varName);
- Tcl_CreateCommand(interp, name, ImageCmd, (ClientData) timPtr, NULL);
- *clientDataPtr = (ClientData) timPtr;
+ Tcl_CreateCommand(interp, name, ImageCmd, timPtr, NULL);
+ *clientDataPtr = timPtr;
Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15);
return TCL_OK;
}
@@ -200,9 +200,9 @@ ImageCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
- TImageMaster *timPtr = (TImageMaster *) clientData;
+ TImageMaster *timPtr = clientData;
int x, y, width, height;
if (argc < 2) {
@@ -258,7 +258,7 @@ ImageGet(
* used. */
ClientData clientData) /* Pointer to TImageMaster for image. */
{
- TImageMaster *timPtr = (TImageMaster *) clientData;
+ TImageMaster *timPtr = clientData;
TImageInstance *instPtr;
char buffer[100];
XGCValues gcValues;
@@ -272,7 +272,7 @@ ImageGet(
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues);
- return (ClientData) instPtr;
+ return instPtr;
}
/*
@@ -305,7 +305,7 @@ ImageDisplay(
/* Coordinates in drawable corresponding to
* imageX and imageY. */
{
- TImageInstance *instPtr = (TImageInstance *) clientData;
+ TImageInstance *instPtr = clientData;
char buffer[200 + TCL_INTEGER_SPACE * 6];
sprintf(buffer, "%s display %d %d %d %d %d %d",
@@ -350,7 +350,7 @@ ImageFree(
ClientData clientData, /* Pointer to TImageInstance for instance. */
Display *display) /* Display where image was to be drawn. */
{
- TImageInstance *instPtr = (TImageInstance *) clientData;
+ TImageInstance *instPtr = clientData;
char buffer[200];
sprintf(buffer, "%s free", instPtr->masterPtr->imageName);
@@ -384,7 +384,7 @@ ImageDelete(
* this function is called, no more instances
* exist. */
{
- TImageMaster *timPtr = (TImageMaster *) clientData;
+ TImageMaster *timPtr = clientData;
char buffer[100];
sprintf(buffer, "%s delete", timPtr->imageName);
diff --git a/generic/tkOption.c b/generic/tkOption.c
index 1fac8b4..06b67f9 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.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: tkOption.c,v 1.24 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkOption.c,v 1.25 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -248,8 +248,8 @@ void
Tk_AddOption(
Tk_Window tkwin, /* Window token; option will be associated
* with main window for this window. */
- CONST char *name, /* Multi-element name of option. */
- CONST char *value, /* String value for option. */
+ const char *name, /* Multi-element name of option. */
+ const char *value, /* String value for option. */
int priority) /* Overall priority level to use for this
* option, such as TK_USER_DEFAULT_PRIO or
* TK_INTERACTIVE_PRIO. Must be between 0 and
@@ -259,13 +259,13 @@ Tk_AddOption(
register ElArray **arrayPtrPtr;
register Element *elPtr;
Element newEl;
- register CONST char *p;
- CONST char *field;
+ register const char *p;
+ const char *field;
int count, firstField;
ptrdiff_t length;
#define TMP_SIZE 100
char tmp[TMP_SIZE+1];
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->mainPtr->optionRootPtr == NULL) {
@@ -402,8 +402,8 @@ Tk_Uid
Tk_GetOption(
Tk_Window tkwin, /* Token for window that option is associated
* with. */
- CONST char *name, /* Name of option. */
- CONST char *className) /* Class of option. NULL means there is no
+ const char *name, /* Name of option. */
+ const char *className) /* Class of option. NULL means there is no
* class for this option: just check for
* name. */
{
@@ -413,7 +413,7 @@ Tk_GetOption(
register int count;
StackLevel *levelPtr;
int stackDepth[NUM_STACKS];
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -477,16 +477,16 @@ Tk_GetOption(
*/
for (elPtr = tsdPtr->stacks[EXACT_LEAF_NAME]->els,
- count = stackDepth[EXACT_LEAF_NAME]; count > 0;
- elPtr++, count--) {
+ count = stackDepth[EXACT_LEAF_NAME]; count > 0;
+ elPtr++, count--) {
if ((elPtr->nameUid == nameId)
&& (elPtr->priority > bestPtr->priority)) {
bestPtr = elPtr;
}
}
for (elPtr = tsdPtr->stacks[WILDCARD_LEAF_NAME]->els,
- count = stackDepth[WILDCARD_LEAF_NAME]; count > 0;
- elPtr++, count--) {
+ count = stackDepth[WILDCARD_LEAF_NAME]; count > 0;
+ elPtr++, count--) {
if ((elPtr->nameUid == nameId)
&& (elPtr->priority > bestPtr->priority)) {
bestPtr = elPtr;
@@ -496,16 +496,16 @@ Tk_GetOption(
if (className != NULL) {
classId = Tk_GetUid(className);
for (elPtr = tsdPtr->stacks[EXACT_LEAF_CLASS]->els,
- count = stackDepth[EXACT_LEAF_CLASS]; count > 0;
- elPtr++, count--) {
+ count = stackDepth[EXACT_LEAF_CLASS]; count > 0;
+ elPtr++, count--) {
if ((elPtr->nameUid == classId)
&& (elPtr->priority > bestPtr->priority)) {
bestPtr = elPtr;
}
}
for (elPtr = tsdPtr->stacks[WILDCARD_LEAF_CLASS]->els,
- count = stackDepth[WILDCARD_LEAF_CLASS]; count > 0;
- elPtr++, count--) {
+ count = stackDepth[WILDCARD_LEAF_CLASS]; count > 0;
+ elPtr++, count--) {
if ((elPtr->nameUid == classId)
&& (elPtr->priority > bestPtr->priority)) {
bestPtr = elPtr;
@@ -535,7 +535,7 @@ Tk_GetOption(
* Extract the masquerade class name from the name field.
*/
- classNameLength = (unsigned int)(masqName - name);
+ classNameLength = (unsigned) (masqName - name);
masqClass = (char *) ckalloc(classNameLength + 1);
strncpy(masqClass, name, classNameLength);
masqClass[classNameLength] = '\0';
@@ -614,14 +614,14 @@ Tk_OptionObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of Tcl_Obj arguments. */
- Tcl_Obj *CONST objv[]) /* Tcl_Obj arguments. */
+ Tcl_Obj *const objv[]) /* Tcl_Obj arguments. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
+ Tk_Window tkwin = clientData;
int index, result;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- static CONST char *optionCmds[] = {
+ static const char *optionCmds[] = {
"add", "clear", "get", "readfile", NULL
};
@@ -644,6 +644,7 @@ Tk_OptionObjCmd(
switch ((enum optionVals) index) {
case OPTION_ADD: {
int priority;
+
if ((objc != 4) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "pattern value ?priority?");
return TCL_ERROR;
@@ -693,7 +694,7 @@ Tk_OptionObjCmd(
value = Tk_GetOption(window, Tcl_GetString(objv[3]),
Tcl_GetString(objv[4]));
if (value != NULL) {
- Tcl_SetResult(interp, (char *)value, TCL_STATIC);
+ Tcl_SetResult(interp, (char *) value, TCL_STATIC);
}
break;
}
@@ -743,7 +744,7 @@ void
TkOptionDeadWindow(
register TkWindow *winPtr) /* Window to be cleaned up. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -799,7 +800,7 @@ TkOptionClassChanged(
{
int i, j, *basePtr;
ElArray *arrayPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->optionLevel == -1) {
@@ -930,7 +931,6 @@ AddFromString(
src = string;
lineNum = 1;
while (1) {
-
/*
* Skip leading white space and empty lines and comment lines, and
* check for the end of the spec.
@@ -1073,7 +1073,7 @@ ReadOptionFile(
* TK_INTERACTIVE_PRIO. Must be between 0 and
* TK_MAX_PRIO. */
{
- CONST char *realName;
+ const char *realName;
char *buffer;
int result, bufferSize;
Tcl_Channel chan;
@@ -1108,7 +1108,7 @@ ReadOptionFile(
*/
bufferSize = (int) Tcl_Seek(chan, (Tcl_WideInt) 0, SEEK_END);
- (void) Tcl_Seek(chan, (Tcl_WideInt) 0, SEEK_SET);
+ Tcl_Seek(chan, (Tcl_WideInt) 0, SEEK_SET);
if (bufferSize < 0) {
Tcl_AppendResult(interp, "error seeking to end of file \"",
@@ -1117,7 +1117,7 @@ ReadOptionFile(
return TCL_ERROR;
}
- buffer = (char *) ckalloc((unsigned) bufferSize+1);
+ buffer = ckalloc((unsigned) bufferSize+1);
bufferSize = Tcl_Read(chan, buffer, bufferSize);
if (bufferSize < 0) {
Tcl_AppendResult(interp, "error reading file \"", fileName, "\":",
@@ -1153,9 +1153,8 @@ static ElArray *
NewArray(
int numEls) /* How many elements of space to allocate. */
{
- register ElArray *arrayPtr;
+ register ElArray *arrayPtr = (ElArray *) ckalloc(EL_ARRAY_SIZE(numEls));
- arrayPtr = (ElArray *) ckalloc(EL_ARRAY_SIZE(numEls));
arrayPtr->arraySize = numEls;
arrayPtr->numUsed = 0;
arrayPtr->nextToUse = arrayPtr->els;
@@ -1236,7 +1235,7 @@ SetupStacks(
int level, i, *iPtr;
register StackLevel *levelPtr;
register ElArray *arrayPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1313,10 +1312,8 @@ SetupStacks(
*/
if (tsdPtr->curLevel >= tsdPtr->numLevels) {
- StackLevel *newLevels;
-
- newLevels = (StackLevel *) ckalloc((unsigned)
- (tsdPtr->numLevels * 2 * sizeof(StackLevel)));
+ StackLevel *newLevels = (StackLevel *)
+ ckalloc((unsigned) (tsdPtr->numLevels*2*sizeof(StackLevel)));
memcpy(newLevels, tsdPtr->levels,
tsdPtr->numLevels * sizeof(StackLevel));
ckfree((char *) tsdPtr->levels);
@@ -1398,7 +1395,7 @@ ExtendStacks(
{
register int count;
register Element *elPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (elPtr = arrayPtr->els, count = arrayPtr->numUsed;
@@ -1431,7 +1428,7 @@ static void
OptionThreadExitProc(
ClientData clientData) /* not used */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->initialized) {
@@ -1469,7 +1466,7 @@ OptionInit(
{
int i;
Tcl_Interp *interp;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Element *defaultMatchPtr = &tsdPtr->defaultMatch;
@@ -1505,7 +1502,7 @@ OptionInit(
mainPtr->optionRootPtr = NewArray(20);
interp = Tcl_CreateInterp();
- (void) GetDefaultOptions(interp, mainPtr->winPtr);
+ GetDefaultOptions(interp, mainPtr->winPtr);
Tcl_DeleteInterp(interp);
}
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 0733d86..a266fba 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -10,20 +10,20 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkPack.c,v 1.27 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkPack.c,v 1.28 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
typedef enum {TOP, BOTTOM, LEFT, RIGHT} Side;
-static CONST char *sideNames[] = {
+static const char *sideNames[] = {
"top", "bottom", "left", "right", NULL
};
-/* For each window that the packer cares about (either because
- * the window is managed by the packer or because the window
- * has slaves that are managed by the packer), there is a
- * structure of the following type:
+/*
+ * For each window that the packer cares about (either because the window is
+ * managed by the packer or because the window has slaves that are managed by
+ * the packer), there is a structure of the following type:
*/
typedef struct Packer {
@@ -34,9 +34,9 @@ typedef struct Packer {
struct Packer *masterPtr; /* Master window within which this window is
* packed (NULL means this window isn't
* managed by the packer). */
- struct Packer *nextPtr; /* Next window packed within same master.
- * List is priority-ordered: first on list
- * gets packed first. */
+ struct Packer *nextPtr; /* Next window packed within same master. List
+ * is priority-ordered: first on list gets
+ * packed first. */
struct Packer *slavePtr; /* First in list of slaves packed inside this
* window (NULL means no packed slaves). */
Side side; /* Side of master against which this window is
@@ -118,11 +118,11 @@ static const Tk_GeomMgr packerType = {
static void ArrangePacking(ClientData clientData);
static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void DestroyPacker(char *memPtr);
static Packer * GetPacker(Tk_Window tkwin);
static int PackAfter(Tcl_Interp *interp, Packer *prevPtr,
- Packer *masterPtr, int objc,Tcl_Obj *CONST objv[]);
+ Packer *masterPtr, int objc,Tcl_Obj *const objv[]);
static void PackStructureProc(ClientData clientData,
XEvent *eventPtr);
static void Unlink(Packer *packPtr);
@@ -130,7 +130,7 @@ static int XExpansion(Packer *slavePtr, int cavityWidth);
static int YExpansion(Packer *slavePtr, int cavityHeight);
/*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*
* TkPrintPadAmount --
*
@@ -144,7 +144,7 @@ static int YExpansion(Packer *slavePtr, int cavityHeight);
* Side effects:
* None.
*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*/
void
@@ -166,7 +166,7 @@ TkPrintPadAmount(
}
/*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*
* Tk_PackCmd --
*
@@ -179,7 +179,7 @@ TkPrintPadAmount(
* Side effects:
* See the user documentation.
*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*/
int
@@ -187,11 +187,11 @@ Tk_PackObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
+ Tk_Window tkwin = clientData;
char *argv2;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
/* after, append, before and unpack are deprecated */
"after", "append", "before", "unpack",
"configure", "forget", "info", "propagate", "slaves", NULL };
@@ -202,6 +202,7 @@ Tk_PackObjCmd(
if (objc >= 2) {
char *string = Tcl_GetString(objv[1]);
+
if (string[0] == '.') {
return ConfigureSlaves(interp, tkwin, objc-1, objv+1);
}
@@ -307,8 +308,7 @@ Tk_PackObjCmd(
}
slavePtr = GetPacker(slave);
if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
- Tk_ManageGeometry(slave, NULL,
- (ClientData) NULL);
+ Tk_ManageGeometry(slave, NULL, NULL);
if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
Tk_UnmaintainGeometry(slavePtr->tkwin,
slavePtr->masterPtr->tkwin);
@@ -397,7 +397,7 @@ Tk_PackObjCmd(
}
if (!(masterPtr->flags & REQUESTED_REPACK)) {
masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(ArrangePacking, masterPtr);
}
} else {
masterPtr->flags |= DONT_PROPAGATE;
@@ -435,8 +435,7 @@ Tk_PackObjCmd(
}
packPtr = GetPacker(tkwin2);
if ((packPtr != NULL) && (packPtr->masterPtr != NULL)) {
- Tk_ManageGeometry(tkwin2, NULL,
- (ClientData) NULL);
+ Tk_ManageGeometry(tkwin2, NULL, NULL);
if (packPtr->masterPtr->tkwin != Tk_Parent(packPtr->tkwin)) {
Tk_UnmaintainGeometry(packPtr->tkwin,
packPtr->masterPtr->tkwin);
@@ -452,7 +451,7 @@ Tk_PackObjCmd(
}
/*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*
* PackReqProc --
*
@@ -466,7 +465,7 @@ Tk_PackObjCmd(
* Arranges for tkwin, and all its managed siblings, to be re-packed at
* the next idle point.
*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -477,17 +476,17 @@ PackReqProc(
Tk_Window tkwin) /* Other Tk-related information about the
* window. */
{
- register Packer *packPtr = (Packer *) clientData;
+ register Packer *packPtr = clientData;
packPtr = packPtr->masterPtr;
if (!(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr);
+ Tcl_DoWhenIdle(ArrangePacking, packPtr);
}
}
/*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*
* PackLostSlaveProc --
*
@@ -500,7 +499,7 @@ PackReqProc(
* Side effects:
* Forgets all packer-related information about the slave.
*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -510,7 +509,7 @@ PackLostSlaveProc(
* stolen away. */
Tk_Window tkwin) /* Tk's handle for the slave window. */
{
- register Packer *slavePtr = (Packer *) clientData;
+ register Packer *slavePtr = clientData;
if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
@@ -520,7 +519,7 @@ PackLostSlaveProc(
}
/*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*
* ArrangePacking --
*
@@ -535,7 +534,7 @@ PackLostSlaveProc(
* Side effects:
* The packed slaves of masterPtr may get resized or moved.
*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*/
static void
@@ -543,7 +542,7 @@ ArrangePacking(
ClientData clientData) /* Structure describing master whose slaves
* are to be re-layed out. */
{
- register Packer *masterPtr = (Packer *) clientData;
+ register Packer *masterPtr = clientData;
register Packer *slavePtr;
int cavityX, cavityY, cavityWidth, cavityHeight;
/* These variables keep track of the
@@ -583,7 +582,7 @@ ArrangePacking(
}
masterPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve((ClientData) masterPtr);
+ Tcl_Preserve(masterPtr);
/*
* Pass #1: scan all the slaves to figure out the total amount of space
@@ -652,7 +651,7 @@ ArrangePacking(
&& !(masterPtr->flags & DONT_PROPAGATE)) {
Tk_GeometryRequest(masterPtr->tkwin, maxWidth, maxHeight);
masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(ArrangePacking, masterPtr);
goto done;
}
@@ -843,7 +842,7 @@ ArrangePacking(
done:
masterPtr->abortPtr = NULL;
- Tcl_Release((ClientData) masterPtr);
+ Tcl_Release(masterPtr);
}
/*
@@ -964,7 +963,7 @@ YExpansion(
}
/*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*
* GetPacker --
*
@@ -979,7 +978,7 @@ YExpansion(
* A new packer structure may be created. If so, then a callback is set
* up to clean things up when the window is deleted.
*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*/
static Packer *
@@ -1005,7 +1004,7 @@ GetPacker(
hPtr = Tcl_CreateHashEntry(&dispPtr->packerHashTable, (char *) tkwin,
&isNew);
if (!isNew) {
- return (Packer *) Tcl_GetHashValue(hPtr);
+ return Tcl_GetHashValue(hPtr);
}
packPtr = (Packer *) ckalloc(sizeof(Packer));
packPtr->tkwin = tkwin;
@@ -1022,12 +1021,12 @@ GetPacker(
packPtr->flags = 0;
Tcl_SetHashValue(hPtr, packPtr);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- PackStructureProc, (ClientData) packPtr);
+ PackStructureProc, packPtr);
return packPtr;
}
/*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*
* PackAfter --
*
@@ -1041,7 +1040,7 @@ GetPacker(
* The geometry of the specified windows may change, both now and again
* in the future.
*
- *--------------------------------------------------------------
+ *------------------------------------------------------------------------
*/
static int
@@ -1052,7 +1051,7 @@ PackAfter(
* masterPtr. */
Packer *masterPtr, /* Master in which to pack windows. */
int objc, /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]) /* Array of lists, each containing 2 elements:
+ Tcl_Obj *const objv[]) /* Array of lists, each containing 2 elements:
* window name and side against which to
* pack. */
{
@@ -1227,7 +1226,7 @@ PackAfter(
packPtr->nextPtr = prevPtr->nextPtr;
prevPtr->nextPtr = packPtr;
}
- Tk_ManageGeometry(tkwin, &packerType, (ClientData) packPtr);
+ Tk_ManageGeometry(tkwin, &packerType, packPtr);
}
}
@@ -1240,7 +1239,7 @@ PackAfter(
}
if (!(masterPtr->flags & REQUESTED_REPACK)) {
masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(ArrangePacking, masterPtr);
}
return TCL_OK;
}
@@ -1286,7 +1285,7 @@ Unlink(
}
if (!(masterPtr->flags & REQUESTED_REPACK)) {
masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(ArrangePacking, masterPtr);
}
if (masterPtr->abortPtr != NULL) {
*masterPtr->abortPtr = 1;
@@ -1346,20 +1345,20 @@ PackStructureProc(
* eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- register Packer *packPtr = (Packer *) clientData;
+ register Packer *packPtr = clientData;
if (eventPtr->type == ConfigureNotify) {
if ((packPtr->slavePtr != NULL)
&& !(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr);
+ Tcl_DoWhenIdle(ArrangePacking, packPtr);
}
if ((packPtr->masterPtr != NULL)
&& (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width)) {
if (!(packPtr->masterPtr->flags & REQUESTED_REPACK)) {
packPtr->doubleBw = 2*Tk_Changes(packPtr->tkwin)->border_width;
packPtr->masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr->masterPtr);
+ Tcl_DoWhenIdle(ArrangePacking, packPtr->masterPtr);
}
}
} else if (eventPtr->type == DestroyNotify) {
@@ -1371,8 +1370,7 @@ PackStructureProc(
for (slavePtr = packPtr->slavePtr; slavePtr != NULL;
slavePtr = nextPtr) {
- Tk_ManageGeometry(slavePtr->tkwin, NULL,
- (ClientData) NULL);
+ Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL);
Tk_UnmapWindow(slavePtr->tkwin);
slavePtr->masterPtr = NULL;
nextPtr = slavePtr->nextPtr;
@@ -1386,10 +1384,10 @@ PackStructureProc(
}
if (packPtr->flags & REQUESTED_REPACK) {
- Tcl_CancelIdleCall(ArrangePacking, (ClientData) packPtr);
+ Tcl_CancelIdleCall(ArrangePacking, packPtr);
}
packPtr->tkwin = NULL;
- Tcl_EventuallyFree((ClientData) packPtr, DestroyPacker);
+ Tcl_EventuallyFree(packPtr, DestroyPacker);
} else if (eventPtr->type == MapNotify) {
/*
* When a master gets mapped, must redo the geometry computation so
@@ -1399,7 +1397,7 @@ PackStructureProc(
if ((packPtr->slavePtr != NULL)
&& !(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr);
+ Tcl_DoWhenIdle(ArrangePacking, packPtr);
}
} else if (eventPtr->type == UnmapNotify) {
register Packer *packPtr2;
@@ -1441,7 +1439,7 @@ ConfigureSlaves(
Tk_Window tkwin, /* Any window in application containing
* slaves. Used to look up slave names. */
int objc, /* Number of elements in argv. */
- Tcl_Obj *CONST objv[]) /* Argument objects: contains one or more
+ Tcl_Obj *const objv[]) /* Argument objects: contains one or more
* window names followed by any number of
* "option value" pairs. Caller must make sure
* that there is at least one window name. */
@@ -1450,7 +1448,7 @@ ConfigureSlaves(
Tk_Window other, slave, parent, ancestor;
int i, j, numWindows, tmp, positionGiven;
char *string;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"-after", "-anchor", "-before", "-expand", "-fill",
"-in", "-ipadx", "-ipady", "-padx", "-pady", "-side", NULL };
enum options {
@@ -1532,8 +1530,8 @@ ConfigureSlaves(
if (prevPtr->masterPtr == NULL) {
notPacked:
Tcl_AppendResult(interp, "window \"",
- Tcl_GetString(objv[i+1]),
- "\" isn't packed", NULL);
+ Tcl_GetString(objv[i+1]), "\" isn't packed",
+ NULL);
return TCL_ERROR;
}
masterPtr = prevPtr->masterPtr;
@@ -1738,7 +1736,7 @@ ConfigureSlaves(
slavePtr->nextPtr = prevPtr->nextPtr;
prevPtr->nextPtr = slavePtr;
}
- Tk_ManageGeometry(slave, &packerType, (ClientData) slavePtr);
+ Tk_ManageGeometry(slave, &packerType, slavePtr);
prevPtr = slavePtr;
/*
@@ -1751,7 +1749,7 @@ ConfigureSlaves(
}
if (!(masterPtr->flags & REQUESTED_REPACK)) {
masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(ArrangePacking, masterPtr);
}
}
return TCL_OK;
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 7854498..f80e257 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.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: tkPanedWindow.c,v 1.30 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkPanedWindow.c,v 1.31 2008/04/27 22:38:56 dkf Exp $
*/
#include "default.h"
@@ -183,11 +183,11 @@ typedef struct PanedWindow {
int Tk_PanedWindowObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static void PanedWindowCmdDeletedProc(ClientData clientData);
static int ConfigurePanedWindow(Tcl_Interp *interp,
PanedWindow *pwPtr, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static void DestroyPanedWindow(PanedWindow *pwPtr);
static void DisplayPanedWindow(ClientData clientData);
static void PanedWindowEventProc(ClientData clientData,
@@ -197,7 +197,7 @@ static void ProxyWindowEventProc(ClientData clientData,
static void DisplayProxyWindow(ClientData clientData);
static void PanedWindowWorldChanged(ClientData instanceData);
static int PanedWindowWidgetObjCmd(ClientData clientData,
- Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]);
+ Tcl_Interp *, int objc, Tcl_Obj * const objv[]);
static void PanedWindowLostSlaveProc(ClientData clientData,
Tk_Window tkwin);
static void PanedWindowReqProc(ClientData clientData,
@@ -209,14 +209,14 @@ static void SlaveStructureProc(ClientData clientData,
XEvent *eventPtr);
static int PanedWindowSashCommand(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]);
+ Tcl_Obj * const objv[]);
static int PanedWindowProxyCommand(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]);
+ Tcl_Obj * const objv[]);
static void ComputeGeometry(PanedWindow *pwPtr);
static int ConfigureSlaves(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]);
+ Tcl_Obj * const objv[]);
static void DestroyOptionTables(ClientData clientData,
Tcl_Interp *interp);
static int SetSticky(ClientData clientData, Tcl_Interp *interp,
@@ -373,7 +373,7 @@ Tk_PanedWindowObjCmd(
ClientData clientData, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj * CONST objv[]) /* Argument objects. */
+ Tcl_Obj * const objv[]) /* Argument objects. */
{
PanedWindow *pwPtr;
Tk_Window tkwin, parent;
@@ -408,7 +408,7 @@ Tk_PanedWindowObjCmd(
*/
Tcl_SetAssocData(interp, "PanedWindowOptionTables",
- DestroyOptionTables, (ClientData) pwOpts);
+ DestroyOptionTables, pwOpts);
/*
* Create the paned window option tables.
@@ -430,8 +430,8 @@ Tk_PanedWindowObjCmd(
pwPtr->display = Tk_Display(tkwin);
pwPtr->interp = interp;
pwPtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(pwPtr->tkwin), PanedWindowWidgetObjCmd,
- (ClientData) pwPtr, PanedWindowCmdDeletedProc);
+ Tk_PathName(pwPtr->tkwin), PanedWindowWidgetObjCmd, pwPtr,
+ PanedWindowCmdDeletedProc);
pwPtr->optionTable = pwOpts->pwOptions;
pwPtr->slaveOpts = pwOpts->slaveOpts;
pwPtr->relief = TK_RELIEF_RAISED;
@@ -444,7 +444,7 @@ Tk_PanedWindowObjCmd(
* otherwise Tk might free it while we still need it.
*/
- Tcl_Preserve((ClientData) pwPtr->tkwin);
+ Tcl_Preserve(pwPtr->tkwin);
if (Tk_InitOptions(interp, (char *) pwPtr, pwOpts->pwOptions,
tkwin) != TCL_OK) {
@@ -453,7 +453,7 @@ Tk_PanedWindowObjCmd(
}
Tk_CreateEventHandler(pwPtr->tkwin, ExposureMask|StructureNotifyMask,
- PanedWindowEventProc, (ClientData) pwPtr);
+ PanedWindowEventProc, pwPtr);
/*
* Find the toplevel ancestor of the panedwindow, and make a proxy win as
@@ -483,7 +483,7 @@ Tk_PanedWindowObjCmd(
Tk_SetWindowVisual(pwPtr->proxywin,
Tk_Visual(tkwin), Tk_Depth(tkwin), Tk_Colormap(tkwin));
Tk_CreateEventHandler(pwPtr->proxywin, ExposureMask, ProxyWindowEventProc,
- (ClientData) pwPtr);
+ pwPtr);
atts.save_under = True;
Tk_ChangeWindowAttributes(pwPtr->proxywin, CWSaveUnder, &atts);
@@ -520,11 +520,11 @@ PanedWindowWidgetObjCmd(
ClientData clientData, /* Information about square widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj * CONST objv[]) /* Argument objects. */
+ Tcl_Obj * const objv[]) /* Argument objects. */
{
- PanedWindow *pwPtr = (PanedWindow *) clientData;
+ PanedWindow *pwPtr = clientData;
int result = TCL_OK;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"add", "cget", "configure", "forget", "identify", "panecget",
"paneconfigure", "panes", "proxy", "sash", NULL
};
@@ -547,7 +547,7 @@ PanedWindowWidgetObjCmd(
return TCL_ERROR;
}
- Tcl_Preserve((ClientData) pwPtr);
+ Tcl_Preserve(pwPtr);
switch ((enum options) index) {
case PW_ADD:
@@ -605,16 +605,17 @@ PanedWindowWidgetObjCmd(
for (count = 0, i = 2; i < objc; i++) {
Tk_Window slave = Tk_NameToWindow(interp, Tcl_GetString(objv[i]),
pwPtr->tkwin);
+
if (slave == NULL) {
continue;
}
slavePtr = GetPane(pwPtr, slave);
if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
count++;
- Tk_ManageGeometry(slave, NULL, (ClientData)NULL);
+ Tk_ManageGeometry(slave, NULL, NULL);
Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, (ClientData) slavePtr);
+ SlaveStructureProc, slavePtr);
Tk_UnmapWindow(slavePtr->tkwin);
Unlink(slavePtr);
}
@@ -720,7 +721,7 @@ PanedWindowWidgetObjCmd(
result = PanedWindowSashCommand(pwPtr, interp, objc, objv);
break;
}
- Tcl_Release((ClientData) pwPtr);
+ Tcl_Release(pwPtr);
return result;
}
@@ -746,7 +747,7 @@ ConfigureSlaves(
PanedWindow *pwPtr, /* Information about paned window. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int i, firstOptionArg, j, found, doubleBw, index, numNewSlaves, haveLoc;
int insertIndex;
@@ -973,9 +974,8 @@ ConfigureSlaves(
*/
Tk_CreateEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, (ClientData) slavePtr);
- Tk_ManageGeometry(slavePtr->tkwin, &panedWindowMgrType,
- (ClientData) slavePtr);
+ SlaveStructureProc, slavePtr);
+ Tk_ManageGeometry(slavePtr->tkwin, &panedWindowMgrType, slavePtr);
inserts[insertIndex++] = slavePtr;
numNewSlaves++;
}
@@ -1066,9 +1066,9 @@ PanedWindowSashCommand(
PanedWindow *pwPtr, /* Pointer to paned window information. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- static CONST char *sashOptionStrings[] = {
+ static const char *sashOptionStrings[] = {
"coord", "dragto", "mark", "place", NULL
};
enum sashOptions {
@@ -1217,7 +1217,7 @@ ConfigurePanedWindow(
Tcl_Interp *interp, /* Used for error reporting. */
PanedWindow *pwPtr, /* Information about widget. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument values. */
+ Tcl_Obj *const objv[]) /* Argument values. */
{
Tk_SavedOptions savedOptions;
int typemask = 0;
@@ -1230,7 +1230,7 @@ ConfigurePanedWindow(
Tk_FreeSavedOptions(&savedOptions);
- PanedWindowWorldChanged((ClientData) pwPtr);
+ PanedWindowWorldChanged(pwPtr);
/*
* If an option that affects geometry has changed, make a re-layout
@@ -1268,7 +1268,7 @@ PanedWindowWorldChanged(
{
XGCValues gcValues;
GC newGC;
- PanedWindow *pwPtr = (PanedWindow *) instanceData;
+ PanedWindow *pwPtr = instanceData;
/*
* Allocated a graphics context for drawing the paned window widget
@@ -1297,7 +1297,7 @@ PanedWindowWorldChanged(
*/
if (Tk_IsMapped(pwPtr->tkwin) && !(pwPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayPanedWindow, (ClientData) pwPtr);
+ Tcl_DoWhenIdle(DisplayPanedWindow, pwPtr);
pwPtr->flags |= REDRAW_PENDING;
}
}
@@ -1325,17 +1325,17 @@ PanedWindowEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- PanedWindow *pwPtr = (PanedWindow *) clientData;
+ PanedWindow *pwPtr = clientData;
if (eventPtr->type == Expose) {
if (pwPtr->tkwin != NULL && !(pwPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayPanedWindow, (ClientData) pwPtr);
+ Tcl_DoWhenIdle(DisplayPanedWindow, pwPtr);
pwPtr->flags |= REDRAW_PENDING;
}
} else if (eventPtr->type == ConfigureNotify) {
pwPtr->flags |= REQUESTED_RELAYOUT;
if (pwPtr->tkwin != NULL && !(pwPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayPanedWindow, (ClientData) pwPtr);
+ Tcl_DoWhenIdle(DisplayPanedWindow, pwPtr);
pwPtr->flags |= REDRAW_PENDING;
}
} else if (eventPtr->type == DestroyNotify) {
@@ -1365,7 +1365,7 @@ static void
PanedWindowCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- PanedWindow *pwPtr = (PanedWindow *) clientData;
+ PanedWindow *pwPtr = clientData;
/*
* This function could be invoked either because the window was destroyed
@@ -1402,7 +1402,7 @@ static void
DisplayPanedWindow(
ClientData clientData) /* Information about window. */
{
- PanedWindow *pwPtr = (PanedWindow *) clientData;
+ PanedWindow *pwPtr = clientData;
Slave *slavePtr;
Pixmap pixmap;
Tk_Window tkwin = pwPtr->tkwin;
@@ -1518,10 +1518,10 @@ DestroyPanedWindow(
*/
if (pwPtr->flags & REDRAW_PENDING) {
- Tcl_CancelIdleCall(DisplayPanedWindow, (ClientData) pwPtr);
+ Tcl_CancelIdleCall(DisplayPanedWindow, pwPtr);
}
if (pwPtr->flags & RESIZE_PENDING) {
- Tcl_CancelIdleCall(ArrangePanes, (ClientData) pwPtr);
+ Tcl_CancelIdleCall(ArrangePanes, pwPtr);
}
/*
@@ -1533,11 +1533,11 @@ DestroyPanedWindow(
for (i = 0; i < pwPtr->numSlaves; i++) {
Tk_DeleteEventHandler(pwPtr->slaves[i]->tkwin, StructureNotifyMask,
- SlaveStructureProc, (ClientData) pwPtr->slaves[i]);
+ SlaveStructureProc, pwPtr->slaves[i]);
Tk_ManageGeometry(pwPtr->slaves[i]->tkwin, NULL, NULL);
- Tk_FreeConfigOptions((char *)pwPtr->slaves[i], pwPtr->slaveOpts,
+ Tk_FreeConfigOptions((char *) pwPtr->slaves[i], pwPtr->slaveOpts,
pwPtr->tkwin);
- ckfree((void *)pwPtr->slaves[i]);
+ ckfree((char *) pwPtr->slaves[i]);
pwPtr->slaves[i] = NULL;
}
if (pwPtr->slaves) {
@@ -1555,10 +1555,10 @@ DestroyPanedWindow(
*/
Tk_FreeConfigOptions((char *) pwPtr, pwPtr->optionTable, pwPtr->tkwin);
- Tcl_Release((ClientData) pwPtr->tkwin);
+ Tcl_Release(pwPtr->tkwin);
pwPtr->tkwin = NULL;
- Tcl_EventuallyFree((ClientData) pwPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(pwPtr, TCL_DYNAMIC);
}
/*
@@ -1586,12 +1586,12 @@ PanedWindowReqProc(
Tk_Window tkwin) /* Other Tk-related information about the
* window. */
{
- Slave *slavePtr = (Slave *) clientData;
+ Slave *slavePtr = clientData;
PanedWindow *pwPtr = (PanedWindow *) (slavePtr->masterPtr);
if (Tk_IsMapped(pwPtr->tkwin)) {
if (!(pwPtr->flags & RESIZE_PENDING)) {
pwPtr->flags |= RESIZE_PENDING;
- Tcl_DoWhenIdle(ArrangePanes, (ClientData) pwPtr);
+ Tcl_DoWhenIdle(ArrangePanes, pwPtr);
}
} else {
int doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
@@ -1630,18 +1630,18 @@ PanedWindowLostSlaveProc(
* stolen away. */
Tk_Window tkwin) /* Tk's handle for the slave window. */
{
- register Slave *slavePtr = (Slave *) clientData;
- PanedWindow *pwPtr = (PanedWindow *) (slavePtr->masterPtr);
+ register Slave *slavePtr = clientData;
+ PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr;
if (pwPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
}
Unlink(slavePtr);
Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, (ClientData) slavePtr);
+ SlaveStructureProc, slavePtr);
Tk_UnmapWindow(slavePtr->tkwin);
slavePtr->tkwin = NULL;
- ckfree((void *)slavePtr);
+ ckfree((char *) slavePtr);
ComputeGeometry(pwPtr);
}
@@ -1669,7 +1669,7 @@ ArrangePanes(
ClientData clientData) /* Structure describing parent whose slaves
* are to be re-layed out. */
{
- register PanedWindow *pwPtr = (PanedWindow *) clientData;
+ register PanedWindow *pwPtr = clientData;
register Slave *slavePtr;
int i, slaveWidth, slaveHeight, slaveX, slaveY;
int paneWidth, paneHeight, paneSize, paneMinSize;
@@ -1696,7 +1696,7 @@ ArrangePanes(
return;
}
- Tcl_Preserve((ClientData) pwPtr);
+ Tcl_Preserve(pwPtr);
/*
* Find index of last visible pane.
@@ -1939,7 +1939,7 @@ ArrangePanes(
}
sashCount--;
}
- Tcl_Release((ClientData) pwPtr);
+ Tcl_Release(pwPtr);
}
/*
@@ -2000,7 +2000,7 @@ Unlink(
masterPtr->flags |= REQUESTED_RELAYOUT;
if (!(masterPtr->flags & REDRAW_PENDING)) {
masterPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayPanedWindow, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(DisplayPanedWindow, masterPtr);
}
/*
@@ -2071,13 +2071,13 @@ SlaveStructureProc(
ClientData clientData, /* Pointer to record describing window item. */
XEvent *eventPtr) /* Describes what just happened. */
{
- Slave *slavePtr = (Slave *) clientData;
+ Slave *slavePtr = clientData;
PanedWindow *pwPtr = slavePtr->masterPtr;
if (eventPtr->type == DestroyNotify) {
Unlink(slavePtr);
slavePtr->tkwin = NULL;
- ckfree((void *)slavePtr);
+ ckfree((char *) slavePtr);
ComputeGeometry(pwPtr);
}
}
@@ -2256,7 +2256,7 @@ ComputeGeometry(
Tk_GeometryRequest(pwPtr->tkwin, reqWidth, reqHeight);
if (Tk_IsMapped(pwPtr->tkwin) && !(pwPtr->flags & REDRAW_PENDING)) {
pwPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayPanedWindow, (ClientData) pwPtr);
+ Tcl_DoWhenIdle(DisplayPanedWindow, pwPtr);
}
}
@@ -2283,7 +2283,7 @@ DestroyOptionTables(
ClientData clientData, /* Pointer to the OptionTables struct */
Tcl_Interp *interp) /* Pointer to the calling interp */
{
- ckfree((char *)clientData);
+ ckfree((char *) clientData);
return;
}
@@ -2664,11 +2664,11 @@ ProxyWindowEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- PanedWindow *pwPtr = (PanedWindow *) clientData;
+ PanedWindow *pwPtr = clientData;
if (eventPtr->type == Expose) {
if (pwPtr->proxywin != NULL &&!(pwPtr->flags & PROXY_REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayProxyWindow, (ClientData) pwPtr);
+ Tcl_DoWhenIdle(DisplayProxyWindow, pwPtr);
pwPtr->flags |= PROXY_REDRAW_PENDING;
}
}
@@ -2696,7 +2696,7 @@ static void
DisplayProxyWindow(
ClientData clientData) /* Information about window. */
{
- PanedWindow *pwPtr = (PanedWindow *) clientData;
+ PanedWindow *pwPtr = clientData;
Pixmap pixmap;
Tk_Window tkwin = pwPtr->proxywin;
pwPtr->flags &= ~PROXY_REDRAW_PENDING;
@@ -2755,9 +2755,9 @@ PanedWindowProxyCommand(
PanedWindow *pwPtr, /* Pointer to paned window information. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"coord", "forget", "place", NULL
};
enum options {
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 28cdf9d..007c052 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.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: tkPlace.c,v 1.24 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkPlace.c,v 1.25 2008/04/27 22:38:56 dkf Exp $
*/
#include "tkInt.h"
@@ -174,7 +174,7 @@ static void SlaveStructureProc(ClientData clientData,
XEvent *eventPtr);
static int ConfigureSlave(Tcl_Interp *interp, Tk_Window tkwin,
Tk_OptionTable table, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int PlaceInfoCommand(Tcl_Interp *interp, Tk_Window tkwin);
static Slave * CreateSlave(Tk_Window tkwin, Tk_OptionTable table);
static void FreeSlave(Slave *slavePtr);
@@ -208,14 +208,14 @@ Tk_PlaceObjCmd(
ClientData clientData, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin;
Slave *slavePtr;
char *string;
TkDisplay *dispPtr;
Tk_OptionTable optionTable;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"configure", "forget", "info", "slaves", NULL
};
enum options { PLACE_CONFIGURE, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES };
@@ -321,7 +321,7 @@ Tk_PlaceObjCmd(
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
(char *) tkwin));
Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- (ClientData) slavePtr);
+ slavePtr);
Tk_ManageGeometry(tkwin, NULL, (ClientData) NULL);
Tk_UnmapWindow(tkwin);
FreeSlave(slavePtr);
@@ -618,7 +618,7 @@ ConfigureSlave(
Tk_Window tkwin, /* Token for the window to manipulate. */
Tk_OptionTable table, /* Token for option table. */
int objc, /* Number of config arguments. */
- Tcl_Obj *CONST objv[]) /* Object values for arguments. */
+ Tcl_Obj *const objv[]) /* Object values for arguments. */
{
register Master *masterPtr;
Tk_SavedOptions savedOptions;
@@ -732,7 +732,7 @@ ConfigureSlave(
slavePtr->masterPtr = masterPtr;
slavePtr->nextPtr = masterPtr->slavePtr;
masterPtr->slavePtr = slavePtr;
- Tk_ManageGeometry(slavePtr->tkwin, &placerType, (ClientData) slavePtr);
+ Tk_ManageGeometry(slavePtr->tkwin, &placerType, slavePtr);
/*
* Arrange for the master to be re-arranged at the first idle moment.
@@ -743,7 +743,7 @@ ConfigureSlave(
if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
}
return TCL_OK;
@@ -851,7 +851,7 @@ static void
RecomputePlacement(
ClientData clientData) /* Pointer to Master record. */
{
- register Master *masterPtr = (Master *) clientData;
+ register Master *masterPtr = clientData;
register Slave *slavePtr;
int x, y, width, height, tmp;
int masterWidth, masterHeight, masterX, masterY;
@@ -873,13 +873,13 @@ RecomputePlacement(
}
masterPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve((ClientData) masterPtr);
+ Tcl_Preserve(masterPtr);
/*
* Iterate over all the slaves for the master. Each slave's geometry can
* be computed independently of the other slaves. Changes to the window's
* structure could cause almost anything to happen, including deleting the
- * parent or child. If this happens, we'll be told to abort.
+ * parent or child. If this happens, we'll be told to abort.
*/
for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort;
@@ -1046,7 +1046,7 @@ RecomputePlacement(
}
masterPtr->abortPtr = NULL;
- Tcl_Release((ClientData) masterPtr);
+ Tcl_Release(masterPtr);
}
/*
@@ -1073,7 +1073,7 @@ MasterStructureProc(
* referred to by eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- register Master *masterPtr = (Master *) clientData;
+ register Master *masterPtr = clientData;
register Slave *slavePtr, *nextPtr;
TkDisplay *dispPtr = ((TkWindow *) masterPtr->tkwin)->dispPtr;
@@ -1081,7 +1081,7 @@ MasterStructureProc(
if ((masterPtr->slavePtr != NULL)
&& !(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
}
} else if (eventPtr->type == DestroyNotify) {
for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
@@ -1093,13 +1093,13 @@ MasterStructureProc(
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable,
(char *) masterPtr->tkwin));
if (masterPtr->flags & PARENT_RECONFIG_PENDING) {
- Tcl_CancelIdleCall(RecomputePlacement, (ClientData) masterPtr);
+ Tcl_CancelIdleCall(RecomputePlacement, masterPtr);
}
masterPtr->tkwin = NULL;
if (masterPtr->abortPtr != NULL) {
*masterPtr->abortPtr = 1;
}
- Tcl_EventuallyFree((ClientData) masterPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(masterPtr, TCL_DYNAMIC);
} else if (eventPtr->type == MapNotify) {
/*
* When a master gets mapped, must redo the geometry computation so
@@ -1109,7 +1109,7 @@ MasterStructureProc(
if ((masterPtr->slavePtr != NULL)
&& !(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
}
} else if (eventPtr->type == UnmapNotify) {
/*
@@ -1147,7 +1147,7 @@ SlaveStructureProc(
* referred to by eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- register Slave *slavePtr = (Slave *) clientData;
+ register Slave *slavePtr = clientData;
TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
if (eventPtr->type == DestroyNotify) {
@@ -1184,7 +1184,7 @@ PlaceRequestProc(
ClientData clientData, /* Pointer to our record for slave. */
Tk_Window tkwin) /* Window that changed its desired size. */
{
- Slave *slavePtr = (Slave *) clientData;
+ Slave *slavePtr = clientData;
Master *masterPtr;
if (((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) != 0)
@@ -1197,7 +1197,7 @@ PlaceRequestProc(
}
if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, (ClientData) masterPtr);
+ Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
}
}
@@ -1225,7 +1225,7 @@ PlaceLostSlaveProc(
* stolen away. */
Tk_Window tkwin) /* Tk's handle for the slave window. */
{
- register Slave *slavePtr = (Slave *) clientData;
+ register Slave *slavePtr = clientData;
TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
@@ -1236,7 +1236,7 @@ PlaceLostSlaveProc(
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
(char *) tkwin));
Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- (ClientData) slavePtr);
+ slavePtr);
FreeSlave(slavePtr);
}
diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c
index 29ee24e..00a8852 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.17 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkRectOval.c,v 1.18 2008/04/27 22:38:57 dkf Exp $
*/
#include <stdio.h>
@@ -135,10 +135,10 @@ static Tk_ConfigSpec configSpecs[] = {
static void ComputeRectOvalBbox(Tk_Canvas canvas,
RectOvalItem *rectOvalPtr);
static int ConfigureRectOval(Tcl_Interp *interp, Tk_Canvas canvas,
- Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[],
+ Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[],
int flags);
static int CreateRectOval(Tcl_Interp *interp, Tk_Canvas canvas,
- Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[]);
+ Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]);
static void DeleteRectOval(Tk_Canvas canvas, Tk_Item *itemPtr,
Display *display);
static void DisplayRectOval(Tk_Canvas canvas, Tk_Item *itemPtr,
@@ -149,7 +149,7 @@ static int OvalToArea(Tk_Canvas canvas, Tk_Item *itemPtr,
static double OvalToPoint(Tk_Canvas canvas, Tk_Item *itemPtr,
double *pointPtr);
static int RectOvalCoords(Tcl_Interp *interp, Tk_Canvas canvas,
- Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[]);
+ Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]);
static int RectOvalToPostscript(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
static int RectToArea(Tk_Canvas canvas, Tk_Item *itemPtr,
@@ -240,7 +240,7 @@ CreateRectOval(
Tk_Item *itemPtr, /* Record to hold new item; header has been
* initialized by caller. */
int objc, /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */
+ Tcl_Obj *const objv[]) /* Arguments describing rectangle. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
int i;
@@ -315,7 +315,7 @@ RectOvalCoords(
Tk_Item *itemPtr, /* Item whose coordinates are to be read or
* modified. */
int objc, /* Number of coordinates supplied in objv. */
- Tcl_Obj *CONST objv[]) /* Array of coordinates: x1,y1,x2,y2,... */
+ Tcl_Obj *const objv[]) /* Array of coordinates: x1,y1,x2,y2,... */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
@@ -404,7 +404,7 @@ ConfigureRectOval(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Rectangle item to reconfigure. */
int objc, /* Number of elements in objv. */
- Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ Tcl_Obj *const objv[], /* Arguments describing things to configure. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
@@ -420,7 +420,7 @@ ConfigureRectOval(
tkwin = Tk_CanvasTkwin(canvas);
if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
- (CONST char **)objv, (char *) rectOvalPtr, flags|TK_CONFIG_OBJS)) {
+ (const char **)objv, (char *) rectOvalPtr, flags|TK_CONFIG_OBJS)) {
return TCL_ERROR;
}
state = itemPtr->state;
@@ -483,7 +483,7 @@ ConfigureRectOval(
rectOvalPtr->outline.gc = newGC;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
if (state == TK_STATE_HIDDEN) {
ComputeRectOvalBbox(canvas, rectOvalPtr);
@@ -492,7 +492,7 @@ ConfigureRectOval(
color = rectOvalPtr->fillColor;
stipple = rectOvalPtr->fillStipple;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (rectOvalPtr->activeFillColor!=NULL) {
color = rectOvalPtr->activeFillColor;
}
@@ -636,7 +636,7 @@ ComputeRectOvalBbox(
Tk_State state = rectOvalPtr->header.state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = rectOvalPtr->outline.width;
@@ -645,7 +645,7 @@ ComputeRectOvalBbox(
rectOvalPtr->header.x2 = rectOvalPtr->header.y2 = -1;
return;
}
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)rectOvalPtr) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *) rectOvalPtr) {
if (rectOvalPtr->outline.activeWidth>width) {
width = rectOvalPtr->outline.activeWidth;
}
@@ -781,10 +781,10 @@ DisplayRectOval(
*/
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
fillStipple = rectOvalPtr->fillStipple;
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)rectOvalPtr) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *) rectOvalPtr) {
if (rectOvalPtr->activeFillStipple != None) {
fillStipple = rectOvalPtr->activeFillStipple;
}
@@ -886,11 +886,11 @@ RectToPoint(
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = rectPtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (rectPtr->outline.activeWidth>width) {
width = rectPtr->outline.activeWidth;
}
@@ -1006,11 +1006,11 @@ OvalToPoint(
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = (double) ovalPtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (ovalPtr->outline.activeWidth>width) {
width = (double) ovalPtr->outline.activeWidth;
}
@@ -1062,16 +1062,16 @@ RectToArea(
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = rectPtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
- if (rectPtr->outline.activeWidth>width) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
+ if (rectPtr->outline.activeWidth > width) {
width = rectPtr->outline.activeWidth;
}
} else if (state == TK_STATE_DISABLED) {
- if (rectPtr->outline.disabledWidth>0) {
+ if (rectPtr->outline.disabledWidth > 0) {
width = rectPtr->outline.disabledWidth;
}
}
@@ -1131,22 +1131,21 @@ OvalToArea(
* y1, x2, y2) describing rectangular area. */
{
RectOvalItem *ovalPtr = (RectOvalItem *) itemPtr;
- double oval[4], halfWidth;
+ double oval[4], halfWidth, width;
int result;
- double width;
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
width = ovalPtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
- if (ovalPtr->outline.activeWidth>width) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
+ if (ovalPtr->outline.activeWidth > width) {
width = ovalPtr->outline.activeWidth;
}
} else if (state == TK_STATE_DISABLED) {
- if (ovalPtr->outline.disabledWidth>0) {
+ if (ovalPtr->outline.disabledWidth > 0) {
width = ovalPtr->outline.disabledWidth;
}
}
@@ -1328,12 +1327,12 @@ RectOvalToPostscript(
}
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
color = rectOvalPtr->outline.color;
fillColor = rectOvalPtr->fillColor;
fillStipple = rectOvalPtr->fillStipple;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (rectOvalPtr->outline.activeColor!=NULL) {
color = rectOvalPtr->outline.activeColor;
}
@@ -1385,7 +1384,7 @@ RectOvalToPostscript(
Tcl_AppendResult(interp, pathCmd, "0 setlinejoin 2 setlinecap\n",
NULL);
if (Tk_CanvasPsOutline(canvas, itemPtr,
- &(rectOvalPtr->outline))!= TCL_OK) {
+ &rectOvalPtr->outline)!= TCL_OK) {
return TCL_ERROR;
}
}
diff --git a/generic/tkScale.c b/generic/tkScale.c
index fce0341..cb010c1 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -16,7 +16,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkScale.c,v 1.28 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkScale.c,v 1.29 2008/04/27 22:38:58 dkf Exp $
*/
#include "default.h"
@@ -142,7 +142,7 @@ static const Tk_OptionSpec optionSpecs[] = {
* scale widget command.
*/
-static CONST char *commandNames[] = {
+static const char *commandNames[] = {
"cget", "configure", "coords", "get", "identify", "set", NULL
};
@@ -158,17 +158,17 @@ enum command {
static void ComputeFormat(TkScale *scalePtr);
static void ComputeScaleGeometry(TkScale *scalePtr);
static int ConfigureScale(Tcl_Interp *interp, TkScale *scalePtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void DestroyScale(char *memPtr);
static void ScaleCmdDeletedProc(ClientData clientData);
static void ScaleEventProc(ClientData clientData,
XEvent *eventPtr);
static char * ScaleVarProc(ClientData clientData,
- Tcl_Interp *interp, CONST char *name1,
- CONST char *name2, int flags);
+ Tcl_Interp *interp, const char *name1,
+ const char *name2, int flags);
static int ScaleWidgetObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static void ScaleWorldChanged(ClientData instanceData);
static void ScaleSetVariable(TkScale *scalePtr);
@@ -204,7 +204,7 @@ Tk_ScaleObjCmd(
ClientData clientData, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument values. */
+ Tcl_Obj *const objv[]) /* Argument values. */
{
register TkScale *scalePtr;
Tk_OptionTable optionTable;
@@ -242,7 +242,7 @@ Tk_ScaleObjCmd(
scalePtr->interp = interp;
scalePtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(scalePtr->tkwin), ScaleWidgetObjCmd,
- (ClientData) scalePtr, ScaleCmdDeletedProc);
+ scalePtr, ScaleCmdDeletedProc);
scalePtr->optionTable = optionTable;
scalePtr->orient = ORIENT_VERTICAL;
scalePtr->width = 0;
@@ -291,10 +291,10 @@ Tk_ScaleObjCmd(
scalePtr->takeFocusPtr = NULL;
scalePtr->flags = NEVER_SET;
- Tk_SetClassProcs(scalePtr->tkwin, &scaleClass, (ClientData) scalePtr);
+ Tk_SetClassProcs(scalePtr->tkwin, &scaleClass, scalePtr);
Tk_CreateEventHandler(scalePtr->tkwin,
ExposureMask|StructureNotifyMask|FocusChangeMask,
- ScaleEventProc, (ClientData) scalePtr);
+ ScaleEventProc, scalePtr);
if ((Tk_InitOptions(interp, (char *) scalePtr, optionTable, tkwin)
!= TCL_OK) ||
@@ -330,9 +330,9 @@ ScaleWidgetObjCmd(
ClientData clientData, /* Information about scale widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument strings. */
+ Tcl_Obj *const objv[]) /* Argument strings. */
{
- TkScale *scalePtr = (TkScale *) clientData;
+ TkScale *scalePtr = clientData;
Tcl_Obj *objPtr;
int index, result;
@@ -345,7 +345,7 @@ ScaleWidgetObjCmd(
if (result != TCL_OK) {
return result;
}
- Tcl_Preserve((ClientData) scalePtr);
+ Tcl_Preserve(scalePtr);
switch (index) {
case COMMAND_CGET:
@@ -467,11 +467,11 @@ ScaleWidgetObjCmd(
break;
}
}
- Tcl_Release((ClientData) scalePtr);
+ Tcl_Release(scalePtr);
return result;
error:
- Tcl_Release((ClientData) scalePtr);
+ Tcl_Release(scalePtr);
return TCL_ERROR;
}
@@ -503,7 +503,7 @@ DestroyScale(
Tcl_DeleteCommandFromToken(scalePtr->interp, scalePtr->widgetCmd);
if (scalePtr->flags & REDRAW_PENDING) {
- Tcl_CancelIdleCall(TkpDisplayScale, (ClientData) scalePtr);
+ Tcl_CancelIdleCall(TkpDisplayScale, scalePtr);
}
/*
@@ -514,7 +514,7 @@ DestroyScale(
if (scalePtr->varNamePtr != NULL) {
Tcl_UntraceVar(scalePtr->interp, Tcl_GetString(scalePtr->varNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- ScaleVarProc, (ClientData) scalePtr);
+ ScaleVarProc, scalePtr);
}
if (scalePtr->troughGC != None) {
Tk_FreeGC(scalePtr->display, scalePtr->troughGC);
@@ -557,7 +557,7 @@ ConfigureScale(
register TkScale *scalePtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in objv. */
- Tcl_Obj *CONST objv[]) /* Argument values. */
+ Tcl_Obj *const objv[]) /* Argument values. */
{
Tk_SavedOptions savedOptions;
Tcl_Obj *errorResult = NULL;
@@ -571,7 +571,7 @@ ConfigureScale(
if (scalePtr->varNamePtr != NULL) {
Tcl_UntraceVar(interp, Tcl_GetString(scalePtr->varNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- ScaleVarProc, (ClientData) scalePtr);
+ ScaleVarProc, scalePtr);
}
for (error = 0; error <= 1; error++) {
@@ -581,8 +581,8 @@ ConfigureScale(
*/
if (Tk_SetOptions(interp, (char *) scalePtr,
- scalePtr->optionTable, objc, objv,
- scalePtr->tkwin, &savedOptions, NULL) != TCL_OK) {
+ scalePtr->optionTable, objc, objv, scalePtr->tkwin,
+ &savedOptions, NULL) != TCL_OK) {
continue;
}
} else {
@@ -687,10 +687,10 @@ ConfigureScale(
}
Tcl_TraceVar(interp, Tcl_GetString(scalePtr->varNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- ScaleVarProc, (ClientData) scalePtr);
+ ScaleVarProc, scalePtr);
}
- ScaleWorldChanged((ClientData) scalePtr);
+ ScaleWorldChanged(scalePtr);
if (error) {
Tcl_SetObjResult(interp, errorResult);
Tcl_DecrRefCount(errorResult);
@@ -723,9 +723,7 @@ ScaleWorldChanged(
{
XGCValues gcValues;
GC gc;
- TkScale *scalePtr;
-
- scalePtr = (TkScale *) instanceData;
+ TkScale *scalePtr = instanceData;
gcValues.foreground = scalePtr->troughColorPtr->pixel;
gc = Tk_GetGC(scalePtr->tkwin, GCForeground, &gcValues);
@@ -1007,7 +1005,7 @@ ScaleEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TkScale *scalePtr = (TkScale *) clientData;
+ TkScale *scalePtr = clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
TkEventuallyRedrawScale(scalePtr, REDRAW_ALL);
@@ -1055,7 +1053,7 @@ static void
ScaleCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkScale *scalePtr = (TkScale *) clientData;
+ TkScale *scalePtr = clientData;
Tk_Window tkwin = scalePtr->tkwin;
/*
@@ -1102,7 +1100,7 @@ TkEventuallyRedrawScale(
}
if (!(scalePtr->flags & REDRAW_PENDING)) {
scalePtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(TkpDisplayScale, (ClientData) scalePtr);
+ Tcl_DoWhenIdle(TkpDisplayScale, scalePtr);
}
scalePtr->flags |= what;
}
@@ -1173,11 +1171,11 @@ static char *
ScaleVarProc(
ClientData clientData, /* Information about button. */
Tcl_Interp *interp, /* Interpreter containing variable. */
- CONST char *name1, /* Name of variable. */
- CONST char *name2, /* Second part of variable name. */
+ const char *name1, /* Name of variable. */
+ const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
- register TkScale *scalePtr = (TkScale *) clientData;
+ register TkScale *scalePtr = clientData;
char *resultStr;
double value;
Tcl_Obj *valuePtr;
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index 52e449f..359e92c 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.12 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkScrollbar.c,v 1.13 2008/04/27 22:38:58 dkf Exp $
*/
#include "tkInt.h"
@@ -25,7 +25,7 @@
static Tk_CustomOption orientOption = {
(Tk_OptionParseProc *) TkOrientParseProc,
TkOrientPrintProc,
- (ClientData) NULL
+ NULL
};
/*
@@ -99,10 +99,10 @@ Tk_ConfigSpec tkpScrollbarConfigSpecs[] = {
static int ConfigureScrollbar(Tcl_Interp *interp,
TkScrollbar *scrollPtr, int argc,
- CONST char **argv, int flags);
+ const char **argv, int flags);
static void ScrollbarCmdDeletedProc(ClientData clientData);
static int ScrollbarWidgetCmd(ClientData clientData,
- Tcl_Interp *, int argc, CONST char **argv);
+ Tcl_Interp *, int argc, const char **argv);
/*
*--------------------------------------------------------------
@@ -126,9 +126,9 @@ Tk_ScrollbarCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
+ Tk_Window tkwin = clientData;
register TkScrollbar *scrollPtr;
Tk_Window newWin;
@@ -146,7 +146,7 @@ Tk_ScrollbarCmd(
Tk_SetClass(newWin, "Scrollbar");
scrollPtr = TkpCreateScrollbar(newWin);
- Tk_SetClassProcs(newWin, &tkpScrollbarProcs, (ClientData) scrollPtr);
+ Tk_SetClassProcs(newWin, &tkpScrollbarProcs, scrollPtr);
/*
* Initialize fields that won't be initialized by ConfigureScrollbar, or
@@ -159,7 +159,7 @@ Tk_ScrollbarCmd(
scrollPtr->interp = interp;
scrollPtr->widgetCmd = Tcl_CreateCommand(interp,
Tk_PathName(scrollPtr->tkwin), ScrollbarWidgetCmd,
- (ClientData) scrollPtr, ScrollbarCmdDeletedProc);
+ scrollPtr, ScrollbarCmdDeletedProc);
scrollPtr->vertical = 0;
scrollPtr->width = 0;
scrollPtr->command = NULL;
@@ -223,9 +223,9 @@ ScrollbarWidgetCmd(
ClientData clientData, /* Information about scrollbar widget. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
- register TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
+ register TkScrollbar *scrollPtr = clientData;
int result = TCL_OK;
size_t length;
int c;
@@ -235,7 +235,7 @@ ScrollbarWidgetCmd(
argv[0], " option ?arg arg ...?\"", NULL);
return TCL_ERROR;
}
- Tcl_Preserve((ClientData) scrollPtr);
+ Tcl_Preserve(scrollPtr);
c = argv[1][0];
length = strlen(argv[1]);
if ((c == 'a') && (strncmp(argv[1], "activate", length) == 0)) {
@@ -493,11 +493,11 @@ ScrollbarWidgetCmd(
}
done:
- Tcl_Release((ClientData) scrollPtr);
+ Tcl_Release(scrollPtr);
return result;
error:
- Tcl_Release((ClientData) scrollPtr);
+ Tcl_Release(scrollPtr);
return TCL_ERROR;
}
@@ -528,7 +528,7 @@ ConfigureScrollbar(
/* Information about widget; may or may not
* already have values for some fields. */
int argc, /* Number of valid entries in argv. */
- CONST char **argv, /* Arguments. */
+ const char **argv, /* Arguments. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, tkpScrollbarConfigSpecs,
@@ -587,7 +587,7 @@ TkScrollbarEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
+ TkScrollbar *scrollPtr = clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
TkScrollbarEventuallyRedraw(scrollPtr);
@@ -599,7 +599,7 @@ TkScrollbarEventProc(
scrollPtr->widgetCmd);
}
if (scrollPtr->flags & REDRAW_PENDING) {
- Tcl_CancelIdleCall(TkpDisplayScrollbar, (ClientData) scrollPtr);
+ Tcl_CancelIdleCall(TkpDisplayScrollbar, scrollPtr);
}
/*
* Free up all the stuff that requires special handling, then let
@@ -608,7 +608,7 @@ TkScrollbarEventProc(
Tk_FreeOptions(tkpScrollbarConfigSpecs, (char *) scrollPtr,
scrollPtr->display, 0);
- Tcl_EventuallyFree((ClientData) scrollPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(scrollPtr, TCL_DYNAMIC);
} else if (eventPtr->type == ConfigureNotify) {
TkpComputeScrollbarGeometry(scrollPtr);
TkScrollbarEventuallyRedraw(scrollPtr);
@@ -651,7 +651,7 @@ static void
ScrollbarCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
+ TkScrollbar *scrollPtr = clientData;
Tk_Window tkwin = scrollPtr->tkwin;
/*
@@ -691,7 +691,7 @@ TkScrollbarEventuallyRedraw(
return;
}
if ((scrollPtr->flags & REDRAW_PENDING) == 0) {
- Tcl_DoWhenIdle(TkpDisplayScrollbar, (ClientData) scrollPtr);
+ Tcl_DoWhenIdle(TkpDisplayScrollbar, scrollPtr);
scrollPtr->flags |= REDRAW_PENDING;
}
}
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index dca3d1c..e02478f 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkSelect.c,v 1.20 2007/04/17 14:36:49 dkf Exp $
+ * RCS: @(#) $Id: tkSelect.c,v 1.21 2008/04/27 22:38:58 dkf Exp $
*/
#include "tkInt.h"
@@ -197,7 +197,7 @@ Tk_CreateSelHandler(
unsigned cmdInfoLen = sizeof(CommandInfo) +
((CommandInfo*)clientData)->cmdLength - 3;
- selPtr->clientData = (ClientData)ckalloc(cmdInfoLen);
+ selPtr->clientData = (ClientData) ckalloc(cmdInfoLen);
memcpy(selPtr->clientData, clientData, cmdInfoLen);
} else {
selPtr->clientData = clientData;
@@ -321,7 +321,7 @@ Tk_DeleteSelHandler(
* Mark the CommandInfo as deleted and free it if we can.
*/
- ((CommandInfo*)selPtr->clientData)->interp = NULL;
+ ((CommandInfo *) selPtr->clientData)->interp = NULL;
Tcl_EventuallyFree(selPtr->clientData, TCL_DYNAMIC);
}
ckfree((char *) selPtr);
@@ -671,15 +671,15 @@ Tk_SelectionObjCmd(
* interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
+ Tk_Window tkwin = clientData;
char *path = NULL;
Atom selection;
char *selName = NULL, *string;
int count, index;
Tcl_Obj **objs;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"clear", "get", "handle", "own", NULL
};
enum options {
@@ -698,7 +698,7 @@ Tk_SelectionObjCmd(
switch ((enum options) index) {
case SELECTION_CLEAR: {
- static CONST char *clearOptionStrings[] = {
+ static const char *clearOptionStrings[] = {
"-displayof", "-selection", NULL
};
enum clearOptions { CLEAR_DISPLAYOF, CLEAR_SELECTION };
@@ -757,7 +757,7 @@ Tk_SelectionObjCmd(
char *targetName = NULL;
Tcl_DString selBytes;
int result;
- static CONST char *getOptionStrings[] = {
+ static const char *getOptionStrings[] = {
"-displayof", "-selection", "-type", NULL
};
enum getOptions { GET_DISPLAYOF, GET_SELECTION, GET_TYPE };
@@ -817,7 +817,7 @@ Tk_SelectionObjCmd(
Tcl_DStringInit(&selBytes);
result = Tk_GetSelection(interp, tkwin, selection, target,
- SelGetProc, (ClientData) &selBytes);
+ SelGetProc, &selBytes);
if (result == TCL_OK) {
Tcl_DStringResult(interp, &selBytes);
} else {
@@ -832,7 +832,7 @@ Tk_SelectionObjCmd(
char *formatName = NULL;
register CommandInfo *cmdInfoPtr;
int cmdLength;
- static CONST char *handleOptionStrings[] = {
+ static const char *handleOptionStrings[] = {
"-format", "-selection", "-type", NULL
};
enum handleOptions {
@@ -911,7 +911,7 @@ Tk_SelectionObjCmd(
cmdInfoPtr->cmdLength = cmdLength;
strcpy(cmdInfoPtr->command, string);
Tk_CreateSelHandler(tkwin, selection, target, HandleTclCommand,
- (ClientData) cmdInfoPtr, format);
+ cmdInfoPtr, format);
}
return TCL_OK;
}
@@ -920,7 +920,7 @@ Tk_SelectionObjCmd(
register LostCommand *lostPtr;
char *script = NULL;
int cmdLength;
- static CONST char *ownOptionStrings[] = {
+ static const char *ownOptionStrings[] = {
"-command", "-displayof", "-selection", NULL
};
enum ownOptions { OWN_COMMAND, OWN_DISPLAYOF, OWN_SELECTION };
@@ -1003,15 +1003,15 @@ Tk_SelectionObjCmd(
script = Tcl_GetString(objs[1]);
}
if (script == NULL) {
- Tk_OwnSelection(tkwin, selection, NULL, (ClientData) NULL);
+ Tk_OwnSelection(tkwin, selection, NULL, NULL);
return TCL_OK;
}
cmdLength = strlen(script);
- lostPtr = (LostCommand *) ckalloc((unsigned) (sizeof(LostCommand)
- -3 + cmdLength));
+ lostPtr = (LostCommand *)
+ ckalloc((unsigned) (sizeof(LostCommand) - 3 + cmdLength));
lostPtr->interp = interp;
strcpy(lostPtr->command, script);
- Tk_OwnSelection(tkwin, selection, LostSelection, (ClientData) lostPtr);
+ Tk_OwnSelection(tkwin, selection, LostSelection, lostPtr);
return TCL_OK;
}
}
@@ -1119,7 +1119,7 @@ TkSelDeadWindow(
* Mark the CommandInfo as deleted and free it when we can.
*/
- ((CommandInfo*)selPtr->clientData)->interp = NULL;
+ ((CommandInfo *) selPtr->clientData)->interp = NULL;
Tcl_EventuallyFree(selPtr->clientData, TCL_DYNAMIC);
}
ckfree((char *) selPtr);
@@ -1292,7 +1292,7 @@ SelGetProc(
* used). */
char *portion) /* New information to be appended. */
{
- Tcl_DStringAppend((Tcl_DString *) clientData, portion, -1);
+ Tcl_DStringAppend(clientData, portion, -1);
return TCL_OK;
}
@@ -1324,7 +1324,7 @@ HandleTclCommand(
char *buffer, /* Place to store converted selection. */
int maxBytes) /* Maximum # of bytes to store at buffer. */
{
- CommandInfo *cmdInfoPtr = (CommandInfo *) clientData;
+ CommandInfo *cmdInfoPtr = clientData;
int spaceNeeded, length;
#define MAX_STATIC_SIZE 100
char staticSpace[MAX_STATIC_SIZE];
@@ -1333,7 +1333,7 @@ HandleTclCommand(
Tcl_DString oldResult;
Tcl_Obj *objPtr;
int extraBytes, charOffset, count, numChars;
- CONST char *p;
+ const char *p;
/*
* We must also protect the interpreter and the command from being deleted
@@ -1341,7 +1341,7 @@ HandleTclCommand(
*/
Tcl_Preserve(clientData);
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
/*
* Compute the proper byte offset in the case where the last chunk split a
@@ -1427,7 +1427,7 @@ HandleTclCommand(
}
Tcl_Release(clientData);
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
return count;
}
@@ -1492,7 +1492,7 @@ TkSelDefaultSelection(
if ((selPtr->selection == infoPtr->selection)
&& (selPtr->target != dispPtr->applicationAtom)
&& (selPtr->target != dispPtr->windowAtom)) {
- CONST char *atomString = Tk_GetAtomName((Tk_Window) winPtr,
+ const char *atomString = Tk_GetAtomName((Tk_Window) winPtr,
selPtr->target);
Tcl_DStringAppendElement(&ds, atomString);
}
@@ -1559,12 +1559,12 @@ static void
LostSelection(
ClientData clientData) /* Pointer to LostCommand structure. */
{
- LostCommand *lostPtr = (LostCommand *) clientData;
+ LostCommand *lostPtr = clientData;
Tcl_Obj *objPtr;
Tcl_Interp *interp;
interp = lostPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
/*
* Execute the command. Save the interpreter's result, if any, and restore
@@ -1582,7 +1582,7 @@ LostSelection(
Tcl_SetObjResult(interp, objPtr);
Tcl_DecrRefCount(objPtr);
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
/*
* Free the storage for the command, since we're done with it now.
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index 6bfde11..29d9957 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.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: tkSquare.c,v 1.10 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkSquare.c,v 1.11 2008/04/27 22:38:58 dkf Exp $
*/
#if 0
@@ -94,7 +94,7 @@ static const Tk_OptionSpec optionSpecs[] = {
int SquareObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]);
+ Tcl_Obj * const objv[]);
static void SquareDeletedProc(ClientData clientData);
static int SquareConfigure(Tcl_Interp *interp, Square *squarePtr);
static void SquareDestroy(char *memPtr);
@@ -103,7 +103,7 @@ static void KeepInWindow(Square *squarePtr);
static void SquareObjEventProc(ClientData clientData,
XEvent *eventPtr);
static int SquareWidgetObjCmd(ClientData clientData,
- Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]);
+ Tcl_Interp *, int objc, Tcl_Obj * const objv[]);
/*
*--------------------------------------------------------------
@@ -127,7 +127,7 @@ SquareObjCmd(
ClientData clientData, /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Square *squarePtr;
Tk_Window tkwin;
@@ -166,8 +166,8 @@ SquareObjCmd(
squarePtr->display = Tk_Display(tkwin);
squarePtr->interp = interp;
squarePtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd,
- (ClientData) squarePtr, SquareDeletedProc);
+ Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd, squarePtr,
+ SquareDeletedProc);
squarePtr->gc = None;
squarePtr->optionTable = optionTable;
@@ -179,7 +179,7 @@ SquareObjCmd(
}
Tk_CreateEventHandler(squarePtr->tkwin, ExposureMask|StructureNotifyMask,
- SquareObjEventProc, (ClientData) squarePtr);
+ SquareObjEventProc, squarePtr);
if (Tk_SetOptions(interp, (char *) squarePtr, optionTable, objc - 2,
objv + 2, tkwin, NULL, NULL) != TCL_OK) {
goto error;
@@ -220,11 +220,11 @@ SquareWidgetObjCmd(
ClientData clientData, /* Information about square widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj * CONST objv[]) /* Argument objects. */
+ Tcl_Obj * const objv[]) /* Argument objects. */
{
- Square *squarePtr = (Square *) clientData;
+ Square *squarePtr = clientData;
int result = TCL_OK;
- static CONST char *squareOptions[] = {"cget", "configure", NULL};
+ static const char *squareOptions[] = {"cget", "configure", NULL};
enum {
SQUARE_CGET, SQUARE_CONFIGURE
};
@@ -241,7 +241,7 @@ SquareWidgetObjCmd(
return TCL_ERROR;
}
- Tcl_Preserve((ClientData) squarePtr);
+ Tcl_Preserve(squarePtr);
switch (index) {
case SQUARE_CGET:
@@ -279,7 +279,7 @@ SquareWidgetObjCmd(
result = SquareConfigure(interp, squarePtr);
}
if (!squarePtr->updatePending) {
- Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
+ Tcl_DoWhenIdle(SquareDisplay, squarePtr);
squarePtr->updatePending = 1;
}
}
@@ -287,11 +287,11 @@ SquareWidgetObjCmd(
Tcl_SetObjResult(interp, resultObjPtr);
}
}
- Tcl_Release((ClientData) squarePtr);
+ Tcl_Release(squarePtr);
return result;
error:
- Tcl_Release((ClientData) squarePtr);
+ Tcl_Release(squarePtr);
return TCL_ERROR;
}
@@ -352,7 +352,7 @@ SquareConfigure(
&borderWidth);
Tk_SetInternalBorder(squarePtr->tkwin, borderWidth);
if (!squarePtr->updatePending) {
- Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
+ Tcl_DoWhenIdle(SquareDisplay, squarePtr);
squarePtr->updatePending = 1;
}
KeepInWindow(squarePtr);
@@ -382,17 +382,17 @@ SquareObjEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- Square *squarePtr = (Square *) clientData;
+ Square *squarePtr = clientData;
if (eventPtr->type == Expose) {
if (!squarePtr->updatePending) {
- Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
+ Tcl_DoWhenIdle(SquareDisplay, squarePtr);
squarePtr->updatePending = 1;
}
} else if (eventPtr->type == ConfigureNotify) {
KeepInWindow(squarePtr);
if (!squarePtr->updatePending) {
- Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
+ Tcl_DoWhenIdle(SquareDisplay, squarePtr);
squarePtr->updatePending = 1;
}
} else if (eventPtr->type == DestroyNotify) {
@@ -407,9 +407,9 @@ SquareObjEventProc(
squarePtr->widgetCmd);
}
if (squarePtr->updatePending) {
- Tcl_CancelIdleCall(SquareDisplay, (ClientData) squarePtr);
+ Tcl_CancelIdleCall(SquareDisplay, squarePtr);
}
- Tcl_EventuallyFree((ClientData) squarePtr, SquareDestroy);
+ Tcl_EventuallyFree(squarePtr, SquareDestroy);
}
}
@@ -435,7 +435,7 @@ static void
SquareDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- Square *squarePtr = (Square *) clientData;
+ Square *squarePtr = clientData;
Tk_Window tkwin = squarePtr->tkwin;
/*
@@ -472,7 +472,7 @@ static void
SquareDisplay(
ClientData clientData) /* Information about window. */
{
- Square *squarePtr = (Square *) clientData;
+ Square *squarePtr = clientData;
Tk_Window tkwin = squarePtr->tkwin;
Pixmap pm = None;
Drawable d;
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index c7f02e7..2372007 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkStubInit.c,v 1.62 2008/04/16 14:51:29 das Exp $
+ * RCS: @(#) $Id: tkStubInit.c,v 1.63 2008/04/27 22:38:58 dkf Exp $
*/
#include "tkInt.h"
@@ -37,9 +37,9 @@
*/
#define Tk_CreateCanvasVisitor \
- ((void (*)(Tcl_Interp * interp, VOID * typePtr)) NULL)
+ ((void (*)(Tcl_Interp * interp, void * typePtr)) NULL)
#define Tk_GetCanvasVisitor \
- ((VOID * (*)(Tcl_Interp * interp, CONST char * name)) NULL)
+ ((void * (*)(Tcl_Interp * interp, const char * name)) NULL)
/*
* WARNING: The contents of this file is automatically generated by the
diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c
index ddfd986..ce47028 100644
--- a/generic/tkStubLib.c
+++ b/generic/tkStubLib.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: tkStubLib.c,v 1.24 2008/04/02 21:31:58 das Exp $
+ * RCS: @(#) $Id: tkStubLib.c,v 1.25 2008/04/27 22:38:58 dkf Exp $
*/
/*
@@ -59,7 +59,9 @@ const TkIntXlibStubs *tkIntXlibStubsPtr = NULL;
* Use our own isdigit to avoid linking to libc on windows
*/
-static int isDigit(const int c)
+static int
+isDigit(
+ const int c)
{
return (c >= '0' && c <= '9');
}
@@ -82,13 +84,13 @@ static int isDigit(const int c)
*----------------------------------------------------------------------
*/
-MODULE_SCOPE CONST char *
+MODULE_SCOPE const char *
Tk_InitStubs(
Tcl_Interp *interp,
- CONST char *version,
+ const char *version,
int exact)
{
- CONST char *actualVersion;
+ const char *actualVersion;
const TkStubs **stubsPtrPtr = &tkStubsPtr; /* squelch warning */
actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 0,
@@ -97,14 +99,14 @@ Tk_InitStubs(
return NULL;
}
if (exact) {
- CONST char *p = version;
+ const char *p = version;
int count = 0;
while (*p) {
count += !isDigit(*p++);
}
if (count == 1) {
- CONST char *q = actualVersion;
+ const char *q = actualVersion;
p = version;
while (*p && (*p == *q)) {
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index 5f2ada2..24464c0 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.8 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkStyle.c,v 1.9 2008/04/27 22:38:58 dkf Exp $
*/
#include "tkInt.h"
@@ -26,7 +26,7 @@ typedef struct StyledWidgetSpec {
* structure. */
Tk_OptionTable optionTable; /* Option table for the widget class using the
* element. */
- CONST Tk_OptionSpec **optionsPtr;
+ const Tk_OptionSpec **optionsPtr;
/* Table of option spec pointers, matching the
* option list provided during element
* registration. Malloc'd. */
@@ -60,7 +60,7 @@ typedef struct StyledElement {
*/
typedef struct StyleEngine {
- CONST char *name; /* Name of engine. Points to a hash key. */
+ const char *name; /* Name of engine. Points to a hash key. */
StyledElement *elements; /* Table of widget element descriptors. Each
* element is indexed by a unique system-wide
* ID. Table grows dynamically as new elements
@@ -77,7 +77,7 @@ typedef struct StyleEngine {
*/
typedef struct Style {
- CONST char *name; /* Name of style. Points to a hash key. */
+ const char *name; /* Name of style. Points to a hash key. */
StyleEngine *enginePtr; /* Style engine of which the style is an
* instance. */
ClientData clientData; /* Data provided during registration. */
@@ -88,7 +88,7 @@ typedef struct Style {
*/
typedef struct Element {
- CONST char *name; /* Name of element. Points to a hash key. */
+ const char *name; /* Name of element. Points to a hash key. */
int id; /* Id of element. */
int genericId; /* Id of generic element. */
int created; /* Boolean, whether the element was created
@@ -122,7 +122,7 @@ static Tcl_ThreadDataKey dataKey;
* Forward declarations for functions defined later in this file:
*/
-static int CreateElement(CONST char *name, int create);
+static int CreateElement(const char *name, int create);
static void DupStyleObjProc(Tcl_Obj *srcObjPtr,
Tcl_Obj *dupObjPtr);
static void FreeElement(Element *elementPtr);
@@ -134,13 +134,13 @@ static StyledElement * GetStyledElement(StyleEngine *enginePtr,
int elementId);
static StyledWidgetSpec*GetWidgetSpec(StyledElement *elementPtr,
Tk_OptionTable optionTable);
-static void InitElement(Element *elementPtr, CONST char *name,
+static void InitElement(Element *elementPtr, const char *name,
int id, int genericId, int created);
-static void InitStyle(Style *stylePtr, CONST char *name,
+static void InitStyle(Style *stylePtr, const char *name,
StyleEngine *enginePtr, ClientData clientData);
static void InitStyledElement(StyledElement *elementPtr);
static void InitStyleEngine(StyleEngine *enginePtr,
- CONST char *name, StyleEngine *parentPtr);
+ const char *name, StyleEngine *parentPtr);
static void InitWidgetSpec(StyledWidgetSpec *widgetSpecPtr,
StyledElement *elementPtr,
Tk_OptionTable optionTable);
@@ -182,7 +182,7 @@ void
TkStylePkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->nbInit != 0) {
@@ -238,7 +238,7 @@ void
TkStylePkgFree(
TkMainInfo *mainPtr) /* The application being deleted. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashSearch search;
Tcl_HashEntry *entryPtr;
@@ -267,7 +267,7 @@ TkStylePkgFree(
entryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search);
while (entryPtr != NULL) {
- enginePtr = (StyleEngine *) Tcl_GetHashValue(entryPtr);
+ enginePtr = Tcl_GetHashValue(entryPtr);
FreeStyleEngine(enginePtr);
ckfree((char *) enginePtr);
entryPtr = Tcl_NextHashEntry(&search);
@@ -305,12 +305,12 @@ TkStylePkgFree(
Tk_StyleEngine
Tk_RegisterStyleEngine(
- CONST char *name, /* Name of the engine to create. NULL or empty
+ const char *name, /* Name of the engine to create. NULL or empty
* means the default system engine. */
Tk_StyleEngine parent) /* The engine's parent. NULL means the default
* system engine. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int newEntry;
@@ -337,7 +337,7 @@ Tk_RegisterStyleEngine(
enginePtr = (StyleEngine *) ckalloc(sizeof(StyleEngine));
InitStyleEngine(enginePtr, Tcl_GetHashKey(&tsdPtr->engineTable, entryPtr),
(StyleEngine *) parent);
- Tcl_SetHashValue(entryPtr, (ClientData) enginePtr);
+ Tcl_SetHashValue(entryPtr, enginePtr);
return (Tk_StyleEngine) enginePtr;
}
@@ -361,13 +361,13 @@ Tk_RegisterStyleEngine(
static void
InitStyleEngine(
StyleEngine *enginePtr, /* Points to an uninitialized engine. */
- CONST char *name, /* Name of the registered engine. NULL or empty
+ const char *name, /* Name of the registered engine. NULL or empty
* means the default system engine. Usually
* points to the hash key. */
StyleEngine *parentPtr) /* The engine's parent. NULL means the default
* system engine. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int elementId;
@@ -377,14 +377,12 @@ InitStyleEngine(
*/
enginePtr->parentPtr = NULL;
-
} else if (parentPtr == NULL) {
/*
* The default style engine is the parent.
*/
enginePtr->parentPtr = tsdPtr->defaultEnginePtr;
-
} else {
enginePtr->parentPtr = parentPtr;
}
@@ -424,7 +422,7 @@ static void
FreeStyleEngine(
StyleEngine *enginePtr) /* The style engine to free. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int elementId;
@@ -456,10 +454,10 @@ FreeStyleEngine(
Tk_StyleEngine
Tk_GetStyleEngine(
- CONST char *name) /* Name of the engine to retrieve. NULL or
+ const char *name) /* Name of the engine to retrieve. NULL or
* empty means the default system engine. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
@@ -472,7 +470,7 @@ Tk_GetStyleEngine(
return NULL;
}
- return (Tk_StyleEngine) Tcl_GetHashValue(entryPtr);
+ return Tcl_GetHashValue(entryPtr);
}
/*
@@ -494,7 +492,7 @@ Tk_GetStyleEngine(
static void
InitElement(
Element *elementPtr, /* Points to an uninitialized element.*/
- CONST char *name, /* Name of the registered element. Usually
+ const char *name, /* Name of the registered element. Usually
* points to the hash key. */
int id, /* Unique element ID. */
int genericId, /* ID of generic element. -1 means none. */
@@ -604,17 +602,16 @@ FreeStyledElement(
static int
CreateElement(
- CONST char *name, /* Name of the element. */
- int create) /* Boolean, whether the element is being created
- * explicitly (being registered) or implicitly (by a
- * derived element). */
+ const char *name, /* Name of the element. */
+ int create) /* Boolean, whether the element is being
+ * created explicitly (being registered) or
+ * implicitly (by a derived element). */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr, *engineEntryPtr;
Tcl_HashSearch search;
- int newEntry;
- int elementId, genericId = -1;
+ int newEntry, elementId, genericId = -1;
char *dot;
StyleEngine *enginePtr;
@@ -642,7 +639,7 @@ CreateElement(
}
elementId = tsdPtr->nbElements++;
- Tcl_SetHashValue(entryPtr, (ClientData) INT2PTR(elementId));
+ Tcl_SetHashValue(entryPtr, INT2PTR(elementId));
/*
* Reallocate element table.
@@ -660,7 +657,7 @@ CreateElement(
engineEntryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search);
while (engineEntryPtr != NULL) {
- enginePtr = (StyleEngine *) Tcl_GetHashValue(engineEntryPtr);
+ enginePtr = Tcl_GetHashValue(engineEntryPtr);
enginePtr->elements = (StyledElement *) ckrealloc(
(char *) enginePtr->elements,
@@ -691,9 +688,9 @@ CreateElement(
int
Tk_GetElementId(
- CONST char *name) /* Name of the element. */
+ const char *name) /* Name of the element. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int genericId = -1;
@@ -851,7 +848,7 @@ GetStyledElement(
int elementId) /* Unique element ID */
{
StyledElement *elementPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
StyleEngine *enginePtr2;
@@ -912,7 +909,7 @@ InitWidgetSpec(
{
int i, nbOptions;
Tk_ElementOptionSpec *elementOptionPtr;
- CONST Tk_OptionSpec *widgetOptionPtr;
+ const Tk_OptionSpec *widgetOptionPtr;
widgetSpecPtr->elementPtr = elementPtr;
widgetSpecPtr->optionTable = optionTable;
@@ -930,7 +927,7 @@ InitWidgetSpec(
* Build the widget option list.
*/
- widgetSpecPtr->optionsPtr = (CONST Tk_OptionSpec **)
+ widgetSpecPtr->optionsPtr = (const Tk_OptionSpec **)
ckalloc(sizeof(Tk_OptionSpec *) * nbOptions);
for (i = 0, elementOptionPtr = elementPtr->specPtr->options;
i < nbOptions; i++, elementOptionPtr++) {
@@ -1232,12 +1229,12 @@ Tk_DrawElement(
Tk_Style
Tk_CreateStyle(
- CONST char *name, /* Name of the style to create. NULL or empty
+ const char *name, /* Name of the style to create. NULL or empty
* means the default system style. */
Tk_StyleEngine engine, /* The style engine. */
ClientData clientData) /* Private data passed as is to engine code. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int newEntry;
@@ -1263,10 +1260,9 @@ Tk_CreateStyle(
stylePtr = (Style *) ckalloc(sizeof(Style));
InitStyle(stylePtr, Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr),
- (engine != NULL ? (StyleEngine *) engine :
- tsdPtr->defaultEnginePtr),
+ (engine!=NULL ? (StyleEngine*) engine : tsdPtr->defaultEnginePtr),
clientData);
- Tcl_SetHashValue(entryPtr, (ClientData) stylePtr);
+ Tcl_SetHashValue(entryPtr, stylePtr);
return (Tk_Style) stylePtr;
}
@@ -1290,7 +1286,7 @@ Tk_CreateStyle(
*---------------------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_NameOfStyle(
Tk_Style style) /* Style whose name is desired. */
{
@@ -1318,7 +1314,7 @@ Tk_NameOfStyle(
static void
InitStyle(
Style *stylePtr, /* Points to an uninitialized style. */
- CONST char *name, /* Name of the registered style. NULL or empty
+ const char *name, /* Name of the registered style. NULL or empty
* means the default system style. Usually
* points to the hash key. */
StyleEngine *enginePtr, /* The style engine. */
@@ -1350,10 +1346,10 @@ InitStyle(
Tk_Style
Tk_GetStyle(
Tcl_Interp *interp, /* Interp for error return. */
- CONST char *name) /* Name of the style to retrieve. NULL or empty
+ const char *name) /* Name of the style to retrieve. NULL or empty
* means the default system style. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
Style *stylePtr;
@@ -1370,7 +1366,7 @@ Tk_GetStyle(
}
return (Tk_Style) NULL;
}
- stylePtr = (Style *) Tcl_GetHashValue(entryPtr);
+ stylePtr = Tcl_GetHashValue(entryPtr);
return (Tk_Style) stylePtr;
}
@@ -1417,10 +1413,8 @@ Tk_AllocStyleFromObj(
if (objPtr->typePtr != &styleObjType) {
SetStyleFromAny(interp, objPtr);
- stylePtr = (Style *) objPtr->internalRep.otherValuePtr;
- } else {
- stylePtr = (Style *) objPtr->internalRep.otherValuePtr;
}
+ stylePtr = objPtr->internalRep.otherValuePtr;
return (Tk_Style) stylePtr;
}
@@ -1452,7 +1446,7 @@ Tk_GetStyleFromObj(
SetStyleFromAny(NULL, objPtr);
}
- return (Tk_Style) objPtr->internalRep.otherValuePtr;
+ return objPtr->internalRep.otherValuePtr;
}
/*
@@ -1507,7 +1501,7 @@ SetStyleFromAny(
}
objPtr->typePtr = &styleObjType;
- objPtr->internalRep.otherValuePtr = (VOID *) Tk_GetStyle(interp, name);
+ objPtr->internalRep.otherValuePtr = Tk_GetStyle(interp, name);
return TCL_OK;
}
@@ -1551,7 +1545,8 @@ DupStyleObjProc(
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
dupObjPtr->typePtr = srcObjPtr->typePtr;
- dupObjPtr->internalRep.otherValuePtr=srcObjPtr->internalRep.otherValuePtr;
+ dupObjPtr->internalRep.otherValuePtr =
+ srcObjPtr->internalRep.otherValuePtr;
}
/*
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 432f5f7..b294022 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTest.c,v 1.35 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkTest.c,v 1.36 2008/04/27 22:38:58 dkf Exp $
*/
#include "tkInt.h"
@@ -61,7 +61,7 @@ typedef struct TImageInstance {
*/
static int ImageCreate(Tcl_Interp *interp,
- char *name, int argc, Tcl_Obj *CONST objv[],
+ char *name, int argc, Tcl_Obj *const objv[],
Tk_ImageType *typePtr, Tk_ImageMaster master,
ClientData *clientDataPtr);
static ClientData ImageGet(Tk_Window tkwin, ClientData clientData);
@@ -103,7 +103,7 @@ static NewApp *newAppPtr = NULL;/* First in list of all new interpreters. */
extern int SquareObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]);
+ Tcl_Obj * const objv[]);
typedef struct CBinding {
Tcl_Interp *interp;
@@ -144,39 +144,39 @@ static int CBindingEvalProc(ClientData clientData,
static void CBindingFreeProc(ClientData clientData);
int Tktest_Init(Tcl_Interp *interp);
static int ImageCmd(ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv);
+ Tcl_Interp *interp, int argc, const char **argv);
static int TestcbindCmd(ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv);
+ Tcl_Interp *interp, int argc, const char **argv);
static int TestbitmapObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]);
+ Tcl_Obj * const objv[]);
static int TestborderObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]);
+ Tcl_Obj * const objv[]);
static int TestcolorObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]);
+ Tcl_Obj * const objv[]);
static int TestcursorObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]);
+ Tcl_Obj * const objv[]);
static int TestdeleteappsCmd(ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv);
+ Tcl_Interp *interp, int argc, const char **argv);
static int TestfontObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int TestmakeexistCmd(ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv);
+ Tcl_Interp *interp, int argc, const char **argv);
#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
static int TestmenubarCmd(ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv);
+ Tcl_Interp *interp, int argc, const char **argv);
#endif
#if defined(__WIN32__) || defined(MAC_OSX_TK)
static int TestmetricsCmd(ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv);
+ Tcl_Interp *interp, int argc, const char **argv);
#endif
static int TestobjconfigObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]);
+ Tcl_Obj * const objv[]);
static int CustomOptionSet(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
Tcl_Obj **value, char *recordPtr,
@@ -191,15 +191,15 @@ static void CustomOptionRestore(ClientData clientData,
static void CustomOptionFree(ClientData clientData,
Tk_Window tkwin, char *internalPtr);
static int TestpropCmd(ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv);
+ Tcl_Interp *interp, int argc, const char **argv);
#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
static int TestwrapperCmd(ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv);
+ Tcl_Interp *interp, int argc, const char **argv);
#endif
static void TrivialCmdDeletedProc(ClientData clientData);
static int TrivialConfigObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]);
+ Tcl_Obj * const objv[]);
static void TrivialEventProc(ClientData clientData,
XEvent *eventPtr);
@@ -334,7 +334,7 @@ TestcbindCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
TkWindow *winPtr;
Tk_Window tkwin;
@@ -442,7 +442,7 @@ TestbitmapObjCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
if (objc < 2) {
@@ -477,7 +477,7 @@ TestborderObjCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
if (objc < 2) {
@@ -512,7 +512,7 @@ TestcolorObjCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "color");
@@ -546,7 +546,7 @@ TestcursorObjCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "cursor");
@@ -581,7 +581,7 @@ TestdeleteappsCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
NewApp *nextPtr;
@@ -618,9 +618,9 @@ TestobjconfigObjCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- static CONST char *options[] = {
+ static const char *options[] = {
"alltypes", "chain1", "chain2", "configerror", "delete", "info",
"internal", "new", "notenoughparams", "twowindows", NULL
};
@@ -1249,10 +1249,10 @@ TrivialConfigObjCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int result = TCL_OK;
- static CONST char *options[] = {
+ static const char *options[] = {
"cget", "configure", "csave", NULL
};
enum {
@@ -1432,9 +1432,9 @@ TestfontObjCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- static CONST char *options[] = {"counts", "subfonts", NULL};
+ static const char *options[] = {"counts", "subfonts", NULL};
enum option {COUNTS, SUBFONTS};
int index;
Tk_Window tkwin;
@@ -1493,7 +1493,7 @@ ImageCreate(
* image. */
char *name, /* Name to use for image. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[], /* Argument strings for options (doesn't
+ Tcl_Obj *const objv[], /* Argument strings for options (doesn't
* include image name or type). */
Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
Tk_ImageMaster master, /* Token for image, to be used by us in later
@@ -1558,7 +1558,7 @@ ImageCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
TImageMaster *timPtr = (TImageMaster *) clientData;
int x, y, width, height;
@@ -1779,7 +1779,7 @@ TestmakeexistCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
Tk_Window mainWin = (Tk_Window) clientData;
int i;
@@ -1821,7 +1821,7 @@ TestmenubarCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
#ifdef __UNIX__
Tk_Window mainWin = (Tk_Window) clientData;
@@ -1890,7 +1890,7 @@ TestmetricsCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
char buf[TCL_INTEGER_SPACE];
int val;
@@ -1963,7 +1963,7 @@ TestpropCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
Tk_Window mainWin = (Tk_Window) clientData;
int result, actualFormat;
@@ -2043,7 +2043,7 @@ TestwrapperCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
TkWindow *winPtr, *wrapperPtr;
Tk_Window tkwin;
diff --git a/generic/tkText.c b/generic/tkText.c
index 0032ad5..97ce974 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.c,v 1.79 2007/12/13 15:24:16 dgp Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.80 2008/04/27 22:38:58 dkf Exp $
*/
#include "default.h"
@@ -331,13 +331,13 @@ int tkTextDebug = 0;
*/
static int ConfigureText(Tcl_Interp *interp,
- TkText *textPtr, int objc, Tcl_Obj *CONST objv[]);
+ TkText *textPtr, int objc, Tcl_Obj *const objv[]);
static int DeleteIndexRange(TkSharedText *sharedPtr,
- TkText *textPtr, CONST TkTextIndex *indexPtr1,
- CONST TkTextIndex *indexPtr2, int viewUpdate);
-static int CountIndices(CONST TkText *textPtr,
- CONST TkTextIndex *indexPtr1,
- CONST TkTextIndex *indexPtr2,
+ TkText *textPtr, const TkTextIndex *indexPtr1,
+ const TkTextIndex *indexPtr2, int viewUpdate);
+static int CountIndices(const TkText *textPtr,
+ const TkTextIndex *indexPtr1,
+ const TkTextIndex *indexPtr2,
TkTextCountType type);
static void DestroyText(TkText *textPtr);
static int InsertChars(TkSharedText *sharedTextPtr,
@@ -346,58 +346,58 @@ static int InsertChars(TkSharedText *sharedTextPtr,
static void TextBlinkProc(ClientData clientData);
static void TextCmdDeletedProc(ClientData clientData);
static int CreateWidget(TkSharedText *sharedPtr, Tk_Window tkwin,
- Tcl_Interp *interp, CONST TkText *parent,
- int objc, Tcl_Obj *CONST objv[]);
+ Tcl_Interp *interp, const TkText *parent,
+ int objc, Tcl_Obj *const objv[]);
static void TextEventProc(ClientData clientData,
XEvent *eventPtr);
static int TextFetchSelection(ClientData clientData, int offset,
char *buffer, int maxBytes);
-static int TextIndexSortProc(CONST void *first,
- CONST void *second);
+static int TextIndexSortProc(const void *first,
+ const void *second);
static int TextInsertCmd(TkSharedText *sharedTextPtr,
TkText *textPtr, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[],
- CONST TkTextIndex *indexPtr, int viewUpdate);
+ int objc, Tcl_Obj *const objv[],
+ const TkTextIndex *indexPtr, int viewUpdate);
static int TextReplaceCmd(TkText *textPtr, Tcl_Interp *interp,
- CONST TkTextIndex *indexFromPtr,
- CONST TkTextIndex *indexToPtr,
- int objc, Tcl_Obj *CONST objv[], int viewUpdate);
+ const TkTextIndex *indexFromPtr,
+ const TkTextIndex *indexToPtr,
+ int objc, Tcl_Obj *const objv[], int viewUpdate);
static int TextSearchCmd(TkText *textPtr, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int TextEditCmd(TkText *textPtr, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int TextWidgetObjCmd(ClientData clientData,
Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int SharedTextObjCmd(ClientData clientData,
Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void TextWorldChangedCallback(ClientData instanceData);
static void TextWorldChanged(TkText *textPtr, int mask);
static int TextDumpCmd(TkText *textPtr, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static int DumpLine(Tcl_Interp *interp, TkText *textPtr,
int what, TkTextLine *linePtr, int start, int end,
int lineno, Tcl_Obj *command);
static int DumpSegment(TkText *textPtr, Tcl_Interp *interp,
- CONST char *key, CONST char *value,
- Tcl_Obj *command, CONST TkTextIndex *index,
+ const char *key, const char *value,
+ Tcl_Obj *command, const TkTextIndex *index,
int what);
static int TextEditUndo(TkText *textPtr);
static int TextEditRedo(TkText *textPtr);
-static Tcl_Obj * TextGetText(CONST TkText *textPtr,
- CONST TkTextIndex *index1,
- CONST TkTextIndex *index2, int visibleOnly);
+static Tcl_Obj * TextGetText(const TkText *textPtr,
+ const TkTextIndex *index1,
+ const TkTextIndex *index2, int visibleOnly);
static void GenerateModifiedEvent(TkText *textPtr);
static void UpdateDirtyFlag(TkSharedText *sharedPtr);
static void TextPushUndoAction(TkText *textPtr,
Tcl_Obj *undoString, int insert,
- CONST TkTextIndex *index1Ptr,
- CONST TkTextIndex *index2Ptr);
-static int TextSearchIndexInLine(CONST SearchSpec *searchSpecPtr,
+ const TkTextIndex *index1Ptr,
+ const TkTextIndex *index2Ptr);
+static int TextSearchIndexInLine(const SearchSpec *searchSpecPtr,
TkTextLine *linePtr, int byteIndex);
static int TextPeerCmd(TkText *textPtr, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static TkUndoProc TextUndoRedoCallback;
/*
@@ -441,7 +441,7 @@ Tk_TextObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
@@ -479,10 +479,10 @@ CreateWidget(
TkSharedText *sharedPtr, /* Shared widget info, or NULL. */
Tk_Window tkwin, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
- CONST TkText *parent, /* If non-NULL then take default start, end
+ const TkText *parent, /* If non-NULL then take default start, end
* from this parent. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register TkText *textPtr;
Tk_OptionTable optionTable;
@@ -679,13 +679,13 @@ TextWidgetObjCmd(
ClientData clientData, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register TkText *textPtr = (TkText *) clientData;
int result = TCL_OK;
int index;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"bbox", "cget", "compare", "configure", "count", "debug", "delete",
"dlineinfo", "dump", "edit", "get", "image", "index", "insert",
"mark", "peer", "replace", "scan", "search", "see", "tag", "window",
@@ -713,7 +713,7 @@ TextWidgetObjCmd(
switch ((enum options) index) {
case TEXT_BBOX: {
int x, y, width, height;
- CONST TkTextIndex *indexPtr;
+ const TkTextIndex *indexPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "index");
@@ -757,8 +757,8 @@ TextWidgetObjCmd(
break;
case TEXT_COMPARE: {
int relation, value;
- CONST char *p;
- CONST TkTextIndex *index1Ptr, *index2Ptr;
+ const char *p;
+ const TkTextIndex *index1Ptr, *index2Ptr;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "index1 op index2");
@@ -818,7 +818,7 @@ TextWidgetObjCmd(
}
break;
case TEXT_COUNT: {
- CONST TkTextIndex *indexFromPtr, *indexToPtr;
+ const TkTextIndex *indexFromPtr, *indexToPtr;
int i, found = 0, update = 0;
Tcl_Obj *objPtr = NULL;
@@ -841,7 +841,7 @@ TextWidgetObjCmd(
for (i = 2; i < objc-2; i++) {
int value, length;
- CONST char *option = Tcl_GetStringFromObj(objv[i], &length);
+ const char *option = Tcl_GetStringFromObj(objv[i], &length);
char c;
if (length < 2 || option[0] != '-') {
@@ -880,7 +880,7 @@ TextWidgetObjCmd(
}
if (compare > 0) {
- CONST TkTextIndex *tmpPtr = indexFromPtr;
+ const TkTextIndex *tmpPtr = indexFromPtr;
indexFromPtr = indexToPtr;
indexToPtr = tmpPtr;
@@ -1061,7 +1061,7 @@ TextWidgetObjCmd(
* Simple case requires no predetermination of indices.
*/
- CONST TkTextIndex *indexPtr1, *indexPtr2;
+ const TkTextIndex *indexPtr1, *indexPtr2;
/*
* Parse the starting and stopping indices.
@@ -1107,7 +1107,7 @@ TextWidgetObjCmd(
*/
for (i = 0; i < objc; i++) {
- CONST TkTextIndex *indexPtr =
+ const TkTextIndex *indexPtr =
TkTextGetIndexFromObj(interp, textPtr, objv[i]);
if (indexPtr == NULL) {
@@ -1198,7 +1198,7 @@ TextWidgetObjCmd(
break;
case TEXT_DLINEINFO: {
int x, y, width, height, base;
- CONST TkTextIndex *indexPtr;
+ const TkTextIndex *indexPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "index");
@@ -1233,7 +1233,7 @@ TextWidgetObjCmd(
case TEXT_GET: {
Tcl_Obj *objPtr = NULL;
int i, found = 0, visible = 0;
- CONST char *name;
+ const char *name;
int length;
if (objc < 3) {
@@ -1264,7 +1264,7 @@ TextWidgetObjCmd(
}
for (; i < objc; i += 2) {
- CONST TkTextIndex *index1Ptr, *index2Ptr;
+ const TkTextIndex *index1Ptr, *index2Ptr;
TkTextIndex index2;
index1Ptr = TkTextGetIndexFromObj(interp, textPtr, objv[i]);
@@ -1328,7 +1328,7 @@ TextWidgetObjCmd(
result = TkTextImageCmd(textPtr, interp, objc, objv);
break;
case TEXT_INDEX: {
- CONST TkTextIndex *indexPtr;
+ const TkTextIndex *indexPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "index");
@@ -1345,7 +1345,7 @@ TextWidgetObjCmd(
break;
}
case TEXT_INSERT: {
- CONST TkTextIndex *indexPtr;
+ const TkTextIndex *indexPtr;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -1371,7 +1371,7 @@ TextWidgetObjCmd(
result = TextPeerCmd(textPtr, interp, objc, objv);
break;
case TEXT_REPLACE: {
- CONST TkTextIndex *indexFromPtr, *indexToPtr;
+ const TkTextIndex *indexFromPtr, *indexToPtr;
if (objc < 5) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -1530,13 +1530,13 @@ SharedTextObjCmd(
ClientData clientData, /* Information about shared test B-tree. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register TkSharedText *sharedPtr = (TkSharedText *) clientData;
int result = TCL_OK;
int index;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"delete", "insert", NULL
};
enum options {
@@ -1636,12 +1636,12 @@ TextPeerCmd(
TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = textPtr->tkwin;
int index;
- static CONST char *peerOptionStrings[] = {
+ static const char *peerOptionStrings[] = {
"create", "names", NULL
};
enum peerOptions {
@@ -1710,12 +1710,12 @@ static int
TextReplaceCmd(
TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
- CONST TkTextIndex *indexFromPtr,
+ const TkTextIndex *indexFromPtr,
/* Index from which to replace. */
- CONST TkTextIndex *indexToPtr,
+ const TkTextIndex *indexToPtr,
/* Index to which to replace. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[], /* Argument objects. */
+ Tcl_Obj *const objv[], /* Argument objects. */
int viewUpdate) /* Update vertical view if set. */
{
/*
@@ -1780,8 +1780,8 @@ TextReplaceCmd(
static int
TextIndexSortProc(
- CONST void *first, /* Elements to be compared. */
- CONST void *second)
+ const void *first, /* Elements to be compared. */
+ const void *second)
{
TkTextIndex *pair1 = (TkTextIndex *) first;
TkTextIndex *pair2 = (TkTextIndex *) second;
@@ -1997,7 +1997,7 @@ ConfigureText(
register TkText *textPtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_SavedOptions savedOptions;
int oldExport = textPtr->exportSelection;
@@ -2508,7 +2508,7 @@ InsertChars(
int resetViewCount;
int pixels[2*PIXEL_CLIENTS];
- CONST char *string = Tcl_GetStringFromObj(stringPtr, &length);
+ const char *string = Tcl_GetStringFromObj(stringPtr, &length);
if (sharedTextPtr == NULL) {
sharedTextPtr = textPtr->sharedTextPtr;
@@ -2640,9 +2640,9 @@ TextPushUndoAction(
TkText *textPtr, /* Overall information about text widget. */
Tcl_Obj *undoString, /* New text. */
int insert, /* 1 if insert, else delete. */
- CONST TkTextIndex *index1Ptr,
+ const TkTextIndex *index1Ptr,
/* Index describing first location. */
- CONST TkTextIndex *index2Ptr)
+ const TkTextIndex *index2Ptr)
/* Index describing second location. */
{
TkUndoSubAtom *iAtom, *dAtom;
@@ -2864,11 +2864,11 @@ TextUndoRedoCallback(
static int
CountIndices(
- CONST TkText *textPtr, /* Overall information about text widget. */
- CONST TkTextIndex *indexPtr1,
+ const TkText *textPtr, /* Overall information about text widget. */
+ const TkTextIndex *indexPtr1,
/* Index describing location of first
* character to delete. */
- CONST TkTextIndex *indexPtr2,
+ const TkTextIndex *indexPtr2,
/* Index describing location of last character
* to delete. NULL means just delete the one
* character given by indexPtr1. */
@@ -2921,10 +2921,10 @@ static int
DeleteIndexRange(
TkSharedText *sharedTextPtr,/* Shared portion of peer widgets. */
TkText *textPtr, /* Overall information about text widget. */
- CONST TkTextIndex *indexPtr1,
+ const TkTextIndex *indexPtr1,
/* Index describing location of first
* character (or other entity) to delete. */
- CONST TkTextIndex *indexPtr2,
+ const TkTextIndex *indexPtr2,
/* Index describing location of last
* character (or other entity) to delete.
* NULL means just delete the one character
@@ -3491,8 +3491,8 @@ TextInsertCmd(
TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[], /* Argument objects. */
- CONST TkTextIndex *indexPtr,/* Index at which to insert. */
+ Tcl_Obj *const objv[], /* Argument objects. */
+ const TkTextIndex *indexPtr,/* Index at which to insert. */
int viewUpdate) /* Update the view if set. */
{
TkTextIndex index1, index2;
@@ -3536,7 +3536,7 @@ TextInsertCmd(
int i;
for (i = 0; i < numTags; i++) {
- CONST char *strTag = Tcl_GetString(tagNamePtrs[i]);
+ const char *strTag = Tcl_GetString(tagNamePtrs[i]);
TkBTreeTag(&index1, &index2,
TkTextCreateTag(textPtr, strTag, NULL), 1);
@@ -3570,12 +3570,12 @@ TextSearchCmd(
TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int i, argsLeft, code;
SearchSpec searchSpec;
- static CONST char *switchStrings[] = {
+ static const char *switchStrings[] = {
"--", "-all", "-backwards", "-count", "-elide", "-exact", "-forwards",
"-hidden", "-nocase", "-nolinestop", "-overlap", "-regexp",
"-strictlimits", NULL
@@ -3787,7 +3787,7 @@ TextSearchGetLineIndex(
int *offsetPosPtr) /* For returning the text offset in the
* line. */
{
- CONST TkTextIndex *indexPtr;
+ const TkTextIndex *indexPtr;
int line;
TkText *textPtr = (TkText *) searchSpecPtr->clientData;
@@ -3846,7 +3846,7 @@ TextSearchGetLineIndex(
static int
TextSearchIndexInLine(
- CONST SearchSpec *searchSpecPtr,
+ const SearchSpec *searchSpecPtr,
/* Search parameters. */
TkTextLine *linePtr, /* The line we're looking at. */
int byteIndex) /* Index into the line. */
@@ -4066,7 +4066,7 @@ TextSearchFoundMatch(
*/
if (searchSpecPtr->exact) {
- CONST char *startOfLine = Tcl_GetString(theLine);
+ const char *startOfLine = Tcl_GetString(theLine);
numChars = Tcl_NumUtfChars(startOfLine + matchOffset, matchLength);
} else {
@@ -4277,7 +4277,7 @@ TkTextGetTabs(
/*
* Map these strings to TkTextTabAlign values.
*/
- static CONST char *tabOptionStrings[] = {
+ static const char *tabOptionStrings[] = {
"left", "right", "center", "numeric", NULL
};
@@ -4431,7 +4431,7 @@ TextDumpCmd(
register TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
+ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "dump". */
{
@@ -4449,7 +4449,7 @@ TextDumpCmd(
#define TK_DUMP_IMG 0x10
#define TK_DUMP_ALL (TK_DUMP_TEXT|TK_DUMP_MARK|TK_DUMP_TAG| \
TK_DUMP_WIN|TK_DUMP_IMG)
- static CONST char *optStrings[] = {
+ static const char *optStrings[] = {
"-all", "-command", "-image", "-mark", "-tag", "-text", "-window",
NULL
};
@@ -4816,10 +4816,10 @@ static int
DumpSegment(
TkText *textPtr,
Tcl_Interp *interp,
- CONST char *key, /* Segment type key. */
- CONST char *value, /* Segment value. */
+ const char *key, /* Segment type key. */
+ const char *value, /* Segment value. */
Tcl_Obj *command, /* Script callback. */
- CONST TkTextIndex *index, /* index with line/byte position info. */
+ const TkTextIndex *index, /* index with line/byte position info. */
int what) /* Look for TK_DUMP_INDEX bit. */
{
char buffer[TK_POS_CHARS];
@@ -4831,7 +4831,7 @@ DumpSegment(
Tcl_AppendElement(interp, buffer);
return 0;
} else {
- CONST char *argv[4];
+ const char *argv[4];
char *list;
int oldStateEpoch = TkBTreeEpoch(textPtr->sharedTextPtr->tree);
@@ -4956,11 +4956,11 @@ TextEditCmd(
TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int index;
- static CONST char *editOptionStrings[] = {
+ static const char *editOptionStrings[] = {
"modified", "redo", "reset", "separator", "undo", NULL
};
enum editOptions {
@@ -5080,10 +5080,10 @@ TextEditCmd(
static Tcl_Obj *
TextGetText(
- CONST TkText *textPtr, /* Information about text widget. */
- CONST TkTextIndex *indexPtr1,
+ const TkText *textPtr, /* Information about text widget. */
+ const TkTextIndex *indexPtr1,
/* Get text from this index... */
- CONST TkTextIndex *indexPtr2,
+ const TkTextIndex *indexPtr2,
/* ...to this index. */
int visibleOnly) /* If non-zero, then only return non-elided
* characters. */
@@ -5251,7 +5251,7 @@ SearchPerform(
*/
if (toPtr != NULL) {
- CONST TkTextIndex *indexToPtr, *indexFromPtr;
+ const TkTextIndex *indexToPtr, *indexFromPtr;
TkText *textPtr = (TkText *) searchSpecPtr->clientData;
indexToPtr = TkTextGetIndexFromObj(interp, textPtr, toPtr);
@@ -5345,7 +5345,7 @@ SearchCore(
Tcl_Obj *theLine;
int alreadySearchOffset = -1;
- CONST char *pattern = NULL; /* For exact searches only. */
+ const char *pattern = NULL; /* For exact searches only. */
int firstNewLine = -1; /* For exact searches only. */
Tcl_RegExp regexp = NULL; /* For regexp searches only. */
@@ -5403,7 +5403,7 @@ SearchCore(
*/
if (searchSpecPtr->exact) {
- CONST char *nl;
+ const char *nl;
/*
* We only need to set the matchLength once for exact searches, and we
@@ -5540,11 +5540,11 @@ SearchCore(
if (searchSpecPtr->exact) {
int maxExtraLines = 0;
- CONST char *startOfLine = Tcl_GetString(theLine);
+ const char *startOfLine = Tcl_GetString(theLine);
do {
Tcl_UniChar ch;
- CONST char *p;
+ const char *p;
int lastFullLine = lastOffset;
if (firstNewLine == -1) {
@@ -5569,7 +5569,7 @@ SearchCore(
* match.
*/
- CONST char c = pattern[0];
+ const char c = pattern[0];
if (alreadySearchOffset != -1) {
p = startOfLine + alreadySearchOffset;
@@ -6515,7 +6515,7 @@ TkpTesttextCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
TkText *textPtr;
size_t len;
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index c8c8606..995b3e8 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.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: tkTextDisp.c,v 1.68 2007/12/13 15:24:17 dgp Exp $
+ * RCS: @(#) $Id: tkTextDisp.c,v 1.69 2008/04/27 22:38:58 dkf Exp $
*/
#include "tkInt.h"
@@ -542,23 +542,23 @@ static void DisplayDLine(TkText *textPtr, DLine *dlPtr,
static void DisplayLineBackground(TkText *textPtr, DLine *dlPtr,
DLine *prevPtr, Pixmap pixmap);
static void DisplayText(ClientData clientData);
-static DLine * FindDLine(DLine *dlPtr, CONST TkTextIndex *indexPtr);
+static DLine * FindDLine(DLine *dlPtr, const TkTextIndex *indexPtr);
static void FreeDLines(TkText *textPtr, DLine *firstPtr,
DLine *lastPtr, int action);
static void FreeStyle(TkText *textPtr, TextStyle *stylePtr);
-static TextStyle * GetStyle(TkText *textPtr, CONST TkTextIndex *indexPtr);
+static TextStyle * GetStyle(TkText *textPtr, const TkTextIndex *indexPtr);
static void GetXView(Tcl_Interp *interp, TkText *textPtr,
int report);
static void GetYView(Tcl_Interp *interp, TkText *textPtr,
int report);
static int GetYPixelCount(TkText *textPtr, DLine *dlPtr);
static DLine * LayoutDLine(TkText *textPtr,
- CONST TkTextIndex *indexPtr);
-static int MeasureChars(Tk_Font tkfont, CONST char *source,
+ const TkTextIndex *indexPtr);
+static int MeasureChars(Tk_Font tkfont, const char *source,
int maxBytes, int rangeStart, int rangeLength,
int startX, int maxX, int flags, int *nextXPtr);
static void MeasureUp(TkText *textPtr,
- CONST TkTextIndex *srcPtr, int distance,
+ const TkTextIndex *srcPtr, int distance,
TkTextIndex *dstPtr, int *overlap);
static int NextTabStop(Tk_Font tkfont, int x, int tabOrigin);
static void UpdateDisplayInfo(TkText *textPtr);
@@ -568,8 +568,8 @@ static int SizeOfTab(TkText *textPtr, int tabStyle,
TkTextTabArray *tabArrayPtr, int *indexPtr, int x,
int maxX);
static void TextChanged(TkText *textPtr,
- CONST TkTextIndex *index1Ptr,
- CONST TkTextIndex *index2Ptr);
+ const TkTextIndex *index1Ptr,
+ const TkTextIndex *index2Ptr);
static void TextInvalidateRegion(TkText *textPtr, TkRegion region);
static void TextRedrawTag(TkText *textPtr,
TkTextIndex *index1Ptr, TkTextIndex *index2Ptr,
@@ -577,7 +577,7 @@ static void TextRedrawTag(TkText *textPtr,
static void TextInvalidateLineMetrics(TkText *textPtr,
TkTextLine *linePtr, int lineCount, int action);
static int CalculateDisplayLineHeight(TkText *textPtr,
- CONST TkTextIndex *indexPtr, int *byteCountPtr,
+ const TkTextIndex *indexPtr, int *byteCountPtr,
int *mergedLinePtr);
static void DlineIndexOfX(TkText *textPtr,
DLine *dlPtr, int x, TkTextIndex *indexPtr);
@@ -585,7 +585,7 @@ static int DlineXOfIndex(TkText *textPtr,
DLine *dlPtr, int byteIndex);
static int TextGetScrollInfoObj(Tcl_Interp *interp,
TkText *textPtr, int objc,
- Tcl_Obj *CONST objv[], double *dblPtr,
+ Tcl_Obj *const objv[], double *dblPtr,
int *intPtr);
static void AsyncUpdateLineMetrics(ClientData clientData);
static void AsyncUpdateYScrollbar(ClientData clientData);
@@ -742,7 +742,7 @@ TkTextFreeDInfo(
static TextStyle *
GetStyle(
TkText *textPtr, /* Overall information about text widget. */
- CONST TkTextIndex *indexPtr)/* The character in the text for which display
+ const TkTextIndex *indexPtr)/* The character in the text for which display
* information is wanted. */
{
TkTextTag **tagPtrs;
@@ -1047,7 +1047,7 @@ FreeStyle(
static DLine *
LayoutDLine(
TkText *textPtr, /* Overall information about text widget. */
- CONST TkTextIndex *indexPtr)/* Beginning of display line. May not
+ const TkTextIndex *indexPtr)/* Beginning of display line. May not
* necessarily point to a character
* segment. */
{
@@ -3518,7 +3518,7 @@ TkTextFindDisplayLineEnd(
static int
CalculateDisplayLineHeight(
TkText *textPtr, /* Widget record for text widget. */
- CONST TkTextIndex *indexPtr,/* The index at the beginning of the display
+ const TkTextIndex *indexPtr,/* The index at the beginning of the display
* line of interest. */
int *byteCountPtr, /* NULL or used to return the number of byte
* indices on the given display line. */
@@ -3589,7 +3589,7 @@ CalculateDisplayLineHeight(
int
TkTextIndexYPixels(
TkText *textPtr, /* Widget record for text widget. */
- CONST TkTextIndex *indexPtr)/* The index of which we want the pixel
+ const TkTextIndex *indexPtr)/* The index of which we want the pixel
* distance from top of logical line to top of
* index. */
{
@@ -4510,8 +4510,8 @@ void
TkTextChanged(
TkSharedText *sharedTextPtr,/* Shared widget section, or NULL. */
TkText *textPtr, /* Widget record for text widget, or NULL. */
- CONST TkTextIndex*index1Ptr,/* Index of first character to redisplay. */
- CONST TkTextIndex*index2Ptr)/* Index of character just after last one to
+ const TkTextIndex*index1Ptr,/* Index of first character to redisplay. */
+ const TkTextIndex*index2Ptr)/* Index of character just after last one to
* redisplay. */
{
if (sharedTextPtr == NULL) {
@@ -4528,8 +4528,8 @@ TkTextChanged(
static void
TextChanged(
TkText *textPtr, /* Widget record for text widget, or NULL. */
- CONST TkTextIndex*index1Ptr,/* Index of first character to redisplay. */
- CONST TkTextIndex*index2Ptr)/* Index of character just after last one to
+ const TkTextIndex*index1Ptr,/* Index of first character to redisplay. */
+ const TkTextIndex*index2Ptr)/* Index of character just after last one to
* redisplay. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -5209,7 +5209,7 @@ TkTextMeasureDown(
static void
MeasureUp(
TkText *textPtr, /* Text widget in which to measure. */
- CONST TkTextIndex *srcPtr, /* Index of character from which to start
+ const TkTextIndex *srcPtr, /* Index of character from which to start
* measuring. */
int distance, /* Vertical distance in pixels measured from
* the pixel just below the lowest one in
@@ -5313,7 +5313,7 @@ TkTextSeeCmd(
TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
+ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "see". */
{
@@ -5442,7 +5442,7 @@ TkTextXviewCmd(
TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
+ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "xview". */
{
@@ -5725,7 +5725,7 @@ TkTextYviewCmd(
TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
+ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "yview". */
{
@@ -5751,7 +5751,7 @@ TkTextYviewCmd(
pickPlace = 0;
if (Tcl_GetString(objv[2])[0] == '-') {
- register CONST char *switchStr =
+ register const char *switchStr =
Tcl_GetStringFromObj(objv[2], &switchLength);
if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace",
@@ -5906,7 +5906,7 @@ TkTextScanCmd(
register TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
+ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "scan". */
{
@@ -6414,7 +6414,7 @@ static DLine *
FindDLine(
register DLine *dlPtr, /* Pointer to first in list of DLines to
* search. */
- CONST TkTextIndex *indexPtr)/* Index of desired character. */
+ const TkTextIndex *indexPtr)/* Index of desired character. */
{
TkTextLine *linePtr;
@@ -6784,7 +6784,7 @@ DlineXOfIndex(
int
TkTextIndexBbox(
TkText *textPtr, /* Widget record for text widget. */
- CONST TkTextIndex *indexPtr,/* Index whose bounding box is desired. */
+ const TkTextIndex *indexPtr,/* Index whose bounding box is desired. */
int *xPtr, int *yPtr, /* Filled with index's upper-left
* coordinate. */
int *widthPtr, int *heightPtr,
@@ -6914,7 +6914,7 @@ TkTextIndexBbox(
int
TkTextDLineInfo(
TkText *textPtr, /* Widget record for text widget. */
- CONST TkTextIndex *indexPtr,/* Index of character whose bounding box is
+ const TkTextIndex *indexPtr,/* Index of character whose bounding box is
* desired. */
int *xPtr, int *yPtr, /* Filled with line's upper-left
* coordinate. */
@@ -8054,7 +8054,7 @@ NextTabStop(
static int
MeasureChars(
Tk_Font tkfont, /* Font in which to draw characters. */
- CONST char *source, /* Characters to be displayed. Need not be
+ const char *source, /* Characters to be displayed. Need not be
* NULL-terminated. */
int maxBytes, /* Maximum # of bytes to consider from
* source. */
@@ -8069,7 +8069,7 @@ MeasureChars(
* here. */
{
int curX, width, ch;
- CONST char *special, *end, *start;
+ const char *special, *end, *start;
ch = 0; /* lint. */
curX = startX;
@@ -8161,19 +8161,19 @@ TextGetScrollInfoObj(
Tcl_Interp *interp, /* Used for error reporting. */
TkText *textPtr, /* Information about the text widget. */
int objc, /* # arguments for command. */
- Tcl_Obj *CONST objv[], /* Arguments for command. */
+ Tcl_Obj *const objv[], /* Arguments for command. */
double *dblPtr, /* Filled in with argument "moveto" option, if
* any. */
int *intPtr) /* Filled in with number of pages or lines or
* pixels to scroll, if any. */
{
- static CONST char *subcommands[] = {
+ static const char *subcommands[] = {
"moveto", "scroll", NULL
};
enum viewSubcmds {
VIEW_MOVETO, VIEW_SCROLL
};
- static CONST char *units[] = {
+ static const char *units[] = {
"units", "pages", "pixels", NULL
};
enum viewUnits {
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 4219feb..e1d58e8 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.28 2007/12/13 15:24:17 dgp Exp $
+ * RCS: @(#) $Id: tkTextIndex.c,v 1.29 2008/04/27 22:38:58 dkf Exp $
*/
#include "default.h"
@@ -35,12 +35,12 @@
* Forward declarations for functions defined later in this file:
*/
-static CONST char * ForwBack(TkText *textPtr, CONST char *string,
+static const char * ForwBack(TkText *textPtr, const char *string,
TkTextIndex *indexPtr);
-static CONST char * StartEnd(TkText *textPtr, CONST char *string,
+static const char * StartEnd(TkText *textPtr, const char *string,
TkTextIndex *indexPtr);
static int GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr,
- TkText *textPtr, CONST char *string,
+ TkText *textPtr, const char *string,
TkTextIndex *indexPtr, int *canCachePtr);
/*
@@ -63,7 +63,7 @@ static void UpdateStringOfTextIndex(Tcl_Obj *objPtr);
#define GET_INDEXEPOCH(objPtr) \
(PTR2INT((objPtr)->internalRep.twoPtrValue.ptr2))
#define SET_TEXTINDEX(objPtr, indexPtr) \
- ((objPtr)->internalRep.twoPtrValue.ptr1 = (VOID *) (indexPtr))
+ ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (indexPtr))
#define SET_INDEXEPOCH(objPtr, epoch) \
((objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(epoch))
@@ -131,7 +131,7 @@ UpdateStringOfTextIndex(
char buffer[TK_POS_CHARS];
register int len;
- CONST TkTextIndex *indexPtr = GET_TEXTINDEX(objPtr);
+ const TkTextIndex *indexPtr = GET_TEXTINDEX(objPtr);
len = TkTextPrintIndex(indexPtr->textPtr, indexPtr, buffer);
@@ -181,7 +181,7 @@ MakeObjIndex(
TkText *textPtr, /* Information about text widget. */
Tcl_Obj *objPtr, /* Object containing description of
* position. */
- CONST TkTextIndex *origPtr) /* Pointer to index. */
+ const TkTextIndex *origPtr) /* Pointer to index. */
{
TkTextIndex *indexPtr = (TkTextIndex *) ckalloc(sizeof(TkTextIndex));
@@ -201,7 +201,7 @@ MakeObjIndex(
return indexPtr;
}
-CONST TkTextIndex *
+const TkTextIndex *
TkTextGetIndexFromObj(
Tcl_Interp *interp, /* Use this for error reporting. */
TkText *textPtr, /* Information about text widget. */
@@ -269,7 +269,7 @@ TkTextGetIndexFromObj(
Tcl_Obj *
TkTextNewIndexObj(
TkText *textPtr, /* Text widget for this index */
- CONST TkTextIndex *indexPtr)/* Pointer to index. */
+ const TkTextIndex *indexPtr)/* Pointer to index. */
{
Tcl_Obj *retVal;
@@ -385,7 +385,7 @@ TkTextIndex *
TkTextMakeByteIndex(
TkTextBTree tree, /* Tree that lineIndex and byteIndex refer
* to. */
- CONST TkText *textPtr,
+ const TkText *textPtr,
int lineIndex, /* Index of desired line (0 means first line
* of text). */
int byteIndex, /* Byte index of desired character. */
@@ -393,7 +393,7 @@ TkTextMakeByteIndex(
{
TkTextSegment *segPtr;
int index;
- CONST char *p, *start;
+ const char *p, *start;
Tcl_UniChar ch;
indexPtr->tree = tree;
@@ -437,7 +437,7 @@ TkTextMakeByteIndex(
if ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType)) {
/*
* Prevent UTF-8 character from being split up by ensuring
- * that byteIndex falls on a character boundary. If index
+ * that byteIndex falls on a character boundary. If the index
* falls in the middle of a UTF-8 character, it will be
* adjusted to the end of that UTF-8 character.
*/
@@ -571,7 +571,7 @@ TkTextMakeCharIndex(
TkTextSegment *
TkTextIndexToSeg(
- CONST TkTextIndex *indexPtr,/* Text index. */
+ const TkTextIndex *indexPtr,/* Text index. */
int *offsetPtr) /* Where to store offset within segment, or
* NULL if offset isn't wanted. */
{
@@ -609,10 +609,10 @@ TkTextIndexToSeg(
int
TkTextSegToOffset(
- CONST TkTextSegment *segPtr,/* Segment whose offset is desired. */
- CONST TkTextLine *linePtr) /* Line containing segPtr. */
+ const TkTextSegment *segPtr,/* Segment whose offset is desired. */
+ const TkTextLine *linePtr) /* Line containing segPtr. */
{
- CONST TkTextSegment *segPtr2;
+ const TkTextSegment *segPtr2;
int offset = 0;
for (segPtr2 = linePtr->segPtr; segPtr2 != segPtr;
@@ -703,7 +703,7 @@ int
TkTextGetIndex(
Tcl_Interp *interp, /* Use this for error reporting. */
TkText *textPtr, /* Information about text widget. */
- CONST char *string, /* Textual description of position. */
+ const char *string, /* Textual description of position. */
TkTextIndex *indexPtr) /* Index structure to fill in. */
{
return GetIndex(interp, NULL, textPtr, string, indexPtr, NULL);
@@ -737,7 +737,7 @@ GetIndex(
Tcl_Interp *interp, /* Use this for error reporting. */
TkSharedText *sharedPtr,
TkText *textPtr, /* Information about text widget. */
- CONST char *string, /* Textual description of position. */
+ const char *string, /* Textual description of position. */
TkTextIndex *indexPtr, /* Index structure to fill in. */
int *canCachePtr) /* Pointer to integer to store whether we can
* cache the index (or NULL). */
@@ -746,7 +746,7 @@ GetIndex(
TkTextIndex first, last;
int wantLast, result;
char c;
- CONST char *cp;
+ const char *cp;
Tcl_DString copy;
int canCache = 0;
@@ -788,7 +788,7 @@ GetIndex(
TkTextSearch search;
TkTextTag *tagPtr;
Tcl_HashEntry *hPtr = NULL;
- CONST char *tagName;
+ const char *tagName;
if ((p[1] == 'f') && (strncmp(p+1, "first", 5) == 0)) {
wantLast = 0;
@@ -813,7 +813,7 @@ GetIndex(
hPtr = Tcl_FindHashEntry(&sharedPtr->tagTable, tagName);
*p = '.';
if (hPtr != NULL) {
- tagPtr = (TkTextTag *) Tcl_GetHashValue(hPtr);
+ tagPtr = Tcl_GetHashValue(hPtr);
}
}
@@ -1022,8 +1022,8 @@ GetIndex(
int
TkTextPrintIndex(
- CONST TkText *textPtr,
- CONST TkTextIndex *indexPtr,/* Pointer to index. */
+ const TkText *textPtr,
+ const TkTextIndex *indexPtr,/* Pointer to index. */
char *string) /* Place to store the position. Must have at
* least TK_POS_CHARS characters. */
{
@@ -1086,8 +1086,8 @@ TkTextPrintIndex(
int
TkTextIndexCmp(
- CONST TkTextIndex*index1Ptr,/* First index. */
- CONST TkTextIndex*index2Ptr)/* Second index. */
+ const TkTextIndex*index1Ptr,/* First index. */
+ const TkTextIndex*index2Ptr)/* Second index. */
{
int line1, line2;
@@ -1139,15 +1139,15 @@ TkTextIndexCmp(
*---------------------------------------------------------------------------
*/
-static CONST char *
+static const char *
ForwBack(
TkText *textPtr, /* Information about text widget. */
- CONST char *string, /* String to parse for additional info about
+ const char *string, /* String to parse for additional info about
* modifier (count and units). Points to "+"
* or "-" that starts modifier. */
TkTextIndex *indexPtr) /* Index to update as specified in string. */
{
- register CONST char *p, *units;
+ register const char *p, *units;
char *end;
int count, lineIndex, modifier;
size_t length;
@@ -1387,8 +1387,8 @@ ForwBack(
int
TkTextIndexForwBytes(
- CONST TkText *textPtr,
- CONST TkTextIndex *srcPtr, /* Source index. */
+ const TkText *textPtr,
+ const TkTextIndex *srcPtr, /* Source index. */
int byteCount, /* How many bytes forward to move. May be
* negative. */
TkTextIndex *dstPtr) /* Destination index: gets modified. */
@@ -1459,8 +1459,8 @@ TkTextIndexForwBytes(
void
TkTextIndexForwChars(
- CONST TkText *textPtr, /* Overall information about text widget. */
- CONST TkTextIndex *srcPtr, /* Source index. */
+ const TkText *textPtr, /* Overall information about text widget. */
+ const TkTextIndex *srcPtr, /* Source index. */
int charCount, /* How many characters forward to move. May
* be negative. */
TkTextIndex *dstPtr, /* Destination index: gets modified. */
@@ -1480,8 +1480,7 @@ TkTextIndexForwChars(
return;
}
if (checkElided) {
- infoPtr = (TkTextElideInfo *)
- ckalloc((unsigned) sizeof(TkTextElideInfo));
+ infoPtr = (TkTextElideInfo *) ckalloc(sizeof(TkTextElideInfo));
elide = TkTextIsElided(textPtr, srcPtr, infoPtr);
}
@@ -1639,11 +1638,11 @@ TkTextIndexForwChars(
int
TkTextIndexCount(
- CONST TkText *textPtr, /* Overall information about text widget. */
- CONST TkTextIndex *indexPtr1,
+ const TkText *textPtr, /* Overall information about text widget. */
+ const TkTextIndex *indexPtr1,
/* Index describing location of character from
* which to count. */
- CONST TkTextIndex *indexPtr2,
+ const TkTextIndex *indexPtr2,
/* Index describing location of last character
* at which to stop the count. */
TkTextCountType type) /* The kind of indices to count. */
@@ -1665,8 +1664,7 @@ TkTextIndexCount(
seg2Ptr = TkTextIndexToSeg(indexPtr2, &maxBytes);
if (checkElided) {
- infoPtr = (TkTextElideInfo *)
- ckalloc((unsigned) sizeof(TkTextElideInfo));
+ infoPtr = (TkTextElideInfo *) ckalloc(sizeof(TkTextElideInfo));
elide = TkTextIsElided(textPtr, indexPtr1, infoPtr);
}
@@ -1835,8 +1833,8 @@ TkTextIndexCount(
int
TkTextIndexBackBytes(
- CONST TkText *textPtr,
- CONST TkTextIndex *srcPtr, /* Source index. */
+ const TkText *textPtr,
+ const TkTextIndex *srcPtr, /* Source index. */
int byteCount, /* How many bytes backward to move. May be
* negative. */
TkTextIndex *dstPtr) /* Destination index: gets modified. */
@@ -1905,8 +1903,8 @@ TkTextIndexBackBytes(
void
TkTextIndexBackChars(
- CONST TkText *textPtr, /* Overall information about text widget. */
- CONST TkTextIndex *srcPtr, /* Source index. */
+ const TkText *textPtr, /* Overall information about text widget. */
+ const TkTextIndex *srcPtr, /* Source index. */
int charCount, /* How many characters backward to move. May
* be negative. */
TkTextIndex *dstPtr, /* Destination index: gets modified. */
@@ -1915,7 +1913,7 @@ TkTextIndexBackChars(
TkTextSegment *segPtr, *oldPtr;
TkTextElideInfo *infoPtr = NULL;
int lineIndex, segSize;
- CONST char *p, *start, *end;
+ const char *p, *start, *end;
int elide = 0;
int checkElided = (type & COUNT_DISPLAY);
@@ -2114,15 +2112,15 @@ TkTextIndexBackChars(
*----------------------------------------------------------------------
*/
-static CONST char *
+static const char *
StartEnd(
TkText *textPtr, /* Information about text widget. */
- CONST char *string, /* String to parse for additional info about
+ const char *string, /* String to parse for additional info about
* modifier (count and units). Points to first
* character of modifer word. */
TkTextIndex *indexPtr) /* Index to modify based on string. */
{
- CONST char *p;
+ const char *p;
size_t length;
register TkTextSegment *segPtr;
int modifier;
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index 97929bd..b54ae3f 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.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: tkTextTag.c,v 1.27 2007/12/13 15:24:17 dgp Exp $
+ * RCS: @(#) $Id: tkTextTag.c,v 1.28 2008/04/27 22:38:58 dkf Exp $
*/
#include "default.h"
@@ -101,7 +101,7 @@ static void ChangeTagPriority(TkText *textPtr, TkTextTag *tagPtr,
static TkTextTag * FindTag(Tcl_Interp *interp, TkText *textPtr,
Tcl_Obj *tagName);
static void SortTags(int numTags, TkTextTag **tagArrayPtr);
-static int TagSortProc(CONST VOID *first, CONST VOID *second);
+static int TagSortProc(const void *first, const void *second);
static void TagBindEvent(TkText *textPtr, XEvent *eventPtr,
int numTags, TkTextTag **tagArrayPtr);
@@ -128,11 +128,11 @@ TkTextTagCmd(
register TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
+ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "tag". */
{
- static CONST char *tagOptionStrings[] = {
+ static const char *tagOptionStrings[] = {
"add", "bind", "cget", "configure", "delete", "lower", "names",
"nextrange", "prevrange", "raise", "ranges", "remove", NULL
};
@@ -225,7 +225,7 @@ TkTextTagCmd(
if (addTag && textPtr->exportSelection
&& !(textPtr->flags & GOT_SELECTION)) {
Tk_OwnSelection(textPtr->tkwin, XA_PRIMARY,
- TkTextLostSelection, (ClientData) textPtr);
+ TkTextLostSelection, textPtr);
textPtr->flags |= GOT_SELECTION;
}
textPtr->abortSelections = 1;
@@ -285,13 +285,13 @@ TkTextTagCmd(
return TCL_ERROR;
}
} else if (objc == 5) {
- CONST char *command;
+ const char *command;
command = Tk_GetBinding(interp,
textPtr->sharedTextPtr->bindingTable,
(ClientData) tagPtr->name, Tcl_GetString(objv[4]));
if (command == NULL) {
- CONST char *string = Tcl_GetStringResult(interp);
+ const char *string = Tcl_GetStringResult(interp);
/*
* Ignore missing binding errors. This is a special hack that
@@ -541,7 +541,7 @@ TkTextTagCmd(
continue;
}
- tagPtr = (TkTextTag *) Tcl_GetHashValue(hPtr);
+ tagPtr = Tcl_GetHashValue(hPtr);
if (tagPtr == textPtr->selTagPtr) {
continue;
}
@@ -607,7 +607,7 @@ TkTextTagCmd(
for (i=0, hPtr = Tcl_FirstHashEntry(
&textPtr->sharedTextPtr->tagTable, &search);
hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) {
- arrayPtr[i] = (TkTextTag *) Tcl_GetHashValue(hPtr);
+ arrayPtr[i] = Tcl_GetHashValue(hPtr);
}
/*
@@ -928,14 +928,14 @@ TkTextTagCmd(
TkTextTag *
TkTextCreateTag(
TkText *textPtr, /* Widget in which tag is being used. */
- CONST char *tagName, /* Name of desired tag. */
+ const char *tagName, /* Name of desired tag. */
int *newTag) /* If non-NULL, then return 1 if new, or 0 if
* already exists. */
{
register TkTextTag *tagPtr;
Tcl_HashEntry *hPtr = NULL;
int isNew;
- CONST char *name;
+ const char *name;
if (!strcmp(tagName, "sel")) {
if (textPtr->selTagPtr != NULL) {
@@ -955,7 +955,7 @@ TkTextCreateTag(
*newTag = isNew;
}
if (!isNew) {
- return (TkTextTag *) Tcl_GetHashValue(hPtr);
+ return Tcl_GetHashValue(hPtr);
}
name = Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr);
}
@@ -1048,7 +1048,7 @@ FindTag(
{
Tcl_HashEntry *hPtr;
int len;
- CONST char *str;
+ const char *str;
str = Tcl_GetStringFromObj(tagName, &len);
if (len == 3 && !strcmp(str,"sel")) {
@@ -1057,7 +1057,7 @@ FindTag(
hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable,
Tcl_GetString(tagName));
if (hPtr != NULL) {
- return (TkTextTag *) Tcl_GetHashValue(hPtr);
+ return Tcl_GetHashValue(hPtr);
}
if (interp != NULL) {
Tcl_AppendResult(interp, "tag \"", Tcl_GetString(tagName),
@@ -1279,8 +1279,8 @@ SortTags(
static int
TagSortProc(
- CONST void *first,
- CONST void *second) /* Elements to be compared. */
+ const void *first,
+ const void *second) /* Elements to be compared. */
{
TkTextTag *tagPtr1, *tagPtr2;
@@ -1349,7 +1349,7 @@ ChangeTagPriority(
}
for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->tagTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- tagPtr2 = (TkTextTag *) Tcl_GetHashValue(hPtr);
+ tagPtr2 = Tcl_GetHashValue(hPtr);
if ((tagPtr2->priority >= low) && (tagPtr2->priority <= high)) {
tagPtr2->priority += delta;
}
@@ -1380,7 +1380,7 @@ TkTextBindProc(
ClientData clientData, /* Pointer to canvas structure. */
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
- TkText *textPtr = (TkText *) clientData;
+ TkText *textPtr = clientData;
int repick = 0;
# define AnyButtonMask \
@@ -1687,8 +1687,8 @@ TagBindEvent(
TkTextTag **tagArrayPtr) /* Array of relevant tags. */
{
#define NUM_BIND_TAGS 10
- CONST char *nameArray[NUM_BIND_TAGS];
- CONST char **nameArrPtr;
+ const char *nameArray[NUM_BIND_TAGS];
+ const char **nameArrPtr;
int i;
/*
@@ -1696,7 +1696,7 @@ TagBindEvent(
*/
if (numTags > NUM_BIND_TAGS) {
- nameArrPtr = (CONST char **) ckalloc(numTags * sizeof(CONST char *));
+ nameArrPtr = (const char **) ckalloc(numTags * sizeof(const char *));
} else {
nameArrPtr = nameArray;
}
diff --git a/generic/tkVisual.c b/generic/tkVisual.c
index 1b880d1..e0e100a 100644
--- a/generic/tkVisual.c
+++ b/generic/tkVisual.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkVisual.c,v 1.10 2007/12/13 15:24:21 dgp Exp $
+ * RCS: @(#) $Id: tkVisual.c,v 1.11 2008/04/27 22:38:58 dkf Exp $
*/
#include "tkInt.h"
@@ -88,7 +88,7 @@ Visual *
Tk_GetVisual(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
Tk_Window tkwin, /* Window in which visual will be used. */
- CONST char *string, /* String describing visual. See manual entry
+ const char *string, /* String describing visual. See manual entry
* for details. */
int *depthPtr, /* The depth of the returned visual is stored
* here. */
@@ -103,7 +103,7 @@ Tk_GetVisual(
Visual *visual;
ptrdiff_t length;
int c, numVisuals, prio, bestPrio, i;
- CONST char *p;
+ const char *p;
VisualDictionary *dictPtr;
TkColormap *cmapPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -368,7 +368,7 @@ Colormap
Tk_GetColormap(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
Tk_Window tkwin, /* Window where colormap will be used. */
- CONST char *string) /* String that identifies colormap: either
+ const char *string) /* String that identifies colormap: either
* "new" or the name of another window. */
{
Colormap colormap;
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index c73b950..8820c73 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWindow.c,v 1.94 2008/04/16 14:51:29 das Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.95 2008/04/27 22:38:58 dkf Exp $
*/
#include "tkInt.h"
@@ -242,14 +242,14 @@ static Tk_ArgvInfo argTable[] = {
*/
static Tk_Window CreateTopLevelWindow(Tcl_Interp *interp,
- Tk_Window parent, CONST char *name,
- CONST char *screenName, unsigned int flags);
+ Tk_Window parent, const char *name,
+ const char *screenName, unsigned int flags);
static void DeleteWindowsExitProc(ClientData clientData);
-static TkDisplay * GetScreen(Tcl_Interp *interp, CONST char *screenName,
+static TkDisplay * GetScreen(Tcl_Interp *interp, const char *screenName,
int *screenPtr);
static int Initialize(Tcl_Interp *interp);
static int NameWindow(Tcl_Interp *interp, TkWindow *winPtr,
- TkWindow *parentPtr, CONST char *name);
+ TkWindow *parentPtr, const char *name);
static void UnlinkWindow(TkWindow *winPtr);
/*
@@ -342,9 +342,9 @@ CreateTopLevelWindow(
Tk_Window parent, /* Token for logical parent of new window
* (used for naming, options, etc.). May be
* NULL. */
- CONST char *name, /* Name for new window; if parent is non-NULL,
+ const char *name, /* Name for new window; if parent is non-NULL,
* must be unique among parent's children. */
- CONST char *screenName, /* Name of screen on which to create window.
+ const char *screenName, /* Name of screen on which to create window.
* NULL means use DISPLAY environment variable
* to determine. Empty string means use
* parent's screen, or DISPLAY if no
@@ -354,7 +354,7 @@ CreateTopLevelWindow(
register TkWindow *winPtr;
register TkDisplay *dispPtr;
int screenId;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
@@ -446,15 +446,15 @@ CreateTopLevelWindow(
static TkDisplay *
GetScreen(
Tcl_Interp *interp, /* Place to leave error message. */
- CONST char *screenName, /* Name for screen. NULL or empty means use
+ const char *screenName, /* Name for screen. NULL or empty means use
* DISPLAY envariable. */
int *screenPtr) /* Where to store screen number. */
{
register TkDisplay *dispPtr;
- CONST char *p;
+ const char *p;
int screenId;
size_t length;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -564,7 +564,7 @@ TkGetDisplay(
Display *display) /* X's display pointer */
{
TkDisplay *dispPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (dispPtr = tsdPtr->displayList; dispPtr != NULL;
@@ -597,7 +597,7 @@ TkGetDisplay(
TkDisplay *
TkGetDisplayList(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return tsdPtr->displayList;
@@ -624,7 +624,7 @@ TkGetDisplayList(void)
TkMainInfo *
TkGetMainInfoList(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return tsdPtr->mainWindowList;
@@ -736,7 +736,7 @@ NameWindow(
register TkWindow *winPtr, /* Window that is to be named and inserted. */
TkWindow *parentPtr, /* Pointer to logical parent for winPtr (used
* for naming, options, etc.). */
- CONST char *name) /* Name for winPtr; must be unique among
+ const char *name) /* Name for winPtr; must be unique among
* parentPtr's children. */
{
#define FIXED_SIZE 200
@@ -853,7 +853,7 @@ NameWindow(
Tk_Window
TkCreateMainWindow(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
- CONST char *screenName, /* Name of screen on which to create window.
+ const char *screenName, /* Name of screen on which to create window.
* Empty or NULL string means use DISPLAY
* environment variable. */
char *baseName) /* Base name for application; usually of the
@@ -866,7 +866,7 @@ TkCreateMainWindow(
register TkWindow *winPtr;
register TkCmd *cmdPtr;
ClientData clientData;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -952,13 +952,13 @@ TkCreateMainWindow(
Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs");
}
if (cmdPtr->passMainWindow) {
- clientData = (ClientData) tkwin;
+ clientData = tkwin;
} else {
- clientData = (ClientData) NULL;
+ clientData = NULL;
}
if (cmdPtr->cmdProc != NULL) {
Tcl_CreateCommand(interp, cmdPtr->name, cmdPtr->cmdProc,
- clientData, (void (*) _ANSI_ARGS_((ClientData))) NULL);
+ clientData, NULL);
} else {
Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc,
clientData, NULL);
@@ -1011,9 +1011,9 @@ Tk_CreateWindow(
* the interp's result is assumed to be
* initialized by the caller. */
Tk_Window parent, /* Token for parent of new window. */
- CONST char *name, /* Name for new window. Must be unique among
+ const char *name, /* Name for new window. Must be unique among
* parent's children. */
- CONST char *screenName) /* If NULL, new window will be internal on
+ const char *screenName) /* If NULL, new window will be internal on
* same screen as its parent. If non-NULL,
* gives name of screen on which to create new
* window; window will be a top-level
@@ -1075,7 +1075,7 @@ Tk_CreateAnonymousWindow(
* the interp's result is assumed to be
* initialized by the caller. */
Tk_Window parent, /* Token for parent of new window. */
- CONST char *screenName) /* If NULL, new window will be internal on
+ const char *screenName) /* If NULL, new window will be internal on
* same screen as its parent. If non-NULL,
* gives name of screen on which to create new
* window; window will be a top-level
@@ -1142,11 +1142,11 @@ Tk_CreateWindowFromPath(
* initialized by the caller. */
Tk_Window tkwin, /* Token for any window in application that is
* to contain new window. */
- CONST char *pathName, /* Path name for new window within the
+ const char *pathName, /* Path name for new window within the
* application of tkwin. The parent of this
* window must already exist, but the window
* itself must not exist. */
- CONST char *screenName) /* If NULL, new window will be on same screen
+ const char *screenName) /* If NULL, new window will be on same screen
* as its parent. If non-NULL, gives name of
* screen on which to create new window;
* window will be a top-level window. */
@@ -1257,7 +1257,7 @@ Tk_DestroyWindow(
TkDisplay *dispPtr = winPtr->dispPtr;
XEvent event;
TkHalfdeadWindow *halfdeadPtr, *prev_halfdeadPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_ALREADY_DEAD) {
@@ -1485,7 +1485,7 @@ Tk_DestroyWindow(
if (winPtr->mainPtr != NULL) {
if (winPtr->pathName != NULL) {
Tk_DeleteAllBindings(winPtr->mainPtr->bindingTable,
- (ClientData) winPtr->pathName);
+ winPtr->pathName);
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&winPtr->mainPtr->nameTable,
winPtr->pathName));
@@ -1607,7 +1607,7 @@ Tk_DestroyWindow(
#endif
}
}
- Tcl_EventuallyFree((ClientData) winPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(winPtr, TCL_DYNAMIC);
}
/*
@@ -2235,7 +2235,7 @@ TkDoConfigureNotify(
void
Tk_SetClass(
Tk_Window tkwin, /* Token for window to assign class. */
- CONST char *className) /* New class for tkwin. */
+ const char *className) /* New class for tkwin. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
@@ -2299,7 +2299,7 @@ Tk_SetClassProcs(
Tk_Window
Tk_NameToWindow(
Tcl_Interp *interp, /* Where to report errors. */
- CONST char *pathName, /* Path name of window. */
+ const char *pathName, /* Path name of window. */
Tk_Window tkwin) /* Token for window: name is assumed to belong
* to the same main window as tkwin. */
{
@@ -2326,7 +2326,7 @@ Tk_NameToWindow(
}
return NULL;
}
- return (Tk_Window) Tcl_GetHashValue(hPtr);
+ return Tcl_GetHashValue(hPtr);
}
/*
@@ -2369,7 +2369,7 @@ Tk_IdToWindow(
if (hPtr == NULL) {
return NULL;
}
- return (Tk_Window) Tcl_GetHashValue(hPtr);
+ return Tcl_GetHashValue(hPtr);
}
/*
@@ -2389,7 +2389,7 @@ Tk_IdToWindow(
*----------------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_DisplayName(
Tk_Window tkwin) /* Window whose display name is desired. */
{
@@ -2628,8 +2628,7 @@ Tk_MainWindow(
return NULL;
}
#endif
- tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (mainPtr = tsdPtr->mainWindowList; mainPtr != NULL;
mainPtr = mainPtr->nextPtr) {
@@ -2697,8 +2696,7 @@ Tk_GetNumMainWindows(void)
}
#endif
- tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return tsdPtr->numMainWindows;
}
@@ -2756,7 +2754,7 @@ DeleteWindowsExitProc(
{
TkDisplay *dispPtr, *nextPtr;
Tcl_Interp *interp;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
+ ThreadSpecificData *tsdPtr = clientData;
if (tsdPtr == NULL) {
return;
@@ -2772,11 +2770,11 @@ DeleteWindowsExitProc(
while (tsdPtr->halfdeadWindowList != NULL) {
interp = tsdPtr->halfdeadWindowList->winPtr->mainPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
tsdPtr->halfdeadWindowList->flags |= HD_CLEANUP;
tsdPtr->halfdeadWindowList->winPtr->flags &= ~TK_ALREADY_DEAD;
Tk_DestroyWindow((Tk_Window) tsdPtr->halfdeadWindowList->winPtr);
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
/*
@@ -2785,9 +2783,9 @@ DeleteWindowsExitProc(
while (tsdPtr->mainWindowList != NULL) {
interp = tsdPtr->mainWindowList->interp;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
Tk_DestroyWindow((Tk_Window) tsdPtr->mainWindowList->winPtr);
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
/*
@@ -2937,9 +2935,9 @@ Initialize(
{
char *p;
int argc, code;
- CONST char **argv;
+ const char **argv;
char *args[20];
- CONST char *argString = NULL;
+ const char *argString = NULL;
Tcl_DString class;
ThreadSpecificData *tsdPtr;
@@ -2958,8 +2956,7 @@ Initialize(
TkRegisterObjTypes();
- tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Start by initializing all the static variables to default acceptable
@@ -2979,7 +2976,7 @@ Initialize(
argv = NULL;
/*
- * We start by resetting the result because it might not be clean
+ * We start by resetting the result because it might not be clean.
*/
Tcl_ResetResult(interp);
@@ -3155,7 +3152,7 @@ Initialize(
visual = NULL;
}
args[argc] = NULL;
- code = TkCreateFrame((ClientData) NULL, interp, argc, args, 1, name);
+ code = TkCreateFrame(NULL, interp, argc, args, 1, name);
Tcl_DStringFree(&class);
if (code != TCL_OK) {
@@ -3253,7 +3250,7 @@ tkInit");
* specific cleanups take place to avoid panics in finalization.
*/
- TkCreateThreadExitHandler(DeleteWindowsExitProc, (ClientData) tsdPtr);
+ TkCreateThreadExitHandler(DeleteWindowsExitProc, tsdPtr);
}
return code;
@@ -3284,16 +3281,16 @@ tkInit");
*----------------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_PkgInitStubsCheck(
Tcl_Interp *interp,
- CONST char * version,
+ const char * version,
int exact)
{
- CONST char *actualVersion = Tcl_PkgRequire(interp, "Tk", version, 0);
+ const char *actualVersion = Tcl_PkgRequire(interp, "Tk", version, 0);
if (exact && actualVersion) {
- CONST char *p = version;
+ const char *p = version;
int count = 0;
while (*p) {
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index bae3e6a..4d1adcd 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -1,4 +1,4 @@
-/* $Id: ttkButton.c,v 1.8 2007/12/13 15:26:24 dgp Exp $
+/* $Id: ttkButton.c,v 1.9 2008/04/27 22:41:12 dkf Exp $
* Copyright (c) 2003, Joe English
*
* label, button, checkbutton, radiobutton, and menubutton widgets.
@@ -519,7 +519,7 @@ CheckbuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
*/
static int
CheckbuttonInvokeCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Checkbutton *checkPtr = recordPtr;
WidgetCore *corePtr = &checkPtr->core;
@@ -705,7 +705,7 @@ RadiobuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
*/
static int
RadiobuttonInvokeCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Radiobutton *radioPtr = recordPtr;
WidgetCore *corePtr = &radioPtr->core;
diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c
index 3dcb379..8c50485 100644
--- a/generic/ttk/ttkImage.c
+++ b/generic/ttk/ttkImage.c
@@ -1,4 +1,4 @@
-/* $Id: ttkImage.c,v 1.7 2007/12/13 15:26:26 dgp Exp $
+/* $Id: ttkImage.c,v 1.8 2008/04/27 22:41:12 dkf Exp $
* Image specifications and image element factory.
*
* Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net>
@@ -312,7 +312,7 @@ Ttk_CreateImageElement(
void *clientData,
Ttk_Theme theme,
const char *elementName,
- int objc, Tcl_Obj *CONST objv[])
+ int objc, Tcl_Obj *const objv[])
{
const char *optionStrings[] =
{ "-border","-height","-padding","-sticky","-width",NULL };
diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c
index c0d930a..76d1768 100644
--- a/generic/ttk/ttkInit.c
+++ b/generic/ttk/ttkInit.c
@@ -1,4 +1,4 @@
-/* $Id: ttkInit.c,v 1.7 2007/12/13 15:26:26 dgp Exp $
+/* $Id: ttkInit.c,v 1.8 2008/04/27 22:41:12 dkf Exp $
* Copyright (c) 2003, Joe English
*
* Ttk package: initialization routine and miscellaneous utilities.
@@ -46,7 +46,7 @@ int Ttk_GetCompoundFromObj(
* Legal values for the -orient option.
* See also: enum Ttk_Orient.
*/
-CONST char *ttkOrientStrings[] = {
+const char *ttkOrientStrings[] = {
"horizontal", "vertical", NULL
};
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 68fd665..7b10300 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -1,4 +1,4 @@
-/* $Id: ttkNotebook.c,v 1.13 2008/01/28 00:36:08 jenglish Exp $
+/* $Id: ttkNotebook.c,v 1.14 2008/04/27 22:41:12 dkf Exp $
* Copyright (c) 2004, Joe English
*/
@@ -208,7 +208,7 @@ static void DestroyTab(Notebook *nb, Tab *tab)
static int ConfigureTab(
Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window slaveWindow,
- int objc, Tcl_Obj *CONST objv[])
+ int objc, Tcl_Obj *const objv[])
{
Ttk_Sticky sticky = tab->sticky;
Ttk_Padding padding = tab->padding;
@@ -854,7 +854,7 @@ static int GetTabIndex(
/* $nb add window ?options ... ?
*/
static int NotebookAddCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Notebook *nb = recordPtr;
int index = Ttk_NumberSlaves(nb->notebook.mgr);
@@ -968,7 +968,7 @@ static int NotebookInsertCommand(
* Removes the specified tab.
*/
static int NotebookForgetCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Notebook *nb = recordPtr;
int index;
@@ -992,7 +992,7 @@ static int NotebookForgetCommand(
* Hides the specified tab.
*/
static int NotebookHideCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Notebook *nb = recordPtr;
int index;
@@ -1022,7 +1022,7 @@ static int NotebookHideCommand(
* Returns name of tab element at $x,$y; empty string if none.
*/
static int NotebookIdentifyCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Notebook *nb = recordPtr;
Ttk_LayoutNode *node = NULL;
@@ -1065,7 +1065,7 @@ static int NotebookIdentifyCommand(
* See above for valid item formats.
*/
static int NotebookIndexCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Notebook *nb = recordPtr;
int index, status;
@@ -1097,7 +1097,7 @@ static int NotebookIndexCommand(
* the currently-selected pane.
*/
static int NotebookSelectCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Notebook *nb = recordPtr;
@@ -1123,7 +1123,7 @@ static int NotebookSelectCommand(
* Return list of tabs.
*/
static int NotebookTabsCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Notebook *nb = recordPtr;
Ttk_Manager *mgr = nb->notebook.mgr;
@@ -1148,7 +1148,7 @@ static int NotebookTabsCommand(
/* $nb tab $tab ?-option ?value -option value...??
*/
static int NotebookTabCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Notebook *nb = recordPtr;
Ttk_Manager *mgr = nb->notebook.mgr;
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
index cac3d20..bd9457c 100644
--- a/generic/ttk/ttkPanedwindow.c
+++ b/generic/ttk/ttkPanedwindow.c
@@ -1,4 +1,4 @@
-/* $Id: ttkPanedwindow.c,v 1.14 2008/02/23 17:35:28 jenglish Exp $
+/* $Id: ttkPanedwindow.c,v 1.15 2008/04/27 22:41:12 dkf Exp $
*
* Copyright (c) 2005, Joe English. Freely redistributable.
*
@@ -142,7 +142,7 @@ static void DestroyPane(Paned *pw, Pane *pane)
*/
static int ConfigurePane(
Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window slaveWindow,
- int objc, Tcl_Obj *CONST objv[])
+ int objc, Tcl_Obj *const objv[])
{
Ttk_Manager *mgr = pw->paned.mgr;
Tk_SavedOptions savedOptions;
@@ -615,7 +615,7 @@ static void PanedDisplay(void *recordPtr, Drawable d)
/* $pw add window [ options ... ]
*/
static int PanedAddCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Paned *pw = recordPtr;
Tk_Window slaveWindow;
@@ -640,7 +640,7 @@ static int PanedAddCommand(
* Insert new slave, or move existing one.
*/
static int PanedInsertCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Paned *pw = recordPtr;
int nSlaves = Ttk_NumberSlaves(pw->paned.mgr);
@@ -685,7 +685,7 @@ static int PanedInsertCommand(
/* $pw forget $pane
*/
static int PanedForgetCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Paned *pw = recordPtr;
int paneIndex;
@@ -709,7 +709,7 @@ static int PanedForgetCommand(
* Return index of sash at $x,$y
*/
static int PanedIdentifyCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Paned *pw = recordPtr;
int sashThickness = pw->paned.sashThickness;
@@ -743,7 +743,7 @@ static int PanedIdentifyCommand(
* Query/modify pane options.
*/
static int PanedPaneCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Paned *pw = recordPtr;
int paneIndex;
@@ -780,7 +780,7 @@ static int PanedPaneCommand(
* Return list of managed panes.
*/
static int PanedPanesCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Paned *pw = recordPtr;
Ttk_Manager *mgr = pw->paned.mgr;
@@ -807,7 +807,7 @@ static int PanedPanesCommand(
* Query or modify sash position.
*/
static int PanedSashposCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Paned *pw = recordPtr;
int sashIndex, position = -1;
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
index 6d6db8d..b5883e1 100644
--- a/generic/ttk/ttkProgress.c
+++ b/generic/ttk/ttkProgress.c
@@ -1,4 +1,4 @@
-/* $Id: ttkProgress.c,v 1.5 2007/01/11 14:49:47 jenglish Exp $
+/* $Id: ttkProgress.c,v 1.6 2008/04/27 22:41:12 dkf Exp $
*
* Copyright (c) Joe English, Pat Thoyts, Michael Kirkham
*
@@ -399,7 +399,7 @@ static Ttk_Layout ProgressbarGetLayout(
/* $sb step ?amount?
*/
static int ProgressbarStepCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Progressbar *pb = recordPtr;
double value = 0.0, stepAmount = 1.0;
@@ -453,7 +453,7 @@ static int ProgressbarStepCommand(
* and pass to interpreter.
*/
static int ProgressbarStartStopCommand(
- Tcl_Interp *interp, const char *cmdName, int objc, Tcl_Obj *CONST objv[])
+ Tcl_Interp *interp, const char *cmdName, int objc, Tcl_Obj *const objv[])
{
Tcl_Obj *cmd = Tcl_NewListObj(objc, objv);
Tcl_Obj *prefix[2];
@@ -473,14 +473,14 @@ static int ProgressbarStartStopCommand(
}
static int ProgressbarStartCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
return ProgressbarStartStopCommand(
interp, "::ttk::progressbar::start", objc, objv);
}
static int ProgressbarStopCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
return ProgressbarStartStopCommand(
interp, "::ttk::progressbar::stop", objc, objv);
diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c
index 4c8d1eb..68438a2 100644
--- a/generic/ttk/ttkScale.c
+++ b/generic/ttk/ttkScale.c
@@ -1,4 +1,4 @@
-/* $Id: ttkScale.c,v 1.7 2007/12/13 15:26:26 dgp Exp $
+/* $Id: ttkScale.c,v 1.8 2008/04/27 22:41:12 dkf Exp $
* Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* ttk::scale widget.
@@ -252,7 +252,7 @@ static double ScaleFraction(Scale *scalePtr, double value)
*/
static int
ScaleGetCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Scale *scalePtr = recordPtr;
int x, y, r = TCL_OK;
@@ -280,7 +280,7 @@ ScaleGetCommand(
*/
static int
ScaleSetCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Scale *scalePtr = recordPtr;
double from = 0.0, to = 1.0, value;
@@ -348,7 +348,7 @@ ScaleSetCommand(
static int
ScaleCoordsCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Scale *scalePtr = recordPtr;
double value;
diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c
index 82bb880..26656f2 100644
--- a/generic/ttk/ttkScrollbar.c
+++ b/generic/ttk/ttkScrollbar.c
@@ -1,4 +1,4 @@
-/* $Id: ttkScrollbar.c,v 1.7 2007/12/13 15:26:26 dgp Exp $
+/* $Id: ttkScrollbar.c,v 1.8 2008/04/27 22:41:12 dkf Exp $
* Copyright (c) 2003, Joe English
*
* ttk::scrollbar widget.
@@ -132,7 +132,7 @@ static void ScrollbarDoLayout(void *recordPtr)
*/
static int
ScrollbarSetCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Scrollbar *scrollbar = recordPtr;
Tcl_Obj *firstObj, *lastObj;
@@ -183,7 +183,7 @@ ScrollbarSetCommand(
*/
static int
ScrollbarGetCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Scrollbar *scrollbar = recordPtr;
Tcl_Obj *result[2];
@@ -206,7 +206,7 @@ ScrollbarGetCommand(
*/
static int
ScrollbarDeltaCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Scrollbar *sb = recordPtr;
double dx, dy;
@@ -246,7 +246,7 @@ ScrollbarDeltaCommand(
*/
static int
ScrollbarFractionCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
Scrollbar *sb = recordPtr;
Ttk_Box b = sb->scrollbar.troughBox;
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index 598bc34..3439ef0 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.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.
*
- * $Id: ttkTheme.c,v 1.11 2007/12/13 15:26:26 dgp Exp $
+ * $Id: ttkTheme.c,v 1.12 2008/04/27 22:41:12 dkf Exp $
*/
#include <stdlib.h>
@@ -18,7 +18,7 @@
#include "ttkThemeInt.h"
#ifdef NO_PRIVATE_HEADERS
-EXTERN CONST Tk_OptionSpec *TkGetOptionSpec (CONST char *name,
+EXTERN const Tk_OptionSpec *TkGetOptionSpec(const char *name,
Tk_OptionTable optionTable);
#else
#include <tkInt.h>
@@ -832,7 +832,7 @@ int Ttk_RegisterElementFactory(
static int Ttk_CloneElement(
Tcl_Interp *interp, void *clientData,
Ttk_Theme theme, const char *elementName,
- int objc, Tcl_Obj *CONST objv[])
+ int objc, Tcl_Obj *const objv[])
{
Ttk_Theme fromTheme;
ElementImpl *fromElement;
@@ -1183,7 +1183,7 @@ StyleMapCmd(
ClientData clientData, /* Master StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
- Tcl_Obj * CONST objv[]) /* Argument objects */
+ Tcl_Obj *const objv[]) /* Argument objects */
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
@@ -1247,7 +1247,7 @@ usage:
/* + style configure $style -option ?value...
*/
static int StyleConfigureCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
@@ -1302,7 +1302,7 @@ usage:
/* + style lookup $style -option ?statespec? ?defaultValue?
*/
static int StyleLookupCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
StylePackageData *pkgPtr = clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
@@ -1346,7 +1346,7 @@ static int StyleLookupCmd(
/* + style theme create name ?-parent $theme? ?-settings { script }?
*/
static int StyleThemeCreateCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
static const char *optStrings[] =
@@ -1410,7 +1410,7 @@ static int StyleThemeCreateCmd(
* Return list of registered themes.
*/
static int StyleThemeNamesCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
StylePackageData *pkgPtr = clientData;
return EnumerateHashTable(interp, &pkgPtr->themeTable);
@@ -1426,7 +1426,7 @@ StyleThemeSettingsCmd(
ClientData clientData, /* Master StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
- Tcl_Obj * CONST objv[]) /* Argument objects */
+ Tcl_Obj *const objv[]) /* Argument objects */
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme oldTheme = pkgPtr->currentTheme;
@@ -1452,7 +1452,7 @@ StyleThemeSettingsCmd(
/* + style element create name type ? ...args ?
*/
static int StyleElementCreateCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
@@ -1484,7 +1484,7 @@ static int StyleElementCreateCmd(
* Return a list of elements defined in the current theme.
*/
static int StyleElementNamesCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
@@ -1500,7 +1500,7 @@ static int StyleElementNamesCmd(
* Return list of element options for specified element
*/
static int StyleElementOptionsCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
StylePackageData *pkgPtr = clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
@@ -1536,7 +1536,7 @@ static int StyleElementOptionsCmd(
/* + style layout name ?spec?
*/
static int StyleLayoutCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
@@ -1576,7 +1576,7 @@ StyleThemeUseCmd(
ClientData clientData, /* Master StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
- Tcl_Obj * CONST objv[]) /* Argument objects */
+ Tcl_Obj *const objv[]) /* Argument objects */
{
StylePackageData *pkgPtr = clientData;
Ttk_Theme theme;
@@ -1635,7 +1635,7 @@ StyleObjCmd(
ClientData clientData, /* Master StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
- Tcl_Obj * CONST objv[]) /* Argument objects */
+ Tcl_Obj *const objv[]) /* Argument objects */
{
struct Ensemble *ensemble = StyleEnsemble;
int optPtr = 1;
diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c
index 37a319b..cb2f1c7 100644
--- a/generic/ttk/ttkTrace.c
+++ b/generic/ttk/ttkTrace.c
@@ -1,4 +1,4 @@
-/* $Id: ttkTrace.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $
+/* $Id: ttkTrace.c,v 1.2 2008/04/27 22:41:12 dkf Exp $
*
* Copyright 2003, Joe English
*
@@ -27,8 +27,8 @@ static char *
VarTraceProc(
ClientData clientData, /* Widget record pointer */
Tcl_Interp *interp, /* Interpreter containing variable. */
- CONST char *name1, /* (unused) */
- CONST char *name2, /* (unused) */
+ const char *name1, /* (unused) */
+ const char *name2, /* (unused) */
int flags) /* Information about what happened. */
{
Ttk_TraceHandle *tracePtr = clientData;
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index ad60f4b..95c9a99 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -1,4 +1,4 @@
-/* $Id: ttkTreeview.c,v 1.23 2007/12/13 15:26:26 dgp Exp $
+/* $Id: ttkTreeview.c,v 1.24 2008/04/27 22:41:12 dkf Exp $
* Copyright (c) 2004, Joe English
*
* ttk::treeview widget implementation.
@@ -2915,8 +2915,8 @@ static int TreeviewTagBindCommand(
Tcl_SetObjResult(interp, Tcl_NewStringObj(script,-1));
}
} else if (objc == 6) { /* $tv tag bind $tag $sequence $script */
- CONST char *sequence = Tcl_GetString(objv[4]);
- CONST char *script = Tcl_GetString(objv[5]);
+ const char *sequence = Tcl_GetString(objv[4]);
+ const char *script = Tcl_GetString(objv[5]);
unsigned long mask = Tk_CreateBinding(interp,
tv->tree.bindingTable, tag, sequence, script, 0);
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index ae00a32..43c6086 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -1,4 +1,4 @@
-/* $Id: ttkWidget.c,v 1.11 2008/01/06 22:35:41 jenglish Exp $
+/* $Id: ttkWidget.c,v 1.12 2008/04/27 22:41:12 dkf Exp $
* Copyright (c) 2003, Joe English
*
* Core widget utilities.
@@ -180,7 +180,7 @@ WidgetInstanceObjCmd(
ClientData clientData, /* Widget record pointer */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj * const objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
WidgetCore *corePtr = (WidgetCore *)clientData;
const WidgetCommandSpec *commands = corePtr->widgetSpec->commands;
@@ -345,7 +345,7 @@ static struct Tk_ClassProcs widgetClassProcs = {
* ClientData is a WidgetSpec *.
*/
int TtkWidgetConstructorObjCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+ ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
WidgetSpec *widgetSpec = (WidgetSpec *)clientData;
const char *className = widgetSpec->className;
@@ -594,7 +594,7 @@ int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr)
/* $w cget -option
*/
int TtkWidgetCgetCommand(
-Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr)
+Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
WidgetCore *corePtr = recordPtr;
Tcl_Obj *result;
@@ -614,7 +614,7 @@ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr)
/* $w configure ?-option ?value ....??
*/
int TtkWidgetConfigureCommand(
-Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
WidgetCore *corePtr = recordPtr;
Tcl_Obj *result;
@@ -679,7 +679,7 @@ Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
*/
int TtkWidgetStateCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
WidgetCore *corePtr = recordPtr;
Ttk_StateSpec spec;
@@ -719,7 +719,7 @@ int TtkWidgetStateCommand(
*/
int TtkWidgetInstateCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
WidgetCore *corePtr = recordPtr;
Ttk_State state = corePtr->state;
@@ -749,7 +749,7 @@ int TtkWidgetInstateCommand(
* Returns: name of element at $x, $y
*/
int TtkWidgetIdentifyCommand(
- Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr)
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
{
WidgetCore *corePtr = recordPtr;
Ttk_LayoutNode *node;
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c
index 7b66a38..74dadbd 100644
--- a/macosx/tkMacOSXBitmap.c
+++ b/macosx/tkMacOSXBitmap.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: tkMacOSXBitmap.c,v 1.7 2007/04/23 21:24:32 das Exp $
+ * RCS: @(#) $Id: tkMacOSXBitmap.c,v 1.8 2008/04/27 22:39:12 dkf Exp $
*/
#include "tkMacOSXInt.h"
@@ -137,7 +137,7 @@ TkpDefineNativeBitmaps(void)
Pixmap
TkpCreateNativeBitmap(
Display *display,
- CONST char *source) /* Info about the icon to build. */
+ const char *source) /* Info about the icon to build. */
{
Pixmap pix;
Rect destRect;
@@ -195,7 +195,7 @@ TkpCreateNativeBitmap(
Pixmap
TkpGetNativeAppBitmap(
Display *display, /* The display. */
- CONST char *name, /* The name of the bitmap. */
+ const char *name, /* The name of the bitmap. */
int *width, /* The width & height of the bitmap. */
int *height)
{
@@ -249,9 +249,9 @@ TkpGetNativeAppBitmap(
Str255 dummy;
/*
- * We need to first paint the background white. Also, for
- * some reason we *must* use GetCIcon instead of GetNamedResource
- * for PlotCIcon to work - so we use GetResInfo to get the id.
+ * We need to first paint the background white. Also, for some reason
+ * we *must* use GetCIcon instead of GetNamedResource for PlotCIcon to
+ * work - so we use GetResInfo to get the id.
*/
RGBForeColor(&white);
diff --git a/macosx/tkMacOSXConfig.c b/macosx/tkMacOSXConfig.c
index 197cfbe..f015ea5 100644
--- a/macosx/tkMacOSXConfig.c
+++ b/macosx/tkMacOSXConfig.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: tkMacOSXConfig.c,v 1.4 2007/04/23 21:24:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXConfig.c,v 1.5 2008/04/27 22:39:12 dkf Exp $
*/
#include "tkInt.h"
@@ -38,8 +38,8 @@
Tcl_Obj *
TkpGetSystemDefault(
Tk_Window tkwin, /* A window to use. */
- CONST char *dbName, /* The option database name. */
- CONST char *className) /* The name of the option class. */
+ const char *dbName, /* The option database name. */
+ const char *className) /* The name of the option class. */
{
return NULL;
}
diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c
index 64b967c..b2d9ba8 100644
--- a/macosx/tkMacOSXCursor.c
+++ b/macosx/tkMacOSXCursor.c
@@ -7,18 +7,18 @@
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXCursor.c,v 1.13 2007/12/13 15:27:08 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXCursor.c,v 1.14 2008/04/27 22:39:12 dkf Exp $
*/
#include "tkMacOSXPrivate.h"
/*
- * There are three different ways to set the cursor on the Mac.
- * The default theme cursors (listed in cursorNames below),
- * color resource cursors, & normal cursors.
+ * There are three different ways to set the cursor on the Mac. The default
+ * theme cursors (listed in cursorNames below), color resource cursors, &
+ * normal cursors.
*/
#define NONE -1 /* Hidden cursor */
@@ -28,17 +28,17 @@
#define NORMAL 3 /* Cursors of type CURS. */
/*
- * The following data structure contains the system specific data
- * necessary to control Windows cursors.
+ * The following data structure contains the system specific data necessary to
+ * control Windows cursors.
*/
typedef struct {
TkCursor info; /* Generic cursor info used by tkCursor.c */
- Handle macCursor; /* Resource containing Macintosh cursor.
- * For theme cursors, this is -1. */
- int type; /* Type of Mac cursor: for theme cursors
- * this is the theme cursor constant,
- * otherwise one of crsr or CURS */
+ Handle macCursor; /* Resource containing Macintosh cursor. For
+ * theme cursors, this is -1. */
+ int type; /* Type of Mac cursor: for theme cursors this
+ * is the theme cursor constant, otherwise one
+ * of crsr or CURS. */
int count; /* For animating cursors, the count for the
* cursor. */
} TkMacOSXCursor;
@@ -94,25 +94,23 @@ static struct CursorName animatedThemeCursorNames[] = {
* Declarations of static variables used in this file.
*/
-static TkMacOSXCursor * gCurrentCursor = NULL; /* A pointer to the current
- * cursor. */
-static int gResizeOverride = false; /* A boolean indicating whether
- * we should use the resize
- * cursor during installations. */
-static int gTkOwnsCursor = true; /* A boolean indicating whether
- * Tk owns the cursor. If not (for
- * instance, in the case where a Tk
- * window is embedded in another app's
- * window, and the cursor is out of
- * the tk window, we will not attempt
- * to adjust the cursor */
+static TkMacOSXCursor * gCurrentCursor = NULL;
+ /* A pointer to the current cursor. */
+static int gResizeOverride = false;
+ /* A boolean indicating whether we should use
+ * the resize cursor during installations. */
+static int gTkOwnsCursor = true;/* A boolean indicating whether Tk owns the
+ * cursor. If not (for instance, in the case
+ * where a Tk window is embedded in another
+ * app's window, and the cursor is out of the
+ * tk window, we will not attempt to adjust
+ * the cursor. */
/*
* Declarations of procedures local to this file
*/
static void FindCursorByName(TkMacOSXCursor *macCursorPtr, const char *string);
-
/*
*----------------------------------------------------------------------
@@ -120,10 +118,9 @@ static void FindCursorByName(TkMacOSXCursor *macCursorPtr, const char *string);
* FindCursorByName --
*
* Retrieve a system cursor by name, and fill the macCursorPtr
- * structure. If the cursor cannot be found, the macCursor field
- * will be NULL. The function first attempts to load a color
- * cursor. If that fails it will attempt to load a black & white
- * cursor.
+ * structure. If the cursor cannot be found, the macCursor field will be
+ * NULL. The function first attempts to load a color cursor. If that
+ * fails it will attempt to load a black & white cursor.
*
* Results:
* Fills the macCursorPtr record.
@@ -205,9 +202,9 @@ TkGetCursorByName(
macCursorPtr->info.cursor = (Tk_Cursor) macCursorPtr;
/*
- * To find a cursor we must first determine if it is one of the
- * builtin cursors or the standard arrow cursor. Otherwise, we
- * attempt to load the cursor as a named Mac resource.
+ * To find a cursor we must first determine if it is one of the builtin
+ * cursors or the standard arrow cursor. Otherwise, we attempt to load the
+ * cursor as a named Mac resource.
*/
if (strcmp(noneCursorName.name, string) == 0) {
@@ -225,11 +222,14 @@ TkGetCursorByName(
if (namePtr->name == NULL) {
for (namePtr = animatedThemeCursorNames;
namePtr->name != NULL; namePtr++) {
- int namelen = strlen (namePtr->name);
+ int namelen = strlen(namePtr->name);
+
if (strncmp(namePtr->name, string, namelen) == 0) {
const char *numPtr = string + namelen;
+
if (*numPtr) {
int result = Tcl_GetInt(NULL, numPtr, &count);
+
if (result != TCL_OK) {
continue;
}
@@ -251,9 +251,9 @@ TkGetCursorByName(
int argc;
/*
- * The user may be trying to specify an XCursor with fore
- * & back colors. We don't want this to be an error, so pick
- * off the first word, and try again.
+ * The user may be trying to specify an XCursor with fore & back
+ * colors. We don't want this to be an error, so pick off the
+ * first word, and try again.
*/
if (Tcl_SplitList(interp, string, &argc, &argv) == TCL_OK ) {
@@ -269,9 +269,8 @@ TkGetCursorByName(
ckfree((char *)macCursorPtr);
Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL);
return NULL;
- } else {
- return (TkCursor *) macCursorPtr;
}
+ return (TkCursor *) macCursorPtr;
}
/*
@@ -293,8 +292,8 @@ TkGetCursorByName(
TkCursor *
TkCreateCursorFromData(
Tk_Window tkwin, /* Window in which cursor will be used. */
- CONST char *source, /* Bitmap data for cursor shape. */
- CONST char *mask, /* Bitmap data for cursor mask. */
+ const char *source, /* Bitmap data for cursor shape. */
+ const char *mask, /* Bitmap data for cursor mask. */
int width, int height, /* Dimensions of cursor. */
int xHot, int yHot, /* Location of hot-spot in cursor. */
XColor fgColor, /* Foreground color for cursor. */
@@ -327,12 +326,12 @@ TkpFreeCursor(
TkMacOSXCursor *macCursorPtr = (TkMacOSXCursor *) cursorPtr;
switch (macCursorPtr->type) {
- case COLOR:
- DisposeCCursor((CCrsrHandle) macCursorPtr->macCursor);
- break;
- case NORMAL:
- ReleaseResource(macCursorPtr->macCursor);
- break;
+ case COLOR:
+ DisposeCCursor((CCrsrHandle) macCursorPtr->macCursor);
+ break;
+ case NORMAL:
+ ReleaseResource(macCursorPtr->macCursor);
+ break;
}
if (macCursorPtr == gCurrentCursor) {
@@ -345,9 +344,8 @@ TkpFreeCursor(
*
* TkMacOSXInstallCursor --
*
- * Installs either the current cursor as defined by TkpSetCursor
- * or a resize cursor as the cursor the Macintosh should currently
- * display.
+ * Installs either the current cursor as defined by TkpSetCursor or a
+ * resize cursor as the cursor the Macintosh should currently display.
*
* Results:
* None.
@@ -382,35 +380,35 @@ TkMacOSXInstallCursor(
SetThemeCursor(kThemeArrowCursor);
} else {
struct CursorName *namePtr;
+
switch (macCursorPtr->type) {
- case NONE:
- if (!cursorHidden) {
- cursorHidden = 1;
- HideCursor();
- }
- cursorNone = 1;
- break;
- case THEME:
- namePtr = (struct CursorName *) macCursorPtr->macCursor;
- SetThemeCursor(
- namePtr->id);
- break;
- case ANIMATED:
- namePtr = (struct CursorName *) macCursorPtr->macCursor;
- if (macCursorPtr->count == -1) {
- SetAnimatedThemeCursor(namePtr->id, cursorStep++);
- } else {
- SetAnimatedThemeCursor(namePtr->id, macCursorPtr->count);
- }
- break;
- case COLOR:
- ccursor = (CCrsrHandle) macCursorPtr->macCursor;
- SetCCursor(ccursor);
- break;
- case NORMAL:
- cursor = (CursHandle) macCursorPtr->macCursor;
- SetCursor(*cursor);
- break;
+ case NONE:
+ if (!cursorHidden) {
+ cursorHidden = 1;
+ HideCursor();
+ }
+ cursorNone = 1;
+ break;
+ case THEME:
+ namePtr = (struct CursorName *) macCursorPtr->macCursor;
+ SetThemeCursor(namePtr->id);
+ break;
+ case ANIMATED:
+ namePtr = (struct CursorName *) macCursorPtr->macCursor;
+ if (macCursorPtr->count == -1) {
+ SetAnimatedThemeCursor(namePtr->id, cursorStep++);
+ } else {
+ SetAnimatedThemeCursor(namePtr->id, macCursorPtr->count);
+ }
+ break;
+ case COLOR:
+ ccursor = (CCrsrHandle) macCursorPtr->macCursor;
+ SetCCursor(ccursor);
+ break;
+ case NORMAL:
+ cursor = (CursHandle) macCursorPtr->macCursor;
+ SetCursor(*cursor);
+ break;
}
}
if (cursorHidden && !cursorNone) {
@@ -448,10 +446,10 @@ TkpSetCursor(
if (cursor == None) {
/*
* This is a little tricky. We can't really tell whether
- * gCurrentCursor is NULL because it was NULL last time around
- * or because we just freed the current cursor. So if the input
- * cursor is NULL, we always need to reset it, we can't trust the
- * cursorChanged logic.
+ * gCurrentCursor is NULL because it was NULL last time around or
+ * because we just freed the current cursor. So if the input cursor is
+ * NULL, we always need to reset it, we can't trust the cursorChanged
+ * logic.
*/
gCurrentCursor = NULL;
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 24c74e3..abe3c2b 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.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: tkMacOSXDialog.c,v 1.36 2007/12/13 15:27:08 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.37 2008/04/27 22:39:12 dkf Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -104,16 +104,14 @@ static int fileDlgInited = 0;
static NavObjectFilterUPP openFileFilterUPP;
static NavEventUPP openFileEventUPP;
-
/*
*----------------------------------------------------------------------
*
* Tk_ChooseColorObjCmd --
*
- * This procedure implements the color dialog box for the Mac
- * platform. See the user documentation for details on what it
- * does.
+ * This procedure implements the color dialog box for the Mac platform.
+ * See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -129,11 +127,11 @@ Tk_ChooseColorObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
OSStatus err;
int result = TCL_ERROR;
- Tk_Window parent, tkwin = (Tk_Window) clientData;
+ Tk_Window parent, tkwin = clientData;
const char *title;
int i, srcRead, dstWrote;
CMError cmerr;
@@ -204,7 +202,7 @@ Tk_ChooseColorObjCmd(
cpinfo.placeWhere = kCenterOnMainScreen;
/* Currently, this does not actually change the colorpicker title */
Tcl_UtfToExternal(NULL, TkMacOSXCarbonEncoding, title, -1, 0, NULL,
- StrBody(cpinfo.prompt), 255, &srcRead, &dstWrote, NULL);
+ StrBody(cpinfo.prompt), 255, &srcRead, &dstWrote, NULL);
StrLength(cpinfo.prompt) = (unsigned char) dstWrote;
TkMacOSXTrackingLoop(1);
@@ -225,7 +223,7 @@ Tk_ChooseColorObjCmd(
}
result = TCL_OK;
-end:
+ end:
return result;
}
@@ -234,9 +232,8 @@ end:
*
* Tk_GetOpenFileObjCmd --
*
- * This procedure implements the "open file" dialog box for the
- * Mac platform. See the user documentation for details on what
- * it does.
+ * This procedure implements the "open file" dialog box for the Mac
+ * platform. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -251,7 +248,7 @@ Tk_GetOpenFileObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int i, result = TCL_ERROR, multiple = 0;
OpenFileData ofd;
@@ -301,51 +298,54 @@ Tk_GetOpenFileObjCmd(
}
switch (index) {
- case OPEN_DEFAULT:
- break;
- case OPEN_FILETYPES:
- types = objv[i + 1];
- if (TkGetFileFilters(interp, &ofd.fl, types, 0) != TCL_OK) {
- goto end;
- }
- break;
- case OPEN_INITDIR:
- initialDir = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- /* empty strings should be like no selection given */
- if (choiceLen == 0) { initialDir = NULL; }
- break;
- case OPEN_INITFILE:
- initialFile = Tcl_GetString(objv[i + 1]);
- /* empty strings should be like no selection given */
- if (choiceLen == 0) { initialFile = NULL; }
- break;
- case OPEN_MESSAGE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- message = CFStringCreateWithBytes(NULL, (unsigned char*)
- choice, choiceLen, kCFStringEncodingUTF8, false);
- break;
- case OPEN_MULTIPLE:
- if (Tcl_GetBooleanFromObj(interp, objv[i + 1], &multiple)
- != TCL_OK) {
- goto end;
- }
- break;
- case OPEN_PARENT:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- parent = Tk_NameToWindow(interp, choice,
- (Tk_Window) clientData);
- if (parent == NULL) {
- goto end;
- }
- break;
- case OPEN_TITLE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- title = CFStringCreateWithBytes(NULL, (unsigned char*)
- choice, choiceLen, kCFStringEncodingUTF8, false);
- break;
- case OPEN_TYPEVARIABLE:
- typeVariablePtr = objv[i + 1];
- break;
+ case OPEN_DEFAULT:
+ break;
+ case OPEN_FILETYPES:
+ types = objv[i + 1];
+ if (TkGetFileFilters(interp, &ofd.fl, types, 0) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case OPEN_INITDIR:
+ initialDir = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ /* empty strings should be like no selection given */
+ if (choiceLen == 0) {
+ initialDir = NULL;
+ }
+ break;
+ case OPEN_INITFILE:
+ initialFile = Tcl_GetString(objv[i + 1]);
+ /* empty strings should be like no selection given */
+ if (choiceLen == 0) {
+ initialFile = NULL;
+ }
+ break;
+ case OPEN_MESSAGE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case OPEN_MULTIPLE:
+ if (Tcl_GetBooleanFromObj(interp, objv[i + 1],
+ &multiple) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case OPEN_PARENT:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ parent = Tk_NameToWindow(interp, choice, clientData);
+ if (parent == NULL) {
+ goto end;
+ }
+ break;
+ case OPEN_TITLE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case OPEN_TYPEVARIABLE:
+ typeVariablePtr = objv[i + 1];
+ break;
}
}
@@ -372,7 +372,7 @@ Tk_GetOpenFileObjCmd(
Tcl_SetVar(interp, Tcl_GetString(typeVariablePtr), filterPtr->name, 0);
}
-end:
+ end:
TkFreeFileFilters(&ofd.fl);
if (initialDesc.dataHandle) {
ChkErr(AEDisposeDesc, &initialDesc);
@@ -394,8 +394,7 @@ end:
*
* Tk_GetSaveFileObjCmd --
*
- * Same as Tk_GetOpenFileCmd but opens a "save file" dialog box
- * instead
+ * Same as Tk_GetOpenFileCmd but opens a "save file" dialog box instead.
*
* Results:
* A standard Tcl result.
@@ -410,7 +409,7 @@ Tk_GetSaveFileObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int i, result = TCL_ERROR;
char *initialFile = NULL;
@@ -453,47 +452,46 @@ Tk_GetSaveFileObjCmd(
goto end;
}
switch (index) {
- case SAVE_DEFAULT:
- break;
- case SAVE_FILETYPES:
- types = objv[i + 1];
- if (TkGetFileFilters(interp, &ofd.fl, types, 0) != TCL_OK) {
- goto end;
- }
- break;
- case SAVE_INITDIR:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- /* empty strings should be like no selection given */
- if (choiceLen && HandleInitialDirectory(interp, NULL, choice,
- &dirRef, NULL, &initialDesc) != TCL_OK) {
- goto end;
- }
- break;
- case SAVE_INITFILE:
- initialFile = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- /* empty strings should be like no selection given */
- if (choiceLen == 0) {
- initialFile = NULL;
- }
- break;
- case SAVE_MESSAGE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- message = CFStringCreateWithBytes(NULL, (unsigned char*)
- choice, choiceLen, kCFStringEncodingUTF8, false);
- break;
- case SAVE_PARENT:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- parent = Tk_NameToWindow(interp, choice,
- (Tk_Window) clientData);
- if (parent == NULL) {
- goto end;
- }
- break;
- case SAVE_TITLE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- title = CFStringCreateWithBytes(NULL, (unsigned char*)
- choice, choiceLen, kCFStringEncodingUTF8, false);
- break;
+ case SAVE_DEFAULT:
+ break;
+ case SAVE_FILETYPES:
+ types = objv[i + 1];
+ if (TkGetFileFilters(interp, &ofd.fl, types, 0) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case SAVE_INITDIR:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ /* empty strings should be like no selection given */
+ if (choiceLen && HandleInitialDirectory(interp, NULL, choice,
+ &dirRef, NULL, &initialDesc) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case SAVE_INITFILE:
+ initialFile = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ /* empty strings should be like no selection given */
+ if (choiceLen == 0) {
+ initialFile = NULL;
+ }
+ break;
+ case SAVE_MESSAGE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case SAVE_PARENT:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ parent = Tk_NameToWindow(interp, choice, (Tk_Window) clientData);
+ if (parent == NULL) {
+ goto end;
+ }
+ break;
+ case SAVE_TITLE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
}
}
@@ -503,7 +501,7 @@ Tk_GetSaveFileObjCmd(
result = NavServicesGetFile(interp, &ofd, initialPtr, initialFile, NULL,
title, message, NULL, false, SAVE_FILE, parent);
TkFreeFileFilters(&ofd.fl);
-end:
+ end:
if (initialDesc.dataHandle) {
ChkErr(AEDisposeDesc, &initialDesc);
}
@@ -521,9 +519,9 @@ end:
*
* Tk_ChooseDirectoryObjCmd --
*
- * This procedure implements the "tk_chooseDirectory" dialog box
- * for the Windows platform. See the user documentation for details
- * on what it does.
+ * This procedure implements the "tk_chooseDirectory" dialog box for the
+ * MacOS X platform. See the user documentation for details on what it
+ * does.
*
* Results:
* See user documentation.
@@ -535,11 +533,11 @@ end:
*/
int
-Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_ChooseDirectoryObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int i, result = TCL_ERROR;
Tk_Window parent = NULL;
@@ -560,9 +558,8 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
}
for (i = 1; i < objc; i += 2) {
- char *choice;
+ char *string, *choice;
int index, choiceLen;
- char *string;
if (Tcl_GetIndexFromObj(interp, objv[i], chooseOptionStrings, "option",
TCL_EXACT, &index) != TCL_OK) {
@@ -575,31 +572,30 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
goto end;
}
switch (index) {
- case CHOOSE_INITDIR:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- if (choiceLen && HandleInitialDirectory(interp, NULL, choice,
- &dirRef, NULL, &initialDesc) != TCL_OK) {
- goto end;
- }
- break;
- case CHOOSE_MESSAGE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- message = CFStringCreateWithBytes(NULL, (unsigned char*)
- choice, choiceLen, kCFStringEncodingUTF8, false);
- break;
- case CHOOSE_PARENT:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- parent = Tk_NameToWindow(interp, choice,
- (Tk_Window) clientData);
- if (parent == NULL) {
- goto end;
- }
- break;
- case CHOOSE_TITLE:
- choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- title = CFStringCreateWithBytes(NULL, (unsigned char*) choice,
- choiceLen, kCFStringEncodingUTF8, false);
- break;
+ case CHOOSE_INITDIR:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (choiceLen && HandleInitialDirectory(interp, NULL, choice,
+ &dirRef, NULL, &initialDesc) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case CHOOSE_MESSAGE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case CHOOSE_PARENT:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ parent = Tk_NameToWindow(interp, choice, clientData);
+ if (parent == NULL) {
+ goto end;
+ }
+ break;
+ case CHOOSE_TITLE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
}
}
@@ -611,7 +607,7 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
result = NavServicesGetFile(interp, &ofd, initialPtr, NULL, NULL, title,
message, NULL, false, CHOOSE_FOLDER, parent);
TkFreeFileFilters(&ofd.fl);
-end:
+ end:
if (initialDesc.dataHandle) {
ChkErr(AEDisposeDesc, &initialDesc);
}
@@ -660,16 +656,16 @@ HandleInitialDirectory(
if (dirName == NULL) {
goto end;
}
- err = ChkErr(FSPathMakeRef, (unsigned char*) dirName,
- dirRef, &isDirectory);
+ err = ChkErr(FSPathMakeRef, (unsigned char *) dirName, dirRef,
+ &isDirectory);
if (err != noErr) {
Tcl_AppendResult(interp, "bad directory \"", initialDir, "\"",
NULL);
goto end;
}
if (!isDirectory) {
- Tcl_AppendResult(interp, "-intialdir \"",
- initialDir, " is a file, not a directory.\"", NULL);
+ Tcl_AppendResult(interp, "-intialdir \"", initialDir, "\""
+ " is a file, not a directory.", NULL);
goto end;
}
ChkErr(AECreateDesc, typeFSRef, dirRef, sizeof(*dirRef), dirDescPtr);
@@ -690,7 +686,7 @@ HandleInitialDirectory(
ChkErr(AECreateList, NULL, 0, false, selectDescPtr);
- err = ChkErr(FSPathMakeRef, (unsigned char*) namePtr, &fileRef,
+ err = ChkErr(FSPathMakeRef, (unsigned char *) namePtr, &fileRef,
&isDirectory);
if (err != noErr) {
Tcl_AppendResult(interp, "bad initialfile \"", initialFile,
@@ -702,7 +698,7 @@ HandleInitialDirectory(
ChkErr(AEDisposeDesc, &fileDesc);
}
result = TCL_OK;
-end:
+ end:
if (dirName) {
Tcl_DStringFree(&ds);
}
@@ -766,7 +762,7 @@ NavServicesGetFile(
NavHandlerUserData data;
NavDialogCreationOptions options;
NavDialogRef dialogRef = NULL;
- CFStringRef * menuItemNames = NULL;
+ CFStringRef *menuItemNames = NULL;
OSStatus err;
Tcl_Obj *theResult = NULL;
int result = TCL_ERROR;
@@ -782,7 +778,7 @@ NavServicesGetFile(
options.optionFlags |= kNavAllowMultipleFiles;
}
options.modality = kWindowModalityAppModal;
- if (parent && ((TkWindow*)parent)->window != None &&
+ if (parent && ((TkWindow *) parent)->window != None &&
TkMacOSXHostToplevelExists(parent)) {
options.parentWindow = TkMacOSXDrawableWindow(Tk_WindowId(parent));
TK_IF_HI_TOOLBOX (5,
@@ -802,10 +798,10 @@ NavServicesGetFile(
* Now process the selection list. We have to use the popupExtension
* to fill the menu.
*/
+
if (ofdPtr && ofdPtr->usePopup) {
- FileFilter *filterPtr;
+ FileFilter *filterPtr = ofdPtr->fl.filters;
- filterPtr = ofdPtr->fl.filters;
if (filterPtr == NULL) {
ofdPtr->usePopup = 0;
}
@@ -815,8 +811,8 @@ NavServicesGetFile(
int index = 0;
ofdPtr->curType = 0;
- menuItemNames = (CFStringRef *) ckalloc(ofdPtr->fl.numFilters
- * sizeof(CFStringRef));
+ menuItemNames = (CFStringRef *)
+ ckalloc(ofdPtr->fl.numFilters * sizeof(CFStringRef));
for (filterPtr = ofdPtr->fl.filters; filterPtr != NULL;
filterPtr = filterPtr->next, index++) {
@@ -836,8 +832,8 @@ NavServicesGetFile(
options.message = message;
options.windowTitle = title;
if (initialFile) {
- options.saveFileName = CFStringCreateWithCString(NULL,
- initialFile, kCFStringEncodingUTF8);
+ options.saveFileName = CFStringCreateWithCString(NULL, initialFile,
+ kCFStringEncodingUTF8);
} else {
options.saveFileName = NULL;
}
@@ -878,9 +874,10 @@ NavServicesGetFile(
}
/*
- * Most commands assume that the file dialogs return a single
- * item, not a list. So only build a list if multiple is true...
+ * Most commands assume that the file dialogs return a single item, not a
+ * list. So only build a list if multiple is true...
*/
+
if (err == noErr) {
if (multiple) {
theResult = Tcl_NewListObj(0, NULL);
@@ -893,67 +890,89 @@ NavServicesGetFile(
}
if (err == noErr && data.reply.validRecord) {
AEDesc resultDesc;
- long count;
+ long count, i;
FSRef fsRef;
char pathPtr[PATH_MAX + 1];
+ char saveName[PATH_MAX + 1];
err = ChkErr(AECountItems, &data.reply.selection, &count);
- if (err == noErr) {
- long i;
+ if (err != noErr) {
+ /*
+ * There was an error when counting the items? Treat as if no
+ * items were chosen.
+ */
- for (i = 1; i <= count; i++) {
- err = ChkErr(AEGetNthDesc, &data.reply.selection, i,
- typeFSRef, NULL, &resultDesc);
- if (err == noErr) {
- err = ChkErr(AEGetDescData, &resultDesc, &fsRef,
- sizeof(fsRef));
- if (err == noErr) {
- err = ChkErr(FSRefMakePath, &fsRef, (unsigned char*)
- pathPtr, PATH_MAX + 1);
- if (err == noErr) {
- int pathValid = 0;
-
- if (isOpen == SAVE_FILE) {
- if (data.saveNameRef) {
- char saveName [PATH_MAX + 1];
-
- if (CFStringGetCString(data.saveNameRef,
- saveName, PATH_MAX + 1,
- kCFStringEncodingUTF8)) {
- if (strlen(pathPtr) + strlen(saveName)
- < PATH_MAX) {
- strcat(pathPtr, "/");
- strcat(pathPtr, saveName);
- pathValid = 1;
- } else {
- TkMacOSXDbgMsg("Path name too "
- "long");
- }
- } else {
- TkMacOSXDbgMsg("CFStringGetCString "
- "failed");
- }
- } else {
- TkMacOSXDbgMsg("NavDialogGetSaveFileName "
- "failed");
- }
- } else {
- pathValid = 1;
- }
- if (pathValid) {
- if (multiple) {
- Tcl_ListObjAppendElement(interp, theResult,
- Tcl_NewStringObj(pathPtr, -1));
- } else {
- Tcl_SetStringObj(theResult, pathPtr, -1);
- }
- }
- }
- }
- ChkErr(AEDisposeDesc, &resultDesc);
+ goto installResult;
+ }
+
+ /*
+ * Process the chosen files. This will be one unless -multiple was
+ * specified.
+ */
+
+ for (i = 1; i <= count; i++) {
+ /*
+ * Get the name of the selected file.
+ */
+
+ err = ChkErr(AEGetNthDesc, &data.reply.selection, i,
+ typeFSRef, NULL, &resultDesc);
+ if (err != noErr) {
+ continue;
+ }
+ err = ChkErr(AEGetDescData, &resultDesc, &fsRef, sizeof(fsRef));
+ if (err != noErr) {
+ goto nextFilename;
+ }
+ err = ChkErr(FSRefMakePath, &fsRef, (unsigned char *) pathPtr,
+ PATH_MAX + 1);
+ if (err != noErr) {
+ goto nextFilename;
+ }
+
+ /*
+ * If we're saving the file, we're creating a new filename and
+ * must therefore check whether it is a legal filename (not
+ * exceeding path length limits, etc.)
+ */
+
+ if (isOpen == SAVE_FILE) {
+ if (!data.saveNameRef) {
+ TkMacOSXDbgMsg("NavDialogGetSaveFileName failed");
+ goto nextFilename;
+ }
+
+ if (!CFStringGetCString(data.saveNameRef, saveName,
+ PATH_MAX + 1, kCFStringEncodingUTF8)) {
+ TkMacOSXDbgMsg("CFStringGetCString failed");
+ goto nextFilename;
}
+
+ if (strlen(pathPtr) + strlen(saveName) >= PATH_MAX) {
+ TkMacOSXDbgMsg("Path name too long");
+ goto nextFilename;
+ }
+
+ strcat(pathPtr, "/");
+ strcat(pathPtr, saveName);
}
+
+ /*
+ * Got a valid file name; put it in the result object.
+ */
+
+ if (multiple) {
+ Tcl_ListObjAppendElement(interp, theResult,
+ Tcl_NewStringObj(pathPtr, -1));
+ } else {
+ Tcl_SetStringObj(theResult, pathPtr, -1);
+ }
+
+ nextFilename:
+ ChkErr(AEDisposeDesc, &resultDesc);
}
+
+ installResult:
Tcl_SetObjResult(interp, theResult);
result = TCL_OK;
} else if (err == userCanceledErr) {
@@ -979,10 +998,11 @@ NavServicesGetFile(
}
if (menuItemNames) {
int i;
+
for (i = 0; i < ofdPtr->fl.numFilters; i++) {
CFRelease(menuItemNames[i]);
}
- ckfree((void *)menuItemNames);
+ ckfree((void *) menuItemNames);
}
if (options.popupExtension) {
CFRelease(options.popupExtension);
@@ -1032,7 +1052,7 @@ OpenEventProc(
selectItem.menuCreator = 0;
selectItem.menuType = ofd->initialType;
selectItem.menuItemName[0] = strlen(filterPtr->name);
- strncpy((char*) &selectItem.menuItemName[1],
+ strncpy((char *) &selectItem.menuItemName[1],
filterPtr->name, 255);
ChkErr(NavCustomControl, callBackParams->context,
kNavCtlSelectCustomType, &selectItem);
@@ -1093,85 +1113,80 @@ OpenEventProc(
pascal Boolean
OpenFileFilterProc(
- AEDesc* theItem, void* info,
+ AEDesc *theItem,
+ void *info,
NavCallBackUserData callBackUD,
NavFilterModes filterMode)
{
- OpenFileData *ofdPtr = ((NavHandlerUserData*) callBackUD)->ofdPtr;
+ OpenFileData *ofdPtr = ((NavHandlerUserData *) callBackUD)->ofdPtr;
int result = MATCHED;
- if (ofdPtr && ofdPtr->usePopup) {
- if (ofdPtr->fl.numFilters > 0) {
- if ((theItem->descriptorType == typeFSS)
- || (theItem->descriptorType == typeFSRef)) {
- NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo *) info;
- char fileName[256];
-
- if (!theInfo->isFolder) {
- OSType fileType;
- StringPtr fileNamePtr = NULL;
- Tcl_DString fileNameDString;
- int i;
- FileFilter *filterPtr;
-
- fileType =
- theInfo->fileAndFolder.fileInfo.finderInfo.fdType;
- Tcl_DStringInit (&fileNameDString);
-
- if (theItem->descriptorType == typeFSS) {
- int len;
- fileNamePtr = ((FSSpec *) *theItem->dataHandle)->name;
- len = fileNamePtr[0];
- strncpy(fileName, (char*) fileNamePtr + 1, len);
- fileName[len] = '\0';
- fileNamePtr = (unsigned char*) fileName;
- } else if ((theItem->descriptorType == typeFSRef)) {
- OSStatus err;
- FSRef *theRef = (FSRef *) *theItem->dataHandle;
- HFSUniStr255 uniFileName;
- err = ChkErr(FSGetCatalogInfo, theRef, kFSCatInfoNone,
- NULL, &uniFileName, NULL, NULL);
-
- if (err == noErr) {
- Tcl_UniCharToUtfDString (
- (Tcl_UniChar *) uniFileName.unicode,
- uniFileName.length, &fileNameDString);
- fileNamePtr = (unsigned char*)
- Tcl_DStringValue(&fileNameDString);
- }
- }
- if (ofdPtr->usePopup) {
- i = ofdPtr->curType;
- for (filterPtr = ofdPtr->fl.filters;
- filterPtr && i > 0; i--) {
- filterPtr = filterPtr->next;
- }
- if (filterPtr) {
- result = MatchOneType(fileNamePtr, fileType,
- ofdPtr, filterPtr);
- } else {
- result = UNMATCHED;
- }
- } else {
- /*
- * We are not using the popup menu. In this case, the
- * file is considered matched if it matches any of
- * the file filters.
- */
-
- result = UNMATCHED;
- for (filterPtr = ofdPtr->fl.filters; filterPtr;
- filterPtr = filterPtr->next) {
- if (MatchOneType(fileNamePtr, fileType,
- ofdPtr, filterPtr) == MATCHED) {
- result = MATCHED;
- break;
- }
- }
+ if (ofdPtr && ofdPtr->usePopup && ofdPtr->fl.numFilters > 0 &&
+ ((theItem->descriptorType == typeFSS)
+ || (theItem->descriptorType == typeFSRef))) {
+ NavFileOrFolderInfo *theInfo = info;
+ char fileName[256];
+ OSType fileType;
+ StringPtr fileNamePtr = NULL;
+ Tcl_DString fileNameDString;
+ int i;
+ FileFilter *filterPtr;
+
+ if (!theInfo->isFolder) {
+ fileType = theInfo->fileAndFolder.fileInfo.finderInfo.fdType;
+ Tcl_DStringInit(&fileNameDString);
+
+ if (theItem->descriptorType == typeFSS) {
+ int len;
+
+ fileNamePtr = ((FSSpec *) *theItem->dataHandle)->name;
+ len = fileNamePtr[0];
+ strncpy(fileName, (char *) fileNamePtr + 1, len);
+ fileName[len] = '\0';
+ fileNamePtr = (unsigned char *) fileName;
+ } else if ((theItem->descriptorType == typeFSRef)) {
+ OSStatus err;
+ FSRef *theRef = (FSRef *) *theItem->dataHandle;
+ HFSUniStr255 uniFileName;
+
+ err = ChkErr(FSGetCatalogInfo, theRef, kFSCatInfoNone,
+ NULL, &uniFileName, NULL, NULL);
+
+ if (err == noErr) {
+ Tcl_UniCharToUtfDString((Tcl_UniChar *)uniFileName.unicode,
+ uniFileName.length, &fileNameDString);
+ fileNamePtr = (unsigned char *)
+ Tcl_DStringValue(&fileNameDString);
+ }
+ }
+ if (ofdPtr->usePopup) {
+ i = ofdPtr->curType;
+ for (filterPtr = ofdPtr->fl.filters; filterPtr && i>0; i--) {
+ filterPtr = filterPtr->next;
+ }
+ if (filterPtr) {
+ result = MatchOneType(fileNamePtr, fileType, ofdPtr,
+ filterPtr);
+ } else {
+ result = UNMATCHED;
+ }
+ } else {
+ /*
+ * We are not using the popup menu. In this case, the file is
+ * considered matched if it matches any of the file filters.
+ */
+
+ result = UNMATCHED;
+ for (filterPtr = ofdPtr->fl.filters; filterPtr;
+ filterPtr = filterPtr->next) {
+ if (MatchOneType(fileNamePtr, fileType, ofdPtr,
+ filterPtr) == MATCHED) {
+ result = MATCHED;
+ break;
}
- Tcl_DStringFree (&fileNameDString);
}
}
+ Tcl_DStringFree(&fileNameDString);
}
}
return (result == MATCHED);
@@ -1206,20 +1221,20 @@ MatchOneType(
FileFilterClause *clausePtr;
/*
- * A file matches with a file type if it matches with at least one
- * clause of the type.
+ * A file matches with a file type if it matches with at least one clause
+ * of the type.
*
- * If the clause has both glob patterns and ostypes, the file must
- * match with at least one pattern AND at least one ostype.
+ * If the clause has both glob patterns and ostypes, the file must match
+ * with at least one pattern AND at least one ostype.
*
* If the clause has glob patterns only, the file must match with at least
* one pattern.
*
- * If the clause has mac types only, the file must match with at least
- * one mac type.
+ * If the clause has mac types only, the file must match with at least one
+ * mac type.
*
- * If the clause has neither glob patterns nor mac types, it's
- * considered an error.
+ * If the clause has neither glob patterns nor mac types, it's considered
+ * an error.
*/
for (clausePtr = filterPtr->clauses; clausePtr;
@@ -1261,10 +1276,7 @@ MatchOneType(
if (Tcl_StringMatch((char*) fileNamePtr, ext)) {
goto glob_matched;
- } else {
- goto glob_unmatched;
}
-
glob_unmatched:
continue;
@@ -1281,13 +1293,12 @@ MatchOneType(
}
/*
- * On Mac OS X, it is not uncommon for files to have NO
- * file type. But folks with Tcl code on Classic MacOS pretty
- * much assume that a generic file will have type TEXT. So
- * if we were strict about matching types when the source file
- * had NO type set, they would have to add another rule always
- * with no fileType. To avoid that, we pass the macMatch side
- * of the test if no fileType is set.
+ * On Mac OS X, it is not uncommon for files to have NO file type. But
+ * folks with Tcl code on Classic MacOS pretty much assume that a
+ * generic file will have type TEXT. So if we were strict about
+ * matching types when the source file had NO type set, they would
+ * have to add another rule always with no fileType. To avoid that, we
+ * pass the macMatch side of the test if no fileType is set.
*/
if (globMatched && (macMatched || (fileType == 0))) {
@@ -1303,8 +1314,8 @@ MatchOneType(
*
* TkAboutDlg --
*
- * Displays the default Tk About box. This code uses Macintosh
- * resources to define the content of the About Box.
+ * Displays the default Tk About box. This code uses Macintosh resources
+ * to define the content of the About Box.
*
* Results:
* None.
@@ -1358,9 +1369,9 @@ Tk_MessageBoxObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
+ Tk_Window tkwin = clientData;
AlertStdCFStringAlertParamRec paramCFStringRec;
AlertType alertType;
DialogRef dialogRef;
@@ -1459,107 +1470,104 @@ Tk_MessageBoxObjCmd(
}
switch (index) {
- case ALERT_DEFAULT:
- /*
- * Need to postpone processing of this option until we are
- * sure to know the '-type' as well.
- */
- haveDefaultOption = true;
- indexDefaultOption = i;
- break;
+ case ALERT_DEFAULT:
+ /*
+ * Need to postpone processing of this option until we are sure to
+ * know the '-type' as well.
+ */
- case ALERT_DETAIL:
- str = Tcl_GetString(objv[i + 1]);
- finemessageTextCF = CFStringCreateWithCString(NULL, str,
- kCFStringEncodingUTF8);
- break;
+ haveDefaultOption = true;
+ indexDefaultOption = i;
+ break;
- case ALERT_ICON:
- if (Tcl_GetIndexFromObj(interp, objv[i + 1],
- movableIconStrings, "value", TCL_EXACT, &iconIndex)
- != TCL_OK) {
- goto end;
- }
- switch (iconIndex) {
- case ICON_ERROR:
- alertType = kAlertStopAlert;
- break;
- case ICON_INFO:
- alertType = kAlertNoteAlert;
- break;
- case ICON_QUESTION:
- alertType = kAlertCautionAlert;
- break;
- case ICON_WARNING:
- alertType = kAlertCautionAlert;
- break;
- }
- break;
+ case ALERT_DETAIL:
+ str = Tcl_GetString(objv[i + 1]);
+ finemessageTextCF = CFStringCreateWithCString(NULL, str,
+ kCFStringEncodingUTF8);
+ break;
- case ALERT_MESSAGE:
- str = Tcl_GetString(objv[i + 1]);
- messageTextCF = CFStringCreateWithCString(NULL, str,
- kCFStringEncodingUTF8);
+ case ALERT_ICON:
+ if (Tcl_GetIndexFromObj(interp, objv[i + 1], movableIconStrings,
+ "value", TCL_EXACT, &iconIndex) != TCL_OK) {
+ goto end;
+ }
+ switch (iconIndex) {
+ case ICON_ERROR:
+ alertType = kAlertStopAlert;
break;
-
- case ALERT_PARENT:
- str = Tcl_GetString(objv[i + 1]);
- tkwin = Tk_NameToWindow(interp, str, tkwin);
- if (tkwin == NULL) {
- goto end;
- }
- if (((TkWindow*)tkwin)->window != None &&
- TkMacOSXHostToplevelExists(tkwin)) {
- haveParentOption = true;
- }
+ case ICON_INFO:
+ alertType = kAlertNoteAlert;
break;
-
- case ALERT_TITLE:
+ case ICON_QUESTION:
+ alertType = kAlertCautionAlert;
+ break;
+ case ICON_WARNING:
+ alertType = kAlertCautionAlert;
break;
+ }
+ break;
- case ALERT_TYPE:
- if (Tcl_GetIndexFromObj(interp, objv[i + 1],\
- movableTypeStrings, "value", TCL_EXACT, &typeIndex)
- != TCL_OK) {
- goto end;
- }
- switch (typeIndex) {
- case TYPE_ABORTRETRYIGNORE:
- paramCFStringRec.defaultText = CFSTR("Abort");
- paramCFStringRec.cancelText = CFSTR("Retry");
- paramCFStringRec.otherText = CFSTR("Ignore");
- paramCFStringRec.cancelButton =
- kAlertStdAlertOtherButton;
- break;
- case TYPE_OK:
- paramCFStringRec.defaultText = CFSTR("OK");
- break;
- case TYPE_OKCANCEL:
- paramCFStringRec.defaultText = CFSTR("OK");
- paramCFStringRec.cancelText = CFSTR("Cancel");
- break;
- case TYPE_RETRYCANCEL:
- paramCFStringRec.defaultText = CFSTR("Retry");
- paramCFStringRec.cancelText = CFSTR("Cancel");
- break;
- case TYPE_YESNO:
- paramCFStringRec.defaultText = CFSTR("Yes");
- paramCFStringRec.cancelText = CFSTR("No");
- break;
- case TYPE_YESNOCANCEL:
- paramCFStringRec.defaultText = CFSTR("Yes");
- paramCFStringRec.cancelText = CFSTR("No");
- paramCFStringRec.otherText = CFSTR("Cancel");
- paramCFStringRec.cancelButton =
- kAlertStdAlertOtherButton;
- break;
- }
+ case ALERT_MESSAGE:
+ str = Tcl_GetString(objv[i + 1]);
+ messageTextCF = CFStringCreateWithCString(NULL, str,
+ kCFStringEncodingUTF8);
+ break;
+
+ case ALERT_PARENT:
+ str = Tcl_GetString(objv[i + 1]);
+ tkwin = Tk_NameToWindow(interp, str, tkwin);
+ if (tkwin == NULL) {
+ goto end;
+ }
+ if (((TkWindow *) tkwin)->window != None &&
+ TkMacOSXHostToplevelExists(tkwin)) {
+ haveParentOption = true;
+ }
+ break;
+
+ case ALERT_TITLE:
+ /* TODO: message box title missing? */
+ break;
+
+ case ALERT_TYPE:
+ if (Tcl_GetIndexFromObj(interp, objv[i + 1], movableTypeStrings,
+ "value", TCL_EXACT, &typeIndex) != TCL_OK) {
+ goto end;
+ }
+ switch (typeIndex) {
+ case TYPE_ABORTRETRYIGNORE:
+ paramCFStringRec.defaultText = CFSTR("Abort");
+ paramCFStringRec.cancelText = CFSTR("Retry");
+ paramCFStringRec.otherText = CFSTR("Ignore");
+ paramCFStringRec.cancelButton = kAlertStdAlertOtherButton;
+ break;
+ case TYPE_OK:
+ paramCFStringRec.defaultText = CFSTR("OK");
break;
+ case TYPE_OKCANCEL:
+ paramCFStringRec.defaultText = CFSTR("OK");
+ paramCFStringRec.cancelText = CFSTR("Cancel");
+ break;
+ case TYPE_RETRYCANCEL:
+ paramCFStringRec.defaultText = CFSTR("Retry");
+ paramCFStringRec.cancelText = CFSTR("Cancel");
+ break;
+ case TYPE_YESNO:
+ paramCFStringRec.defaultText = CFSTR("Yes");
+ paramCFStringRec.cancelText = CFSTR("No");
+ break;
+ case TYPE_YESNOCANCEL:
+ paramCFStringRec.defaultText = CFSTR("Yes");
+ paramCFStringRec.cancelText = CFSTR("No");
+ paramCFStringRec.otherText = CFSTR("Cancel");
+ paramCFStringRec.cancelButton = kAlertStdAlertOtherButton;
+ break;
+ }
+ break;
}
}
if (haveDefaultOption) {
-
/*
* Any '-default' option needs to know the '-type' option, which is why
* we do this here.
@@ -1642,19 +1650,18 @@ Tk_MessageBoxObjCmd(
}
}
if (err == noErr) {
- int ind;
-
/*
* Map 'itemHit' (1, 2, 3) to descriptive text string.
*/
- ind = nativeButtonIndexAndTypeToButtonIndex[typeIndex][itemHit];
+ int ind = nativeButtonIndexAndTypeToButtonIndex[typeIndex][itemHit];
+
Tcl_SetObjResult(interp, Tcl_NewStringObj(movableButtonStrings[ind],
-1));
result = TCL_OK;
}
-end:
+ end:
if (finemessageTextCF) {
CFRelease(finemessageTextCF);
}
@@ -1686,21 +1693,21 @@ AlertHandler(
EventRef eventRef,
void *userData)
{
- AlertHandlerUserData *data = (AlertHandlerUserData *) userData;
+ AlertHandlerUserData *data = userData;
HICommand cmd;
ChkErr(GetEventParameter,eventRef, kEventParamDirectObject, typeHICommand,
NULL, sizeof(cmd), NULL, &cmd);
switch (cmd.commandID) {
- case kHICommandOK:
- data->buttonIndex = 1;
- break;
- case kHICommandCancel:
- data->buttonIndex = 2;
- break;
- case kHICommandOther:
- data->buttonIndex = 3;
- break;
+ case kHICommandOK:
+ data->buttonIndex = 1;
+ break;
+ case kHICommandCancel:
+ data->buttonIndex = 2;
+ break;
+ case kHICommandOther:
+ data->buttonIndex = 3;
+ break;
}
if (data->buttonIndex) {
ChkErr(QuitAppModalLoopForWindow, data->dialogWindow);
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index a971c0d..47a9ed7 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -3,52 +3,49 @@
*
* This file contains platform-specific procedures for theMac to provide
* basic operations needed for application embedding (where one
- * application can use as its main window an internal window from
- * some other application).
- * Currently only Toplevel embedding within the same Tk application is
- * allowed on the Macintosh.
+ * application can use as its main window an internal window from some
+ * other application). Currently only Toplevel embedding within the same
+ * Tk application is allowed on the Macintosh.
*
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXEmbed.c,v 1.16 2007/12/13 15:27:09 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXEmbed.c,v 1.17 2008/04/27 22:39:12 dkf Exp $
*/
#include "tkMacOSXInt.h"
/*
* One of the following structures exists for each container in this
- * application. It keeps track of the container window and its
- * associated embedded window.
+ * application. It keeps track of the container window and its associated
+ * embedded window.
*/
typedef struct Container {
- Window parent; /* The Mac Drawable for the parent of
- * the pair (the container). */
- TkWindow *parentPtr; /* Tk's information about the container,
- * or NULL if the container isn't
+ Window parent; /* The Mac Drawable for the parent of the pair
+ * (the container). */
+ TkWindow *parentPtr; /* Tk's information about the container, or
+ * NULL if the container isn't in this
+ * process. */
+ Window embedded; /* The MacDrawable for the embedded window.
+ * Starts off as None, but gets filled in when
+ * the window is eventually created. */
+ TkWindow *embeddedPtr; /* Tk's information about the embedded window,
+ * or NULL if the embedded application isn't
* in this process. */
- Window embedded; /* The MacDrawable for the embedded
- * window. Starts off as None, but
- * gets filled in when the window is
- * eventually created. */
- TkWindow *embeddedPtr; /* Tk's information about the embedded
- * window, or NULL if the
- * embedded application isn't in
- * this process. */
- struct Container *nextPtr; /* Next in list of all containers in
- * this process. */
+ struct Container *nextPtr; /* Next in list of all containers in this
+ * process. */
} Container;
static Container *firstContainerPtr = NULL;
- /* First in list of all containers
- * managed by this process. */
+ /* First in list of all containers managed by
+ * this process. */
/*
- * Globals defined in this file
+ * Globals defined in this file:
*/
TkMacOSXEmbedHandler *tkMacOSXEmbedHandler = NULL;
@@ -57,25 +54,24 @@ TkMacOSXEmbedHandler *tkMacOSXEmbedHandler = NULL;
* Prototypes for static procedures defined in this file:
*/
-static void ContainerEventProc(ClientData clientData, XEvent *eventPtr);
-static void EmbeddedEventProc(ClientData clientData, XEvent *eventPtr);
-static void EmbedActivateProc(ClientData clientData, XEvent *eventPtr);
-static void EmbedFocusProc(ClientData clientData, XEvent *eventPtr);
-static void EmbedGeometryRequest(Container * containerPtr, int width,
- int height);
-static void EmbedSendConfigure(Container *containerPtr);
-static void EmbedStructureProc(ClientData clientData, XEvent *eventPtr);
-static void EmbedWindowDeleted(TkWindow *winPtr);
-
+static void ContainerEventProc(ClientData clientData, XEvent *eventPtr);
+static void EmbeddedEventProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedActivateProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedFocusProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedGeometryRequest(Container *containerPtr, int width,
+ int height);
+static void EmbedSendConfigure(Container *containerPtr);
+static void EmbedStructureProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedWindowDeleted(TkWindow *winPtr);
/*
*----------------------------------------------------------------------
*
* Tk_MacOSXSetEmbedHandler --
*
- * Registers a handler for an in process form of embedding, like
- * Netscape plugins, where Tk is loaded into the process, but does
- * not control the main window
+ * Registers a handler for an in process form of embedding, like Netscape
+ * plugins, where Tk is loaded into the process, but does not control the
+ * main window
*
* Results:
* None
@@ -95,7 +91,8 @@ Tk_MacOSXSetEmbedHandler(
Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc)
{
if (tkMacOSXEmbedHandler == NULL) {
- tkMacOSXEmbedHandler = (TkMacOSXEmbedHandler *) ckalloc(sizeof(TkMacOSXEmbedHandler));
+ tkMacOSXEmbedHandler = (TkMacOSXEmbedHandler *)
+ ckalloc(sizeof(TkMacOSXEmbedHandler));
}
tkMacOSXEmbedHandler->registerWinProc = registerWinProc;
tkMacOSXEmbedHandler->getPortProc = getPortProc;
@@ -129,9 +126,8 @@ TkpMakeWindow(
XEvent event;
/*
- * If this window is marked as embedded then
- * the window structure should have already been
- * created in the TkpUseWindow function.
+ * If this window is marked as embedded then the window structure should
+ * have already been created in the TkpUseWindow function.
*/
if (Tk_IsEmbedded(winPtr)) {
@@ -158,22 +154,24 @@ TkpMakeWindow(
macWin->size = CGSizeZero;
if (Tk_IsTopLevel(macWin->winPtr)) {
/*
- *This will be set when we are mapped.
+ * This will be set when we are mapped.
*/
+
macWin->xOff = 0;
macWin->yOff = 0;
macWin->toplevel = macWin;
} else {
macWin->xOff = winPtr->parentPtr->privatePtr->xOff +
- winPtr->parentPtr->changes.border_width +
- winPtr->changes.x;
+ winPtr->parentPtr->changes.border_width +
+ winPtr->changes.x;
macWin->yOff = winPtr->parentPtr->privatePtr->yOff +
- winPtr->parentPtr->changes.border_width +
- winPtr->changes.y;
+ winPtr->parentPtr->changes.border_width +
+ winPtr->changes.y;
macWin->toplevel = winPtr->parentPtr->privatePtr->toplevel;
}
macWin->toplevel->referenceCount++;
}
+
/*
* TODO: need general solution for visibility events.
*/
@@ -195,15 +193,15 @@ TkpMakeWindow(
*
* TkpUseWindow --
*
- * This procedure causes a Tk window to use a given X window as
- * its parent window, rather than the root window for the screen.
- * It is invoked by an embedded application to specify the window
- * in which it is embedded.
+ * This procedure causes a Tk window to use a given X window as its
+ * parent window, rather than the root window for the screen. It is
+ * invoked by an embedded application to specify the window in which it
+ * is embedded.
*
* Results:
- * The return value is normally TCL_OK. If an error occurs (such
- * as string not being a valid window spec), then the return value
- * is TCL_ERROR and an error message is left in the interp's result if
+ * The return value is normally TCL_OK. If an error occurs (such as
+ * string not being a valid window spec), then the return value is
+ * TCL_ERROR and an error message is left in the interp's result if
* interp is non-NULL.
*
* Side effects:
@@ -214,12 +212,12 @@ TkpMakeWindow(
int
TkpUseWindow(
- Tcl_Interp *interp, /* If not NULL, used for error reporting
- * if string is bogus. */
+ Tcl_Interp *interp, /* If not NULL, used for error reporting if
+ * string is bogus. */
Tk_Window tkwin, /* Tk window that does not yet have an
* associated X window. */
- CONST char *string) /* String identifying an X window to use
- * for tkwin; must be an integer value. */
+ const char *string) /* String identifying an X window to use for
+ * tkwin; must be an integer value. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
TkWindow *usePtr;
@@ -233,13 +231,12 @@ TkpUseWindow(
}
/*
- * Decode the container pointer, and look for it among the
- * list of available containers.
+ * Decode the container pointer, and look for it among the list of
+ * available containers.
*
* N.B. For now, we are limiting the containers to be in the same Tk
- * application as tkwin, since otherwise they would not be in our list
- * of containers.
- *
+ * application as tkwin, since otherwise they would not be in our list of
+ * containers.
*/
if (Tcl_GetInt(interp, string, (int*) &parent) != TCL_OK) {
@@ -261,8 +258,8 @@ TkpUseWindow(
*/
/*
- * Save information about the container and the embedded window
- * in a Container structure. Currently, there must already be an existing
+ * Save information about the container and the embedded window in a
+ * Container structure. Currently, there must already be an existing
* Container structure, since we only allow the case where both container
* and embedded app. are in the same process.
*/
@@ -290,11 +287,11 @@ TkpUseWindow(
winPtr->privatePtr = macWin;
/*
- * The grafPtr will be NULL for a Tk in Tk embedded window.
- * It is none of our business what it is for a Tk not in Tk embedded window,
- * but we will initialize it to NULL, and let the registerWinProc
- * set it. In any case, you must always use TkMacOSXGetDrawablePort
- * to get the portPtr. It will correctly find the container's port.
+ * The grafPtr will be NULL for a Tk in Tk embedded window. It is none of
+ * our business what it is for a Tk not in Tk embedded window, but we will
+ * initialize it to NULL, and let the registerWinProc set it. In any case,
+ * you must always use TkMacOSXGetDrawablePort to get the portPtr. It will
+ * correctly find the container's port.
*/
macWin->grafPtr = NULL;
@@ -310,19 +307,17 @@ TkpUseWindow(
winPtr->flags |= TK_EMBEDDED;
-
/*
- * Make a copy of the TK_EMBEDDED flag, since sometimes
- * we need this to get the port after the TkWindow structure
- * has been freed.
+ * Make a copy of the TK_EMBEDDED flag, since sometimes we need this to
+ * get the port after the TkWindow structure has been freed.
*/
macWin->flags |= TK_EMBEDDED;
/*
- * Now check whether it is embedded in another Tk widget. If not (the first
- * case below) we see if there is an in-process embedding handler registered,
- * and if so, let that fill in the rest of the macWin.
+ * Now check whether it is embedded in another Tk widget. If not (the
+ * first case below) we see if there is an in-process embedding handler
+ * registered, and if so, let that fill in the rest of the macWin.
*/
if (containerPtr == NULL) {
@@ -345,10 +340,8 @@ TkpUseWindow(
containerPtr->embeddedPtr = macWin->winPtr;
containerPtr->nextPtr = firstContainerPtr;
firstContainerPtr = containerPtr;
-
}
} else {
-
/*
* The window is embedded in another Tk window.
*/
@@ -360,10 +353,9 @@ TkpUseWindow(
parent->winPtr->changes.border_width +
winPtr->changes.y;
-
/*
- * Finish filling up the container structure with the embedded window's
- * information.
+ * Finish filling up the container structure with the embedded
+ * window's information.
*/
containerPtr->embedded = (Window) macWin;
@@ -375,8 +367,7 @@ TkpUseWindow(
*/
Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbeddedEventProc,
- (ClientData) winPtr);
-
+ winPtr);
}
return TCL_OK;
@@ -387,10 +378,10 @@ TkpUseWindow(
*
* TkpMakeContainer --
*
- * This procedure is called to indicate that a particular window
- * will be a container for an embedded application. This changes
- * certain aspects of the window's behavior, such as whether it
- * will receive events anymore.
+ * This procedure is called to indicate that a particular window will be
+ * a container for an embedded application. This changes certain aspects
+ * of the window's behavior, such as whether it will receive events
+ * anymore.
*
* Results:
* None.
@@ -403,18 +394,17 @@ TkpUseWindow(
void
TkpMakeContainer(
- Tk_Window tkwin) /* Token for a window that is about to
- * become a container. */
+ Tk_Window tkwin) /* Token for a window that is about to become
+ * a container. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
/*
- * Register the window as a container so that, for example, we can
- * make sure the argument to -use is valid.
+ * Register the window as a container so that, for example, we can make
+ * sure the argument to -use is valid.
*/
-
Tk_MakeWindowExist(tkwin);
containerPtr = (Container *) ckalloc(sizeof(Container));
containerPtr->parent = Tk_WindowId(tkwin);
@@ -426,23 +416,22 @@ TkpMakeContainer(
winPtr->flags |= TK_CONTAINER;
/*
- * Request SubstructureNotify events so that we can find out when
- * the embedded application creates its window or attempts to
- * resize it. Also watch Configure events on the container so that
- * we can resize the child to match. Also, pass activate events from
- * the container down to the embedded toplevel.
+ * Request SubstructureNotify events so that we can find out when the
+ * embedded application creates its window or attempts to resize it. Also
+ * watch Configure events on the container so that we can resize the child
+ * to match. Also, pass activate events from the container down to the
+ * embedded toplevel.
*/
Tk_CreateEventHandler(tkwin,
SubstructureNotifyMask|SubstructureRedirectMask,
- ContainerEventProc, (ClientData) winPtr);
+ ContainerEventProc, winPtr);
Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbedStructureProc,
- (ClientData) containerPtr);
+ containerPtr);
Tk_CreateEventHandler(tkwin, ActivateMask, EmbedActivateProc,
- (ClientData) containerPtr);
+ containerPtr);
Tk_CreateEventHandler(tkwin, FocusChangeMask, EmbedFocusProc,
- (ClientData) containerPtr);
-
+ containerPtr);
}
/*
@@ -454,8 +443,7 @@ TkpMakeContainer(
* identifier for the associated container window.
*
* Results:
- * The return value is the MacDrawable for winPtr's
- * container window.
+ * The return value is the MacDrawable for winPtr's container window.
*
* Side effects:
* None.
@@ -464,8 +452,8 @@ TkpMakeContainer(
*/
MacDrawable *
-TkMacOSXContainerId(winPtr)
- TkWindow *winPtr; /* Tk's structure for an embedded window. */
+TkMacOSXContainerId(
+ TkWindow *winPtr) /* Tk's structure for an embedded window. */
{
Container *containerPtr;
@@ -484,8 +472,8 @@ TkMacOSXContainerId(winPtr)
*
* TkMacOSXGetHostToplevel --
*
- * Given the TkWindow, return the MacDrawable for the outermost
- * toplevel containing it. This will be a real Macintosh window.
+ * Given the TkWindow, return the MacDrawable for the outermost toplevel
+ * containing it. This will be a real Macintosh window.
*
* Results:
* Returns a MacDrawable corresponding to a Macintosh Toplevel
@@ -504,20 +492,18 @@ TkMacOSXGetHostToplevel(
topWinPtr = winPtr->privatePtr->toplevel->winPtr;
if (!Tk_IsEmbedded(topWinPtr)) {
- return winPtr->privatePtr->toplevel;
- } else {
- contWinPtr = TkpGetOtherWindow(topWinPtr);
+ return winPtr->privatePtr->toplevel;
+ }
+ contWinPtr = TkpGetOtherWindow(topWinPtr);
- /*
- * TODO: Here we should handle out of process embedding.
- */
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
- if (contWinPtr != NULL) {
- return TkMacOSXGetHostToplevel(contWinPtr);
- } else {
- return None;
- }
+ if (contWinPtr == NULL) {
+ return None;
}
+ return TkMacOSXGetHostToplevel(contWinPtr);
}
/*
@@ -525,10 +511,10 @@ TkMacOSXGetHostToplevel(
*
* TkpClaimFocus --
*
- * This procedure is invoked when someone asks for the input focus
- * to be put on a window in an embedded application, but the
- * application doesn't currently have the focus. It requests the
- * input focus from the container application.
+ * This procedure is invoked when someone asks for the input focus to be
+ * put on a window in an embedded application, but the application
+ * doesn't currently have the focus. It requests the input focus from the
+ * container application.
*
* Results:
* None.
@@ -541,11 +527,11 @@ TkMacOSXGetHostToplevel(
void
TkpClaimFocus(
- TkWindow *topLevelPtr, /* Top-level window containing desired
- * focus window; should be embedded. */
- int force) /* One means that the container should
- * claim the focus if it doesn't
- * currently have it. */
+ TkWindow *topLevelPtr, /* Top-level window containing desired focus
+ * window; should be embedded. */
+ int force) /* One means that the container should claim
+ * the focus if it doesn't currently have
+ * it. */
{
XEvent event;
Container *containerPtr;
@@ -560,7 +546,6 @@ TkpClaimFocus(
/* Empty loop body. */
}
-
event.xfocus.type = FocusIn;
event.xfocus.serial = LastKnownRequestProcessed(topLevelPtr->display);
event.xfocus.send_event = 1;
@@ -576,9 +561,8 @@ TkpClaimFocus(
*
* TkpTestembedCmd --
*
- * This procedure implements the "testembed" command. It returns
- * some or all of the information in the list pointed to by
- * firstContainerPtr.
+ * This procedure implements the "testembed" command. It returns some or
+ * all of the information in the list pointed to by firstContainerPtr.
*
* Results:
* A standard Tcl result.
@@ -594,7 +578,7 @@ TkpTestembedCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
int all;
Container *containerPtr;
@@ -612,13 +596,11 @@ TkpTestembedCmd(
Tcl_DStringStartSublist(&dString);
if (containerPtr->parent == None) {
Tcl_DStringAppendElement(&dString, "");
+ } else if (all) {
+ sprintf(buffer, "0x%x", (int) containerPtr->parent);
+ Tcl_DStringAppendElement(&dString, buffer);
} else {
- if (all) {
- sprintf(buffer, "0x%x", (int) containerPtr->parent);
- Tcl_DStringAppendElement(&dString, buffer);
- } else {
- Tcl_DStringAppendElement(&dString, "XXX");
- }
+ Tcl_DStringAppendElement(&dString, "XXX");
}
if (containerPtr->parentPtr == NULL) {
Tcl_DStringAppendElement(&dString, "");
@@ -628,13 +610,11 @@ TkpTestembedCmd(
}
if (containerPtr->embedded == None) {
Tcl_DStringAppendElement(&dString, "");
+ } else if (all) {
+ sprintf(buffer, "0x%x", (int) containerPtr->embedded);
+ Tcl_DStringAppendElement(&dString, buffer);
} else {
- if (all) {
- sprintf(buffer, "0x%x", (int) containerPtr->embedded);
- Tcl_DStringAppendElement(&dString, buffer);
- } else {
- Tcl_DStringAppendElement(&dString, "XXX");
- }
+ Tcl_DStringAppendElement(&dString, "XXX");
}
if (containerPtr->embeddedPtr == NULL) {
Tcl_DStringAppendElement(&dString, "");
@@ -653,13 +633,13 @@ TkpTestembedCmd(
*
* TkpRedirectKeyEvent --
*
- * This procedure is invoked when a key press or release event
- * arrives for an application that does not believe it owns the
- * input focus. This can happen because of embedding; for example,
- * X can send an event to an embedded application when the real
- * focus window is in the container application and is an ancestor
- * of the container. This procedure's job is to forward the event
- * back to the application where it really belongs.
+ * This procedure is invoked when a key press or release event arrives
+ * for an application that does not believe it owns the input focus. This
+ * can happen because of embedding; for example, X can send an event to
+ * an embedded application when the real focus window is in the container
+ * application and is an ancestor of the container. This procedure's job
+ * is to forward the event back to the application where it really
+ * belongs.
*
* Results:
* None.
@@ -674,9 +654,10 @@ void
TkpRedirectKeyEvent(
TkWindow *winPtr, /* Window to which the event was originally
* reported. */
- XEvent *eventPtr) /* X event to redirect (should be KeyPress
- * or KeyRelease). */
+ XEvent *eventPtr) /* X event to redirect (should be KeyPress or
+ * KeyRelease). */
{
+ /* TODO: Implement this or decide it definitely needs no implementation */
}
/*
@@ -684,13 +665,13 @@ TkpRedirectKeyEvent(
*
* TkpGetOtherWindow --
*
- * If both the container and embedded window are in the same
- * process, this procedure will return either one, given the other.
+ * If both the container and embedded window are in the same process,
+ * this procedure will return either one, given the other.
*
* Results:
* If winPtr is a container, the return value is the token for the
- * embedded window, and vice versa. If the "other" window isn't in
- * this process, NULL is returned.
+ * embedded window, and vice versa. If the "other" window isn't in this
+ * process, NULL is returned.
*
* Side effects:
* None.
@@ -700,14 +681,14 @@ TkpRedirectKeyEvent(
TkWindow *
TkpGetOtherWindow(
- TkWindow *winPtr) /* Tk's structure for a container or
- * embedded window. */
+ TkWindow *winPtr) /* Tk's structure for a container or embedded
+ * window. */
{
Container *containerPtr;
/*
- * TkpGetOtherWindow returns NULL if both windows are not
- * in the same process...
+ * TkpGetOtherWindow returns NULL if both windows are not in the same
+ * process...
*/
if (!(winPtr->flags & TK_BOTH_HALVES)) {
@@ -749,7 +730,7 @@ EmbeddedEventProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
if (eventPtr->type == DestroyNotify) {
EmbedWindowDeleted(winPtr);
@@ -762,19 +743,19 @@ EmbeddedEventProc(
* ContainerEventProc --
*
* This procedure is invoked by the Tk event dispatcher when various
- * useful events are received for the children of a container
- * window. It forwards relevant information, such as geometry
- * requests, from the events into the container's application.
+ * useful events are received for the children of a container window. It
+ * forwards relevant information, such as geometry requests, from the
+ * events into the container's application.
*
- * NOTE: on the Mac, only the DestroyNotify branch is ever taken.
- * We don't synthesize the other events.
+ * NOTE: on the Mac, only the DestroyNotify branch is ever taken. We
+ * don't synthesize the other events.
*
* Results:
* None.
*
* Side effects:
- * Depends on the event. For example, when ConfigureRequest events
- * occur, geometry information gets set for the container window.
+ * Depends on the event. For example, when ConfigureRequest events occur,
+ * geometry information gets set for the container window.
*
*----------------------------------------------------------------------
*/
@@ -784,18 +765,18 @@ ContainerEventProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
Container *containerPtr;
Tk_ErrorHandler errHandler;
/*
- * Ignore any X protocol errors that happen in this procedure
- * (almost any operation could fail, for example, if the embedded
- * application has deleted its window).
+ * Ignore any X protocol errors that happen in this procedure (almost any
+ * operation could fail, for example, if the embedded application has
+ * deleted its window).
*/
errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, NULL, NULL);
/*
* Find the Container structure associated with the parent window.
@@ -811,10 +792,9 @@ ContainerEventProc(
if (eventPtr->type == CreateNotify) {
/*
- * A new child window has been created in the container. Record
- * its id in the Container structure (if more than one child is
- * created, just remember the last one and ignore the earlier
- * ones).
+ * A new child window has been created in the container. Record its id
+ * in the Container structure (if more than one child is created, just
+ * remember the last one and ignore the earlier ones).
*/
containerPtr->embedded = eventPtr->xcreatewindow.window;
@@ -822,14 +802,13 @@ ContainerEventProc(
if ((eventPtr->xconfigurerequest.x != 0)
|| (eventPtr->xconfigurerequest.y != 0)) {
/*
- * The embedded application is trying to move itself, which
- * isn't legal. At this point, the window hasn't actually
- * moved, but we need to send it a ConfigureNotify event to
- * let it know that its request has been denied. If the
- * embedded application was also trying to resize itself, a
- * ConfigureNotify will be sent by the geometry management
- * code below, so we don't need to do anything. Otherwise,
- * generate a synthetic event.
+ * The embedded application is trying to move itself, which isn't
+ * legal. At this point, the window hasn't actually moved, but we
+ * need to send it a ConfigureNotify event to let it know that its
+ * request has been denied. If the embedded application was also
+ * trying to resize itself, a ConfigureNotify will be sent by the
+ * geometry management code below, so we don't need to do
+ * anything. Otherwise, generate a synthetic event.
*/
if ((eventPtr->xconfigurerequest.width == winPtr->changes.width)
@@ -844,8 +823,8 @@ ContainerEventProc(
} else if (eventPtr->type == MapRequest) {
/*
* The embedded application's map request was ignored and simply
- * passed on to us, so we have to map the window for it to appear
- * on the screen.
+ * passed on to us, so we have to map the window for it to appear on
+ * the screen.
*/
XMapWindow(eventPtr->xmaprequest.display,
@@ -865,11 +844,10 @@ ContainerEventProc(
*
* EmbedStructureProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * a container window owned by this application gets resized
- * (and also at several other times that we don't care about).
- * This procedure reflects the size change in the embedded
- * window that corresponds to the container.
+ * This procedure is invoked by the Tk event dispatcher when a container
+ * window owned by this application gets resized (and also at several
+ * other times that we don't care about). This procedure reflects the
+ * size change in the embedded window that corresponds to the container.
*
* Results:
* None.
@@ -885,7 +863,7 @@ EmbedStructureProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- Container *containerPtr = (Container *) clientData;
+ Container *containerPtr = clientData;
Tk_ErrorHandler errHandler;
if (eventPtr->type == ConfigureNotify) {
@@ -896,12 +874,10 @@ EmbedStructureProc(
*/
errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, NULL, NULL);
Tk_MoveResizeWindow((Tk_Window) containerPtr->embeddedPtr, 0, 0,
- (unsigned int) Tk_Width(
- (Tk_Window) containerPtr->parentPtr),
- (unsigned int) Tk_Height(
- (Tk_Window) containerPtr->parentPtr));
+ (unsigned) Tk_Width((Tk_Window) containerPtr->parentPtr),
+ (unsigned) Tk_Height((Tk_Window)containerPtr->parentPtr));
Tk_DeleteErrorHandler(errHandler);
}
} else if (eventPtr->type == DestroyNotify) {
@@ -914,10 +890,10 @@ EmbedStructureProc(
*
* EmbedActivateProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * Activate and Deactivate events occur for a container window owned
- * by this application. It is responsible for forwarding an activate
- * event down into the embedded toplevel.
+ * This procedure is invoked by the Tk event dispatcher when Activate and
+ * Deactivate events occur for a container window owned by this
+ * application. It is responsible for forwarding an activate event down
+ * into the embedded toplevel.
*
* Results:
* None.
@@ -933,7 +909,7 @@ EmbedActivateProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- Container *containerPtr = (Container *) clientData;
+ Container *containerPtr = clientData;
if (containerPtr->embeddedPtr != NULL) {
if (eventPtr->type == ActivateNotify) {
@@ -949,11 +925,10 @@ EmbedActivateProc(
*
* EmbedFocusProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * FocusIn and FocusOut events occur for a container window owned
- * by this application. It is responsible for moving the focus
- * back and forth between a container application and an embedded
- * application.
+ * This procedure is invoked by the Tk event dispatcher when FocusIn and
+ * FocusOut events occur for a container window owned by this
+ * application. It is responsible for moving the focus back and forth
+ * between a container application and an embedded application.
*
* Results:
* None.
@@ -969,37 +944,37 @@ EmbedFocusProc(
ClientData clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
- Container *containerPtr = (Container *) clientData;
+ Container *containerPtr = clientData;
Display *display;
XEvent event;
if (containerPtr->embeddedPtr != NULL) {
- display = Tk_Display(containerPtr->parentPtr);
+ display = Tk_Display(containerPtr->parentPtr);
event.xfocus.serial = LastKnownRequestProcessed(display);
event.xfocus.send_event = false;
event.xfocus.display = display;
event.xfocus.mode = NotifyNormal;
event.xfocus.window = containerPtr->embedded;
- if (eventPtr->type == FocusIn) {
- /*
- * The focus just arrived at the container. Change the X focus
- * to move it to the embedded application, if there is one.
- * Ignore X errors that occur during this operation (it's
- * possible that the new focus window isn't mapped).
- */
+ if (eventPtr->type == FocusIn) {
+ /*
+ * The focus just arrived at the container. Change the X focus to
+ * move it to the embedded application, if there is one. Ignore X
+ * errors that occur during this operation (it's possible that the
+ * new focus window isn't mapped).
+ */
event.xfocus.detail = NotifyNonlinear;
event.xfocus.type = FocusIn;
-
} else if (eventPtr->type == FocusOut) {
- /* When the container gets a FocusOut event, it has to tell the embedded app
- * that it has lost the focus.
- */
+ /*
+ * When the container gets a FocusOut event, it has to tell the
+ * embedded app that it has lost the focus.
+ */
event.xfocus.type = FocusOut;
event.xfocus.detail = NotifyNonlinear;
- }
+ }
Tk_QueueWindowEvent(&event, TCL_QUEUE_MARK);
}
@@ -1010,10 +985,10 @@ EmbedFocusProc(
*
* EmbedGeometryRequest --
*
- * This procedure is invoked when an embedded application requests
- * a particular size. It processes the request (which may or may
- * not actually honor the request) and reflects the results back
- * to the embedded application.
+ * This procedure is invoked when an embedded application requests a
+ * particular size. It processes the request (which may or may not
+ * actually honor the request) and reflects the results back to the
+ * embedded application.
*
* NOTE: On the Mac, this is a stub, since we don't synthesize
* ConfigureRequest events.
@@ -1022,10 +997,10 @@ EmbedFocusProc(
* None.
*
* Side effects:
- * If we deny the child's size change request, a Configure event
- * is synthesized to let the child know how big it ought to be.
- * Events get processed while we're waiting for the geometry
- * managers to do their thing.
+ * If we deny the child's size change request, a Configure event is
+ * synthesized to let the child know how big it ought to be. Events get
+ * processed while we're waiting for the geometry managers to do their
+ * thing.
*
*----------------------------------------------------------------------
*/
@@ -1038,13 +1013,13 @@ EmbedGeometryRequest(
TkWindow *winPtr = containerPtr->parentPtr;
/*
- * Forward the requested size into our geometry management hierarchy
- * via the container window. We need to send a Configure event back
- * to the embedded application if we decide not to honor its
- * request; to make this happen, process all idle event handlers
- * synchronously here (so that the geometry managers have had a
- * chance to do whatever they want to do), and if the window's size
- * didn't change then generate a configure event.
+ * Forward the requested size into our geometry management hierarchy via
+ * the container window. We need to send a Configure event back to the
+ * embedded application if we decide not to honor its request; to make
+ * this happen, process all idle event handlers synchronously here (so
+ * that the geometry managers have had a chance to do whatever they want
+ * to do), and if the window's size didn't change then generate a
+ * configure event.
*/
Tk_GeometryRequest((Tk_Window) winPtr, width, height);
@@ -1062,13 +1037,12 @@ EmbedGeometryRequest(
*
* EmbedSendConfigure --
*
- * This is currently a stub. It is called to notify an
- * embedded application of its current size and location. This
- * procedure is called when the embedded application made a
- * geometry request that we did not grant, so that the embedded
- * application knows that its geometry didn't change after all.
- * It is a response to ConfigureRequest events, which we do not
- * currently synthesize on the Mac
+ * This is currently a stub. It is called to notify an embedded
+ * application of its current size and location. This procedure is called
+ * when the embedded application made a geometry request that we did not
+ * grant, so that the embedded application knows that its geometry didn't
+ * change after all. It is a response to ConfigureRequest events, which
+ * we do not currently synthesize on the Mac
*
* Results:
* None.
@@ -1090,9 +1064,9 @@ EmbedSendConfigure(
*
* EmbedWindowDeleted --
*
- * This procedure is invoked when a window involved in embedding
- * (as either the container or the embedded application) is
- * destroyed. It cleans up the Container structure for the window.
+ * This procedure is invoked when a window involved in embedding (as
+ * either the container or the embedded application) is destroyed. It
+ * cleans up the Container structure for the window.
*
* Results:
* None.
@@ -1111,16 +1085,14 @@ EmbedWindowDeleted(
Container *containerPtr, *prevPtr;
/*
- * Find the Container structure for this window. Delete the
- * information about the embedded application and free the container's
- * record.
+ * Find the Container structure for this window. Delete the information
+ * about the embedded application and free the container's record.
*/
prevPtr = NULL;
containerPtr = firstContainerPtr;
while (1) {
if (containerPtr->embeddedPtr == winPtr) {
-
/*
* We also have to destroy our parent, to clean up the container.
* Fabricate an event to do this.
@@ -1131,20 +1103,18 @@ EmbedWindowDeleted(
XEvent event;
event.xany.serial =
- Tk_Display(containerPtr->parentPtr)->request;
- event.xany.send_event = False;
- event.xany.display = Tk_Display(containerPtr->parentPtr);
-
- event.xany.type = DestroyNotify;
- event.xany.window = containerPtr->parent;
- event.xdestroywindow.event = containerPtr->parent;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_HEAD);
-
+ Tk_Display(containerPtr->parentPtr)->request;
+ event.xany.send_event = False;
+ event.xany.display = Tk_Display(containerPtr->parentPtr);
+
+ event.xany.type = DestroyNotify;
+ event.xany.window = containerPtr->parent;
+ event.xdestroywindow.event = containerPtr->parent;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_HEAD);
}
containerPtr->embedded = None;
containerPtr->embeddedPtr = NULL;
-
break;
}
if (containerPtr->parentPtr == winPtr) {
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 59418f5..fdaf9aa 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -8,10 +8,10 @@
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXInit.c,v 1.34 2007/12/13 15:27:09 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.35 2008/04/27 22:39:12 dkf Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -24,19 +24,20 @@
#include <mach-o/getsect.h>
/*
- * Define the following to 0 to not attempt to use an undocumented SPI
- * to notify the window server that an unbundled executable is a full
- * GUI application after loading Tk.
+ * Define the following to 0 to not attempt to use an undocumented SPI to
+ * notify the window server that an unbundled executable is a full GUI
+ * application after loading Tk.
*/
+
#ifndef MAC_OSX_TK_USE_CPS_SPI
#define MAC_OSX_TK_USE_CPS_SPI 1
#endif
/*
* The following structures are used to map the script/language codes of a
- * font to the name that should be passed to Tcl_GetEncoding() to obtain
- * the encoding for that font. The set of numeric constants is fixed and
- * defined by Apple.
+ * font to the name that should be passed to Tcl_GetEncoding() to obtain the
+ * encoding for that font. The set of numeric constants is fixed and defined
+ * by Apple.
*/
typedef struct Map {
@@ -83,13 +84,13 @@ static Map scriptMap[] = {
Tcl_Encoding TkMacOSXCarbonEncoding = NULL;
/*
- * If the App is in an App package, then we want to add the Scripts
- * directory to the auto_path.
+ * If the App is in an App package, then we want to add the Scripts directory
+ * to the auto_path.
*/
+
static char scriptPath[PATH_MAX + 1] = "";
float tkMacOSXToolboxVersionNumber = 0;
-
/*
*----------------------------------------------------------------------
@@ -100,8 +101,8 @@ float tkMacOSXToolboxVersionNumber = 0;
* tk_library variable.
*
* Results:
- * Returns a standard Tcl result. Leaves an error message or result
- * in the interp's result.
+ * Returns a standard Tcl result. Leaves an error message or result in
+ * the interp's result.
*
* Side effects:
* Sets "tk_library" Tcl variable, runs "tk.tcl" script.
@@ -119,9 +120,9 @@ TkpInit(
Tk_MacOSXSetupTkNotifier();
/*
- * Since it is possible for TkInit to be called multiple times
- * and we don't want to do the following initialization multiple times
- * we protect against doing it more than once.
+ * Since it is possible for TkInit to be called multiple times and we
+ * don't want to do the following initialization multiple times we protect
+ * against doing it more than once.
*/
if (!initialized) {
@@ -130,7 +131,7 @@ TkpInit(
CFURLRef bundleUrl = NULL;
CFStringEncoding encoding;
const char *encodingStr = NULL;
- int i;
+ int i;
struct utsname name;
long osVersion = 0;
@@ -145,7 +146,7 @@ TkpInit(
}
if (osVersion && osVersion < (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10) {
Tcl_Panic("Mac OS X 10.%d or later required !",
- (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10);
+ (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10);
}
TK_IF_MAC_OS_X_API (3, &kHIToolboxVersionNumber,
tkMacOSXToolboxVersionNumber = kHIToolboxVersionNumber;
@@ -174,7 +175,7 @@ TkpInit(
"com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 1, PATH_MAX,
tkLibPath) != TCL_OK)
#endif
- {
+ {
/* Tk.framework not found, check if resource file is open */
Handle rsrc = Get1NamedResource('CURS', "\phand");
if (rsrc) {
@@ -194,7 +195,7 @@ TkpInit(
image = _dyld_get_image_header(i);
if (image) {
data = getsectdatafromheader(image, SEG_TEXT,
- "__tk_rsrc", (void*)&size);
+ "__tk_rsrc", (void *) &size);
if (data) {
data += _dyld_get_image_vmaddr_slide(i);
break;
@@ -222,7 +223,7 @@ TkpInit(
if (write(fd, data, size) == -1) {
break;
}
- if(ChkErr(FSPathMakeRef, (unsigned char*)fileName, &ref,
+ if(ChkErr(FSPathMakeRef, (unsigned char *) fileName, &ref,
NULL) != noErr) {
break;
}
@@ -260,11 +261,14 @@ TkpInit(
* executable's url and compare the resulting url with the main
* bundle url.
*/
+
int j = 3;
CFURLRef url = CFBundleCopyExecutableURL(bundleRef);
+
while (url && j--) {
- CFURLRef parent = CFURLCreateCopyDeletingLastPathComponent(NULL,
- url);
+ CFURLRef parent =
+ CFURLCreateCopyDeletingLastPathComponent(NULL, url);
+
CFRelease(url);
url = parent;
}
@@ -275,8 +279,11 @@ TkpInit(
CFRelease(bundleUrl);
}
- /* If we are not a bundled executable, notify the window server that
- * we are a foregroundable app. */
+ /*
+ * If we are not a bundled executable, notify the window server that
+ * we are a foregroundable app.
+ */
+
if (!bundledExecutable) {
OSStatus err = procNotFound;
ProcessSerialNumber psn = { 0, kCurrentProcess };
@@ -293,6 +300,7 @@ TkpInit(
* server. Load the SPI symbol dynamically, so that we don't
* break if it ever disappears or changes its name.
*/
+
TkMacOSXInitNamedSymbol(CoreGraphics, OSStatus,
CPSEnableForegroundOperation, ProcessSerialNumberPtr);
if (CPSEnableForegroundOperation) {
@@ -327,8 +335,8 @@ TkpInit(
}
/*
- * FIXME: Close stdin & stdout for remote debugging otherwise we
- * will fight with gdb for stdin & stdout
+ * FIXME: Close stdin & stdout for remote debugging otherwise we will
+ * fight with gdb for stdin & stdout
*/
if (getenv("XCNOSTDIN") != NULL) {
@@ -389,9 +397,9 @@ TkpInit(
*
* TkpGetAppName --
*
- * Retrieves the name of the current application from a platform
- * specific location. For Unix, the application name is the tail
- * of the path contained in the tcl variable argv0.
+ * Retrieves the name of the current application from a platform specific
+ * location. For Unix, the application name is the tail of the path
+ * contained in the tcl variable argv0.
*
* Results:
* Returns the application name in the given Tcl_DString.
@@ -426,8 +434,8 @@ TkpGetAppName(
*
* TkpDisplayWarning --
*
- * This routines is called from Tk_Main to display warning
- * messages that occur during startup.
+ * This routines is called from Tk_Main to display warning messages that
+ * occur during startup.
*
* Results:
* None.
@@ -440,10 +448,11 @@ TkpGetAppName(
void
TkpDisplayWarning(
- CONST char *msg, /* Message to be displayed. */
- CONST char *title) /* Title of warning. */
+ const char *msg, /* Message to be displayed. */
+ const char *title) /* Title of warning. */
{
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
+
if (errChannel) {
Tcl_WriteChars(errChannel, title, -1);
Tcl_WriteChars(errChannel, ": ", 2);
@@ -457,13 +466,11 @@ TkpDisplayWarning(
*
* TkMacOSXDefaultStartupScript --
*
- *
- * On MacOS X, we look for a file in the Resources/Scripts
- * directory called AppMain.tcl and if found, we set argv[1] to
- * that, so that the rest of the code will find it, and add the
- * Scripts folder to the auto_path. If we don't find the startup
- * script, we just bag it, assuming the user is starting up some
- * other way.
+ * On MacOS X, we look for a file in the Resources/Scripts directory
+ * called AppMain.tcl and if found, we set argv[1] to that, so that the
+ * rest of the code will find it, and add the Scripts folder to the
+ * auto_path. If we don't find the startup script, we just bag it,
+ * assuming the user is starting up some other way.
*
* Results:
* None.
@@ -482,24 +489,21 @@ TkMacOSXDefaultStartupScript(void)
bundleRef = CFBundleGetMainBundle();
if (bundleRef != NULL) {
- CFURLRef appMainURL;
- appMainURL = CFBundleCopyResourceURL(bundleRef,
- CFSTR("AppMain"),
- CFSTR("tcl"),
- CFSTR("Scripts"));
+ CFURLRef appMainURL = CFBundleCopyResourceURL(bundleRef,
+ CFSTR("AppMain"), CFSTR("tcl"), CFSTR("Scripts"));
if (appMainURL != NULL) {
CFURLRef scriptFldrURL;
char startupScript[PATH_MAX + 1];
if (CFURLGetFileSystemRepresentation (appMainURL, true,
- (unsigned char*) startupScript, PATH_MAX)) {
- Tcl_SetStartupScript(Tcl_NewStringObj(startupScript, -1), NULL);
- scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(
- NULL, appMainURL);
+ (unsigned char *) startupScript, PATH_MAX)) {
+ Tcl_SetStartupScript(Tcl_NewStringObj(startupScript,-1), NULL);
+ scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(NULL,
+ appMainURL);
if (scriptFldrURL != NULL) {
- CFURLGetFileSystemRepresentation(scriptFldrURL,
- true, (unsigned char*) scriptPath, PATH_MAX);
+ CFURLGetFileSystemRepresentation(scriptFldrURL, true,
+ (unsigned char *) scriptPath, PATH_MAX);
CFRelease(scriptFldrURL);
}
}
@@ -513,11 +517,9 @@ TkMacOSXDefaultStartupScript(void)
*
* TkMacOSXGetNamedSymbol --
*
- *
- * Dynamically acquire address of a named symbol from a loaded
- * dynamic library, so that we can use API that may not be
- * available on all OS versions.
- * If module is non-NULL and not the empty string, use twolevel
+ * Dynamically acquire address of a named symbol from a loaded dynamic
+ * library, so that we can use API that may not be available on all OS
+ * versions. If module is non-NULL and not the empty string, use twolevel
* namespace lookup.
*
* Results:
@@ -535,18 +537,19 @@ TkMacOSXGetNamedSymbol(
const char* symbol)
{
NSSymbol nsSymbol = NULL;
+
if (module && *module) {
- if(NSIsSymbolNameDefinedWithHint(symbol, module)) {
+ if (NSIsSymbolNameDefinedWithHint(symbol, module)) {
nsSymbol = NSLookupAndBindSymbolWithHint(symbol, module);
}
} else {
- if(NSIsSymbolNameDefined(symbol)) {
+ if (NSIsSymbolNameDefined(symbol)) {
nsSymbol = NSLookupAndBindSymbol(symbol);
}
}
- if (nsSymbol) {
- return NSAddressOfSymbol(nsSymbol);
- } else {
+
+ if (!nsSymbol) {
return NULL;
}
+ return NSAddressOfSymbol(nsSymbol);
}
diff --git a/macosx/tkMacOSXSend.c b/macosx/tkMacOSXSend.c
index c65833b..50526d3 100644
--- a/macosx/tkMacOSXSend.c
+++ b/macosx/tkMacOSXSend.c
@@ -1,175 +1,171 @@
/*
* tkMacOSXSend.c --
*
- * This file provides procedures that implement the "send"
- * command, allowing commands to be passed from interpreter
- * to interpreter. This current implementation for the Mac
- * has most functionality stubed out.
- *
- * The current plan, which we have not had time to implement, is
- * for the first Wish app to create a gestalt of type 'WIsH'.
- * This gestalt will point to a table, in system memory, of
- * Tk apps. Each Tk app, when it starts up, will register their
- * name, and process ID, in this table. This will allow us to
- * implement "tk appname".
- *
- * Then the send command will look up the process id of the target
- * app in this table, and send an AppleEvent to that process. The
- * AppleEvent handler is much like the do script handler, except that
- * you have to specify the name of the tk app as well, since there may
- * be many interps in one wish app, and you need to send it to the
- * right one.
- *
- * Implementing this has been on our list of things to do, but what
- * with the demise of Tcl at Sun, and the lack of resources at
- * Scriptics it may not get done for awhile. So this sketch is
- * offered for the brave to attempt if they need the functionality...
+ * This file provides procedures that implement the "send" command,
+ * allowing commands to be passed from interpreter to interpreter. This
+ * current implementation for the Mac has most functionality stubed out.
+ *
+ * The current plan, which we have not had time to implement, is for the
+ * first Wish app to create a gestalt of type 'WIsH'. This gestalt will
+ * point to a table, in system memory, of Tk apps. Each Tk app, when it
+ * starts up, will register their name, and process ID, in this table.
+ * This will allow us to implement "tk appname".
+ *
+ * Then the send command will look up the process id of the target app in
+ * this table, and send an AppleEvent to that process. The AppleEvent
+ * handler is much like the do script handler, except that you have to
+ * specify the name of the tk app as well, since there may be many
+ * interps in one wish app, and you need to send it to the right one.
+ *
+ * Implementing this has been on our list of things to do, but what with
+ * the demise of Tcl at Sun, and the lack of resources at Scriptics it
+ * may not get done for awhile. So this sketch is offered for the brave
+ * to attempt if they need the functionality...
*
* Copyright (c) 1989-1994 The Regents of the University of California.
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXSend.c,v 1.8 2007/12/13 15:27:10 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXSend.c,v 1.9 2008/04/27 22:39:12 dkf Exp $
*/
#include "tkMacOSXInt.h"
/*
- * The following structure is used to keep track of the
- * interpreters registered by this process.
+ * The following structure is used to keep track of the interpreters
+ * registered by this process.
*/
typedef struct RegisteredInterp {
char *name; /* Interpreter's name (malloc-ed). */
- Tcl_Interp *interp; /* Interpreter associated with
- * name. */
+ Tcl_Interp *interp; /* Interpreter associated with name. */
struct RegisteredInterp *nextPtr;
- /* Next in list of names associated
- * with interps in this process.
- * NULL means end of list. */
+ /* Next in list of names associated with
+ * interps in this process. NULL means end of
+ * list. */
} RegisteredInterp;
/*
- * A registry of all interpreters for a display is kept in a
- * property "InterpRegistry" on the root window of the display.
- * It is organized as a series of zero or more concatenated strings
- * (in no particular order), each of the form
+ * A registry of all interpreters for a display is kept in a property
+ * "InterpRegistry" on the root window of the display. It is organized as a
+ * series of zero or more concatenated strings (in no particular order), each
+ * of the form
* window space name '\0'
- * where "window" is the hex id of the comm. window to use to talk
- * to an interpreter named "name".
+ * where "window" is the hex id of the comm. window to use to talk to an
+ * interpreter named "name".
*
- * When the registry is being manipulated by an application (e.g. to
- * add or remove an entry), it is loaded into memory using a structure
- * of the following type:
+ * When the registry is being manipulated by an application (e.g. to add or
+ * remove an entry), it is loaded into memory using a structure of the
+ * following type:
*/
typedef struct NameRegistry {
TkDisplay *dispPtr; /* Display from which the registry was
* read. */
- int locked; /* Non-zero means that the display was
- * locked when the property was read in. */
- int modified; /* Non-zero means that the property has
- * been modified, so it needs to be written
- * out when the NameRegistry is closed. */
+ int locked; /* Non-zero means that the display was locked
+ * when the property was read in. */
+ int modified; /* Non-zero means that the property has been
+ * modified, so it needs to be written out
+ * when the NameRegistry is closed. */
unsigned long propLength; /* Length of the property, in bytes. */
- char *property; /* The contents of the property, or NULL
- * if none. See format description above;
- * this is *not* terminated by the first
- * null character. Dynamically allocated. */
+ char *property; /* The contents of the property, or NULL if
+ * none. See format description above; this is
+ * *not* terminated by the first null
+ * character. Dynamically allocated. */
int allocedByX; /* Non-zero means must free property with
* XFree; zero means use ckfree. */
} NameRegistry;
-static int initialized = false; /* A flag to denote if we have initialized yet. */
+static int initialized = false; /* A flag to denote if we have initialized
+ * yet. */
static RegisteredInterp *interpListPtr = NULL;
-/* List of all interpreters
- * registered by this process. */
-
- /*
- * The information below is used for communication between processes
- * during "send" commands. Each process keeps a private window, never
- * even mapped, with one property, "Comm". When a command is sent to
- * an interpreter, the command is appended to the comm property of the
- * communication window associated with the interp's process. Similarly,
- * when a result is returned from a sent command, it is also appended
- * to the comm property.
- *
- * Each command and each result takes the form of ASCII text. For a
- * command, the text consists of a zero character followed by several
- * null-terminated ASCII strings. The first string consists of the
- * single letter "c". Subsequent strings have the form "option value"
- * where the following options are supported:
- *
- * -r commWindow serial
- *
- * This option means that a response should be sent to the window
- * whose X identifier is "commWindow" (in hex), and the response should
- * be identified with the serial number given by "serial" (in decimal).
- * If this option isn't specified then the send is asynchronous and
- * no response is sent.
- *
- * -n name
- * "Name" gives the name of the application for which the command is
- * intended. This option must be present.
- *
- * -s script
- *
- * "Script" is the script to be executed. This option must be present.
- *
- * The options may appear in any order. The -n and -s options must be
- * present, but -r may be omitted for asynchronous RPCs. For compatibility
- * with future releases that may add new features, there may be additional
- * options present; as long as they start with a "-" character, they will
- * be ignored.
- *
- * A result also consists of a zero character followed by several null-
- * terminated ASCII strings. The first string consists of the single
- * letter "r". Subsequent strings have the form "option value" where
- * the following options are supported:
- *
- * -s serial
- *
- * Identifies the command for which this is the result. It is the
- * same as the "serial" field from the -s option in the command. This
- * option must be present.
- *
- * -c code
- *
- * "Code" is the completion code for the script, in decimal. If the
- * code is omitted it defaults to TCL_OK.
- *
- * -r result
- *
- * "Result" is the result string for the script, which may be either
- * a result or an error message. If this field is omitted then it
- * defaults to an empty string.
- *
- * -i errorInfo
- *
- * "ErrorInfo" gives a string with which to initialize the errorInfo
- * variable. This option may be omitted; it is ignored unless the
- * completion code is TCL_ERROR.
- *
- * -e errorCode
- *
- * "ErrorCode" gives a string with with to initialize the errorCode
- * variable. This option may be omitted; it is ignored unless the
- * completion code is TCL_ERROR.
- *
- * Options may appear in any order, and only the -s option must be
- * present. As with commands, there may be additional options besides
- * these; unknown options are ignored.
- */
-
- /*
- * Maximum size property that can be read at one time by
- * this module:
- */
+ /* List of all interpreters registered by this
+ * process. */
+
+/*
+ * The information below is used for communication between processes during
+ * "send" commands. Each process keeps a private window, never even mapped,
+ * with one property, "Comm". When a command is sent to an interpreter, the
+ * command is appended to the comm property of the communication window
+ * associated with the interp's process. Similarly, when a result is returned
+ * from a sent command, it is also appended to the comm property.
+ *
+ * Each command and each result takes the form of ASCII text. For a command,
+ * the text consists of a zero character followed by several null-terminated
+ * ASCII strings. The first string consists of the single letter "c".
+ * Subsequent strings have the form "option value" where the following options
+ * are supported:
+ *
+ * -r commWindow serial
+ *
+ * This option means that a response should be sent to the window whose X
+ * identifier is "commWindow" (in hex), and the response should be
+ * identified with the serial number given by "serial" (in decimal). If
+ * this option isn't specified then the send is asynchronous and no
+ * response is sent.
+ *
+ * -n name
+ *
+ * "Name" gives the name of the application for which the command is
+ * intended. This option must be present.
+ *
+ * -s script
+ *
+ * "Script" is the script to be executed. This option must be present.
+ *
+ * The options may appear in any order. The -n and -s options must be present,
+ * but -r may be omitted for asynchronous RPCs. For compatibility with future
+ * releases that may add new features, there may be additional options
+ * present; as long as they start with a "-" character, they will be ignored.
+ *
+ *
+ * A result also consists of a zero character followed by several null-
+ * terminated ASCII strings. The first string consists of the single letter
+ * "r". Subsequent strings have the form "option value" where the following
+ * options are supported:
+ *
+ * -s serial
+ *
+ * Identifies the command for which this is the result. It is the same as
+ * the "serial" field from the -s option in the command. This option must
+ * be present.
+ *
+ * -c code
+ *
+ * "Code" is the completion code for the script, in decimal. If the code
+ * is omitted it defaults to TCL_OK.
+ *
+ * -r result
+ *
+ * "Result" is the result string for the script, which may be either a
+ * result or an error message. If this field is omitted then it defaults
+ * to an empty string.
+ *
+ * -i errorInfo
+ *
+ * "ErrorInfo" gives a string with which to initialize the errorInfo
+ * variable. This option may be omitted; it is ignored unless the
+ * completion code is TCL_ERROR.
+ *
+ * -e errorCode
+ *
+ * "ErrorCode" gives a string with with to initialize the errorCode
+ * variable. This option may be omitted; it is ignored unless the
+ * completion code is TCL_ERROR.
+ *
+ * Options may appear in any order, and only the -s option must be present. As
+ * with commands, there may be additional options besides these; unknown
+ * options are ignored.
+ */
+
+/*
+ * Maximum size property that can be read at one time by this module:
+ */
#define MAX_PROP_WORDS 100000
@@ -178,7 +174,6 @@ static RegisteredInterp *interpListPtr = NULL;
*/
static int SendInit(Tcl_Interp *interp);
-
/*
*--------------------------------------------------------------
@@ -186,34 +181,33 @@ static int SendInit(Tcl_Interp *interp);
* Tk_SetAppName --
*
* This procedure is called to associate an ASCII name with a Tk
- * application. If the application has already been named, the
- * name replaces the old one.
+ * application. If the application has already been named, the name
+ * replaces the old one.
*
* Results:
- * The return value is the name actually given to the application.
- * This will normally be the same as name, but if name was already
- * in use for an application then a name of the form "name #2" will
- * be chosen, with a high enough number to make the name unique.
+ * The return value is the name actually given to the application. This
+ * will normally be the same as name, but if name was already in use for
+ * an application then a name of the form "name #2" will be chosen, with
+ * a high enough number to make the name unique.
*
* Side effects:
- * Registration info is saved, thereby allowing the "send" command
- * to be used later to invoke commands in the application. In
- * addition, the "send" command is created in the application's
- * interpreter. The registration will be removed automatically
- * if the interpreter is deleted or the "send" command is removed.
+ * Registration info is saved, thereby allowing the "send" command to be
+ * used later to invoke commands in the application. In addition, the
+ * "send" command is created in the application's interpreter. The
+ * registration will be removed automatically if the interpreter is
+ * deleted or the "send" command is removed.
*
*--------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_SetAppName(
- Tk_Window tkwin, /* Token for any window in the application
- * to be named: it is just used to identify
- * the application and the display. */
- CONST char *name) /* The name that will be used to
- * refer to the interpreter in later
- * "send" commands. Must be globally
- * unique. */
+ Tk_Window tkwin, /* Token for any window in the application to
+ * be named: it is just used to identify the
+ * application and the display. */
+ const char *name) /* The name that will be used to refer to the
+ * interpreter in later "send" commands. Must
+ * be globally unique. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
Tcl_Interp *interp = winPtr->mainPtr->interp;
@@ -229,9 +223,9 @@ Tk_SetAppName(
}
/*
- * See if the application is already registered; if so, remove its
- * current name from the registry. The deletion of the command
- * will take care of disposing of this entry.
+ * See if the application is already registered; if so, remove its current
+ * name from the registry. The deletion of the command will take care of
+ * disposing of this entry.
*/
for (riPtr = interpListPtr, prevPtr = NULL; riPtr != NULL;
@@ -247,10 +241,9 @@ Tk_SetAppName(
}
/*
- * Pick a name to use for the application. Use "name" if it's not
- * already in use. Otherwise add a suffix such as " #2", trying
- * larger and larger numbers until we eventually find one that is
- * unique.
+ * Pick a name to use for the application. Use "name" if it's not already
+ * in use. Otherwise add a suffix such as " #2", trying larger and larger
+ * numbers until we eventually find one that is unique.
*/
actualName = name;
@@ -301,8 +294,7 @@ Tk_SetAppName(
* TODO: DeleteProc
*/
- Tcl_CreateObjCommand(interp, "send", Tk_SendObjCmd,
- (ClientData) riPtr, NULL);
+ Tcl_CreateObjCommand(interp, "send", Tk_SendObjCmd, riPtr, NULL);
if (Tcl_IsSafe(interp)) {
Tcl_HideCommand(interp, "send", "send");
}
@@ -316,8 +308,8 @@ Tk_SetAppName(
*
* Tk_SendObjCmd --
*
- * This procedure is invoked to process the "send" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "send" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -333,7 +325,7 @@ Tk_SendObjCmd(
ClientData clientData, /* Used only for deletion */
Tcl_Interp *interp, /* The interp we are sending from */
int objc, /* Number of arguments */
- Tcl_Obj *CONST objv[]) /* The arguments */
+ Tcl_Obj *const objv[]) /* The arguments */
{
const char *sendOptions[] = {"-async", "-displayof", "-", NULL};
char *stringRep, *destName;
@@ -375,11 +367,10 @@ Tk_SendObjCmd(
resultPtr = Tcl_GetObjResult(interp);
/*
- * See if the target interpreter is local. If so, execute
- * the command directly without going through the DDE server.
- * The only tricky thing is passing the result from the target
- * interpreter to the invoking interpreter. Watch out: they
- * could be the same!
+ * See if the target interpreter is local. If so, execute the command
+ * directly without going through the DDE server. The only tricky thing is
+ * passing the result from the target interpreter to the invoking
+ * interpreter. Watch out: they could be the same!
*/
for (riPtr = interpListPtr; (riPtr != NULL)
@@ -387,29 +378,29 @@ Tk_SendObjCmd(
/*
* Empty loop body.
*/
-
}
if (riPtr != NULL) {
/*
- * This command is to a local interp. No need to go through
- * the server.
+ * This command is to a local interp. No need to go through the
+ * server.
*/
Tcl_Interp *localInterp;
- Tcl_Preserve((ClientData) riPtr);
+ Tcl_Preserve(riPtr);
localInterp = riPtr->interp;
- Tcl_Preserve((ClientData) localInterp);
+ Tcl_Preserve(localInterp);
if (firstArg == (objc - 1)) {
/*
- * This might be one of those cases where the new
- * parser is faster.
+ * This might be one of those cases where the new parser is
+ * faster.
*/
- result = Tcl_EvalObjEx(localInterp, objv[firstArg], TCL_EVAL_DIRECT);
+ result = Tcl_EvalObjEx(localInterp, objv[firstArg],
+ TCL_EVAL_DIRECT);
} else {
- listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
+ listObjPtr = Tcl_NewListObj(0, NULL);
for (i = firstArg; i < objc; i++) {
Tcl_ListObjAppendList(interp, listObjPtr, objv[i]);
}
@@ -425,9 +416,9 @@ Tk_SendObjCmd(
* An error occurred, so transfer error information from the
* destination interpreter back to our interpreter. Must clear
* interp's result before calling Tcl_AddErrorInfo, since
- * Tcl_AddErrorInfo will store the interp's result in errorInfo
- * before appending riPtr's $errorInfo; we've already got
- * everything we need in riPtr's $errorInfo.
+ * Tcl_AddErrorInfo will store the interp's result in
+ * errorInfo before appending riPtr's $errorInfo; we've
+ * already got everything we need in riPtr's $errorInfo.
*/
Tcl_ResetResult(interp);
@@ -439,12 +430,12 @@ Tk_SendObjCmd(
}
Tcl_SetObjResult(interp, Tcl_GetObjResult(localInterp));
}
- Tcl_Release((ClientData) riPtr);
- Tcl_Release((ClientData) localInterp);
+ Tcl_Release(riPtr);
+ Tcl_Release(localInterp);
} else {
/*
- * TODO: This is a non-local request. Send the script to the server and
- * poll it for a result.
+ * TODO: This is a non-local request. Send the script to the server
+ * and poll it for a result.
*/
}
@@ -456,15 +447,14 @@ Tk_SendObjCmd(
*
* TkGetInterpNames --
*
- * This procedure is invoked to fetch a list of all the
- * interpreter names currently registered for the display
- * of a particular window.
+ * This procedure is invoked to fetch a list of all the interpreter names
+ * currently registered for the display of a particular window.
*
* Results:
- * A standard Tcl return value. Interp->result will be set
- * to hold a list of all the interpreter names defined for
- * tkwin's display. If an error occurs, then TCL_ERROR
- * is returned and interp->result will hold an error message.
+ * A standard Tcl return value. Interp->result will be set to hold a list
+ * of all the interpreter names defined for tkwin's display. If an error
+ * occurs, then TCL_ERROR is returned and interp->result will hold an
+ * error message.
*
* Side effects:
* None.
@@ -475,13 +465,13 @@ Tk_SendObjCmd(
int
TkGetInterpNames(
Tcl_Interp *interp, /* Interpreter for returning a result. */
- Tk_Window tkwin) /* Window whose display is to be used
- * for the lookup. */
+ Tk_Window tkwin) /* Window whose display is to be used for the
+ * lookup. */
{
Tcl_Obj *listObjPtr;
RegisteredInterp *riPtr;
- listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
+ listObjPtr = Tcl_NewListObj(0, NULL);
riPtr = interpListPtr;
while (riPtr != NULL) {
Tcl_ListObjAppendElement(interp, listObjPtr,
@@ -498,9 +488,8 @@ TkGetInterpNames(
*
* SendInit --
*
- * This procedure is called to initialize the
- * communication channels for sending commands and
- * receiving results.
+ * This procedure is called to initialize the communication channels for
+ * sending commands and receiving results.
*
* Results:
* None.
@@ -513,8 +502,8 @@ TkGetInterpNames(
static int
SendInit(
- Tcl_Interp *interp) /* Interpreter to use for error reporting
- * (no errors are ever returned, but the
+ Tcl_Interp *interp) /* Interpreter to use for error reporting (no
+ * errors are ever returned, but the
* interpreter is needed anyway). */
{
return TCL_OK;
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 7fbde07..688d8ed 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -2,18 +2,18 @@
* tkMacOSXWm.c --
*
* This module takes care of the interactions between a Tk-based
- * application and the window manager. Among other things, it
- * implements the "wm" command and passes geometry information
- * to the window manager.
+ * application and the window manager. Among other things, it implements
+ * the "wm" command and passes geometry information to the window
+ * manager.
*
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXWm.c,v 1.63 2007/12/13 15:27:10 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.64 2008/04/27 22:39:12 dkf Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -52,25 +52,24 @@ static const char *WmAttributeNames[] = {
TkMacOSXWindowList *tkMacOSXWindowListPtr = NULL;
/*
- * The variable below is used to enable or disable tracing in this
- * module. If tracing is enabled, then information is printed on
- * standard output about interesting interactions with the window
- * manager.
+ * The variable below is used to enable or disable tracing in this module. If
+ * tracing is enabled, then information is printed on standard output about
+ * interesting interactions with the window manager.
*/
static int wmTracing = 0;
/*
- * The following structure is the official type record for geometry
- * management of top-level windows.
+ * The following structure is the official type record for geometry management
+ * of top-level windows.
*/
static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
static const Tk_GeomMgr wmMgrType = {
- "wm", /* name */
- TopLevelReqProc, /* requestProc */
- (Tk_GeomLostSlaveProc *) NULL, /* lostSlaveProc */
+ "wm", /* name */
+ TopLevelReqProc, /* requestProc */
+ NULL, /* lostSlaveProc */
};
/*
@@ -174,16 +173,14 @@ static WindowGroupRef WmGetWindowGroup(TkWindow *winPtr);
static void GetMinSize(TkWindow *winPtr, int *minWidthPtr, int *minHeightPtr);
static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr, int *maxHeightPtr);
static void RemapWindows(TkWindow *winPtr, MacDrawable *parentWin);
-
/*
*----------------------------------------------------------------------
*
* TkWmNewWindow --
*
- * This procedure is invoked whenever a new top-level
- * window is created. Its job is to initialize the WmInfo
- * structure for the window.
+ * This procedure is invoked whenever a new top-level window is created.
+ * Its job is to initialize the WmInfo structure for the window.
*
* Results:
* None.
@@ -198,9 +195,8 @@ void
TkWmNewWindow(
TkWindow *winPtr) /* Newly-created top-level window. */
{
- WmInfo *wmPtr;
+ WmInfo *wmPtr = (WmInfo *) ckalloc(sizeof(WmInfo));
- wmPtr = (WmInfo *) ckalloc(sizeof(WmInfo));
wmPtr->winPtr = winPtr;
wmPtr->reparent = None;
wmPtr->titleUid = NULL;
@@ -233,9 +229,9 @@ TkWmNewWindow(
wmPtr->x = winPtr->changes.x;
wmPtr->y = winPtr->changes.y;
wmPtr->parentWidth = winPtr->changes.width
- + 2*winPtr->changes.border_width;
+ + 2*winPtr->changes.border_width;
wmPtr->parentHeight = winPtr->changes.height
- + 2*winPtr->changes.border_width;
+ + 2*winPtr->changes.border_width;
wmPtr->xInParent = 0;
wmPtr->yInParent = 0;
wmPtr->cmapList = NULL;
@@ -259,16 +255,16 @@ TkWmNewWindow(
UpdateVRootGeometry(wmPtr);
/*
- * Tk must monitor structure events for top-level windows, in order
- * to detect size and position changes caused by window managers.
+ * Tk must monitor structure events for top-level windows, in order to
+ * detect size and position changes caused by window managers.
*/
Tk_CreateEventHandler((Tk_Window) winPtr, StructureNotifyMask,
- TopLevelEventProc, (ClientData) winPtr);
+ TopLevelEventProc, winPtr);
/*
- * Arrange for geometry requests to be reflected from the window
- * to the window manager.
+ * Arrange for geometry requests to be reflected from the window to the
+ * window manager.
*/
Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, (ClientData) 0);
@@ -279,28 +275,28 @@ TkWmNewWindow(
*
* TkWmMapWindow --
*
- * This procedure is invoked to map a top-level window. This
- * module gets a chance to update all window-manager-related
- * information in properties before the window manager sees
- * the map event and checks the properties. It also gets to
- * decide whether or not to even map the window after all.
+ * This procedure is invoked to map a top-level window. This module gets
+ * a chance to update all window-manager-related information in
+ * properties before the window manager sees the map event and checks the
+ * properties. It also gets to decide whether or not to even map the
+ * window after all.
*
* Results:
* None.
*
* Side effects:
- * Properties of winPtr may get updated to provide up-to-date
- * information to the window manager. The window may also get
- * mapped, but it may not be if this procedure decides that
- * isn't appropriate (e.g. because the window is withdrawn).
+ * Properties of winPtr may get updated to provide up-to-date information
+ * to the window manager. The window may also get mapped, but it may not
+ * be if this procedure decides that isn't appropriate (e.g. because the
+ * window is withdrawn).
*
*----------------------------------------------------------------------
*/
void
TkWmMapWindow(
- TkWindow *winPtr) /* Top-level window that's about to
- * be mapped. */
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -310,6 +306,7 @@ TkWmMapWindow(
/*
* Create the underlying Mac window for this Tk window.
*/
+
if (!TkMacOSXHostToplevelExists(winPtr)) {
TkMacOSXMakeRealWindowExist(winPtr);
}
@@ -321,9 +318,8 @@ TkWmMapWindow(
TK_LOCATION_CHANGED);
/*
- * This is the first time this window has ever been mapped.
- * Store all the window-manager-related information for the
- * window.
+ * This is the first time this window has ever been mapped. Store all
+ * the window-manager-related information for the window.
*/
if (wmPtr->titleUid == NULL) {
@@ -357,11 +353,12 @@ TkWmMapWindow(
/*
* Update geometry information.
*/
+
wmPtr->flags |= WM_ABOUT_TO_MAP;
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tk_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tk_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
- UpdateGeometryInfo((ClientData) winPtr);
+ UpdateGeometryInfo(winPtr);
wmPtr->flags &= ~WM_ABOUT_TO_MAP;
/*
@@ -376,8 +373,8 @@ TkWmMapWindow(
*
* TkWmUnmapWindow --
*
- * This procedure is invoked to unmap a top-level window.
- * On the Macintosh all we do is call XUnmapWindow.
+ * This procedure is invoked to unmap a top-level window. On the
+ * Macintosh all we do is call XUnmapWindow.
*
* Results:
* None.
@@ -390,8 +387,8 @@ TkWmMapWindow(
void
TkWmUnmapWindow(
- TkWindow *winPtr) /* Top-level window that's about to
- * be mapped. */
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
{
XUnmapWindow(winPtr->display, winPtr->window);
}
@@ -401,9 +398,8 @@ TkWmUnmapWindow(
*
* TkWmDeadWindow --
*
- * This procedure is invoked when a top-level window is
- * about to be deleted. It cleans up the wm-related data
- * structures for the window.
+ * This procedure is invoked when a top-level window is about to be
+ * deleted. It cleans up the wm-related data structures for the window.
*
* Results:
* None.
@@ -450,7 +446,7 @@ TkWmDeadWindow(
protPtr = wmPtr->protPtr;
wmPtr->protPtr = protPtr->nextPtr;
- Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
}
if (wmPtr->cmdArgv != NULL) {
ckfree((char *) wmPtr->cmdArgv);
@@ -459,7 +455,7 @@ TkWmDeadWindow(
ckfree((char *) wmPtr->clientMachine);
}
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tk_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tk_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
ckfree((char *) wmPtr);
winPtr->wmInfoPtr = NULL;
@@ -470,11 +466,10 @@ TkWmDeadWindow(
*
* TkWmSetClass --
*
- * This procedure is invoked whenever a top-level window's
- * class is changed. If the window has been mapped then this
- * procedure updates the window manager property for the
- * class. If the window hasn't been mapped, the update is
- * deferred until just before the first mapping.
+ * This procedure is invoked whenever a top-level window's class is
+ * changed. If the window has been mapped then this procedure updates the
+ * window manager property for the class. If the window hasn't been
+ * mapped, the update is deferred until just before the first mapping.
*
* Results:
* None.
@@ -497,8 +492,8 @@ TkWmSetClass(
*
* Tk_WmObjCmd --
*
- * This procedure is invoked to process the "wm" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -543,7 +538,7 @@ Tk_WmObjCmd(
TkWindow *winPtr;
if (objc < 2) {
-wrongNumArgs:
+ wrongNumArgs:
Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?");
return TCL_ERROR;
}
@@ -563,7 +558,7 @@ wrongNumArgs:
}
if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
- &index) != TCL_OK) {
+ &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -576,78 +571,77 @@ wrongNumArgs:
return TCL_ERROR;
}
if (!Tk_IsTopLevel(winPtr)
- && (index != WMOPT_MANAGE) && (index != WMOPT_FORGET)
- ) {
+ && (index != WMOPT_MANAGE) && (index != WMOPT_FORGET)) {
Tcl_AppendResult(interp, "window \"", winPtr->pathName,
"\" isn't a top-level window", NULL);
return TCL_ERROR;
}
switch ((enum options) index) {
- case WMOPT_ASPECT:
- return WmAspectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ATTRIBUTES:
- return WmAttributesCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_CLIENT:
- return WmClientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COLORMAPWINDOWS:
- return WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COMMAND:
- return WmCommandCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_DEICONIFY:
- return WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FOCUSMODEL:
- return WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FORGET:
- return WmForgetCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FRAME:
- return WmFrameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GEOMETRY:
- return WmGeometryCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GRID:
- return WmGridCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GROUP:
- return WmGroupCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONBITMAP:
- return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONIFY:
- return WmIconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONMASK:
- return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONNAME:
- return WmIconnameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONPHOTO:
- return WmIconphotoCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONPOSITION:
- return WmIconpositionCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONWINDOW:
- return WmIconwindowCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MANAGE:
- return WmManageCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MAXSIZE:
- return WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MINSIZE:
- return WmMinsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_OVERRIDEREDIRECT:
- return WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_POSITIONFROM:
- return WmPositionfromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_PROTOCOL:
- return WmProtocolCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_RESIZABLE:
- return WmResizableCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_SIZEFROM:
- return WmSizefromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STACKORDER:
- return WmStackorderCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STATE:
- return WmStateCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TITLE:
- return WmTitleCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TRANSIENT:
- return WmTransientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_WITHDRAW:
- return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ASPECT:
+ return WmAspectCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ATTRIBUTES:
+ return WmAttributesCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_CLIENT:
+ return WmClientCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_COLORMAPWINDOWS:
+ return WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_COMMAND:
+ return WmCommandCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_DEICONIFY:
+ return WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FOCUSMODEL:
+ return WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FORGET:
+ return WmForgetCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FRAME:
+ return WmFrameCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_GEOMETRY:
+ return WmGeometryCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_GRID:
+ return WmGridCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_GROUP:
+ return WmGroupCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONBITMAP:
+ return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONIFY:
+ return WmIconifyCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONMASK:
+ return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONNAME:
+ return WmIconnameCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONPHOTO:
+ return WmIconphotoCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONPOSITION:
+ return WmIconpositionCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONWINDOW:
+ return WmIconwindowCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MANAGE:
+ return WmManageCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MAXSIZE:
+ return WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MINSIZE:
+ return WmMinsizeCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_OVERRIDEREDIRECT:
+ return WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_POSITIONFROM:
+ return WmPositionfromCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_PROTOCOL:
+ return WmProtocolCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_RESIZABLE:
+ return WmResizableCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_SIZEFROM:
+ return WmSizefromCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_STACKORDER:
+ return WmStackorderCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_STATE:
+ return WmStateCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_TITLE:
+ return WmTitleCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_TRANSIENT:
+ return WmTransientCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_WITHDRAW:
+ return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv);
}
/* This should not happen */
@@ -659,8 +653,8 @@ wrongNumArgs:
*
* WmAspectCmd --
*
- * This procedure is invoked to process the "wm aspect" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm aspect" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -702,15 +696,14 @@ WmAspectCmd(
wmPtr->sizeHintsFlags &= ~PAspect;
} else {
if ((Tcl_GetIntFromObj(interp, objv[3], &numer1) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &denom1) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) {
+ || (Tcl_GetIntFromObj(interp, objv[4], &denom1) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) {
return TCL_ERROR;
}
if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) ||
- (denom2 <= 0)) {
- Tcl_SetResult(interp, "aspect number can't be <= 0",
- TCL_STATIC);
+ (denom2 <= 0)) {
+ Tcl_SetResult(interp, "aspect number can't be <= 0", TCL_STATIC);
return TCL_ERROR;
}
wmPtr->minAspect.x = numer1;
@@ -729,17 +722,19 @@ WmAspectCmd(
*
* WmSetAttribute --
*
- * Helper routine for WmAttributesCmd. Sets the value
- * of the specified attribute.
+ * Helper routine for WmAttributesCmd. Sets the value of the specified
+ * attribute.
*
* Returns:
*
- * TCL_OK if successful, TCL_ERROR otherwise. In case of an
- * error, leaves a message in the interpreter's result.
+ * TCL_OK if successful, TCL_ERROR otherwise. In case of an error, leaves
+ * a message in the interpreter's result.
*
*----------------------------------------------------------------------
*/
-static int WmSetAttribute(
+
+static int
+WmSetAttribute(
TkWindow *winPtr, /* Toplevel to work with */
WindowRef macWindow,
Tcl_Interp *interp, /* Current interpreter */
@@ -750,152 +745,150 @@ static int WmSetAttribute(
int boolean;
switch (attribute) {
- case WMATT_ALPHA: {
- double dval;
+ case WMATT_ALPHA: {
+ double dval;
- if (Tcl_GetDoubleFromObj(interp, value, &dval) != TCL_OK) {
- return TCL_ERROR;
- }
- /*
- * The user should give (transparent) 0 .. 1.0 (opaque)
- */
- if (dval < 0.0) {
- dval = 0.0;
- } else if (dval > 1.0) {
- dval = 1.0;
- }
- ChkErr(SetWindowAlpha, macWindow, dval);
- break;
+ if (Tcl_GetDoubleFromObj(interp, value, &dval) != TCL_OK) {
+ return TCL_ERROR;
}
- case WMATT_FULLSCREEN:
- if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
- return TCL_ERROR;
- }
- if (boolean != ((wmPtr->flags & WM_FULLSCREEN) != 0)) {
- if(TkMacOSXMakeFullscreen(winPtr, macWindow, boolean, interp)
- != TCL_OK) {
- return TCL_ERROR;
- }
- }
- break;
- case WMATT_MODIFIED:
- if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
- return TCL_ERROR;
- }
- if (boolean != IsWindowModified(macWindow)) {
- ChkErr(SetWindowModified, macWindow, boolean);
- }
- break;
- case WMATT_NOTIFY:
- if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+
+ /*
+ * The user should give (transparent) 0 .. 1.0 (opaque)
+ */
+
+ if (dval < 0.0) {
+ dval = 0.0;
+ } else if (dval > 1.0) {
+ dval = 1.0;
+ }
+ ChkErr(SetWindowAlpha, macWindow, dval);
+ break;
+ }
+ case WMATT_FULLSCREEN:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean != ((wmPtr->flags & WM_FULLSCREEN) != 0)) {
+ if (TkMacOSXMakeFullscreen(winPtr, macWindow, boolean, interp)
+ != TCL_OK) {
return TCL_ERROR;
}
- if (boolean == !tkMacOSXWmAttrNotifyVal) {
- static NMRec notifyRec;
-
- if (boolean) {
- bzero(&notifyRec, sizeof(notifyRec));
- notifyRec.qType = nmType;
- notifyRec.nmMark = 1;
- ChkErr(NMInstall, &notifyRec);
- } else {
- ChkErr(NMRemove, &notifyRec);
- }
- tkMacOSXWmAttrNotifyVal = boolean;
+ }
+ break;
+ case WMATT_MODIFIED:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean != IsWindowModified(macWindow)) {
+ ChkErr(SetWindowModified, macWindow, boolean);
+ }
+ break;
+ case WMATT_NOTIFY:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean == !tkMacOSXWmAttrNotifyVal) {
+ static NMRec notifyRec;
+
+ if (boolean) {
+ bzero(&notifyRec, sizeof(notifyRec));
+ notifyRec.qType = nmType;
+ notifyRec.nmMark = 1;
+ ChkErr(NMInstall, &notifyRec);
+ } else {
+ ChkErr(NMRemove, &notifyRec);
}
- break;
- case WMATT_TITLEPATH: {
- const char *path;
- OSStatus err;
-
- path = Tcl_FSGetNativePath(value);
- if (path && *path) {
- FSRef ref;
- Boolean d;
-
- err = ChkErr(FSPathMakeRef, (const unsigned char*) path, &ref,
- &d);
- if (err == noErr) {
- TK_IF_MAC_OS_X_API (4, HIWindowSetProxyFSRef,
+ tkMacOSXWmAttrNotifyVal = boolean;
+ }
+ break;
+ case WMATT_TITLEPATH: {
+ const char *path = Tcl_FSGetNativePath(value);
+ OSStatus err;
+
+ if (path && *path) {
+ FSRef ref;
+ Boolean d;
+
+ err = ChkErr(FSPathMakeRef, (const unsigned char*)path, &ref, &d);
+ if (err == noErr) {
+ TK_IF_MAC_OS_X_API (4, HIWindowSetProxyFSRef,
err = ChkErr(HIWindowSetProxyFSRef, macWindow, &ref);
- ) TK_ELSE_MAC_OS_X (4,
- AliasHandle alias;
-
- err = ChkErr(FSNewAlias, NULL, &ref, &alias);
- if (err == noErr) {
- err = ChkErr(SetWindowProxyAlias, macWindow,
- alias);
- DisposeHandle((Handle) alias);
- }
- ) TK_ENDIF
- }
- } else {
- int len;
+ ) TK_ELSE_MAC_OS_X (4,
+ AliasHandle alias;
- Tcl_GetStringFromObj(value, &len);
- if (!len) {
- err = ChkErr(RemoveWindowProxy, macWindow);
- } else {
- err = fnfErr;
- }
+ err = ChkErr(FSNewAlias, NULL, &ref, &alias);
+ if (err == noErr) {
+ err = ChkErr(SetWindowProxyAlias, macWindow, alias);
+ DisposeHandle((Handle) alias);
+ }
+ ) TK_ENDIF
}
- if (err != noErr) {
- return TCL_ERROR;
+ } else {
+ int len;
+
+ Tcl_GetStringFromObj(value, &len);
+ if (!len) {
+ err = ChkErr(RemoveWindowProxy, macWindow);
+ } else {
+ err = fnfErr;
}
- break;
}
- case WMATT_TOPMOST: {
- if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
- return TCL_ERROR;
- }
- if (boolean != ((wmPtr->flags & WM_TOPMOST) != 0)) {
- WindowGroupRef group;
+ if (err != noErr) {
+ return TCL_ERROR;
+ }
+ break;
+ }
+ case WMATT_TOPMOST:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean != ((wmPtr->flags & WM_TOPMOST) != 0)) {
+ WindowGroupRef group;
- if (boolean) {
- wmPtr->flags |= WM_TOPMOST;
- } else {
- wmPtr->flags &= ~WM_TOPMOST;
- }
- group = WmGetWindowGroup(winPtr);
- if (group && group != GetWindowGroup(macWindow)) {
- ChkErr(SetWindowGroup, macWindow, group);
- }
+ if (boolean) {
+ wmPtr->flags |= WM_TOPMOST;
+ } else {
+ wmPtr->flags &= ~WM_TOPMOST;
+ }
+ group = WmGetWindowGroup(winPtr);
+ if (group && group != GetWindowGroup(macWindow)) {
+ ChkErr(SetWindowGroup, macWindow, group);
}
- break;
}
- case WMATT_TRANSPARENT:
- if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
- return TCL_ERROR;
+ break;
+ case WMATT_TRANSPARENT:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean != ((wmPtr->flags & WM_TRANSPARENT) != 0)) {
+ WindowAttributes oldAttributes = wmPtr->attributes;
+
+ if (boolean) {
+ wmPtr->flags |= WM_TRANSPARENT;
+ wmPtr->attributes |= kWindowNoShadowAttribute;
+ TK_IF_MAC_OS_X_API (3, HIWindowChangeFeatures,
+ UInt32 features;
+
+ ChkErr(GetWindowFeatures, macWindow, &features);
+ if (features & kWindowIsOpaque) {
+ ChkErr(HIWindowChangeFeatures, macWindow, 0,
+ kWindowIsOpaque);
+ }
+ ) TK_ENDIF
+ } else {
+ wmPtr->flags &= ~WM_TRANSPARENT;
+ wmPtr->attributes &= ~kWindowNoShadowAttribute;
}
- if (boolean != ((wmPtr->flags & WM_TRANSPARENT) != 0)) {
- WindowAttributes oldAttributes = wmPtr->attributes;
-
- if (boolean) {
- wmPtr->flags |= WM_TRANSPARENT;
- wmPtr->attributes |= kWindowNoShadowAttribute;
- TK_IF_MAC_OS_X_API (3, HIWindowChangeFeatures,
- UInt32 features;
-
- ChkErr(GetWindowFeatures, macWindow, &features);
- if (features & kWindowIsOpaque) {
- ChkErr(HIWindowChangeFeatures, macWindow, 0,
- kWindowIsOpaque);
- }
- ) TK_ENDIF
- } else {
- wmPtr->flags &= ~WM_TRANSPARENT;
- wmPtr->attributes &= ~kWindowNoShadowAttribute;
- }
- ApplyWindowClassAttributeChanges(winPtr, macWindow,
- wmPtr->macClass, oldAttributes, 1);
- ChkErr(ReshapeCustomWindow, macWindow);
- TkMacOSXInvalidateWindow((MacDrawable *)(winPtr->window),
- TK_PARENT_WINDOW);
+ ApplyWindowClassAttributeChanges(winPtr, macWindow,
+ wmPtr->macClass, oldAttributes, 1);
+ ChkErr(ReshapeCustomWindow, macWindow);
+ TkMacOSXInvalidateWindow((MacDrawable *) winPtr->window,
+ TK_PARENT_WINDOW);
}
- break;
- case _WMATT_LAST_ATTRIBUTE:
- default:
- return TCL_ERROR;
+ break;
+ case _WMATT_LAST_ATTRIBUTE:
+ default:
+ return TCL_ERROR;
}
return TCL_OK;
}
@@ -905,12 +898,14 @@ static int WmSetAttribute(
*
* WmGetAttribute --
*
- * Helper routine for WmAttributesCmd. Returns the current value
- * of the specified attribute.
+ * Helper routine for WmAttributesCmd. Returns the current value of the
+ * specified attribute.
*
*----------------------------------------------------------------------
*/
-static Tcl_Obj *WmGetAttribute(
+
+static Tcl_Obj *
+WmGetAttribute(
TkWindow *winPtr, /* Toplevel to work with */
WindowRef macWindow,
WmAttribute attribute) /* Code of attribute to get */
@@ -919,57 +914,56 @@ static Tcl_Obj *WmGetAttribute(
Tcl_Obj *result = NULL;
switch (attribute) {
- case WMATT_ALPHA: {
- float fval = 1.0;
-
- ChkErr(GetWindowAlpha, macWindow, &fval);
- result = Tcl_NewDoubleObj(fval);
- break;
- }
- case WMATT_FULLSCREEN:
- result = Tcl_NewBooleanObj(wmPtr->flags & WM_FULLSCREEN);
- break;
- case WMATT_MODIFIED:
- result = Tcl_NewBooleanObj(IsWindowModified(macWindow));
- break;
- case WMATT_NOTIFY:
- result = Tcl_NewBooleanObj(tkMacOSXWmAttrNotifyVal);
- break;
- case WMATT_TITLEPATH: {
- FSRef ref;
- UInt8 path[PATH_MAX+1];
- OSStatus err;
-
- TK_IF_MAC_OS_X_API (4, HIWindowSetProxyFSRef,
- err = ChkErr(HIWindowGetProxyFSRef, macWindow, &ref);
- ) TK_ELSE_MAC_OS_X (4,
- Boolean wasChanged;
- AliasHandle alias;
-
- err = ChkErr(GetWindowProxyAlias, macWindow, &alias);
- if (err == noErr) {
- err = ChkErr(FSResolveAlias, NULL, alias, &ref,
- &wasChanged);
- }
- ) TK_ENDIF
+ case WMATT_ALPHA: {
+ float fval = 1.0;
+
+ ChkErr(GetWindowAlpha, macWindow, &fval);
+ result = Tcl_NewDoubleObj(fval);
+ break;
+ }
+ case WMATT_FULLSCREEN:
+ result = Tcl_NewBooleanObj(wmPtr->flags & WM_FULLSCREEN);
+ break;
+ case WMATT_MODIFIED:
+ result = Tcl_NewBooleanObj(IsWindowModified(macWindow));
+ break;
+ case WMATT_NOTIFY:
+ result = Tcl_NewBooleanObj(tkMacOSXWmAttrNotifyVal);
+ break;
+ case WMATT_TITLEPATH: {
+ FSRef ref;
+ UInt8 path[PATH_MAX+1];
+ OSStatus err;
+
+ TK_IF_MAC_OS_X_API (4, HIWindowSetProxyFSRef,
+ err = ChkErr(HIWindowGetProxyFSRef, macWindow, &ref);
+ ) TK_ELSE_MAC_OS_X (4,
+ Boolean wasChanged;
+ AliasHandle alias;
+
+ err = ChkErr(GetWindowProxyAlias, macWindow, &alias);
if (err == noErr) {
- err = ChkErr(FSRefMakePath, &ref, path, PATH_MAX);
+ err = ChkErr(FSResolveAlias, NULL, alias, &ref, &wasChanged);
}
- if (err != noErr) {
- *path = 0;
- }
- result = Tcl_NewStringObj((char*) path, -1);
- break;
+ ) TK_ENDIF
+ if (err == noErr) {
+ err = ChkErr(FSRefMakePath, &ref, path, PATH_MAX);
}
- case WMATT_TOPMOST:
- result = Tcl_NewBooleanObj(wmPtr->flags & WM_TOPMOST);
- break;
- case WMATT_TRANSPARENT:
- result = Tcl_NewBooleanObj(wmPtr->flags & WM_TRANSPARENT);
- break;
- case _WMATT_LAST_ATTRIBUTE:
- default:
- break;
+ if (err != noErr) {
+ *path = 0;
+ }
+ result = Tcl_NewStringObj((char*) path, -1);
+ break;
+ }
+ case WMATT_TOPMOST:
+ result = Tcl_NewBooleanObj(wmPtr->flags & WM_TOPMOST);
+ break;
+ case WMATT_TRANSPARENT:
+ result = Tcl_NewBooleanObj(wmPtr->flags & WM_TRANSPARENT);
+ break;
+ case _WMATT_LAST_ATTRIBUTE:
+ default:
+ break;
}
return result;
}
@@ -1051,8 +1045,8 @@ WmAttributesCmd(
*
* WmClientCmd --
*
- * This procedure is invoked to process the "wm client" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm client" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1096,8 +1090,7 @@ WmClientCmd(
if (wmPtr->clientMachine != NULL) {
ckfree((char *) wmPtr->clientMachine);
}
- wmPtr->clientMachine = (char *)
- ckalloc((unsigned) (length + 1));
+ wmPtr->clientMachine = ckalloc((unsigned) length + 1);
strcpy(wmPtr->clientMachine, argv3);
return TCL_OK;
}
@@ -1107,9 +1100,8 @@ WmClientCmd(
*
* WmColormapwindowsCmd --
*
- * This procedure is invoked to process the "wm colormapwindows"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm colormapwindows" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1154,11 +1146,10 @@ WmColormapwindowsCmd(
return TCL_ERROR;
}
cmapList = (TkWindow **) ckalloc((unsigned)
- ((windowObjc+1)*sizeof(TkWindow*)));
+ ((windowObjc+1) * sizeof(TkWindow*)));
for (i = 0; i < windowObjc; i++) {
if (TkGetWindowFromObj(interp, tkwin, windowObjv[i],
- (Tk_Window *) &winPtr2) != TCL_OK)
- {
+ (Tk_Window *) &winPtr2) != TCL_OK) {
ckfree((char *) cmapList);
return TCL_ERROR;
}
@@ -1185,9 +1176,8 @@ WmColormapwindowsCmd(
wmPtr->cmapCount = windowObjc;
/*
- * On the Macintosh all of this is just an excercise
- * in compatability as we don't support colormaps. If
- * we did they would be installed here.
+ * On the Macintosh all of this is just an excercise in compatability as
+ * we don't support colormaps. If we did they would be installed here.
*/
return TCL_OK;
@@ -1229,8 +1219,7 @@ WmCommandCmd(
}
if (objc == 3) {
if (wmPtr->cmdArgv != NULL) {
- Tcl_SetResult(interp,
- Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv),
+ Tcl_SetResult(interp, Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv),
TCL_DYNAMIC);
}
return TCL_OK;
@@ -1280,6 +1269,7 @@ WmDeiconifyCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
+
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
@@ -1342,7 +1332,7 @@ WmFocusmodelCmd(
}
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
+ &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_ACTIVE) {
@@ -1371,15 +1361,15 @@ WmFocusmodelCmd(
*/
static int
-WmForgetCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel or Frame to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmForgetCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel or Frame to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
#if 1
- Tcl_AppendResult(interp, "wm forget is not yet supported", (char*)NULL);
+ Tcl_AppendResult(interp, "wm forget is not yet supported", NULL);
return TCL_ERROR;
#else
register Tk_Window frameWin = (Tk_Window)winPtr;
@@ -1393,8 +1383,8 @@ WmForgetCmd(tkwin, winPtr, interp, objc, objv)
Tk_UnmapWindow(frameWin);
if (destPort != NULL) {
- WindowRef winRef;
- winRef = GetWindowFromPort(destPort);
+ WindowRef winRef = GetWindowFromPort(destPort);
+
TkMacOSXUnregisterMacWindow(winRef);
DisposeWindow(winRef);
}
@@ -1404,7 +1394,8 @@ WmForgetCmd(tkwin, winPtr, interp, objc, objv)
RemapWindows(winPtr, macWin);
TkWmDeadWindow(winPtr);
- winPtr->flags &= ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
+ winPtr->flags &=
+ ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
TkMapTopFrame(frameWin);
} else {
@@ -1419,8 +1410,8 @@ WmForgetCmd(tkwin, winPtr, interp, objc, objv)
*
* WmFrameCmd --
*
- * This procedure is invoked to process the "wm frame" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm frame" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1504,8 +1495,8 @@ WmGeometryCmd(
width = winPtr->changes.width;
height = winPtr->changes.height;
}
- sprintf(buf, "%dx%d%c%d%c%d", width, height, xSign, wmPtr->x,
- ySign, wmPtr->y);
+ sprintf(buf, "%dx%d%c%d%c%d",
+ width, height, xSign, wmPtr->x, ySign, wmPtr->y);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
@@ -1524,8 +1515,8 @@ WmGeometryCmd(
*
* WmGridCmd --
*
- * This procedure is invoked to process the "wm grid" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm grid" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1565,8 +1556,8 @@ WmGridCmd(
}
if (*Tcl_GetString(objv[3]) == '\0') {
/*
- * Turn off gridding and reset the width and height
- * to make sense as ungridded numbers.
+ * Turn off gridding and reset the width and height to make sense as
+ * ungridded numbers.
*/
wmPtr->sizeHintsFlags &= ~(PBaseSize|PResizeInc);
@@ -1580,9 +1571,9 @@ WmGridCmd(
wmPtr->heightInc = 1;
} else {
if ((Tcl_GetIntFromObj(interp, objv[3], &reqWidth) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &reqHeight) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[5], &widthInc) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[6], &heightInc) != TCL_OK)) {
+ || (Tcl_GetIntFromObj(interp, objv[4], &reqHeight) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[5], &widthInc) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[6], &heightInc)!=TCL_OK)) {
return TCL_ERROR;
}
if (reqWidth < 0) {
@@ -1614,8 +1605,8 @@ WmGridCmd(
*
* WmGroupCmd --
*
- * This procedure is invoked to process the "wm group" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm group" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1829,8 +1820,7 @@ WmIconmaskCmd(
}
if (objc == 3) {
if (wmPtr->hints.flags & IconMaskHint) {
- Tcl_SetResult(interp,
- (char*)Tk_NameOfBitmap(winPtr->display,
+ Tcl_SetResult(interp, (char *) Tk_NameOfBitmap(winPtr->display,
wmPtr->hints.icon_mask), TCL_STATIC);
}
return TCL_OK;
@@ -1886,8 +1876,7 @@ WmIconnameCmd(
return TCL_ERROR;
}
if (objc == 3) {
- Tcl_SetResult(interp,
- (char*)((wmPtr->iconName != NULL) ?
+ Tcl_SetResult(interp, (char *) ((wmPtr->iconName != NULL) ?
wmPtr->iconName : ""), TCL_STATIC);
return TCL_OK;
} else {
@@ -1895,7 +1884,7 @@ WmIconnameCmd(
ckfree((char *) wmPtr->iconName);
}
argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->iconName = ckalloc((unsigned) (length + 1));
+ wmPtr->iconName = ckalloc((unsigned) length + 1);
strcpy(wmPtr->iconName, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName);
@@ -1909,10 +1898,9 @@ WmIconnameCmd(
*
* WmIconphotoCmd --
*
- * This procedure is invoked to process the "wm iconphoto"
- * Tcl command.
- * See the user documentation for details on what it does.
- * Not yet implemented for OS X.
+ * This procedure is invoked to process the "wm iconphoto" Tcl command.
+ * See the user documentation for details on what it does. Not yet
+ * implemented for OS X.
*
* Results:
* A standard Tcl result.
@@ -1947,10 +1935,12 @@ WmIconphotoCmd(
return TCL_ERROR;
}
}
+
/*
* Iterate over all images to retrieve their sizes, in order to allocate a
* buffer large enough to hold all images.
*/
+
for (i = 3 + isDefault; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
if (photo == NULL) {
@@ -1960,10 +1950,12 @@ WmIconphotoCmd(
}
Tk_PhotoGetSize(photo, &width, &height);
}
+
/*
- * This requires implementation for OS X, but we silently return
- * for now.
+ * TODO: This requires implementation for OS X, but we silently return for
+ * now.
*/
+
return TCL_OK;
}
@@ -1972,9 +1964,8 @@ WmIconphotoCmd(
*
* WmIconpositionCmd --
*
- * This procedure is invoked to process the "wm iconposition"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm iconposition" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2112,8 +2103,8 @@ WmIconwindowCmd(
*
* WmManageCmd --
*
- * This procedure is invoked to process the "wm manage" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm manage" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2130,10 +2121,10 @@ WmManageCmd(
TkWindow *winPtr, /* Toplevel or Frame to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
#if 1
- Tcl_AppendResult(interp, "wm manage is not yet supported", (char*)NULL);
+ Tcl_AppendResult(interp, "wm manage is not yet supported", NULL);
return TCL_ERROR;
#else
register Tk_Window frameWin = (Tk_Window)winPtr;
@@ -2159,8 +2150,9 @@ WmManageCmd(
macWin->grafPtr = NULL;
macWin->toplevel = macWin;
RemapWindows(winPtr, macWin);
- winPtr->flags |= (TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
- TkMapTopFrame (frameWin);
+ winPtr->flags |=
+ (TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
+ TkMapTopFrame(frameWin);
} else if (Tk_IsTopLevel(frameWin)) {
/* Already managed by wm - ignore it */
}
@@ -2260,7 +2252,7 @@ WmMinsizeCmd(
return TCL_OK;
}
if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) {
+ || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) {
return TCL_ERROR;
}
wmPtr->minWidth = width;
@@ -2275,9 +2267,8 @@ WmMinsizeCmd(
*
* WmOverrideredirectCmd --
*
- * This procedure is invoked to process the "wm overrideredirect"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm overrideredirect" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2366,7 +2357,7 @@ WmPositionfromCmd(
wmPtr->sizeHintsFlags &= ~(USPosition|PPosition);
} else {
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
+ &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_USER) {
@@ -2421,6 +2412,7 @@ WmProtocolCmd(
/*
* Return a list of all defined protocols for the window.
*/
+
for (protPtr = wmPtr->protPtr; protPtr != NULL;
protPtr = protPtr->nextPtr) {
Tcl_AppendElement(interp,
@@ -2445,9 +2437,8 @@ WmProtocolCmd(
}
/*
- * Delete any current protocol handler, then create a new
- * one with the specified command, unless the command is
- * empty.
+ * Delete any current protocol handler, then create a new one with the
+ * specified command, unless the command is empty.
*/
for (protPtr = wmPtr->protPtr, prevPtr = NULL; protPtr != NULL;
@@ -2458,7 +2449,7 @@ WmProtocolCmd(
} else {
prevPtr->nextPtr = protPtr->nextPtr;
}
- Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
break;
}
}
@@ -2546,7 +2537,7 @@ WmResizableCmd(
}
WmUpdateGeom(wmPtr, winPtr);
ApplyWindowClassAttributeChanges(winPtr, NULL, wmPtr->macClass,
- oldAttributes, 1);
+ oldAttributes, 1);
return TCL_OK;
}
@@ -2599,7 +2590,7 @@ WmSizefromCmd(
wmPtr->sizeHintsFlags &= ~(USSize|PSize);
} else {
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
+ &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_USER) {
@@ -2656,13 +2647,13 @@ WmStackorderCmd(
windows = TkWmStackorderToplevel(winPtr);
if (windows == NULL) {
Tcl_Panic("TkWmStackorderToplevel failed");
- } else {
- for (window_ptr = windows; *window_ptr ; window_ptr++) {
- Tcl_AppendElement(interp, (*window_ptr)->pathName);
- }
- ckfree((char *) windows);
- return TCL_OK;
}
+
+ for (window_ptr = windows; *window_ptr ; window_ptr++) {
+ Tcl_AppendElement(interp, (*window_ptr)->pathName);
+ }
+ ckfree((char *) windows);
+ return TCL_OK;
} else {
TkWindow *winPtr2;
int index1=-1, index2=-1, result;
@@ -2691,9 +2682,8 @@ WmStackorderCmd(
}
/*
- * Lookup stacking order of all toplevels that are children
- * of "." and find the position of winPtr and winPtr2
- * in the stacking order.
+ * Lookup stacking order of all toplevels that are children of "." and
+ * find the position of winPtr and winPtr2 in the stacking order.
*/
windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
@@ -2703,21 +2693,25 @@ WmStackorderCmd(
return TCL_ERROR;
} else {
for (window_ptr = windows; *window_ptr ; window_ptr++) {
- if (*window_ptr == winPtr)
+ if (*window_ptr == winPtr) {
index1 = (window_ptr - windows);
- if (*window_ptr == winPtr2)
+ }
+ if (*window_ptr == winPtr2) {
index2 = (window_ptr - windows);
+ }
}
- if (index1 == -1)
+ if (index1 == -1) {
Tcl_Panic("winPtr window not found");
- if (index2 == -1)
+ }
+ if (index2 == -1) {
Tcl_Panic("winPtr2 window not found");
+ }
ckfree((char *) windows);
}
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
- &index) != TCL_OK) {
+ &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_ISABOVE) {
@@ -2736,8 +2730,8 @@ WmStackorderCmd(
*
* WmStateCmd --
*
- * This procedure is invoked to process the "wm state" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm state" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2818,18 +2812,18 @@ WmStateCmd(
ZoomState : NormalState);
}
switch (wmPtr->hints.initial_state) {
- case NormalState:
- Tcl_SetResult(interp, "normal", TCL_STATIC);
- break;
- case IconicState:
- Tcl_SetResult(interp, "iconic", TCL_STATIC);
- break;
- case WithdrawnState:
- Tcl_SetResult(interp, "withdrawn", TCL_STATIC);
- break;
- case ZoomState:
- Tcl_SetResult(interp, "zoomed", TCL_STATIC);
- break;
+ case NormalState:
+ Tcl_SetResult(interp, "normal", TCL_STATIC);
+ break;
+ case IconicState:
+ Tcl_SetResult(interp, "iconic", TCL_STATIC);
+ break;
+ case WithdrawnState:
+ Tcl_SetResult(interp, "withdrawn", TCL_STATIC);
+ break;
+ case ZoomState:
+ Tcl_SetResult(interp, "zoomed", TCL_STATIC);
+ break;
}
}
}
@@ -2841,8 +2835,8 @@ WmStateCmd(
*
* WmTitleCmd --
*
- * This procedure is invoked to process the "wm title" Tcl command.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the "wm title" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3017,7 +3011,7 @@ WmInfo *wmPtr;
TkWindow *winPtr;
{
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3028,33 +3022,33 @@ TkWindow *winPtr;
* Tk_SetGrid --
*
* This procedure is invoked by a widget when it wishes to set a grid
- * coordinate system that controls the size of a top-level window.
- * It provides a C interface equivalent to the "wm grid" command and
- * is usually asscoiated with the -setgrid option.
+ * coordinate system that controls the size of a top-level window. It
+ * provides a C interface equivalent to the "wm grid" command and is
+ * usually asscoiated with the -setgrid option.
*
* Results:
* None.
*
* Side effects:
- * Grid-related information will be passed to the window manager, so
- * that the top-level window associated with tkwin will resize on
- * even grid units. If some other window already controls gridding
- * for the top-level window then this procedure call has no effect.
+ * Grid-related information will be passed to the window manager, so that
+ * the top-level window associated with tkwin will resize on even grid
+ * units. If some other window already controls gridding for the
+ * top-level window then this procedure call has no effect.
*
*----------------------------------------------------------------------
*/
void
Tk_SetGrid(
- Tk_Window tkwin, /* Token for window. New window mgr info
- * will be posted for the top-level window
+ Tk_Window tkwin, /* Token for window. New window mgr info will
+ * be posted for the top-level window
* associated with this window. */
- int reqWidth, /* Width (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int reqHeight, /* Height (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int widthInc, int heightInc)/* Pixel increments corresponding to a
- * change of one grid unit. */
+ int reqWidth, /* Width (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int reqHeight, /* Height (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int widthInc, int heightInc)/* Pixel increments corresponding to a change
+ * of one grid unit. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr;
@@ -3094,15 +3088,15 @@ Tk_SetGrid(
}
/*
- * If gridding was previously off, then forget about any window
- * size requests made by the user or via "wm geometry": these are
- * in pixel units and there's no easy way to translate them to
- * grid units since the new requested size of the top-level window in
- * pixels may not yet have been registered yet (it may filter up
- * the hierarchy in DoWhenIdle handlers). However, if the window
- * has never been mapped yet then just leave the window size alone:
- * assume that it is intended to be in grid units but just happened
- * to have been specified before this procedure was called.
+ * If gridding was previously off, then forget about any window size
+ * requests made by the user or via "wm geometry": these are in pixel
+ * units and there's no easy way to translate them to grid units since the
+ * new requested size of the top-level window in pixels may not yet have
+ * been registered yet (it may filter up the hierarchy in DoWhenIdle
+ * handlers). However, if the window has never been mapped yet then just
+ * leave the window size alone: assume that it is intended to be in grid
+ * units but just happened to have been specified before this procedure
+ * was called.
*/
if ((wmPtr->gridWin == NULL) && !(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -3111,8 +3105,8 @@ Tk_SetGrid(
}
/*
- * Set the new gridding information, and start the process of passing
- * all of this information to the window manager.
+ * Set the new gridding information, and start the process of passing all
+ * of this information to the window manager.
*/
wmPtr->gridWin = tkwin;
@@ -3123,7 +3117,7 @@ Tk_SetGrid(
wmPtr->sizeHintsFlags |= PBaseSize|PResizeInc;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3133,16 +3127,15 @@ Tk_SetGrid(
*
* Tk_UnsetGrid --
*
- * This procedure cancels the effect of a previous call
- * to Tk_SetGrid.
+ * This procedure cancels the effect of a previous call to Tk_SetGrid.
*
* Results:
* None.
*
* Side effects:
* If tkwin currently controls gridding for its top-level window,
- * gridding is cancelled for that top-level window; if some other
- * window controls gridding then this procedure has no effect.
+ * gridding is cancelled for that top-level window; if some other window
+ * controls gridding then this procedure has no effect.
*
*----------------------------------------------------------------------
*/
@@ -3181,7 +3174,7 @@ Tk_UnsetGrid(
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3198,8 +3191,8 @@ Tk_UnsetGrid(
* None.
*
* Side effects:
- * Tk's internal data structures for the window get modified to
- * reflect the structural change.
+ * Tk's internal data structures for the window get modified to reflect
+ * the structural change.
*
*----------------------------------------------------------------------
*/
@@ -3209,7 +3202,7 @@ TopLevelEventProc(
ClientData clientData, /* Window for which event occurred. */
XEvent *eventPtr) /* Event that just happened. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
winPtr->wmInfoPtr->flags |= WM_VROOT_OFFSET_STALE;
if (eventPtr->type == DestroyNotify) {
@@ -3223,7 +3216,7 @@ TopLevelEventProc(
*/
Tk_ErrorHandler handler = Tk_CreateErrorHandler(winPtr->display,
- -1, -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, -1, NULL, NULL);
Tk_DestroyWindow((Tk_Window) winPtr);
Tk_DeleteErrorHandler(handler);
}
@@ -3240,15 +3233,15 @@ TopLevelEventProc(
*
* TopLevelReqProc --
*
- * This procedure is invoked by the geometry manager whenever
- * the requested size for a top-level window is changed.
+ * This procedure is invoked by the geometry manager whenever the
+ * requested size for a top-level window is changed.
*
* Results:
* None.
*
* Side effects:
- * Arrange for the window to be resized to satisfy the request
- * (this happens as a when-idle action).
+ * Arrange for the window to be resized to satisfy the request (this
+ * happens as a when-idle action).
*
*----------------------------------------------------------------------
*/
@@ -3265,7 +3258,7 @@ TopLevelReqProc(
wmPtr = winPtr->wmInfoPtr;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3275,19 +3268,18 @@ TopLevelReqProc(
*
* UpdateGeometryInfo --
*
- * This procedure is invoked when a top-level window is first
- * mapped, and also as a when-idle procedure, to bring the
- * geometry and/or position of a top-level window back into
- * line with what has been requested by the user and/or widgets.
- * This procedure doesn't return until the window manager has
- * responded to the geometry change.
+ * This procedure is invoked when a top-level window is first mapped, and
+ * also as a when-idle procedure, to bring the geometry and/or position
+ * of a top-level window back into line with what has been requested by
+ * the user and/or widgets. This procedure doesn't return until the
+ * window manager has responded to the geometry change.
*
* Results:
* None.
*
* Side effects:
- * The window's size and location may change, unless the WM prevents
- * that from happening.
+ * The window's size and location may change, unless the WM prevents that
+ * from happening.
*
*----------------------------------------------------------------------
*/
@@ -3296,7 +3288,7 @@ static void
UpdateGeometryInfo(
ClientData clientData) /* Pointer to the window's record. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y, width, height, min, max;
unsigned long serial;
@@ -3308,14 +3300,12 @@ UpdateGeometryInfo(
}
/*
- * Compute the new size for the top-level window. See the
- * user documentation for details on this, but the size
- * requested depends on (a) the size requested internally
- * by the window's widgets, (b) the size requested by the
- * user in a "wm geometry" command or via wm-based interactive
- * resizing (if any), and (c) whether or not the window is
- * gridded. Don't permit sizes <= 0 because this upsets
- * the X server.
+ * Compute the new size for the top-level window. See the user
+ * documentation for details on this, but the size requested depends on
+ * (a) the size requested internally by the window's widgets, (b) the size
+ * requested by the user in a "wm geometry" command or via wm-based
+ * interactive resizing (if any), and (c) whether or not the window is
+ * gridded. Don't permit sizes <= 0 because this upsets the X server.
*/
if (wmPtr->width == -1) {
@@ -3390,10 +3380,10 @@ UpdateGeometryInfo(
/*
* Compute the new position for the upper-left pixel of the window's
- * decorative frame. This is tricky, because we need to include the
- * border widths supplied by a reparented parent in this calculation,
- * but can't use the parent's current overall size since that may
- * change as a result of this code.
+ * decorative frame. This is tricky, because we need to include the border
+ * widths supplied by a reparented parent in this calculation, but can't
+ * use the parent's current overall size since that may change as a result
+ * of this code.
*/
if (wmPtr->flags & WM_NEGATIVE_X) {
@@ -3410,10 +3400,10 @@ UpdateGeometryInfo(
}
/*
- * If the window's size is going to change and the window is
- * supposed to not be resizable by the user, then we have to
- * update the size hints. There may also be a size-hint-update
- * request pending from somewhere else, too.
+ * If the window's size is going to change and the window is supposed to
+ * not be resizable by the user, then we have to update the size hints.
+ * There may also be a size-hint-update request pending from somewhere
+ * else, too.
*/
if (((width != winPtr->changes.width)
@@ -3427,22 +3417,21 @@ UpdateGeometryInfo(
}
/*
- * Reconfigure the window if it isn't already configured correctly.
- * A few tricky points:
+ * Reconfigure the window if it isn't already configured correctly. A few
+ * tricky points:
*
- * 1. If the window is embedded and the container is also in this
- * process, don't actually reconfigure the window; just pass the
- * desired size on to the container. Also, zero out any position
- * information, since embedded windows are not allowed to move.
- * 2. Sometimes the window manager will give us a different size
- * than we asked for (e.g. mwm has a minimum size for windows), so
- * base the size check on what we *asked for* last time, not what we
- * got.
- * 3. Don't move window unless a new position has been requested for
- * it. This is because of "features" in some window managers (e.g.
- * twm, as of 4/24/91) where they don't interpret coordinates
- * according to ICCCM. Moving a window to its current location may
- * cause it to shift position on the screen.
+ * 1. If the window is embedded and the container is also in this process,
+ * don't actually reconfigure the window; just pass the desired size on
+ * to the container. Also, zero out any position information, since
+ * embedded windows are not allowed to move.
+ * 2. Sometimes the window manager will give us a different size than we
+ * asked for (e.g. mwm has a minimum size for windows), so base the
+ * size check on what we *asked for* last time, not what we got.
+ * 3. Don't move window unless a new position has been requested for it.
+ * This is because of "features" in some window managers (e.g. twm, as
+ * of 4/24/91) where they don't interpret coordinates according to
+ * ICCCM. Moving a window to its current location may cause it to shift
+ * position on the screen.
*/
if (Tk_IsEmbedded(winPtr)) {
@@ -3456,9 +3445,9 @@ UpdateGeometryInfo(
/*
* This window is embedded and the container is also in this
* process, so we don't need to do anything special about the
- * geometry, except to make sure that the desired size is known
- * by the container. Also, zero out any position information,
- * since embedded windows are not allowed to move.
+ * geometry, except to make sure that the desired size is known by
+ * the container. Also, zero out any position information, since
+ * embedded windows are not allowed to move.
*/
wmPtr->x = wmPtr->y = 0;
@@ -3498,9 +3487,8 @@ UpdateGeometryInfo(
*
* UpdateSizeHints --
*
- * This procedure is called to update the window manager's
- * size hints information from the information in a WmInfo
- * structure.
+ * This procedure is called to update the window manager's size hints
+ * information from the information in a WmInfo structure.
*
* Results:
* None.
@@ -3518,8 +3506,6 @@ UpdateSizeHints(
WmInfo *wmPtr = winPtr->wmInfoPtr;
wmPtr->flags &= ~WM_UPDATE_SIZE_HINTS;
-
- return;
}
/*
@@ -3527,13 +3513,12 @@ UpdateSizeHints(
*
* ParseGeometry --
*
- * This procedure parses a geometry string and updates
- * information used to control the geometry of a top-level
- * window.
+ * This procedure parses a geometry string and updates information used
+ * to control the geometry of a top-level window.
*
* Results:
- * A standard Tcl return value, plus an error message in
- * the interp's result if an error occurs.
+ * A standard Tcl return value, plus an error message in the interp's
+ * result if an error occurs.
*
* Side effects:
* The size and/or location of winPtr may change.
@@ -3546,8 +3531,8 @@ ParseGeometry(
Tcl_Interp *interp, /* Used for error reporting. */
char *string, /* String containing new geometry. Has the
* standard form "=wxh+x+y". */
- TkWindow *winPtr) /* Pointer to top-level window whose
- * geometry is to be changed. */
+ TkWindow *winPtr) /* Pointer to top-level window whose geometry
+ * is to be changed. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y, width, height, flags;
@@ -3563,9 +3548,9 @@ ParseGeometry(
}
/*
- * Parse the width and height, if they are present. Don't
- * actually update any of the fields of wmPtr until we've
- * successfully parsed the entire geometry string.
+ * Parse the width and height, if they are present. Don't actually update
+ * any of the fields of wmPtr until we've successfully parsed the entire
+ * geometry string.
*/
width = wmPtr->width;
@@ -3619,10 +3604,10 @@ ParseGeometry(
}
/*
- * Assume that the geometry information came from the user,
- * unless an explicit source has been specified. Otherwise
- * most window managers assume that the size hints were
- * program-specified and they ignore them.
+ * Assume that the geometry information came from the user, unless an
+ * explicit source has been specified. Otherwise most window managers
+ * assume that the size hints were program-specified and they ignore
+ * them.
*/
if ((wmPtr->sizeHintsFlags & (USPosition|PPosition)) == 0) {
@@ -3632,9 +3617,9 @@ ParseGeometry(
}
/*
- * Everything was parsed OK. Update the fields of *wmPtr and
- * arrange for the appropriate information to be percolated out
- * to the window manager at the next idle moment.
+ * Everything was parsed OK. Update the fields of *wmPtr and arrange for
+ * the appropriate information to be percolated out to the window manager
+ * at the next idle moment.
*/
wmPtr->width = width;
@@ -3654,12 +3639,12 @@ ParseGeometry(
wmPtr->flags = flags;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
return TCL_OK;
-error:
+ error:
Tcl_AppendResult(interp, "bad geometry specifier \"", string, "\"", NULL);
return TCL_ERROR;
}
@@ -3669,15 +3654,15 @@ error:
*
* Tk_GetRootCoords --
*
- * Given a token for a window, this procedure traces through the
- * window's lineage to find the (virtual) root-window coordinates
- * corresponding to point (0,0) in the window.
+ * Given a token for a window, this procedure traces through the window's
+ * lineage to find the (virtual) root-window coordinates corresponding to
+ * point (0,0) in the window.
*
* Results:
- * The locations pointed to by xPtr and yPtr are filled in with
- * the root coordinates of the (0,0) point in tkwin. If a virtual
- * root window is in effect for the window, then the coordinates
- * in the virtual root are returned.
+ * The locations pointed to by xPtr and yPtr are filled in with the root
+ * coordinates of the (0,0) point in tkwin. If a virtual root window is
+ * in effect for the window, then the coordinates in the virtual root are
+ * returned.
*
* Side effects:
* None.
@@ -3695,9 +3680,8 @@ Tk_GetRootCoords(
TkWindow *winPtr = (TkWindow *) tkwin;
/*
- * Search back through this window's parents all the way to a
- * top-level window, combining the offsets of each window within
- * its parent.
+ * Search back through this window's parents all the way to a top-level
+ * window, combining the offsets of each window within its parent.
*/
x = y = 0;
@@ -3714,15 +3698,16 @@ Tk_GetRootCoords(
if (otherPtr != NULL) {
/*
- * The container window is in the same application.
- * Query its coordinates.
+ * The container window is in the same application. Query
+ * its coordinates.
*/
+
winPtr = otherPtr;
/*
- * Remember to offset by the container window here,
- * since at the end of this if branch, we will
- * pop out to the container's parent...
+ * Remember to offset by the container window here, since
+ * at the end of this if branch, we will pop out to the
+ * container's parent...
*/
x += winPtr->changes.x + winPtr->changes.border_width;
@@ -3733,12 +3718,12 @@ Tk_GetRootCoords(
if (tkMacOSXEmbedHandler->getOffsetProc != NULL) {
/*
- * We do not require that the changes.x & changes.y for
- * a non-Tk master window be kept up to date. So we
- * first subtract off the possibly bogus values that
- * have been added on at the top of this pass through
- * the loop, and then call out to the getOffsetProc to
- * give us the correct offset.
+ * We do not require that the changes.x & changes.y
+ * for a non-Tk master window be kept up to date. So
+ * we first subtract off the possibly bogus values
+ * that have been added on at the top of this pass
+ * through the loop, and then call out to the
+ * getOffsetProc to give us the correct offset.
*/
x -= winPtr->changes.x + winPtr->changes.border_width;
@@ -3765,14 +3750,14 @@ Tk_GetRootCoords(
*
* Tk_CoordsToWindow --
*
- * This is a Macintosh specific implementation of this function.
- * Given the root coordinates of a point, this procedure returns
- * the token for the top-most window covering that point, if
- * there exists such a window in this application.
+ * This is a Macintosh specific implementation of this function. Given
+ * the root coordinates of a point, this procedure returns the token for
+ * the top-most window covering that point, if there exists such a window
+ * in this application.
*
* Results:
- * The return result is either a token for the window corresponding
- * to rootX and rootY, or else NULL to indicate that there is no such
+ * The return result is either a token for the window corresponding to
+ * rootX and rootY, or else NULL to indicate that there is no such
* window.
*
* Side effects:
@@ -3783,19 +3768,19 @@ Tk_GetRootCoords(
Tk_Window
Tk_CoordsToWindow(
- int rootX, int rootY, /* Coordinates of point in root window. If
- * a virtual-root window manager is in use,
+ int rootX, int rootY, /* Coordinates of point in root window. If a
+ * virtual-root window manager is in use,
* these coordinates refer to the virtual
* root, not the real root. */
- Tk_Window tkwin) /* Token for any window in application;
- * used to identify the display. */
+ Tk_Window tkwin) /* Token for any window in application; used
+ * to identify the display. */
{
WindowPtr whichWin;
Point where;
Window rootChild;
TkWindow *winPtr, *childPtr;
- TkWindow *nextPtr; /* Coordinates of highest child found so
- * far that contains point. */
+ TkWindow *nextPtr; /* Coordinates of highest child found so far
+ * that contains point. */
int x, y; /* Coordinates in winPtr. */
int tmpx, tmpy, bd;
TkDisplay *dispPtr;
@@ -3818,10 +3803,10 @@ Tk_CoordsToWindow(
}
/*
- * Step 2: work down through the hierarchy underneath this window.
- * At each level, scan through all the children to find the highest
- * one in the stacking order that contains the point. Then repeat
- * the whole process on that child.
+ * Step 2: work down through the hierarchy underneath this window. At each
+ * level, scan through all the children to find the highest one in the
+ * stacking order that contains the point. Then repeat the whole process
+ * on that child.
*/
x = rootX - winPtr->wmInfoPtr->xInParent;
@@ -3888,13 +3873,12 @@ Tk_CoordsToWindow(
* Given a Tk Window, and coordinates of a point relative to that window
* this procedure returns the top-most child of the window (excluding
* toplevels) covering that point, if there exists such a window in this
- * application.
- * It also sets newX, and newY to the coords of the point relative to the
- * window returned.
+ * application. It also sets newX, and newY to the coords of the point
+ * relative to the window returned.
*
* Results:
- * The return result is either a token for the window corresponding
- * to rootX and rootY, or else NULL to indicate that there is no such
+ * The return result is either a token for the window corresponding to
+ * rootX and rootY, or else NULL to indicate that there is no such
* window. newX and newY are also set to the coords of the point relative
* to the returned window.
*
@@ -3906,15 +3890,15 @@ Tk_CoordsToWindow(
Tk_Window
Tk_TopCoordsToWindow(
- Tk_Window tkwin, /* Token for a Tk Window which defines the;
+ Tk_Window tkwin, /* Token for a Tk Window which defines the
* coordinates for rootX & rootY */
int rootX, int rootY, /* Coordinates of a point in tkWin. */
int *newX, int *newY) /* Coordinates of point in the upperMost child
* of tkWin containing (rootX,rootY) */
{
TkWindow *winPtr, *childPtr;
- TkWindow *nextPtr; /* Coordinates of highest child found so
- * far that contains point. */
+ TkWindow *nextPtr; /* Coordinates of highest child found so far
+ * that contains point. */
int x, y; /* Coordinates in winPtr. */
Window *children; /* Children of winPtr, or NULL. */
@@ -3979,24 +3963,23 @@ Tk_TopCoordsToWindow(
*
* UpdateVRootGeometry --
*
- * This procedure is called to update all the virtual root
- * geometry information in wmPtr.
+ * This procedure is called to update all the virtual root geometry
+ * information in wmPtr.
*
* Results:
* None.
*
* Side effects:
- * The vRootX, vRootY, vRootWidth, and vRootHeight fields in
- * wmPtr are filled with the most up-to-date information.
+ * The vRootX, vRootY, vRootWidth, and vRootHeight fields in wmPtr are
+ * filled with the most up-to-date information.
*
*----------------------------------------------------------------------
*/
static void
UpdateVRootGeometry(
- WmInfo *wmPtr) /* Window manager information to be
- * updated. The wmPtr->vRoot field must
- * be valid. */
+ WmInfo *wmPtr) /* Window manager information to be updated.
+ * The wmPtr->vRoot field must be valid. */
{
TkWindow *winPtr = wmPtr->winPtr;
unsigned int bd, dummy;
@@ -4022,8 +4005,7 @@ UpdateVRootGeometry(
* Refresh the virtual root information if it's out of date.
*/
- handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1, NULL, NULL);
status = XGetGeometry(winPtr->display, wmPtr->vRoot,
&dummy2, &wmPtr->vRootX, &wmPtr->vRootY,
&wmPtr->vRootWidth, &wmPtr->vRootHeight, &bd, &dummy);
@@ -4035,7 +4017,7 @@ UpdateVRootGeometry(
Tk_DeleteErrorHandler(handler);
if (status == 0) {
/*
- * The virtual root is gone! Pretend that it never existed.
+ * The virtual root is gone! Pretend that it never existed.
*/
wmPtr->vRoot = None;
@@ -4048,16 +4030,15 @@ UpdateVRootGeometry(
*
* Tk_GetVRootGeometry --
*
- * This procedure returns information about the virtual root
- * window corresponding to a particular Tk window.
+ * This procedure returns information about the virtual root window
+ * corresponding to a particular Tk window.
*
* Results:
- * The values at xPtr, yPtr, widthPtr, and heightPtr are set
- * with the offset and dimensions of the root window corresponding
- * to tkwin. If tkwin is being managed by a virtual root window
- * manager these values correspond to the virtual root window being
- * used for tkwin; otherwise the offsets will be 0 and the
- * dimensions will be those of the screen.
+ * The values at xPtr, yPtr, widthPtr, and heightPtr are set with the
+ * offset and dimensions of the root window corresponding to tkwin. If
+ * tkwin is being managed by a virtual root window manager these values
+ * correspond to the virtual root window being used for tkwin; otherwise
+ * the offsets will be 0 and the dimensions will be those of the screen.
*
* Side effects:
* Vroot window information is refreshed if it is out of date.
@@ -4088,8 +4069,8 @@ Tk_GetVRootGeometry(
wmPtr = winPtr->wmInfoPtr;
/*
- * Make sure that the geometry information is up-to-date, then copy
- * it out to the caller.
+ * Make sure that the geometry information is up-to-date, then copy it out
+ * to the caller.
*/
if (wmPtr->flags & WM_VROOT_OFFSET_STALE) {
@@ -4106,18 +4087,17 @@ Tk_GetVRootGeometry(
*
* Tk_MoveToplevelWindow --
*
- * This procedure is called instead of Tk_MoveWindow to adjust
- * the x-y location of a top-level window. It delays the actual
- * move to a later time and keeps window-manager information
- * up-to-date with the move
+ * This procedure is called instead of Tk_MoveWindow to adjust the x-y
+ * location of a top-level window. It delays the actual move to a later
+ * time and keeps window-manager information up-to-date with the move.
*
* Results:
* None.
*
* Side effects:
* The window is eventually moved so that its upper-left corner
- * (actually, the upper-left corner of the window's decorative
- * frame, if there is one) is at (x,y).
+ * (actually, the upper-left corner of the window's decorative frame, if
+ * there is one) is at (x,y).
*
*----------------------------------------------------------------------
*/
@@ -4125,8 +4105,7 @@ Tk_GetVRootGeometry(
void
Tk_MoveToplevelWindow(
Tk_Window tkwin, /* Window to move. */
- int x, int y) /* New location for window (within
- * parent). */
+ int x, int y) /* New location for window (within parent). */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4145,16 +4124,15 @@ Tk_MoveToplevelWindow(
/*
* If the window has already been mapped, must bring its geometry
- * up-to-date immediately, otherwise an event might arrive from the
- * server that would overwrite wmPtr->x and wmPtr->y and lose the
- * new position.
+ * up-to-date immediately, otherwise an event might arrive from the server
+ * that would overwrite wmPtr->x and wmPtr->y and lose the new position.
*/
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tk_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tk_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
- UpdateGeometryInfo((ClientData) winPtr);
+ UpdateGeometryInfo(winPtr);
}
}
@@ -4169,9 +4147,9 @@ Tk_MoveToplevelWindow(
* None.
*
* Side effects:
- * WinPtr gets restacked as specified by aboveBelow and otherPtr.
- * This procedure doesn't return until the restack has taken
- * effect and the ConfigureNotify event for it has been received.
+ * WinPtr gets restacked as specified by aboveBelow and otherPtr. This
+ * procedure doesn't return until the restack has taken effect and the
+ * ConfigureNotify event for it has been received.
*
*----------------------------------------------------------------------
*/
@@ -4181,9 +4159,9 @@ TkWmRestackToplevel(
TkWindow *winPtr, /* Window to restack. */
int aboveBelow, /* Gives relative position for restacking;
* must be Above or Below. */
- TkWindow *otherPtr) /* Window relative to which to restack;
- * if NULL, then winPtr gets restacked
- * above or below *all* siblings. */
+ TkWindow *otherPtr) /* Window relative to which to restack; if
+ * NULL, then winPtr gets restacked above or
+ * below *all* siblings. */
{
WmInfo *wmPtr;
@@ -4194,15 +4172,15 @@ TkWmRestackToplevel(
/*
* Get the mac window. Make sure it exists & is mapped.
*/
+
if (winPtr->window == None) {
Tk_MakeWindowExist((Tk_Window) winPtr);
}
if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
-
/*
- * Can't set stacking order properly until the window is on the
- * screen (mapping it may give it a reparent window), so make sure
- * it's on the screen.
+ * Can't set stacking order properly until the window is on the screen
+ * (mapping it may give it a reparent window), so make sure it's on
+ * the screen.
*/
TkWmMapWindow(winPtr);
@@ -4212,6 +4190,7 @@ TkWmRestackToplevel(
/*
* Get the window in which a raise or lower is in relation to.
*/
+
if (otherPtr != NULL) {
if (otherPtr->window == None) {
Tk_MakeWindowExist((Tk_Window) otherPtr);
@@ -4233,8 +4212,8 @@ TkWmRestackToplevel(
*/
} else if (otherMacWindow == frontWindow || otherMacWindow == NULL) {
/*
- * Raise the window to the top. If the window is visible then
- * we also make it the active window.
+ * Raise the window to the top. If the window is visible then we
+ * also make it the active window.
*/
if (wmPtr->hints.initial_state == WithdrawnState) {
@@ -4277,27 +4256,26 @@ TkWmRestackToplevel(
* TkWmAddToColormapWindows --
*
* This procedure is called to add a given window to the
- * WM_COLORMAP_WINDOWS property for its top-level, if it
- * isn't already there. It is invoked by the Tk code that
- * creates a new colormap, in order to make sure that colormap
- * information is propagated to the window manager by default.
+ * WM_COLORMAP_WINDOWS property for its top-level, if it isn't already
+ * there. It is invoked by the Tk code that creates a new colormap, in
+ * order to make sure that colormap information is propagated to the
+ * window manager by default.
*
* Results:
* None.
*
* Side effects:
- * WinPtr's window gets added to the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * colormaps have been set explicitly with the
- * "wm colormapwindows" command.
+ * WinPtr's window gets added to the WM_COLORMAP_WINDOWS property of its
+ * nearest top-level ancestor, unless the colormaps have been set
+ * explicitly with the "wm colormapwindows" command.
*
*----------------------------------------------------------------------
*/
void
TkWmAddToColormapWindows(
- TkWindow *winPtr) /* Window with a non-default colormap.
- * Should not be a top-level window. */
+ TkWindow *winPtr) /* Window with a non-default colormap. Should
+ * not be a top-level window. */
{
TkWindow *topPtr;
TkWindow **oldPtr, **newPtr;
@@ -4337,14 +4315,13 @@ TkWmAddToColormapWindows(
}
/*
- * Make a new bigger array and use it to reset the property.
- * Automatically add the toplevel itself as the last element
- * of the list.
+ * Make a new bigger array and use it to reset the property. Automatically
+ * add the toplevel itself as the last element of the list.
*/
- newPtr = (TkWindow **) ckalloc((unsigned) ((count+2)*sizeof(TkWindow*)));
+ newPtr = (TkWindow **) ckalloc((unsigned) (count+2)*sizeof(TkWindow *));
if (count > 0) {
- memcpy(newPtr, oldPtr, count * sizeof(TkWindow*));
+ memcpy(newPtr, oldPtr, count * sizeof(TkWindow *));
}
if (count == 0) {
count++;
@@ -4359,9 +4336,8 @@ TkWmAddToColormapWindows(
topPtr->wmInfoPtr->cmapCount = count+1;
/*
- * On the Macintosh all of this is just an excercise
- * in compatability as we don't support colormaps. If
- * we did they would be installed here.
+ * On the Macintosh all of this is just an excercise in compatability as
+ * we don't support colormaps. If we did they would be installed here.
*/
}
@@ -4371,16 +4347,16 @@ TkWmAddToColormapWindows(
* TkWmRemoveFromColormapWindows --
*
* This procedure is called to remove a given window from the
- * WM_COLORMAP_WINDOWS property for its top-level. It is invoked
- * when windows are deleted.
+ * WM_COLORMAP_WINDOWS property for its top-level. It is invoked when
+ * windows are deleted.
*
* Results:
* None.
*
* Side effects:
- * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * top-level itself is being deleted too.
+ * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS property of
+ * its nearest top-level ancestor, unless the top-level itself is being
+ * deleted too.
*
*----------------------------------------------------------------------
*/
@@ -4398,8 +4374,8 @@ TkWmRemoveFromColormapWindows(
for (topPtr = winPtr->parentPtr; ; topPtr = topPtr->parentPtr) {
if (topPtr == NULL) {
/*
- * Ancestors have been deleted, so skip the whole operation.
- * Seems like this can't ever happen?
+ * Ancestors have been deleted, so skip the whole operation. Seems
+ * like this can't ever happen?
*/
return;
@@ -4410,16 +4386,15 @@ TkWmRemoveFromColormapWindows(
}
if (topPtr->flags & TK_ALREADY_DEAD) {
/*
- * Top-level is being deleted, so there's no need to cleanup
- * the WM_COLORMAP_WINDOWS property.
+ * Top-level is being deleted, so there's no need to cleanup the
+ * WM_COLORMAP_WINDOWS property.
*/
return;
}
/*
- * Find the window and slide the following ones down to cover
- * it up.
+ * Find the window and slide the following ones down to cover it up.
*/
count = topPtr->wmInfoPtr->cmapCount;
@@ -4443,10 +4418,10 @@ TkWmRemoveFromColormapWindows(
* Fetch the position of the mouse pointer.
*
* Results:
- * *xPtr and *yPtr are filled in with the (virtual) root coordinates
- * of the mouse pointer for tkwin's display. If the pointer isn't
- * on tkwin's screen, then -1 values are returned for both
- * coordinates. The argument tkwin must be a toplevel window.
+ * *xPtr and *yPtr are filled in with the (virtual) root coordinates of
+ * the mouse pointer for tkwin's display. If the pointer isn't on tkwin's
+ * screen, then -1 values are returned for both coordinates. The argument
+ * tkwin must be a toplevel window.
*
* Side effects:
* None.
@@ -4456,8 +4431,8 @@ TkWmRemoveFromColormapWindows(
void
TkGetPointerCoords(
- Tk_Window tkwin, /* Toplevel window that identifies screen
- * on which lookup is to be done. */
+ Tk_Window tkwin, /* Toplevel window that identifies screen on
+ * which lookup is to be done. */
int *xPtr, int *yPtr) /* Store pointer coordinates here. */
{
XQueryPointer(NULL, None, NULL, NULL, xPtr, yPtr, NULL, NULL, NULL);
@@ -4468,10 +4443,10 @@ TkGetPointerCoords(
*
* InitialWindowBounds --
*
- * This function calculates the initial bounds for a new Mac
- * toplevel window. Unless the geometry is specified by the user
- * this code will auto place the windows in a cascade diagonially
- * across the main monitor of the Mac.
+ * This function calculates the initial bounds for a new Mac toplevel
+ * window. Unless the geometry is specified by the user this code will
+ * auto place the windows in a cascade diagonially across the main
+ * monitor of the Mac.
*
* Results:
* The bounds are returned in geometry.
@@ -4527,9 +4502,9 @@ InitialWindowBounds(
*
* TkMacOSXResizable --
*
- * This function determines if the passed in window is part of
- * a toplevel window that is resizable. If the window is
- * resizable in the x, y or both directions, true is returned.
+ * This function determines if the passed in window is part of a toplevel
+ * window that is resizable. If the window is resizable in the x, y or
+ * both directions, true is returned.
*
* Results:
* True if resizable, false otherwise.
@@ -4567,10 +4542,10 @@ TkMacOSXResizable(
*
* TkMacOSXGrowToplevel --
*
- * The function is invoked when the user clicks in the grow region
- * of a Tk window. The function will handle the dragging
- * procedure and not return until completed. Finally, the function
- * may place information Tk's event queue is the window was resized.
+ * The function is invoked when the user clicks in the grow region of a
+ * Tk window. The function will handle the dragging procedure and not
+ * return until completed. Finally, the function may place information
+ * Tk's event queue is the window was resized.
*
* Results:
* True if events were placed on event queue, false otherwise.
@@ -4689,8 +4664,8 @@ TkMacOSXGrowToplevel(
*
* TkSetWMName --
*
- * Set the title for a toplevel window. If the window is embedded,
- * do not change the window title.
+ * Set the title for a toplevel window. If the window is embedded, do not
+ * change the window title.
*
* Results:
* None.
@@ -4712,7 +4687,7 @@ TkSetWMName(
return;
}
- title = CFStringCreateWithBytes(NULL, (const unsigned char*) titleUid,
+ title = CFStringCreateWithBytes(NULL, (const unsigned char *) titleUid,
strlen(titleUid), kCFStringEncodingUTF8, false);
if (title) {
WindowRef macWin = TkMacOSXDrawableWindow(winPtr->window);
@@ -4727,8 +4702,8 @@ TkSetWMName(
*
* TkGetTransientMaster --
*
- * If the passed window has the TRANSIENT_FOR property set this
- * will return the master window. Otherwise it will return None.
+ * If the passed window has the TRANSIENT_FOR property set this will
+ * return the master window. Otherwise it will return None.
*
* Results:
* The master window or None.
@@ -4786,10 +4761,9 @@ TkMacOSXGetXWindow(
*
* TkMacOSXIsWindowZoomed --
*
- * Ask Carbon if the given window is in the zoomed out state.
- * Because dragging & growing a window can change the Carbon
- * zoom state, we cannot rely on wmInfoPtr->hints.initial_state
- * for this information.
+ * Ask Carbon if the given window is in the zoomed out state. Because
+ * dragging & growing a window can change the Carbon zoom state, we
+ * cannot rely on wmInfoPtr->hints.initial_state for this information.
*
* Results:
* True if window is zoomed out, false otherwise.
@@ -4846,11 +4820,10 @@ TkMacOSXIsWindowZoomed(
*
* TkMacOSXZoomToplevel --
*
- * The function is invoked when the user clicks in the zoom region
- * of a Tk window or when the window state is set/unset to "zoomed"
- * manually. If the window is to be zoomed (in or out), the window
- * size is changed and events are generated to let Tk know what
- * happened.
+ * The function is invoked when the user clicks in the zoom region of a
+ * Tk window or when the window state is set/unset to "zoomed" manually.
+ * If the window is to be zoomed (in or out), the window size is changed
+ * and events are generated to let Tk know what happened.
*
* Results:
* True if events were placed on event queue, false otherwise.
@@ -4915,13 +4888,12 @@ TkMacOSXZoomToplevel(
}
err = ChkErr(ZoomWindowIdeal, whichWindow, zoomPart, &idealSize);
- if (err == noErr) {
- wmPtr->hints.initial_state =
- (zoomPart == inZoomIn ? NormalState : ZoomState);
- return true;
- } else {
+ if (err != noErr) {
return false;
}
+ wmPtr->hints.initial_state =
+ (zoomPart == inZoomIn ? NormalState : ZoomState);
+ return true;
}
/*
@@ -4930,9 +4902,8 @@ TkMacOSXZoomToplevel(
* TkUnsupported1Cmd --
*
* This procedure is invoked to process the
- * "::tk::unsupported::MacWindowStyle" Tcl command.
- * This command allows you to set the style of decoration
- * for a Macintosh window.
+ * "::tk::unsupported::MacWindowStyle" Tcl command. This command allows
+ * you to set the style of decoration for a Macintosh window.
*
* Results:
* A standard Tcl result.
@@ -4946,11 +4917,10 @@ TkMacOSXZoomToplevel(
/* ARGSUSED */
int
TkUnsupported1ObjCmd(
- ClientData clientData, /* Main window associated with
- * interpreter. */
+ ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj * const objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *subcmds[] = {
"style", NULL
@@ -4958,7 +4928,7 @@ TkUnsupported1ObjCmd(
enum SubCmds {
TKMWS_STYLE
};
- Tk_Window tkwin = (Tk_Window) clientData;
+ Tk_Window tkwin = clientData;
TkWindow *winPtr;
int index;
@@ -4967,8 +4937,8 @@ TkUnsupported1ObjCmd(
return TCL_ERROR;
}
- winPtr = (TkWindow *) Tk_NameToWindow(interp,
- Tcl_GetString(objv[2]), tkwin);
+ winPtr = (TkWindow *)
+ Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
if (winPtr == NULL) {
return TCL_ERROR;
}
@@ -5000,9 +4970,8 @@ TkUnsupported1ObjCmd(
* WmWinStyle --
*
* This procedure is invoked to process the
- * "::tk::unsupported::MacWindowStyle style" subcommand.
- * This command allows you to set the style of decoration
- * for a Macintosh window.
+ * "::tk::unsupported::MacWindowStyle style" subcommand. This command
+ * allows you to set the style of decoration for a Macintosh window.
*
* Results:
* A standard Tcl result.
@@ -5012,6 +4981,7 @@ TkUnsupported1ObjCmd(
*
*----------------------------------------------------------------------
*/
+
static int
WmWinStyle(
Tcl_Interp *interp, /* Current interpreter. */
@@ -5100,7 +5070,7 @@ WmWinStyle(
if (objc == 3) {
if (wmPtr->style != -1) {
for (i = 0; styleMap[i].strValue != NULL; i++) {
- if (wmPtr->style == (short)(styleMap[i].intValue)) {
+ if (wmPtr->style == (short) styleMap[i].intValue) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj(styleMap[i].strValue, -1));
return TCL_OK;
@@ -5201,8 +5171,8 @@ WmWinStyle(
*
* TkpMakeMenuWindow --
*
- * Configure the window to be either a undecorated pull-down
- * (or pop-up) menu, or as a toplevel floating menu (palette).
+ * Configure the window to be either a undecorated pull-down (or pop-up)
+ * menu, or as a toplevel floating menu (palette).
*
* Results:
* None.
@@ -5216,10 +5186,10 @@ WmWinStyle(
void
TkpMakeMenuWindow(
Tk_Window tkwin, /* New window. */
- int transient) /* 1 means menu is only posted briefly as
- * a popup or pulldown or cascade. 0 means
- * menu is always visible, e.g. as a
- * floating menu. */
+ int transient) /* 1 means menu is only posted briefly as a
+ * popup or pulldown or cascade. 0 means menu
+ * is always visible, e.g. as a floating
+ * menu. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -5239,8 +5209,8 @@ TkpMakeMenuWindow(
*
* TkMacOSXMakeRealWindowExist --
*
- * This function finally creates the real Macintosh window that
- * the Mac actually understands.
+ * This function finally creates the real Macintosh window that the Mac
+ * actually understands.
*
* Results:
* None.
@@ -5390,8 +5360,8 @@ TkMacOSXMakeRealWindowExist(
*
* TkMacOSXRegisterOffScreenWindow --
*
- * This function adds the passed in Off Screen Port to the
- * hash table that maps Mac windows to root X windows.
+ * This function adds the passed in Off Screen Port to the hash table
+ * that maps Mac windows to root X windows.
*
* Results:
* None.
@@ -5426,9 +5396,8 @@ TkMacOSXRegisterOffScreenWindow(
*
* TkMacOSXUnregisterMacWindow --
*
- * Given a macintosh port window, this function removes the
- * association between this window and the root X window that
- * Tk cares about.
+ * Given a macintosh port window, this function removes the association
+ * between this window and the root X window that Tk cares about.
*
* Results:
* None.
@@ -5461,9 +5430,8 @@ TkMacOSXUnregisterMacWindow(
*
* TkMacOSXSetScrollbarGrow --
*
- * Sets a flag for a toplevel window indicating that the passed
- * Tk scrollbar window will display the grow region for the
- * toplevel window.
+ * Sets a flag for a toplevel window indicating that the passed Tk
+ * scrollbar window will display the grow region for the toplevel window.
*
* Results:
* None.
@@ -5495,15 +5463,15 @@ TkMacOSXSetScrollbarGrow(
* TkWmFocusToplevel --
*
* This is a utility procedure invoked by focus-management code. It
- * exists because of the extra wrapper windows that exist under
- * Unix; its job is to map from wrapper windows to the
- * corresponding toplevel windows. On PCs and Macs there are no
- * wrapper windows so no mapping is necessary; this procedure just
- * determines whether a window is a toplevel or not.
+ * exists because of the extra wrapper windows that exist under Unix; its
+ * job is to map from wrapper windows to the corresponding toplevel
+ * windows. On PCs and Macs there are no wrapper windows so no mapping is
+ * necessary; this procedure just determines whether a window is a
+ * toplevel or not.
*
* Results:
- * If winPtr is a toplevel window, returns the pointer to the
- * window; otherwise returns NULL.
+ * If winPtr is a toplevel window, returns the pointer to the window;
+ * otherwise returns NULL.
*
* Side effects:
* None.
@@ -5527,13 +5495,13 @@ TkWmFocusToplevel(
*
* TkpGetWrapperWindow --
*
- * This is a utility procedure invoked by focus-management code. It
- * maps to the wrapper for a top-level, which is just the same
- * as the top-level on Macs and PCs.
+ * This is a utility procedure invoked by focus-management code. It maps
+ * to the wrapper for a top-level, which is just the same as the
+ * top-level on Macs and PCs.
*
* Results:
- * If winPtr is a toplevel window, returns the pointer to the
- * window; otherwise returns NULL.
+ * If winPtr is a toplevel window, returns the pointer to the window;
+ * otherwise returns NULL.
*
* Side effects:
* None.
@@ -5557,8 +5525,8 @@ TkpGetWrapperWindow(
*
* TkpWmSetState --
*
- * Sets the window manager state for the wrapper window of a
- * given toplevel window.
+ * Sets the window manager state for the wrapper window of a given
+ * toplevel window.
*
* Results:
* None.
@@ -5570,9 +5538,9 @@ TkpGetWrapperWindow(
*/
void
-TkpWmSetState(winPtr, state)
- TkWindow *winPtr; /* Toplevel window to operate on. */
- int state; /* One of IconicState, ZoomState, NormalState,
+TkpWmSetState(
+ TkWindow *winPtr, /* Toplevel window to operate on. */
+ int state) /* One of IconicState, ZoomState, NormalState,
* or WithdrawnState. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -5589,9 +5557,10 @@ TkpWmSetState(winPtr, state)
Tk_UnmapWindow((Tk_Window) winPtr);
} else if (state == IconicState) {
/*
- * The window always gets unmapped. If we can show the
- * icon version of the window we also collapse it.
+ * The window always gets unmapped. If we can show the icon version of
+ * the window we also collapse it.
*/
+
if (IsWindowCollapsable(macWin) && !IsWindowCollapsed(macWin)) {
CollapseWindow(macWin, true);
}
@@ -5669,9 +5638,9 @@ TkMacOSXWindowClass(
*
* TkMacOSXWindowOffset --
*
- * Determines the x and y offset from the orgin of the toplevel
- * window dressing (the structure region, ie. title bar) and the
- * orgin of the content area.
+ * Determines the x and y offset from the orgin of the toplevel window
+ * dressing (the structure region, i.e. title bar) and the orgin of the
+ * content area.
*
* Results:
* The x & y offset in pixels.
@@ -5704,8 +5673,8 @@ TkMacOSXWindowOffset(
*
* TkpGetMS --
*
- * Return a relative time in milliseconds. It doesn't matter
- * when the epoch was.
+ * Return a relative time in milliseconds. It doesn't matter when the
+ * epoch was.
*
* Results:
* Number of milliseconds.
@@ -5758,15 +5727,14 @@ XSetInputFocus(
*
* TkpChangeFocus --
*
- * This procedure is a stub on the Mac because we always own the
- * focus if we are a front most application.
+ * This procedure is a stub on the Mac because we always own the focus if
+ * we are a front most application.
*
* Results:
- * The return value is the serial number of the command that
- * changed the focus. It may be needed by the caller to filter
- * out focus change events that were queued before the command.
- * If the procedure doesn't actually change the focus then
- * it returns 0.
+ * The return value is the serial number of the command that changed the
+ * focus. It may be needed by the caller to filter out focus change
+ * events that were queued before the command. If the procedure doesn't
+ * actually change the focus then it returns 0.
*
* Side effects:
* None.
@@ -5775,15 +5743,15 @@ XSetInputFocus(
*/
int
-TkpChangeFocus(winPtr, force)
- TkWindow *winPtr; /* Window that is to receive the X focus. */
- int force; /* Non-zero means claim the focus even
- * if it didn't originally belong to
- * topLevelPtr's application. */
+TkpChangeFocus(
+ TkWindow *winPtr, /* Window that is to receive the X focus. */
+ int force) /* Non-zero means claim the focus even if it
+ * didn't originally belong to topLevelPtr's
+ * application. */
{
/*
- * We don't really need to do anything on the Mac. Tk will
- * keep all this state for us.
+ * We don't really need to do anything on the Mac. Tk will keep all this
+ * state for us.
*/
if (winPtr->atts.override_redirect) {
@@ -5791,10 +5759,10 @@ TkpChangeFocus(winPtr, force)
}
/*
- * Remember the current serial number for the X server and issue
- * a dummy server request. This marks the position at which we
- * changed the focus, so we can distinguish FocusIn and FocusOut
- * events on either side of the mark.
+ * Remember the current serial number for the X server and issue a dummy
+ * server request. This marks the position at which we changed the focus,
+ * so we can distinguish FocusIn and FocusOut events on either side of the
+ * mark.
*/
return NextRequest(winPtr->display);
@@ -5805,13 +5773,12 @@ TkpChangeFocus(winPtr, force)
*
* WmStackorderToplevelWrapperMap --
*
- * This procedure will create a table that maps the reparent wrapper
- * X id for a toplevel to the TkWindow structure that is wraps.
- * Tk keeps track of a mapping from the window X id to the TkWindow
- * structure but that does us no good here since we only get the X
- * id of the wrapper window. Only those toplevel windows that are
- * mapped have a position in the stacking order.
- *
+ * This procedure will create a table that maps the reparent wrapper X id
+ * for a toplevel to the TkWindow structure that is wraps. Tk keeps track
+ * of a mapping from the window X id to the TkWindow structure but that
+ * does us no good here since we only get the X id of the wrapper window.
+ * Only those toplevel windows that are mapped have a position in the
+ * stacking order.
*
* Results:
* None.
@@ -5838,7 +5805,7 @@ WmStackorderToplevelWrapperMap(
macWindow = TkMacOSXDrawableWindow(winPtr->window);
hPtr = Tcl_CreateHashEntry(table,
- (const char *) macWindow, &newEntry);
+ (const char *) macWindow, &newEntry);
Tcl_SetHashValue(hPtr, winPtr);
}
@@ -5856,8 +5823,8 @@ WmStackorderToplevelWrapperMap(
* This procedure returns the stack order of toplevel windows.
*
* Results:
- * An array of pointers to tk window objects in stacking order
- * or else NULL if there was an error.
+ * An array of pointers to tk window objects in stacking order or else
+ * NULL if there was an error.
*
* Side effects:
* None.
@@ -5866,8 +5833,8 @@ WmStackorderToplevelWrapperMap(
*/
TkWindow **
-TkWmStackorderToplevel(parentPtr)
- TkWindow *parentPtr; /* Parent toplevel window. */
+TkWmStackorderToplevel(
+ TkWindow *parentPtr) /* Parent toplevel window. */
{
WindowRef frontWindow;
TkWindow *childWinPtr, **windows, **window_ptr;
@@ -5882,12 +5849,12 @@ TkWmStackorderToplevel(parentPtr)
Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS);
WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table);
- windows = (TkWindow **) ckalloc((table.numEntries+1)
- * sizeof(TkWindow *));
+ windows = (TkWindow **)
+ ckalloc((table.numEntries+1) * sizeof(TkWindow *));
/*
- * Special cases: If zero or one toplevels were mapped
- * there is no need to enumerate Windows.
+ * Special cases: If zero or one toplevels were mapped there is no need to
+ * enumerate Windows.
*/
switch (table.numEntries) {
@@ -5896,7 +5863,7 @@ TkWmStackorderToplevel(parentPtr)
goto done;
case 1:
hPtr = Tcl_FirstHashEntry(&table, &search);
- windows[0] = (TkWindow *) Tcl_GetHashValue(hPtr);
+ windows[0] = Tcl_GetHashValue(hPtr);
windows[1] = NULL;
goto done;
}
@@ -5908,20 +5875,21 @@ TkWmStackorderToplevel(parentPtr)
} else {
window_ptr = windows + table.numEntries;
*window_ptr-- = NULL;
- while (frontWindow != NULL) {
- hPtr = Tcl_FindHashEntry(&table, (char *) frontWindow);
- if (hPtr != NULL) {
- childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
- *window_ptr-- = childWinPtr;
- }
- frontWindow = GetNextWindow(frontWindow);
+ while (frontWindow != NULL) {
+ hPtr = Tcl_FindHashEntry(&table, (char *) frontWindow);
+ if (hPtr != NULL) {
+ childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
+ *window_ptr-- = childWinPtr;
}
- if (window_ptr != (windows-1))
+ frontWindow = GetNextWindow(frontWindow);
+ }
+ if (window_ptr != (windows-1)) {
Tcl_Panic("num matched toplevel windows does not equal num "
"children");
+ }
}
- done:
+ done:
Tcl_DeleteHashTable(&table);
return windows;
}
@@ -5977,7 +5945,7 @@ ApplyWindowClassAttributeChanges(
if (wmPtr->macClass != oldClass) {
TK_IF_MAC_OS_X_API (4, HIWindowChangeClass,
ChkErr(HIWindowChangeClass, macWindow, wmPtr->macClass);
- ) TK_ENDIF
+ ) TK_ENDIF;
ChkErr(GetWindowClass, macWindow, &(wmPtr->macClass));
}
if (newAttributes != oldAttributes) {
@@ -5998,7 +5966,7 @@ ApplyWindowClassAttributeChanges(
}
}
TkMacOSXInvalClipRgns((Tk_Window) winPtr);
- TkMacOSXInvalidateWindow((MacDrawable *)(winPtr->window),
+ TkMacOSXInvalidateWindow((MacDrawable *) winPtr->window,
TK_PARENT_WINDOW);
}
@@ -6006,6 +5974,7 @@ ApplyWindowClassAttributeChanges(
* The change of window class/attributes might have changed the window
* structure widths:
*/
+
GetWindowStructureWidths(macWindow, &strWidths);
wmPtr->xInParent = strWidths.left;
wmPtr->yInParent = strWidths.top;
@@ -6068,7 +6037,7 @@ ApplyMasterOverrideChanges(
WindowGroupRef group;
ApplyWindowClassAttributeChanges(winPtr, macWindow, oldClass,
- oldAttributes, 0);
+ oldAttributes, 0);
if (winPtr->atts.override_redirect && wmPtr->master != None) {
wmPtr->flags |= WM_TOPMOST;
@@ -6109,8 +6078,8 @@ WmGetWindowGroup(
group = GetWindowGroupOfClass(kUtilityWindowClass);
} else if (wmPtr->master != None) {
TkDisplay *dispPtr = TkGetDisplayList();
- TkWindow *masterWinPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display,
- wmPtr->master);
+ TkWindow *masterWinPtr = (TkWindow *)
+ Tk_IdToWindow(dispPtr->display, wmPtr->master);
if (masterWinPtr && masterWinPtr->window != None &&
TkMacOSXHostToplevelExists(masterWinPtr)) {
@@ -6165,9 +6134,11 @@ TkMacOSXMakeFullscreen(
if (fullscreen) {
int screenWidth = WidthOfScreen(Tk_Screen(winPtr));
int screenHeight = HeightOfScreen(Tk_Screen(winPtr));
+
/*
* Check max width and height if set by the user.
*/
+
if ((wmPtr->maxWidth > 0 && wmPtr->maxWidth < screenWidth)
|| (wmPtr->maxHeight > 0 && wmPtr->maxHeight < screenHeight)) {
if (interp) {
@@ -6272,8 +6243,8 @@ TkMacOSXEnterExitFullscreen(
*
* GetMinSize --
*
- * This function computes the current minWidth and minHeight values for
- * a window, taking into account the possibility that they may be
+ * This function computes the current minWidth and minHeight values for a
+ * window, taking into account the possibility that they may be
* defaulted.
*
* Results:
@@ -6307,41 +6278,43 @@ GetMinSize(
*/
switch (wmPtr->macClass) {
- case kDocumentWindowClass:
- case kMovableAlertWindowClass:
- case kMovableModalWindowClass:
- minWidth = 72;
- if (wmPtr->attributes & kWindowResizableAttribute) {
- minHeight = 15;
- }
- if (wmPtr->attributes & kWindowToolbarButtonAttribute) {
- minWidth += 29;
- }
- break;
- case kFloatingWindowClass:
- case kUtilityWindowClass:
- minWidth = 59;
- if (wmPtr->attributes & kWindowResizableAttribute) {
- minHeight = 11;
- }
- if (wmPtr->attributes & kWindowSideTitlebarAttribute) {
- int tmp = minWidth;
- minWidth = minHeight;
- minHeight = tmp;
- } else if (wmPtr->attributes & kWindowToolbarButtonAttribute) {
- minWidth += 29;
- }
- break;
- default:
- if (wmPtr->attributes & kWindowResizableAttribute) {
- minWidth = 15;
- minHeight = 15;
- }
- break;
+ case kDocumentWindowClass:
+ case kMovableAlertWindowClass:
+ case kMovableModalWindowClass:
+ minWidth = 72;
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ minHeight = 15;
+ }
+ if (wmPtr->attributes & kWindowToolbarButtonAttribute) {
+ minWidth += 29;
+ }
+ break;
+ case kFloatingWindowClass:
+ case kUtilityWindowClass:
+ minWidth = 59;
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ minHeight = 11;
+ }
+ if (wmPtr->attributes & kWindowSideTitlebarAttribute) {
+ int tmp = minWidth;
+
+ minWidth = minHeight;
+ minHeight = tmp;
+ } else if (wmPtr->attributes & kWindowToolbarButtonAttribute) {
+ minWidth += 29;
+ }
+ break;
+ default:
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ minWidth = 15;
+ minHeight = 15;
+ }
+ break;
}
if (wmPtr->gridWin != NULL) {
int base = winPtr->reqWidth - (wmPtr->reqGridWidth * wmPtr->widthInc);
+
if (base < 0) {
base = 0;
}
@@ -6367,8 +6340,8 @@ GetMinSize(
*
* GetMaxSize --
*
- * This function computes the current maxWidth and maxHeight values for
- * a window, taking into account the possibility that they may be
+ * This function computes the current maxWidth and maxHeight values for a
+ * window, taking into account the possibility that they may be
* defaulted.
*
* Results:
@@ -6398,6 +6371,7 @@ GetMaxSize(
*maxWidthPtr = wmPtr->maxWidth;
} else {
int maxWidth = maxBounds->right - maxBounds->left - wmPtr->xInParent;
+
if (wmPtr->gridWin != NULL) {
maxWidth = wmPtr->reqGridWidth
+ (maxWidth - winPtr->reqWidth)/wmPtr->widthInc;
@@ -6408,6 +6382,7 @@ GetMaxSize(
*maxHeightPtr = wmPtr->maxHeight;
} else {
int maxHeight = maxBounds->bottom - maxBounds->top - wmPtr->yInParent;
+
if (wmPtr->gridWin != NULL) {
maxHeight = wmPtr->reqGridHeight
+ (maxHeight - winPtr->reqHeight)/wmPtr->heightInc;
@@ -6421,8 +6396,7 @@ GetMaxSize(
*
* RemapWindows
*
- * Adjust parent/child relation ships of
- * the given window hierarchy.
+ * Adjust parent/child relation ships of the given window hierarchy.
*
* Results:
* none
@@ -6432,16 +6406,22 @@ GetMaxSize(
*
*----------------------------------------------------------------------
*/
+
static void
-RemapWindows(TkWindow *winPtr, MacDrawable *parentWin)
+RemapWindows(
+ TkWindow *winPtr,
+ MacDrawable *parentWin)
{
TkWindow *childPtr;
- /* Remove the OS specific window.
- * It will get rebuilt when the window gets Mapped.
+ /*
+ * Remove the OS specific window. It will get rebuilt when the window gets
+ * Mapped.
*/
+
if (winPtr->window != None) {
MacDrawable *macWin = (MacDrawable *) winPtr->window;
+
macWin->grafPtr = NULL;
macWin->toplevel = parentWin->toplevel;
winPtr->flags &= ~TK_MAPPED;
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index 2e66cb4..d936d9c 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -1,19 +1,19 @@
/*
* tkMacOSXXStubs.c --
*
- * This file contains most of the X calls called by Tk. Many of
- * these calls are just stubs and either don't make sense on the
- * Macintosh or thier implamentation just doesn't do anything. Other
- * calls will eventually be moved into other files.
+ * This file contains most of the X calls called by Tk. Many of these
+ * calls are just stubs and either don't make sense on the Macintosh or
+ * their implamentation just doesn't do anything. Other calls will
+ * eventually be moved into other files.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
* Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.25 2007/12/13 15:27:10 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.26 2008/04/27 22:39:12 dkf Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -23,8 +23,8 @@
/*
* Because this file is still under major development Debugger statements are
- * used through out this file. The define TCL_DEBUG will decide whether
- * the debugger statements actually call the debugger or not.
+ * used through out this file. The define TCL_DEBUG will decide whether the
+ * debugger statements actually call the debugger or not.
*/
#ifndef TCL_DEBUG
@@ -37,29 +37,32 @@
* Declarations of static variables used in this file.
*/
-static TkDisplay *gMacDisplay = NULL; /* Macintosh display. */
-static const char *macScreenName = ":0"; /* Default name of macintosh display. */
+static TkDisplay *gMacDisplay = NULL;
+ /* Macintosh display. */
+static const char *macScreenName = ":0";
+ /* Default name of macintosh display. */
/*
* Forward declarations of procedures used in this file.
*/
-static XID MacXIdAlloc(Display *display);
-static int DefaultErrorHandler(Display* display, XErrorEvent* err_evt);
+static XID MacXIdAlloc(Display *display);
+static int DefaultErrorHandler(Display *display,
+ XErrorEvent *err_evt);
/*
* Other declarations
*/
-static int DestroyImage(XImage *image);
-static unsigned long ImageGetPixel(XImage *image, int x, int y);
-static int PutPixel(XImage *image, int x, int y, unsigned long pixel);
+static int DestroyImage(XImage *image);
+static unsigned long ImageGetPixel(XImage *image, int x, int y);
+static int PutPixel(XImage *image, int x, int y,
+ unsigned long pixel);
#if 0
-static XImage *SubImage(XImage *image, int x, int y,
- unsigned int width, unsigned int height);
-static int AddPixel(XImage *image, long value);
+static XImage * SubImage(XImage *image, int x, int y,
+ unsigned int width, unsigned int height);
+static int AddPixel(XImage *image, long value);
#endif
-
/*
*----------------------------------------------------------------------
@@ -79,7 +82,8 @@ static int AddPixel(XImage *image, long value);
*/
void
-TkMacOSXDisplayChanged(Display *display)
+TkMacOSXDisplayChanged(
+ Display *display)
{
GDHandle graphicsDevice;
Screen *screen;
@@ -91,17 +95,17 @@ TkMacOSXDisplayChanged(Display *display)
screen = display->screens;
graphicsDevice = GetMainDevice();
- screen->root_depth = (*(*graphicsDevice)->gdPMap)->cmpSize *
- (*(*graphicsDevice)->gdPMap)->cmpCount;
- screen->height = (*graphicsDevice)->gdRect.bottom -
- (*graphicsDevice)->gdRect.top;
- screen->width = (*graphicsDevice)->gdRect.right -
- (*graphicsDevice)->gdRect.left;
+ screen->root_depth = (*(*graphicsDevice)->gdPMap)->cmpSize *
+ (*(*graphicsDevice)->gdPMap)->cmpCount;
+ screen->height = (*graphicsDevice)->gdRect.bottom -
+ (*graphicsDevice)->gdRect.top;
+ screen->width = (*graphicsDevice)->gdRect.right -
+ (*graphicsDevice)->gdRect.left;
- screen->mwidth = (screen->width * 254 + 360) / 720;
- screen->mheight = (screen->height * 254 + 360) / 720;
+ screen->mwidth = (screen->width * 254 + 360) / 720;
+ screen->mheight = (screen->height * 254 + 360) / 720;
- maxBounds = (Rect*) screen->ext_data;
+ maxBounds = (Rect *) screen->ext_data;
*maxBounds = bounds;
graphicsDevice = GetDeviceList();
while (graphicsDevice) {
@@ -121,8 +125,8 @@ TkMacOSXDisplayChanged(Display *display)
*
* TkpOpenDisplay --
*
- * Create the Display structure and fill it with device
- * specific information.
+ * Create the Display structure and fill it with device specific
+ * information.
*
* Results:
* Returns a Display structure on success or NULL on failure.
@@ -135,7 +139,7 @@ TkMacOSXDisplayChanged(Display *display)
TkDisplay *
TkpOpenDisplay(
- CONST char *display_name)
+ const char *display_name)
{
Display *display;
Screen *screen;
@@ -162,13 +166,13 @@ TkpOpenDisplay(
display->screens = screen;
display->nscreens = 1;
display->default_screen = 0;
- display->display_name = (char*)macScreenName;
+ display->display_name = (char *) macScreenName;
- Gestalt(gestaltQuickdrawVersion, (long*)&display->proto_minor_version);
+ Gestalt(gestaltQuickdrawVersion, (long *) &display->proto_minor_version);
display->proto_major_version = 10;
display->proto_minor_version -= gestaltMacOSXQD;
display->vendor = "Apple";
- Gestalt(gestaltSystemVersion, (long*)&display->release);
+ Gestalt(gestaltSystemVersion, (long *) &display->release);
/*
* These screen bits never change
@@ -177,7 +181,7 @@ TkpOpenDisplay(
screen->display = display;
screen->black_pixel = 0x00000000 | PIXEL_MAGIC << 24;
screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24;
- screen->ext_data = (XExtData*) &maxBounds;
+ screen->ext_data = (XExtData *) &maxBounds;
screen->root_visual = (Visual *) ckalloc(sizeof(Visual));
screen->root_visual->visualid = 0;
@@ -191,13 +195,14 @@ TkpOpenDisplay(
/*
* Initialize screen bits that may change
*/
+
TkMacOSXDisplayChanged(display);
gMacDisplay = (TkDisplay *) ckalloc(sizeof(TkDisplay));
/*
- * This is the quickest way to make sure that all the *Init
- * flags get properly initialized
+ * This is the quickest way to make sure that all the *Init flags get
+ * properly initialized
*/
bzero(gMacDisplay, sizeof(TkDisplay));
@@ -226,13 +231,14 @@ TkpCloseDisplay(
TkDisplay *displayPtr)
{
Display *display = displayPtr->display;
+
if (gMacDisplay != displayPtr) {
Tcl_Panic("TkpCloseDisplay: tried to call TkpCloseDisplay on bad display");
}
gMacDisplay = NULL;
- if (display->screens != (Screen *) NULL) {
- if (display->screens->root_visual != (Visual *) NULL) {
+ if (display->screens != NULL) {
+ if (display->screens->root_visual != NULL) {
ckfree((char *) display->screens->root_visual);
}
ckfree((char *) display->screens);
@@ -245,11 +251,10 @@ TkpCloseDisplay(
*
* TkClipCleanup --
*
- * This procedure is called to cleanup resources associated with
- * claiming clipboard ownership and for receiving selection get
- * results. This function is called in tkWindow.c. This has to be
- * called by the display cleanup function because we still need the
- * access display elements.
+ * This procedure is called to cleanup resources associated with claiming
+ * clipboard ownership and for receiving selection get results. This
+ * function is called in tkWindow.c. This has to be called by the display
+ * cleanup function because we still need the access display elements.
*
* Results:
* None.
@@ -261,12 +266,12 @@ TkpCloseDisplay(
*/
void
-TkClipCleanup(dispPtr)
- TkDisplay *dispPtr; /* display associated with clipboard */
+TkClipCleanup(
+ TkDisplay *dispPtr) /* display associated with clipboard */
{
/*
- * Make sure that the local scrap is transfered to the global
- * scrap if needed.
+ * Make sure that the local scrap is transfered to the global scrap if
+ * needed.
*/
TkSuspendClipboard();
@@ -278,7 +283,7 @@ TkClipCleanup(dispPtr)
dispPtr->windowAtom);
Tk_DestroyWindow(dispPtr->clipWindow);
- Tcl_Release((ClientData) dispPtr->clipWindow);
+ Tcl_Release(dispPtr->clipWindow);
dispPtr->clipWindow = NULL;
}
}
@@ -288,31 +293,31 @@ TkClipCleanup(dispPtr)
*
* MacXIdAlloc --
*
- * This procedure is invoked by Xlib as the resource allocator
- * for a display.
+ * This procedure is invoked by Xlib as the resource allocator for a
+ * display.
*
* Results:
- * The return value is an X resource identifier that isn't currently
- * in use.
+ * The return value is an X resource identifier that isn't currently in
+ * use.
*
* Side effects:
- * The identifier is removed from the stack of free identifiers,
- * if it was previously on the stack.
+ * The identifier is removed from the stack of free identifiers, if it
+ * was previously on the stack.
*
*----------------------------------------------------------------------
*/
static XID
MacXIdAlloc(
- Display *display) /* Display for which to allocate. */
+ Display *display) /* Display for which to allocate. */
{
- static long int cur_id = 100;
- /*
- * Some special XIds are reserved
- * - this is why we start at 100
- */
+ static long int cur_id = 100;
+ /*
+ * Some special XIds are reserved
+ * - this is why we start at 100
+ */
- return ++cur_id;
+ return ++cur_id;
}
/*
@@ -347,8 +352,8 @@ TkpWindowWasRecentlyDeleted(
*
* DefaultErrorHandler --
*
- * This procedure is the default X error handler. Tk uses it's
- * own error handler so this call should never be called.
+ * This procedure is the default X error handler. Tk uses it's own error
+ * handler so this call should never be called.
*
* Results:
* None.
@@ -365,14 +370,14 @@ DefaultErrorHandler(
XErrorEvent* err_evt)
{
/*
- * This call should never be called. Tk replaces
- * it with its own error handler.
+ * This call should never be called. Tk replaces it with its own error
+ * handler.
*/
+
Tcl_Panic("Warning hit bogus error handler!");
return 0;
}
-
char *
XGetAtomName(
Display * display,
@@ -383,7 +388,8 @@ XGetAtomName(
}
int
-_XInitImageFuncPtrs(XImage *image)
+_XInitImageFuncPtrs(
+ XImage *image)
{
return 0;
}
@@ -396,24 +402,25 @@ XSetErrorHandler(
}
Window
-XRootWindow(Display *display, int screen_number)
+XRootWindow(
+ Display *display,
+ int screen_number)
{
display->request++;
return ROOT_ID;
}
int
-XGetGeometry(display, d, root_return, x_return, y_return, width_return,
- height_return, border_width_return, depth_return)
- Display* display;
- Drawable d;
- Window* root_return;
- int* x_return;
- int* y_return;
- unsigned int* width_return;
- unsigned int* height_return;
- unsigned int* border_width_return;
- unsigned int* depth_return;
+XGetGeometry(
+ Display *display,
+ Drawable d,
+ Window *root_return,
+ int *x_return,
+ int *y_return,
+ unsigned int *width_return,
+ unsigned int *height_return,
+ unsigned int *border_width_return,
+ unsigned int *depth_return)
{
TkWindow *winPtr = ((MacDrawable *) d)->winPtr;
@@ -488,8 +495,8 @@ XSizeHints *
XAllocSizeHints(void)
{
/*
- * Always return NULL. Tk code checks to see if NULL
- * is returned & does nothing if it is.
+ * Always return NULL. Tk code checks to see if NULL is returned & does
+ * nothing if it is.
*/
return NULL;
@@ -670,10 +677,11 @@ XForceScreenSaver(
int mode)
{
/*
- * This function is just a no-op. It is defined to
- * reset the screen saver. However, there is no real
- * way to do this on a Mac. Let me know if there is!
+ * This function is just a no-op. It is defined to reset the screen saver.
+ * However, there is no real way to do this on a Mac. Let me know if there
+ * is!
*/
+
display->request++;
}
@@ -727,9 +735,9 @@ XSetClipRectangles(
*
* TkGetServerInfo --
*
- * Given a window, this procedure returns information about
- * the window server for that window. This procedure provides
- * the guts of the "winfo server" command.
+ * Given a window, this procedure returns information about the window
+ * server for that window. This procedure provides the guts of the "winfo
+ * server" command.
*
* Results:
* None.
@@ -742,10 +750,10 @@ XSetClipRectangles(
void
TkGetServerInfo(
- Tcl_Interp *interp, /* The server information is returned in
- * this interpreter's result. */
- Tk_Window tkwin) /* Token for window; this selects a
- * particular display and server. */
+ Tcl_Interp *interp, /* The server information is returned in this
+ * interpreter's result. */
+ Tk_Window tkwin) /* Token for window; this selects a particular
+ * display and server. */
{
char buffer[8 + TCL_INTEGER_SPACE * 2];
char buffer2[TCL_INTEGER_SPACE];
@@ -880,11 +888,15 @@ XGetImage(
if (TkMacOSXGetDrawablePort(d)) {
if (format == ZPixmap) {
if (width > 0 && height > 0) {
- /* Tk_GetPixmap fails for zero width or height */
+ /*
+ * Tk_GetPixmap fails for zero width or height.
+ */
+
pixmap = Tk_GetPixmap(display, d, width, height, depth);
}
if (win) {
XGCValues values;
+
gc = Tk_GetGC(win, 0, &values);
} else {
gc = XCreateGC(display, pixmap, 0, NULL);
@@ -893,18 +905,22 @@ XGetImage(
XCopyArea(display, d, pixmap, gc, x, y, width, height, 0, 0);
}
imagePtr = XCreateImage(display, NULL, depth, format, offset,
- (char*)TkMacOSXGetDrawablePort(pixmap),
- width, height, bitmap_pad, bytes_per_line);
- /* Track Pixmap underlying the XImage in the unused obdata field *
- * so that we can treat XImages coming from XGetImage specially. */
+ (char *) TkMacOSXGetDrawablePort(pixmap),
+ width, height, bitmap_pad, bytes_per_line);
+
+ /*
+ * Track Pixmap underlying the XImage in the unused obdata field
+ * so that we can treat XImages coming from XGetImage specially.
+ */
+
imagePtr->obdata = (XPointer) pixmap;
if (!win) {
XFreeGC(display, gc);
}
} else {
TkpDisplayWarning(
- "XGetImage: only ZPixmap types are implemented",
- "XGetImage Failure");
+ "XGetImage: only ZPixmap types are implemented",
+ "XGetImage Failure");
}
}
return imagePtr;
@@ -968,11 +984,14 @@ ImageGetPixel(
RGBColor cPix;
unsigned long r, g, b, c;
- destPort = (CGrafPtr)image->data;
+ destPort = (CGrafPtr) image->data;
portChanged = QDSwapPort(destPort, &savePort);
GetCPixel(x, y, &cPix);
if (image->obdata) {
- /* Image from XGetImage, 16 bit color values */
+ /*
+ * Image from XGetImage, 16 bit color values.
+ */
+
r = (cPix . red) >> 8;
g = (cPix . green) >> 8;
b = (cPix . blue) >> 8;
@@ -1018,18 +1037,21 @@ PutPixel(
destPort = (CGrafPtr)image->data;
portChanged = QDSwapPort(destPort, &savePort);
- r = (pixel & image->red_mask)>>16;
- g = (pixel & image->green_mask)>>8;
- b = (pixel & image->blue_mask);
+ r = (pixel & image->red_mask)>>16;
+ g = (pixel & image->green_mask)>>8;
+ b = (pixel & image->blue_mask);
if (image->obdata) {
- /* Image from XGetImage, 16 bit color values */
- cPix . red = r << 8;
- cPix . green = g << 8;
- cPix . blue = b << 8;
+ /*
+ * Image from XGetImage, 16 bit color values.
+ */
+
+ cPix.red = r << 8;
+ cPix.green = g << 8;
+ cPix.blue = b << 8;
} else {
- cPix . red = r;
- cPix . green = g;
- cPix . blue = b;
+ cPix.red = r;
+ cPix.green = g;
+ cPix.blue = b;
}
SetCPixel(x, y, &cPix);
if (portChanged) {
@@ -1068,8 +1090,8 @@ AddPixel(
* XSetWindowBackgroundPixmap, XSetWindowBorder, XSetWindowBorderPixmap,
* XSetWindowBorderWidth, XSetWindowColormap
*
- * These functions are all no-ops. They all have equivilent
- * Tk calls that should always be used instead.
+ * These functions are all no-ops. They all have equivilent Tk calls that
+ * should always be used instead.
*
* Results:
* None.
@@ -1180,10 +1202,10 @@ XCreateIC(
*----------------------------------------------------------------------
*/
-CONST char *
+const char *
TkGetDefaultScreenName(
Tcl_Interp *interp, /* Not used. */
- CONST char *screenName) /* If NULL, use default string. */
+ const char *screenName) /* If NULL, use default string. */
{
#if 0
if ((screenName == NULL) || (screenName[0] == '\0')) {
@@ -1202,8 +1224,8 @@ TkGetDefaultScreenName(
* Return the number of milliseconds the user was inactive.
*
* Results:
- * The number of milliseconds the user has been inactive,
- * or -1 if querying the inactive time is not supported.
+ * The number of milliseconds the user has been inactive, or -1 if
+ * querying the inactive time is not supported.
*
* Side effects:
* None.
@@ -1211,13 +1233,15 @@ TkGetDefaultScreenName(
*/
long
-Tk_GetUserInactiveTime(Display *dpy)
+Tk_GetUserInactiveTime(
+ Display *dpy)
{
io_registry_entry_t regEntry;
CFMutableDictionaryRef props = NULL;
CFTypeRef timeObj;
long ret = -1l;
uint64_t time;
+ IOReturn result;
regEntry = IOServiceGetMatchingService(kIOMasterPortDefault,
IOServiceMatching("IOHIDSystem"));
@@ -1226,7 +1250,7 @@ Tk_GetUserInactiveTime(Display *dpy)
return -1l;
}
- IOReturn result = IORegistryEntryCreateCFProperties(regEntry, &props,
+ result = IORegistryEntryCreateCFProperties(regEntry, &props,
kCFAllocatorDefault, 0);
IOObjectRelease(regEntry);
@@ -1244,13 +1268,13 @@ Tk_GetUserInactiveTime(Display *dpy)
CFRangeMake(0, sizeof(time)), (UInt8 *) &time);
/* Convert nanoseconds to milliseconds. */
/* ret /= kMillisecondScale; */
- ret = (long)(time/kMillisecondScale);
+ ret = (long) (time/kMillisecondScale);
} else if (type == CFNumberGetTypeID()) { /* Panther+ */
CFNumberGetValue((CFNumberRef)timeObj,
kCFNumberSInt64Type, &time);
/* Convert nanoseconds to milliseconds. */
/* ret /= kMillisecondScale; */
- ret = (long)(time/kMillisecondScale);
+ ret = (long) (time/kMillisecondScale);
} else {
ret = -1l;
}
@@ -1272,14 +1296,15 @@ Tk_GetUserInactiveTime(Display *dpy)
* none
*
* Side effects:
- * The user inactivity timer of the underlaying windowing system
- * is reset to zero.
+ * The user inactivity timer of the underlaying windowing system is reset
+ * to zero.
*
*----------------------------------------------------------------------
*/
void
-Tk_ResetUserInactiveTime(Display *dpy)
+Tk_ResetUserInactiveTime(
+ Display *dpy)
{
UpdateSystemActivity(OverallAct);
}
diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c
index 526a3e8..9ae77f1 100644
--- a/unix/tkAppInit.c
+++ b/unix/tkAppInit.c
@@ -10,14 +10,14 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkAppInit.c,v 1.8 2007/02/22 13:56:33 dkf Exp $
+ * RCS: @(#) $Id: tkAppInit.c,v 1.9 2008/04/27 22:39:12 dkf Exp $
*/
#include "tk.h"
#include "locale.h"
#ifdef TK_TEST
-extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int Tktest_Init(Tcl_Interp *interp);
#endif /* TK_TEST */
/*
@@ -52,7 +52,7 @@ main(
#ifndef TK_LOCAL_APPINIT
#define TK_LOCAL_APPINIT Tcl_AppInit
#endif
- extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
+ extern int TK_LOCAL_APPINIT(Tcl_Interp *interp);
/*
* The following #if block allows you to change how Tcl finds the startup
@@ -61,7 +61,7 @@ main(
*/
#ifdef TK_LOCAL_MAIN_HOOK
- extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
+ extern int TK_LOCAL_MAIN_HOOK(int *argc, char ***argv);
TK_LOCAL_MAIN_HOOK(&argc, &argv);
#endif
diff --git a/unix/tkUnix.c b/unix/tkUnix.c
index cd44149..986ca96 100644
--- a/unix/tkUnix.c
+++ b/unix/tkUnix.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: tkUnix.c,v 1.15 2007/12/13 15:28:50 dgp Exp $
+ * RCS: @(#) $Id: tkUnix.c,v 1.16 2008/04/27 22:39:13 dkf Exp $
*/
#include "tkInt.h"
@@ -71,11 +71,11 @@ TkGetServerInfo(
*----------------------------------------------------------------------
*/
-CONST char *
+const char *
TkGetDefaultScreenName(
Tcl_Interp *interp, /* Interp used to find environment
* variables. */
- CONST char *screenName) /* Screen name from command line, or NULL. */
+ const char *screenName) /* Screen name from command line, or NULL. */
{
if ((screenName == NULL) || (screenName[0] == '\0')) {
screenName = Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY);
diff --git a/unix/tkUnixConfig.c b/unix/tkUnixConfig.c
index 91a992a..65a23d7 100644
--- a/unix/tkUnixConfig.c
+++ b/unix/tkUnixConfig.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: tkUnixConfig.c,v 1.6 2007/12/13 15:28:50 dgp Exp $
+ * RCS: @(#) $Id: tkUnixConfig.c,v 1.7 2008/04/27 22:39:13 dkf Exp $
*/
#include "tkInt.h"
@@ -37,8 +37,8 @@
Tcl_Obj *
TkpGetSystemDefault(
Tk_Window tkwin, /* A window to use. */
- CONST char *dbName, /* The option database name. */
- CONST char *className) /* The name of the option class. */
+ const char *dbName, /* The option database name. */
+ const char *className) /* The name of the option class. */
{
return NULL;
}
diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c
index d57db13..103fd13 100644
--- a/unix/tkUnixCursor.c
+++ b/unix/tkUnixCursor.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: tkUnixCursor.c,v 1.13 2008/03/26 19:34:53 dgp Exp $
+ * RCS: @(#) $Id: tkUnixCursor.c,v 1.14 2008/04/27 22:39:13 dkf Exp $
*/
#include "tkInt.h"
@@ -30,8 +30,8 @@ typedef struct {
* the official cursor font:
*/
-static struct CursorName {
- CONST char *name;
+static const struct CursorName {
+ const char *name;
unsigned int shape;
} cursorNames[] = {
{"X_cursor", XC_X_cursor},
@@ -161,8 +161,8 @@ static struct CursorName {
#endif /* DEFINE_MYARROW_CURSOR */
-static struct TkCursorName {
- char *name;
+static const struct TkCursorName {
+ const char *name;
char *data;
char *mask;
} tkCursorNames[] = {
@@ -182,8 +182,8 @@ static struct TkCursorName {
#endif
static Cursor CreateCursorFromTableOrFile(Tcl_Interp *interp,
- Tk_Window tkwin, int argc, CONST char **argv,
- struct TkCursorName *tkCursorPtr);
+ Tk_Window tkwin, int argc, const char **argv,
+ const struct TkCursorName *tkCursorPtr);
/*
*----------------------------------------------------------------------
@@ -213,10 +213,10 @@ TkGetCursorByName(
TkUnixCursor *cursorPtr = NULL;
Cursor cursor = None;
int argc;
- CONST char **argv = NULL;
+ const char **argv = NULL;
Display *display = Tk_Display(tkwin);
int inTkTable = 0;
- struct TkCursorName* tkCursorPtr = NULL;
+ const struct TkCursorName *tkCursorPtr = NULL;
if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) {
return NULL;
@@ -247,7 +247,7 @@ TkGetCursorByName(
if ((argv[0][0] != '@') && !inTkTable) {
XColor fg, bg;
unsigned int maskIndex;
- register struct CursorName *namePtr;
+ register const struct CursorName *namePtr;
TkDisplay *dispPtr;
/*
@@ -377,8 +377,8 @@ CreateCursorFromTableOrFile(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
Tk_Window tkwin, /* Window in which cursor will be used. */
int argc,
- CONST char **argv, /* Cursor spec parsed into elements. */
- struct TkCursorName *tkCursorPtr)
+ const char **argv, /* Cursor spec parsed into elements. */
+ const struct TkCursorName *tkCursorPtr)
/* Non-NULL when cursor is defined in Tk
* table. */
{
@@ -388,8 +388,8 @@ CreateCursorFromTableOrFile(
int xHot = -1, yHot = -1;
int dummy1, dummy2;
XColor fg, bg;
- CONST char *fgColor;
- CONST char *bgColor;
+ const char *fgColor;
+ const char *bgColor;
int inTkTable = (tkCursorPtr != NULL);
Display *display = Tk_Display(tkwin);
@@ -430,7 +430,7 @@ CreateCursorFromTableOrFile(
ckfree(data);
} else {
if (TkReadBitmapFile(display, drawable, &argv[0][1],
- (unsigned int *) &width, (unsigned int *) &height,
+ (unsigned *) &width, (unsigned *) &height,
&source, &xHot, &yHot) != BitmapSuccess) {
Tcl_AppendResult(interp, "cleanup reading bitmap file \"",
&argv[0][1], "\"", NULL);
@@ -570,8 +570,8 @@ CreateCursorFromTableOrFile(
TkCursor *
TkCreateCursorFromData(
Tk_Window tkwin, /* Window in which cursor will be used. */
- CONST char *source, /* Bitmap data for cursor shape. */
- CONST char *mask, /* Bitmap data for cursor mask. */
+ const char *source, /* Bitmap data for cursor shape. */
+ const char *mask, /* Bitmap data for cursor mask. */
int width, int height, /* Dimensions of cursor. */
int xHot, int yHot, /* Location of hot-spot in cursor. */
XColor fgColor, /* Foreground color for cursor. */
diff --git a/unix/tkUnixDialog.c b/unix/tkUnixDialog.c
index 1299e90..851edf3 100644
--- a/unix/tkUnixDialog.c
+++ b/unix/tkUnixDialog.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: tkUnixDialog.c,v 1.6 2007/12/13 15:28:50 dgp Exp $
+ * RCS: @(#) $Id: tkUnixDialog.c,v 1.7 2008/04/27 22:39:13 dkf Exp $
*
*/
@@ -42,7 +42,7 @@ EvalObjv(
Tcl_Interp *interp, /* Current interpreter. */
char *cmdName, /* Name of the TCL command to call */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST *objv) /* Arguments. */
+ Tcl_Obj *const *objv) /* Arguments. */
{
Tcl_Obj *cmdObj, **objs;
int result;
@@ -85,7 +85,7 @@ Tk_ChooseColorObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST *objv) /* Arguments. */
+ Tcl_Obj *const *objv) /* Arguments. */
{
return EvalObjv(interp, "tk::ColorDialog", objc-1, objv+1);
}
@@ -114,9 +114,9 @@ Tk_GetOpenFileObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST *objv) /* Arguments. */
+ Tcl_Obj *const *objv) /* Arguments. */
{
- Tk_Window tkwin = (Tk_Window)clientData;
+ Tk_Window tkwin = clientData;
if (Tk_StrictMotif(tkwin)) {
return EvalObjv(interp, "tk::MotifOpenFDialog", objc-1, objv+1);
@@ -146,9 +146,9 @@ Tk_GetSaveFileObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST *objv) /* Arguments. */
+ Tcl_Obj *const *objv) /* Arguments. */
{
- Tk_Window tkwin = (Tk_Window)clientData;
+ Tk_Window tkwin = clientData;
if (Tk_StrictMotif(tkwin)) {
return EvalObjv(interp, "tk::MotifSaveFDialog", objc-1, objv+1);
@@ -180,7 +180,7 @@ Tk_MessageBoxCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST *objv) /* Arguments. */
+ Tcl_Obj *const *objv) /* Arguments. */
{
return EvalObjv(interp, "tk::MessageBox", objc-1, objv+1);
}
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index 9b93cb6..028d081 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.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: tkUnixEmbed.c,v 1.12 2007/12/13 15:28:50 dgp Exp $
+ * RCS: @(#) $Id: tkUnixEmbed.c,v 1.13 2008/04/27 22:39:13 dkf Exp $
*/
#include "tkUnixInt.h"
@@ -97,7 +97,7 @@ TkpUseWindow(
* string is bogus. */
Tk_Window tkwin, /* Tk window that does not yet have an
* associated X window. */
- CONST char *string) /* String identifying an X window to use for
+ const char *string) /* String identifying an X window to use for
* tkwin; must be an integer value. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -867,7 +867,7 @@ TkpTestembedCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
int all;
Container *containerPtr;
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index bb66552..8335b09 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.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: tkUnixEvent.c,v 1.27 2008/03/26 19:04:10 jenglish Exp $
+ * RCS: @(#) $Id: tkUnixEvent.c,v 1.28 2008/04/27 22:39:13 dkf Exp $
*/
#include "tkUnixInt.h"
@@ -115,7 +115,7 @@ DisplayExitHandler(
TkDisplay *
TkpOpenDisplay(
- CONST char *displayNameStr)
+ const char *displayNameStr)
{
TkDisplay *dispPtr;
Display *display = XOpenDisplay(displayNameStr);
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index d97723b..286ac32 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.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: tkUnixFont.c,v 1.33 2007/02/28 09:23:30 dkf Exp $
+ * RCS: @(#) $Id: tkUnixFont.c,v 1.34 2008/04/27 22:39:13 dkf Exp $
*/
#include "tkUnixInt.h"
@@ -21,7 +21,7 @@
* The preferred font encodings.
*/
-static CONST char *encodingList[] = {
+static const char *encodingList[] = {
"iso8859-1", "jis0208", "jis0212", NULL
};
@@ -207,31 +207,31 @@ static void FontPkgCleanup(ClientData clientData);
static FontFamily * AllocFontFamily(Display *display,
XFontStruct *fontStructPtr, int base);
static SubFont * CanUseFallback(UnixFont *fontPtr,
- CONST char *fallbackName, int ch,
+ const char *fallbackName, int ch,
SubFont **fixSubFontPtrPtr);
static SubFont * CanUseFallbackWithAliases(UnixFont *fontPtr,
char *fallbackName, int ch,
Tcl_DString *nameTriedPtr,
SubFont **fixSubFontPtrPtr);
-static int ControlUtfProc(ClientData clientData, CONST char *src,
+static int ControlUtfProc(ClientData clientData, const char *src,
int srcLen, int flags, Tcl_EncodingState*statePtr,
char *dst, int dstLen, int *srcReadPtr,
int *dstWrotePtr, int *dstCharsPtr);
static XFontStruct * CreateClosestFont(Tk_Window tkwin,
- CONST TkFontAttributes *faPtr,
- CONST TkXLFDAttributes *xaPtr);
+ const TkFontAttributes *faPtr,
+ const TkXLFDAttributes *xaPtr);
static SubFont * FindSubFontForChar(UnixFont *fontPtr, int ch,
SubFont **fixSubFontPtrPtr);
static void FontMapInsert(SubFont *subFontPtr, int ch);
static void FontMapLoadPage(SubFont *subFontPtr, int row);
static int FontMapLookup(SubFont *subFontPtr, int ch);
static void FreeFontFamily(FontFamily *afPtr);
-static CONST char * GetEncodingAlias(CONST char *name);
+static const char * GetEncodingAlias(const char *name);
static int GetFontAttributes(Display *display,
XFontStruct *fontStructPtr, FontAttributes *faPtr);
static XFontStruct * GetScreenFont(Display *display,
FontAttributes *wantPtr, char **nameList,
- int bestIdx[], unsigned int bestScore[]);
+ int bestIdx[], unsigned bestScore[]);
static XFontStruct * GetSystemFont(Display *display);
static int IdentifySymbolEncodings(FontAttributes *faPtr);
static void InitFont(Tk_Window tkwin, XFontStruct *fontStructPtr,
@@ -239,21 +239,21 @@ static void InitFont(Tk_Window tkwin, XFontStruct *fontStructPtr,
static void InitSubFont(Display *display,
XFontStruct *fontStructPtr, int base,
SubFont *subFontPtr);
-static char ** ListFonts(Display *display, CONST char *faceName,
+static char ** ListFonts(Display *display, const char *faceName,
int *numNamesPtr);
-static char ** ListFontOrAlias(Display *display, CONST char*faceName,
+static char ** ListFontOrAlias(Display *display, const char*faceName,
int *numNamesPtr);
-static unsigned int RankAttributes(FontAttributes *wantPtr,
+static unsigned RankAttributes(FontAttributes *wantPtr,
FontAttributes *gotPtr);
static void ReleaseFont(UnixFont *fontPtr);
static void ReleaseSubFont(Display *display, SubFont *subFontPtr);
-static int SeenName(CONST char *name, Tcl_DString *dsPtr);
+static int SeenName(const char *name, Tcl_DString *dsPtr);
#ifndef WORDS_BIGENDIAN
-static int Ucs2beToUtfProc(ClientData clientData, CONST char*src,
+static int Ucs2beToUtfProc(ClientData clientData, const char*src,
int srcLen, int flags, Tcl_EncodingState*statePtr,
char *dst, int dstLen, int *srcReadPtr,
int *dstWrotePtr, int *dstCharsPtr);
-static int UtfToUcs2beProc(ClientData clientData, CONST char*src,
+static int UtfToUcs2beProc(ClientData clientData, const char*src,
int srcLen, int flags, Tcl_EncodingState*statePtr,
char *dst, int dstLen, int *srcReadPtr,
int *dstWrotePtr, int *dstCharsPtr);
@@ -281,7 +281,7 @@ static void
FontPkgCleanup(
ClientData clientData)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->controlFamily.encoding != NULL) {
@@ -320,7 +320,7 @@ void
TkpFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_EncodingType type;
SubFont dummy;
@@ -382,7 +382,7 @@ TkpFontPkgInit(
static int
ControlUtfProc(
ClientData clientData, /* Not used. */
- CONST char *src, /* Source string in UTF-8. */
+ const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
@@ -406,7 +406,7 @@ ControlUtfProc(
* correspond to the bytes stored in the
* output buffer. */
{
- CONST char *srcStart, *srcEnd;
+ const char *srcStart, *srcEnd;
char *dstStart, *dstEnd;
Tcl_UniChar ch;
int result;
@@ -475,7 +475,7 @@ ControlUtfProc(
static int
Ucs2beToUtfProc(
ClientData clientData, /* Not used. */
- CONST char *src, /* Source string in Unicode. */
+ const char *src, /* Source string in Unicode. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
@@ -499,7 +499,7 @@ Ucs2beToUtfProc(
* correspond to the bytes stored in the
* output buffer. */
{
- CONST char *srcStart, *srcEnd;
+ const char *srcStart, *srcEnd;
char *dstEnd, *dstStart;
int result, numChars;
@@ -558,7 +558,7 @@ static int
UtfToUcs2beProc(
ClientData clientData, /* TableEncodingData that specifies
* encoding. */
- CONST char *src, /* Source string in UTF-8. */
+ const char *src, /* Source string in UTF-8. */
int srcLen, /* Source string length in bytes. */
int flags, /* Conversion control flags. */
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
@@ -582,7 +582,7 @@ UtfToUcs2beProc(
* correspond to the bytes stored in the
* output buffer. */
{
- CONST char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
+ const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
int result, numChars;
Tcl_UniChar ch;
@@ -658,12 +658,12 @@ UtfToUcs2beProc(
TkFont *
TkpGetNativeFont(
Tk_Window tkwin, /* For display where font will be used. */
- CONST char *name) /* Platform-specific font name. */
+ const char *name) /* Platform-specific font name. */
{
UnixFont *fontPtr;
XFontStruct *fontStructPtr;
FontAttributes fa;
- CONST char *p;
+ const char *p;
int hasSpace, dashes, hasWild;
/*
@@ -765,7 +765,7 @@ TkpGetFontFromAttributes(
* will be released. If NULL, a new TkFont
* structure is allocated. */
Tk_Window tkwin, /* For display where font will be used. */
- CONST TkFontAttributes *faPtr)
+ const TkFontAttributes *faPtr)
/* Set of attributes to match. */
{
UnixFont *fontPtr;
@@ -960,6 +960,7 @@ TkpGetFontAttrsForChar(
SubFont *thisSubFontPtr = FindSubFontForChar(fontPtr, c, &lastSubFontPtr);
/* Pointer to the subfont to use for the given
* character */
+
GetFontAttributes(Tk_Display(tkwin), thisSubFontPtr->fontStructPtr, &atts);
*faPtr = atts.fa;
}
@@ -988,7 +989,7 @@ TkpGetFontAttrsForChar(
int
Tk_MeasureChars(
Tk_Font tkfont, /* Font in which characters will be drawn. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
int numBytes, /* Maximum number of bytes to consider from
* source string. */
@@ -1027,7 +1028,7 @@ Tk_MeasureChars(
curX = 0;
curByte = 0;
} else if (maxLength < 0) {
- CONST char *p, *end, *next;
+ const char *p, *end, *next;
Tcl_UniChar ch;
SubFont *thisSubFontPtr;
FontFamily *familyPtr;
@@ -1080,7 +1081,7 @@ Tk_MeasureChars(
Tcl_DStringFree(&runString);
curByte = numBytes;
} else {
- CONST char *p, *end, *next, *term;
+ const char *p, *end, *next, *term;
int newX, termX, sawNonSpace, dstWrote;
Tcl_UniChar ch;
FontFamily *familyPtr;
@@ -1202,7 +1203,7 @@ Tk_MeasureChars(
int
TkpMeasureCharsInContext(
Tk_Font tkfont, /* Font in which characters will be drawn. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
int numBytes, /* Maximum number of bytes to consider from
* source string in all. */
@@ -1255,7 +1256,7 @@ Tk_DrawChars(
GC gc, /* Graphics context for drawing characters. */
Tk_Font tkfont, /* Font in which characters will be drawn;
* must be the same as font used in GC. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
@@ -1266,22 +1267,20 @@ Tk_DrawChars(
int x, int y) /* Coordinates at which to place origin of
* string when drawing. */
{
- UnixFont *fontPtr;
+ UnixFont *fontPtr = (UnixFont *) tkfont;
SubFont *thisSubFontPtr, *lastSubFontPtr;
Tcl_DString runString;
- CONST char *p, *end, *next;
+ const char *p, *end, *next;
int xStart, needWidth, window_width, do_width;
Tcl_UniChar ch;
FontFamily *familyPtr;
#ifdef TK_DRAW_CHAR_XWINDOW_CHECK
int rx, ry;
- unsigned int width, height, border_width, depth;
+ unsigned width, height, border_width, depth;
Drawable root;
#endif
- fontPtr = (UnixFont *) tkfont;
lastSubFontPtr = &fontPtr->subFontArray[0];
-
xStart = x;
#ifdef TK_DRAW_CHAR_XWINDOW_CHECK
@@ -1394,7 +1393,7 @@ TkpDrawCharsInContext(
GC gc, /* Graphics context for drawing characters. */
Tk_Font tkfont, /* Font in which characters will be drawn;
* must be the same as font used in GC. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
@@ -1443,9 +1442,9 @@ TkpDrawCharsInContext(
static XFontStruct *
CreateClosestFont(
Tk_Window tkwin, /* For display where font will be used. */
- CONST TkFontAttributes *faPtr,
+ const TkFontAttributes *faPtr,
/* Set of generic attributes to match. */
- CONST TkXLFDAttributes *xaPtr)
+ const TkXLFDAttributes *xaPtr)
/* Set of X-specific attributes to match. */
{
FontAttributes want;
@@ -1453,7 +1452,7 @@ CreateClosestFont(
int numNames, nameIdx, bestIdx[2];
Display *display;
XFontStruct *fontStructPtr;
- unsigned int bestScore[2];
+ unsigned bestScore[2];
want.fa = *faPtr;
want.xa = *xaPtr;
@@ -1515,12 +1514,12 @@ CreateClosestFont(
found:
bestIdx[0] = -1;
bestIdx[1] = -1;
- bestScore[0] = (unsigned int) -1;
- bestScore[1] = (unsigned int) -1;
+ bestScore[0] = (unsigned) -1;
+ bestScore[1] = (unsigned) -1;
for (nameIdx = 0; nameIdx < numNames; nameIdx++) {
FontAttributes got;
int scalable;
- unsigned int score;
+ unsigned score;
if (TkFontParseXLFD(nameList[nameIdx], &got.fa, &got.xa) != TCL_OK) {
continue;
@@ -1576,7 +1575,7 @@ InitFont(
UnixFont *fontPtr) /* Filled with information constructed from
* the above arguments. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
unsigned long value;
int minHi, maxHi, minLo, maxLo, fixed, width, limit, i, n;
@@ -1829,7 +1828,7 @@ AllocFontFamily(
FontFamily *familyPtr;
FontAttributes fa;
Tcl_Encoding encoding;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
GetFontAttributes(display, fontStructPtr, &fa);
@@ -1903,7 +1902,7 @@ FreeFontFamily(
FontFamily *familyPtr) /* The FontFamily to delete. */
{
FontFamily **familyPtrPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int i;
@@ -2206,7 +2205,7 @@ FontMapLoadPage(
Tcl_Encoding encoding;
XFontStruct *fontStructPtr;
XCharStruct *widths;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
subFontPtr->fontMap[row] = (char *) ckalloc(FONTMAP_BITSPERPAGE / 8);
@@ -2343,11 +2342,11 @@ CanUseFallbackWithAliases(
static int
SeenName(
- CONST char *name, /* The name to check. */
+ const char *name, /* The name to check. */
Tcl_DString *dsPtr) /* Contains names that have already been
* seen. */
{
- CONST char *seen, *end;
+ const char *seen, *end;
seen = Tcl_DStringValue(dsPtr);
end = seen + Tcl_DStringLength(dsPtr);
@@ -2392,7 +2391,7 @@ static SubFont *
CanUseFallback(
UnixFont *fontPtr, /* The font object that will own the new
* screen font. */
- CONST char *faceName, /* Desired face name for new screen font. */
+ const char *faceName, /* Desired face name for new screen font. */
int ch, /* The Unicode character that the new screen
* font must be able to display. */
SubFont **fixSubFontPtrPtr) /* Subfont reference to fix up if we
@@ -2400,8 +2399,8 @@ CanUseFallback(
{
int i, nameIdx, numNames, srcLen, numEncodings, bestIdx[2];
Tk_Uid hateFoundry;
- CONST char *charset, *hateCharset;
- unsigned int bestScore[2];
+ const char *charset, *hateCharset;
+ unsigned bestScore[2];
char **nameList, **nameListOrig, src[TCL_UTF_MAX];
FontAttributes want, got;
Display *display;
@@ -2450,13 +2449,13 @@ CanUseFallback(
retry:
bestIdx[0] = -1;
bestIdx[1] = -1;
- bestScore[0] = (unsigned int) -1;
- bestScore[1] = (unsigned int) -1;
+ bestScore[0] = (unsigned) -1;
+ bestScore[1] = (unsigned) -1;
for (nameIdx = 0; nameIdx < numNames; nameIdx++) {
Tcl_Encoding encoding;
char dst[16];
int scalable, srcRead, dstWrote;
- unsigned int score;
+ unsigned score;
if (nameList[nameIdx] == NULL) {
continue;
@@ -2624,12 +2623,12 @@ CanUseFallback(
*---------------------------------------------------------------------------
*/
-static unsigned int
+static unsigned
RankAttributes(
FontAttributes *wantPtr, /* The desired attributes. */
FontAttributes *gotPtr) /* The attributes we have to live with. */
{
- unsigned int penalty;
+ unsigned penalty;
penalty = 0;
if (gotPtr->xa.foundry != wantPtr->xa.foundry) {
@@ -2676,7 +2675,7 @@ RankAttributes(
}
if (gotPtr->xa.charset != wantPtr->xa.charset) {
int i;
- CONST char *gotAlias, *wantAlias;
+ const char *gotAlias, *wantAlias;
penalty += 65000;
gotAlias = GetEncodingAlias(gotPtr->xa.charset);
@@ -2721,7 +2720,7 @@ GetScreenFont(
char **nameList, /* Array of XLFDs. */
int bestIdx[2], /* Indices into above array for XLFD of best
* bitmapped and best scalable font. */
- unsigned int bestScore[2]) /* Scores of best bitmapped and best scalable
+ unsigned bestScore[2]) /* Scores of best bitmapped and best scalable
* font. XLFD corresponding to lowest score
* will be constructed. */
{
@@ -2890,7 +2889,7 @@ GetFontAttributes(
static char **
ListFonts(
Display *display, /* Display to query. */
- CONST char *faceName, /* Desired face name, or "*" for all. */
+ const char *faceName, /* Desired face name, or "*" for all. */
int *numNamesPtr) /* Filled with length of returned array, or 0
* if no names were found. */
{
@@ -2903,7 +2902,7 @@ ListFonts(
static char **
ListFontOrAlias(
Display *display, /* Display to query. */
- CONST char *faceName, /* Desired face name, or "*" for all. */
+ const char *faceName, /* Desired face name, or "*" for all. */
int *numNamesPtr) /* Filled with length of returned array, or 0
* if no names were found. */
{
@@ -2995,9 +2994,9 @@ IdentifySymbolEncodings(
*---------------------------------------------------------------------------
*/
-static CONST char *
+static const char *
GetEncodingAlias(
- CONST char *name) /* The name to look up. */
+ const char *name) /* The name to look up. */
{
EncodingAlias *aliasPtr;
diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c
index 50797f2..7c07e4d 100644
--- a/unix/tkUnixInit.c
+++ b/unix/tkUnixInit.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: tkUnixInit.c,v 1.10 2007/12/13 15:28:50 dgp Exp $
+ * RCS: @(#) $Id: tkUnixInit.c,v 1.11 2008/04/27 22:39:13 dkf Exp $
*/
#include "tkUnixInt.h"
@@ -69,7 +69,7 @@ TkpGetAppName(
Tcl_Interp *interp,
Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */
{
- CONST char *p, *name;
+ const char *p, *name;
name = Tcl_GetVar(interp, "argv0", TCL_GLOBAL_ONLY);
if ((name == NULL) || (*name == 0)) {
@@ -102,10 +102,11 @@ TkpGetAppName(
void
TkpDisplayWarning(
- CONST char *msg, /* Message to be displayed. */
- CONST char *title) /* Title of warning. */
+ const char *msg, /* Message to be displayed. */
+ const char *title) /* Title of warning. */
{
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
+
if (errChannel) {
Tcl_WriteChars(errChannel, title, -1);
Tcl_WriteChars(errChannel, ": ", 2);
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 0fcadb6..ec77732 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.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: tkUnixMenu.c,v 1.19 2007/12/13 15:28:50 dgp Exp $
+ * RCS: @(#) $Id: tkUnixMenu.c,v 1.20 2008/04/27 22:39:13 dkf Exp $
*/
#include "default.h"
@@ -53,7 +53,7 @@ MODULE_SCOPE void TkpDrawCheckIndicator(Tk_Window tkwin,
static void SetHelpMenu(TkMenu *menuPtr);
static void DrawMenuEntryAccelerator(TkMenu *menuPtr,
TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
Tk_3DBorder activeBorder, int x, int y,
int width, int height, int drawArrow);
static void DrawMenuEntryBackground(TkMenu *menuPtr,
@@ -64,42 +64,42 @@ static void DrawMenuEntryIndicator(TkMenu *menuPtr,
TkMenuEntry *mePtr, Drawable d,
Tk_3DBorder border, XColor *indicatorColor,
XColor *disableColor, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int x, int y,
+ const Tk_FontMetrics *fmPtr, int x, int y,
int width, int height);
static void DrawMenuEntryLabel(TkMenu * menuPtr,
TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
int x, int y, int width, int height);
static void DrawMenuSeparator(TkMenu *menuPtr,
TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
int x, int y, int width, int height);
static void DrawTearoffEntry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
int x, int y, int width, int height);
static void DrawMenuUnderline(TkMenu *menuPtr,
TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
int x, int y, int width, int height);
static void GetMenuAccelGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int *widthPtr,
+ const Tk_FontMetrics *fmPtr, int *widthPtr,
int *heightPtr);
static void GetMenuLabelGeometry(TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
int *widthPtr, int *heightPtr);
static void GetMenuIndicatorGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr,
+ const Tk_FontMetrics *fmPtr,
int *widthPtr, int *heightPtr);
static void GetMenuSeparatorGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr,
+ const Tk_FontMetrics *fmPtr,
int *widthPtr, int *heightPtr);
static void GetTearoffEntryGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int *widthPtr,
+ const Tk_FontMetrics *fmPtr, int *widthPtr,
int *heightPtr);
/*
@@ -326,7 +326,7 @@ GetMenuIndicatorGeometry(
TkMenu *menuPtr, /* The menu we are drawing. */
TkMenuEntry *mePtr, /* The entry we are interested in. */
Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
int *widthPtr, /* The resulting width */
int *heightPtr) /* The resulting height */
{
@@ -393,7 +393,7 @@ GetMenuAccelGeometry(
TkMenu *menuPtr, /* The menu was are drawing */
TkMenuEntry *mePtr, /* The entry we are getting the geometry for */
Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
int *widthPtr, /* The width of the acclerator area */
int *heightPtr) /* The height of the accelerator area */
{
@@ -485,7 +485,7 @@ DrawMenuEntryAccelerator(
Drawable d, /* The drawable we are drawing into */
GC gc, /* The precalculated gc to draw with */
Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
Tk_3DBorder activeBorder, /* The border for an active item */
int x, /* Left coordinate of entry rect */
int y, /* Top coordinate of entry rect */
@@ -559,7 +559,7 @@ DrawMenuEntryIndicator(
XColor *indicatorColor, /* The color to draw indicators with */
XColor *disableColor, /* The color use use when disabled */
Tk_Font tkfont, /* The font to draw with */
- CONST Tk_FontMetrics *fmPtr,/* The font metrics of the font */
+ const Tk_FontMetrics *fmPtr,/* The font metrics of the font */
int x, /* The left of the entry rect */
int y, /* The top of the entry rect */
int width, /* Width of menu entry */
@@ -631,7 +631,7 @@ DrawMenuSeparator(
Drawable d, /* The drawable we are using */
GC gc, /* The gc to draw into */
Tk_Font tkfont, /* The font to draw with */
- CONST Tk_FontMetrics *fmPtr,/* The font metrics from the font */
+ const Tk_FontMetrics *fmPtr,/* The font metrics from the font */
int x, int y,
int width, int height)
{
@@ -674,7 +674,7 @@ DrawMenuEntryLabel(
Drawable d, /* What we are drawing into. */
GC gc, /* The gc we are drawing into.*/
Tk_Font tkfont, /* The precalculated font. */
- CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics. */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics. */
int x, /* Left edge. */
int y, /* Top edge. */
int width, /* width of entry. */
@@ -851,7 +851,7 @@ DrawMenuUnderline(
Drawable d, /* What we are drawing into */
GC gc, /* The gc to draw into */
Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
int x, int y,
int width, int height)
{
@@ -865,7 +865,7 @@ DrawMenuUnderline(
Tcl_GetUnicodeFromObj(mePtr->labelPtr, &len);
if (mePtr->underline < len) {
int activeBorderWidth, leftEdge;
- CONST char *label, *start, *end;
+ const char *label, *start, *end;
label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
start = Tcl_UtfAtIndex(label, mePtr->underline);
@@ -931,7 +931,7 @@ GetMenuSeparatorGeometry(
TkMenu *menuPtr, /* The menu we are measuring */
TkMenuEntry *mePtr, /* The entry we are measuring */
Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */
+ const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */
int *widthPtr, /* The resulting width */
int *heightPtr) /* The resulting height */
{
@@ -960,7 +960,7 @@ GetTearoffEntryGeometry(
TkMenu *menuPtr, /* The menu we are drawing */
TkMenuEntry *mePtr, /* The entry we are measuring */
Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
int *widthPtr, /* The resulting width */
int *heightPtr) /* The resulting height */
{
@@ -1181,7 +1181,7 @@ DrawTearoffEntry(
Drawable d, /* The drawable we are drawing into */
GC gc, /* The gc we are drawing with */
Tk_Font tkfont, /* The font we are drawing with */
- CONST Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */
+ const Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */
int x, int y,
int width, int height)
{
@@ -1310,7 +1310,7 @@ TkpDrawMenuEntry(
TkMenuEntry *mePtr, /* The entry to draw */
Drawable d, /* What to draw into */
Tk_Font tkfont, /* Precalculated font for menu */
- CONST Tk_FontMetrics *menuMetricsPtr,
+ const Tk_FontMetrics *menuMetricsPtr,
/* Precalculated metrics for menu */
int x, /* X-coordinate of topleft of entry */
int y, /* Y-coordinate of topleft of entry */
@@ -1325,7 +1325,7 @@ TkpDrawMenuEntry(
XColor *indicatorColor, *disableColor = NULL;
TkMenu *menuPtr = mePtr->menuPtr;
Tk_3DBorder bgBorder, activeBorder;
- CONST Tk_FontMetrics *fmPtr;
+ const Tk_FontMetrics *fmPtr;
Tk_FontMetrics entryMetrics;
int padY = (menuPtr->menuType == MENUBAR) ? 3 : 0;
int adjustedY = y + padY;
@@ -1460,7 +1460,7 @@ static void
GetMenuLabelGeometry(
TkMenuEntry *mePtr, /* The entry we are computing */
Tk_Font tkfont, /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
int *widthPtr, /* The resulting width of the label portion */
int *heightPtr) /* The resulting height of the label
* portion */
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index 73e091c..3bea31f 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.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: tkUnixRFont.c,v 1.24 2008/03/12 16:35:27 jenglish Exp $
+ * RCS: @(#) $Id: tkUnixRFont.c,v 1.25 2008/04/27 22:39:13 dkf Exp $
*/
#include "tkUnixInt.h"
@@ -303,7 +303,7 @@ FinishedWithFont(
TkFont *
TkpGetNativeFont(
Tk_Window tkwin, /* For display where font will be used. */
- CONST char *name) /* Platform-specific font name. */
+ const char *name) /* Platform-specific font name. */
{
UnixFtFont *fontPtr;
FcPattern *pattern;
@@ -337,7 +337,7 @@ TkpGetFontFromAttributes(
* will be released. If NULL, a new TkFont
* structure is allocated. */
Tk_Window tkwin, /* For display where font will be used. */
- CONST TkFontAttributes *faPtr)
+ const TkFontAttributes *faPtr)
/* Set of attributes to match. */
{
XftPattern *pattern;
@@ -524,7 +524,7 @@ TkpGetFontAttrsForChar(
int
Tk_MeasureChars(
Tk_Font tkfont, /* Font in which characters will be drawn. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
int numBytes, /* Maximum number of bytes to consider from
* source string. */
@@ -620,7 +620,7 @@ Tk_MeasureChars(
int
TkpMeasureCharsInContext(
Tk_Font tkfont,
- CONST char *source,
+ const char *source,
int numBytes,
int rangeStart,
int rangeLength,
@@ -643,7 +643,7 @@ Tk_DrawChars(
GC gc, /* Graphics context for drawing characters. */
Tk_Font tkfont, /* Font in which characters will be drawn;
* must be the same as font used in GC. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index b2083f3..9a0aacf 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.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: tkUnixSend.c,v 1.20 2007/12/13 15:28:51 dgp Exp $
+ * RCS: @(#) $Id: tkUnixSend.c,v 1.21 2008/04/27 22:39:13 dkf Exp $
*/
#include "tkUnixInt.h"
@@ -79,7 +79,7 @@ typedef struct NameRegistry {
typedef struct PendingCommand {
int serial; /* Serial number expected in result. */
TkDisplay *dispPtr; /* Display being used for communication. */
- CONST char *target; /* Name of interpreter command is being sent
+ const char *target; /* Name of interpreter command is being sent
* to. */
Window commWindow; /* Target's communication window. */
Tcl_Interp *interp; /* Interpreter from which the send was
@@ -212,10 +212,10 @@ static void AppendPropCarefully(Display *display,
int length, PendingCommand *pendingPtr);
static void DeleteProc(ClientData clientData);
static void RegAddName(NameRegistry *regPtr,
- CONST char *name, Window commWindow);
+ const char *name, Window commWindow);
static void RegClose(NameRegistry *regPtr);
-static void RegDeleteName(NameRegistry *regPtr, CONST char *name);
-static Window RegFindName(NameRegistry *regPtr, CONST char *name);
+static void RegDeleteName(NameRegistry *regPtr, const char *name);
+static Window RegFindName(NameRegistry *regPtr, const char *name);
static NameRegistry * RegOpen(Tcl_Interp *interp,
TkDisplay *dispPtr, int lock);
static void SendEventProc(ClientData clientData, XEvent *eventPtr);
@@ -224,7 +224,7 @@ static Tk_RestrictAction SendRestrictProc(ClientData clientData,
XEvent *eventPtr);
static int ServerSecure(TkDisplay *dispPtr);
static void UpdateCommWindow(TkDisplay *dispPtr);
-static int ValidateName(TkDisplay *dispPtr, CONST char *name,
+static int ValidateName(TkDisplay *dispPtr, const char *name,
Window commWindow, int oldOK);
/*
@@ -349,7 +349,7 @@ static Window
RegFindName(
NameRegistry *regPtr, /* Pointer to a registry opened with a
* previous call to RegOpen. */
- CONST char *name) /* Name of an application. */
+ const char *name) /* Name of an application. */
{
char *p;
@@ -360,7 +360,7 @@ RegFindName(
p++;
}
if ((*p != 0) && (strcmp(name, p+1) == 0)) {
- unsigned int id;
+ unsigned id;
if (sscanf(entry, "%x", &id) == 1) {
/*
@@ -402,7 +402,7 @@ static void
RegDeleteName(
NameRegistry *regPtr, /* Pointer to a registry opened with a
* previous call to RegOpen. */
- CONST char *name) /* Name of an application. */
+ const char *name) /* Name of an application. */
{
char *p;
@@ -464,7 +464,7 @@ static void
RegAddName(
NameRegistry *regPtr, /* Pointer to a registry opened with a
* previous call to RegOpen. */
- CONST char *name, /* Name of an application. The caller must
+ const char *name, /* Name of an application. The caller must
* ensure that this name isn't already
* registered. */
Window commWindow) /* X identifier for comm. window of
@@ -473,7 +473,7 @@ RegAddName(
char id[30], *newProp;
int idLength, newBytes;
- sprintf(id, "%x ", (unsigned int) commWindow);
+ sprintf(id, "%x ", (unsigned) commWindow);
idLength = strlen(id);
newBytes = idLength + strlen(name) + 1;
newProp = ckalloc((unsigned) (regPtr->propLength + newBytes));
@@ -575,7 +575,7 @@ static int
ValidateName(
TkDisplay *dispPtr, /* Display for which to perform the
* validation. */
- CONST char *name, /* The name of an application. */
+ const char *name, /* The name of an application. */
Window commWindow, /* X identifier for the application's comm.
* window. */
int oldOK) /* Non-zero means that we should consider an
@@ -588,7 +588,7 @@ ValidateName(
Atom actualType;
char *property, **propertyPtr = &property;
Tk_ErrorHandler handler;
- CONST char **argv;
+ const char **argv;
property = NULL;
@@ -716,12 +716,12 @@ ServerSecure(
*--------------------------------------------------------------
*/
-CONST char *
+const char *
Tk_SetAppName(
Tk_Window tkwin, /* Token for any window in the application to
* be named: it is just used to identify the
* application and the display. */
- CONST char *name) /* The name that will be used to refer to the
+ const char *name) /* The name that will be used to refer to the
* interpreter in later "send" commands. Must
* be globally unique. */
{
@@ -731,10 +731,10 @@ Tk_SetAppName(
TkDisplay *dispPtr = winPtr->dispPtr;
NameRegistry *regPtr;
Tcl_Interp *interp;
- CONST char *actualName;
+ const char *actualName;
Tcl_DString dString;
int offset, i;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
interp = winPtr->mainPtr->interp;
@@ -762,8 +762,7 @@ Tk_SetAppName(
riPtr->nextPtr = tsdPtr->interpListPtr;
tsdPtr->interpListPtr = riPtr;
riPtr->name = NULL;
- Tcl_CreateCommand(interp, "send", Tk_SendCmd, (ClientData) riPtr,
- DeleteProc);
+ Tcl_CreateCommand(interp, "send", Tk_SendCmd, riPtr, DeleteProc);
if (Tcl_IsSafe(interp)) {
Tcl_HideCommand(interp, "send", "send");
}
@@ -874,13 +873,13 @@ Tk_SendCmd(
* field is used). */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
TkWindow *winPtr;
Window commWindow;
PendingCommand pending;
register RegisteredInterp *riPtr;
- CONST char *destName;
+ const char *destName;
int result, c, async, i, firstArg;
size_t length;
Tk_RestrictProc *prevRestrictProc;
@@ -889,7 +888,7 @@ Tk_SendCmd(
Tcl_Time timeout;
NameRegistry *regPtr;
Tcl_DString request;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_Interp *localInterp; /* Used when the interpreter to send the
* command to is within the same process. */
@@ -956,9 +955,9 @@ Tk_SendCmd(
|| (strcmp(riPtr->name, destName) != 0)) {
continue;
}
- Tcl_Preserve((ClientData) riPtr);
+ Tcl_Preserve(riPtr);
localInterp = riPtr->interp;
- Tcl_Preserve((ClientData) localInterp);
+ Tcl_Preserve(localInterp);
if (firstArg == (argc-1)) {
result = Tcl_GlobalEval(localInterp, argv[firstArg]);
} else {
@@ -994,8 +993,8 @@ Tk_SendCmd(
Tcl_SetObjResult(interp, Tcl_GetObjResult(localInterp));
Tcl_ResetResult(localInterp);
}
- Tcl_Release((ClientData) riPtr);
- Tcl_Release((ClientData) localInterp);
+ Tcl_Release(riPtr);
+ Tcl_Release(localInterp);
return result;
}
@@ -1024,7 +1023,7 @@ Tk_SendCmd(
char buffer[TCL_INTEGER_SPACE * 2];
sprintf(buffer, "%x %d",
- (unsigned int) Tk_WindowId(dispPtr->commTkwin),
+ (unsigned) Tk_WindowId(dispPtr->commTkwin),
localData.sendSerial);
Tcl_DStringAppend(&request, "\0-r ", 4);
Tcl_DStringAppend(&request, buffer, -1);
@@ -1178,9 +1177,9 @@ TkGetInterpNames(
for (p=regPtr->property ; p-regPtr->property<(int)regPtr->propLength ;) {
char *entry = p, *entryName;
Window commWindow;
- unsigned int id;
+ unsigned id;
- if (sscanf(p, "%x",(unsigned int *) &id) != 1) {
+ if (sscanf(p, "%x", (unsigned *) &id) != 1) {
commWindow = None;
} else {
commWindow = id;
@@ -1250,9 +1249,9 @@ TkSendCleanup(
{
if (dispPtr->commTkwin != NULL) {
Tk_DeleteEventHandler(dispPtr->commTkwin, PropertyChangeMask,
- SendEventProc, (ClientData) dispPtr);
+ SendEventProc, dispPtr);
Tk_DestroyWindow(dispPtr->commTkwin);
- Tcl_Release((ClientData) dispPtr->commTkwin);
+ Tcl_Release(dispPtr->commTkwin);
dispPtr->commTkwin = NULL;
}
}
@@ -1293,12 +1292,12 @@ SendInit(
if (dispPtr->commTkwin == NULL) {
Tcl_Panic("Tk_CreateWindow failed in SendInit!");
}
- Tcl_Preserve((ClientData) dispPtr->commTkwin);
+ Tcl_Preserve(dispPtr->commTkwin);
atts.override_redirect = True;
Tk_ChangeWindowAttributes(dispPtr->commTkwin,
CWOverrideRedirect, &atts);
Tk_CreateEventHandler(dispPtr->commTkwin, PropertyChangeMask,
- SendEventProc, (ClientData) dispPtr);
+ SendEventProc, dispPtr);
Tk_MakeWindowExist(dispPtr->commTkwin);
/*
@@ -1339,14 +1338,14 @@ SendEventProc(
ClientData clientData, /* Display information. */
XEvent *eventPtr) /* Information about event. */
{
- TkDisplay *dispPtr = (TkDisplay *) clientData;
+ TkDisplay *dispPtr = clientData;
char *propInfo, **propInfoPtr = &propInfo;
register char *p;
int result, actualFormat;
unsigned long numItems, bytesAfter;
Atom actualType;
Tcl_Interp *remoteInterp; /* Interp in which to execute the command. */
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if ((eventPtr->xproperty.atom != dispPtr->commProperty)
@@ -1485,7 +1484,7 @@ SendEventProc(
break;
}
}
- Tcl_Preserve((ClientData) riPtr);
+ Tcl_Preserve(riPtr);
/*
* We must protect the interpreter because the script may enter
@@ -1493,7 +1492,7 @@ SendEventProc(
*/
remoteInterp = riPtr->interp;
- Tcl_Preserve((ClientData) remoteInterp);
+ Tcl_Preserve(remoteInterp);
result = Tcl_GlobalEval(remoteInterp, script);
@@ -1508,7 +1507,7 @@ SendEventProc(
Tcl_DStringAppend(&reply, Tcl_GetStringResult(remoteInterp),
-1);
if (result == TCL_ERROR) {
- CONST char *varValue;
+ const char *varValue;
varValue = Tcl_GetVar2(remoteInterp, "errorInfo",
NULL, TCL_GLOBAL_ONLY);
@@ -1524,8 +1523,8 @@ SendEventProc(
}
}
}
- Tcl_Release((ClientData) remoteInterp);
- Tcl_Release((ClientData) riPtr);
+ Tcl_Release(remoteInterp);
+ Tcl_Release(riPtr);
/*
* Return the result to the sender if a commWindow was specified
@@ -1617,19 +1616,19 @@ SendEventProc(
}
pcPtr->code = code;
if (resultString != NULL) {
- pcPtr->result = (char *) ckalloc((unsigned)
- (strlen(resultString) + 1));
+ pcPtr->result =
+ ckalloc((unsigned) (strlen(resultString) + 1));
strcpy(pcPtr->result, resultString);
}
if (code == TCL_ERROR) {
if (errorInfo != NULL) {
- pcPtr->errorInfo = (char *) ckalloc((unsigned)
- (strlen(errorInfo) + 1));
+ pcPtr->errorInfo =
+ ckalloc((unsigned) (strlen(errorInfo) + 1));
strcpy(pcPtr->errorInfo, errorInfo);
}
if (errorCode != NULL) {
- pcPtr->errorCode = (char *) ckalloc((unsigned)
- (strlen(errorCode) + 1));
+ pcPtr->errorCode =
+ ckalloc((unsigned) (strlen(errorCode) + 1));
strcpy(pcPtr->errorCode, errorCode);
}
}
@@ -1685,7 +1684,7 @@ AppendPropCarefully(
Tk_ErrorHandler handler;
handler = Tk_CreateErrorHandler(display, -1, -1, -1, AppendErrorProc,
- (ClientData) pendingPtr);
+ pendingPtr);
XChangeProperty(display, window, property, XA_STRING, 8,
PropModeAppend, (unsigned char *) value, length);
Tk_DeleteErrorHandler(handler);
@@ -1702,9 +1701,9 @@ AppendErrorProc(
ClientData clientData, /* Command to mark complete, or NULL. */
XErrorEvent *errorPtr) /* Information about error. */
{
- PendingCommand *pendingPtr = (PendingCommand *) clientData;
+ PendingCommand *pendingPtr = clientData;
register PendingCommand *pcPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (pendingPtr == NULL) {
@@ -1752,10 +1751,10 @@ DeleteProc(
ClientData clientData) /* Info about registration, passed as
* ClientData. */
{
- RegisteredInterp *riPtr = (RegisteredInterp *) clientData;
+ RegisteredInterp *riPtr = clientData;
register RegisteredInterp *riPtr2;
NameRegistry *regPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
regPtr = RegOpen(riPtr->interp, riPtr->dispPtr, 1);
@@ -1776,7 +1775,7 @@ DeleteProc(
ckfree((char *) riPtr->name);
riPtr->interp = NULL;
UpdateCommWindow(riPtr->dispPtr);
- Tcl_EventuallyFree((ClientData) riPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(riPtr, TCL_DYNAMIC);
}
/*
@@ -1844,7 +1843,7 @@ UpdateCommWindow(
{
Tcl_DString names;
RegisteredInterp *riPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DStringInit(&names);
@@ -1883,9 +1882,9 @@ TkpTestsendCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index d8082ff..e4c250c 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.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: tkUnixWm.c,v 1.58 2007/12/13 15:28:51 dgp Exp $
+ * RCS: @(#) $Id: tkUnixWm.c,v 1.59 2008/04/27 22:39:13 dkf Exp $
*/
#include "tkUnixInt.h"
@@ -207,7 +207,7 @@ typedef struct TkWmInfo {
ProtocolHandler *protPtr; /* First in list of protocol handlers for this
* window (NULL means none). */
int cmdArgc; /* Number of elements in cmdArgv below. */
- CONST char **cmdArgv; /* Array of strings to store in the WM_COMMAND
+ const char **cmdArgv; /* Array of strings to store in the WM_COMMAND
* property. NULL means nothing available. */
char *clientMachine; /* String to store in WM_CLIENT_MACHINE
* property, or NULL. */
@@ -363,100 +363,100 @@ static void WrapperEventProc(ClientData clientData,
static void WmWaitMapProc(ClientData clientData, XEvent *eventPtr);
static int WmAspectCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmAttributesCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmClientCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmColormapwindowsCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmCommandCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmDeiconifyCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmFocusmodelCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmForgetCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmFrameCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmGeometryCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconmaskCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconnameCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconphotoCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconpositionCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconwindowCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmManageCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmMaxsizeCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmMinsizeCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmOverrideredirectCmd(Tk_Window tkwin,TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmPositionfromCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmProtocolCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmResizableCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmSizefromCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmStackorderCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr);
/*
@@ -511,7 +511,7 @@ void TkWmCleanup(
protPtr = wmPtr->protPtr;
wmPtr->protPtr = protPtr->nextPtr;
- Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
}
if (wmPtr->cmdArgv != NULL) {
ckfree((char *) wmPtr->cmdArgv);
@@ -569,6 +569,7 @@ TkWmNewWindow(
/*
* Initialize attributes.
*/
+
wmPtr->attributes.alpha = 1.0;
wmPtr->attributes.topmost = 0;
wmPtr->attributes.zoomed = 0;
@@ -724,16 +725,16 @@ TkWmMapWindow(
*/
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
- UpdateGeometryInfo((ClientData) winPtr);
+ UpdateGeometryInfo(winPtr);
return;
}
wmPtr->flags |= WM_ABOUT_TO_MAP;
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
- UpdateGeometryInfo((ClientData) winPtr);
+ UpdateGeometryInfo(winPtr);
wmPtr->flags &= ~WM_ABOUT_TO_MAP;
/*
@@ -877,11 +878,10 @@ TkWmDeadWindow(
Tk_DestroyWindow((Tk_Window) wmPtr->wrapperPtr);
}
while (wmPtr->protPtr != NULL) {
- ProtocolHandler *protPtr;
+ ProtocolHandler *protPtr = wmPtr->protPtr;
- protPtr = wmPtr->protPtr;
wmPtr->protPtr = protPtr->nextPtr;
- Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
}
if (wmPtr->cmdArgv != NULL) {
ckfree((char *) wmPtr->cmdArgv);
@@ -890,7 +890,7 @@ TkWmDeadWindow(
ckfree((char *) wmPtr->clientMachine);
}
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
/*
@@ -902,8 +902,7 @@ TkWmDeadWindow(
if (wmPtr2->masterPtr == winPtr) {
wmPtr->numTransients--;
Tk_DeleteEventHandler((Tk_Window) wmPtr2->masterPtr,
- StructureNotifyMask,
- WmWaitMapProc, (ClientData) wmPtr2->winPtr);
+ StructureNotifyMask, WmWaitMapProc, wmPtr2->winPtr);
wmPtr2->masterPtr = NULL;
if (!(wmPtr2->flags & WM_NEVER_MAPPED)) {
XDeleteProperty(winPtr->display, wmPtr2->wrapperPtr->window,
@@ -999,10 +998,10 @@ Tk_WmObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"aspect", "attributes", "client", "colormapwindows",
"command", "deiconify", "focusmodel", "forget", "frame",
"geometry", "grid", "group", "iconbitmap",
@@ -1174,7 +1173,7 @@ WmAspectCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int numer1, denom1, numer2, denom2;
@@ -1371,7 +1370,7 @@ WmAttributesCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int attribute = 0;
@@ -1435,7 +1434,7 @@ WmClientCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -1466,8 +1465,7 @@ WmClientCmd(
if (wmPtr->clientMachine != NULL) {
ckfree((char *) wmPtr->clientMachine);
}
- wmPtr->clientMachine = (char *)
- ckalloc((unsigned) (length + 1));
+ wmPtr->clientMachine = ckalloc((unsigned) (length + 1));
strcpy(wmPtr->clientMachine, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XTextProperty textProp;
@@ -1521,7 +1519,7 @@ WmColormapwindowsCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Window *cmapList;
@@ -1621,12 +1619,12 @@ WmCommandCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
int cmdArgc;
- CONST char **cmdArgv;
+ const char **cmdArgv;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?value?");
@@ -1689,7 +1687,7 @@ WmDeiconifyCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -1735,10 +1733,10 @@ WmFocusmodelCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"active", "passive", NULL };
enum options {
OPT_ACTIVE, OPT_PASSIVE };
@@ -1785,12 +1783,12 @@ WmFocusmodelCmd(
*/
static int
-WmForgetCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel or Frame to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmForgetCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel or Frame to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register Tk_Window frameWin = (Tk_Window)winPtr;
@@ -1798,7 +1796,8 @@ WmForgetCmd(tkwin, winPtr, interp, objc, objv)
TkFocusJoin(winPtr);
Tk_UnmapWindow(frameWin);
TkWmDeadWindow(winPtr);
- winPtr->flags &= ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
+ winPtr->flags &=
+ ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
RemapWindows(winPtr, winPtr->parentPtr);
/* flags (above) must be cleared before calling */
/* TkMapTopFrame (below) */
@@ -1832,7 +1831,7 @@ WmFrameCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Window window;
@@ -1874,7 +1873,7 @@ WmGeometryCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char xSign, ySign;
@@ -1937,7 +1936,7 @@ WmGridCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int reqWidth, reqHeight, widthInc, heightInc;
@@ -2027,7 +2026,7 @@ WmGroupCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
@@ -2103,7 +2102,7 @@ WmIconbitmapCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Pixmap pixmap;
@@ -2163,7 +2162,7 @@ WmIconifyCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
if (objc != 3) {
@@ -2222,7 +2221,7 @@ WmIconmaskCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Pixmap pixmap;
@@ -2281,7 +2280,7 @@ WmIconnameCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -2333,7 +2332,7 @@ WmIconphotoCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_PhotoHandle photo;
@@ -2483,7 +2482,7 @@ WmIconpositionCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y;
@@ -2540,7 +2539,7 @@ WmIconwindowCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
@@ -2650,12 +2649,12 @@ WmIconwindowCmd(
*/
static int
-WmManageCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel or Frame to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmManageCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel or Frame to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register Tk_Window frameWin = (Tk_Window)winPtr;
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -2704,7 +2703,7 @@ WmMaxsizeCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -2762,7 +2761,7 @@ WmMinsizeCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -2812,7 +2811,7 @@ WmOverrideredirectCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int boolean, curValue;
XSetWindowAttributes atts;
@@ -2870,10 +2869,10 @@ WmPositionfromCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"program", "user", NULL };
enum options {
OPT_PROGRAM, OPT_USER };
@@ -2934,7 +2933,7 @@ WmProtocolCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
register ProtocolHandler *protPtr, *prevPtr;
@@ -3039,7 +3038,7 @@ WmResizableCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -3099,10 +3098,10 @@ WmSizefromCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"program", "user", NULL };
enum options {
OPT_PROGRAM, OPT_USER };
@@ -3164,10 +3163,10 @@ WmStackorderCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
TkWindow **windows, **window_ptr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"isabove", "isbelow", NULL };
enum options {
OPT_ISABOVE, OPT_ISBELOW };
@@ -3284,10 +3283,10 @@ WmStateCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"normal", "iconic", "withdrawn", NULL };
enum options {
OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN };
@@ -3378,7 +3377,7 @@ WmTitleCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -3431,7 +3430,7 @@ WmTransientCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
TkWindow *masterPtr = wmPtr->masterPtr;
@@ -3571,7 +3570,7 @@ WmWithdrawCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -6039,7 +6038,7 @@ TkWmProtocolEventProc(
register ProtocolHandler *protPtr;
Atom protocol;
int result;
- CONST char *protocolName;
+ const char *protocolName;
Tcl_Interp *interp;
protocol = (Atom) eventPtr->xclient.data.l[0];
diff --git a/unix/tkUnixXId.c b/unix/tkUnixXId.c
index af43b7f..0131181 100644
--- a/unix/tkUnixXId.c
+++ b/unix/tkUnixXId.c
@@ -16,7 +16,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixXId.c,v 1.10 2007/12/13 15:28:51 dgp Exp $
+ * RCS: @(#) $Id: tkUnixXId.c,v 1.11 2008/04/27 22:39:14 dkf Exp $
*/
/*
@@ -76,7 +76,7 @@ TkInitXId(
TkDisplay *dispPtr) /* Tk's information about the display. */
{
dispPtr->idStackPtr = NULL;
- dispPtr->defaultAllocProc = (XID (*) _ANSI_ARGS_((Display *display)))
+ dispPtr->defaultAllocProc = (XID (*) (Display *display))
dispPtr->display->resource_alloc;
dispPtr->display->resource_alloc = AllocXId;
dispPtr->windowStackPtr = NULL;
@@ -324,7 +324,7 @@ TkFreeWindowId(
if (!dispPtr->idCleanupScheduled) {
dispPtr->idCleanupScheduled = Tcl_CreateTimerHandler(100,
- WindowIdCleanup, (ClientData) dispPtr);
+ WindowIdCleanup, dispPtr);
}
}
@@ -351,7 +351,7 @@ static void
WindowIdCleanup(
ClientData clientData) /* Pointer to TkDisplay for display */
{
- TkDisplay *dispPtr = (TkDisplay *) clientData;
+ TkDisplay *dispPtr = clientData;
int anyEvents, delta;
Tk_RestrictProc *oldProc;
ClientData oldData;
@@ -379,8 +379,7 @@ WindowIdCleanup(
XSync(dispPtr->display, False);
}
anyEvents = 0;
- oldProc = Tk_RestrictEvents(CheckRestrictProc, (ClientData) &anyEvents,
- &oldData);
+ oldProc = Tk_RestrictEvents(CheckRestrictProc, &anyEvents, &oldData);
TkUnixDoOneXEvent(&timeout);
Tk_RestrictEvents(oldProc, oldData, &oldData);
if (anyEvents) {
@@ -394,7 +393,7 @@ WindowIdCleanup(
if (dispPtr->windowStackPtr != NULL) {
Tcl_CreateTimerHandler(5000, WindowIdCleanup2,
- (ClientData) dispPtr->windowStackPtr);
+ dispPtr->windowStackPtr);
dispPtr->windowStackPtr = NULL;
}
return;
@@ -405,7 +404,7 @@ WindowIdCleanup(
tryAgain:
dispPtr->idCleanupScheduled = Tcl_CreateTimerHandler(500,
- WindowIdCleanup, (ClientData) dispPtr);
+ WindowIdCleanup, dispPtr);
}
/*
@@ -430,7 +429,7 @@ static void
WindowIdCleanup2(
ClientData clientData) /* Pointer to TkIdStack list. */
{
- TkIdStack *stackPtr = (TkIdStack *) clientData;
+ TkIdStack *stackPtr = clientData;
TkIdStack *lastPtr;
lastPtr = stackPtr;
@@ -465,7 +464,8 @@ CheckRestrictProc(
ClientData clientData, /* Pointer to flag to set. */
XEvent *eventPtr) /* Event to filter; not used. */
{
- int *flag = (int *) clientData;
+ int *flag = clientData;
+
*flag = 1;
return TK_DEFER_EVENT;
}
@@ -585,7 +585,7 @@ TkpWindowWasRecentlyDeleted(
int
TkpScanWindowId(
Tcl_Interp *interp,
- CONST char *string,
+ const char *string,
Window *idPtr)
{
int value;
diff --git a/win/stubs.c b/win/stubs.c
index 678b176..cf0983f 100644
--- a/win/stubs.c
+++ b/win/stubs.c
@@ -252,7 +252,7 @@ void
XSetCommand(
Display *display,
Window w,
- CONST char **argv,
+ const char **argv,
int argc)
{
}
diff --git a/win/tkWinConfig.c b/win/tkWinConfig.c
index 73e20f9..59faacc 100644
--- a/win/tkWinConfig.c
+++ b/win/tkWinConfig.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: tkWinConfig.c,v 1.6 2007/12/13 15:28:53 dgp Exp $
+ * RCS: @(#) $Id: tkWinConfig.c,v 1.7 2008/04/27 22:39:14 dkf Exp $
*/
#include "tkWinInt.h"
@@ -37,8 +37,8 @@
Tcl_Obj *
TkpGetSystemDefault(
Tk_Window tkwin, /* A window to use. */
- CONST char *dbName, /* The option database name. */
- CONST char *className) /* The name of the option class. */
+ const char *dbName, /* The option database name. */
+ const char *className) /* The name of the option class. */
{
Tcl_Obj *valueObjPtr;
Tk_Uid classUid;
diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c
index e22a1c7..b35a2c8 100644
--- a/win/tkWinCursor.c
+++ b/win/tkWinCursor.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: tkWinCursor.c,v 1.15 2007/12/13 15:28:55 dgp Exp $
+ * RCS: @(#) $Id: tkWinCursor.c,v 1.16 2008/04/27 22:39:14 dkf Exp $
*/
#include "tkWinInt.h"
@@ -98,7 +98,7 @@ TkGetCursorByName(
struct CursorName *namePtr;
TkWinCursor *cursorPtr;
int argc;
- CONST char **argv = NULL;
+ const char **argv = NULL;
/*
* All cursor names are valid lists of one element (for
@@ -191,8 +191,8 @@ TkGetCursorByName(
TkCursor *
TkCreateCursorFromData(
Tk_Window tkwin, /* Window in which cursor will be used. */
- CONST char *source, /* Bitmap data for cursor shape. */
- CONST char *mask, /* Bitmap data for cursor mask. */
+ const char *source, /* Bitmap data for cursor shape. */
+ const char *mask, /* Bitmap data for cursor mask. */
int width, int height, /* Dimensions of cursor. */
int xHot, int yHot, /* Location of hot-spot in cursor. */
XColor fgColor, /* Foreground color for cursor. */
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index da88672..93d2d57 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.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: tkWinDialog.c,v 1.51 2008/04/14 20:48:50 patthoyts Exp $
+ * RCS: @(#) $Id: tkWinDialog.c,v 1.52 2008/04/27 22:39:14 dkf Exp $
*
*/
@@ -175,10 +175,10 @@ static UINT CALLBACK ColorDlgHookProc(HWND hDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam);
static int GetFileNameA(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[], int isOpen);
+ Tcl_Obj *const objv[], int isOpen);
static int GetFileNameW(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[], int isOpen);
+ Tcl_Obj *const objv[], int isOpen);
static int MakeFilter(Tcl_Interp *interp, Tcl_Obj *valuePtr,
Tcl_DString *dsPtr, Tcl_Obj *initialPtr,
int *index);
@@ -290,7 +290,7 @@ Tk_ChooseColorObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin, parent;
HWND hWnd;
@@ -299,7 +299,7 @@ Tk_ChooseColorObjCmd(
static int inited = 0;
static COLORREF dwCustColors[16];
static long oldColor; /* the color selected last time */
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"-initialcolor", "-parent", "-title", NULL
};
enum options {
@@ -502,7 +502,7 @@ Tk_GetOpenFileObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
return GetFileNameW(clientData, interp, objc, objv, 1);
@@ -533,7 +533,7 @@ Tk_GetSaveFileObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
return GetFileNameW(clientData, interp, objc, objv, 0);
@@ -563,7 +563,7 @@ GetFileNameW(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[], /* Argument objects. */
+ Tcl_Obj *const objv[], /* Argument objects. */
int open) /* 1 to call GetOpenFileName(), 0 to call
* GetSaveFileName(). */
{
@@ -579,15 +579,15 @@ GetFileNameW(
Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- static CONST char *saveOptionStrings[] = {
+ static const char *saveOptionStrings[] = {
"-defaultextension", "-filetypes", "-initialdir", "-initialfile",
"-parent", "-title", "-typevariable", NULL
};
- static CONST char *openOptionStrings[] = {
+ static const char *openOptionStrings[] = {
"-defaultextension", "-filetypes", "-initialdir", "-initialfile",
"-multiple", "-parent", "-title", "-typevariable", NULL
};
- CONST char **optionStrings;
+ const char **optionStrings;
enum options {
FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE,
@@ -1007,7 +1007,7 @@ GetFileNameA(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[], /* Argument objects. */
+ Tcl_Obj *const objv[], /* Argument objects. */
int open) /* 1 to call GetOpenFileName(), 0 to call
* GetSaveFileName(). */
{
@@ -1022,15 +1022,15 @@ GetFileNameA(
Tcl_DString extString, filterString, dirString, titleString;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- static CONST char *saveOptionStrings[] = {
+ static const char *saveOptionStrings[] = {
"-defaultextension", "-filetypes", "-initialdir", "-initialfile",
"-parent", "-title", "-typevariable", NULL
};
- static CONST char *openOptionStrings[] = {
+ static const char *openOptionStrings[] = {
"-defaultextension", "-filetypes", "-initialdir", "-initialfile",
"-multiple", "-parent", "-title", "-typevariable", NULL
};
- CONST char **optionStrings;
+ const char **optionStrings;
enum options {
FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE,
@@ -1674,7 +1674,7 @@ Tk_ChooseDirectoryObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
char path[MAX_PATH];
int oldMode, result, i;
@@ -1689,7 +1689,7 @@ Tk_ChooseDirectoryObjCmd(
TCHAR saveDir[MAX_PATH];
Tcl_DString titleString; /* UTF Title */
Tcl_DString initDirString; /* Initial directory */
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"-initialdir", "-mustexist", "-parent", "-title", NULL
};
enum options {
@@ -2056,7 +2056,7 @@ Tk_MessageBoxObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin, parent;
HWND hWnd;
@@ -2064,7 +2064,7 @@ Tk_MessageBoxObjCmd(
int defaultBtn, icon, type;
int i, oldMode, winCode;
UINT flags;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"-default", "-detail", "-icon", "-message",
"-parent", "-title", "-type", NULL
};
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index 35762d4..c082b58 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.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: tkWinDraw.c,v 1.20 2007/12/13 15:28:55 dgp Exp $
+ * RCS: @(#) $Id: tkWinDraw.c,v 1.21 2008/04/27 22:39:16 dkf Exp $
*/
#include "tkWinInt.h"
@@ -103,7 +103,7 @@ int tkpWinBltModes[] = {
* The followng typedef is used to pass Windows GDI drawing functions.
*/
-typedef BOOL (CALLBACK *WinDrawFunc)(HDC dc, CONST POINT* points, int npoints);
+typedef BOOL (CALLBACK *WinDrawFunc)(HDC dc, const POINT *points, int npoints);
typedef struct ThreadSpecificData {
POINT *winPoints; /* Array of points that is reused. */
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index 80b1204..bf49dcd 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.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: tkWinEmbed.c,v 1.34 2008/04/08 03:28:05 kennykb Exp $
+ * RCS: @(#) $Id: tkWinEmbed.c,v 1.35 2008/04/27 22:39:17 dkf Exp $
*/
#include "tkWinInt.h"
@@ -104,7 +104,7 @@ TkpTestembedCmd(
ClientData clientData,
Tcl_Interp *interp,
int argc,
- CONST char **argv)
+ const char **argv)
{
return TCL_OK;
}
@@ -232,7 +232,7 @@ TkpUseWindow(
* string is bogus. */
Tk_Window tkwin, /* Tk window that does not yet have an
* associated X window. */
- CONST char *string) /* String identifying an X window to use for
+ const char *string) /* String identifying an X window to use for
* tkwin; must be an integer value. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 29e5fff..c6ce1e7 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.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: tkWinFont.c,v 1.38 2007/12/13 15:28:55 dgp Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.39 2008/04/27 22:39:17 dkf Exp $
*/
#include "tkWinInt.h"
@@ -174,7 +174,7 @@ typedef struct ThreadSpecificData {
* currently loaded. As screen fonts are
* loaded, this list grows to hold information
* about what characters exist in each font
- * family. */
+ * family. */
Tcl_HashTable uidTable;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -196,33 +196,33 @@ static SubFont * CanUseFallback(HDC hdc, WinFont *fontPtr,
static SubFont * CanUseFallbackWithAliases(HDC hdc, WinFont *fontPtr,
char *faceName, int ch, Tcl_DString *nameTriedPtr,
SubFont **subFontPtrPtr);
-static int FamilyExists(HDC hdc, CONST char *faceName);
-static char * FamilyOrAliasExists(HDC hdc, CONST char *faceName);
+static int FamilyExists(HDC hdc, const char *faceName);
+static char * FamilyOrAliasExists(HDC hdc, const char *faceName);
static SubFont * FindSubFontForChar(WinFont *fontPtr, int ch,
SubFont **subFontPtrPtr);
static void FontMapInsert(SubFont *subFontPtr, int ch);
static void FontMapLoadPage(SubFont *subFontPtr, int row);
static int FontMapLookup(SubFont *subFontPtr, int ch);
static void FreeFontFamily(FontFamily *familyPtr);
-static HFONT GetScreenFont(CONST TkFontAttributes *faPtr,
- CONST char *faceName, int pixelSize);
+static HFONT GetScreenFont(const TkFontAttributes *faPtr,
+ const char *faceName, int pixelSize);
static void InitFont(Tk_Window tkwin, HFONT hFont,
int overstrike, WinFont *tkFontPtr);
static void InitSubFont(HDC hdc, HFONT hFont, int base,
SubFont *subFontPtr);
static int CreateNamedSystemLogFont(Tcl_Interp *interp,
- Tk_Window tkwin, CONST char* name,
+ Tk_Window tkwin, const char* name,
LOGFONT* logFontPtr);
static int CreateNamedSystemFont(Tcl_Interp *interp,
- Tk_Window tkwin, CONST char* name, HFONT hFont);
+ Tk_Window tkwin, const char* name, HFONT hFont);
static int LoadFontRanges(HDC hdc, HFONT hFont,
USHORT **startCount, USHORT **endCount,
int *symbolPtr);
static void MultiFontTextOut(HDC hdc, WinFont *fontPtr,
- CONST char *source, int numBytes, int x, int y);
+ const char *source, int numBytes, int x, int y);
static void ReleaseFont(WinFont *fontPtr);
static void ReleaseSubFont(SubFont *subFontPtr);
-static int SeenName(CONST char *name, Tcl_DString *dsPtr);
+static int SeenName(const char *name, Tcl_DString *dsPtr);
static void SwapLong(PULONG p);
static void SwapShort(USHORT *p);
static int CALLBACK WinFontCanUseProc(ENUMLOGFONT *lfPtr,
@@ -300,7 +300,7 @@ TkpFontPkgInit(
TkFont *
TkpGetNativeFont(
Tk_Window tkwin, /* For display where font will be used. */
- CONST char *name) /* Platform-specific font name. */
+ const char *name) /* Platform-specific font name. */
{
int object;
WinFont *fontPtr;
@@ -335,7 +335,7 @@ static int
CreateNamedSystemLogFont(
Tcl_Interp *interp,
Tk_Window tkwin,
- CONST char* name,
+ const char* name,
LOGFONTA* logFontPtr)
{
HFONT hFont;
@@ -365,7 +365,7 @@ static int
CreateNamedSystemFont(
Tcl_Interp *interp,
Tk_Window tkwin,
- CONST char* name,
+ const char* name,
HFONT hFont)
{
WinFont winfont;
@@ -403,14 +403,14 @@ TkWinSetupSystemFonts(TkMainInfo *mainPtr)
/* force this for now */
if (((TkWindow *) tkwin)->mainPtr == NULL) {
- ((TkWindow *) tkwin)->mainPtr = mainPtr;
+ ((TkWindow *) tkwin)->mainPtr = mainPtr;
}
/*
- * If this API call fails then we will fallback to setting these
- * named fonts from script in ttk/fonts.tcl. So far I've only
- * seen it fail when WINVER has been defined for a higher platform than
- * we are running on. (ie: WINVER=0x0600 and running on XP).
+ * If this API call fails then we will fallback to setting these named
+ * fonts from script in ttk/fonts.tcl. So far I've only seen it fail when
+ * WINVER has been defined for a higher platform than we are running on.
+ * (i.e. WINVER=0x0600 and running on XP).
*/
ZeroMemory(&ncMetrics, sizeof(ncMetrics));
@@ -418,29 +418,29 @@ TkWinSetupSystemFonts(TkMainInfo *mainPtr)
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
sizeof(ncMetrics), &ncMetrics, 0)) {
CreateNamedSystemLogFont(interp, tkwin, "TkDefaultFont",
- &ncMetrics.lfMessageFont);
+ &ncMetrics.lfMessageFont);
CreateNamedSystemLogFont(interp, tkwin, "TkHeadingFont",
- &ncMetrics.lfMessageFont);
+ &ncMetrics.lfMessageFont);
CreateNamedSystemLogFont(interp, tkwin, "TkTextFont",
- &ncMetrics.lfMessageFont);
+ &ncMetrics.lfMessageFont);
CreateNamedSystemLogFont(interp, tkwin, "TkMenuFont",
- &ncMetrics.lfMenuFont);
+ &ncMetrics.lfMenuFont);
CreateNamedSystemLogFont(interp, tkwin, "TkTooltipFont",
- &ncMetrics.lfStatusFont);
+ &ncMetrics.lfStatusFont);
CreateNamedSystemLogFont(interp, tkwin, "TkCaptionFont",
- &ncMetrics.lfCaptionFont);
+ &ncMetrics.lfCaptionFont);
CreateNamedSystemLogFont(interp, tkwin, "TkSmallCaptionFont",
- &ncMetrics.lfSmCaptionFont);
+ &ncMetrics.lfSmCaptionFont);
}
iconMetrics.cbSize = sizeof(iconMetrics);
if (SystemParametersInfo(SPI_GETICONMETRICS, sizeof(iconMetrics),
&iconMetrics, 0)) {
CreateNamedSystemLogFont(interp, tkwin, "TkIconFont",
- &iconMetrics.lfFont);
+ &iconMetrics.lfFont);
}
- hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
+ hFont = (HFONT) GetStockObject(ANSI_FIXED_FONT);
CreateNamedSystemFont(interp, tkwin, "TkFixedFont", hFont);
/*
@@ -448,8 +448,8 @@ TkWinSetupSystemFonts(TkMainInfo *mainPtr)
*/
for (mapPtr = systemMap; mapPtr->strKey != NULL; mapPtr++) {
- hFont = (HFONT)GetStockObject(mapPtr->numKey);
- CreateNamedSystemFont(interp, tkwin, mapPtr->strKey, hFont);
+ hFont = (HFONT) GetStockObject(mapPtr->numKey);
+ CreateNamedSystemFont(interp, tkwin, mapPtr->strKey, hFont);
}
}
@@ -491,7 +491,7 @@ TkpGetFontFromAttributes(
* will be released. If NULL, a new TkFont
* structure is allocated. */
Tk_Window tkwin, /* For display where font will be used. */
- CONST TkFontAttributes *faPtr)
+ const TkFontAttributes *faPtr)
/* Set of attributes to match. */
{
int i, j;
@@ -764,7 +764,7 @@ TkpGetFontAttrsForChar(
/*
*---------------------------------------------------------------------------
*
- * Tk_MeasureChars --
+ * Tk_MeasureChars --
*
* Determine the number of bytes from the string that will fit in the
* given horizontal span. The measurement is done under the assumption
@@ -784,7 +784,7 @@ TkpGetFontAttrsForChar(
int
Tk_MeasureChars(
Tk_Font tkfont, /* Font in which characters will be drawn. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
int numBytes, /* Maximum number of bytes to consider from
* source string. */
@@ -815,7 +815,7 @@ Tk_MeasureChars(
FontFamily *familyPtr;
Tcl_DString runString;
SubFont *thisSubFontPtr, *lastSubFontPtr;
- CONST char *p, *end, *next = NULL, *start;
+ const char *p, *end, *next = NULL, *start;
if (numBytes == 0) {
*lengthPtr = 0;
@@ -952,7 +952,7 @@ Tk_MeasureChars(
* procedure without the maxLength limit or any flags.
*/
- CONST char *lastWordBreak = NULL;
+ const char *lastWordBreak = NULL;
Tcl_UniChar ch2;
end = p;
@@ -986,7 +986,7 @@ Tk_MeasureChars(
/*
*---------------------------------------------------------------------------
*
- * TkpMeasureCharsInContext --
+ * TkpMeasureCharsInContext --
*
* Determine the number of bytes from the string that will fit in the
* given horizontal span. The measurement is done under the assumption
@@ -1011,7 +1011,7 @@ Tk_MeasureChars(
int
TkpMeasureCharsInContext(
Tk_Font tkfont, /* Font in which characters will be drawn. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
int numBytes, /* Maximum number of bytes to consider from
* source string in all. */
@@ -1063,7 +1063,7 @@ Tk_DrawChars(
GC gc, /* Graphics context for drawing characters. */
Tk_Font tkfont, /* Font in which characters will be drawn;
* must be the same as font used in GC. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
@@ -1227,7 +1227,7 @@ TkpDrawCharsInContext(
GC gc, /* Graphics context for drawing characters. */
Tk_Font tkfont, /* Font in which characters will be drawn;
* must be the same as font used in GC. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
+ const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
@@ -1271,7 +1271,7 @@ MultiFontTextOut(
HDC hdc, /* HDC to draw into. */
WinFont *fontPtr, /* Contains set of fonts to use when drawing
* following string. */
- CONST char *source, /* Potentially multilingual UTF-8 string. */
+ const char *source, /* Potentially multilingual UTF-8 string. */
int numBytes, /* Length of string in bytes. */
int x, int y) /* Coordinates at which to place origin of
* string when drawing. */
@@ -1281,7 +1281,7 @@ MultiFontTextOut(
HFONT oldFont;
FontFamily *familyPtr;
Tcl_DString runString;
- CONST char *p, *end, *next;
+ const char *p, *end, *next;
SubFont *lastSubFontPtr, *thisSubFontPtr;
TEXTMETRIC tm;
@@ -1705,7 +1705,7 @@ FreeFontFamily(
for (familyPtrPtr = &tsdPtr->fontFamilyList; ; ) {
if (*familyPtrPtr == familyPtr) {
- *familyPtrPtr = familyPtr->nextPtr;
+ *familyPtrPtr = familyPtr->nextPtr;
break;
}
familyPtrPtr = &(*familyPtrPtr)->nextPtr;
@@ -1850,7 +1850,7 @@ FindSubFontForChar(
if (subFontPtr == NULL) {
/*
- * No font can display this character. We will use the base font and
+ * No font can display this character. We will use the base font and
* have it display the "unknown" character.
*/
@@ -2146,11 +2146,11 @@ CanUseFallbackWithAliases(
static int
SeenName(
- CONST char *name, /* The name to check. */
+ const char *name, /* The name to check. */
Tcl_DString *dsPtr) /* Contains names that have already been
* seen. */
{
- CONST char *seen, *end;
+ const char *seen, *end;
seen = Tcl_DStringValue(dsPtr);
end = seen + Tcl_DStringLength(dsPtr);
@@ -2277,9 +2277,9 @@ CanUseFallback(
static HFONT
GetScreenFont(
- CONST TkFontAttributes *faPtr,
+ const TkFontAttributes *faPtr,
/* Desired font attributes for new HFONT. */
- CONST char *faceName, /* Overrides font family specified in font
+ const char *faceName, /* Overrides font family specified in font
* attributes. */
int pixelSize) /* Overrides size specified in font
* attributes. */
@@ -2359,7 +2359,7 @@ GetScreenFont(
static int
FamilyExists(
HDC hdc, /* HDC in which font family will be used. */
- CONST char *faceName) /* Font family to query. */
+ const char *faceName) /* Font family to query. */
{
int result;
Tcl_DString faceString;
@@ -2403,7 +2403,7 @@ FamilyExists(
static char *
FamilyOrAliasExists(
HDC hdc,
- CONST char *faceName)
+ const char *faceName)
{
char **aliases;
int i;
@@ -2439,7 +2439,7 @@ WinFontExistProc(
#pragma pack(1) /* Structures are byte aligned in file. */
-#define CMAPHEX 0x636d6170 /* Key for character map resource. */
+#define CMAPHEX 0x636d6170 /* Key for character map resource. */
typedef struct CMAPTABLE {
USHORT version; /* Table version number (0). */
@@ -2481,7 +2481,7 @@ typedef struct SUBHEADER {
} SUBHEADER;
typedef struct HIBYTETABLE {
- USHORT format; /* Format number is set to 2. */
+ USHORT format; /* Format number is set to 2. */
USHORT length; /* The actual length in bytes of this
* subtable. */
USHORT version; /* Version number (starts at 0). */
diff --git a/win/tkWinInit.c b/win/tkWinInit.c
index 1a7f2be..a1b06ff 100644
--- a/win/tkWinInit.c
+++ b/win/tkWinInit.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: tkWinInit.c,v 1.14 2007/12/13 15:28:55 dgp Exp $
+ * RCS: @(#) $Id: tkWinInit.c,v 1.15 2008/04/27 22:39:17 dkf Exp $
*/
#include "tkWinInt.h"
@@ -70,7 +70,7 @@ TkpGetAppName(
Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */
{
int argc, namelength;
- CONST char **argv = NULL, *name, *p;
+ const char **argv = NULL, *name, *p;
name = Tcl_GetVar(interp, "argv0", TCL_GLOBAL_ONLY);
namelength = -1;
@@ -115,8 +115,8 @@ TkpGetAppName(
void
TkpDisplayWarning(
- CONST char *msg, /* Message to be displayed. */
- CONST char *title) /* Title of warning. */
+ const char *msg, /* Message to be displayed. */
+ const char *title) /* Title of warning. */
{
Tcl_DString msgString, titleString;
Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index 0cdcb58..6de5563 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinTest.c,v 1.16 2008/04/14 20:48:51 patthoyts Exp $
+ * RCS: @(#) $Id: tkWinTest.c,v 1.17 2008/04/27 22:39:17 dkf Exp $
*/
#include "tkWinInt.h"
@@ -24,15 +24,15 @@ HWND tkWinCurrentDialog;
static int TestclipboardObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int TestwineventCmd(ClientData clientData,
- Tcl_Interp *interp, int argc, CONST char **argv);
+ Tcl_Interp *interp, int argc, const char **argv);
static int TestfindwindowObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int TestgetwindowinfoObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp);
@@ -180,7 +180,7 @@ TestclipboardObjCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument values. */
+ Tcl_Obj *const objv[]) /* Argument values. */
{
HGLOBAL handle;
char *data;
@@ -238,7 +238,7 @@ TestwineventCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
- CONST char **argv) /* Argument strings. */
+ const char **argv) /* Argument strings. */
{
HWND hwnd = 0;
HWND child = 0;
@@ -379,7 +379,7 @@ TestfindwindowObjCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument values. */
+ Tcl_Obj *const objv[]) /* Argument values. */
{
const char *title = NULL, *class = NULL;
HWND hwnd = NULL;
@@ -418,7 +418,7 @@ TestgetwindowinfoObjCmd(
ClientData clientData,
Tcl_Interp *interp,
int objc,
- Tcl_Obj *CONST objv[])
+ Tcl_Obj *const objv[])
{
HWND hwnd = NULL;
Tcl_Obj *resObj = NULL, *classObj = NULL, *textObj = NULL;
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index e7a25af..1c2745c 100644
--- a/win/tkWinWindow.c
+++ b/win/tkWinWindow.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: tkWinWindow.c,v 1.15 2007/02/23 14:15:34 dkf Exp $
+ * RCS: @(#) $Id: tkWinWindow.c,v 1.16 2008/04/27 22:39:17 dkf Exp $
*/
#include "tkWinInt.h"
@@ -203,7 +203,7 @@ TkpPrintWindowId(
int
TkpScanWindowId(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
- CONST char *string, /* String containing a (possibly signed)
+ const char *string, /* String containing a (possibly signed)
* integer in a form acceptable to strtol. */
Window *idPtr) /* Place to store converted result. */
{
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index d9fc1ac..b4d5705 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.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: tkWinWm.c,v 1.124 2007/12/14 15:56:09 patthoyts Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.125 2008/04/27 22:39:17 dkf Exp $
*/
#include "tkWinInt.h"
@@ -265,7 +265,7 @@ typedef struct TkWmInfo {
ProtocolHandler *protPtr; /* First in list of protocol handlers for this
* window (NULL means none). */
int cmdArgc; /* Number of elements in cmdArgv below. */
- CONST char **cmdArgv; /* Array of strings to store in the WM_COMMAND
+ const char **cmdArgv; /* Array of strings to store in the WM_COMMAND
* property. NULL means nothing available. */
char *clientMachine; /* String to store in WM_CLIENT_MACHINE
* property, or NULL. */
@@ -462,100 +462,100 @@ static void DecrIconRefCount(WinIconPtr titlebaricon);
static int WmAspectCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmAttributesCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmClientCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmColormapwindowsCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmCommandCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmDeiconifyCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmFocusmodelCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmForgetCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmFrameCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmGeometryCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmGridCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmGroupCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconbitmapCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconifyCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconmaskCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconnameCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconphotoCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconpositionCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmIconwindowCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmManageCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmMaxsizeCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmMinsizeCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmOverrideredirectCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmPositionfromCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmProtocolCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmResizableCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmSizefromCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmStackorderCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmStateCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmTitleCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmTransientCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static int WmWithdrawCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]);
+ Tcl_Obj *const objv[]);
static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr);
/*
@@ -1294,7 +1294,7 @@ ReadIconFromFile(
SHFILEINFO sfiSM;
Tcl_DString ds, ds2;
DWORD *res;
- CONST char *file;
+ const char *file;
file = Tcl_TranslateFileName(interp, Tcl_GetString(fileName), &ds);
if (file == NULL) {
@@ -2831,10 +2831,10 @@ Tk_WmObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"aspect", "attributes", "client", "colormapwindows",
"command", "deiconify", "focusmodel", "forget", "frame",
"geometry", "grid", "group", "iconbitmap",
@@ -3007,7 +3007,7 @@ WmAspectCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int numer1, denom1, numer2, denom2;
@@ -3074,7 +3074,7 @@ WmAttributesCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
LONG style, exStyle, styleBit, *stylePtr = NULL;
@@ -3365,7 +3365,7 @@ WmClientCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -3435,7 +3435,7 @@ WmColormapwindowsCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
TkWindow **cmapList;
@@ -3528,12 +3528,12 @@ WmCommandCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
int cmdArgc;
- CONST char **cmdArgv;
+ const char **cmdArgv;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?value?");
@@ -3595,7 +3595,7 @@ WmDeiconifyCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -3643,10 +3643,10 @@ WmFocusmodelCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"active", "passive", NULL
};
enum options {
@@ -3694,12 +3694,12 @@ WmFocusmodelCmd(
*/
static int
-WmForgetCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel or Frame to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmForgetCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel or Frame to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register Tk_Window frameWin = (Tk_Window)winPtr;
@@ -3739,7 +3739,7 @@ WmFrameCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
HWND hwnd;
@@ -3784,7 +3784,7 @@ WmGeometryCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char xSign, ySign;
@@ -3854,7 +3854,7 @@ WmGridCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int reqWidth, reqHeight, widthInc, heightInc;
@@ -3943,7 +3943,7 @@ WmGroupCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
@@ -4006,7 +4006,7 @@ WmIconbitmapCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */
@@ -4140,7 +4140,7 @@ WmIconifyCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
if (objc != 3) {
@@ -4196,7 +4196,7 @@ WmIconmaskCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Pixmap pixmap;
@@ -4254,7 +4254,7 @@ WmIconnameCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -4306,7 +4306,7 @@ WmIconphotoCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */
Tk_PhotoHandle photo;
@@ -4431,7 +4431,7 @@ WmIconpositionCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y;
@@ -4487,7 +4487,7 @@ WmIconwindowCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
@@ -4589,12 +4589,12 @@ WmIconwindowCmd(
*/
static int
-WmManageCmd(tkwin, winPtr, interp, objc, objv)
- Tk_Window tkwin; /* Main window of the application. */
- TkWindow *winPtr; /* Toplevel or Frame to work with */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+WmManageCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel or Frame to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register Tk_Window frameWin = (Tk_Window)winPtr;
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4641,7 +4641,7 @@ WmMaxsizeCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -4691,7 +4691,7 @@ WmMinsizeCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -4741,7 +4741,7 @@ WmOverrideredirectCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int boolean, curValue;
@@ -4812,10 +4812,10 @@ WmPositionfromCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"program", "user", NULL
};
enum options {
@@ -4877,7 +4877,7 @@ WmProtocolCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
register ProtocolHandler *protPtr, *prevPtr;
@@ -4969,7 +4969,7 @@ WmResizableCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -5032,10 +5032,10 @@ WmSizefromCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"program", "user", NULL
};
enum options {
@@ -5098,10 +5098,10 @@ WmStackorderCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
TkWindow **windows, **window_ptr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"isabove", "isbelow", NULL
};
enum options {
@@ -5219,10 +5219,10 @@ WmStateCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
+ static const char *optionStrings[] = {
"normal", "iconic", "withdrawn", "zoomed", NULL
};
enum options {
@@ -5361,7 +5361,7 @@ WmTitleCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
@@ -5435,7 +5435,7 @@ WmTransientCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
TkWindow *masterPtr = wmPtr->masterPtr, **masterPtrPtr = &masterPtr;
@@ -5556,7 +5556,7 @@ WmWithdrawCmd(
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -6530,7 +6530,7 @@ TkWmProtocolEventProc(
* the eval.
*/
- CONST char *name = Tk_GetAtomName((Tk_Window) winPtr, protocol);
+ const char *name = Tk_GetAtomName((Tk_Window) winPtr, protocol);
Tcl_Preserve((ClientData) protPtr);
interp = protPtr->interp;
diff --git a/win/tkWinX.c b/win/tkWinX.c
index e5e9e7b..9632bd2 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.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: tkWinX.c,v 1.57 2007/12/13 15:28:56 dgp Exp $
+ * RCS: @(#) $Id: tkWinX.c,v 1.58 2008/04/27 22:39:17 dkf Exp $
*/
/*
@@ -70,7 +70,7 @@ static TkWinProcs asciiProcs = {
WPARAM wParam, LPARAM lParam)) CallWindowProcA,
(LRESULT (WINAPI *)(HWND hWnd, UINT Msg, WPARAM wParam,
LPARAM lParam)) DefWindowProcA,
- (ATOM (WINAPI *)(CONST WNDCLASS *lpWndClass)) RegisterClassA,
+ (ATOM (WINAPI *)(const WNDCLASS *lpWndClass)) RegisterClassA,
(BOOL (WINAPI *)(HWND hWnd, LPCTSTR lpString)) SetWindowTextA,
(HWND (WINAPI *)(DWORD dwExStyle, LPCTSTR lpClassName,
LPCTSTR lpWindowName, DWORD dwStyle, int x, int y,
@@ -88,7 +88,7 @@ static TkWinProcs unicodeProcs = {
WPARAM wParam, LPARAM lParam)) CallWindowProcW,
(LRESULT (WINAPI *)(HWND hWnd, UINT Msg, WPARAM wParam,
LPARAM lParam)) DefWindowProcW,
- (ATOM (WINAPI *)(CONST WNDCLASS *lpWndClass)) RegisterClassW,
+ (ATOM (WINAPI *)(const WNDCLASS *lpWndClass)) RegisterClassW,
(BOOL (WINAPI *)(HWND hWnd, LPCTSTR lpString)) SetWindowTextW,
(HWND (WINAPI *)(DWORD dwExStyle, LPCTSTR lpClassName,
LPCTSTR lpWindowName, DWORD dwStyle, int x, int y,
@@ -464,10 +464,10 @@ TkWinGetPlatformTheme(void)
*----------------------------------------------------------------------
*/
-CONST char *
+const char *
TkGetDefaultScreenName(
Tcl_Interp *interp, /* Not used. */
- CONST char *screenName) /* If NULL, use default string. */
+ const char *screenName) /* If NULL, use default string. */
{
if ((screenName == NULL) || (screenName[0] == '\0')) {
screenName = winScreenName;
@@ -589,7 +589,7 @@ TkWinDisplayChanged(
TkDisplay *
TkpOpenDisplay(
- CONST char *display_name)
+ const char *display_name)
{
Screen *screen;
TkWinDrawable *twdPtr;
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index a0a485c..03eaab9 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -1,5 +1,5 @@
/*
- * $Id: ttkWinXPTheme.c,v 1.19 2008/04/08 23:30:46 patthoyts Exp $
+ * $Id: ttkWinXPTheme.c,v 1.20 2008/04/27 22:39:17 dkf Exp $
*
* Tk theme engine which uses the Windows XP "Visual Styles" API
* Adapted from Georgios Petasis' XP theme patch.
@@ -50,8 +50,8 @@ typedef HRESULT (STDAPICALLTYPE GetThemeTextExtentProc)(HTHEME hTheme, HDC hdc,
typedef HRESULT (STDAPICALLTYPE DrawThemeTextProc)(HTHEME hTheme, HDC hdc,
int iPartId, int iStateId, LPCWSTR pszText, int iCharCount,
DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect);
-typedef BOOL (STDAPICALLTYPE IsThemeActiveProc)(VOID);
-typedef BOOL (STDAPICALLTYPE IsAppThemedProc)(VOID);
+typedef BOOL (STDAPICALLTYPE IsThemeActiveProc)(void);
+typedef BOOL (STDAPICALLTYPE IsAppThemedProc)(void);
typedef struct
{
@@ -992,7 +992,8 @@ Ttk_CreateVsapiElement(
void *clientData,
Ttk_Theme theme,
const char *elementName,
- int objc, Tcl_Obj *CONST objv[])
+ int objc,
+ Tcl_Obj *const objv[])
{
XPThemeData *themeData = clientData;
ElementInfo *elementPtr = NULL;
@@ -1028,34 +1029,38 @@ Ttk_CreateVsapiElement(
int tmp = 0;
if (i == objc -1) {
Tcl_AppendResult(interp, "Missing value for \"",
- Tcl_GetString(objv[i]), "\".", NULL);
+ Tcl_GetString(objv[i]), "\".", NULL);
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings,
"option", 0, &option) != TCL_OK)
return TCL_ERROR;
switch (option) {
- case O_PADDING:
- if (Ttk_GetBorderFromObj(interp, objv[i+1], &pad) != TCL_OK)
- return TCL_ERROR;
- break;
- case O_MARGINS:
- if (Ttk_GetBorderFromObj(interp, objv[i+1], &pad) != TCL_OK)
- return TCL_ERROR;
- flags |= PAD_MARGINS;
- break;
- case O_WIDTH:
- if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK)
- return TCL_ERROR;
- pad.left = pad.right = tmp;
- flags |= IGNORE_THEMESIZE;
- break;
- case O_HEIGHT:
- if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK)
- return TCL_ERROR;
- pad.top = pad.bottom = tmp;
- flags |= IGNORE_THEMESIZE;
- break;
+ case O_PADDING:
+ if (Ttk_GetBorderFromObj(interp, objv[i+1], &pad) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
+ case O_MARGINS:
+ if (Ttk_GetBorderFromObj(interp, objv[i+1], &pad) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ flags |= PAD_MARGINS;
+ break;
+ case O_WIDTH:
+ if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ pad.left = pad.right = tmp;
+ flags |= IGNORE_THEMESIZE;
+ break;
+ case O_HEIGHT:
+ if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ pad.top = pad.bottom = tmp;
+ flags |= IGNORE_THEMESIZE;
+ break;
}
}
}
@@ -1068,7 +1073,7 @@ Ttk_CreateVsapiElement(
return TCL_ERROR;
/* we over-allocate to ensure there is a terminating entry */
stateTable = (Ttk_StateTable *)
- ckalloc(sizeof(Ttk_StateTable) * (count + 1));
+ ckalloc(sizeof(Ttk_StateTable) * (count + 1));
memset(stateTable, 0, sizeof(Ttk_StateTable) * (count + 1));
for (n = 0, j = 0; status == TCL_OK && n < count; n += 2, ++j) {
Ttk_StateSpec spec = {0,0};
@@ -1077,7 +1082,7 @@ Ttk_CreateVsapiElement(
stateTable[j].onBits = spec.onbits;
stateTable[j].offBits = spec.offbits;
status = Tcl_GetIntFromObj(interp, specs[n+1],
- &stateTable[j].index);
+ &stateTable[j].index);
}
}
if (status != TCL_OK) {
@@ -1102,7 +1107,7 @@ Ttk_CreateVsapiElement(
elementPtr->elementName = name;
/* set the class name to an allocated copy */
- wname = (LPWSTR)ckalloc(sizeof(WCHAR) * (length + 1));
+ wname = (LPWSTR) ckalloc(sizeof(WCHAR) * (length + 1));
wcscpy(wname, className);
elementPtr->className = wname;
diff --git a/win/winMain.c b/win/winMain.c
index 254d194..c75c22c 100644
--- a/win/winMain.c
+++ b/win/winMain.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: winMain.c,v 1.26 2007/12/13 15:28:56 dgp Exp $
+ * RCS: @(#) $Id: winMain.c,v 1.27 2008/04/27 22:39:17 dkf Exp $
*/
#include "tkInt.h"
@@ -28,7 +28,7 @@
* Forward declarations for procedures defined later in this file:
*/
-static void WishPanic(CONST char *format, ...);
+static void WishPanic(const char *format, ...);
#ifdef TK_TEST
extern int Tktest_Init(Tcl_Interp *interp);
#endif /* TK_TEST */
@@ -224,7 +224,7 @@ error:
void
WishPanic(
- CONST char *format, ...)
+ const char *format, ...)
{
va_list argList;
char buf[1024];