# osx_stdafx.h

Go to the documentation of this file.

    00001 /* $Id: osx_stdafx.h 25913 2013-10-26 17:20:48Z michi_cc $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef MACOS_STDAFX_H
    00013 #define MACOS_STDAFX_H
    00014
    00015
    00016 /* It would seem that to ensure backward compability we have to ensure that we have defined MAC_OS_X_VERSION_10_x everywhere */
    00017 #ifndef MAC_OS_X_VERSION_10_3
    00018 #define MAC_OS_X_VERSION_10_3 1030
    00019 #endif
    00020
    00021 #ifndef MAC_OS_X_VERSION_10_4
    00022 #define MAC_OS_X_VERSION_10_4 1040
    00023 #endif
    00024
    00025 #ifndef MAC_OS_X_VERSION_10_5
    00026 #define MAC_OS_X_VERSION_10_5 1050
    00027 #endif
    00028
    00029 #ifndef MAC_OS_X_VERSION_10_6
    00030 #define MAC_OS_X_VERSION_10_6 1060
    00031 #endif
    00032
    00033 #ifndef MAC_OS_X_VERSION_10_7
    00034 #define MAC_OS_X_VERSION_10_7 1070
    00035 #endif
    00036
    00037 #ifndef MAC_OS_X_VERSION_10_8
    00038 #define MAC_OS_X_VERSION_10_8 1080
    00039 #endif
    00040
    00041 #ifndef MAC_OS_X_VERSION_10_9
    00042 #define MAC_OS_X_VERSION_10_9 1090
    00043 #endif
    00044
    00045
    00046 #define __STDC_LIMIT_MACROS
    00047 #include <stdint.h>
    00048
    00049 /* We need to include this first as that "depends" on the compiler's setting
    00050  * of __LP64__. So before we define __LP64__ so it can be used. */
    00051 #include <sys/cdefs.h>
    00052 #include <unistd.h>
    00053
    00054 /* Some gcc versions include assert.h via this header. As this would interfere
    00055  * with our own assert redefinition, include this header first. */
    00056 #if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
    00057 # include <debug/debug.h>
    00058 #endif
    00059
    00060 /* __LP64__ only exists in 10.5 and higher */
    00061 #if defined(__APPLE__) && !defined(__LP64__)
    00062 # define __LP64__ 0
    00063 #endif
    00064
    00065 /* Check for mismatching 'architectures' */
    00066 #if !defined(STRGEN) && !defined(SETTINGSGEN) && ((__LP64__ && !defined(_SQ64)) || (!__LP64__ && defined(_SQ64)))
    00067 # error "Compiling 64 bits without _SQ64 set! (or vice versa)"
    00068 #endif
    00069
    00070 #include <AvailabilityMacros.h>
    00071
    00072 /* Name conflict */
    00073 #define Rect        OTTDRect
    00074 #define Point       OTTDPoint
    00075 #define WindowClass OTTDWindowClass
    00076 #define ScriptOrder OTTDScriptOrder
    00077 #define Palette     OTTDPalette
    00078 #define GlyphID     OTTDGlyphID
    00079
    00080 #include <CoreServices/CoreServices.h>
    00081 #include <ApplicationServices/ApplicationServices.h>
    00082
    00083 #undef Rect
    00084 #undef Point
    00085 #undef WindowClass
    00086 #undef ScriptOrder
    00087 #undef Palette
    00088 #undef GlyphID
    00089
    00090 /* remove the variables that CoreServices defines, but we define ourselves too */
    00091 #undef bool
    00092 #undef false
    00093 #undef true
    00094
    00095 /* Name conflict */
    00096 #define GetTime OTTD_GetTime
    00097
    00098 #define SL_ERROR OSX_SL_ERROR
    00099
    00100 /* NSInteger and NSUInteger are part of 10.5 and higher. */
    00101 #ifndef NSInteger
    00102 #if __LP64__
    00103 typedef long NSInteger;
    00104 typedef unsigned long NSUInteger;
    00105 #else
    00106 typedef int NSInteger;
    00107 typedef unsigned int NSUInteger;
    00108 #endif /* __LP64__ */
    00109 #endif /* NSInteger */
    00110
    00111 #ifndef CGFLOAT_DEFINED
    00112 #if __LP64__
    00113 typedef double CGFloat;
    00114 #else
    00115 typedef float CGFloat;
    00116 #endif /* __LP64__ */
    00117 #endif /* CGFLOAT_DEFINED */
    00118
    00119 /* OS X SDK versions >= 10.5 have a non-const iconv. */
    00120 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
    00121 # define HAVE_NON_CONST_ICONV
    00122 #endif
    00123
    00124 #endif /* MACOS_STDAFX_H */