/home/fwph/code/wurde/rde/core/wds-debug.h

Go to the documentation of this file.
00001 
00016 #ifndef _wds_debug_h
00017 #define _wds_debug_h
00018 
00019 
00050 /* Be good about what include files that we actually use */
00051 #ifdef __cplusplus
00052 #include <cassert>
00053 #include <cstdio>
00054 #else
00055 #include <assert.h>
00056 #include <stdio.h>
00057 #endif
00058 
00059 
00060 /* Define everything in terms of DEBUG_X */
00061 #ifdef FULL_DEBUG
00062 #ifndef BEBUG_3
00063 #define DEBUG_3
00064 #endif
00065 #endif
00066 
00067 #ifdef DEBUG_VERBOSE
00068 #ifndef DEBUG_3
00069 #define DEBUG_3
00070 #endif
00071 #endif
00072 
00073 #ifdef DEBUG_MEDIUM
00074 #ifndef DEBUG_2
00075 #define DEBUG_2
00076 #endif
00077 #endif
00078 
00079 
00080 /* Debugging levels are hierarchical */
00081 #ifdef DEBUG_3
00082 #ifndef DEBUG_2
00083 #define DEBUG_2
00084 #endif
00085 #endif
00086 
00087 #ifdef DEBUG_2
00088 #ifndef DEBUG_1
00089 #define DEBUG_1
00090 #endif
00091 #endif
00092 
00093 #ifdef DEBUG_1
00094 #ifdef NDEBUG
00095 #undef NDEBUG
00096 #endif
00097 #endif
00098 
00099 
00102 #ifdef DEBUG_3
00103 
00106 #define debug_3(format, ...)  fprintf(stderr, format, ## __VA_ARGS__)
00107 
00110 #define debug_verbose(format, ...)  fprintf(stderr, format, ## __VA_ARGS__)
00111 #else
00112 
00115 #define debug_3(format, ...)
00116 
00119 #define debug_verbose(format, ...)
00120 #endif
00121 
00122 
00125 #ifdef DEBUG_2
00126 
00129 #define debug_2(format, ...)   fprintf(stderr, format, ## __VA_ARGS__)
00130 
00133 #define debug_medium(format, ...)  fprintf(stderr, format, ## __VA_ARGS__)
00134 #else
00135 
00138 #define debug_2(format, ...)
00139 
00142 #define debug_medium(format, ...)
00143 #endif
00144 
00145 
00146 
00149 #ifdef DEBUG_1
00150 
00153 #define debug_1(format, ...)   fprintf(stderr, format, ## __VA_ARGS__)
00154 
00157 #ifdef ALLOW_DEBUG_MACRO
00158 #define debug(format, ...)   fprintf(stderr, format, ## __VA_ARGS__)
00159 #endif
00160 #else
00161 
00164 #define debug_1(format, ...)
00165 
00168 #ifdef ALLOW_DEBUG_MACRO
00169 #define debug(format, ...)
00170 #endif
00171 #endif
00172 
00173 
00174 
00177 #ifndef NDEBUG
00178 
00181 #define invalidate_pointer(pointer)  pointer = NULL
00182 #else
00183 #define invalidate_pointer(pointer)
00184 #endif
00185 
00186 
00187 
00193 #define assert_pointer(pointer)  assert((pointer) != NULL)
00194 
00199 #define assert_range(number, low, high)  \
00200   assert(((number) >= (low)) && ((number) < (high)))
00201 
00204 #define assert_natural(number)  assert((number) >= 0)
00205 
00210 #define assert_range_inc(number, low, high)  \
00211   assert(((number) >= (low)) && ((number) <= (high)))
00212 
00216 #define assert_more(number, threshold)  assert((number) > (threshold))
00217 
00221 #define assert_more_inc(number, threshold)  assert((number) >= (threshold))
00222 
00226 #define assert_less(number, threshold)  assert((number) < (threshold))
00227 
00231 #define assert_less_inc(number, threshold)  assert((number) <= (threshold))
00232 
00235 #define assert_prob(number)  assert_range_inc(number, 0.0, 1.0)
00236 
00237 
00238 
00239 #endif

Generated on Thu Feb 1 15:31:54 2007 for WURDE by  doxygen 1.5.1