diff options
author | Max Horn | 2011-06-17 12:16:18 -0700 |
---|---|---|
committer | Max Horn | 2011-06-17 12:16:18 -0700 |
commit | 158c2252ab4fea7fd9ecea62a2439d82b388df1c (patch) | |
tree | be7e972a8118b92d6cbdc16ce36129a4de3c094f | |
parent | 825c889e33d2c68dec65e6496c69d5d4a89cba51 (diff) | |
parent | f7c1e7d002c21eeaf0b5c06d3527ede532f5cd51 (diff) | |
download | scummvm-rg350-158c2252ab4fea7fd9ecea62a2439d82b388df1c.tar.gz scummvm-rg350-158c2252ab4fea7fd9ecea62a2439d82b388df1c.tar.bz2 scummvm-rg350-158c2252ab4fea7fd9ecea62a2439d82b388df1c.zip |
Merge pull request #42 from fingolfin/no-osystem-defaults
Remove default implementation of OSystem::logMessage
-rw-r--r-- | backends/platform/iphone/osys_main.cpp | 12 | ||||
-rw-r--r-- | backends/platform/iphone/osys_main.h | 2 | ||||
-rw-r--r-- | backends/platform/n64/osys_n64.h | 1 | ||||
-rw-r--r-- | backends/platform/n64/osys_n64_base.cpp | 12 | ||||
-rw-r--r-- | backends/platform/null/null.cpp | 14 | ||||
-rw-r--r-- | backends/platform/psp/osys_psp.cpp | 13 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 14 | ||||
-rw-r--r-- | backends/platform/wii/osystem.cpp | 18 | ||||
-rw-r--r-- | backends/platform/wii/osystem.h | 2 | ||||
-rw-r--r-- | common/system.cpp | 19 | ||||
-rw-r--r-- | common/system.h | 2 |
11 files changed, 80 insertions, 29 deletions
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp index 9325ed50bf..4bc567c39d 100644 --- a/backends/platform/iphone/osys_main.cpp +++ b/backends/platform/iphone/osys_main.cpp @@ -242,6 +242,18 @@ void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit } } +void OSystem_IPHONE::logMessage(LogMessageType::Type type, const char *message) { + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); +} + void iphone_main(int argc, char *argv[]) { //OSystem_IPHONE::migrateApp(); diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index 14325f8090..37896cceeb 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -180,6 +180,8 @@ public: virtual Common::String getDefaultConfigFileName(); + virtual void logMessage(LogMessageType::Type type, const char *message); + protected: void internUpdateScreen(); void dirtyFullScreen(); diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index dfa8f58cce..285e2afa55 100644 --- a/backends/platform/n64/osys_n64.h +++ b/backends/platform/n64/osys_n64.h @@ -199,6 +199,7 @@ public: virtual Audio::Mixer *getMixer(); virtual void getTimeAndDate(TimeDate &t) const; virtual void setTimerCallback(TimerProc callback, int interval); + virtual void logMessage(LogMessageType::Type type, const char *message); void rebuildOffscreenGameBuffer(void); void rebuildOffscreenMouseBuffer(void); diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index 69e8da3526..4bc3780fe2 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -870,6 +870,18 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const { return; } +void OSystem_N64::logMessage(LogMessageType::Type type, const char *message) { + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); +} + void OSystem_N64::setTimerCallback(TimerProc callback, int interval) { assert (interval > 0); diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp index 106cde1699..4690a67c55 100644 --- a/backends/platform/null/null.cpp +++ b/backends/platform/null/null.cpp @@ -52,6 +52,8 @@ public: virtual uint32 getMillis(); virtual void delayMillis(uint msecs); virtual void getTimeAndDate(TimeDate &t) const {} + + virtual void logMessage(LogMessageType::Type type, const char *message); }; OSystem_NULL::OSystem_NULL() { @@ -97,6 +99,18 @@ uint32 OSystem_NULL::getMillis() { void OSystem_NULL::delayMillis(uint msecs) { } +void OSystem_NULL::logMessage(LogMessageType::Type type, const char *message) { + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); +} + OSystem *OSystem_NULL_create() { return new OSystem_NULL(); } diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 01124b420e..8c8180d04e 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -20,8 +20,7 @@ * */ -// Allow use of stuff in <time.h> -#define FORBIDDEN_SYMBOL_EXCEPTION_time_h +#define FORBIDDEN_SYMBOL_ALLOW_ALL #include <pspuser.h> #include <pspgu.h> @@ -422,7 +421,15 @@ void OSystem_PSP::quit() { } void OSystem_PSP::logMessage(LogMessageType::Type type, const char *message) { - EventsBaseBackend::logMessage(type, message); + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); if (type == LogMessageType::kError) PspDebugTrace(false, "%s", message); // write to file diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index fd27c82797..e36878db07 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -275,10 +275,22 @@ void OSystem_SDL::fatalError() { void OSystem_SDL::logMessage(LogMessageType::Type type, const char *message) { - ModularBackend::logMessage(type, message); + // First log to stdout/stderr + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); + + // Then log into file (via the logger) if (_logger) _logger->print(message); + // Finally, some Windows / WinCE specific logging code. #if defined( USE_WINDBG ) #if defined( _WIN32_WCE ) TCHAR buf_unicode[1024]; diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp index c6b23783b8..258a782cc4 100644 --- a/backends/platform/wii/osystem.cpp +++ b/backends/platform/wii/osystem.cpp @@ -19,11 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -// Allow use of stuff in <time.h> -#define FORBIDDEN_SYMBOL_EXCEPTION_time_h - -#define FORBIDDEN_SYMBOL_EXCEPTION_printf -#define FORBIDDEN_SYMBOL_EXCEPTION_getcwd +#define FORBIDDEN_SYMBOL_ALLOW_ALL #include <unistd.h> @@ -291,6 +287,18 @@ void OSystem_Wii::showOptionsDialog() { _padAcceleration = 9 - ConfMan.getInt("wii_pad_acceleration"); } +void OSystem_Wii::logMessage(LogMessageType::Type type, const char *message) { + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); +} + #ifndef GAMECUBE Common::String OSystem_Wii::getSystemLanguage() const { const char *wiiCountries[] = { diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index 6863a6840e..64197f913a 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -211,6 +211,8 @@ public: virtual FilesystemFactory *getFilesystemFactory(); virtual void getTimeAndDate(TimeDate &t) const; + virtual void logMessage(LogMessageType::Type type, const char *message); + #ifndef GAMECUBE virtual Common::String getSystemLanguage() const; #endif // GAMECUBE diff --git a/common/system.cpp b/common/system.cpp index fae7a3ef34..1645a6be10 100644 --- a/common/system.cpp +++ b/common/system.cpp @@ -21,11 +21,6 @@ */ #define FORBIDDEN_SYMBOL_EXCEPTION_exit -#define FORBIDDEN_SYMBOL_EXCEPTION_FILE -#define FORBIDDEN_SYMBOL_EXCEPTION_fputs -#define FORBIDDEN_SYMBOL_EXCEPTION_fflush -#define FORBIDDEN_SYMBOL_EXCEPTION_stdout -#define FORBIDDEN_SYMBOL_EXCEPTION_stderr #include "common/system.h" #include "common/events.h" @@ -136,20 +131,6 @@ Common::String OSystem::getDefaultConfigFileName() { return "scummvm.ini"; } -void OSystem::logMessage(LogMessageType::Type type, const char *message) { -#if !defined(__PLAYSTATION2__) && !defined(__DS__) - FILE *output = 0; - - if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) - output = stdout; - else - output = stderr; - - fputs(message, output); - fflush(output); -#endif -} - Common::String OSystem::getSystemLanguage() const { return "en_US"; } diff --git a/common/system.h b/common/system.h index d26bc593aa..3e740ff0c1 100644 --- a/common/system.h +++ b/common/system.h @@ -1101,7 +1101,7 @@ public: * @param type the type of the message * @param message the message itself */ - virtual void logMessage(LogMessageType::Type type, const char *message); + virtual void logMessage(LogMessageType::Type type, const char *message) = 0; /** * Open the log file in a way that allows the user to review it, |