whoops - forgot to commit header files
[reactos.git] / posix / include / psx / debug.h
1 /*
2 * psx/debug.h
3 *
4 * debugging utilities
5 *
6 * This file is part of the ReactOS Operating System.
7 *
8 * Contributors:
9 * Created by KJK::Hyperion <noog@libero.it>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22 #ifndef __PSX_DEBUG_H_INCLUDED__
23 #define __PSX_DEBUG_H_INCLUDED__
24
25 /* INCLUDES */
26 #ifdef __PSX_DEBUG_TO_STDERR__
27 #include <stdio.h>
28 #else /* !defined(__PSX_DEBUG_TO_STDERR__) */
29 #include <ddk/ntddk.h>
30 #endif /* defined(__PSX_DEBUG_TO_STDERR__) */
31
32 /* OBJECTS */
33
34 /* TYPES */
35
36 /* CONSTANTS */
37
38 /* PROTOTYPES */
39
40 /* MACROS */
41
42 #define __PSX_MODULE__ "psxdll.dll"
43
44 #ifndef NDEBUG
45
46 #ifdef __PSX_DEBUG_TO_STDERR__
47
48 #if 0
49 #define DEBUGOUT(MODULE,TYPE,ARGS...) \
50 do{ \
51 fprintf(stderr,"%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \
52 fprintf(stderr,ARGS); \
53 fprintf("\n"); \
54 } \
55 while(0)
56 #endif
57
58 #define DEBUGOUT(MODULE,TYPE,ARGS...) \
59 do{ \
60 printf("%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \
61 printf(ARGS); \
62 printf("\n"); \
63 } \
64 while(0)
65
66
67 #else /* !defined(__PSX_DEBUG_TO_STDERR__) */
68
69 #define DEBUGOUT(MODULE,TYPE,ARGS...) \
70 do{ \
71 DbgPrint("%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \
72 DbgPrint(ARGS); \
73 DbgPrint("\n"); \
74 } \
75 while(0)
76
77 #endif /* defined(__PSX_DEBUG_TO_STDERR__) */
78
79 #define DEBUGOUTIF(CONDITION,MODULE,TYPE,ARGS...) \
80 if((CONDITION)) \
81 { \
82 DEBUGOUT((MODULE),(TYPE),ARGS); \
83 }
84
85 #else /* defined(NDEBUG) */
86
87 #define DEBUGOUTIF(c,m,t,args...)
88 #define DEBUGOUT(m,t,args...)
89
90 #endif /* !defined(NDEBUG) */
91
92 #if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_HINTS__)
93 #define HINT(args...) DEBUGOUT(__PSX_MODULE__,"HINT",args)
94 #define HINTIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"HINT",args)
95 #else
96 #define HINT(args...)
97 #define HINTIF(c,args...)
98 #endif
99
100 #if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_INFOS__)
101 #define INFO(args...) DEBUGOUT(__PSX_MODULE__,"INFO",args)
102 #define INFOIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"INFO",args)
103 #else
104 #define INFO(args...)
105 #define INFOIF(c,args...)
106 #endif
107
108 #if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_WARNS__)
109 #define WARN(args...) DEBUGOUT(__PSX_MODULE__,"WARN",args)
110 #define WARNIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"WARN",args)
111 #else
112 #define WARN(args...)
113 #define WARNIF(c,args...)
114 #endif
115
116 #if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_ERRS__)
117 #define ERR(args...) DEBUGOUT(__PSX_MODULE__,"ERR",args)
118 #define ERRIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"ERR",args)
119 #else
120 #define ERR(args...)
121 #define ERRIF(c,args...)
122 #endif
123
124 #if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_TODOS__)
125 #define TODO(args...) DEBUGOUT(__PSX_MODULE__,"TODO",args)
126 #define TODOIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"TODO",args)
127 #else
128 #define TODO(args...)
129 #define TODOIF(c,args...)
130 #endif
131
132 #if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_FIXMES__)
133 #define FIXME(args...) DEBUGOUT(__PSX_MODULE__,"FIXME",args)
134 #define FIXMEIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"FIXME",args)
135 #else
136 #define FIXME(args...)
137 #define FIXMEIF(c,args...)
138 #endif
139
140
141 #endif /* __PSX_DEBUG_H_INCLUDED__ */
142
143 /* EOF */
144