diff src/console/blargg_source.h @ 316:fb513e10174e trunk

[svn] - merge libconsole-blargg into mainline libconsole: + obsoletes plugins-ugly:sapplug
author nenolod
date Thu, 30 Nov 2006 19:54:33 -0800
parents 3da1b8942b8b
children
line wrap: on
line diff
--- a/src/console/blargg_source.h	Wed Nov 29 14:42:11 2006 -0800
+++ b/src/console/blargg_source.h	Thu Nov 30 19:54:33 2006 -0800
@@ -1,9 +1,4 @@
-
-// By default, #included at beginning of library source files.
-// Can be overridden by #defining BLARGG_SOURCE_BEGIN to path of alternate file.
-
-// Copyright (C) 2005 Shay Green.
-
+// Included at the beginning of library source files, after all other #include lines
 #ifndef BLARGG_SOURCE_H
 #define BLARGG_SOURCE_H
 
@@ -22,32 +17,26 @@
 // Like printf() except output goes to debug log file. Might be defined to do
 // nothing (not even evaluate its arguments).
 // void dprintf( const char* format, ... );
+inline void blargg_dprintf_( const char*, ... ) { }
 #undef dprintf
-#ifdef BLARGG_DPRINTF
-	#define dprintf BLARGG_DPRINTF
-#else
-	inline void blargg_dprintf_( const char*, ... ) { }
-	#define dprintf (1) ? (void) 0 : blargg_dprintf_
-#endif
+#define dprintf (1) ? (void) 0 : blargg_dprintf_
 
 // If enabled, evaluate expr and if false, make debug log entry with source file
 // and line. Meant for finding situations that should be examined further, but that
 // don't indicate a problem. In all cases, execution continues normally.
 #undef check
-#ifdef BLARGG_CHECK
-	#define check( expr ) BLARGG_CHECK( expr )
-#else
-	#define check( expr ) ((void) 0)
-#endif
+#define check( expr ) ((void) 0)
 
-// If expr returns non-NULL error string, return it from current function, otherwise continue.
-#define BLARGG_RETURN_ERR( expr ) do {                          \
+// If expr yields error string, return it from current function, otherwise continue.
+#undef RETURN_ERR
+#define RETURN_ERR( expr ) do {                         \
 		blargg_err_t blargg_return_err_ = (expr);               \
 		if ( blargg_return_err_ ) return blargg_return_err_;    \
 	} while ( 0 )
 
-// If ptr is NULL, return out of memory error string.
-#define BLARGG_CHECK_ALLOC( ptr )   do { if ( (ptr) == 0 ) return "Out of memory"; } while ( 0 )
+// If ptr is 0, return out of memory error string.
+#undef CHECK_ALLOC
+#define CHECK_ALLOC( ptr ) do { if ( (ptr) == 0 ) return "Out of memory"; } while ( 0 )
 
 // Avoid any macros which evaluate their arguments multiple times
 #undef min
@@ -72,5 +61,18 @@
 	return x;
 }
 
+// TODO: good idea? bad idea?
+#undef byte
+#define byte byte_
+typedef unsigned char byte;
+
+// deprecated
+#define BLARGG_CHECK_ALLOC CHECK_ALLOC
+#define BLARGG_RETURN_ERR RETURN_ERR
+
+// BLARGG_SOURCE_BEGIN: If defined, #included, allowing redefition of dprintf and check
+#ifdef BLARGG_SOURCE_BEGIN
+	#include BLARGG_SOURCE_BEGIN
 #endif
 
+#endif