comparison 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
comparison
equal deleted inserted replaced
494:3bb9a8df6ee9 495:c7a2471e5c4e
117 #endif 117 #endif
118 #ifndef DEBUG 118 #ifndef DEBUG
119 # define debug 0 119 # define debug 0
120 #endif 120 #endif
121 121
122 #ifdef DEBUG
123 #define DEBUG_N(n, ...) do { if (debug >= (n)) printf(__VA_ARGS__); } while (0)
124 #else
125 #define DEBUG_N(n, ...) do { } while(0)
126 #endif
127
128 #define DEBUG_1(...) DEBUG_N(1, __VA_ARGS__)
129 #define DEBUG_2(...) DEBUG_N(2, __VA_ARGS__)
130 #define DEBUG_3(...) DEBUG_N(3, __VA_ARGS__)
131 #define DEBUG_4(...) DEBUG_N(4, __VA_ARGS__)
132
122 #include "typedefs.h" 133 #include "typedefs.h"
123 134
124 /* 135 /*
125 *---------------------------------------------------------------------------- 136 *----------------------------------------------------------------------------
126 * globals 137 * globals