+
+/* 16bit */
+#ifdef SIZEOF_SHORT
+ #if SIZEOF_SHORT != 2
+ #error "wxWidgets assumes sizeof(short) == 2, please fix the code"
+ #endif
+#else
+ #define SIZEOF_SHORT 2
+#endif
+
+typedef signed short wxInt16;
+typedef unsigned short wxUint16;
+
+typedef wxUint16 wxWord;
+
+/*
+ things are getting more interesting with ints, longs and pointers
+
+ there are several different standard data models described by this table:
+
+ +-----------+----------------------------+
+ |type\model | LP64 ILP64 LLP64 ILP32 LP32|
+ +-----------+----------------------------+
+ |char | 8 8 8 8 8 |
+ |short | 16 16 16 16 16 |
+ |int | 32 64 32 32 16 |
+ |long | 64 64 32 32 32 |
+ |long long | 64 |
+ |void * | 64 64 64 32 32 |
+ +-----------+----------------------------+
+
+ Win16 used LP32 (but we don't support it any longer), Win32 obviously used
+ ILP32 and Win64 uses LLP64 (a.k.a. P64)
+
+ Under Unix LP64 is the most widely used (the only I've ever seen, in fact)
+ */
+
+/* 32bit */
+#ifdef __PALMOS__
+ typedef int wxInt32;
+ typedef unsigned int wxUint32;
+ #define SIZEOF_INT 4
+ #define SIZEOF_LONG 4
+ #define SIZEOF_WCHAR_T 2
+ #define SIZEOF_SIZE_T 4
+ #define wxSIZE_T_IS_UINT
+ #define SIZEOF_VOID_P 4
+ #define SIZEOF_SIZE_T 4
+#elif defined(__WINDOWS__)
+ /* Win64 uses LLP64 model and so ints and longs have the same size as in */
+ /* Win32 */
+ #if defined(__WIN32__)
+ typedef int wxInt32;
+ typedef unsigned int wxUint32;
+
+ /* Assume that if SIZEOF_INT is defined that all the other ones except
+ SIZEOF_SIZE_T, are too. See next #if below. */
+ #ifndef SIZEOF_INT
+ #define SIZEOF_INT 4
+ #define SIZEOF_LONG 4
+ #define SIZEOF_WCHAR_T 2
+
+ /*
+ under Win64 sizeof(size_t) == 8 and so it is neither unsigned
+ int nor unsigned long!
+ */
+ #ifdef __WIN64__
+ #define SIZEOF_SIZE_T 8
+
+ #undef wxSIZE_T_IS_UINT
+ #else /* Win32 */
+ #define SIZEOF_SIZE_T 4
+
+ #define wxSIZE_T_IS_UINT
+ #endif
+ #undef wxSIZE_T_IS_ULONG
+
+ #ifdef __WIN64__
+ #define SIZEOF_VOID_P 8
+ #else /* Win32 */
+ #define SIZEOF_VOID_P 4
+ #endif /* Win64/32 */
+ #endif /* !defined(SIZEOF_INT) */
+
+ /*
+ If Python.h was included first, it defines all of the SIZEOF's above
+ except for SIZEOF_SIZE_T, so we need to do it here to avoid
+ triggering the #error in the ssize_t typedefs below...
+ */
+ #ifndef SIZEOF_SIZE_T
+ #ifdef __WIN64__
+ #define SIZEOF_SIZE_T 8
+ #else /* Win32 */
+ #define SIZEOF_SIZE_T 4
+ #endif
+ #endif
+ #else
+ #error "Unsupported Windows version"
+ #endif
+#else /* !Windows */
+ /* SIZEOF_XXX are normally defined by configure */
+ #ifdef SIZEOF_INT
+ #if SIZEOF_INT == 8
+ /* must be ILP64 data model, there is normally a special 32 bit */
+ /* type in it but we don't know what it is... */
+ #error "No 32bit int type on this platform"
+ #elif SIZEOF_INT == 4
+ typedef int wxInt32;
+ typedef unsigned int wxUint32;
+ #elif SIZEOF_INT == 2
+ /* must be LP32 */
+ #if SIZEOF_LONG != 4
+ #error "No 32bit int type on this platform"
+ #endif
+
+ typedef long wxInt32;
+ typedef unsigned long wxUint32;
+ #else
+ /* wxWidgets is not ready for 128bit systems yet... */
+ #error "Unknown sizeof(int) value, what are you compiling for?"
+ #endif
+ #else /* !defined(SIZEOF_INT) */
+ /* assume default 32bit machine -- what else can we do? */
+ wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes);
+ wxCOMPILE_TIME_ASSERT( sizeof(size_t) == 4, SizeTMustBeExactly4Bytes);
+ wxCOMPILE_TIME_ASSERT( sizeof(void *) == 4, PtrMustBeExactly4Bytes);
+
+ #define SIZEOF_INT 4
+ #define SIZEOF_SIZE_T 4
+ #define SIZEOF_VOID_P 4
+
+ typedef int wxInt32;
+ typedef unsigned int wxUint32;
+
+ #if defined(__MACH__) && !defined(SIZEOF_WCHAR_T)
+ #define SIZEOF_WCHAR_T 4
+ #endif
+ #if wxUSE_WCHAR_T && !defined(SIZEOF_WCHAR_T)
+ /* also assume that sizeof(wchar_t) == 2 (under Unix the most */
+ /* common case is 4 but there configure would have defined */
+ /* SIZEOF_WCHAR_T for us) */
+ /* the most common case */
+ wxCOMPILE_TIME_ASSERT( sizeof(wchar_t) == 2,
+ Wchar_tMustBeExactly2Bytes);
+
+ #define SIZEOF_WCHAR_T 2
+ #endif /* wxUSE_WCHAR_T */
+ #endif
+#endif /* Win/!Win */
+
+typedef wxUint32 wxDword;
+
+/*
+ Define an integral type big enough to contain all of long, size_t and void *.
+ */
+#if SIZEOF_LONG >= SIZEOF_VOID_P && SIZEOF_LONG >= SIZEOF_SIZE_T
+ /* normal case */
+ typedef unsigned long wxUIntPtr;
+#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P
+ /* Win64 case */
+ typedef size_t wxUIntPtr;
+#else
+ /*
+ This should never happen for the current architectures but if you're
+ using one where it does, please contact wx-dev@lists.wxwidgets.org.
+ */
+ #error "Pointers can't be stored inside integer types."
+#endif
+
+#ifdef __cplusplus
+/* And also define a couple of simple functions to cast pointer to/from it. */
+inline wxUIntPtr wxPtrToUInt(const void *p)
+{
+ /*
+ VC++ 7.1 gives warnings about casts such as below even when they're
+ explicit with /Wp64 option, suppress them as we really know what we're
+ doing here. Same thing with icc with -Wall.
+ */
+#ifdef __VISUALC__
+ #if __VISUALC__ >= 1200
+ #pragma warning(push)
+ #endif
+ /* pointer truncation from '' to '' */
+ #pragma warning(disable: 4311)
+#elif defined(__INTELC__)
+ #pragma warning(push)
+ /* conversion from pointer to same-sized integral type */
+ #pragma warning(disable: 1684)
+#endif
+
+ return wx_reinterpret_cast(wxUIntPtr, p);
+
+#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
+ #pragma warning(pop)
+#endif
+}
+
+inline void *wxUIntToPtr(wxUIntPtr p)
+{
+#ifdef __VISUALC__
+ #if __VISUALC__ >= 1200
+ #pragma warning(push)
+ #endif
+ /* conversion to type of greater size */
+ #pragma warning(disable: 4312)
+#elif defined(__INTELC__)
+ #pragma warning(push)
+ /* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
+ #pragma warning(disable: 171)
+#endif
+
+ return wx_reinterpret_cast(void *, p);
+
+#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
+ #pragma warning(pop)
+#endif
+}
+#endif /*__cplusplus*/
+
+
+/* 64 bit */
+
+/* NB: we #define and not typedef wxLongLong_t because we use "#ifdef */
+/* wxLongLong_t" in wx/longlong.h */
+
+/* wxULongLong_t is set later (usually to unsigned wxLongLong_t) */
+
+/* to avoid compilation problems on 64bit machines with ambiguous method calls */
+/* we will need to define this */
+#undef wxLongLongIsLong
+
+/* first check for generic cases which are long on 64bit machine and "long */
+/* long", then check for specific compilers */
+#if defined(SIZEOF_LONG) && (SIZEOF_LONG == 8)
+ #define wxLongLong_t long
+ #define wxLongLongSuffix l
+ #define wxLongLongFmtSpec _T("l")
+ #define wxLongLongIsLong
+#elif defined(__WXPALMOS__)
+ #define wxLongLong_t int64_t
+ #define wxLongLongSuffix ll
+ #define wxLongLongFmtSpec _T("ll")
+#elif (defined(__VISUALC__) && defined(__WIN32__))
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix i64
+ #define wxLongLongFmtSpec _T("I64")
+#elif defined(__BORLANDC__) && defined(__WIN32__) && (__BORLANDC__ >= 0x520)
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix i64
+ #define wxLongLongFmtSpec _T("L")
+#elif (defined(__WATCOMC__) && (defined(__WIN32__) || defined(__DOS__) || defined(__OS2__)))
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix i64
+ #define wxLongLongFmtSpec _T("L")
+#elif defined(__DIGITALMARS__)
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix LL
+ #define wxLongLongFmtSpec _T("ll")
+#elif defined(__MINGW32__)
+ #define wxLongLong_t long long
+ #define wxLongLongSuffix ll
+ #define wxLongLongFmtSpec _T("I64")
+#elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \
+ defined(__GNUC__) || \
+ defined(__CYGWIN__) || \
+ defined(__WXMICROWIN__) || \
+ (defined(__DJGPP__) && __DJGPP__ >= 2)
+ #define wxLongLong_t long long
+ #define wxLongLongSuffix ll
+ #define wxLongLongFmtSpec _T("ll")
+#elif defined(__MWERKS__)
+ #if __option(longlong)
+ #define wxLongLong_t long long
+ #define wxLongLongSuffix ll
+ #define wxLongLongFmtSpec _T("ll")
+ #else
+ #error "The 64 bit integer support in CodeWarrior has been disabled."
+ #error "See the documentation on the 'longlong' pragma."
+ #endif
+#elif defined(__VISAGECPP__) && __IBMCPP__ >= 400
+ #define wxLongLong_t long long
+#endif
+
+
+#ifdef wxLongLong_t
+
+ #ifdef __WXPALMOS__
+ #define wxULongLong_t uint64_t
+ #else
+ #define wxULongLong_t unsigned wxLongLong_t
+ #endif
+
+ /* these macros allow to definea 64 bit constants in a portable way */
+ #define wxLL(x) wxCONCAT(x, wxLongLongSuffix)
+ #define wxULL(x) wxCONCAT(x, wxCONCAT(u, wxLongLongSuffix))
+
+ typedef wxLongLong_t wxInt64;
+ typedef wxULongLong_t wxUint64;
+
+ #define wxHAS_INT64 1
+
+#elif wxUSE_LONGLONG
+ /* these macros allow to definea 64 bit constants in a portable way */
+ #define wxLL(x) wxLongLong(x)
+ #define wxULL(x) wxULongLong(x)
+
+ #define wxInt64 wxLongLong
+ #define wxUint64 wxULongLong
+
+ #define wxHAS_INT64 1
+
+#else /* !wxUSE_LONGLONG */
+
+ #define wxHAS_INT64 0
+
+#endif
+
+
+/* Make sure ssize_t is defined (a signed type the same size as size_t) */
+/* HAVE_SSIZE_T should be defined for compiliers that already have it */
+#ifdef __MINGW32__
+ #if defined(_SSIZE_T_) && !defined(HAVE_SSIZE_T)
+ #define HAVE_SSIZE_T
+ #endif
+#endif
+#if defined(__PALMOS__) && !defined(HAVE_SSIZE_T)
+ #define HAVE_SSIZE_T
+#endif
+#if wxCHECK_WATCOM_VERSION(1,4)
+ #define HAVE_SSIZE_T
+#endif
+#ifndef HAVE_SSIZE_T
+ #if SIZEOF_SIZE_T == 4
+ typedef wxInt32 ssize_t;
+ #elif SIZEOF_SIZE_T == 8
+ typedef wxInt64 ssize_t;
+ #else
+ #error "error defining ssize_t, size_t is not 4 or 8 bytes"
+ #endif
+#endif
+
+
+/* base floating point types */
+/* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits */
+/* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits */
+/* wxDouble: native fastest representation that has at least wxFloat64 */
+/* precision, so use the IEEE types for storage, and this for */
+/* calculations */
+
+typedef float wxFloat32;
+#if (defined( __WXMAC__ ) || defined(__WXCOCOA__)) && defined (__MWERKS__)