[Scummvm-cvs-logs] scummvm master -> 811b257014c9e30a2fea9b189b2d37751cdb2e07

fingolfin max at quendi.de
Tue May 31 14:51:21 CEST 2011


This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9c3e2e43bd COMMON: Move some code from scummsys.h to relevant portdefs.h files
2d6be5d077 COMMON: Move more stuff from scummsys.h to portdefs.h
8654e846e4 COMMON: Shorten endianess / mem align guessing logic in scummsys.h
1c198cec1b COMMON: Move some weird WinCE/MSVC snprintf-#define around
e06ca6560f COMMON: Move scumm_str(n)icmp declaration to str.h
811b257014 COMMON: Simplify OverlayColor definition


Commit: 9c3e2e43bde0c03ec012b83cd501a93a9ec4025e
    https://github.com/scummvm/scummvm/commit/9c3e2e43bde0c03ec012b83cd501a93a9ec4025e
Author: Max Horn (max at quendi.de)
Date: 2011-05-31T04:48:03-07:00

Commit Message:
COMMON: Move some code from scummsys.h to relevant portdefs.h files

Changed paths:
    backends/platform/ds/arm9/source/portdefs.h
    backends/platform/n64/portdefs.h
    backends/platform/symbian/src/portdefs.h
    common/scummsys.h



diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h
index 580eb68..f512ce3 100644
--- a/backends/platform/ds/arm9/source/portdefs.h
+++ b/backends/platform/ds/arm9/source/portdefs.h
@@ -26,8 +26,11 @@
 // Include ndstypes.h for uint16 etc. typedefs
 #include "nds/ndstypes.h"
 
-// Somebody removed these from scummsys.h, but they're still required, so I'm
-// adding them here in the hope that they'll stay.
+// Define SCUMMVM_DONT_DEFINE_TYPES to prevent scummsys.h from trying to
+// re-define those data types.
+#define SCUMMVM_DONT_DEFINE_TYPES
+
+// Include required headers
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/backends/platform/n64/portdefs.h b/backends/platform/n64/portdefs.h
index e625513..35ef3c7 100644
--- a/backends/platform/n64/portdefs.h
+++ b/backends/platform/n64/portdefs.h
@@ -35,5 +35,18 @@
 #undef assert
 #define assert(x)  ((x) ? 0 : (print_error("ASSERT TRIGGERED:\n\n("#x")\n%s\nline: %d", __FILE__, __LINE__)))
 
+// Typedef basic data types in a way that is compatible with the N64 SDK.
+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;
+
+// Define SCUMMVM_DONT_DEFINE_TYPES to prevent scummsys.h from trying to
+// re-define those data types.
+#define SCUMMVM_DONT_DEFINE_TYPES
+
 #endif
 
diff --git a/backends/platform/symbian/src/portdefs.h b/backends/platform/symbian/src/portdefs.h
index ebcd273..8ad2fa9 100644
--- a/backends/platform/symbian/src/portdefs.h
+++ b/backends/platform/symbian/src/portdefs.h
@@ -18,8 +18,10 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
+
 #ifndef SYMBIAN_PORTDEFS_H
 #define SYMBIAN_PORTDEFS_H
+
 #include <assert.h>
 #include <stdarg.h>
 #include <string.h>
@@ -37,6 +39,25 @@
 #define M_PI 3.14159265358979323846
 #endif  /*  M_PI  */
 
+
+// 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;
+
+// Define SCUMMVM_DONT_DEFINE_TYPES to prevent scummsys.h from trying to
+// re-define those data types.
+#define SCUMMVM_DONT_DEFINE_TYPES
+
+
 #define DISABLE_COMMAND_LINE
 
 #if defined(USE_TREMOR) && !defined(USE_VORBIS)
diff --git a/common/scummsys.h b/common/scummsys.h
index 5cf3ba4..cc8f3b9 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -320,75 +320,21 @@
 
 
 //
-// Typedef our system types
+// Typedef our system types unless they have already been defined by config.h,
+// or SCUMMVM_DONT_DEFINE_TYPES is set.
 //
-#if !defined(HAVE_CONFIG_H)
-
-	#if 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(__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(__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(__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;
-		typedef unsigned short uint16;
-		typedef signed short int16;
-		typedef unsigned int uint32;
-		typedef signed int int32;
-		typedef unsigned int uint;
-
-	#endif
-
+#if !defined(HAVE_CONFIG_H) && !defined(SCUMMVM_DONT_DEFINE_TYPES)
+	typedef unsigned char byte;
+	typedef unsigned char uint8;
+	typedef signed char int8;
+	typedef unsigned short uint16;
+	typedef signed short int16;
+	typedef unsigned int uint32;
+	typedef signed int int32;
+	typedef unsigned int uint;
 #endif
 
+
 //
 // Define scumm_stricmp and scumm_strnicmp
 //


Commit: 2d6be5d0771ef3c3ac5d7dac1bdb5b0aab4793c6
    https://github.com/scummvm/scummvm/commit/2d6be5d0771ef3c3ac5d7dac1bdb5b0aab4793c6
Author: Max Horn (max at quendi.de)
Date: 2011-05-31T04:56:28-07:00

Commit Message:
COMMON: Move more stuff from scummsys.h to portdefs.h

Changed paths:
    backends/platform/symbian/src/portdefs.h
    backends/platform/wince/portdefs.h
    common/scummsys.h



diff --git a/backends/platform/symbian/src/portdefs.h b/backends/platform/symbian/src/portdefs.h
index 8ad2fa9..86460e6 100644
--- a/backends/platform/symbian/src/portdefs.h
+++ b/backends/platform/symbian/src/portdefs.h
@@ -57,6 +57,7 @@ typedef signed long int int32;
 // re-define those data types.
 #define SCUMMVM_DONT_DEFINE_TYPES
 
+#define SMALL_SCREEN_DEVICE
 
 #define DISABLE_COMMAND_LINE
 
diff --git a/backends/platform/wince/portdefs.h b/backends/platform/wince/portdefs.h
index 64aa80a..93df6cd 100644
--- a/backends/platform/wince/portdefs.h
+++ b/backends/platform/wince/portdefs.h
@@ -20,40 +20,47 @@
  *
  */
 
-// Missing string/stdlib/assert declarations for WinCE 2.xx
+#ifndef WINCE_PORTDEFS_H
+#define WINCE_PORTDEFS_H
+
+#ifndef _WIN32_WCE
+#error For use on WinCE only
+#endif
 
+// Missing string/stdlib/assert declarations for WinCE 2.xx
 #if _WIN32_WCE < 300
 
-void *calloc(size_t n, size_t s);
-int isalnum(int c);
-int isdigit(int c);
-int isprint(int c);
-int isspace(int c);
-char *strrchr(const char *s, int c);
-char *strdup(const char *s);
-void assert(void *expression);
-void assert(int expression);
-long int strtol(const char *nptr, char **endptr, int base);
-char *_strdup(const char *s);
-char *strpbrk(const char *s, const char *accept);
+	#define SMALL_SCREEN_DEVICE
+
+	void *calloc(size_t n, size_t s);
+	int isalnum(int c);
+	int isdigit(int c);
+	int isprint(int c);
+	int isspace(int c);
+	char *strrchr(const char *s, int c);
+	char *strdup(const char *s);
+	void assert(void *expression);
+	void assert(int expression);
+	long int strtol(const char *nptr, char **endptr, int base);
+	char *_strdup(const char *s);
+	char *strpbrk(const char *s, const char *accept);
 
 #endif
 
-#ifdef _WIN32_WCE
 
 #ifndef __GNUC__
-void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
-char *getcwd(char *buf, int size);
-typedef int ptrdiff_t;
-void GetCurrentDirectory(int len, char *buf);
-#define INVALID_FILE_ATTRIBUTES 0xffffffff
+	void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
+	char *getcwd(char *buf, int size);
+	typedef int ptrdiff_t;
+	void GetCurrentDirectory(int len, char *buf);
+	#define INVALID_FILE_ATTRIBUTES 0xffffffff
 #else
-#include <math.h>
-#undef GetCurrentDirectory
-extern "C" void GetCurrentDirectory(int len, char *buf);
-#define snprintf _snprintf
-#define strdup _strdup
-#define fopen wce_fopen
+	#include <math.h>
+	#undef GetCurrentDirectory
+	extern "C" void GetCurrentDirectory(int len, char *buf);
+	#define snprintf _snprintf
+	#define strdup _strdup
+	#define fopen wce_fopen
 #endif
 
 #include <windows.h>
@@ -68,7 +75,7 @@ extern "C" void GetCurrentDirectory(int len, char *buf);
 //#include <direct.h>
 
 #ifdef __MINGW32CE__
-void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
+	void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
 #endif
 int remove(const char *path);
 int _access(const char *path, int mode);
@@ -77,4 +84,5 @@ void drawError(char *);
 
 #define vsnprintf _vsnprintf
 
+
 #endif
diff --git a/common/scummsys.h b/common/scummsys.h
index cc8f3b9..3000091 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -225,17 +225,7 @@
 // Some more system specific settings.
 // TODO/FIXME: All of these should be moved to backend specific files (such as portdefs.h)
 //
-#if defined(__SYMBIAN32__)
-
-	#define SMALL_SCREEN_DEVICE
-
-#elif defined(_WIN32_WCE)
-
-	#if _WIN32_WCE < 300
-	#define SMALL_SCREEN_DEVICE
-	#endif
-
-#elif defined(DINGUX)
+#if defined(DINGUX)
 
 	// Very BAD hack following, used to avoid triggering an assert in uClibc dingux library
 	// "toupper" when pressing keyboard function keys.


Commit: 8654e846e4005d25f46587188c8964dc2e0a65d9
    https://github.com/scummvm/scummvm/commit/8654e846e4005d25f46587188c8964dc2e0a65d9
Author: Max Horn (max at quendi.de)
Date: 2011-05-31T05:05:37-07:00

Commit Message:
COMMON: Shorten endianess / mem align guessing logic in scummsys.h

Changed paths:
    common/scummsys.h



diff --git a/common/scummsys.h b/common/scummsys.h
index 3000091..f7743a8 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -136,88 +136,47 @@
 //
 #define SCUMMVM_USE_PRAGMA_PACK
 
+//
+// Determine the host endianess and whether memory alignment is required.
+//
+#if !defined(HAVE_CONFIG_H)
+	#if defined(SDL_BACKEND)
+		/* need this for the SDL_BYTEORDER define */
+		#include <SDL_byteorder.h>
+
+		#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 defined(HAVE_CONFIG_H)
-	// All settings should have been set in config.h
-
-#elif defined(__SYMBIAN32__)
-
-	#define SCUMM_LITTLE_ENDIAN
-	#define SCUMM_NEED_ALIGNMENT
-
-#elif defined(_WIN32_WCE)
-
-	#define SCUMM_LITTLE_ENDIAN
+	#elif defined(__DC__) || \
+		  defined(__DS__) || \
+		  defined(__GP32__) || \
+		  defined(IPHONE) || \
+		  defined(__PLAYSTATION2__) || \
+		  defined(__PSP__) || \
+		  defined(__SYMBIAN32__)
 
-#elif defined(_MSC_VER)
+		#define SCUMM_LITTLE_ENDIAN
+		#define SCUMM_NEED_ALIGNMENT
 
-	#define SCUMM_LITTLE_ENDIAN
+	#elif defined(_WIN32_WCE) || defined(_MSC_VER) || defined(__MINGW32__)
 
-#elif defined(__MINGW32__)
+		#define SCUMM_LITTLE_ENDIAN
 
-	#define SCUMM_LITTLE_ENDIAN
+	#elif defined(__amigaos4__) || defined(__N64__) || defined(__WII__)
 
-#elif defined(SDL_BACKEND)
-	/* need this for the SDL_BYTEORDER define */
-	#include <SDL_byteorder.h>
+		#define SCUMM_BIG_ENDIAN
+		#define SCUMM_NEED_ALIGNMENT
 
-	#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__)
-
-	#define SCUMM_LITTLE_ENDIAN
-	#define SCUMM_NEED_ALIGNMENT
-
-#elif defined(__GP32__)
-
-	#define SCUMM_LITTLE_ENDIAN
-	#define SCUMM_NEED_ALIGNMENT
-
-#elif defined(__PLAYSTATION2__)
-
-	#define SCUMM_LITTLE_ENDIAN
-	#define SCUMM_NEED_ALIGNMENT
-
-#elif defined(__N64__)
 
-	#define SCUMM_BIG_ENDIAN
-	#define SCUMM_NEED_ALIGNMENT
-
-#elif defined(__PSP__)
-
-	#define	SCUMM_LITTLE_ENDIAN
-	#define	SCUMM_NEED_ALIGNMENT
-
-#elif defined(__amigaos4__)
-
-	#define	SCUMM_BIG_ENDIAN
-	#define	SCUMM_NEED_ALIGNMENT
-
-#elif defined(__DS__)
-
-	#define SCUMM_NEED_ALIGNMENT
-	#define SCUMM_LITTLE_ENDIAN
-
-#elif defined(__WII__)
-
-	#define	SCUMM_BIG_ENDIAN
-	#define	SCUMM_NEED_ALIGNMENT
-
-#elif defined(IPHONE)
-
-	#define	SCUMM_LITTLE_ENDIAN
-	#define	SCUMM_NEED_ALIGNMENT
-
-
-#else
-	#error No system type defined
+		#error No system type defined, host endianess unknown.
 
+	#endif
 #endif
 
 
@@ -284,7 +243,7 @@
 	#if defined(_MSC_VER)
 		#define NORETURN_PRE __declspec(noreturn)
 	#else
-		#define	NORETURN_PRE
+		#define NORETURN_PRE
 	#endif
 #endif
 
@@ -292,7 +251,7 @@
 	#if defined(__GNUC__) || defined(__INTEL_COMPILER)
 		#define NORETURN_POST __attribute__((__noreturn__))
 	#else
-		#define	NORETURN_POST
+		#define NORETURN_POST
 	#endif
 #endif
 


Commit: 1c198cec1b7f0f3025ca1db26a8d44b7584c6eee
    https://github.com/scummvm/scummvm/commit/1c198cec1b7f0f3025ca1db26a8d44b7584c6eee
Author: Max Horn (max at quendi.de)
Date: 2011-05-31T05:06:47-07:00

Commit Message:
COMMON: Move some weird WinCE/MSVC snprintf-#define around

Changed paths:
    common/scummsys.h



diff --git a/common/scummsys.h b/common/scummsys.h
index f7743a8..a09d6fd 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -44,6 +44,9 @@
 		#if (_MSC_VER < 1500)
 			#define vsnprintf _vsnprintf
 		#endif
+		// FIXME: Is this actually necessary for WinCE or Windows?
+		// If yes, please add corresponding comments. Otherwise, let's get rid of it!
+		#define snprintf _snprintf
 		#endif
 
 		#if !defined(_WIN32_WCE)
@@ -289,10 +292,6 @@
 //
 extern int scumm_stricmp(const char *s1, const char *s2);
 extern int scumm_strnicmp(const char *s1, const char *s2, uint n);
-#if defined(_WIN32_WCE) || defined(_MSC_VER)
-	// FIXME: Why is this necessary?
-	#define snprintf _snprintf
-#endif
 
 
 //


Commit: e06ca6560f6c4295a9cd3828abfbeec5286630c6
    https://github.com/scummvm/scummvm/commit/e06ca6560f6c4295a9cd3828abfbeec5286630c6
Author: Max Horn (max at quendi.de)
Date: 2011-05-31T05:19:25-07:00

Commit Message:
COMMON: Move scumm_str(n)icmp declaration to str.h

Changed paths:
    common/scummsys.h
    common/str.h



diff --git a/common/scummsys.h b/common/scummsys.h
index a09d6fd..7b81dab 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -288,13 +288,6 @@
 
 
 //
-// Define scumm_stricmp and scumm_strnicmp
-//
-extern int scumm_stricmp(const char *s1, const char *s2);
-extern int scumm_strnicmp(const char *s1, const char *s2, uint n);
-
-
-//
 // Overlay color type (FIXME: shouldn't be declared here)
 //
 #if defined(NEWGUI_256)
diff --git a/common/str.h b/common/str.h
index b85c381..7b97dfe 100644
--- a/common/str.h
+++ b/common/str.h
@@ -378,4 +378,7 @@ size_t strlcat(char *dst, const char *src, size_t size);
 
 } // End of namespace Common
 
+extern int scumm_stricmp(const char *s1, const char *s2);
+extern int scumm_strnicmp(const char *s1, const char *s2, uint n);
+
 #endif


Commit: 811b257014c9e30a2fea9b189b2d37751cdb2e07
    https://github.com/scummvm/scummvm/commit/811b257014c9e30a2fea9b189b2d37751cdb2e07
Author: Max Horn (max at quendi.de)
Date: 2011-05-31T05:22:19-07:00

Commit Message:
COMMON: Simplify OverlayColor definition

This typedef still should be moved somewhere else. Maybe a header file
of its own?

Changed paths:
    common/scummsys.h



diff --git a/common/scummsys.h b/common/scummsys.h
index 7b81dab..18e21a2 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -290,13 +290,7 @@
 //
 // Overlay color type (FIXME: shouldn't be declared here)
 //
-#if defined(NEWGUI_256)
-	// 256 color only on PalmOS
-	typedef byte OverlayColor;
-#else
-	// 15/16 bit color mode everywhere else...
-	typedef uint16 OverlayColor;
-#endif
+typedef uint16 OverlayColor;
 
 #include "common/forbidden.h"
 






More information about the Scummvm-git-logs mailing list