[Scummvm-cvs-logs] SF.net SVN: scummvm: [21545] scummvm/trunk/base

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Apr 1 16:58:01 CEST 2006


Revision: 21545
Author:   fingolfin
Date:     2006-04-01 16:56:53 -0800 (Sat, 01 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21545&view=rev

Log Message:
-----------
Moved all debug functions to from main.cpp to util.cpp

Modified Paths:
--------------
    scummvm/trunk/base/main.cpp
    scummvm/trunk/common/util.cpp
    scummvm/trunk/common/util.h
Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp	2006-04-02 00:56:21 UTC (rev 21544)
+++ scummvm/trunk/base/main.cpp	2006-04-02 00:56:53 UTC (rev 21545)
@@ -517,65 +517,3 @@
 
 	return 0;
 }
-
-static void debugHelper(char *buf, bool caret = true) {
-#ifndef _WIN32_WCE
-	if (caret)
-		printf("%s\n", buf);
-	else
-		printf("%s", buf);
-#endif
-
-#if defined( USE_WINDBG )
-	if (caret)
-		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
-
-	fflush(stdout);
-}
-
-void CDECL debug(int level, const char *s, ...) {
-	char buf[STRINGBUFLEN];
-	va_list va;
-
-	if (level > gDebugLevel)
-		return;
-
-	va_start(va, s);
-	vsnprintf(buf, STRINGBUFLEN, s, va);
-	va_end(va);
-
-	debugHelper(buf);
-}
-
-void CDECL debugN(int level, const char *s, ...) {
-	char buf[STRINGBUFLEN];
-	va_list va;
-
-	if (level > gDebugLevel)
-		return;
-
-	va_start(va, s);
-	vsnprintf(buf, STRINGBUFLEN, s, va);
-	va_end(va);
-
-	debugHelper(buf, false);
-}
-
-void CDECL debug(const char *s, ...) {
-	char buf[STRINGBUFLEN];
-	va_list va;
-
-	va_start(va, s);
-	vsnprintf(buf, STRINGBUFLEN, s, va);
-	va_end(va);
-
-	debugHelper(buf);
-}

Modified: scummvm/trunk/common/util.cpp
===================================================================
--- scummvm/trunk/common/util.cpp	2006-04-02 00:56:21 UTC (rev 21544)
+++ scummvm/trunk/common/util.cpp	2006-04-02 00:56:53 UTC (rev 21545)
@@ -341,6 +341,68 @@
 
 }	// End of namespace Common
 
+static void debugHelper(char *buf, bool caret = true) {
+#ifndef _WIN32_WCE
+	if (caret)
+		printf("%s\n", buf);
+	else
+		printf("%s", buf);
+#endif
+
+#if defined( USE_WINDBG )
+	if (caret)
+		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
+
+	fflush(stdout);
+}
+
+void CDECL debug(int level, const char *s, ...) {
+	char buf[STRINGBUFLEN];
+	va_list va;
+
+	if (level > gDebugLevel)
+		return;
+
+	va_start(va, s);
+	vsnprintf(buf, STRINGBUFLEN, s, va);
+	va_end(va);
+
+	debugHelper(buf);
+}
+
+void CDECL debugN(int level, const char *s, ...) {
+	char buf[STRINGBUFLEN];
+	va_list va;
+
+	if (level > gDebugLevel)
+		return;
+
+	va_start(va, s);
+	vsnprintf(buf, STRINGBUFLEN, s, va);
+	va_end(va);
+
+	debugHelper(buf, false);
+}
+
+void CDECL debug(const char *s, ...) {
+	char buf[STRINGBUFLEN];
+	va_list va;
+
+	va_start(va, s);
+	vsnprintf(buf, STRINGBUFLEN, s, va);
+	va_end(va);
+
+	debugHelper(buf);
+}
+
 void CDECL debugC(int level, uint32 engine_level, const char *s, ...) {
 	char buf[STRINGBUFLEN];
 	va_list va;
@@ -352,6 +414,5 @@
 	vsnprintf(buf, STRINGBUFLEN, s, va);
 	va_end(va);
 
-	// pass it to debug for now
-	debug(level, buf);
+	debugHelper(buf);
 }

Modified: scummvm/trunk/common/util.h
===================================================================
--- scummvm/trunk/common/util.h	2006-04-02 00:56:21 UTC (rev 21544)
+++ scummvm/trunk/common/util.h	2006-04-02 00:56:53 UTC (rev 21545)
@@ -272,10 +272,10 @@
 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);
+
 void checkHeap();
 
-void CDECL debugC(int level, uint32 engine_level, const char *s, ...) GCC_PRINTF(3, 4);
-
 extern int gDebugLevel;
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list