annotate lout/msg.h @ 772:c1104104babf

Added lout/msg.h and normalized debug messages to use it.
author Jorge Arellano Cid <jcid@dillo.org>
date Fri, 16 Jan 2009 10:37:30 -0300
parents
children 64e078b7a711
rev   line source
772
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
1 #ifndef __MSG_H__
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
2 #define __MSG_H__
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
3
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
4 #include <stdio.h>
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
5
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
6 /*#include "prefs.h"*/
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
7 #define prefs_show_msg 1
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
8
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
9 #define D_STMT_START do
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
10 #define D_STMT_END while (0)
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
11
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
12 /*
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
13 * You can disable any MSG* macro by adding the '_' prefix.
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
14 */
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
15 #define _MSG(...)
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
16 #define _MSG_WARN(...)
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
17 #define _MSG_HTTP(...)
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
18
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
19
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
20 #define MSG(...) \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
21 D_STMT_START { \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
22 if (prefs_show_msg){ \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
23 printf(__VA_ARGS__); \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
24 fflush (stdout); \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
25 } \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
26 } D_STMT_END
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
27
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
28 #define MSG_WARN(...) \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
29 D_STMT_START { \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
30 if (prefs_show_msg) \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
31 printf("** WARNING **: " __VA_ARGS__); \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
32 } D_STMT_END
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
33
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
34 #define MSG_ERR(...) \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
35 D_STMT_START { \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
36 if (prefs_show_msg) \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
37 printf("** ERROR **: " __VA_ARGS__); \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
38 } D_STMT_END
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
39
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
40 #define MSG_HTTP(...) \
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
41 printf("HTTP warning: " __VA_ARGS__)
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
42
c1104104babf Added lout/msg.h and normalized debug messages to use it.
Jorge Arellano Cid <jcid@dillo.org>
parents:
diff changeset
43 #endif /* __MSG_H__ */