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