src/stdafx.h
author rubidium
Wed, 26 Nov 2008 01:07:49 +0000
changeset 10384 6b408b83ac34
parent 10308 72ffe5505a38
child 10385 4f9838649c7f
permissions -rw-r--r--
(svn r14635) -Change: use S_ISDIR/S_ISREG as x & S_IFREG always results false on platforms when S_IFREG is 0x0000.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2125
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2125
diff changeset
     2
9111
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 9072
diff changeset
     3
/** @file stdafx.h Definition of base types and functions in a cross-platform compatible way. */
6420
456c275f3313 (svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents: 6285
diff changeset
     4
2436
7d5df545bd5d (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
7d5df545bd5d (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
8373
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
     8
#if defined(__NDS__)
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
     9
	#include <nds/jtypes.h>
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
    10
	/* NDS' types for uint32/int32 are based on longs, which causes
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
    11
	 * trouble all over the place in OpenTTD. */
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
    12
	#define uint32 uint32_ugly_hack
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
    13
	#define int32 int32_ugly_hack
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
    14
	typedef unsigned int uint32_ugly_hack;
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
    15
	typedef signed int int32_ugly_hack;
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
    16
#endif /* __NDS__ */
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
    17
5820
4a9da174bf1b (svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents: 5812
diff changeset
    18
/* It seems that we need to include stdint.h before anything else
4a9da174bf1b (svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents: 5812
diff changeset
    19
 * We need INT64_MAX, which for most systems comes from stdint.h. However, MSVC
4a9da174bf1b (svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents: 5812
diff changeset
    20
 * does not have stdint.h and apparently neither does MorphOS, so define
7775
5ca1ba91cde2 (svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents: 7405
diff changeset
    21
 * INT64_MAX for them ourselves.
5ca1ba91cde2 (svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents: 7405
diff changeset
    22
 * Sometimes OSX headers manages to include stdint.h before this but without
5ca1ba91cde2 (svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents: 7405
diff changeset
    23
 * __STDC_LIMIT_MACROS so it will be without INT64_*. We need to define those
5ca1ba91cde2 (svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents: 7405
diff changeset
    24
 * too if this is the case. */
5ca1ba91cde2 (svn r11325) -Fix (r11312)[FS#1357]: [OSX] fixed compilation on OSX
bjarni
parents: 7405
diff changeset
    25
#if !defined(_MSC_VER) && !defined( __MORPHOS__) && !defined(_STDINT_H_)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    26
	#if defined(SUNOS)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    27
		/* SunOS/Solaris does not have stdint.h, but inttypes.h defines everything
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    28
		 * stdint.h defines and we need. */
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    29
		#include <inttypes.h>
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    30
	# else
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    31
		#define __STDC_LIMIT_MACROS
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    32
		#include <stdint.h>
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    33
	#endif
5820
4a9da174bf1b (svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents: 5812
diff changeset
    34
#else
8825
c5af79334951 (svn r12573) -Codechange: use defined constants instead of numbers in math_func.hpp
smatz
parents: 8823
diff changeset
    35
	#define UINT64_MAX (18446744073709551615ULL)
c5af79334951 (svn r12573) -Codechange: use defined constants instead of numbers in math_func.hpp
smatz
parents: 8823
diff changeset
    36
	#define INT64_MAX  (9223372036854775807LL)
c5af79334951 (svn r12573) -Codechange: use defined constants instead of numbers in math_func.hpp
smatz
parents: 8823
diff changeset
    37
	#define INT64_MIN  (-INT64_MAX - 1)
c5af79334951 (svn r12573) -Codechange: use defined constants instead of numbers in math_func.hpp
smatz
parents: 8823
diff changeset
    38
	#define UINT32_MAX (4294967295U)
c5af79334951 (svn r12573) -Codechange: use defined constants instead of numbers in math_func.hpp
smatz
parents: 8823
diff changeset
    39
	#define INT32_MAX  (2147483647)
c5af79334951 (svn r12573) -Codechange: use defined constants instead of numbers in math_func.hpp
smatz
parents: 8823
diff changeset
    40
	#define INT32_MIN  (-INT32_MAX - 1)
c5af79334951 (svn r12573) -Codechange: use defined constants instead of numbers in math_func.hpp
smatz
parents: 8823
diff changeset
    41
	#define UINT16_MAX (65535U)
c5af79334951 (svn r12573) -Codechange: use defined constants instead of numbers in math_func.hpp
smatz
parents: 8823
diff changeset
    42
	#define INT16_MAX  (32767)
c5af79334951 (svn r12573) -Codechange: use defined constants instead of numbers in math_func.hpp
smatz
parents: 8823
diff changeset
    43
	#define INT16_MIN  (-INT16_MAX - 1)
5820
4a9da174bf1b (svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents: 5812
diff changeset
    44
#endif
4a9da174bf1b (svn r8382) -Fix (r8374): moved the include of stdint.h to the front of stdafx.h
bjarni
parents: 5812
diff changeset
    45
5933
c09d80249412 (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: 5843
diff changeset
    46
#include <cstdio>
c09d80249412 (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: 5843
diff changeset
    47
#include <cstddef>
c09d80249412 (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: 5843
diff changeset
    48
#include <cstring>
c09d80249412 (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: 5843
diff changeset
    49
#include <cstdlib>
c09d80249412 (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: 5843
diff changeset
    50
#include <climits>
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
5934
46e88dcb71ff (svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents: 5933
diff changeset
    52
/* MacOS X will use an NSAlert to display failed assertaions since they're lost unless running from a terminal
46e88dcb71ff (svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents: 5933
diff changeset
    53
 * strgen always runs from terminal and don't need a window for asserts */
2731
888a994e9fe9 (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
    54
#if !defined(__APPLE__) || defined(STRGEN)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    55
	#include <cassert>
2223
b9564d70ec3d (svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents: 2186
diff changeset
    56
#else
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    57
	#include "os/macosx/macos.h"
2223
b9564d70ec3d (svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents: 2186
diff changeset
    58
#endif
b9564d70ec3d (svn r2741) -Feature: [OSX] added a window to display asserts on OSX (Tobin)
bjarni
parents: 2186
diff changeset
    59
858
9a3254670831 (svn r1339) -Fix: compilation with networking works on MinGW32 again (thx orudge).
darkvater
parents: 796
diff changeset
    60
#if defined(UNIX) || defined(__MINGW32__)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    61
	#include <sys/types.h>
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    64
#if defined(__OS2__)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    65
	#include <types.h>
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    66
	#define strcasecmp stricmp
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    67
#endif
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
    68
5976
aa1cae2b975a (svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
truelight
parents: 5967
diff changeset
    69
#if defined(PSP)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    70
	#include <psptypes.h>
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    71
	#include <pspdebug.h>
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    72
	#include <pspthreadman.h>
446
7a92ca9738e2 (svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents: 425
diff changeset
    73
#endif
7a92ca9738e2 (svn r655) Add the necessary bits to make building on SunOS/Solaris work
tron
parents: 425
diff changeset
    74
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    75
#if defined(__BEOS__)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    76
	#include <SupportDefs.h>
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    77
#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    78
9072
c4126d1e01cf (svn r12930) -Add: build support for NetBSD and HP-UX. Patch by ahoka.
rubidium
parents: 8983
diff changeset
    79
#if defined(SUNOS) || defined(HPUX)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    80
	#include <alloca.h>
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    81
#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    82
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    83
#if defined(__MORPHOS__)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    84
	/* MorphOS defines certain Amiga defines per default, we undefine them
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    85
	 * here to make the rest of source less messy and more clear what is
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    86
	 * required for morphos and what for AmigaOS */
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    87
	#if defined(amigaos)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    88
		#undef amigaos
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    89
	#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    90
	#if defined(__amigaos__)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    91
		#undef __amigaos__
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    92
	# endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    93
	#if defined(__AMIGA__)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    94
		#undef __AMIGA__
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    95
	#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    96
	#if defined(AMIGA)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    97
		#undef AMIGA
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    98
	#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
    99
	#if defined(amiga)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   100
		#undef amiga
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   101
	#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   102
	/* Act like we already included this file, as it somehow gives linkage problems
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   103
	 *  (mismatch linkage of C++ and C between this include and unistd.h). */
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   104
	#define CLIB_USERGROUP_PROTOS_H
770
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
   105
#endif /* __MORPHOS__ */
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 569
diff changeset
   106
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   107
#if defined(__APPLE__)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   108
	#include "os/macosx/osx_stdafx.h"
3289
0ec00b2d14dc (svn r4003) - Minor codebeautifier@work
Darkvater
parents: 3016
diff changeset
   109
#endif /* __APPLE__ */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   110
5967
e8c5596608ad (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: 5947
diff changeset
   111
#if defined(PSP)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   112
	/* PSP can only have 10 file-descriptors open at any given time, but this
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   113
	 *  switch only limits reads via the Fio system. So keep 2 fds free for things
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   114
	 *  like saving a game. */
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   115
	#define LIMITED_FDS 8
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   116
	#define printf pspDebugScreenPrintf
5967
e8c5596608ad (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: 5947
diff changeset
   117
#endif /* PSP */
e8c5596608ad (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: 5947
diff changeset
   118
5934
46e88dcb71ff (svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents: 5933
diff changeset
   119
/* by default we use [] var arrays */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   120
#define VARARRAY_SIZE
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   121
5934
46e88dcb71ff (svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents: 5933
diff changeset
   122
/* Stuff for GCC */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   123
#if defined(__GNUC__)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   124
	#define NORETURN __attribute__ ((noreturn))
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   125
	#define FORCEINLINE inline
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   126
	#define CDECL
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   127
	#define __int64 long long
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   128
	#define GCC_PACK __attribute__((packed))
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   129
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   130
	#if (__GNUC__ == 2)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   131
		#undef VARARRAY_SIZE
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   132
		#define VARARRAY_SIZE 0
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   133
	#endif
2485
3e83ba6adf27 (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
   134
#endif /* __GNUC__ */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   135
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
   136
#if defined(__WATCOMC__)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   137
	#define NORETURN
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   138
	#define FORCEINLINE inline
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   139
	#define CDECL
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   140
	#define GCC_PACK
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   141
	#include <malloc.h>
2485
3e83ba6adf27 (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
   142
#endif /* __WATCOMC__ */
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
   143
796
ffa693752831 (svn r1266) -Fix: fix some cygwin/mingw warnings
darkvater
parents: 781
diff changeset
   144
#if defined(__MINGW32__) || defined(__CYGWIN__)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   145
	#include <malloc.h> // alloca()
796
ffa693752831 (svn r1266) -Fix: fix some cygwin/mingw warnings
darkvater
parents: 781
diff changeset
   146
#endif
ffa693752831 (svn r1266) -Fix: fix some cygwin/mingw warnings
darkvater
parents: 781
diff changeset
   147
9997
d858e88e871a (svn r14154) -Fix (r14153): strndup is a GNU extension, so it doesn't exist on all platforms
glx
parents: 9470
diff changeset
   148
#if defined(__MINGW32__) && defined(_GNU_SOURCE)
d858e88e871a (svn r14154) -Fix (r14153): strndup is a GNU extension, so it doesn't exist on all platforms
glx
parents: 9470
diff changeset
   149
	/* For some weird reasons, SDL defines _GNU_SOURCE */
d858e88e871a (svn r14154) -Fix (r14153): strndup is a GNU extension, so it doesn't exist on all platforms
glx
parents: 9470
diff changeset
   150
	#undef _GNU_SOURCE
d858e88e871a (svn r14154) -Fix (r14153): strndup is a GNU extension, so it doesn't exist on all platforms
glx
parents: 9470
diff changeset
   151
#endif
d858e88e871a (svn r14154) -Fix (r14153): strndup is a GNU extension, so it doesn't exist on all platforms
glx
parents: 9470
diff changeset
   152
9256
02e55c458b5e (svn r13122) -Fix: WIN32_LEAN_AND_MEAN define is needed for all WIN32 compilers
glx
parents: 9117
diff changeset
   153
#if defined(WIN32)
02e55c458b5e (svn r13122) -Fix: WIN32_LEAN_AND_MEAN define is needed for all WIN32 compilers
glx
parents: 9117
diff changeset
   154
	#define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
02e55c458b5e (svn r13122) -Fix: WIN32_LEAN_AND_MEAN define is needed for all WIN32 compilers
glx
parents: 9117
diff changeset
   155
#endif
02e55c458b5e (svn r13122) -Fix: WIN32_LEAN_AND_MEAN define is needed for all WIN32 compilers
glx
parents: 9117
diff changeset
   156
5934
46e88dcb71ff (svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents: 5933
diff changeset
   157
/* Stuff for MSVC */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   158
#if defined(_MSC_VER)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   159
	#pragma once
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   160
	/* Define a win32 target platform, to override defaults of the SDK
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   161
	 * We need to define NTDDI version for Vista SDK, but win2k is minimum */
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   162
	#define NTDDI_VERSION NTDDI_WIN2K // Windows 2000
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   163
	#define _WIN32_WINNT 0x0500       // Windows 2000
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   164
	#define _WIN32_WINDOWS 0x400      // Windows 95
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   165
	#if !defined(WINCE)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   166
		#define WINVER 0x0400     // Windows NT 4.0 / Windows 95
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   167
	#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   168
	#define _WIN32_IE_ 0x0401         // 4.01 (win98 and NT4SP5+)
2695
cb39a85e267f (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
   169
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   170
	#pragma warning(disable: 4244)  // 'conversion' conversion from 'type1' to 'type2', possible loss of data
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   171
	#pragma warning(disable: 4761)  // integral size mismatch in argument : conversion supplied
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   172
	#pragma warning(disable: 4200)  // nonstandard extension used : zero-sized array in struct/union
2485
3e83ba6adf27 (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
   173
8409
de295d5e2bb4 (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: 8373
diff changeset
   174
	#if (_MSC_VER < 1400)                   // MSVC 2005 safety checks
de295d5e2bb4 (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: 8373
diff changeset
   175
		#error "Only MSVC 2005 or higher are supported. MSVC 2003 and earlier are not!. Upgrade your compiler."
de295d5e2bb4 (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: 8373
diff changeset
   176
	#endif /* (_MSC_VER < 1400) */
de295d5e2bb4 (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: 8373
diff changeset
   177
	#pragma warning(disable: 4996)   // 'strdup' was declared deprecated
de295d5e2bb4 (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: 8373
diff changeset
   178
	#define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions
de295d5e2bb4 (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: 8373
diff changeset
   179
	#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
de295d5e2bb4 (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: 8373
diff changeset
   180
	#pragma warning(disable: 6011)   // code analyzer: Dereferencing NULL pointer 'pfGetAddrInfo': Lines: 995, 996, 998, 999, 1001
de295d5e2bb4 (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: 8373
diff changeset
   181
	#pragma warning(disable: 6326)   // code analyzer: potential comparison of a constant with another constant
de295d5e2bb4 (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: 8373
diff changeset
   182
	#pragma warning(disable: 6031)   // code analyzer: Return value ignored: 'ReadFile'
de295d5e2bb4 (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: 8373
diff changeset
   183
	#pragma warning(disable: 6255)   // code analyzer: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead
de295d5e2bb4 (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: 8373
diff changeset
   184
	#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
9b5f6f369ab3 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   185
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   186
	#include <malloc.h> // alloca()
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   187
	#define NORETURN __declspec(noreturn)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   188
	#define FORCEINLINE __forceinline
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   189
	#define inline _inline
2694
9b5f6f369ab3 (svn r3236) - Fix: warnings about 'CDECL must be used with ...' on VS6
Darkvater
parents: 2639
diff changeset
   190
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   191
	#if !defined(WINCE)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   192
		#define CDECL _cdecl
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   193
	#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   194
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   195
	int CDECL snprintf(char *str, size_t size, const char *format, ...);
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   196
	#if (_MSC_VER < 1400) || defined(WINCE)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   197
		int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap);
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   198
	#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   199
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   200
	#if defined(WIN32) && !defined(_WIN64) && !defined(WIN64)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   201
		#if !defined(_W64)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   202
			#define _W64
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   203
		#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   204
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   205
		typedef _W64 int INT_PTR, *PINT_PTR;
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   206
		typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   207
	#endif /* WIN32 && !_WIN64 && !WIN64 */
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   208
9390
88d36f907e96 (svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
rubidium
parents: 9256
diff changeset
   209
	#if defined(_WIN64) || defined(WIN64)
88d36f907e96 (svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
rubidium
parents: 9256
diff changeset
   210
		#define fseek _fseeki64
88d36f907e96 (svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
rubidium
parents: 9256
diff changeset
   211
	#endif /* _WIN64 || WIN64 */
88d36f907e96 (svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
rubidium
parents: 9256
diff changeset
   212
88d36f907e96 (svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
rubidium
parents: 9256
diff changeset
   213
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   214
	#define GCC_PACK
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   215
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   216
	/* This is needed to zlib uses the stdcall calling convention on visual studio */
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   217
	#if defined(WITH_ZLIB) || defined(WITH_PNG)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   218
		#if !defined(ZLIB_WINAPI)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   219
			#define ZLIB_WINAPI
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   220
		#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   221
	#endif
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   222
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   223
	#if defined(WINCE)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   224
		#define strcasecmp _stricmp
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   225
		#define strncasecmp _strnicmp
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   226
		#undef DEBUG
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   227
	#else
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   228
		#define strcasecmp stricmp
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   229
		#define strncasecmp strnicmp
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   230
	#endif
8051
0cb6e84eb367 (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: 8050
diff changeset
   231
0cb6e84eb367 (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: 8050
diff changeset
   232
	void SetExceptionString(const char* s, ...);
0cb6e84eb367 (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: 8050
diff changeset
   233
0cb6e84eb367 (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: 8050
diff changeset
   234
	#if defined(NDEBUG) && defined(WITH_ASSERT)
0cb6e84eb367 (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: 8050
diff changeset
   235
		#undef assert
0cb6e84eb367 (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: 8050
diff changeset
   236
		#define assert(expression) if (!(expression)) { SetExceptionString("Assertion failed at %s:%d: %s", __FILE__, __LINE__, #expression); *(byte*)0 = 0; }
0cb6e84eb367 (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: 8050
diff changeset
   237
	#endif
10384
6b408b83ac34 (svn r14635) -Change: use S_ISDIR/S_ISREG as x & S_IFREG always results false on platforms when S_IFREG is 0x0000.
rubidium
parents: 10308
diff changeset
   238
6b408b83ac34 (svn r14635) -Change: use S_ISDIR/S_ISREG as x & S_IFREG always results false on platforms when S_IFREG is 0x0000.
rubidium
parents: 10308
diff changeset
   239
	/* MSVC doesn't have these :( */
6b408b83ac34 (svn r14635) -Change: use S_ISDIR/S_ISREG as x & S_IFREG always results false on platforms when S_IFREG is 0x0000.
rubidium
parents: 10308
diff changeset
   240
	#define S_ISDIR(mode) (mode & S_IFDIR)
6b408b83ac34 (svn r14635) -Change: use S_ISDIR/S_ISREG as x & S_IFREG always results false on platforms when S_IFREG is 0x0000.
rubidium
parents: 10308
diff changeset
   241
	#define S_ISREG(mode) (mode & S_IFREG)
6b408b83ac34 (svn r14635) -Change: use S_ISDIR/S_ISREG as x & S_IFREG always results false on platforms when S_IFREG is 0x0000.
rubidium
parents: 10308
diff changeset
   242
2485
3e83ba6adf27 (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
   243
#endif /* defined(_MSC_VER) */
2483
e2d5f55daf63 (svn r3009) DIEEEEEEEEEEE VS6 (you good-for-nothing compiler)
Darkvater
parents: 2482
diff changeset
   244
5755
09b36c6ee100 (svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents: 5671
diff changeset
   245
#if defined(WINCE)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   246
	#define strdup _strdup
5755
09b36c6ee100 (svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents: 5671
diff changeset
   247
#endif /* WINCE */
09b36c6ee100 (svn r8306) [WinCE] -Fix: some functions don't exists in WinCE, so give an alternative where possible
truelight
parents: 5671
diff changeset
   248
5167
12c46fb7eccf (svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents: 5138
diff changeset
   249
/* NOTE: the string returned by these functions is only valid until the next
12c46fb7eccf (svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents: 5138
diff changeset
   250
 * call to the same function and is not thread- or reentrancy-safe */
12c46fb7eccf (svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents: 5138
diff changeset
   251
#if !defined(STRGEN)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   252
	#if defined(WIN32) || defined(WIN64)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   253
		char *getcwd(char *buf, size_t size);
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   254
		#include <tchar.h>
6251
2ad87f850eb9 (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: 6233
diff changeset
   255
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   256
		/* XXX - WinCE without MSVCRT doesn't support wfopen, so it seems */
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   257
		#if !defined(WINCE)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   258
			#define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode))
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   259
		#endif /* WINCE */
6251
2ad87f850eb9 (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: 6233
diff changeset
   260
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   261
		const char *FS2OTTD(const TCHAR *name);
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   262
		const TCHAR *OTTD2FS(const char *name);
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   263
	#else
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   264
		#define fopen(file, mode) fopen(OTTD2FS(file), mode)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   265
		const char *FS2OTTD(const char *name);
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   266
		const char *OTTD2FS(const char *name);
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   267
	#endif /* WIN32 */
5167
12c46fb7eccf (svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
Darkvater
parents: 5138
diff changeset
   268
#endif /* STRGEN */
2482
374f6395847d (svn r3008) [ 1247535 ] Native Support for Win64 (compile&run only) (michi_cc)
Darkvater
parents: 2436
diff changeset
   269
5591
51e4c59c31dd (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge
parents: 5587
diff changeset
   270
#if defined(WIN32) || defined(WIN64) || defined(__OS2__) && !defined(__INNOTEK_LIBC__)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   271
	#define PATHSEP "\\"
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   272
	#define PATHSEPCHAR '\\'
4379
96eb926dcc1d (svn r6117) -Fix r6097: on mingw it is normal that both / as \ are accepted as input
truelight
parents: 4316
diff changeset
   273
#else
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   274
	#define PATHSEP "/"
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   275
	#define PATHSEPCHAR '/'
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   276
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   277
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   278
typedef unsigned char byte;
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   279
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   280
/* This is already defined in unix, but not in QNX Neutrino (6.x)*/
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   281
#if (!defined(UNIX) && !defined(__CYGWIN__) && !defined(__BEOS__) && !defined(__MORPHOS__)) || defined(__QNXNTO__)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   282
	typedef unsigned int uint;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   283
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   284
8373
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
   285
#if !defined(__BEOS__) && !defined(__NDS__) /* Already defined on BEOS and NDS */
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   286
	typedef unsigned char    uint8;
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   287
	typedef   signed char     int8;
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   288
	typedef unsigned short   uint16;
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   289
	typedef   signed short    int16;
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   290
	typedef unsigned int     uint32;
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   291
	typedef   signed int      int32;
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   292
	typedef unsigned __int64 uint64;
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   293
	typedef   signed __int64  int64;
8373
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
   294
#endif /* !__BEOS__ && !__NDS__ */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   295
6929
56470c1b8a66 (svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
rubidium
parents: 6834
diff changeset
   296
#if !defined(WITH_PERSONAL_DIR)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   297
	#define PERSONAL_DIR ""
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   298
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   299
5934
46e88dcb71ff (svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents: 5933
diff changeset
   300
/* Compile time assertions */
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   301
#if defined(__OS2__)
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   302
	#define assert_compile(expr)
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 770
diff changeset
   303
#else
9117
87f472043e9e (svn r12977) -Codechange: remove quite some redundant (duplicate) function declarations.
rubidium
parents: 9111
diff changeset
   304
	#define assert_compile(expr) extern const int __ct_assert__[1 - 2 * !(expr)]
3900
2c84ed52709d (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3624
diff changeset
   305
#endif /* __OS2__ */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   306
8678
c78f591cb317 (svn r12344) -Codechange: Check uint64 bitsize on compiletime too.
skidd13
parents: 8409
diff changeset
   307
/* Check if the types have the bitsizes like we are using them */
c78f591cb317 (svn r12344) -Codechange: Check uint64 bitsize on compiletime too.
skidd13
parents: 8409
diff changeset
   308
assert_compile(sizeof(uint64) == 8);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   309
assert_compile(sizeof(uint32) == 4);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   310
assert_compile(sizeof(uint16) == 2);
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2485
diff changeset
   311
assert_compile(sizeof(uint8)  == 1);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   312
10308
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   313
/**
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   314
 * Return the length of an fixed size array.
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   315
 * Unlike sizeof this function returns the number of elements
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   316
 * of the given type.
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   317
 *
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   318
 * @param x The pointer to the first element of the array
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   319
 * @return The number of elements
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   320
 */
9117
87f472043e9e (svn r12977) -Codechange: remove quite some redundant (duplicate) function declarations.
rubidium
parents: 9111
diff changeset
   321
#define lengthof(x) (sizeof(x) / sizeof(x[0]))
10308
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   322
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   323
/**
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   324
 * Get the end element of an fixed size array.
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   325
 *
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   326
 * @param x The pointer to the first element of the array
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   327
 * @return The pointer past to the last element of the array
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   328
 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   329
#define endof(x) (&x[lengthof(x)])
10308
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   330
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   331
/**
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   332
 * Get the last element of an fixed size array.
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   333
 *
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   334
 * @param x The pointer to the first element of the array
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   335
 * @return The pointer to the last element of the array
72ffe5505a38 (svn r14553) -Doc: Add some doxygen comments
skidd13
parents: 9997
diff changeset
   336
 */
1317
3c90086ff34f (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
   337
#define lastof(x) (&x[lengthof(x) - 1])
5671
c7b6e63f1996 (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: 5591
diff changeset
   338
8969
6d1c74e0e2cd (svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents: 8825
diff changeset
   339
#define cpp_offsetof(s, m)   (((size_t)&reinterpret_cast<const volatile char&>((((s*)(char*)8)->m))) - 8)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   340
#if !defined(offsetof)
8969
6d1c74e0e2cd (svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents: 8825
diff changeset
   341
	#define offsetof(s, m) cpp_offsetof(s, m)
6083
53aedcdb9e90 (svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
rubidium
parents: 5976
diff changeset
   342
#endif /* offsetof */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   343
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   344
5934
46e88dcb71ff (svn r8573) -Cleanup: obey the comment style in stdafx.h.
rubidium
parents: 5933
diff changeset
   345
/* take care of some name clashes on MacOS */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   346
#if defined(__APPLE__)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   347
	#define GetString OTTD_GetString
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   348
	#define DrawString OTTD_DrawString
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   349
	#define CloseConnection OTTD_CloseConnection
8126
c96febd50363 (svn r11687) -Codechange: move some defines to a better place
skidd13
parents: 8123
diff changeset
   350
#endif /* __APPLE__ */
569
1e1755ba1572 (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
   351
9470
08424e2e79e4 (svn r13390) -Codechange: introduce usererror() for fatal but not openttd related errors. Now all error() will 'crash' openttd after showing the message in win32 releases (MSVC), creating a crash.log and crash.dmp (like the '!' hack used before). On the other hand, usererror() will just close the game. So use error() only when it can be helpful to debugging, else use usererror().
glx
parents: 9390
diff changeset
   352
void NORETURN CDECL usererror(const char *str, ...);
8983
ea20f3cd2165 (svn r12777) -Codechange: rename fatal() and error() in strgen, so it can always have the NORETURN attribute
smatz
parents: 8969
diff changeset
   353
void NORETURN CDECL error(const char *str, ...);
6622
918a98fc95fb (svn r9842) -Codechange: now NOT_REACHED is also triggered when debugging is disabled.
rubidium
parents: 6524
diff changeset
   354
#define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__)
918a98fc95fb (svn r9842) -Codechange: now NOT_REACHED is also triggered when debugging is disabled.
rubidium
parents: 6524
diff changeset
   355
8373
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
   356
#if defined(MORPHOS) || defined(__NDS__)
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
   357
	/* MorphOS and NDS don't have C++ conformant _stricmp... */
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   358
	#define _stricmp stricmp
7275
81c0163435a5 (svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents: 7266
diff changeset
   359
#elif defined(OPENBSD)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   360
	/* OpenBSD uses strcasecmp(3) */
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   361
	#define _stricmp strcasecmp
7275
81c0163435a5 (svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents: 7266
diff changeset
   362
#endif
81c0163435a5 (svn r10605) -Fix [FS#1046]: also OpenBSD does not know wchar. Patch by Matthias.
rubidium
parents: 7266
diff changeset
   363
8373
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
   364
#if !defined(MORPHOS) && !defined(OPENBSD) && !defined(__NDS__)
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
   365
	/* NDS, MorphOS & OpenBSD don't know wchars, the rest does :( */
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   366
	#define HAS_WCHAR
8373
7431d91527f2 (svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
rubidium
parents: 8292
diff changeset
   367
#endif /* !defined(MORPHOS) && !defined(OPENBSD) && !defined(__NDS__) */
7255
31eec725265f (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: 7154
diff changeset
   368
7266
b16e67e992b4 (svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents: 7255
diff changeset
   369
#if !defined(MAX_PATH)
8004
1c54bc6f4bdf (svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs
skidd13
parents: 7927
diff changeset
   370
	#define MAX_PATH 260
7266
b16e67e992b4 (svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents: 7255
diff changeset
   371
#endif
b16e67e992b4 (svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents: 7255
diff changeset
   372
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8051
diff changeset
   373
/**
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8051
diff changeset
   374
 * The largest value that can be entered in a variable
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8051
diff changeset
   375
 * @param type the type of the variable
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8051
diff changeset
   376
 */
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8051
diff changeset
   377
#define MAX_UVALUE(type) ((type)~(type)0)
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8051
diff changeset
   378
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2225
diff changeset
   379
#endif /* STDAFX_H */