summaryrefslogtreecommitdiff
path: root/base.h
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-11-20 22:28:38 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-11-20 22:28:38 -0500
commit5e458dff3bcc832b0b28d83bd3ef482174d1dc09 (patch)
tree28ac081edae5d36aad5df5b2e53848034dc2b99c /base.h
parentc3fd9dfa23969c842991da4cd852330288889463 (diff)
more text rendering
Diffstat (limited to 'base.h')
-rw-r--r--base.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/base.h b/base.h
index 92270bc..8327fdb 100644
--- a/base.h
+++ b/base.h
@@ -1,6 +1,10 @@
#ifndef BASE_H_
#define BASE_H_
+#ifndef DEBUG
+#define NDEBUG 1
+#endif
+
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@@ -34,4 +38,22 @@ typedef unsigned long ulong;
#define no_warn_end
#endif
+#if DEBUG
+#if __unix__
+#define debug_println printf
+#else // __unix__
+static void debug_println(char const *fmt, ...) {
+ char buf[256];
+ va_list args;
+ va_start(args, fmt);
+ vsprintf_s(buf, sizeof buf, fmt, args);
+ va_end(args);
+ OutputDebugStringA(buf);
+ OutputDebugStringA("\n");
+}
+#endif // __unix__
+#else // DEBUG
+#define debug_println(...)
+#endif
+
#endif