aboutsummaryrefslogtreecommitdiff
path: root/lout/msg.h
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2010-08-20 23:24:19 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2010-08-20 23:24:19 +0200
commitf5c598b518d1f906148534d015f50075d3e8242d (patch)
tree21dd70add5b366c3dd80641b77f6b18e0baa009e /lout/msg.h
parente98d02a01ffeb18ede86af025e51ae1ec011c75a (diff)
parent5f0fc0e48b8cbee7e1795935da0abff6627fd498 (diff)
merge
Diffstat (limited to 'lout/msg.h')
-rw-r--r--lout/msg.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/lout/msg.h b/lout/msg.h
new file mode 100644
index 00000000..4993c105
--- /dev/null
+++ b/lout/msg.h
@@ -0,0 +1,39 @@
+#ifndef __MSG_H__
+#define __MSG_H__
+
+#include <stdio.h>
+
+#define prefs_show_msg 1
+
+#define D_STMT_START do
+#define D_STMT_END while (0)
+
+/*
+ * You can disable any MSG* macro by adding the '_' prefix.
+ */
+#define _MSG(...)
+#define _MSG_WARN(...)
+#define _MSG_ERR(...)
+
+
+#define MSG(...) \
+ D_STMT_START { \
+ if (prefs_show_msg){ \
+ printf(__VA_ARGS__); \
+ fflush (stdout); \
+ } \
+ } D_STMT_END
+
+#define MSG_WARN(...) \
+ D_STMT_START { \
+ if (prefs_show_msg) \
+ printf("** WARNING **: " __VA_ARGS__); \
+ } D_STMT_END
+
+#define MSG_ERR(...) \
+ D_STMT_START { \
+ if (prefs_show_msg) \
+ printf("** ERROR **: " __VA_ARGS__); \
+ } D_STMT_END
+
+#endif /* __MSG_H__ */