source: trunk/include/dbglog.h@ 10366

Last change on this file since 10366 was 9707, checked in by sandervl, 23 years ago

Added changed VAC headers to rename memory and file functions; add include\incl_vac to include path (/I)

File size: 3.0 KB
Line 
1/*
2 * Miscellaneous definitions
3 * Debug prototypes and macros
4 */
5
6
7#ifndef __DBGLOG_H__
8#define __DBGLOG_H__
9
10#if !defined(_OS2WIN_H) && !defined(__INCLUDE_WINUSER_H) && !defined(__WINE_WINBASE_H) && !defined(__WINE_WINDEF_H)
11 #include <win32type.h>
12#endif
13
14#ifdef __cplusplus
15 extern "C" {
16#endif
17
18#ifdef DEBUG
19#ifdef PRIVATE_LOGGING
20 //To use private dll logging, define PRIVATE_LOGGING and
21 //add Open/ClosePrivateLogFiles (see below) functions to the dll
22 //to open close the private logfile. The logfile handle should
23 //be stored in the _privateLogFile variable
24 //dprintf can be called like this:
25 //dprintf((LOG, "PE file : %s", szFileName));
26 #define LOG (void*)_privateLogFile
27 #define dprintf(a) WritePrivateLog a
28 #define dprintfGlobal(a) WriteLog a
29#else
30 #define dprintf(a) WriteLog a
31 #define dprintfNoEOL(a) WriteLogNoEOL a
32#endif
33 #define eprintf(a) WriteLog a
34 #define dassert(a, b) if(!(a)) dprintf b
35 #define dbgCheckObj(a) a->checkObject()
36 #define DisableLogging() DecreaseLogCount()
37 #define EnableLogging() IncreaseLogCount()
38
39#ifdef DEBUG_ENABLELOG_LEVEL2
40#ifdef PRIVATE_LOGGING
41 #define dprintf2(a) WritePrivateLog a
42#else
43 #define dprintf2(a) WriteLog a
44#endif
45#else
46 #define dprintf2(a)
47#endif
48
49#else
50 #define dprintfGlobal(a)
51 #define dprintf(a)
52 #define dprintf2(a)
53 #define dprintfNoEOL(a)
54 #define eprintf(a)
55 #define dassert(a, b)
56 #define dbgCheckObj(a)
57 #define DisableLogging()
58 #define EnableLogging()
59#endif
60
61
62// necessary types
63#ifndef __WINE_WINDEF_H
64#ifdef ULONG
65 #error ULONG definition is bad.
66 #define ULONG nope.
67#endif
68#ifndef NO_ULONG
69 typedef unsigned long ULONG;
70 typedef unsigned long HMODULE;
71#endif
72#endif //!__WINE_WINDEF_H
73
74#ifndef SYSTEM
75# define SYSTEM _System
76#endif
77
78
79int SYSTEM WriteLog(char *tekst, ...);
80int SYSTEM WriteLogNoEOL(char *tekst, ...);
81int SYSTEM WritePrivateLog(void *logfile, char *tekst, ...);
82
83void SYSTEM DecreaseLogCount();
84void SYSTEM IncreaseLogCount();
85
86void SYSTEM CheckVersion(ULONG version, char *modname);
87
88void SYSTEM CheckVersionFromHMOD(ULONG version, HMODULE hModule);
89
90int SYSTEM DebugErrorBox(ULONG iErrorCode,
91 char* pszFormat,
92 ...);
93
94//To use private logfiles for dlls, you must have these functions and call
95//them when the dll is loaded (open) and the exitlist handler is called (close)
96void OpenPrivateLogFiles();
97void ClosePrivateLogFiles();
98
99/* enable support for the _interrupt() statement */
100#if (defined(__IBMCPP__) || defined(__IBMC__))
101# include <builtin.h>
102#ifdef DEBUG
103#ifdef __cplusplus
104void inline BreakPoint(char *szFile, char *szFunction)
105{
106 dprintf(("BREAKPOINT %s %s", szFile, szFunction));
107 _interrupt(3);
108}
109 #define DebugInt3() BreakPoint(__FILE__, __FUNCTION__)
110
111#else
112 #define DebugInt3() _interrupt(3)
113#endif
114#else
115 #define DebugInt3()
116#endif
117
118#else
119#ifdef DEBUG
120 #define DebugInt3() _asm int 3;
121#else
122 #define DebugInt3()
123#endif
124
125#endif
126
127#ifdef __cplusplus
128 }
129#endif
130
131
132#endif //__DBGLOG_H__
133
Note: See TracBrowser for help on using the repository browser.