OpenTTD
osx_stdafx.h
Go to the documentation of this file.
1 /* $Id: osx_stdafx.h 26709 2014-07-30 20:19:29Z planetmaker $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * 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.
6  * 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.
7  * 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/>.
8  */
9 
12 #ifndef MACOS_STDAFX_H
13 #define MACOS_STDAFX_H
14 
15 
16 /* It would seem that to ensure backward compability we have to ensure that we have defined MAC_OS_X_VERSION_10_x everywhere */
17 #ifndef MAC_OS_X_VERSION_10_3
18 #define MAC_OS_X_VERSION_10_3 1030
19 #endif
20 
21 #ifndef MAC_OS_X_VERSION_10_4
22 #define MAC_OS_X_VERSION_10_4 1040
23 #endif
24 
25 #ifndef MAC_OS_X_VERSION_10_5
26 #define MAC_OS_X_VERSION_10_5 1050
27 #endif
28 
29 #ifndef MAC_OS_X_VERSION_10_6
30 #define MAC_OS_X_VERSION_10_6 1060
31 #endif
32 
33 #ifndef MAC_OS_X_VERSION_10_7
34 #define MAC_OS_X_VERSION_10_7 1070
35 #endif
36 
37 #ifndef MAC_OS_X_VERSION_10_8
38 #define MAC_OS_X_VERSION_10_8 1080
39 #endif
40 
41 #ifndef MAC_OS_X_VERSION_10_9
42 #define MAC_OS_X_VERSION_10_9 1090
43 #endif
44 
45 
46 #define __STDC_LIMIT_MACROS
47 #include <stdint.h>
48 
49 /* Some gcc versions include assert.h via this header. As this would interfere
50  * with our own assert redefinition, include this header first. */
51 #if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
52 # include <debug/debug.h>
53 #endif
54 
55 /* Check for mismatching 'architectures' */
56 #if !defined(STRGEN) && !defined(SETTINGSGEN) && ((defined(__LP64__) && !defined(_SQ64)) || (!defined(__LP64__) && defined(_SQ64)))
57 # error "Compiling 64 bits without _SQ64 set! (or vice versa)"
58 #endif
59 
60 #include <AvailabilityMacros.h>
61 
62 /* Name conflict */
63 #define Rect OTTDRect
64 #define Point OTTDPoint
65 #define WindowClass OTTDWindowClass
66 #define ScriptOrder OTTDScriptOrder
67 #define Palette OTTDPalette
68 #define GlyphID OTTDGlyphID
69 
70 #include <CoreServices/CoreServices.h>
71 #include <ApplicationServices/ApplicationServices.h>
72 
73 #undef Rect
74 #undef Point
75 #undef WindowClass
76 #undef ScriptOrder
77 #undef Palette
78 #undef GlyphID
79 
80 /* remove the variables that CoreServices defines, but we define ourselves too */
81 #undef bool
82 #undef false
83 #undef true
84 
85 /* Name conflict */
86 #define GetTime OTTD_GetTime
87 
88 #define SL_ERROR OSX_SL_ERROR
89 
90 /* NSInteger and NSUInteger are part of 10.5 and higher. */
91 #ifndef NSInteger
92 #ifdef __LP64__
93 typedef long NSInteger;
94 typedef unsigned long NSUInteger;
95 #else
96 typedef int NSInteger;
97 typedef unsigned int NSUInteger;
98 #endif /* __LP64__ */
99 #endif /* NSInteger */
100 
101 #ifndef CGFLOAT_DEFINED
102 #ifdef __LP64__
103 typedef double CGFloat;
104 #else
105 typedef float CGFloat;
106 #endif /* __LP64__ */
107 #endif /* CGFLOAT_DEFINED */
108 
109 /* OS X SDK versions >= 10.5 have a non-const iconv. */
110 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
111 # define HAVE_NON_CONST_ICONV
112 #endif
113 
114 #endif /* MACOS_STDAFX_H */