wavelength 1.0.0
Loading...
Searching...
No Matches
debug.h
Go to the documentation of this file.
1#ifndef DMADEBUG_DEBUG_H
2#define DMADEBUG_DEBUG_H
3
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
21#define DEBUG_ANSI_RESET "\033[0m"
22#define DEBUG_ANSI_BOLD "\033[1m"
23#define DEBUG_ANSI_YELLOW "\033[33m"
24#define DEBUG_ANSI_GREEN "\033[32m"
25#define DEBUG_ANSI_MAGENTA "\033[35m"
26#define DEBUG_ANSI_CYAN "\033[36m"
27#define DEBUG_ANSI_WHITE "\033[37m"
28#define DEBUG_ANSI_ON_GREEN "\033[42m\033[30m"
29#define DEBUG_ANSI_ON_MAGENTA "\033[45m\033[30m"
30#define DEBUG_ANSI_ON_CYAN "\033[46m\033[30m"
31#define DEBUG_ANSI_ON_WHITE "\033[47m\033[30m"
32#define DEBUG_ANSI_ON_RED "\033[41m\033[30m"
33#define DEBUG_ANSI_ALERT "\033[41m\033[30m\033[5m"
34#define DEBUG_ANSI_CAUTION "\033[43m\033[30m\033[5m"
35
42#define DEBUG_ABORT(line, message) \
43 do { \
44 printf("Line %d: ", line); \
45 printf(message); \
46 printf("\n"); \
47 exit(1); \
48 } while (0)
49
51enum {
55};
56
58enum {
62};
63
65enum { DEBUG_COLUMN_WIDTH = 24 };
66
69
71enum { DEBUG_SCRATCH_SIZE = 1024 };
72
79
92void DEBUG_init(const char *options);
93
100void DEBUG_reset(void);
101
112int DEBUG_print(const char *text);
113
127int DEBUG_message(int number, int severity, const char *text);
128
141void DEBUG_addField(int placement, char *line, char *format, ...);
142
143#ifdef __cplusplus
144}
145#endif
146
147#endif
void DEBUG_reset(void)
Empty the output buffer and the pending message line.
char g_szDebugScratch[DEBUG_SCRATCH_SIZE]
Text the checker formats a message into before reporting it.
void DEBUG_addField(int placement, char *line, char *format,...)
Format a field and add it to a report line.
void DEBUG_init(const char *options)
Configure the module and allocate the output buffer.
@ DEBUG_MAX_WARNING_MASKS
Definition debug.h:68
int DEBUG_print(const char *text)
Append a line to the output buffer.
@ DEBUG_SCRATCH_SIZE
Definition debug.h:71
@ DEBUG_FATAL
Definition debug.h:53
@ DEBUG_ERROR
Definition debug.h:52
@ DEBUG_WARNING
Definition debug.h:54
@ DEBUG_FIELD_LINE
Definition debug.h:61
@ DEBUG_FIELD_INLINE
Definition debug.h:60
@ DEBUG_FIELD_COLUMN
Definition debug.h:59
int DEBUG_message(int number, int severity, const char *text)
Report an error or a warning.
@ DEBUG_COLUMN_WIDTH
Definition debug.h:65