Rabbit Tree
Radix bit tries for implementing associative arrays and sets in C.
debug.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define debug_print(msg)
 
#define debug_print_func(func, print_newline, ...)
 
#define debug_print_prefix   debug_print_prefix_flat
 
#define debug_print_prefix_flat
 
#define debug_printf(fmt, ...)
 
#define error_print(msg)
 
#define error_printf(fmt, ...)
 
#define RBT_DEBUG   0
 
#define RBT_DEBUG_FD   stderr
 
#define RBT_DEBUG_INDENT   0
 

Detailed Description

Author
Xyne

Macro Definition Documentation

◆ debug_print

#define debug_print (   msg)
Value:
do \
{ \
if (RBT_DEBUG) \
{ \
debug_print_prefix; \
fprintf(\
msg \
); \
} \
} while (0)
#define RBT_DEBUG_FD
Definition: debug.h:27
#define RBT_DEBUG
Definition: debug.h:20

Print a debugging message.

Parameters
msgThe string to print.

◆ debug_print_func

#define debug_print_func (   func,
  print_newline,
  ... 
)
Value:
do \
{ \
if (RBT_DEBUG) \
{ \
debug_print_prefix; \
func(RBT_DEBUG_FD, ##__VA_ARGS__); \
if (print_newline) \
{ \
fprintf(RBT_DEBUG_FD, "\n"); \
} \
} \
} while (0)

Print the debugging prefix then invoke a function to print the rest of the message.

Parameters
funcA function that accepts a file descriptor as its first argument.
print_newlineA boolean parameter. If it evaluates to non-zero, a newline will be printed after the function call.
...Additional arguments to pass to the function.

◆ debug_print_prefix

#define debug_print_prefix   debug_print_prefix_flat

Precede debug_print_prefix_flat with indentation to represent the nesting level, if RBT_DEBUG_INDENT is greater than 0, otherwise this is the same as debug_print_prefix_flat.

◆ debug_print_prefix_flat

#define debug_print_prefix_flat
Value:
fprintf(\
"%s%s %s%d %s%s(): %s", \
RBT_DEBUG_FILENAME_COLOR, \
__FILE__, \
RBT_DEBUG_LINENUMBER_COLOR, \
__LINE__, \
RBT_DEBUG_FUNCTIONNAME_COLOR, \
__func__, \
RBT_DEBUG_RESET_COLOR \
)

Print the file name, line number and function name.

◆ debug_printf

#define debug_printf (   fmt,
  ... 
)
Value:
do \
{ \
if (RBT_DEBUG) \
{ \
debug_print_prefix; \
fprintf(\
fmt, \
__VA_ARGS__ \
); \
} \
} while (0)

Print a debugging message.

Parameters
fmtA printf format string.
...Parameters to pass to printf.

◆ error_print

#define error_print (   msg)
Value:
do \
{ \
fprintf( \
"%s %d %s(): %s", \
__FILE__, __LINE__, __func__, msg \
); \
} \
while (0) \

Identical to debug_print except that it is independent of RBT_DEBUG.

Parameters
msgThe string to print.

◆ error_printf

#define error_printf (   fmt,
  ... 
)
Value:
do \
{ \
fprintf( \
"%s %d %s(): " fmt, \
__FILE__, __LINE__, __func__, fmt, __VA_ARGS__ \
); \
} \
while (0) \

Identical to debug_printf except that it is independent of RBT_DEBUG.

Parameters
fmtA printf format string.
...Parameters to pass to printf.

◆ RBT_DEBUG

#define RBT_DEBUG   0

Enable debugging messages if non-zero.

◆ RBT_DEBUG_FD

#define RBT_DEBUG_FD   stderr

The file descriptor to use for printing debugging messages.

◆ RBT_DEBUG_INDENT

#define RBT_DEBUG_INDENT   0

Use indentation to represent the nesting level of function calls.

Contact
echo xyne.archlinux.org | sed 's/\./@/'