| 1 | // |
| 2 | // debugprint.h |
| 3 | // Part of ScottFree, an interpreter for adventures in Scott Adams format |
| 4 | // |
| 5 | // Created by Petter Sjölund on 2022-10-07. |
| 6 | // |
| 7 | |
| 8 | #ifndef DEBUG_PRINT |
| 9 | |
| 10 | /* Set this to 1 to enable debug print output */ |
| 11 | #define DEBUG_PRINT 0 |
| 12 | |
| 13 | #endif /* DEBUG_PRINT */ |
| 14 | |
| 15 | #ifndef debug_print |
| 16 | |
| 17 | #ifdef DEBUG |
| 18 | |
| 19 | #define debug_print(fmt, ...) \ |
| 20 | do { \ |
| 21 | if (DEBUG_PRINT) \ |
| 22 | fprintf(stderr, fmt, ##__VA_ARGS__); \ |
| 23 | } while (0) |
| 24 | |
| 25 | #else |
| 26 | |
| 27 | #define debug_print(fmt, ...) |
| 28 | |
| 29 | #endif /* DEBUG */ |
| 30 | |
| 31 | #endif /* debug_print */ |