1 | #ifndef DEBUG_H
|
---|
2 | #define DEBUG_H
|
---|
3 |
|
---|
4 | //#include <lib.h>
|
---|
5 | extern int last_putchar;
|
---|
6 |
|
---|
7 | /* Defining DEBUG_THIS before including this file enables debug() macro
|
---|
8 | * for the file. DEBUG_ALL is for global control. */
|
---|
9 |
|
---|
10 | #if DEBUG_THIS || DEBUG_ALL
|
---|
11 | #define DEBUG 1
|
---|
12 | #else
|
---|
13 | #undef DEBUG
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #if DEBUG
|
---|
17 | # define debug(...) \
|
---|
18 | ((last_putchar=='\n' ? printf("%s: ", __FUNCTION__) : 0), \
|
---|
19 | printf(__VA_ARGS__))
|
---|
20 | # define debug_hexdump hexdump
|
---|
21 | #else
|
---|
22 | # define debug(...) /* nothing */
|
---|
23 | # define debug_hexdump(...) /* nothing */
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | #define debugx debug
|
---|
27 |
|
---|
28 | #endif /* DEBUG_H */
|
---|