summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/include/debug.hpp48
m---------lib/libwrapsdl20
2 files changed, 48 insertions, 0 deletions
diff --git a/lib/include/debug.hpp b/lib/include/debug.hpp
new file mode 100644
index 0000000..fd90500
--- /dev/null
+++ b/lib/include/debug.hpp
@@ -0,0 +1,48 @@
+#pragma once
+
+#ifdef DEBUG
+#include <iostream>
+#include <sstream>
+
+#define __FILENAME__ (\
+ __builtin_strrchr(__FILE__, '/') ? \
+ __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
+
+#define npdebug(...); { \
+ std::cerr << "[" << __FILENAME__ \
+ << ":" << __LINE__ \
+ << ", " << __func__ \
+ << "] " ; \
+ _np::debug(__VA_ARGS__); \
+}
+
+#define npinspect(...); _np::inspect(__VA_ARGS__);
+
+namespace _np {
+ template<typename... Args>
+ inline void debug(const Args&... args) {
+ (std::cerr << ... << args) << std::endl;
+ }
+
+ template<typename Msg, typename Expr, typename... Args>
+ inline T& inspect(const Msg& msg, Expr& expr, const Args&... args) {
+ npdebug(msg, expr, args);
+ return expr;
+ }
+}
+
+#else
+
+#define npdebug(...); {}
+#define npinspect(...); {}
+
+namespace _np {
+ template<typename.. Args>
+ void debug(Args&... args) {}
+
+ template<typename Msg, typename Expr, typename... Args>
+ inline T& inspect(const Msg& msg, Expr& expr, const Args&... args) {
+ return expr;
+ }
+}
+#endif
diff --git a/lib/libwrapsdl2 b/lib/libwrapsdl2
deleted file mode 160000
-Subproject 66bb51fa6148d6910da054bacd4fcbd2fa7b5ba