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