summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-02-13 13:47:49 (GMT)
committernijtmans <nijtmans>2010-02-13 13:47:49 (GMT)
commit759424b1be09259bf20d269efd93af21c5150a01 (patch)
treed5a35b36ffd02f3cb0421a640eda7ee6ee229478 /generic
parent454e04bbf4e61fb4a363ffcfedb08e941a17952f (diff)
downloadtk-759424b1be09259bf20d269efd93af21c5150a01.zip
tk-759424b1be09259bf20d269efd93af21c5150a01.tar.gz
tk-759424b1be09259bf20d269efd93af21c5150a01.tar.bz2
use -pipe for gcc on win32 (mingw/cygwin)
make sure that TkpCmapStressed is exported clean up unused Tk_CreatePhotoOption Make more internal arrays "const"
Diffstat (limited to 'generic')
-rw-r--r--generic/tkBind.c16
-rw-r--r--generic/tkBusy.c4
-rw-r--r--generic/tkButton.c4
-rw-r--r--generic/tkEvent.c6
-rw-r--r--generic/tkGrab.c4
-rw-r--r--generic/tkImgBmap.c4
-rw-r--r--generic/tkImgPhoto.c153
-rw-r--r--generic/tkObj.c6
-rw-r--r--generic/tkOption.c12
-rw-r--r--generic/tkPanedWindow.c16
-rw-r--r--generic/tkPointer.c4
-rw-r--r--generic/tkWindow.c10
12 files changed, 46 insertions, 193 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 5c10a58..e0fcf19 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.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: tkBind.c,v 1.61 2010/01/29 23:29:06 nijtmans Exp $
+ * RCS: @(#) $Id: tkBind.c,v 1.62 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "tkInt.h"
@@ -354,7 +354,7 @@ typedef struct {
const char *name; /* Name of keysym. */
KeySym value; /* Numeric identifier for keysym. */
} KeySymInfo;
-static KeySymInfo keyArray[] = {
+static const KeySymInfo keyArray[] = {
#ifndef lint
#include "ks_names.h"
#endif
@@ -462,7 +462,7 @@ typedef struct {
* unless you've asked about button events.
*/
-static EventInfo eventArray[] = {
+static const EventInfo eventArray[] = {
{"Key", KeyPress, KeyPressMask},
{"KeyPress", KeyPress, KeyPressMask},
{"KeyRelease", KeyRelease, KeyPressMask|KeyReleaseMask},
@@ -534,7 +534,7 @@ static Tcl_HashTable eventTable;
#define KEY_BUTTON_MOTION_VIRTUAL (KEY|BUTTON|MOTION|VIRTUAL)
#define KEY_BUTTON_MOTION_CROSSING (KEY|BUTTON|MOTION|VIRTUAL|CROSSING)
-static int flagArray[TK_LASTEVENT] = {
+static const int flagArray[TK_LASTEVENT] = {
/* Not used */ 0,
/* Not used */ 0,
/* KeyPress */ KEY,
@@ -734,10 +734,10 @@ TkBindInit(
if (!initialized) {
Tcl_HashEntry *hPtr;
const ModInfo *modPtr;
- EventInfo *eiPtr;
+ const EventInfo *eiPtr;
int newEntry;
#ifdef REDO_KEYSYM_LOOKUP
- KeySymInfo *kPtr;
+ const KeySymInfo *kPtr;
Tcl_InitHashTable(&keySymTable, TCL_STRING_KEYS);
Tcl_InitHashTable(&nameTable, TCL_ONE_WORD_KEYS);
@@ -4272,7 +4272,7 @@ ParseEventDescription(
eventFlags = 0;
hPtr = Tcl_FindHashEntry(&eventTable, field);
if (hPtr != NULL) {
- EventInfo *eiPtr = Tcl_GetHashValue(hPtr);
+ const EventInfo *eiPtr = Tcl_GetHashValue(hPtr);
patPtr->eventType = eiPtr->type;
eventFlags = flagArray[eiPtr->type];
@@ -4416,7 +4416,7 @@ GetPatternString(
char c, buffer[TCL_INTEGER_SPACE];
int patsLeft, needMods;
const ModInfo *modPtr;
- EventInfo *eiPtr;
+ const EventInfo *eiPtr;
/*
* The order of the patterns in the sequence is backwards from the order
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index 1275e81..320f177 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.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: tkBusy.c,v 1.8 2010/02/05 22:45:03 nijtmans Exp $
+ * RCS: @(#) $Id: tkBusy.c,v 1.9 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "tkInt.h"
@@ -23,7 +23,7 @@
* OSX/Aqua, that's nothing at all.
*/
-static Tk_OptionSpec busyOptionSpecs[] = {
+static const Tk_OptionSpec busyOptionSpecs[] = {
#ifndef MAC_OSX_TK
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUSY_CURSOR, -1, Tk_Offset(Busy, cursor),
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 38b374d..1ad493a 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.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: tkButton.c,v 1.37 2010/01/13 23:08:07 nijtmans Exp $
+ * RCS: @(#) $Id: tkButton.c,v 1.38 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "tkInt.h"
@@ -502,7 +502,7 @@ enum command {
COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_DESELECT, COMMAND_FLASH,
COMMAND_INVOKE, COMMAND_SELECT, COMMAND_TOGGLE
};
-static enum command map[][8] = {
+static const enum command map[][8] = {
{COMMAND_CGET, COMMAND_CONFIGURE},
{COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_FLASH, COMMAND_INVOKE},
{COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_DESELECT, COMMAND_FLASH,
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 08f2f85..63c69ac 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.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: tkEvent.c,v 1.42 2010/01/02 22:52:38 dkf Exp $
+ * RCS: @(#) $Id: tkEvent.c,v 1.43 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "tkInt.h"
@@ -75,7 +75,7 @@ typedef struct TkWindowEvent {
* Array of event masks corresponding to each X event:
*/
-static unsigned long realEventMasks[MappingNotify+1] = {
+static const unsigned long realEventMasks[MappingNotify+1] = {
0,
0,
KeyPressMask, /* KeyPress */
@@ -116,7 +116,7 @@ static unsigned long realEventMasks[MappingNotify+1] = {
0 /* Mapping Notify */
};
-static unsigned long virtualEventMasks[TK_LASTEVENT-VirtualEvent] = {
+static const unsigned long virtualEventMasks[TK_LASTEVENT-VirtualEvent] = {
VirtualEventMask, /* VirtualEvents */
ActivateMask, /* ActivateNotify */
ActivateMask, /* DeactivateNotify */
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 48bfcd6..67cf216 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.19 2009/06/29 14:35:01 das Exp $
+ * RCS: @(#) $Id: tkGrab.c,v 1.20 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "tkInt.h"
@@ -141,7 +141,7 @@ typedef struct NewGrabWinEvent {
#define ALL_BUTTONS \
(Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
-static unsigned int buttonStates[] = {
+static const unsigned int buttonStates[] = {
Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask
};
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index f9a94e2..bec7a93 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.30 2010/01/18 20:43:38 nijtmans Exp $
+ * RCS: @(#) $Id: tkImgBmap.c,v 1.31 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "tkInt.h"
@@ -1134,7 +1134,7 @@ ImgBmapPsImagemask(
* within a byte so that the bits will be in the order postscript expects.
*/
- static unsigned char bit_reverse[] = {
+ static const unsigned char bit_reverse[] = {
0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240,
8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248,
4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244,
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 6c7fd26..8e0f6e3 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.94 2010/01/18 20:43:38 nijtmans Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.95 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "tkImgPhoto.h"
@@ -198,9 +198,6 @@ static int MatchStringFormat(Tcl_Interp *interp, Tcl_Obj *data,
Tcl_Obj *formatString,
Tk_PhotoImageFormat **imageFormatPtr,
int *widthPtr, int *heightPtr, int *oldformat);
-static Tcl_ObjCmdProc * PhotoOptionFind(Tcl_Interp *interp, Tcl_Obj *obj);
-static void PhotoOptionCleanupProc(ClientData clientData,
- Tcl_Interp *interp);
/*
*----------------------------------------------------------------------
@@ -426,12 +423,7 @@ ImgPhotoCmd(
if (Tcl_GetIndexFromObj(interp, objv[1], photoOptions, "option", 0,
&index) != TCL_OK) {
- Tcl_ObjCmdProc *proc = PhotoOptionFind(interp, objv[1]);
-
- if (proc == NULL) {
- return TCL_ERROR;
- }
- return proc(clientData, interp, objc, objv);
+ return TCL_ERROR;
}
switch ((enum PhotoOptions) index) {
@@ -3774,147 +3766,6 @@ Tk_PhotoGetImage(
}
/*
- *----------------------------------------------------------------------
- *
- * PhotoOptionFind --
- *
- * Finds a specific Photo option.
- *
- * Results:
- * None.
- *
- * Side effects:
- * After commands are removed.
- *
- *----------------------------------------------------------------------
- */
-
-typedef struct OptionAssocData {
- struct OptionAssocData *nextPtr;
- /* Pointer to next OptionAssocData. */
- Tcl_ObjCmdProc *command; /* Command associated with this option. */
- char name[1]; /* Name of option (remaining chars) */
-} OptionAssocData;
-
-static Tcl_ObjCmdProc *
-PhotoOptionFind(
- Tcl_Interp *interp, /* Interpreter that is being deleted. */
- Tcl_Obj *obj) /* Name of option to be found. */
-{
- int length;
- const char *name = Tcl_GetStringFromObj(obj, &length);
- char *prevname = NULL;
- Tcl_ObjCmdProc *proc = NULL;
- OptionAssocData *list = Tcl_GetAssocData(interp, "photoOption", NULL);
-
- while (list != NULL) {
- if (strncmp(name, list->name, (unsigned) length) == 0) {
- if (proc != NULL) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "ambiguous option \"", name,
- "\": must be ", prevname, NULL);
- while (list->nextPtr != NULL) {
- Tcl_AppendResult(interp, prevname, ", ",NULL);
- list = list->nextPtr;
- prevname = list->name;
- }
- Tcl_AppendResult(interp, ", or", prevname, NULL);
- return NULL;
- }
- proc = list->command;
- prevname = list->name;
- }
- list = list->nextPtr;
- }
- if (proc != NULL) {
- Tcl_ResetResult(interp);
- }
- return proc;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * PhotoOptionCleanupProc --
- *
- * This function is invoked whenever an interpreter is deleted to cleanup
- * the AssocData for "photoVisitor".
- *
- * Results:
- * None.
- *
- * Side effects:
- * Photo Visitor options are removed.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-PhotoOptionCleanupProc(
- ClientData clientData, /* Points to "photoVisitor" AssocData for the
- * interpreter. */
- Tcl_Interp *interp) /* Interpreter that is being deleted. */
-{
- OptionAssocData *list = clientData;
-
- while (list != NULL) {
- register OptionAssocData *ptr = list;
-
- list = list->nextPtr;
- ckfree((char *) ptr);
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * Tk_CreatePhotoOption --
- *
- * This function may be invoked to add a new kind of photo option to the
- * core photo command supported by Tk.
- *
- * Results:
- * None.
- *
- * Side effects:
- * From now on, the new option will be useable by the photo command.
- *
- *--------------------------------------------------------------
- */
-
-MODULE_SCOPE void
-Tk_CreatePhotoOption(
- Tcl_Interp *interp, /* Interpreter. */
- const char *name, /* Option name. */
- Tcl_ObjCmdProc *proc) /* Function to execute command. */
-{
- OptionAssocData *typePtr2, *prevPtr, *ptr;
- OptionAssocData *list = Tcl_GetAssocData(interp, "photoOption", NULL);
-
- /*
- * If there's already a photo option with the given name, remove it.
- */
-
- for (typePtr2 = list, prevPtr = NULL; typePtr2 != NULL;
- prevPtr = typePtr2, typePtr2 = typePtr2->nextPtr) {
- if (strcmp(typePtr2->name, name) == 0) {
- if (prevPtr == NULL) {
- list = typePtr2->nextPtr;
- } else {
- prevPtr->nextPtr = typePtr2->nextPtr;
- }
- ckfree((char *) typePtr2);
- break;
- }
- }
- ptr = (OptionAssocData *) ckalloc(sizeof(OptionAssocData) + strlen(name));
- strcpy(&(ptr->name[0]), name);
- ptr->command = proc;
- ptr->nextPtr = list;
- Tcl_SetAssocData(interp, "photoOption", PhotoOptionCleanupProc, ptr);
-}
-
-/*
*--------------------------------------------------------------
*
* TkPostscriptPhoto --
diff --git a/generic/tkObj.c b/generic/tkObj.c
index e78d7d2..d51b28f 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.27 2009/12/15 18:12:07 dgp Exp $
+ * RCS: @(#) $Id: tkObj.c,v 1.28 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "tkInt.h"
@@ -155,7 +155,7 @@ GetPixelsFromObjEx(
int result,fresh;
double d;
PixelRep *pixelPtr;
- static double bias[] = {
+ static const double bias[] = {
1.0, 10.0, 25.4, 0.35278 /*25.4 / 72.0*/
};
@@ -482,7 +482,7 @@ Tk_GetMMFromObj(
int result;
double d;
MMRep *mmPtr;
- static double bias[] = {
+ static const double bias[] = {
10.0, 25.4, 1.0, 0.35278 /*25.4 / 72.0*/
};
diff --git a/generic/tkOption.c b/generic/tkOption.c
index 19394d1..d3242fd 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.29 2009/02/03 23:55:47 nijtmans Exp $
+ * RCS: @(#) $Id: tkOption.c,v 1.30 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "tkInt.h"
@@ -525,11 +525,12 @@ Tk_GetOption(
Tk_Uid nodeId, winClassId, winNameId;
unsigned int classNameLength;
register Element *nodePtr, *leafPtr;
- static int searchOrder[] = {
+ static const int searchOrder[] = {
EXACT_NODE_NAME, WILDCARD_NODE_NAME, EXACT_NODE_CLASS,
WILDCARD_NODE_CLASS, -1
};
- int *currentPtr, currentStack, leafCount;
+ const int *currentPtr;
+ int currentStack, leafCount;
/*
* Extract the masquerade class name from the name field.
@@ -1228,7 +1229,8 @@ SetupStacks(
* being probed. Zero means this is an
* ancestor of the desired leaf. */
{
- int level, i, *iPtr;
+ int level, i;
+ const int *iPtr;
register StackLevel *levelPtr;
register ElArray *arrayPtr;
ThreadSpecificData *tsdPtr =
@@ -1243,7 +1245,7 @@ SetupStacks(
* differently.
*/
- static int searchOrder[] = {WILDCARD_NODE_CLASS, WILDCARD_NODE_NAME,
+ static const int searchOrder[] = {WILDCARD_NODE_CLASS, WILDCARD_NODE_NAME,
EXACT_NODE_CLASS, EXACT_NODE_NAME, -1};
if (winPtr->mainPtr->optionRootPtr == NULL) {
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 046555c..adf2f2b 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.40 2010/01/18 20:43:38 nijtmans Exp $
+ * RCS: @(#) $Id: tkPanedWindow.c,v 1.41 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "default.h"
@@ -2316,22 +2316,22 @@ GetSticky(
* sticky value. */
{
int sticky = *(int *)(recordPtr + internalOffset);
- static char buffer[5];
- int count = 0;
+ char buffer[5];
+ char *p = &buffer[0];
if (sticky & STICK_NORTH) {
- buffer[count++] = 'n';
+ *p++ = 'n';
}
if (sticky & STICK_EAST) {
- buffer[count++] = 'e';
+ *p++ = 'e';
}
if (sticky & STICK_SOUTH) {
- buffer[count++] = 's';
+ *p++ = 's';
}
if (sticky & STICK_WEST) {
- buffer[count++] = 'w';
+ *p++ = 'w';
}
- buffer[count] = '\0';
+ *p = '\0';
return Tcl_NewStringObj(buffer, -1);
}
diff --git a/generic/tkPointer.c b/generic/tkPointer.c
index dc97f33..f107f53 100644
--- a/generic/tkPointer.c
+++ b/generic/tkPointer.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: tkPointer.c,v 1.13 2010/01/02 22:52:38 dkf Exp $
+ * RCS: @(#) $Id: tkPointer.c,v 1.14 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "tkInt.h"
@@ -32,7 +32,7 @@
#define ALL_BUTTONS \
(Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
-static unsigned int buttonMasks[] = {
+static const unsigned int buttonMasks[] = {
Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask
};
#define ButtonMask(b) (buttonMasks[(b)-Button1])
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 9a26d69..877a667 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.109 2010/02/05 22:45:03 nijtmans Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.110 2010/02/13 13:47:49 nijtmans Exp $
*/
#include "tkInt.h"
@@ -108,7 +108,7 @@ typedef struct {
* clientData to command function. */
} TkCmd;
-static TkCmd commands[] = {
+static const TkCmd commands[] = {
/*
* Commands that are part of the intrinsics:
*/
@@ -218,7 +218,7 @@ static char *use = NULL;
static char *visual = NULL;
static int rest = 0;
-static Tk_ArgvInfo argTable[] = {
+static const Tk_ArgvInfo argTable[] = {
{"-colormap", TK_ARGV_STRING, NULL, (char *) &colormap,
"Colormap for main window"},
{"-display", TK_ARGV_STRING, NULL, (char *) &display,
@@ -865,7 +865,7 @@ TkCreateMainWindow(
Tcl_HashEntry *hPtr;
register TkMainInfo *mainPtr;
register TkWindow *winPtr;
- register TkCmd *cmdPtr;
+ register const TkCmd *cmdPtr;
ClientData clientData;
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -1511,7 +1511,7 @@ Tk_DestroyWindow(
}
winPtr->mainPtr->refCount--;
if (winPtr->mainPtr->refCount == 0) {
- register TkCmd *cmdPtr;
+ register const TkCmd *cmdPtr;
/*
* We just deleted the last window in the application. Delete the