4 **-----------------------------------------------------------------------------
6 ** Purpose: Sample Debug code
9 ** Copyright (c) 1995 - 1997 by Microsoft, all rights reserved
10 **-----------------------------------------------------------------------------
14 **-----------------------------------------------------------------------------
16 **-----------------------------------------------------------------------------
22 **-----------------------------------------------------------------------------
24 **-----------------------------------------------------------------------------
28 // Note: Define DEBUG_PROMPTME if you want MessageBox Error prompting
29 // This can get annoying quickly...
30 // #define DEBUG_PROMPTME
32 // Pre and Post debug string info
33 // #define START_STR TEXT ("D3DDESCENT: ")
34 #define START_STR TEXT ("")
35 #define END_STR TEXT ("\r\n")
39 #define DEBUG_ALWAYS 0L
40 #define DEBUG_CRITICAL 1L
41 #define DEBUG_ERROR 2L
42 #define DEBUG_MINOR 3L
44 #define DEBUG_DETAILS 5L
48 #define APPERR_GENERIC MAKE_DDHRESULT (10001)
49 #define APPERR_INVALIDPARAMS MAKE_DDHRESULT (10002)
50 #define APPERR_NOTINITIALIZED MAKE_DDHRESULT (10003)
51 #define APPERR_OUTOFMEMORY MAKE_DDHRESULT (10004)
52 #define APPERR_NOTFOUND MAKE_DDHRESULT (10005)
57 **-----------------------------------------------------------------------------
59 **-----------------------------------------------------------------------------
68 DPF (DEBUG_ALWAYS, TEXT("Assertion violated: %s, File = %s, Line = #%ld\n"), \
69 TEXT(#x), TEXT(__FILE__), (DWORD)__LINE__ ); \
74 #define REPORTERR(x) \
75 ReportDDError ((x), TEXT("%s(%ld)"), \
76 TEXT(__FILE__), (DWORD)__LINE__ );
79 ReportDDError ((x), TEXT("%s(%ld)"), \
80 TEXT(__FILE__), (DWORD)__LINE__ ); \
82 DestroyWindow (g_hWnd);
85 #define DPF 1 ? (void)0 : (void)
91 DestroyWindow (g_hWnd);
97 **-----------------------------------------------------------------------------
99 **-----------------------------------------------------------------------------
104 extern DWORD g_dwDebugLevel;
107 extern BOOL g_fDebug;
112 **-----------------------------------------------------------------------------
113 ** Function Prototypes
114 **-----------------------------------------------------------------------------
119 void __cdecl dprintf (DWORD dwDebugLevel, LPCTSTR szFormat, ...);
122 void _cdecl ReportDDError (HRESULT hResult, LPCTSTR szFormat, ...);
127 CDebugTracker (LPCSTR lpsz);
130 void __cdecl Return (LPCSTR szFormat, ...);
135 static ULONG s_cLevels;
136 static char szsp [80];
139 #define TRACKER_ENTER(str)\
140 CDebugTracker __tracker (str);
142 #define TRACKER_ENTER(str) while(0);
146 **-----------------------------------------------------------------------------
148 **-----------------------------------------------------------------------------
150 #endif // End DEBUG_H