Author: hpoussin Date: Fri Dec 14 18:59:14 2007 New Revision: 31216
URL: http://svn.reactos.org/svn/reactos?rev=31216&view=rev Log: Add ERR_, WARN_, TRACE_ and INFO_ macros which call DbgPrintEx
Modified: trunk/reactos/include/reactos/debug.h
Modified: trunk/reactos/include/reactos/debug.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/debug.h?rev... ============================================================================== --- trunk/reactos/include/reactos/debug.h (original) +++ trunk/reactos/include/reactos/debug.h Fri Dec 14 18:59:14 2007 @@ -21,14 +21,26 @@ #define CHECKED #endif
-/* Define DbgPrint/RtlAssert unless the NDK is used */ +/* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */ #if !defined(_RTLFUNCS_H) && (!defined(_NTDDK_) || !defined(__NTDDK_H))
/* Make sure we have basic types (some people include us *before* SDK... */ -#if defined(_NTDEF_) || (defined _WINDEF_) || (defined _WINDEF_H) +#if !defined(_NTDEF_) && !defined(_WINDEF_) && !defined(_WINDEF_H) +#error Please include SDK first. +#endif + ULONG __cdecl DbgPrint( + IN PCCH Format, + IN ... +); + +ULONG +__cdecl +DbgPrintEx( + IN ULONG ComponentId, + IN ULONG Level, IN PCCH Format, IN ... ); @@ -42,7 +54,6 @@ ULONG LineNumber, PCHAR Message ); -#endif
#endif
@@ -98,6 +109,28 @@ #define UNIMPLEMENTED \ DbgPrint("WARNING: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__);
+ #if defined(__GNUC__) + #define ERR_(ch, args...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL, "(%s:%d)", __FILE__, __LINE__), \ + DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL, ##args) + #define WARN_(ch, args...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, "(%s:%d)", __FILE__, __LINE__), \ + DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, ##args) + #define TRACE_(ch, args...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, "(%s:%d)", __FILE__, __LINE__), \ + DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, ##args) + #define INFO_(ch, args...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d)", __FILE__, __LINE__), \ + DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, ##args) + #elif defined(_MSC_VER) + #define ERR_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL, "(%s:%d)", __FILE__, __LINE__), \ + DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL, __VA_ARGS__) + #define WARN_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, "(%s:%d)", __FILE__, __LINE__), \ + DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, __VA_ARGS__) + #define TRACE_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, "(%s:%d)", __FILE__, __LINE__), \ + DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, __VA_ARGS__) + #define INFO_(ch, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d)", __FILE__, __LINE__), \ + DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, __VA_ARGS__) + #else + #error Unknown compiler + #endif + #else
/* On non-debug builds, we never show these */ @@ -107,6 +140,11 @@ #define CHECKPOINT1 #define CHECKPOINT #define UNIMPLEMENTED + + #define ERR_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) + #define WARN_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) + #define TRACE_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) + #define INFO_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) #endif
/*