1
0
Fork 0

(svn r11563) -Codechange: Align the preprocessor code in stdafx.h with tabs

release/0.6
skidd13 2007-12-02 21:43:16 +00:00
parent fe76841255
commit 1a43c6a6f6
1 changed files with 224 additions and 227 deletions

View File

@ -53,33 +53,33 @@
#include <psptypes.h>
#include <pspdebug.h>
#include <pspthreadman.h>
#endif /* PSP */
#endif
#ifdef __BEOS__
#if defined(__BEOS__)
#include <SupportDefs.h>
#endif
#ifdef SUNOS
#if defined(SUNOS)
#include <alloca.h>
#endif
#ifdef __MORPHOS__
#if defined(__MORPHOS__)
/* MorphOS defines certain Amiga defines per default, we undefine them
* here to make the rest of source less messy and more clear what is
* required for morphos and what for AmigaOS */
# ifdef amigaos
#if defined(amigaos)
#undef amigaos
#endif
# ifdef __amigaos__
#if defined(__amigaos__)
#undef __amigaos__
# endif
# ifdef __AMIGA__
#if defined(__AMIGA__)
#undef __AMIGA__
#endif
# ifdef AMIGA
#if defined(AMIGA)
#undef AMIGA
#endif
# ifdef amiga
#if defined(amiga)
#undef amiga
#endif
/* Act like we already included this file, as it somehow gives linkage problems
@ -87,7 +87,7 @@
#define CLIB_USERGROUP_PROTOS_H
#endif /* __MORPHOS__ */
#ifdef __APPLE__
#if defined(__APPLE__)
#include "os/macosx/osx_stdafx.h"
/* Make endian swapping use Apple's macros to increase speed (since it will use hardware swapping if available)
* Even though they should return uint16 and uint32, we get warnings if we don't cast those (why?) */
@ -109,7 +109,6 @@
/* by default we use [] var arrays */
#define VARARRAY_SIZE
/* Stuff for GCC */
#if defined(__GNUC__)
#define NORETURN __attribute__ ((noreturn))
@ -143,7 +142,6 @@
* We need to define NTDDI version for Vista SDK, but win2k is minimum */
#define NTDDI_VERSION NTDDI_WIN2K // Windows 2000
#define _WIN32_WINNT 0x0500 // Windows 2000
#define _WIN32_WINDOWS 0x400 // Windows 95
#if !defined(WINCE)
#define WINVER 0x0400 // Windows NT 4.0 / Windows 95
@ -155,7 +153,7 @@
#pragma warning(disable: 4761) // integral size mismatch in argument : conversion supplied
#pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union
# if _MSC_VER >= 1400 // MSVC 2005 safety checks
#if (_MSC_VER >= 1400) // MSVC 2005 safety checks
#pragma warning(disable: 4996) // 'strdup' was declared deprecated
#define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions
#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
@ -173,18 +171,21 @@
#define NORETURN __declspec(noreturn)
#define FORCEINLINE __forceinline
#define inline _inline
#if !defined(WINCE)
#define CDECL _cdecl
#endif
int CDECL snprintf(char *str, size_t size, const char *format, ...);
# if _MSC_VER < 1400 || defined(WINCE)
#if (_MSC_VER < 1400) || defined(WINCE)
int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap);
#endif
#if defined(WIN32) && !defined(_WIN64) && !defined(WIN64)
# ifndef _W64
#if !defined(_W64)
#define _W64
#endif
typedef _W64 int INT_PTR, *PINT_PTR;
typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
#endif /* WIN32 && !_WIN64 && !WIN64 */
@ -193,7 +194,7 @@
/* This is needed to zlib uses the stdcall calling convention on visual studio */
#if defined(WITH_ZLIB) || defined(WITH_PNG)
# ifndef ZLIB_WINAPI
#if !defined(ZLIB_WINAPI)
#define ZLIB_WINAPI
#endif
#endif
@ -219,6 +220,7 @@
#if defined(WIN32) || defined(WIN64)
char *getcwd(char *buf, size_t size);
#include <tchar.h>
/* XXX - WinCE without MSVCRT doesn't support wfopen, so it seems */
#if !defined(WINCE)
#define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode))
@ -227,7 +229,6 @@ char *getcwd(char *buf, size_t size);
const char *FS2OTTD(const TCHAR *name);
const TCHAR *OTTD2FS(const char *name);
#else
#define fopen(file, mode) fopen(OTTD2FS(file), mode)
const char *FS2OTTD(const char *name);
const char *OTTD2FS(const char *name);
@ -238,6 +239,7 @@ char *getcwd(char *buf, size_t size);
#if defined(WIN32) || defined(__OS2__) || defined(WIN64)
#define TTD_LITTLE_ENDIAN
#elif defined(TESTING)
/* Do noting */
#else
/* Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile */
#if defined(STRGEN)
@ -256,28 +258,22 @@ char *getcwd(char *buf, size_t size);
#endif
typedef unsigned char byte;
#ifndef __BEOS__ /* already defined */
/* This is already defined in unix, but not in QNX Neutrino (6.x)*/
#if (!defined(UNIX) && !defined(__CYGWIN__) && !defined(__BEOS__) && !defined(__MORPHOS__)) || defined(__QNXNTO__)
typedef unsigned int uint;
#endif
#if !defined(__BEOS__) /* Already defined on BEOS */
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
#endif
/* This is already defined in unix */
#if !defined(UNIX) && !defined(__CYGWIN__) && !defined(__BEOS__) && !defined(__MORPHOS__)
typedef unsigned int uint;
#endif
/* Not defined in QNX Neutrino (6.x) */
#if defined(__QNXNTO__)
typedef unsigned int uint;
#endif
#ifndef __BEOS__
typedef signed char int8;
typedef unsigned short uint16;
typedef signed short int16;
typedef unsigned int uint32;
typedef signed int int32;
typedef signed __int64 int64;
typedef unsigned __int64 uint64;
#endif /* !__BEOS__ */
typedef signed __int64 int64;
#endif
#if defined(ARM) || defined(__arm__) || defined(__alpha__)
#define OTTD_ALIGNMENT
@ -285,27 +281,27 @@ typedef unsigned char byte;
/* Setup alignment and conversion macros */
#if defined(TTD_BIG_ENDIAN)
static inline uint32 TO_LE32(uint32 x) { return BSWAP32(x); }
static inline uint16 TO_LE16(uint16 x) { return BSWAP16(x); }
static inline uint32 FROM_LE32(uint32 x) { return BSWAP32(x); }
static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); }
# define TO_BE32(x) (x)
# define TO_BE16(x) (x)
# define FROM_BE32(x) (x)
# define FROM_BE16(x) (x)
# define TO_LE32X(x) BSWAP32(x)
#define TO_BE32X(x) (x)
#define FROM_BE32(x) (x)
#define TO_BE32(x) (x)
#define FROM_BE16(x) (x)
#define TO_BE16(x) (x)
#define TO_LE32X(x) BSWAP32(x)
static inline uint32 FROM_LE32(uint32 x) { return BSWAP32(x); }
static inline uint32 TO_LE32(uint32 x) { return BSWAP32(x); }
static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); }
static inline uint16 TO_LE16(uint16 x) { return BSWAP16(x); }
#else
static inline uint32 TO_BE32(uint32 x) { return BSWAP32(x); }
static inline uint16 TO_BE16(uint16 x) { return BSWAP16(x); }
static inline uint32 FROM_BE32(uint32 x) { return BSWAP32(x); }
static inline uint16 FROM_BE16(uint16 x) { return BSWAP16(x); }
# define TO_LE32(x) (x)
# define TO_LE16(x) (x)
# define FROM_LE32(x) (x)
# define FROM_LE16(x) (x)
# define TO_LE32X(x) (x)
#define TO_BE32X(x) BSWAP32(x)
static inline uint32 FROM_BE32(uint32 x) { return BSWAP32(x); }
static inline uint32 TO_BE32(uint32 x) { return BSWAP32(x); }
static inline uint16 FROM_BE16(uint16 x) { return BSWAP16(x); }
static inline uint16 TO_BE16(uint16 x) { return BSWAP16(x); }
#define TO_LE32X(x) (x)
#define FROM_LE32(x) (x)
#define TO_LE32(x) (x)
#define FROM_LE16(x) (x)
#define TO_LE16(x) (x)
#endif /* TTD_BIG_ENDIAN */
#if !defined(WITH_PERSONAL_DIR)
@ -313,7 +309,7 @@ typedef unsigned char byte;
#endif
/* Compile time assertions */
#ifdef __OS2__
#if defined(__OS2__)
#define assert_compile(expr)
#else
#define assert_compile(expr) extern "C" void __ct_assert__(int a[1 - 2 * !(expr)])
@ -328,7 +324,7 @@ assert_compile(sizeof(uint8) == 1);
#define lastof(x) (&x[lengthof(x) - 1])
#define cpp_offsetof(s,m) (((size_t)&reinterpret_cast<const volatile char&>((((s*)(char*)8)->m))) - 8)
#ifndef offsetof
#if !defined(offsetof)
#define offsetof(s,m) cpp_offsetof(s, m)
#endif /* offsetof */
@ -341,17 +337,18 @@ assert_compile(sizeof(uint8) == 1);
#define CloseConnection OTTD_CloseConnection
#endif /* __APPLE */
#ifdef __AMIGA__
#if defined(__AMIGA__)
/* it seems AmigaOS already have a Point declared */
#define Point OTTD_AMIGA_POINT
#endif
void
#ifndef STRGEN
#if !defined(STRGEN)
/* In strgen error is not fatal and returns */
NORETURN
#endif /* STRGEN */
CDECL error(const char *str, ...);
void NORETURN CDECL error(const char *str, ...);
#else
void CDECL error(const char *str, ...);
#endif
#define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__)
#if defined(MORPHOS)