diff src/main.h @ 495:c7a2471e5c4e

Introduce macros to display debug messages. if (debug) printf(...) is now replaced by variadic macros: DEBUG_1() And for higher debugging levels: DEBUG_2() DEBUG_3() DEBUG_4()
author zas_
date Wed, 23 Apr 2008 20:47:19 +0000
parents 3809ffa3567b
children 2c6558663b52
line wrap: on
line diff
--- a/src/main.h	Wed Apr 23 13:46:18 2008 +0000
+++ b/src/main.h	Wed Apr 23 20:47:19 2008 +0000
@@ -119,6 +119,17 @@
 # define debug 0
 #endif
 
+#ifdef DEBUG
+#define DEBUG_N(n, ...) do { if (debug >= (n)) printf(__VA_ARGS__); } while (0)
+#else
+#define DEBUG_N(n, ...)  do { } while(0)
+#endif
+
+#define DEBUG_1(...) DEBUG_N(1, __VA_ARGS__)
+#define DEBUG_2(...) DEBUG_N(2, __VA_ARGS__)
+#define DEBUG_3(...) DEBUG_N(3, __VA_ARGS__)
+#define DEBUG_4(...) DEBUG_N(4, __VA_ARGS__)
+
 #include "typedefs.h"
 
 /*