7#ifndef RBT_HEADER_DEBUG
8#define RBT_HEADER_DEBUG
10#ifndef RBT_DEBUG_USE_COLOR
12#define RBT_DEBUG_USE_COLOR 1
27#define RBT_DEBUG_FD stderr
33#ifndef RBT_DEBUG_INDENT
34#define RBT_DEBUG_INDENT 0
42unsigned int RBT_NESTING_LEVEL = 0;
45__cyg_profile_func_enter(
void * this_fn,
void * call_site)
51__cyg_profile_func_exit(
void * this_fn,
void * call_site)
56#error RBT_DEBUG_INDENT is currently only supported when using GCC.
60#ifdef RBT_DEBUG_USE_COLOR
64#define RBT_DEBUG_FILENAME_COLOR "\033[34m"
68#define RBT_DEBUG_LINENUMBER_COLOR "\033[36m"
72#define RBT_DEBUG_FUNCTIONNAME_COLOR "\033[35m"
76#define RBT_DEBUG_RESET_COLOR "\033[0m"
81#define RBT_DEBUG_FILENAME_COLOR ""
82#define RBT_DEBUG_LINENUMBER_COLOR ""
83#define RBT_DEBUG_FUNCTIONNAME_COLOR ""
84#define RBT_DEBUG_RESET_COLOR ""
95#define debug_print_prefix_flat \
98 "%s%s %s%d %s%s(): %s", \
99 RBT_DEBUG_FILENAME_COLOR, \
101 RBT_DEBUG_LINENUMBER_COLOR, \
103 RBT_DEBUG_FUNCTIONNAME_COLOR, \
105 RBT_DEBUG_RESET_COLOR \
115#if RBT_DEBUG_INDENT>0
116#define debug_print_prefix \
117 int i = RBT_NESTING_LEVEL; \
120 fprintf(stderr, " "); \
122 debug_print_prefix_flat
124#define debug_print_prefix debug_print_prefix_flat
138#define debug_printf(fmt, ...) \
143 debug_print_prefix; \
160#define debug_print(msg) \
165 debug_print_prefix; \
190#define debug_print_func(func, print_newline, ...) \
195 debug_print_prefix; \
196 func(RBT_DEBUG_FD, ##__VA_ARGS__); \
199 fprintf(RBT_DEBUG_FD, "\n"); \
215#define error_printf(fmt, ...) \
220 "%s %d %s(): " fmt, \
221 __FILE__, __LINE__, __func__, fmt, __VA_ARGS__ \
234#define error_print(msg) \
240 __FILE__, __LINE__, __func__, msg \
#define RBT_DEBUG_INDENT
Definition: debug.h:34