1 | /*
|
---|
2 | * Miscellaneous definitions
|
---|
3 | * Debug prototypes and macros
|
---|
4 | */
|
---|
5 |
|
---|
6 |
|
---|
7 | #ifndef __MISC_H__
|
---|
8 | #define __MISC_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 ; WriteLogError a
|
---|
34 | #define dassert(a, b) if(!(a)) WriteLogError 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 |
|
---|
79 | int SYSTEM WriteLog(char *tekst, ...);
|
---|
80 | int SYSTEM WriteLogNoEOL(char *tekst, ...);
|
---|
81 | int SYSTEM WritePrivateLog(void *logfile, char *tekst, ...);
|
---|
82 |
|
---|
83 | int SYSTEM WriteLogError(char *tekst, ...);
|
---|
84 |
|
---|
85 | void SYSTEM DecreaseLogCount();
|
---|
86 | void SYSTEM IncreaseLogCount();
|
---|
87 |
|
---|
88 | void SYSTEM CheckVersion(ULONG version, char *modname);
|
---|
89 |
|
---|
90 | void SYSTEM CheckVersionFromHMOD(ULONG version, HMODULE hModule);
|
---|
91 |
|
---|
92 | int SYSTEM DebugErrorBox(ULONG iErrorCode,
|
---|
93 | char* pszFormat,
|
---|
94 | ...);
|
---|
95 |
|
---|
96 | //To use private logfiles for dlls, you must have these functions and call
|
---|
97 | //them when the dll is loaded (open) and the exitlist handler is called (close)
|
---|
98 | void OpenPrivateLogFiles();
|
---|
99 | void ClosePrivateLogFiles();
|
---|
100 |
|
---|
101 | /* enable support for the _interrupt() statement */
|
---|
102 | #if (defined(__IBMCPP__) || defined(__IBMC__))
|
---|
103 | # include <builtin.h>
|
---|
104 | #ifdef DEBUG
|
---|
105 | #ifdef __cplusplus
|
---|
106 | void inline BreakPoint(char *szFile, char *szFunction)
|
---|
107 | {
|
---|
108 | dprintf(("BREAKPOINT %s %s", szFile, szFunction));
|
---|
109 | _interrupt(3);
|
---|
110 | }
|
---|
111 | #define DebugInt3() BreakPoint(__FILE__, __FUNCTION__)
|
---|
112 |
|
---|
113 | #else
|
---|
114 | #define DebugInt3() _interrupt(3)
|
---|
115 | #endif
|
---|
116 | #else
|
---|
117 | #define DebugInt3()
|
---|
118 | #endif
|
---|
119 |
|
---|
120 | #else
|
---|
121 | #ifdef DEBUG
|
---|
122 | #define DebugInt3() _asm int 3;
|
---|
123 | #else
|
---|
124 | #define DebugInt3()
|
---|
125 | #endif
|
---|
126 |
|
---|
127 | #endif
|
---|
128 |
|
---|
129 | #ifdef __cplusplus
|
---|
130 | }
|
---|
131 | #endif
|
---|
132 |
|
---|
133 |
|
---|
134 | #include "unicode.h"
|
---|
135 |
|
---|
136 | #endif
|
---|