41 #define PRINT(x) std::cout << x << std::endl;
42 #define WARN(x) PRINT("WARNING: " << x);
43 #define ERROR(x) std::cerr << "ERROR: " << x << std::endl;
44 #define DUMP(x) PRINT(#x << " = " << std::dec << x);
45 #define DUMP_HEX(x) PRINT(#x << " = 0x" << std::hex << x);
51 #define DEBUG_DUMP_HEX(x)
53 #define DEBUG_EXHAUSTIVE(x)
54 #define DEBUG_LOG_EXHAUSTIVE(x)
56 #define DEBUG(x) if (debug) { x }
57 #define DEBUG_LOG(x) if (debug) { PRINT("DEBUG: " << x); }
58 #define DEBUG_DUMP(x) if (debug) { PRINT("DEBUG: " << #x << " = " << std::dec << x); }
59 #define DEBUG_DUMP_HEX(x) if (debug) { PRINT("DEBUG: " << #x << " = 0x" << std::hex << x); }
61 #ifdef EXHAUSTIVE_DEBUGGING
62 #define DEBUG_EXHAUSTIVE(x) if (debug) { x }
63 #define DEBUG_LOG_EXHAUSTIVE(x) if (debug) { PRINT("DEBUG_EXHAUSTIVE: " << x); }
65 #define DEBUG_EXHAUSTIVE(x)
66 #define DEBUG_LOG_EXHAUSTIVE(x)
73 namespace int8_printers {
75 inline std::ostream &operator<<(std::ostream &os,
char c) {
76 return os << (std::is_signed<char>::value ?
static_cast<int>(c)
77 : static_cast<unsigned int>(c));
80 inline std::ostream &operator<<(std::ostream &os,
signed char c) {
81 return os << static_cast<int>(c);
84 inline std::ostream &operator<<(std::ostream &os,
unsigned char c) {
85 return os << static_cast<unsigned int>(c);
93 using namespace kaco::int8_printers;