aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2008-11-13 11:26:47 +0000
committerMax Horn2008-11-13 11:26:47 +0000
commita6502da9acae76abe874da65d4a1ba2576e58e76 (patch)
tree9b84dab833b74d4775802665b2bac1b3f5d43e6c
parentc0786313fa568079b8d54ddb1734102badcad1cd (diff)
downloadscummvm-rg350-a6502da9acae76abe874da65d4a1ba2576e58e76.tar.gz
scummvm-rg350-a6502da9acae76abe874da65d4a1ba2576e58e76.tar.bz2
scummvm-rg350-a6502da9acae76abe874da65d4a1ba2576e58e76.zip
* got rid of CDECL
* got rid of scumm_strrev * added DISABLE_TEXT_CONSOLE flag which disables printf, warning, debug (but not error) svn-id: r35038
-rw-r--r--common/scummsys.h5
-rw-r--r--common/util.cpp75
-rw-r--r--common/util.h31
-rw-r--r--engines/scumm/debugger.cpp2
-rw-r--r--engines/scumm/scumm.h2
5 files changed, 56 insertions, 59 deletions
diff --git a/common/scummsys.h b/common/scummsys.h
index 45462a6974..725f4fdf0b 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -208,7 +208,6 @@
#define PLUGIN_EXPORT __declspec(dllexport)
#if _WIN32_WCE < 300
- #define CDECL __cdecl
#define SMALL_SCREEN_DEVICE
#endif
@@ -404,10 +403,6 @@
#define FORCEINLINE inline
#endif
-#ifndef CDECL
-#define CDECL
-#endif
-
#ifndef PLUGIN_EXPORT
#define PLUGIN_EXPORT
#endif
diff --git a/common/util.cpp b/common/util.cpp
index f68d253ec3..13a810e20f 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -458,7 +458,7 @@ uint32 getEnabledSpecialDebugLevels() {
*/
int gDebugLevel = -1;
-
+#ifndef DISABLE_TEXT_CONSOLE
static void debugHelper(const char *in_buf, bool caret = true) {
char buf[STRINGBUFLEN];
@@ -490,7 +490,7 @@ static void debugHelper(const char *in_buf, bool caret = true) {
fflush(stdout);
}
-void CDECL debug(int level, const char *s, ...) {
+void debug(int level, const char *s, ...) {
char buf[STRINGBUFLEN];
va_list va;
@@ -504,7 +504,7 @@ void CDECL debug(int level, const char *s, ...) {
debugHelper(buf);
}
-void CDECL debugN(int level, const char *s, ...) {
+void debugN(int level, const char *s, ...) {
char buf[STRINGBUFLEN];
va_list va;
@@ -518,7 +518,7 @@ void CDECL debugN(int level, const char *s, ...) {
debugHelper(buf, false);
}
-void CDECL debug(const char *s, ...) {
+void debug(const char *s, ...) {
char buf[STRINGBUFLEN];
va_list va;
@@ -529,7 +529,7 @@ void CDECL debug(const char *s, ...) {
debugHelper(buf);
}
-void CDECL debugC(int level, uint32 engine_level, const char *s, ...) {
+void debugC(int level, uint32 engine_level, const char *s, ...) {
char buf[STRINGBUFLEN];
va_list va;
@@ -544,7 +544,33 @@ void CDECL debugC(int level, uint32 engine_level, const char *s, ...) {
debugHelper(buf);
}
-void NORETURN CDECL error(const char *s, ...) {
+void warning(const char *s, ...) {
+ char buf[STRINGBUFLEN];
+ va_list va;
+
+ va_start(va, s);
+ vsnprintf(buf, STRINGBUFLEN, s, va);
+ va_end(va);
+
+#if !defined (__SYMBIAN32__)
+ fprintf(stderr, "WARNING: %s!\n", buf);
+#endif
+
+#if defined( USE_WINDBG )
+ strcat(buf, "\n");
+#if defined( _WIN32_WCE )
+ TCHAR buf_unicode[1024];
+ MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode));
+ OutputDebugString(buf_unicode);
+#else
+ OutputDebugString(buf);
+#endif
+#endif
+}
+
+#endif
+
+void NORETURN error(const char *s, ...) {
char buf_input[STRINGBUFLEN];
char buf_output[STRINGBUFLEN];
va_list va;
@@ -612,43 +638,6 @@ void NORETURN CDECL error(const char *s, ...) {
exit(1);
}
-void CDECL warning(const char *s, ...) {
- char buf[STRINGBUFLEN];
- va_list va;
-
- va_start(va, s);
- vsnprintf(buf, STRINGBUFLEN, s, va);
- va_end(va);
-
-#if !defined (__SYMBIAN32__)
- fprintf(stderr, "WARNING: %s!\n", buf);
-#endif
-
-#if defined( USE_WINDBG )
- strcat(buf, "\n");
-#if defined( _WIN32_WCE )
- TCHAR buf_unicode[1024];
- MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode));
- OutputDebugString(buf_unicode);
-#else
- OutputDebugString(buf);
-#endif
-#endif
-}
-
-char *scumm_strrev(char *str) {
- if (!str)
- return str;
- int len = strlen(str);
- if (len < 2)
- return str;
- char *p1, *p2;
- for (p1 = str, p2 = str + len - 1; p1 < p2; p1++, p2--) {
- SWAP(*p1, *p2);
- }
- return str;
-}
-
Common::String tag2string(uint32 tag) {
char str[5];
str[0] = (char)(tag >> 24);
diff --git a/common/util.h b/common/util.h
index 573004c437..80f5c4385f 100644
--- a/common/util.h
+++ b/common/util.h
@@ -306,21 +306,34 @@ uint32 getEnabledSpecialDebugLevels();
#if defined(__GNUC__)
-void CDECL error(const char *s, ...) GCC_PRINTF(1, 2) NORETURN;
+void error(const char *s, ...) GCC_PRINTF(1, 2) NORETURN;
#else
-void CDECL NORETURN error(const char *s, ...);
+void NORETURN error(const char *s, ...);
#endif
-void CDECL warning(const char *s, ...) GCC_PRINTF(1, 2);
+#ifdef DISABLE_TEXT_CONSOLE
-void CDECL debug(int level, const char *s, ...) GCC_PRINTF(2, 3);
-void CDECL debug(const char *s, ...) GCC_PRINTF(1, 2);
-void CDECL debugN(int level, const char *s, ...) GCC_PRINTF(2, 3);
-void CDECL debugC(int level, uint32 engine_level, const char *s, ...) GCC_PRINTF(3, 4);
+inline void printf(const char *s, ...) {}
-extern int gDebugLevel;
+inline void warning(const char *s, ...) {}
+
+inline void debug(int level, const char *s, ...) {}
+inline void debug(const char *s, ...) {}
+inline void debugN(int level, const char *s, ...) {}
+inline void debugC(int level, uint32 engine_level, const char *s, ...) {}
+
+#else
+
+void warning(const char *s, ...) GCC_PRINTF(1, 2);
-char *scumm_strrev(char *str);
+void debug(int level, const char *s, ...) GCC_PRINTF(2, 3);
+void debug(const char *s, ...) GCC_PRINTF(1, 2);
+void debugN(int level, const char *s, ...) GCC_PRINTF(2, 3);
+void debugC(int level, uint32 engine_level, const char *s, ...) GCC_PRINTF(3, 4);
+
+#endif
+
+extern int gDebugLevel;
Common::String tag2string(uint32 tag);
#define tag2str(x) tag2string(x).c_str()
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp
index 23af1f9672..a391ba5332 100644
--- a/engines/scumm/debugger.cpp
+++ b/engines/scumm/debugger.cpp
@@ -41,7 +41,7 @@
namespace Scumm {
-void CDECL debugC(int channel, const char *s, ...) {
+void debugC(int channel, const char *s, ...) {
char buf[STRINGBUFLEN];
va_list va;
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 582d9fdf60..1c550f824c 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -130,7 +130,7 @@ enum GameFeatures {
};
/* SCUMM Debug Channels */
-void CDECL debugC(int level, const char *s, ...);
+void debugC(int level, const char *s, ...);
enum {
DEBUG_GENERAL = 1 << 0, // General debug