OSDN Git Service

Adapt platform feature checks to NTDDI_VERSION conventions.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Tue, 14 Jul 2015 21:01:58 +0000 (22:01 +0100)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Tue, 14 Jul 2015 21:01:58 +0000 (22:01 +0100)
mingwrt/ChangeLog
mingwrt/include/_mingw.h
w32api/ChangeLog
w32api/include/sdkddkver.h [new file with mode: 0644]
w32api/include/w32api.h
w32api/include/windef.h

index b7f0899..0d2cd83 100644 (file)
@@ -1,5 +1,14 @@
 2015-07-14  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
+       Adapt platform feature checks to NTDDI_VERSION conventions.
+
+       * include/_mingw.h: Assert copyright; include w32api.h
+       (UNICODE, _UNICODE): Factor out consistency checks; relocate them
+       to w32api/include/w32api.h, whence they remain in effect.
+       (_EXTERN_C, _BEGIN_C_DECLS, _END_C_DECLS): Likewise.
+
+2015-07-14  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
        Correct mismatched #if/#endif from preceding commit.
 
        * include/_mingw.h (#pragma GCC system_header)
index 9701b5c..154e858 100644 (file)
@@ -2,22 +2,33 @@
 /*
  * _mingw.h
  *
- * Mingw specific macros included by ALL include files.
+ * MinGW specific macros included by ALL mingwrt include files; (this file
+ * is part of the MinGW32 runtime library package).
  *
- * This file is part of the Mingw32 package.
+ * $Id$
  *
- * Contributors:
- *  Created by Mumit Khan  <khan@xraylith.wisc.edu>
+ * Written by Mumit Khan  <khan@xraylith.wisc.edu>
+ * Copyright (C) 1999, 2001-2011, 2014, 2015, MinGW.org Project
  *
- *  THIS SOFTWARE IS NOT COPYRIGHTED
  *
- *  This source code is offered for use in the public domain. You may
- *  use, modify or distribute it freely.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
  *
- *  This code is distributed in the hope that it will be useful but
- *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- *  DISCLAIMED. This includes but is not limited to warranties of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
  *
  */
 #define __MINGW_H
 # include <msvcrtver.h>
 #endif
 
+/* A better inference than __MSVCRT_VERSION__, of the capabilities
+ * supported by the operating system default MSVCRT.DLL, is provided
+ * by the Windows API version identification macros.
+ */
+#include <w32api.h>
+
 /* The following are defined by the user (or by the compiler), to specify how
  * identifiers are imported from a DLL.  All headers should include this first,
  * and then use __DECLSPEC_SUPPORTED to choose between the old ``__imp__name''
  * __MINGW_IMPORT                  The attribute definition to specify imported
  *                                 variables/functions.
  * _CRTIMP                         As above.  For MS compatibility.
- * __MINGW32_VERSION               Runtime version.
- * __MINGW32_MAJOR_VERSION         Runtime major version.
- * __MINGW32_MINOR_VERSION         Runtime minor version.
- * __MINGW32_BUILD_DATE            Runtime build date.
  *
  * Macros to enable MinGW features which deviate from standard MSVC
  * compatible behaviour; these may be specified directly in user code,
 #endif
 
 #ifdef __cplusplus
-# define _EXTERN_C       extern "C"
-# define _BEGIN_C_DECLS  extern "C" {
-# define _END_C_DECLS    }
-
 # define __CRT_INLINE    inline
-
 #else
-# define _EXTERN_C       extern
-# define _BEGIN_C_DECLS
-# define _END_C_DECLS
-
 # if __GNUC_STDC_INLINE__
 #  define __CRT_INLINE   extern inline __attribute__((__gnu_inline__))
 # else
@@ -429,30 +433,4 @@ allow GCC to optimize away some EH unwind code, at least in DW2 case.  */
 # endif
 #endif
 
-
-/* Only Microsoft could attempt to justify this insanity: when building
- * a UTF-16LE application -- apparently their understanding of Unicode is
- * limited to this -- the C/C++ runtime requires that the user must define
- * the _UNICODE macro, while to use the Windows API's UTF-16LE capabilities,
- * it is the UNICODE macro, (without the leading underscore), which must be
- * defined.  The (bogus) explanation appears to be that it is the C standard
- * which dictates the requirement for the leading underscore, to avoid any
- * possible conflict with a user defined symbol; (bogus because the macro
- * must be user defined anyway -- it is not a private symbol -- and in
- * any case, the Windows API already reserves the UNICODE symbol as
- * a user defined macro, with equivalent intent.
- *
- * The real explanation, of course, is that this is just another example
- * of Microsoft irrationality; in any event, there seems to be no sane
- * scenario in which defining one without the other would be required,
- * or indeed would not raise potential for internal inconsistency, so we
- * ensure that either both are, or neither is defined.
- */
-#if defined UNICODE && ! defined _UNICODE
-# define _UNICODE  UNICODE
-#endif
-#if defined _UNICODE && ! defined UNICODE
-# define UNICODE  _UNICODE
-#endif
-
-#endif /* __MINGW_H */
+#endif /* __MINGW_H: $RCSfile$: end of file */
index 15404cb..c74301d 100644 (file)
@@ -1,3 +1,31 @@
+2015-07-14  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Adapt platform feature checks to NTDDI_VERSION conventions.
+
+       * include/sdkddkver.h: New file; merge from 4.0-dev branch.
+       (_WIN32_WINNT_WINBLUE): New manifest constant for Windows-8.1.
+       (WINNTVER): Prefer bitwise shift to division; adjust accordingly.
+       [_WIN32_WINNT != OSVER(NTDDI_VERSION)]: Bad comparison; correct to...
+       [_WIN32_WINNT != WINNTVER(NTDDI_VERSION)]: ...this.
+
+       * include/w32api.h: Assert copyright; include sdkddkver.h.
+       (__W32API_VERSION): Increment to 3.18; adopt new encoding format.
+       (__W32API_MAJOR_VERSION, __W32API_MINOR_VERSION): Adjust consistently.
+       (__W32API_PATCH_LEVEL): New macro; define with initial value of zero.
+       (__W32API_DEPRECATED_ALIAS): New macro; define it; use to redefine...
+       (Windows95, Windows98, WindowsME, WindowsNT4, Windows2000, WindowsXP)
+       (Windows2003, WindowsVista, IE3, IE301, IE302, IE4, IE401, IE5, IE5a)
+       (IE5b, IE501, IE55, IE56, IE6, IE601, IE602, IE7): ...these; replace
+       macro definitions by long integer constants, and mark as deprecated.
+       (UNICODE, _UNICODE): Keep these consistent; use logic factored out of
+       mingwrt/include/_mingw.h, whence we similarly relocate...
+       (_EXTERN_C, _BEGIN_C_DECLS, _END_C_DECLS): ...these.
+
+       * include/windef.h: Assert copyright; include w32api.h, whence we
+       infer default assignments, per included sdkddkver.h, for each of...
+       (WINVER, _WIN32_WINNT): ...these; delete local defines.
+       (_BEGIN_C_DECLS, _END_C_DECLS): Use them.
+
 2015-06-16  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Remove generated configure script from revision control.
diff --git a/w32api/include/sdkddkver.h b/w32api/include/sdkddkver.h
new file mode 100644 (file)
index 0000000..139e369
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * sdkddkver.h
+ *
+ * Macros to set up the compilation environment, such that it provides
+ * support for a user specified host OS version, (default Win2K).
+ *
+ * $Id$
+ *
+ * Written by Earnie Boyd  <earnie@users.sourceforge.net>
+ * Copyright (C) 2012, 2013, 2015, MinGW.org Project
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+#ifndef _SDKDDKVER_H
+#define _SDKDDKVER_H
+#pragma GCC system_header
+
+/* Define masks for extracting version components from NTDDI_VERSION;
+ * values and names are guessed based on comments in the documentation; see
+ * http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx
+ */
+#define OSVERSION_MASK         0xFFFF0000
+#define SPVERSION_MASK         0x0000FF00
+#define SUBVERSION_MASK        0x000000FF
+
+/* Macros to facilitate such extraction; derived from comments on MSDN or
+ * on social.microsoft.com
+ */
+#define OSVER(ver)             ((ver) & OSVERSION_MASK)
+#define SPVER(ver)             (((ver) & SPVERSION_MASK) >> 8)
+#define SUBVER(ver)            ((ver) & SUBVERSION_MASK)
+#define WINNTVER(ver)          ((ver) >> 16)
+
+/* Macros to construct a minimal NTDDI_VERSION from a _WIN32_WINNT value.
+ */
+#define NTDDI_VERSION_FROM_WIN32_WINNT(ver) _NTDDI_VERSION_FROM_WIN32_WINNT(ver)
+#define _NTDDI_VERSION_FROM_WIN32_WINNT(ver) ver##0000
+
+/* Version constants specifying _WIN32_WINNT versions; these are defined at
+ * http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx
+ * (values for legacy platforms have been inferred from historical knowledge).
+ */
+#define _WIN32_WINNT_NT4       0x0400          /* Windows NT4 */
+#define _WIN32_WINNT_NT4E      0x0401          /* Windows NT4E */
+#define _WIN32_WINDOWS_95      0x0400          /* Windows 95 */
+#define _WIN32_WINDOWS_98      0x0410          /* Windows 98 */
+#define _WIN32_WINDOWS_ME      0x0490          /* Windows Millenium Edition */
+#define _WIN32_WINNT_WIN2K     0x0500          /* Windows 2000 */
+#define _WIN32_WINNT_WINXP     0x0501          /* Windows XP */
+#define _WIN32_WINNT_WS03      0x0502          /* Windows Server 2003 */
+#define _WIN32_WINNT_WIN6      0x0600          /* Alias for Windows Vista */
+#define _WIN32_WINNT_VISTA     0x0600          /* Windows Vista */
+#define _WIN32_WINNT_WS08      0x0600          /* Windows Server 2008 */
+#define _WIN32_WINNT_LONGHORN  0x0600          /* Alias for Windows Vista */
+#define _WIN32_WINNT_WIN7      0x0601          /* Windows 7 */
+#define _WIN32_WINNT_WIN8      0x0602          /* Windows 8 */
+#define _WIN32_WINNT_WINBLUE   0x0603          /* Windows 8.1 */
+
+/* Version constants specifying Internet Explorer versions; also defined at
+ * http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx
+ */
+#define _WIN32_IE_IE50         0x0500
+#define _WIN32_IE_IE501        0x0501
+#define _WIN32_IE_IE55         0x0550
+#define _WIN32_IE_IE56         0x0560
+#define _WIN32_IE_IE60         0x0600
+#define _WIN32_IE_IE60SP1      0x0601
+#define _WIN32_IE_IE60SP2      0x0603
+#define _WIN32_IE_IE70         0x0700
+#define _WIN32_IE_IE80         0x0800
+
+#define _WIN32_IE_IE30         0x0300
+#define _WIN32_IE_IE301        0x0301
+#define _WIN32_IE_IE302        0x0302
+#define _WIN32_IE_IE40         0x0400
+#define _WIN32_IE_IE401        0x0401
+
+/* Version constants specifying NTDDI_VERSION; these are also defined at
+ * http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx
+ */
+#define __NTDDI_WIN5           0x05000000
+#define __NTDDI_WIN51          0x05010000
+#define __NTDDI_WIN52          0x05020000
+#define __NTDDI_WIN6           0x06000000
+#define __NTDDI_WIN61          0x06010000
+#define __NTDDI_WIN62          0x06020000
+#define __NTDDI_WIN63          0x06030000
+#define __NTDDI_SP0            0x00000000
+#define __NTDDI_SP1            0x00000100
+#define __NTDDI_SP2            0x00000200
+#define __NTDDI_SP3            0x00000300
+#define __NTDDI_SP4            0x00000400
+
+#define NTDDI_WIN2K            __NTDDI_WIN5 + __NTDDI_SP0
+#define NTDDI_WIN2KSP1         __NTDDI_WIN5 + __NTDDI_SP1
+#define NTDDI_WIN2KSP2         __NTDDI_WIN5 + __NTDDI_SP2
+#define NTDDI_WIN2KSP3         __NTDDI_WIN5 + __NTDDI_SP3
+#define NTDDI_WIN2KSP4         __NTDDI_WIN5 + __NTDDI_SP4
+
+#define NTDDI_WINXP            __NTDDI_WIN51 + __NTDDI_SP0
+#define NTDDI_WINXPSP1         __NTDDI_WIN51 + __NTDDI_SP1
+#define NTDDI_WINXPSP2         __NTDDI_WIN51 + __NTDDI_SP2
+#define NTDDI_WINXPSP3         __NTDDI_WIN51 + __NTDDI_SP3
+
+#define NTDDI_WS03             __NTDDI_WIN52 + __NTDDI_SP0
+#define NTDDI_WS03SP1          __NTDDI_WIN52 + __NTDDI_SP1
+#define NTDDI_WS03SP2          __NTDDI_WIN52 + __NTDDI_SP2
+
+#define NTDDI_VISTA            __NTDDI_WIN6 + __NTDDI_SP0
+#define NTDDI_VISTASP1         __NTDDI_WIN6 + __NTDDI_SP1
+#define NTDDI_VISTASP2         __NTDDI_WIN6 + __NTDDI_SP2
+
+#define NTDDI_LONGHORN         NTDDI_VISTA
+
+#define NTDDI_WIN6             NTDDI_VISTA
+#define NTDDI_WIN6SP1          NTDDI_VISTASP1
+#define NTDDI_WIN6SP2          NTDDI_VISTASP2
+
+#define NTDDI_WS08             __NTDDI_WIN6 + __NTDDI_SP1
+
+#define NTDDI_WIN7             __NTDDI_WIN61 + __NTDDI_SP0
+
+#define NTDDI_WIN8             __NTDDI_WIN62 + __NTDDI_SP0
+
+#define NTDDI_WINBLUE          __NTDDI_WIN63 + __NTDDI_SP0
+
+/* Although NTDDI_VERSION is now the preferred designator for the
+ * level of support required from the operating system, legacy code
+ * is likely to have specified WINVER, from which _WIN32_WINNT may
+ * be inferred.
+ */
+#if defined WINVER && ! defined _WIN32_WINNT
+# define _WIN32_WINNT WINVER
+
+/* Additionally, legacy code intended for deployment on the Win9x
+ * series operating systems may have specified _WIN32_WINDOWS, as
+ * an alternative to, or in addition to, _WIN32_WINNT.
+ */
+#elif defined _WIN32_WINDOWS && ! defined _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINDOWS
+#endif
+
+/* Stipulate defaults; check consistency of any user specified overrides.
+ */
+#ifdef NTDDI_VERSION
+# ifdef _WIN32_WINNT
+#  if _WIN32_WINNT != WINNTVER(NTDDI_VERSION)
+#   error "_WIN32_WINNT setting conflicts with specified NTDDI_VERSION"
+#  endif
+# else
+#  define _WIN32_WINNT WINNTVER(NTDDI_VERSION)
+#  ifndef WINVER
+#   define WINVER _WIN32_WINNT
+#  endif
+# endif
+#endif
+
+#ifndef _WIN32_WINNT
+# ifdef WINVER
+#  define _WIN32_WINNT WINVER
+# else
+#  ifdef _WARN_DEFAULTS
+#   warning "Assuming default setting of _WIN32_WINNT_WIN2K for _WIN32_WINNT"
+#  endif
+#  define _WIN32_WINNT _WIN32_WINNT_WIN2K
+# endif
+#endif
+
+#ifndef WINVER
+# define WINVER _WIN32_WINNT
+#elif WINVER != _WIN32_WINNT
+ /* TODO(REVIEW): is this appropriate for WINVER consistency checking?
+  */
+# error "_WIN32_WINNT setting conflicts with specified WINVER"
+#endif
+
+#ifndef NTDDI_VERSION
+# ifdef _WARN_DEFAULTS
+#  warning "Assuming default NTDDI_VERSION setting to match _WIN32_WINNT"
+# endif
+# define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
+#endif
+
+#endif /* _SDKDDKVER_H: $RCSfile$: end of file */
index b69cf02..0da309c 100644 (file)
+/*
+ * w32api.h
+ *
+ * Package version identification, operating system support level set up,
+ * and "convenience" macros to be shared by all package header files.
+ *
+ * $Id$
+ *
+ * Written by Earnie Boyd  <earnie@users.sourceforge.net>
+ * Copyright (C) 2001-2011, 2015, MinGW.org Project
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
 #ifndef _W32API_H
 #define _W32API_H
-#define _W32API_H_
-#if __GNUC__ >=3
 #pragma GCC system_header
+
+/* Package version identification: formerly specified as a simple
+ * dotted numeric pair representing major.minor, this doesn't adapt
+ * well to the inclusion of the patch-level, since the dotted triplet
+ * representation of major.minor.patch is not a valid representation
+ * of a numeric entity.  Thus, from version 3.18 onwards we adopt a
+ * representation which encodes the version as a long integer value,
+ * expressing:
+ *
+ *   __W32API_VERSION = 1,000,000 * major + 1,000 * minor + patch
+ */
+#define __W32API_VERSION               3017000L
+#define __W32API_MAJOR_VERSION               3
+#define __W32API_MINOR_VERSION              17
+#define __W32API_PATCH_LEVEL                 0
+
+/* The underlying operating system platform version, and its
+ * identifying macros for application support, are established by:
+ */
+#include <sdkddkver.h>
+
+/* The following defines are for documentation purposes.  Although not used
+ * within it, they were provided in earlier versions of the Win32 API, as a
+ * convenience for users who wished to symbolically declare a minimum level
+ * of required operating system and Internet Explorer version support, when
+ * assigning WINVER, _WIN32_WINDOWS, _WIN32_WINNT, and _WIN32_IE values.
+ *
+ * Formerly defined as macros, these are now considered deprecated in favour
+ * of manifest definitions from <sdkddkver.h>; hence, reimplement in terms of
+ * static long integer constants, and flag as deprecated.
+ */
+#define __WIN32_DEPRECATED_ALIAS( __type__, __name__, __value__ )\
+  static const __type__ __name__ __attribute__((__deprecated__)) = __value__;
+
+/* _WIN32_WINDOWS and/or WINVER may be set to any of the following manifest
+ * values, to specify a minimum Win9x support level requirement:
+ *
+ *                              Old Name       Preferred Name
+ *                              -------------  -----------------
+ */
+__WIN32_DEPRECATED_ALIAS( long,  Windows95,    _WIN32_WINDOWS_95 )
+__WIN32_DEPRECATED_ALIAS( long,  Windows98,    _WIN32_WINDOWS_98 )
+__WIN32_DEPRECATED_ALIAS( long,  WindowsME,    _WIN32_WINDOWS_ME )
+
+/* _WIN32_WINNT and/or WINVER may be set to any of the following manifest
+ * values, to specify a minimum WinNT support level requirement:
+ *
+ *                              Old Name       Preferred Name
+ *                              -------------  -----------------
+ */
+__WIN32_DEPRECATED_ALIAS( long,  WindowsNT4,   _WIN32_WINNT_NT4 )
+__WIN32_DEPRECATED_ALIAS( long,  Windows2000,  _WIN32_WINNT_WIN2K )
+__WIN32_DEPRECATED_ALIAS( long,  WindowsXP,    _WIN32_WINNT_WINXP )
+__WIN32_DEPRECATED_ALIAS( long,  Windows2003,  _WIN32_WINNT_WS03 )
+__WIN32_DEPRECATED_ALIAS( long,  WindowsVista, _WIN32_WINNT_VISTA )
+
+/* _WIN32_IE may be set to any of the following manifest values, to
+ * specify a minimum Internet Explorer support level requirement:
+ *
+ *                              Old Name       Preferred Name
+ *                              -------------  -----------------
+ */
+__WIN32_DEPRECATED_ALIAS( long,  IE3,          _WIN32_IE_IE30 )
+__WIN32_DEPRECATED_ALIAS( long,  IE301,        _WIN32_IE_IE301 )
+__WIN32_DEPRECATED_ALIAS( long,  IE302,        _WIN32_IE_IE302 )
+__WIN32_DEPRECATED_ALIAS( long,  IE4,          _WIN32_IE_IE40 )
+__WIN32_DEPRECATED_ALIAS( long,  IE401,        _WIN32_IE_IE401 )
+__WIN32_DEPRECATED_ALIAS( long,  IE5,          _WIN32_IE_IE50 )
+__WIN32_DEPRECATED_ALIAS( long,  IE5a,         _WIN32_IE_IE50 )
+__WIN32_DEPRECATED_ALIAS( long,  IE5b,         _WIN32_IE_IE50 )
+__WIN32_DEPRECATED_ALIAS( long,  IE501,        _WIN32_IE_IE501 )
+__WIN32_DEPRECATED_ALIAS( long,  IE55,         _WIN32_IE_IE55 )
+__WIN32_DEPRECATED_ALIAS( long,  IE56,         _WIN32_IE_IE56 )
+__WIN32_DEPRECATED_ALIAS( long,  IE6,          _WIN32_IE_IE60 )
+__WIN32_DEPRECATED_ALIAS( long,  IE601,        _WIN32_IE_IE60SP1 )
+__WIN32_DEPRECATED_ALIAS( long,  IE602,        _WIN32_IE_IE60SP2 )
+__WIN32_DEPRECATED_ALIAS( long,  IE7,          _WIN32_IE_IE70 )
+
+
+/* Only Microsoft could attempt to justify this insanity: when building
+ * a UTF-16LE application -- apparently their understanding of Unicode is
+ * limited to this -- the C/C++ runtime requires that the user must define
+ * the _UNICODE macro, while to use the Windows API's UTF-16LE capabilities,
+ * it is the UNICODE macro, (without the leading underscore), which must be
+ * defined.  The (bogus) explanation appears to be that it is the C standard
+ * which dictates the requirement for the leading underscore, to avoid any
+ * possible conflict with a user defined symbol; (bogus because the macro
+ * must be user defined anyway -- it is not a private symbol -- and in
+ * any case, the Windows API already reserves the UNICODE symbol as
+ * a user defined macro, with equivalent intent.
+ *
+ * The real explanation, of course, is that this is just another example
+ * of Microsoft irrationality; in any event, there seems to be no sane
+ * scenario in which defining one without the other would be required,
+ * or indeed would not raise potential for internal inconsistency, so we
+ * ensure that either both are, or neither is defined.
+ */
+#if defined UNICODE && ! defined _UNICODE
+# define _UNICODE  UNICODE
+#elif defined _UNICODE && ! defined UNICODE
+# define UNICODE  _UNICODE
+#endif
+
+#ifdef __cplusplus
+/* When compiling C++ code, these macros provide a convenient notation,
+ * for designating those sections of system header files which declare
+ * prototypes for API functions with "C" binding...
+ */
+# define _EXTERN_C       extern "C"
+# define _BEGIN_C_DECLS  extern "C" {
+# define _END_C_DECLS    }
+
+#else
+/* ...while remaining transparent, when compiling C code.
+ */
+# define _EXTERN_C       extern
+# define _BEGIN_C_DECLS
+# define _END_C_DECLS
 #endif
 
-#define __W32API_VERSION 3.17
-#define __W32API_MAJOR_VERSION 3
-#define __W32API_MINOR_VERSION 17
-
-/* The following defines are for documentation purposes.  The following defines
- * identify the versions of Windows and Internet Explorer.  They are not to be
- * used in the w32api library but may be used by a user to set the _WIN32_WINNT
- * or _WIN32_WINDOWS and the WINVER values to their minimum level of support.
- *
- * Similarly the user can use the Internet Explorer values to set the _WIN32_IE
- * value to their minimum level of support.
- */
-
-/* Use these values to set _WIN32_WINDOWS and WINVER to your minimum support
- * level */
-#define Windows95    0x0400
-#define Windows98    0x0410
-#define WindowsME    0x0500
-
-/* Use these values to set _WIN32_WINNT and WINVER to your mimimum support
- * level. */
-#define WindowsNT4   0x0400
-#define Windows2000  0x0500
-#define WindowsXP    0x0501
-#define Windows2003  0x0502
-#define WindowsVista 0x0600
-
-/* Use these values to set _WIN32_IE to your minimum support level */
-#define IE3    0x0300
-#define IE301  0x0300
-#define IE302  0x0300
-#define IE4    0x0400
-#define IE401  0x0401
-#define IE5    0x0500
-#define IE5a   0x0500
-#define IE5b   0x0500
-#define IE501  0x0501
-#define IE55   0x0501
-#define IE56   0x0560
-#define IE6    0x0600
-#define IE601  0x0601
-#define IE602  0x0603
-#define IE7    0x0700
-
-#endif /* ndef _W32API_H */
+#endif /* ! _W32API_H: $RCSfile$: end of file */
index c02945e..5be42c9 100644 (file)
@@ -1,30 +1,48 @@
+/*
+ * windef.h
+ *
+ * Common definitions for the Win32 API.
+ *
+ * $Id$
+ *
+ * Written by Anders Norlander  <anorland@hem2.passagen.se>
+ * Copyright (C) 1998-2002, 2006-2008, 2010, 2015, MinGW.org Project
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
 #ifndef _WINDEF_H
 #define _WINDEF_H
-#if __GNUC__ >=3
 #pragma GCC system_header
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
 
-#ifndef WINVER
-#define WINVER 0x0400
-/*
- * If you need Win32 API features newer the Win95 and WinNT then you must
- * define WINVER before including windows.h or any other method of including
- * the windef.h header.
+/* We used to provide preprocessor code here, to ensure that WINVER
+ * and _WIN32_WINNT are defined; this is now handled by inclusion of
+ * w32api.h, which in turn includes sdkddkver.h, so implementing the
+ * preferred technique of deriving these from a user assigned, (or
+ * default), NTDDI_VERSION setting.
  */
-#endif
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT WINVER
-/*
- * There may be the need to define _WIN32_WINNT to a value different from
- * the value of WINVER.  I don't have any example of why you would do that.
- * However, if you must then define _WIN32_WINNT to the value required before
- * including windows.h or any other method of including the windef.h header.
- */
-#endif
+#include <w32api.h>
+
+_BEGIN_C_DECLS
+
 #ifndef WIN32
 #define WIN32
 #endif
@@ -55,16 +73,17 @@ extern "C" {
 #define TRUE 1
 #endif
 
-/* Pseudo modifiers for parameters
-   We don't use these unnecessary defines in the w32api headers. Define
-   them by default since that is what people expect, but allow users
-   to avoid the pollution.  */
 #ifndef _NO_W32_PSEUDO_MODIFIERS
-#define IN
-#define OUT
-#ifndef OPTIONAL
-#define OPTIONAL
-#endif
+/* Pseudo-modifiers support function argument classification:
+ * we don't use these unnecessary defines in the w32api headers,
+ * but define them by default, since that is what people expect;
+ * this is conditional, so that users may avoid the pollution.
+ */
+# define IN
+# define OUT
+# ifndef OPTIONAL
+#  define OPTIONAL
+# endif
 #endif
 
 #ifdef __GNUC__
@@ -213,17 +232,18 @@ extern "C" {
 #endif
 #endif
 
-/* FIXME: This will make some code compile. The programs will most
-   likely crash when an exception is raised, but at least they will
-   compile. */
 #if defined (__GNUC__) && defined (__SEH_NOOP)
-#define __try
-#define __except(x) if (0) /* don't execute handler */
-#define __finally
+/* FIXME: This will make some code compile. The programs will most
+ * likely crash when an exception is raised, but at least they will
+ * compile.
+ */
+# define __try
+# define __except(x) if (0) /* don't execute handler */
+# define __finally
 
-#define _try __try
-#define _except __except
-#define _finally __finally
+# define _try __try
+# define _except __except
+# define _finally __finally
 #endif
 
 typedef unsigned long DWORD;
@@ -332,7 +352,6 @@ typedef struct tagPOINTS {
        SHORT y;
 } POINTS,*PPOINTS,*LPPOINTS;
 
-#ifdef __cplusplus
-}
-#endif
-#endif
+_END_C_DECLS
+
+#endif /* _WINDEF_H: $RCSfile$: end of file */