osx_stdafx.h

Go to the documentation of this file.
00001 /* $Id: osx_stdafx.h 23446 2011-12-08 18:13:29Z rubidium $ */
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 #define __STDC_LIMIT_MACROS
00016 #include <stdint.h>
00017 
00018 /* We need to include this first as that "depends" on the compiler's setting
00019  * of __LP64__. So before we define __LP64__ so it can be used. */
00020 #include <sys/cdefs.h>
00021 #include <unistd.h>
00022 
00023 /* Some gcc versions include assert.h via this header. As this would interfere
00024  * with our own assert redefinition, include this header first. */
00025 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
00026 # include <debug/debug.h>
00027 #endif
00028 
00029 /* __LP64__ only exists in 10.5 and higher */
00030 #if defined(__APPLE__) && !defined(__LP64__)
00031 # define __LP64__ 0
00032 #endif
00033 
00034 /* Check for mismatching 'architectures' */
00035 #if !defined(STRGEN) && !defined(SETTINGSGEN) && ((__LP64__ && !defined(_SQ64)) || (!__LP64__ && defined(_SQ64)))
00036 # error "Compiling 64 bits without _SQ64 set! (or vice versa)"
00037 #endif
00038 
00039 #include <AvailabilityMacros.h>
00040 
00041 /* Name conflict */
00042 #define Rect        OTTDRect
00043 #define Point       OTTDPoint
00044 #define WindowClass OTTDWindowClass
00045 #define ScriptOrder OTTDScriptOrder
00046 #define Palette     OTTDPalette
00047 
00048 #include <CoreServices/CoreServices.h>
00049 #include <ApplicationServices/ApplicationServices.h>
00050 
00051 #undef Rect
00052 #undef Point
00053 #undef WindowClass
00054 #undef ScriptOrder
00055 #undef Palette
00056 
00057 /* remove the variables that CoreServices defines, but we define ourselves too */
00058 #undef bool
00059 #undef false
00060 #undef true
00061 
00062 /* Name conflict */
00063 #define GetTime OTTD_GetTime
00064 
00065 #define SL_ERROR OSX_SL_ERROR
00066 
00067 /* NSInteger and NSUInteger are part of 10.5 and higher. */
00068 #ifndef NSInteger
00069 #if __LP64__
00070 typedef long NSInteger;
00071 typedef unsigned long NSUInteger;
00072 #else
00073 typedef int NSInteger;
00074 typedef unsigned int NSUInteger;
00075 #endif /* __LP64__ */
00076 #endif /* NSInteger */
00077 
00078 #endif /* MACOS_STDAFX_H */