Revert "lists: Add list literal doc example."
[factor.git] / vm / debug.hpp
blob3c56f818aac72f2ce73fced391e78a1f01a90928
1 namespace factor {
3 extern bool factor_print_p;
5 #ifdef FACTOR_DEBUG
7 // To chop the directory path of the __FILE__ macro.
8 inline const char* abbrev_path(const char* path) {
9 const char* p1 = strrchr(path, '\\');
10 const char* p2 = strrchr(path, '/');
11 return (p1 > p2 ? p1 : p2) + 1;
14 #define FACTOR_PRINT(x) \
15 do { \
16 if (factor_print_p) { \
17 std::cerr \
18 << std::setw(16) << std::left << abbrev_path(__FILE__) \
19 << " " << std::setw(4) << std::right << __LINE__ \
20 << " " << std::setw(20) << std::left << __FUNCTION__ \
21 << " " << x \
22 << std::endl; \
23 } \
24 } while (0)
25 #define FACTOR_PRINT_MARK FACTOR_PRINT("")
27 #else
28 #define FACTOR_PRINT(fmt, ...) ((void)0)
29 #define FACTOR_PRINT_MARK ((void)0)
30 #endif