From d015e4d8b48ad76acce178827f3ab114c330308c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 10 Feb 2014 11:06:19 +0000 Subject: Eliminate all usage of __WIN32__ macro: Some compilers (e.g. Clang/LLVM) don't define it, and _WIN32 is much more portable anyway. See: [http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system#WindowsCygwinnonPOSIXandMinGW] --- generic/default.h | 3 +-- generic/tk.h | 2 +- generic/tkBind.c | 4 ++-- generic/tkCmds.c | 4 ++-- generic/tkColor.c | 4 ++-- generic/tkConsole.c | 2 +- generic/tkGrab.c | 4 ++-- generic/tkImgPhInstance.c | 20 ++++++++++---------- generic/tkImgPhoto.h | 2 +- generic/tkInt.h | 4 ++-- generic/tkIntDecls.h | 14 +++++++------- generic/tkIntPlatDecls.h | 12 ++++++------ generic/tkIntXlibDecls.h | 6 +++--- generic/tkMain.c | 8 ++++---- generic/tkPlatDecls.h | 6 +++--- generic/tkPointer.c | 2 +- generic/tkRectOval.c | 4 ++-- generic/tkSelect.c | 2 +- generic/tkStubInit.c | 30 +++++++++++++++--------------- generic/tkStubLib.c | 4 ++-- generic/tkTest.c | 24 ++++++++++++------------ generic/tkTextDisp.c | 2 +- generic/tkWindow.c | 22 +++++++++++----------- generic/ttk/ttkGenStubs.tcl | 9 ++++----- generic/ttk/ttkWidget.h | 2 +- unix/tkUnix3d.c | 2 +- unix/tkUnixDraw.c | 2 +- win/configure | 4 ++-- win/makefile.bc | 2 +- win/tcl.m4 | 4 ++-- 30 files changed, 104 insertions(+), 106 deletions(-) diff --git a/generic/default.h b/generic/default.h index 6156f4d..e6ef132 100644 --- a/generic/default.h +++ b/generic/default.h @@ -14,8 +14,7 @@ #ifndef _DEFAULT #define _DEFAULT -#if defined(__WIN32__) || defined(_WIN32) || \ - defined(__MINGW32__) +#ifdef _WIN32 # include "tkWinDefault.h" #else # if defined(MAC_OSX_TK) diff --git a/generic/tk.h b/generic/tk.h index 088f4be..8f03b54 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -1496,7 +1496,7 @@ typedef struct Tk_ElementSpec { #define Tk_Release Tcl_Release /* Removed Tk_Main, use macro instead */ -#if defined(__WIN32__) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) #define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ (Tcl_FindExecutable(0), (Tcl_CreateInterp)())) #else diff --git a/generic/tkBind.c b/generic/tkBind.c index ff308ed..fbac56d 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -14,11 +14,11 @@ #include "tkInt.h" -#ifdef __WIN32__ +#ifdef _WIN32 #include "tkWinInt.h" #endif -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* UNIX */ +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* UNIX */ #include "tkUnixInt.h" #endif diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 4933d34..23fad0f 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -49,7 +49,7 @@ static int WindowingsystemCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); -#if defined(__WIN32__) || defined(MAC_OSX_TK) +#if defined(_WIN32) || defined(MAC_OSX_TK) MODULE_SCOPE const TkEnsemble tkFontchooserEnsemble[]; #else #define tkFontchooserEnsemble NULL @@ -649,7 +649,7 @@ TkInitTkCmd( ClientData clientData) { TkMakeEnsemble(interp, "::", "tk", clientData, tkCmdMap); -#if defined(__WIN32__) || defined(MAC_OSX_TK) +#if defined(_WIN32) || defined(MAC_OSX_TK) TkInitFontchooser(interp, clientData); #endif return TCL_OK; diff --git a/generic/tkColor.c b/generic/tkColor.c index e4fa3f7..9abb448 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -829,7 +829,7 @@ TkDebugColor( return resultPtr; } -#ifndef __WIN32__ +#ifndef _WIN32 /* This function is not necessary for Win32, * since XParseColor already does the right thing */ @@ -937,7 +937,7 @@ TkParseColor( done: return XParseColor(display, map, name, color); } -#endif /* __WIN32__ */ +#endif /* _WIN32 */ /* * Local Variables: * mode: c diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 12e9353..8bfbe9b 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -84,7 +84,7 @@ static const Tcl_ChannelType consoleChannelType = { NULL }; -#ifdef __WIN32__ +#ifdef _WIN32 #include /* diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 2df5552..00d4511 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -12,9 +12,9 @@ #include "tkInt.h" -#ifdef __WIN32__ +#ifdef _WIN32 #include "tkWinInt.h" -#elif !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#elif !defined(MAC_OSX_TK) #include "tkUnixInt.h" #endif diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index 01f11bb..666a9b0 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -407,7 +407,7 @@ TkImgPhotoGet( *---------------------------------------------------------------------- */ -#ifndef __WIN32__ +#ifndef _WIN32 #define GetRValue(rgb) (UCHAR(((rgb) & red_mask) >> red_shift)) #define GetGValue(rgb) (UCHAR(((rgb) & green_mask) >> green_shift)) #define GetBValue(rgb) (UCHAR(((rgb) & blue_mask) >> blue_shift)) @@ -419,7 +419,7 @@ TkImgPhotoGet( (((r) * red_mask / 255) & red_mask) | \ (((g) * green_mask / 255) & green_mask) | \ (((b) * blue_mask / 255) & blue_mask) )) -#endif /* !__WIN32__ */ +#endif /* !_WIN32 */ static void BlendComplexAlpha( @@ -453,7 +453,7 @@ BlendComplexAlpha( * might be cached for better performance. */ -#ifndef __WIN32__ +#ifndef _WIN32 unsigned long red_mask, green_mask, blue_mask; unsigned long red_shift, green_shift, blue_shift; Visual *visual = iPtr->visualInfo.visual; @@ -473,7 +473,7 @@ BlendComplexAlpha( while ((0x0001 & (blue_mask >> blue_shift)) == 0) { blue_shift++; } -#endif /* !__WIN32__ */ +#endif /* !_WIN32 */ /* * Only UNIX requires the special case for <24bpp. It varies with 3 extra @@ -481,7 +481,7 @@ BlendComplexAlpha( * optimized. */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) if (bgImg->depth < 24) { unsigned char red_mlen, green_mlen, blue_mlen; @@ -529,7 +529,7 @@ BlendComplexAlpha( } return; } -#endif /* !__WIN32__ && !MAC_OSX_TK */ +#endif /* !_WIN32 && !MAC_OSX_TK */ for (y = 0; y < height; y++) { line = (y + yOffset) * iPtr->masterPtr->width; @@ -1336,12 +1336,12 @@ AllocateColors( * since we will be passing the color table into the TkPutImage call. */ -#ifndef __WIN32__ +#ifndef _WIN32 if ((colorPtr->visualInfo.class != DirectColor) && (colorPtr->visualInfo.class != TrueColor)) { colorPtr->flags |= MAP_COLORS; } -#endif /* __WIN32__ */ +#endif /* _WIN32 */ } colorPtr->numColors = numColors; @@ -1770,7 +1770,7 @@ TkImgDitherInstance( case NBBY: *destBytePtr++ = i; break; -#ifndef __WIN32__ +#ifndef _WIN32 /* * This case is not valid for Windows because the * image format is different from the pixel format in @@ -1832,7 +1832,7 @@ TkImgDitherInstance( case NBBY: *destBytePtr++ = i; break; -#ifndef __WIN32__ +#ifndef _WIN32 /* * This case is not valid for Windows because the * image format is different from the pixel format in diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h index 7bef76b..36bc6cb 100644 --- a/generic/tkImgPhoto.h +++ b/generic/tkImgPhoto.h @@ -17,7 +17,7 @@ */ #include "tkInt.h" -#ifdef __WIN32__ +#ifdef _WIN32 #include "tkWinInt.h" #elif defined(__CYGWIN__) #include "tkUnixInt.h" diff --git a/generic/tkInt.h b/generic/tkInt.h index b48647d..b71e9b9 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1216,7 +1216,7 @@ MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp, ClientData clientData); MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr); -#ifdef __WIN32__ +#ifdef _WIN32 #define TkParseColor XParseColor #else MODULE_SCOPE Status TkParseColor (Display * display, @@ -1242,7 +1242,7 @@ MODULE_SCOPE int SquareObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp); -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) #define TkplatformtestInit(x) TCL_OK #else MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp); diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index 3c37922..67a4f4b 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -676,20 +676,20 @@ typedef struct TkIntStubs { void (*tkSetRegion) (Display *display, GC gc, TkRegion rgn); /* 118 */ void (*tkUnionRectWithRegion) (XRectangle *rect, TkRegion src, TkRegion dr_return); /* 119 */ void (*reserved120)(void); -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ void (*reserved121)(void); #endif /* X11 */ -#if defined(__WIN32__) /* WIN */ +#if defined(_WIN32) /* WIN */ void (*reserved121)(void); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ void (*reserved121)(void); /* Dummy entry for stubs table backwards compatibility */ Pixmap (*tkpCreateNativeBitmap) (Display *display, const void *source); /* 121 */ #endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ void (*reserved122)(void); #endif /* X11 */ -#if defined(__WIN32__) /* WIN */ +#if defined(_WIN32) /* WIN */ void (*reserved122)(void); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -697,10 +697,10 @@ typedef struct TkIntStubs { void (*tkpDefineNativeBitmaps) (void); /* 122 */ #endif /* AQUA */ void (*reserved123)(void); -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ void (*reserved124)(void); #endif /* X11 */ -#if defined(__WIN32__) /* WIN */ +#if defined(_WIN32) /* WIN */ void (*reserved124)(void); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -1150,7 +1150,7 @@ extern const TkIntStubs *tkIntStubsPtr; /* * On X11, these macros are just wrappers for the equivalent X Region calls. */ -#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ #undef TkClipBox #undef TkCreateRegion diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 141f743..2fd66c6 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -34,7 +34,7 @@ extern "C" { * Exported function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ /* 0 */ EXTERN char * TkAlignImageData(XImage *image, int alignment, int bitOrder); @@ -256,7 +256,7 @@ EXTERN unsigned long TkpGetMS(void); /* 54 */ EXTERN void * TkMacOSXDrawable(Drawable drawable); #endif /* AQUA */ -#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ /* 0 */ EXTERN void TkCreateXEventSource(void); /* Slot 1 is reserved */ @@ -291,7 +291,7 @@ typedef struct TkIntPlatStubs { int magic; void *hooks; -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ char * (*tkAlignImageData) (XImage *image, int alignment, int bitOrder); /* 0 */ void (*reserved1)(void); void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 2 */ @@ -396,7 +396,7 @@ typedef struct TkIntPlatStubs { unsigned long (*tkpGetMS) (void); /* 53 */ void * (*tkMacOSXDrawable) (Drawable drawable); /* 54 */ #endif /* AQUA */ -#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ void (*tkCreateXEventSource) (void); /* 0 */ void (*reserved1)(void); void (*reserved2)(void); @@ -426,7 +426,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; * Inline function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ #define TkAlignImageData \ (tkIntPlatStubsPtr->tkAlignImageData) /* 0 */ /* Slot 1 is reserved */ @@ -623,7 +623,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; #define TkMacOSXDrawable \ (tkIntPlatStubsPtr->tkMacOSXDrawable) /* 54 */ #endif /* AQUA */ -#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ #define TkCreateXEventSource \ (tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */ /* Slot 1 is reserved */ diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index 8abda05..6ac7ccb 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -44,7 +44,7 @@ extern "C" { * Exported function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ /* 0 */ EXTERN int XSetDashes(Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); @@ -626,7 +626,7 @@ typedef struct TkIntXlibStubs { int magic; void *hooks; -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */ XModifierKeymap * (*xGetModifierMapping) (Display *d); /* 1 */ XImage * (*xCreateImage) (Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4); /* 2 */ @@ -851,7 +851,7 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; * Inline function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ #define XSetDashes \ (tkIntXlibStubsPtr->xSetDashes) /* 0 */ #define XGetModifierMapping \ diff --git a/generic/tkMain.c b/generic/tkMain.c index 9d12693..f6f4013 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -54,7 +54,7 @@ extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *); * platforms which don't have we have to translate that * to strcmp here. */ -#ifdef __WIN32__ +#ifdef _WIN32 # include "tclInt.h" # include "tkWinInt.h" #else @@ -95,7 +95,7 @@ extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *); * it will conflict with a declaration elsewhere on some systems. */ -#if defined(__WIN32__) || defined(_WIN32) +#if defined(_WIN32) #define isatty WinIsTty static int WinIsTty(int fd) { HANDLE handle; @@ -195,7 +195,7 @@ Tk_MainEx( } } -#if defined(__WIN32__) && !defined(UNICODE) && !defined(STATIC_BUILD) +#if defined(_WIN32) && !defined(UNICODE) && !defined(STATIC_BUILD) if (tclStubsPtr->reserved9) { /* We are running win32 Tk under Cygwin, so let's check @@ -226,7 +226,7 @@ Tk_MainEx( is.gotPartial = 0; Tcl_Preserve(interp); -#if defined(__WIN32__) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) Tk_InitConsoleChannels(interp); #endif diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h index 88fa918..1e69c88 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -37,7 +37,7 @@ extern "C" { * Exported function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ /* 0 */ EXTERN Window Tk_AttachHWND(Tk_Window tkwin, HWND hwnd); /* 1 */ @@ -88,7 +88,7 @@ typedef struct TkPlatStubs { int magic; void *hooks; -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ Window (*tk_AttachHWND) (Tk_Window tkwin, HWND hwnd); /* 0 */ HINSTANCE (*tk_GetHINSTANCE) (void); /* 1 */ HWND (*tk_GetHWND) (Window window); /* 2 */ @@ -123,7 +123,7 @@ extern const TkPlatStubs *tkPlatStubsPtr; * Inline function declarations: */ -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ #define Tk_AttachHWND \ (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ #define Tk_GetHINSTANCE \ diff --git a/generic/tkPointer.c b/generic/tkPointer.c index 451373d..0141b64 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -14,7 +14,7 @@ #include "tkInt.h" -#ifdef __WIN32__ +#ifdef _WIN32 #include "tkWinInt.h" #endif diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index a51ca33..50b5f1a 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -671,11 +671,11 @@ ComputeRectOvalBbox( * correct place to solve it, but it works. */ -#ifdef __WIN32__ +#ifdef _WIN32 bloat = 1; #else bloat = 0; -#endif /* __WIN32__ */ +#endif /* _WIN32 */ } else { #ifdef MAC_OSX_TK /* diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 2414b3d..ab9018a 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -1193,7 +1193,7 @@ TkSelInit( * http://www.cl.cam.ac.uk/~mgk25/unicode.html#x11 */ -#if !defined(__WIN32__) +#if !defined(_WIN32) dispPtr->utf8Atom = Tk_InternAtom(tkwin, "UTF8_STRING"); #else dispPtr->utf8Atom = (Atom) 0; diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index d141b02..47288c6 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -11,13 +11,13 @@ #include "tkInt.h" -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* UNIX */ #define UNIX_TK #include "tkUnixInt.h" #endif -#ifdef __WIN32__ +#ifdef _WIN32 #include "tkWinInt.h" #endif @@ -38,7 +38,7 @@ static const TkIntStubs tkIntStubs; #undef Tk_MainEx -#ifdef __WIN32__ +#ifdef _WIN32 int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) @@ -65,7 +65,7 @@ TkCreateXEventSource(void) # define TkSendCleanup (void (*)(TkDisplay *)) TkpSync # define TkpTestsendCmd 0 -#else /* !__WIN32__ */ +#else /* !_WIN32 */ /* * Make sure that extensions which call XParseColor through the stub @@ -224,7 +224,7 @@ void TkSubtractRegion (TkRegion a, TkRegion b, TkRegion c) # define TkUnionRectWithRegion (void (*) (XRectangle *, TkRegion, TkRegion)) XUnionRectWithRegion # define TkSubtractRegion (void (*) (TkRegion, TkRegion, TkRegion)) XSubtractRegion # endif -#endif /* !__WIN32__ */ +#endif /* !_WIN32 */ /* * WARNING: The contents of this file is automatically generated by the @@ -358,20 +358,20 @@ static const TkIntStubs tkIntStubs = { TkSetRegion, /* 118 */ TkUnionRectWithRegion, /* 119 */ 0, /* 120 */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ 0, /* 121 */ #endif /* X11 */ -#if defined(__WIN32__) /* WIN */ +#if defined(_WIN32) /* WIN */ 0, /* 121 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ 0, /* 121 */ /* Dummy entry for stubs table backwards compatibility */ TkpCreateNativeBitmap, /* 121 */ #endif /* AQUA */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ 0, /* 122 */ #endif /* X11 */ -#if defined(__WIN32__) /* WIN */ +#if defined(_WIN32) /* WIN */ 0, /* 122 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -379,10 +379,10 @@ static const TkIntStubs tkIntStubs = { TkpDefineNativeBitmaps, /* 122 */ #endif /* AQUA */ 0, /* 123 */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ 0, /* 124 */ #endif /* X11 */ -#if defined(__WIN32__) /* WIN */ +#if defined(_WIN32) /* WIN */ 0, /* 124 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ @@ -454,7 +454,7 @@ static const TkIntStubs tkIntStubs = { static const TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, 0, -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ TkAlignImageData, /* 0 */ 0, /* 1 */ TkGenerateActivateEvents, /* 2 */ @@ -559,7 +559,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkpGetMS, /* 53 */ TkMacOSXDrawable, /* 54 */ #endif /* AQUA */ -#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ +#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ TkCreateXEventSource, /* 0 */ 0, /* 1 */ 0, /* 2 */ @@ -580,7 +580,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { static const TkIntXlibStubs tkIntXlibStubs = { TCL_STUB_MAGIC, 0, -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ @@ -796,7 +796,7 @@ static const TkIntXlibStubs tkIntXlibStubs = { static const TkPlatStubs tkPlatStubs = { TCL_STUB_MAGIC, 0, -#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ Tk_AttachHWND, /* 0 */ Tk_GetHINSTANCE, /* 1 */ Tk_GetHWND, /* 2 */ diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c index fe30f26..ea48894 100644 --- a/generic/tkStubLib.c +++ b/generic/tkStubLib.c @@ -13,7 +13,7 @@ #include "tkInt.h" -#ifdef __WIN32__ +#ifdef _WIN32 #include "tkWinInt.h" #endif @@ -21,7 +21,7 @@ #include "tkMacOSXInt.h" #endif -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) #include "tkUnixInt.h" #endif diff --git a/generic/tkTest.c b/generic/tkTest.c index 8146c69..562b2c8 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -24,7 +24,7 @@ #include "tkInt.h" #include "tkText.h" -#ifdef __WIN32__ +#ifdef _WIN32 #include "tkWinInt.h" #endif @@ -160,11 +160,11 @@ static int TestfontObjCmd(ClientData dummy, Tcl_Obj *const objv[]); static int TestmakeexistCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); -#if !(defined(__WIN32__) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) +#if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestmenubarCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); #endif -#if defined(__WIN32__) || defined(MAC_OSX_TK) +#if defined(_WIN32) || defined(MAC_OSX_TK) static int TestmetricsCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); #endif @@ -186,7 +186,7 @@ static void CustomOptionFree(ClientData clientData, Tk_Window tkwin, char *internalPtr); static int TestpropCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); -#if !(defined(__WIN32__) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) +#if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestwrapperCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); #endif @@ -259,7 +259,7 @@ Tktest_Init( Tcl_CreateCommand(interp, "testtext", TkpTesttextCmd, (ClientData) Tk_MainWindow(interp), NULL); -#if defined(__WIN32__) || defined(MAC_OSX_TK) +#if defined(_WIN32) || defined(MAC_OSX_TK) Tcl_CreateCommand(interp, "testmetrics", TestmetricsCmd, (ClientData) Tk_MainWindow(interp), NULL); #elif !defined(__CYGWIN__) @@ -269,7 +269,7 @@ Tktest_Init( (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateCommand(interp, "testwrapper", TestwrapperCmd, (ClientData) Tk_MainWindow(interp), NULL); -#endif /* __WIN32__ || MAC_OSX_TK */ +#endif /* _WIN32 || MAC_OSX_TK */ /* * Create test image type. @@ -1693,7 +1693,7 @@ TestmakeexistCmd( */ /* ARGSUSED */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) +#if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestmenubarCmd( ClientData clientData, /* Main window for application. */ @@ -1761,7 +1761,7 @@ TestmenubarCmd( *---------------------------------------------------------------------- */ -#if defined(__WIN32__) || defined(MAC_OSX_TK) +#if defined(_WIN32) || defined(MAC_OSX_TK) static int TestmetricsCmd( ClientData clientData, /* Main window for application. */ @@ -1772,7 +1772,7 @@ TestmetricsCmd( char buf[TCL_INTEGER_SPACE]; int val; -#ifdef __WIN32__ +#ifdef _WIN32 if (argc < 2) { Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0], " option ?arg ...?\"", NULL); @@ -1795,13 +1795,13 @@ TestmetricsCmd( #endif if (strcmp(argv[1], "cyvscroll") == 0) { -#ifdef __WIN32__ +#ifdef _WIN32 val = GetSystemMetrics(SM_CYVSCROLL); #else val = ((TkScrollbar *) winPtr->instanceData)->width; #endif } else if (strcmp(argv[1], "cxhscroll") == 0) { -#ifdef __WIN32__ +#ifdef _WIN32 val = GetSystemMetrics(SM_CXHSCROLL); #else val = ((TkScrollbar *) winPtr->instanceData)->width; @@ -1895,7 +1895,7 @@ TestpropCmd( return TCL_OK; } -#if !(defined(__WIN32__) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) +#if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) /* *---------------------------------------------------------------------- * diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 5bd69a3..aebdcc6 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -16,7 +16,7 @@ #include "tkInt.h" #include "tkText.h" -#ifdef __WIN32__ +#ifdef _WIN32 #include "tkWinInt.h" #elif defined(__CYGWIN__) #include "tkUnixInt.h" diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 6f5ee95..4a65db7 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -14,7 +14,7 @@ #include "tkInt.h" -#ifdef __WIN32__ +#ifdef _WIN32 #include "tkWinInt.h" #elif !defined(MAC_OSX_TK) #include "tkUnixInt.h" @@ -189,7 +189,7 @@ static const TkCmd commands[] = { * these commands differently (via the script library). */ -#if defined(__WIN32__) || defined(MAC_OSX_TK) +#if defined(_WIN32) || defined(MAC_OSX_TK) {"tk_chooseColor", Tk_ChooseColorObjCmd, PASSMAINWINDOW}, {"tk_chooseDirectory", Tk_ChooseDirectoryObjCmd,WINMACONLY|PASSMAINWINDOW}, {"tk_getOpenFile", Tk_GetOpenFileObjCmd, WINMACONLY|PASSMAINWINDOW}, @@ -959,7 +959,7 @@ TkCreateMainWindow( Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs"); } -#if defined(__WIN32__) && !defined(STATIC_BUILD) +#if defined(_WIN32) && !defined(STATIC_BUILD) if ((cmdPtr->flags & WINMACONLY) && tclStubsPtr->reserved9) { /* * We are running on Cygwin, so don't use the win32 dialogs. @@ -967,7 +967,7 @@ TkCreateMainWindow( continue; } -#endif /* __WIN32__ && !STATIC_BUILD */ +#endif /* _WIN32 && !STATIC_BUILD */ if (cmdPtr->flags & PASSMAINWINDOW) { clientData = tkwin; @@ -1466,7 +1466,7 @@ Tk_DestroyWindow( TkWmRemoveFromColormapWindows(winPtr); } if (winPtr->window != None) { -#if defined(MAC_OSX_TK) || defined(__WIN32__) +#if defined(MAC_OSX_TK) || defined(_WIN32) XDestroyWindow(winPtr->display, winPtr->window); #else if ((winPtr->flags & TK_TOP_HIERARCHY) @@ -2851,7 +2851,7 @@ DeleteWindowsExitProc( tsdPtr->initialized = 0; } -#if defined(__WIN32__) +#if defined(_WIN32) static HMODULE tkcygwindll = NULL; @@ -2897,7 +2897,7 @@ TkCygwinMainEx( tkmainex(argc, argv, appInitProc, interp); return 1; } -#endif /* __WIN32__ */ +#endif /* _WIN32 */ /* *---------------------------------------------------------------------- @@ -2926,7 +2926,7 @@ int Tk_Init( Tcl_Interp *interp) /* Interpreter to initialize. */ { -#if defined(__WIN32__) +#if defined(_WIN32) if (tkcygwindll) { int (*tkinit)(Tcl_Interp *); @@ -2935,7 +2935,7 @@ Tk_Init( return tkinit(interp); } } -#endif /* __WIN32__ */ +#endif /* _WIN32 */ return Initialize(interp); } @@ -2999,7 +2999,7 @@ Tk_SafeInit( * checked at several places to differentiate the two initialisations. */ -#if defined(__WIN32__) +#if defined(_WIN32) if (tkcygwindll) { int (*tksafeinit)(Tcl_Interp *); @@ -3009,7 +3009,7 @@ Tk_SafeInit( return tksafeinit(interp); } } -#endif /* __WIN32__ */ +#endif /* _WIN32 */ return Initialize(interp); } diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl index 5e56951..034f405 100644 --- a/generic/ttk/ttkGenStubs.tcl +++ b/generic/ttk/ttkGenStubs.tcl @@ -290,14 +290,14 @@ proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} { set text "" switch $plat { win { - append text "#ifdef __WIN32__ /* WIN */\n${iftxt}" + append text "#ifdef _WIN32 /* WIN */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* WIN */\n${eltxt}" } append text "#endif /* WIN */\n" } unix { - append text "#if !defined(__WIN32__) && !defined(MAC_OSX_TCL)\ + append text "#if !defined(_WIN32) && !defined(MAC_OSX_TCL)\ /* UNIX */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* UNIX */\n${eltxt}" @@ -319,7 +319,7 @@ proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} { append text "#endif /* AQUA */\n" } x11 { - append text "#if !(defined(__WIN32__) || defined(MAC_OSX_TK))\ + append text "#if !(defined(_WIN32) || defined(MAC_OSX_TK))\ /* X11 */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* X11 */\n${eltxt}" @@ -822,10 +822,9 @@ proc genStubs::emitInit {name textVar} { variable hooks variable interfaces variable epoch - variable revision upvar $textVar text - set root 1 + set capName [string toupper [string index $name 0]] append capName [string range $name 1 end] diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h index 9e9ab69..e4dd712 100644 --- a/generic/ttk/ttkWidget.h +++ b/generic/ttk/ttkWidget.h @@ -260,7 +260,7 @@ MODULE_SCOPE int TtkGetLabelAnchorFromObj( * Platform-specific initialization. */ -#if defined(__WIN32__) +#ifdef _WIN32 #define Ttk_PlatformInit Ttk_WinPlatformInit MODULE_SCOPE int Ttk_PlatformInit(Tcl_Interp *); #elif defined(MAC_OSX_TK) diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c index 38ce683..038d4e1 100644 --- a/unix/tkUnix3d.c +++ b/unix/tkUnix3d.c @@ -13,7 +13,7 @@ #include "tkInt.h" #include "tk3d.h" -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) +#if !(defined(_WIN32) || defined(MAC_OSX_TK)) #include "tkUnixInt.h" #endif diff --git a/unix/tkUnixDraw.c b/unix/tkUnixDraw.c index 55f7464..acc0565 100644 --- a/unix/tkUnixDraw.c +++ b/unix/tkUnixDraw.c @@ -11,7 +11,7 @@ #include "tkInt.h" -#if !defined(__WIN32__) +#ifndef _WIN32 #include "tkUnixInt.h" #endif diff --git a/win/configure b/win/configure index 7ce097f..299be69 100755 --- a/win/configure +++ b/win/configure @@ -3489,7 +3489,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #ifndef __WIN32__ + #ifndef _WIN32 #error cross-compiler #endif @@ -3612,7 +3612,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #ifdef __WIN32__ + #ifdef _WIN32 #error win32 #endif diff --git a/win/makefile.bc b/win/makefile.bc index 8738da9..934599c 100644 --- a/win/makefile.bc +++ b/win/makefile.bc @@ -243,7 +243,7 @@ RCDIR = $(WINDIR)\rc TK_INCLUDES = -I$(WINDIR) -I$(GENERICDIR) -I$(BITMAPDIR) -I$(XLIBDIR) \ -I$(TCLDIR)\generic -I$(TCLDIR)\win -TK_DEFINES = -D__WIN32__ $(DEBUGDEFINES) $(THREADDEFINES) SUPPORT_CONFIG_EMBEDDED +TK_DEFINES = -D_WIN32 $(DEBUGDEFINES) $(THREADDEFINES) SUPPORT_CONFIG_EMBEDDED ###################################################################### # Compile flags diff --git a/win/tcl.m4 b/win/tcl.m4 index 625c329..d12ae10 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -572,7 +572,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ AC_CACHE_CHECK(for cross-compile version of gcc, ac_cv_cross, AC_TRY_COMPILE([ - #ifndef __WIN32__ + #ifndef _WIN32 #error cross-compiler #endif ], [], @@ -639,7 +639,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ AC_CACHE_CHECK(for mingw32 version of gcc, ac_cv_win32, AC_TRY_COMPILE([ - #ifdef __WIN32__ + #ifdef _WIN32 #error win32 #endif ], [], -- cgit v0.12