summaryrefslogtreecommitdiffstats
path: root/src/emu/log.h
diff options
context:
space:
mode:
authorBenedikt Böhm <bb@xnull.de>2009-05-18 20:53:42 +0200
committerBenedikt Böhm <bb@xnull.de>2009-05-18 20:53:42 +0200
commit49f510d2d60129526832bfcd9c0f4049962bc80e (patch)
tree2828b773c75bdbc4014a3421c8046778a1a2b11b /src/emu/log.h
parent144258f0196b69cbdd2f29bd501276942efc3182 (diff)
downloadswppy-49f510d2d60129526832bfcd9c0f4049962bc80e.tar.gz
swppy-49f510d2d60129526832bfcd9c0f4049962bc80e.tar.xz
swppy-49f510d2d60129526832bfcd9c0f4049962bc80e.zip
move stuff around and create initial source structure
Diffstat (limited to 'src/emu/log.h')
-rw-r--r--src/emu/log.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/emu/log.h b/src/emu/log.h
new file mode 100644
index 0000000..6660c66
--- /dev/null
+++ b/src/emu/log.h
@@ -0,0 +1,33 @@
+#ifndef _LOG_H
+#define _LOG_H
+
+#include <stdbool.h>
+#include <stdio.h>
+
+extern bool is_debug;
+
+#define debug(...) do { \
+ if (is_debug) { \
+ fprintf(stderr, __VA_ARGS__); \
+ fprintf(stderr, "\n"); \
+ } \
+} while (0)
+
+#define error(...) do { \
+ fprintf(stderr, __VA_ARGS__); \
+ fprintf(stderr, "\n"); \
+} while (0)
+
+#define die(...) do { \
+ error(__VA_ARGS__); \
+ exit(EXIT_FAILURE); \
+} while (0)
+
+#define pdie(...) do { \
+ fprintf(stderr, __VA_ARGS__); \
+ fprintf(stderr, ": "); \
+ perror(NULL); \
+ exit(EXIT_FAILURE); \
+} while (0)
+
+#endif