author | rubidium |
Sat, 26 Apr 2008 20:54:56 +0000 | |
branch | 0.6 |
changeset 10366 | 960aae8c20e2 |
parent 9174 | 4a7b5962abd6 |
child 9319 | cc5eb4f7ef4c |
child 10367 | 94c008da45c4 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6977
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6916
diff
changeset
|
3 |
/** @file stdafx.h */ |
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6611
diff
changeset
|
4 |
|
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2225
diff
changeset
|
5 |
#ifndef STDAFX_H |
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2225
diff
changeset
|
6 |
#define STDAFX_H |
0 | 7 |
|
8869
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
8 |
#if defined(__NDS__) |
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
9 |
#include <nds/jtypes.h> |
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
10 |
/* NDS' types for uint32/int32 are based on longs, which causes |
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
11 |
* trouble all over the place in OpenTTD. */ |
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
12 |
#define uint32 uint32_ugly_hack |
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
13 |
#define int32 int32_ugly_hack |
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
14 |
typedef unsigned int uint32_ugly_hack; |
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
15 |
typedef signed int int32_ugly_hack; |
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
16 |
#endif /* __NDS__ */ |
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
17 |
|
6071
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
18 |
/* It seems that we need to include stdint.h before anything else |
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
19 |
* We need INT64_MAX, which for most systems comes from stdint.h. However, MSVC |
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
20 |
* does not have stdint.h and apparently neither does MorphOS, so define |
8271
393440621fb9
(svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents:
7901
diff
changeset
|
21 |
* INT64_MAX for them ourselves. |
393440621fb9
(svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents:
7901
diff
changeset
|
22 |
* Sometimes OSX headers manages to include stdint.h before this but without |
393440621fb9
(svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents:
7901
diff
changeset
|
23 |
* __STDC_LIMIT_MACROS so it will be without INT64_*. We need to define those |
393440621fb9
(svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents:
7901
diff
changeset
|
24 |
* too if this is the case. */ |
393440621fb9
(svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents:
7901
diff
changeset
|
25 |
#if !defined(_MSC_VER) && !defined( __MORPHOS__) && !defined(_STDINT_H_) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
26 |
#if defined(SUNOS) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
27 |
/* SunOS/Solaris does not have stdint.h, but inttypes.h defines everything |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
28 |
* stdint.h defines and we need. */ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
29 |
#include <inttypes.h> |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
30 |
# else |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
31 |
#define __STDC_LIMIT_MACROS |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
32 |
#include <stdint.h> |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
33 |
#endif |
6071
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
34 |
#else |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
35 |
#define INT64_MAX 9223372036854775807LL |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
36 |
#define INT64_MIN (-INT64_MAX - 1) |
6071
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
37 |
#endif |
c37b45d0109b
(svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents:
6063
diff
changeset
|
38 |
|
6184
3cfe1dfa7a04
(svn r8572) -Fix: use the C++ version of the Standard C Library headers. This due to the fact that some stl headers will include them anyway and #undef several defines made in stdafx.h.
rubidium
parents:
6094
diff
changeset
|
39 |
#include <cstdio> |
3cfe1dfa7a04
(svn r8572) -Fix: use the C++ version of the Standard C Library headers. This due to the fact that some stl headers will include them anyway and #undef several defines made in stdafx.h.
rubidium
parents:
6094
diff
changeset
|
40 |
#include <cstddef> |
3cfe1dfa7a04
(svn r8572) -Fix: use the C++ version of the Standard C Library headers. This due to the fact that some stl headers will include them anyway and #undef several defines made in stdafx.h.
rubidium
parents:
6094
diff
changeset
|
41 |
#include <cstring> |
3cfe1dfa7a04
(svn r8572) -Fix: use the C++ version of the Standard C Library headers. This due to the fact that some stl headers will include them anyway and #undef several defines made in stdafx.h.
rubidium
parents:
6094
diff
changeset
|
42 |
#include <cstdlib> |
3cfe1dfa7a04
(svn r8572) -Fix: use the C++ version of the Standard C Library headers. This due to the fact that some stl headers will include them anyway and #undef several defines made in stdafx.h.
rubidium
parents:
6094
diff
changeset
|
43 |
#include <climits> |
0 | 44 |
|
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
45 |
/* MacOS X will use an NSAlert to display failed assertaions since they're lost unless running from a terminal |
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
46 |
* strgen always runs from terminal and don't need a window for asserts */ |
2731
97a409a62741
(svn r3276) reverted the last two commits. OSX 10.2 kept finding new stuff to prevent it from running OpenTTD, so now it's not supported anymore
bjarni
parents:
2730
diff
changeset
|
47 |
#if !defined(__APPLE__) || defined(STRGEN) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
48 |
#include <cassert> |
2223
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
49 |
#else |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
50 |
#include "os/macosx/macos.h" |
2223
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
51 |
#endif |
29d61b962cb0
(svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents:
2186
diff
changeset
|
52 |
|
858
329ff519fb45
(svn r1339) -Fix: compilation with networking works on MinGW32 again (thx orudge).
darkvater
parents:
796
diff
changeset
|
53 |
#if defined(UNIX) || defined(__MINGW32__) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
54 |
#include <sys/types.h> |
0 | 55 |
#endif |
56 |
||
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
57 |
#if defined(__OS2__) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
58 |
#include <types.h> |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
59 |
#define strcasecmp stricmp |
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
60 |
#endif |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
61 |
|
6227
ab74f5faf662
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents:
6218
diff
changeset
|
62 |
#if defined(PSP) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
63 |
#include <psptypes.h> |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
64 |
#include <pspdebug.h> |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
65 |
#include <pspthreadman.h> |
446
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
66 |
#endif |
20304ea8e94e
(svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents:
425
diff
changeset
|
67 |
|
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
68 |
#if defined(__BEOS__) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
69 |
#include <SupportDefs.h> |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
70 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
71 |
|
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
72 |
#if defined(SUNOS) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
73 |
#include <alloca.h> |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
74 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
75 |
|
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
76 |
#if defined(__MORPHOS__) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
77 |
/* MorphOS defines certain Amiga defines per default, we undefine them |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
78 |
* here to make the rest of source less messy and more clear what is |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
79 |
* required for morphos and what for AmigaOS */ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
80 |
#if defined(amigaos) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
81 |
#undef amigaos |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
82 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
83 |
#if defined(__amigaos__) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
84 |
#undef __amigaos__ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
85 |
# endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
86 |
#if defined(__AMIGA__) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
87 |
#undef __AMIGA__ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
88 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
89 |
#if defined(AMIGA) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
90 |
#undef AMIGA |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
91 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
92 |
#if defined(amiga) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
93 |
#undef amiga |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
94 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
95 |
/* Act like we already included this file, as it somehow gives linkage problems |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
96 |
* (mismatch linkage of C++ and C between this include and unistd.h). */ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
97 |
#define CLIB_USERGROUP_PROTOS_H |
770
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
98 |
#endif /* __MORPHOS__ */ |
89dab23f04ca
(svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents:
569
diff
changeset
|
99 |
|
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
100 |
#if defined(__APPLE__) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
101 |
#include "os/macosx/osx_stdafx.h" |
3289 | 102 |
#endif /* __APPLE__ */ |
0 | 103 |
|
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
6198
diff
changeset
|
104 |
#if defined(PSP) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
105 |
/* PSP can only have 10 file-descriptors open at any given time, but this |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
106 |
* switch only limits reads via the Fio system. So keep 2 fds free for things |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
107 |
* like saving a game. */ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
108 |
#define LIMITED_FDS 8 |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
109 |
#define printf pspDebugScreenPrintf |
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
6198
diff
changeset
|
110 |
#endif /* PSP */ |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
6198
diff
changeset
|
111 |
|
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
112 |
/* by default we use [] var arrays */ |
0 | 113 |
#define VARARRAY_SIZE |
114 |
||
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
115 |
/* Stuff for GCC */ |
0 | 116 |
#if defined(__GNUC__) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
117 |
#define NORETURN __attribute__ ((noreturn)) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
118 |
#define FORCEINLINE inline |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
119 |
#define CDECL |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
120 |
#define __int64 long long |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
121 |
#define GCC_PACK __attribute__((packed)) |
0 | 122 |
|
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
123 |
#if (__GNUC__ == 2) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
124 |
#undef VARARRAY_SIZE |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
125 |
#define VARARRAY_SIZE 0 |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
126 |
#endif |
2485
fd92a70a064a
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
127 |
#endif /* __GNUC__ */ |
0 | 128 |
|
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
129 |
#if defined(__WATCOMC__) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
130 |
#define NORETURN |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
131 |
#define FORCEINLINE inline |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
132 |
#define CDECL |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
133 |
#define GCC_PACK |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
134 |
#include <malloc.h> |
2485
fd92a70a064a
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
135 |
#endif /* __WATCOMC__ */ |
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
136 |
|
796 | 137 |
#if defined(__MINGW32__) || defined(__CYGWIN__) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
138 |
#include <malloc.h> // alloca() |
796 | 139 |
#endif |
140 |
||
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
141 |
/* Stuff for MSVC */ |
0 | 142 |
#if defined(_MSC_VER) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
143 |
#pragma once |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
144 |
/* Define a win32 target platform, to override defaults of the SDK |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
145 |
* We need to define NTDDI version for Vista SDK, but win2k is minimum */ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
146 |
#define NTDDI_VERSION NTDDI_WIN2K // Windows 2000 |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
147 |
#define _WIN32_WINNT 0x0500 // Windows 2000 |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
148 |
#define _WIN32_WINDOWS 0x400 // Windows 95 |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
149 |
#if !defined(WINCE) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
150 |
#define WINVER 0x0400 // Windows NT 4.0 / Windows 95 |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
151 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
152 |
#define _WIN32_IE_ 0x0401 // 4.01 (win98 and NT4SP5+) |
2695
395110265c87
(svn r3237) - CodeChange: remove silencing of some warnings. MSVC6 once again has some issues with enums, and other things as usual, so silence those still.
Darkvater
parents:
2694
diff
changeset
|
153 |
|
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
154 |
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
155 |
#pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
156 |
#pragma warning(disable: 4761) // integral size mismatch in argument : conversion supplied |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
157 |
#pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union |
2485
fd92a70a064a
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
158 |
|
8905
a6974b6041d9
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
rubidium
parents:
8869
diff
changeset
|
159 |
#if (_MSC_VER < 1400) // MSVC 2005 safety checks |
a6974b6041d9
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
rubidium
parents:
8869
diff
changeset
|
160 |
#error "Only MSVC 2005 or higher are supported. MSVC 2003 and earlier are not!. Upgrade your compiler." |
a6974b6041d9
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
rubidium
parents:
8869
diff
changeset
|
161 |
#endif /* (_MSC_VER < 1400) */ |
a6974b6041d9
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
rubidium
parents:
8869
diff
changeset
|
162 |
#pragma warning(disable: 4996) // 'strdup' was declared deprecated |
a6974b6041d9
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
rubidium
parents:
8869
diff
changeset
|
163 |
#define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions |
a6974b6041d9
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
rubidium
parents:
8869
diff
changeset
|
164 |
#pragma warning(disable: 6308) // code analyzer: 'realloc' might return null pointer: assigning null pointer to 't_ptr', which is passed as an argument to 'realloc', will cause the original memory block to be leaked |
a6974b6041d9
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
rubidium
parents:
8869
diff
changeset
|
165 |
#pragma warning(disable: 6011) // code analyzer: Dereferencing NULL pointer 'pfGetAddrInfo': Lines: 995, 996, 998, 999, 1001 |
a6974b6041d9
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
rubidium
parents:
8869
diff
changeset
|
166 |
#pragma warning(disable: 6326) // code analyzer: potential comparison of a constant with another constant |
a6974b6041d9
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
rubidium
parents:
8869
diff
changeset
|
167 |
#pragma warning(disable: 6031) // code analyzer: Return value ignored: 'ReadFile' |
a6974b6041d9
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
rubidium
parents:
8869
diff
changeset
|
168 |
#pragma warning(disable: 6255) // code analyzer: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead |
a6974b6041d9
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
rubidium
parents:
8869
diff
changeset
|
169 |
#pragma warning(disable: 6246) // code analyzer: Local declaration of 'statspec' hides declaration of the same name in outer scope. For additional information, see previous declaration at ... |
2694
99d88a9d5337
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
170 |
|
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
171 |
#include <malloc.h> // alloca() |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
172 |
#define NORETURN __declspec(noreturn) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
173 |
#define FORCEINLINE __forceinline |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
174 |
#define inline _inline |
2694
99d88a9d5337
(svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents:
2639
diff
changeset
|
175 |
|
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
176 |
#if !defined(WINCE) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
177 |
#define CDECL _cdecl |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
178 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
179 |
|
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
180 |
int CDECL snprintf(char *str, size_t size, const char *format, ...); |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
181 |
#if (_MSC_VER < 1400) || defined(WINCE) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
182 |
int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap); |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
183 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
184 |
|
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
185 |
#if defined(WIN32) && !defined(_WIN64) && !defined(WIN64) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
186 |
#if !defined(_W64) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
187 |
#define _W64 |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
188 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
189 |
|
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
190 |
typedef _W64 int INT_PTR, *PINT_PTR; |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
191 |
typedef _W64 unsigned int UINT_PTR, *PUINT_PTR; |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
192 |
#endif /* WIN32 && !_WIN64 && !WIN64 */ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
193 |
|
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
194 |
#define GCC_PACK |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
195 |
|
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
196 |
/* This is needed to zlib uses the stdcall calling convention on visual studio */ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
197 |
#if defined(WITH_ZLIB) || defined(WITH_PNG) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
198 |
#if !defined(ZLIB_WINAPI) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
199 |
#define ZLIB_WINAPI |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
200 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
201 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
202 |
|
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
203 |
#if defined(WINCE) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
204 |
#define strcasecmp _stricmp |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
205 |
#define strncasecmp _strnicmp |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
206 |
#undef DEBUG |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
207 |
#else |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
208 |
#define strcasecmp stricmp |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
209 |
#define strncasecmp strnicmp |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
210 |
#endif |
8547
41d5e08fff3b
(svn r11611) -Codechange: it is now possible to use a define to enable asserts and show them in crash.log for MSVC release builds
glx
parents:
8546
diff
changeset
|
211 |
|
41d5e08fff3b
(svn r11611) -Codechange: it is now possible to use a define to enable asserts and show them in crash.log for MSVC release builds
glx
parents:
8546
diff
changeset
|
212 |
void SetExceptionString(const char* s, ...); |
41d5e08fff3b
(svn r11611) -Codechange: it is now possible to use a define to enable asserts and show them in crash.log for MSVC release builds
glx
parents:
8546
diff
changeset
|
213 |
|
41d5e08fff3b
(svn r11611) -Codechange: it is now possible to use a define to enable asserts and show them in crash.log for MSVC release builds
glx
parents:
8546
diff
changeset
|
214 |
#if defined(NDEBUG) && defined(WITH_ASSERT) |
41d5e08fff3b
(svn r11611) -Codechange: it is now possible to use a define to enable asserts and show them in crash.log for MSVC release builds
glx
parents:
8546
diff
changeset
|
215 |
#undef assert |
41d5e08fff3b
(svn r11611) -Codechange: it is now possible to use a define to enable asserts and show them in crash.log for MSVC release builds
glx
parents:
8546
diff
changeset
|
216 |
#define assert(expression) if (!(expression)) { SetExceptionString("Assertion failed at %s:%d: %s", __FILE__, __LINE__, #expression); *(byte*)0 = 0; } |
41d5e08fff3b
(svn r11611) -Codechange: it is now possible to use a define to enable asserts and show them in crash.log for MSVC release builds
glx
parents:
8546
diff
changeset
|
217 |
#endif |
2485
fd92a70a064a
(svn r3011) Refix last revision's fix of VS6 which broke compilation on MinGW. Also beautify stdafx.h with nice indentation and comments after big #ifdef blocks. Hope it didn't break compilation on any OS's.
Darkvater
parents:
2483
diff
changeset
|
218 |
#endif /* defined(_MSC_VER) */ |
2483
ee0517ddfa92
(svn r3009) DIEEEEEEEEEEE VS6 (you good-for-nothing compiler)
Darkvater
parents:
2482
diff
changeset
|
219 |
|
6006
56ccbc3ec899
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5922
diff
changeset
|
220 |
#if defined(WINCE) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
221 |
#define strdup _strdup |
6006
56ccbc3ec899
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5922
diff
changeset
|
222 |
#endif /* WINCE */ |
56ccbc3ec899
(svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents:
5922
diff
changeset
|
223 |
|
5167
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
224 |
/* NOTE: the string returned by these functions is only valid until the next |
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
225 |
* call to the same function and is not thread- or reentrancy-safe */ |
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
226 |
#if !defined(STRGEN) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
227 |
#if defined(WIN32) || defined(WIN64) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
228 |
char *getcwd(char *buf, size_t size); |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
229 |
#include <tchar.h> |
6577
ee768d653dd0
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6559
diff
changeset
|
230 |
|
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
231 |
/* XXX - WinCE without MSVCRT doesn't support wfopen, so it seems */ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
232 |
#if !defined(WINCE) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
233 |
#define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode)) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
234 |
#endif /* WINCE */ |
6577
ee768d653dd0
(svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents:
6559
diff
changeset
|
235 |
|
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
236 |
const char *FS2OTTD(const TCHAR *name); |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
237 |
const TCHAR *OTTD2FS(const char *name); |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
238 |
#else |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
239 |
#define fopen(file, mode) fopen(OTTD2FS(file), mode) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
240 |
const char *FS2OTTD(const char *name); |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
241 |
const char *OTTD2FS(const char *name); |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
242 |
#endif /* WIN32 */ |
5167
2b9d61386688
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents:
5138
diff
changeset
|
243 |
#endif /* STRGEN */ |
2482
dffcca243dbc
(svn r3008) [ 1247535 ] Native Support for Win64 (compile&run only) (michi_cc)
Darkvater
parents:
2436
diff
changeset
|
244 |
|
5842
180c71b8fc14
(svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge
parents:
5838
diff
changeset
|
245 |
#if defined(WIN32) || defined(WIN64) || defined(__OS2__) && !defined(__INNOTEK_LIBC__) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
246 |
#define PATHSEP "\\" |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
247 |
#define PATHSEPCHAR '\\' |
4379
2866185c1377
(svn r6117) -Fix r6097: on mingw it is normal that both / as \ are accepted as input
truelight
parents:
4316
diff
changeset
|
248 |
#else |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
249 |
#define PATHSEP "/" |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
250 |
#define PATHSEPCHAR '/' |
0 | 251 |
#endif |
252 |
||
253 |
typedef unsigned char byte; |
|
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
254 |
|
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
255 |
/* This is already defined in unix, but not in QNX Neutrino (6.x)*/ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
256 |
#if (!defined(UNIX) && !defined(__CYGWIN__) && !defined(__BEOS__) && !defined(__MORPHOS__)) || defined(__QNXNTO__) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
257 |
typedef unsigned int uint; |
0 | 258 |
#endif |
259 |
||
8869
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
260 |
#if !defined(__BEOS__) && !defined(__NDS__) /* Already defined on BEOS and NDS */ |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
261 |
typedef unsigned char uint8; |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
262 |
typedef signed char int8; |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
263 |
typedef unsigned short uint16; |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
264 |
typedef signed short int16; |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
265 |
typedef unsigned int uint32; |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
266 |
typedef signed int int32; |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
267 |
typedef unsigned __int64 uint64; |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
268 |
typedef signed __int64 int64; |
8869
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
269 |
#endif /* !__BEOS__ && !__NDS__ */ |
0 | 270 |
|
7425
350b9265b7a2
(svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
rubidium
parents:
7330
diff
changeset
|
271 |
#if !defined(WITH_PERSONAL_DIR) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
272 |
#define PERSONAL_DIR "" |
0 | 273 |
#endif |
274 |
||
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
275 |
/* Compile time assertions */ |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
276 |
#if defined(__OS2__) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
277 |
#define assert_compile(expr) |
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
770
diff
changeset
|
278 |
#else |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
279 |
#define assert_compile(expr) extern "C" void __ct_assert__(int a[1 - 2 * !(expr)]) |
3900
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3624
diff
changeset
|
280 |
#endif /* __OS2__ */ |
0 | 281 |
|
9174
4a7b5962abd6
(svn r12344) -Codechange: Check uint64 bitsize on compiletime too.
skidd13
parents:
8905
diff
changeset
|
282 |
/* Check if the types have the bitsizes like we are using them */ |
4a7b5962abd6
(svn r12344) -Codechange: Check uint64 bitsize on compiletime too.
skidd13
parents:
8905
diff
changeset
|
283 |
assert_compile(sizeof(uint64) == 8); |
0 | 284 |
assert_compile(sizeof(uint32) == 4); |
285 |
assert_compile(sizeof(uint16) == 2); |
|
2639 | 286 |
assert_compile(sizeof(uint8) == 1); |
0 | 287 |
|
288 |
#define lengthof(x) (sizeof(x)/sizeof(x[0])) |
|
289 |
#define endof(x) (&x[lengthof(x)]) |
|
1317
f382f1b439c7
(svn r1821) Move generic string handling functions to string.[ch] and introduce stre{cpy,cat}, see string.h for their semantics
tron
parents:
1022
diff
changeset
|
290 |
#define lastof(x) (&x[lengthof(x) - 1]) |
5922
510e1bbc5992
(svn r8131) -Fix (r8125): g++ warning: 'invalid access to non-static data member ?<class>::<member>? of NULL object'. It is weird, but renaming the 'offsetof' macro helped.
KUDr
parents:
5842
diff
changeset
|
291 |
|
6409
55217fea8342
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
6227
diff
changeset
|
292 |
#define cpp_offsetof(s,m) (((size_t)&reinterpret_cast<const volatile char&>((((s*)(char*)8)->m))) - 8) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
293 |
#if !defined(offsetof) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
294 |
#define offsetof(s,m) cpp_offsetof(s, m) |
6409
55217fea8342
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents:
6227
diff
changeset
|
295 |
#endif /* offsetof */ |
0 | 296 |
|
297 |
||
6185
be6627364fa3
(svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents:
6184
diff
changeset
|
298 |
/* take care of some name clashes on MacOS */ |
0 | 299 |
#if defined(__APPLE__) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
300 |
#define GetString OTTD_GetString |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
301 |
#define DrawString OTTD_DrawString |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
302 |
#define CloseConnection OTTD_CloseConnection |
8622
b917f0b0dd6b
(svn r11687) -Codechange: move some defines to a better place
skidd13
parents:
8619
diff
changeset
|
303 |
#endif /* __APPLE__ */ |
569
2e86ae517874
(svn r980) Fixed issues where MorphOS would get problems if AmigaOS would get a port, since MorphOS also have the flag __AMIGA__ defined (Tokai)
bjarni
parents:
543
diff
changeset
|
304 |
|
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
305 |
#if !defined(STRGEN) |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
306 |
/* In strgen error is not fatal and returns */ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
307 |
void NORETURN CDECL error(const char *str, ...); |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
308 |
#else |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
309 |
void CDECL error(const char *str, ...); |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
310 |
#endif |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
311 |
|
7118
2cc02ab0557d
(svn r9842) -Codechange: now NOT_REACHED is also triggered when debugging is disabled.
rubidium
parents:
7020
diff
changeset
|
312 |
#define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__) |
2cc02ab0557d
(svn r9842) -Codechange: now NOT_REACHED is also triggered when debugging is disabled.
rubidium
parents:
7020
diff
changeset
|
313 |
|
8869
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
314 |
#if defined(MORPHOS) || defined(__NDS__) |
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
315 |
/* MorphOS and NDS don't have C++ conformant _stricmp... */ |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
316 |
#define _stricmp stricmp |
7771
e6f9227cf0fc
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7762
diff
changeset
|
317 |
#elif defined(OPENBSD) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
318 |
/* OpenBSD uses strcasecmp(3) */ |
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
319 |
#define _stricmp strcasecmp |
7771
e6f9227cf0fc
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7762
diff
changeset
|
320 |
#endif |
e6f9227cf0fc
(svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents:
7762
diff
changeset
|
321 |
|
8869
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
322 |
#if !defined(MORPHOS) && !defined(OPENBSD) && !defined(__NDS__) |
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
323 |
/* NDS, MorphOS & OpenBSD don't know wchars, the rest does :( */ |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
324 |
#define HAS_WCHAR |
8869
1e62a45d7599
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents:
8788
diff
changeset
|
325 |
#endif /* !defined(MORPHOS) && !defined(OPENBSD) && !defined(__NDS__) */ |
7751
99bcdf28a226
(svn r10562) -Fix: most of the MorphOS issues; MorphOS doesn't know about wchars, so disable all code that has to use wchars for MorphOS.
rubidium
parents:
7650
diff
changeset
|
326 |
|
7762
03721db0ac1c
(svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents:
7751
diff
changeset
|
327 |
#if !defined(MAX_PATH) |
8500
39a092b5cc2f
(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents:
8423
diff
changeset
|
328 |
#define MAX_PATH 260 |
7762
03721db0ac1c
(svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents:
7751
diff
changeset
|
329 |
#endif |
03721db0ac1c
(svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents:
7751
diff
changeset
|
330 |
|
8619
c2434269c3eb
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8547
diff
changeset
|
331 |
/** |
c2434269c3eb
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8547
diff
changeset
|
332 |
* The largest value that can be entered in a variable |
c2434269c3eb
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8547
diff
changeset
|
333 |
* @param type the type of the variable |
c2434269c3eb
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8547
diff
changeset
|
334 |
*/ |
c2434269c3eb
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8547
diff
changeset
|
335 |
#define MAX_UVALUE(type) ((type)~(type)0) |
c2434269c3eb
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8547
diff
changeset
|
336 |
|
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2225
diff
changeset
|
337 |
#endif /* STDAFX_H */ |