From 8754c86686116cd937f5483a65a5eeda48cca02d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 10 May 2011 11:02:08 +0200 Subject: COMMON: Refactor typedefs a bit --- common/scummsys.h | 125 +++++++++++++++++++++++++++--------------------------- 1 file changed, 62 insertions(+), 63 deletions(-) diff --git a/common/scummsys.h b/common/scummsys.h index e1c99efa6e..8ba983fd6c 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -136,10 +136,6 @@ // - Define this on a big endian target // SCUMM_NEED_ALIGNMENT // - Define this if your system has problems reading e.g. an int32 from an odd address -// SCUMMVM_DONT_DEFINE_TYPES -// - Define this if you need to provide your own typedefs, e.g. because your -// system headers conflict with our typenames, or because you have odd -// type requirements. // SMALL_SCREEN_DEVICE // - ... // ... @@ -161,30 +157,12 @@ #if defined(HAVE_CONFIG_H) // All settings should have been set in config.h - #define SCUMMVM_DONT_DEFINE_TYPES #elif defined(__SYMBIAN32__) #define SCUMM_LITTLE_ENDIAN #define SCUMM_NEED_ALIGNMENT - // Enable Symbians own datatypes - // This is done for two reasons - // a) uint is already defined by Symbians libc component - // b) Symbian is using its "own" datatyping, and the Scummvm port - // should follow this to ensure the best compability possible. - #define SCUMMVM_DONT_DEFINE_TYPES - typedef unsigned char byte; - - typedef unsigned char uint8; - typedef signed char int8; - - typedef unsigned short int uint16; - typedef signed short int int16; - - typedef unsigned long int uint32; - typedef signed long int int32; - #elif defined(_WIN32_WCE) #define SCUMM_LITTLE_ENDIAN @@ -197,19 +175,16 @@ #define SCUMM_LITTLE_ENDIAN -#elif defined(UNIX) - - #if !defined(CONFIG_H) && defined(SDL_BACKEND) - /* need this for the SDL_BYTEORDER define */ - #include +#elif defined(SDL_BACKEND) + /* need this for the SDL_BYTEORDER define */ + #include - #if SDL_BYTEORDER == SDL_LIL_ENDIAN - #define SCUMM_LITTLE_ENDIAN - #elif SDL_BYTEORDER == SDL_BIG_ENDIAN - #define SCUMM_BIG_ENDIAN - #else - #error Neither SDL_BIG_ENDIAN nor SDL_LIL_ENDIAN is set. - #endif + #if SDL_BYTEORDER == SDL_LIL_ENDIAN + #define SCUMM_LITTLE_ENDIAN + #elif SDL_BYTEORDER == SDL_BIG_ENDIAN + #define SCUMM_BIG_ENDIAN + #else + #error Neither SDL_BIG_ENDIAN nor SDL_LIL_ENDIAN is set. #endif #elif defined(__DC__) @@ -222,19 +197,6 @@ #define SCUMM_LITTLE_ENDIAN #define SCUMM_NEED_ALIGNMENT - // Override typenames. uint is already defined by system header files. - #define SCUMMVM_DONT_DEFINE_TYPES - typedef unsigned char byte; - - typedef unsigned char uint8; - typedef signed char int8; - - typedef unsigned short int uint16; - typedef signed short int int16; - - typedef unsigned long int uint32; - typedef signed long int int32; - #elif defined(__PLAYSTATION2__) #define SCUMM_LITTLE_ENDIAN @@ -245,18 +207,6 @@ #define SCUMM_BIG_ENDIAN #define SCUMM_NEED_ALIGNMENT - #define SCUMMVM_DONT_DEFINE_TYPES - typedef unsigned char byte; - - typedef unsigned char uint8; - typedef signed char int8; - - typedef unsigned short int uint16; - typedef signed short int int16; - - typedef unsigned int uint32; - typedef signed int int32; - #elif defined(__PSP__) #define SCUMM_LITTLE_ENDIAN @@ -272,8 +222,6 @@ #define SCUMM_NEED_ALIGNMENT #define SCUMM_LITTLE_ENDIAN - #define SCUMMVM_DONT_DEFINE_TYPES - #elif defined(__WII__) #define SCUMM_BIG_ENDIAN @@ -384,9 +332,60 @@ // -// Typedef our system types unless SCUMMVM_DONT_DEFINE_TYPES is set. +// Typedef our system types // -#ifndef SCUMMVM_DONT_DEFINE_TYPES +#if !defined(HAVE_CONFIG_H) && defined(__SYMBIAN32__) + + // Enable Symbians own datatypes + // This is done for two reasons + // a) uint is already defined by Symbians libc component + // b) Symbian is using its "own" datatyping, and the Scummvm port + // should follow this to ensure the best compability possible. + typedef unsigned char byte; + + typedef unsigned char uint8; + typedef signed char int8; + + typedef unsigned short int uint16; + typedef signed short int int16; + + typedef unsigned long int uint32; + typedef signed long int int32; + +#elif !defined(HAVE_CONFIG_H) && defined(__GP32__) + + // Override typenames. uint is already defined by system header files. + typedef unsigned char byte; + + typedef unsigned char uint8; + typedef signed char int8; + + typedef unsigned short int uint16; + typedef signed short int int16; + + typedef unsigned long int uint32; + typedef signed long int int32; + +#elif !defined(HAVE_CONFIG_H) && defined(__N64__) + + typedef unsigned char byte; + + typedef unsigned char uint8; + typedef signed char int8; + + typedef unsigned short int uint16; + typedef signed short int int16; + + typedef unsigned int uint32; + typedef signed int int32; + +#elif !defined(HAVE_CONFIG_H) && defined(__DS__) + + // Do nothing, the SDK defines all types we need in nds/ndstypes.h, + // which we include in our portsdef.h + +#else + typedef unsigned char byte; typedef unsigned char uint8; typedef signed char int8; -- cgit v1.2.3