OpenTTD Source 20260109-master-g241b5fcdfe
osx_stdafx.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef MACOS_STDAFX_H
11#define MACOS_STDAFX_H
12
13
14#include <AvailabilityMacros.h>
15
16#define __STDC_LIMIT_MACROS
17#include <stdint.h>
18
19/* Some gcc versions include assert.h via this header. As this would interfere
20 * with our own assert redefinition, include this header first. */
21#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
22# include <debug/debug.h>
23#endif
24
25/* Check for mismatching 'architectures' */
26#if !defined(STRGEN) && !defined(SETTINGSGEN) && ((defined(__LP64__) && !defined(POINTER_IS_64BIT)) || (!defined(__LP64__) && defined(POINTER_IS_64BIT)))
27# error "Compiling 64 bits without POINTER_IS_64BIT set! (or vice versa)"
28#endif
29
30/* Name conflict */
31#define Rect OTTDRect
32#define Point OTTDPoint
33#define WindowClass OTTDWindowClass
34#define ScriptOrder OTTDScriptOrder
35#define Palette OTTDPalette
36#define GlyphID OTTDGlyphID
37
38#include <CoreServices/CoreServices.h>
39#include <ApplicationServices/ApplicationServices.h>
40
41#undef Rect
42#undef Point
43#undef WindowClass
44#undef ScriptOrder
45#undef Palette
46#undef GlyphID
47
48/* remove the variables that CoreServices defines, but we define ourselves too */
49#undef bool
50#undef false
51#undef true
52
53/* Name conflict */
54#define GetTime OTTD_GetTime
55
56#define SL_ERROR OSX_SL_ERROR
57
58/* NSInteger and NSUInteger are part of 10.5 and higher. */
59#ifndef NSInteger
60#ifdef __LP64__
61typedef long NSInteger;
62typedef unsigned long NSUInteger;
63#else
64typedef int NSInteger;
65typedef unsigned int NSUInteger;
66#endif /* __LP64__ */
67#endif /* NSInteger */
68
69#ifndef CGFLOAT_DEFINED
70#ifdef __LP64__
71typedef double CGFloat;
72#else
73typedef float CGFloat;
74#endif /* __LP64__ */
75#endif /* CGFLOAT_DEFINED */
76
77/* OS X has a non-const iconv. */
78#define HAVE_NON_CONST_ICONV
79
80#endif /* MACOS_STDAFX_H */