#pragma once #include #include struct print { print() {} ~print() { std::cout << std::endl; } }; struct noprint { noprint() { std::cout.setstate(std::ios_base::failbit); } ~noprint() { std::cout.clear(); } }; #ifdef LOG_DEBUG #define DEBUG (print(), std::cout << "DEBUG[" << __FILENAME__ << ":" << __LINE__ << " in " << __func__ << "()]: ") #define WARN (print(), std::cout << "WARN [" << __FILENAME__ << ":" << __LINE__ << " in " << __func__ << "()]: ") #else #define DEBUG (noprint(), std::cout << "") #define WARN (noprint(), std::cout << "") #endif #ifdef LOG_DEBUG #define STEP \ do { DEBUG << "Stepping through, Hit Enter..."; \ std::cin.get(); \ } while (0) #else #define STEP (void)(0) #endif namespace io { void debug(std::string msg); }