| 1 | /* $Id: misc.h,v 1.18 2000-09-15 13:23:23 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 |   #define dprintfNoEOL(a)      WriteLogNoEOL a
 | 
|---|
| 53 | #endif
 | 
|---|
| 54 |   #define eprintf(a)      WriteLog a ; WriteLogError a
 | 
|---|
| 55 |   #define dassert(a, b)   if(!(a)) WriteLogError b
 | 
|---|
| 56 |   #define dbgCheckObj(a)        a->checkObject()
 | 
|---|
| 57 |   #define DisableLogging  DecreaseLogCount
 | 
|---|
| 58 |   #define EnableLogging   IncreaseLogCount
 | 
|---|
| 59 | 
 | 
|---|
| 60 | #ifdef DEBUG_ENABLELOG_LEVEL2
 | 
|---|
| 61 | #ifdef PRIVATE_LOGGING
 | 
|---|
| 62 |   #define dprintf2(a)      WritePrivateLog a
 | 
|---|
| 63 | #else
 | 
|---|
| 64 |   #define dprintf2(a)      WriteLog a
 | 
|---|
| 65 | #endif
 | 
|---|
| 66 | #else
 | 
|---|
| 67 |   #define dprintf2(a)
 | 
|---|
| 68 | #endif
 | 
|---|
| 69 | 
 | 
|---|
| 70 | #else
 | 
|---|
| 71 |   #define dprintfGlobal(a)
 | 
|---|
| 72 |   #define dprintf(a)
 | 
|---|
| 73 |   #define dprintf2(a)
 | 
|---|
| 74 |   #define dprintfNoEOL(a)
 | 
|---|
| 75 |   #define eprintf(a)
 | 
|---|
| 76 |   #define dassert(a, b)
 | 
|---|
| 77 |   #define dbgCheckObj(a)
 | 
|---|
| 78 |   #define DisableLogging
 | 
|---|
| 79 |   #define EnableLogging
 | 
|---|
| 80 | #endif
 | 
|---|
| 81 | 
 | 
|---|
| 82 | 
 | 
|---|
| 83 | // necessary types
 | 
|---|
| 84 | #ifndef __WINE_WINDEF_H
 | 
|---|
| 85 | #ifdef ULONG
 | 
|---|
| 86 |   #error ULONG definition is bad.
 | 
|---|
| 87 |   #define ULONG nope.
 | 
|---|
| 88 | #endif
 | 
|---|
| 89 | #ifndef NO_ULONG
 | 
|---|
| 90 |   typedef unsigned long ULONG;
 | 
|---|
| 91 |   typedef unsigned long HMODULE;
 | 
|---|
| 92 | #endif
 | 
|---|
| 93 | #endif //!__WINE_WINDEF_H
 | 
|---|
| 94 | 
 | 
|---|
| 95 | #ifndef SYSTEM
 | 
|---|
| 96 | #  define SYSTEM _System
 | 
|---|
| 97 | #endif
 | 
|---|
| 98 | 
 | 
|---|
| 99 | 
 | 
|---|
| 100 | int  SYSTEM WriteLog(char *tekst, ...);
 | 
|---|
| 101 | int  SYSTEM WriteLogNoEOL(char *tekst, ...);
 | 
|---|
| 102 | int  SYSTEM WritePrivateLog(void *logfile, char *tekst, ...);
 | 
|---|
| 103 | 
 | 
|---|
| 104 | int  SYSTEM WriteLogError(char *tekst, ...);
 | 
|---|
| 105 | 
 | 
|---|
| 106 | void SYSTEM DecreaseLogCount();
 | 
|---|
| 107 | void SYSTEM IncreaseLogCount();
 | 
|---|
| 108 | 
 | 
|---|
| 109 | void SYSTEM CheckVersion(ULONG version, char *modname);
 | 
|---|
| 110 | 
 | 
|---|
| 111 | void SYSTEM CheckVersionFromHMOD(ULONG version, HMODULE hModule);
 | 
|---|
| 112 | 
 | 
|---|
| 113 | int  SYSTEM DebugErrorBox(ULONG  iErrorCode,
 | 
|---|
| 114 |                           char*  pszFormat,
 | 
|---|
| 115 |                           ...);
 | 
|---|
| 116 | 
 | 
|---|
| 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();
 | 
|---|
| 121 | 
 | 
|---|
| 122 | #ifdef __cplusplus
 | 
|---|
| 123 |         }
 | 
|---|
| 124 | #endif
 | 
|---|
| 125 | 
 | 
|---|
| 126 | 
 | 
|---|
| 127 | #include "unicode.h"
 | 
|---|
| 128 | 
 | 
|---|
| 129 | #endif
 | 
|---|