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