osx_stdafx.h

Go to the documentation of this file.
00001 /* $Id: osx_stdafx.h 26715 2014-08-03 14:06:04Z frosch $ */
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 /* Some gcc versions include assert.h via this header. As this would interfere
00050  * with our own assert redefinition, include this header first. */
00051 #if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
00052 # include <debug/debug.h>
00053 #endif
00054 
00055 /* Check for mismatching 'architectures' */
00056 #if !defined(STRGEN) && !defined(SETTINGSGEN) && ((defined(__LP64__) && !defined(_SQ64)) || (!defined(__LP64__) && defined(_SQ64)))
00057 # error "Compiling 64 bits without _SQ64 set! (or vice versa)"
00058 #endif
00059 
00060 #include <AvailabilityMacros.h>
00061 
00062 /* Name conflict */
00063 #define Rect        OTTDRect
00064 #define Point       OTTDPoint
00065 #define WindowClass OTTDWindowClass
00066 #define ScriptOrder OTTDScriptOrder
00067 #define Palette     OTTDPalette
00068 #define GlyphID     OTTDGlyphID
00069 
00070 #include <CoreServices/CoreServices.h>
00071 #include <ApplicationServices/ApplicationServices.h>
00072 
00073 #undef Rect
00074 #undef Point
00075 #undef WindowClass
00076 #undef ScriptOrder
00077 #undef Palette
00078 #undef GlyphID
00079 
00080 /* remove the variables that CoreServices defines, but we define ourselves too */
00081 #undef bool
00082 #undef false
00083 #undef true
00084 
00085 /* Name conflict */
00086 #define GetTime OTTD_GetTime
00087 
00088 #define SL_ERROR OSX_SL_ERROR
00089 
00090 /* NSInteger and NSUInteger are part of 10.5 and higher. */
00091 #ifndef NSInteger
00092 #ifdef __LP64__
00093 typedef long NSInteger;
00094 typedef unsigned long NSUInteger;
00095 #else
00096 typedef int NSInteger;
00097 typedef unsigned int NSUInteger;
00098 #endif /* __LP64__ */
00099 #endif /* NSInteger */
00100 
00101 #ifndef CGFLOAT_DEFINED
00102 #ifdef __LP64__
00103 typedef double CGFloat;
00104 #else
00105 typedef float CGFloat;
00106 #endif /* __LP64__ */
00107 #endif /* CGFLOAT_DEFINED */
00108 
00109 /* OS X SDK versions >= 10.5 have a non-const iconv. */
00110 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
00111 # define HAVE_NON_CONST_ICONV
00112 #endif
00113 
00114 #endif /* MACOS_STDAFX_H */