changeset 502:2c6558663b52

Display file and line along debug messages for any debug level but level 1. Add a DEBUG_0() macro for instant debugging.
author zas_
date Wed, 23 Apr 2008 23:35:13 +0000
parents 1bac19d5a663
children e5023cced4e5
files src/main.h
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.h	Wed Apr 23 22:40:55 2008 +0000
+++ b/src/main.h	Wed Apr 23 23:35:13 2008 +0000
@@ -120,11 +120,19 @@
 #endif
 
 #ifdef DEBUG
-#define DEBUG_N(n, ...) do { if (debug >= (n)) printf(__VA_ARGS__); } while (0)
+#define DEBUG_N(n, ...) do \
+				{ \
+				if (debug >= (n)) 	\
+					{ 		\
+					if (debug != 1) printf("%s:%d: ", __FILE__, __LINE__); \
+					printf(__VA_ARGS__); \
+					} \
+				} while (0)
 #else
 #define DEBUG_N(n, ...)  do { } while(0)
 #endif
 
+#define DEBUG_0(...) DEBUG_N(0, __VA_ARGS__)
 #define DEBUG_1(...) DEBUG_N(1, __VA_ARGS__)
 #define DEBUG_2(...) DEBUG_N(2, __VA_ARGS__)
 #define DEBUG_3(...) DEBUG_N(3, __VA_ARGS__)