summaryrefslogtreecommitdiff
path: root/lout
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2009-01-16 10:37:30 -0300
committerJorge Arellano Cid <jcid@dillo.org>2009-01-16 10:37:30 -0300
commitaba09fd14b3f8a4a665d4f045e1b666803a90321 (patch)
treee3a8502ea6e7fdec50b9f80ab7716698ac0bc647 /lout
parent8175675595e0fb05341b181dc00a59cd83659537 (diff)
Added lout/msg.h and normalized debug messages to use it.
Diffstat (limited to 'lout')
-rw-r--r--lout/Makefile.am3
-rw-r--r--lout/msg.h43
2 files changed, 45 insertions, 1 deletions
diff --git a/lout/Makefile.am b/lout/Makefile.am
index 18e00cf2..5a246708 100644
--- a/lout/Makefile.am
+++ b/lout/Makefile.am
@@ -11,4 +11,5 @@ liblout_a_SOURCES = \
object.cc \
object.hh \
signal.cc \
- signal.hh
+ signal.hh \
+ msg.h
diff --git a/lout/msg.h b/lout/msg.h
new file mode 100644
index 00000000..219a9744
--- /dev/null
+++ b/lout/msg.h
@@ -0,0 +1,43 @@
+#ifndef __MSG_H__
+#define __MSG_H__
+
+#include <stdio.h>
+
+/*#include "prefs.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_HTTP(...)
+
+
+#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
+
+#define MSG_HTTP(...) \
+ printf("HTTP warning: " __VA_ARGS__)
+
+#endif /* __MSG_H__ */