diff options
author | Max Horn | 2009-11-24 22:11:07 +0000 |
---|---|---|
committer | Max Horn | 2009-11-24 22:11:07 +0000 |
commit | 1a313a7eca87e9c135171d404ff10a90718f8c4c (patch) | |
tree | 418528e4834f748973f5c38ee48aaed583933f19 /common/util.cpp | |
parent | 5e0f79a2edd388dd727ecf6377bc6b8f37c577ed (diff) | |
download | scummvm-rg350-1a313a7eca87e9c135171d404ff10a90718f8c4c.tar.gz scummvm-rg350-1a313a7eca87e9c135171d404ff10a90718f8c4c.tar.bz2 scummvm-rg350-1a313a7eca87e9c135171d404ff10a90718f8c4c.zip |
COMMON: Remove dependency on engines code (by using the inversion principle).
svn-id: r46130
Diffstat (limited to 'common/util.cpp')
-rw-r--r-- | common/util.cpp | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/common/util.cpp b/common/util.cpp index 5e4ee2b2c7..94f5906b80 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -25,8 +25,6 @@ #include "common/util.h" #include "common/system.h" #include "common/config-manager.h" -#include "gui/debugger.h" -#include "engines/engine.h" #include <stdarg.h> // For va_list etc. @@ -421,113 +419,3 @@ void updateGameGUIOptions(const uint32 options) { } } // End of namespace Common - - - -#ifndef DISABLE_TEXT_CONSOLE - -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__) - fputs("WARNING: ", stderr); - fputs(buf, stderr); - fputs("!\n", stderr); -#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; - - // Generate the full error message - va_start(va, s); - vsnprintf(buf_input, STRINGBUFLEN, s, va); - va_end(va); - - - // Next, give the active engine (if any) a chance to augment the message - if (g_engine) { - g_engine->errorString(buf_input, buf_output, STRINGBUFLEN); - } else { - strncpy(buf_output, buf_input, STRINGBUFLEN); - } - - buf_output[STRINGBUFLEN-3] = '\0'; - buf_output[STRINGBUFLEN-2] = '\0'; - buf_output[STRINGBUFLEN-1] = '\0'; - strcat(buf_output, "!\n"); - - - // Print the error message to stderr - fputs(buf_output, stderr); - - // Unless this error -originated- within the debugger itself, we - // now invoke the debugger, if available / supported. - if (g_engine) { - GUI::Debugger *debugger = g_engine->getDebugger(); -#ifdef _WIN32_WCE - if (isSmartphone()) - debugger = 0; -#endif - if (debugger && !debugger->isAttached()) { - debugger->attach(buf_output); - debugger->onFrame(); - } - } - - -#if defined( USE_WINDBG ) -#if defined( _WIN32_WCE ) - TCHAR buf_output_unicode[1024]; - MultiByteToWideChar(CP_ACP, 0, buf_output, strlen(buf_output) + 1, buf_output_unicode, sizeof(buf_output_unicode)); - OutputDebugString(buf_output_unicode); -#ifndef DEBUG - drawError(buf_output); -#else - int cmon_break_into_the_debugger_if_you_please = *(int *)(buf_output + 1); // bus error - printf("%d", cmon_break_into_the_debugger_if_you_please); // don't optimize the int out -#endif -#else - OutputDebugString(buf_output); -#endif -#endif - -#ifdef PALMOS_MODE - extern void PalmFatalError(const char *err); - PalmFatalError(buf_output); -#endif - -#ifdef __SYMBIAN32__ - Symbian::FatalError(buf_output); -#endif - // Finally exit. quit() will terminate the program if g_system is present - if (g_system) - g_system->quit(); - -#if defined(SAMSUNGTV) - // FIXME - for (;;) {} -#else - exit(1); -#endif -} |