CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
authorChristian Taedcke
Thu, 09 Sep 2010 15:50:02 +0200
changeset 637 c676669ec3c1
parent 636 033fe6f1ec3c
child 638 00bc03cb5606
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
include/win32/applicfg.h
--- a/include/win32/applicfg.h	Thu Sep 09 15:56:06 2010 +0200
+++ b/include/win32/applicfg.h	Thu Sep 09 15:50:02 2010 +0200
@@ -94,6 +94,10 @@
 /// Definition of error and warning macros
 // --------------------------------------
 
+#ifndef _MSC_VER
+#error This block is for Visual only, please adapt it for your compiler.
+#elif (_MSC_VER >= 1400)
+//Visual Studio 2005 and above
 #ifdef UNICODE
 #define MSG(...) \
   do{wchar_t msg[300];\
@@ -107,10 +111,24 @@
    sprintf(msg,##__VA_ARGS__);\
    OutputDebugString(msg);}while(0)
 */
-#endif  
+#endif
+#else //(_MSC_VER < 1400)
+//For Visual Studio 2003 and below, without VA_ARGS
+#ifdef UNICODE
+#define MSG(text) \
+  do{wchar_t msg[300];\
+   vswprintf(msg,L##text);\
+   OutputDebugString(msg);}while(0)
+#else
+#define MSG(text) \
+  do{printf text;fflush(stdout);}while(0)
+#endif
+
+#endif //_MSC_VER
+
 #define CANFESTIVAL_DEBUG_MSG(num, str, val)\
   {unsigned long value = val;\
-   MSG("%s(%d) : 0x%X %s 0x%X\n",__FILE__, __LINE__,num, str, value);\
+   MSG(("%s(%d) : 0x%X %s 0x%lX\n",__FILE__, __LINE__,num, str, value)); \
    }
 
 /// Definition of MSG_WAR