From 49f510d2d60129526832bfcd9c0f4049962bc80e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20B=C3=B6hm?= Date: Mon, 18 May 2009 20:53:42 +0200 Subject: move stuff around and create initial source structure --- src/emu/log.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/emu/log.h (limited to 'src/emu/log.h') 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 +#include + +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 -- cgit v1.2.3