You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
774 B
31 lines
774 B
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
struct X {
|
|
#ifdef LOG_DEBUG
|
|
X() { if(false) std::cout.setstate(std::ios_base::failbit); }
|
|
~X() { if(false) { std::cout.clear(); } else { std::cout << std::endl << std::flush; } }
|
|
#else
|
|
X() { std::cout.setstate(std::ios_base::failbit); }
|
|
~X() { std::cout.clear(); }
|
|
#endif
|
|
};
|
|
|
|
|
|
#define DEBUG (X(), std::cout << "DEBUG[" << __FILENAME__ << ":" << __LINE__ << " in " << __func__ << "()]: ")
|
|
#define WARN (X(), std::cout << "WARN [" << __FILENAME__ << ":" << __LINE__ << " in " << __func__ << "()]: ")
|
|
|
|
#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);
|
|
}
|