source: trunk/include/misc.h@ 2431

Last change on this file since 2431 was 2431, checked in by sandervl, 26 years ago

added logging functions

File size: 2.7 KB
Line 
1/* $Id: misc.h,v 1.15 2000-01-13 20:09:59 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#endif
24
25#ifdef DEBUG
26 #define DebugInt3() _interrupt(3)
27#else
28 #define DebugInt3()
29#endif
30
31
32#ifdef DEBUG
33#ifdef PRIVATE_LOGGING
34 //To use private dll logging, define PRIVATE_LOGGING and
35 //add Open/ClosePrivateLogFiles (see below) functions to the dll
36 //to open close the private logfile. The logfile handle should
37 //be stored in the _privateLogFile variable
38 //dprintf can be called like this:
39 //dprintf((LOG, "PE file : %s", szFileName));
40 #define LOG (void*)_privateLogFile
41 #define dprintf(a) WritePrivateLog a
42 #define dprintfGlobal(a) WriteLog a
43#else
44 #define dprintf(a) WriteLog a
45#endif
46 #define eprintf(a) WriteLog a ; WriteLogError a
47 #define dassert(a, b) if(!(a)) WriteLogError b
48 #define dbgCheckObj(a) a->checkObject()
49 #define DisableLogging DecreaseLogCount
50 #define EnableLogging IncreaseLogCount
51
52#ifdef DEBUG_ENABLELOG_LEVEL2
53#ifdef PRIVATE_LOGGING
54 #define dprintf2(a) WritePrivateLog a
55#else
56 #define dprintf2(a) WriteLog a
57#endif
58#else
59 #define dprintf2(a)
60#endif
61
62#else
63 #define dprintfGlobal(a)
64 #define dprintf(a)
65 #define dprintf2(a)
66 #define eprintf(a)
67 #define dassert(a, b)
68 #define dbgCheckObj(a)
69 #define DisableLogging
70 #define EnableLogging
71#endif
72
73
74// necessary types
75#ifndef __WINE_WINDEF_H
76#ifdef ULONG
77 #error ULONG definition is bad.
78 #define ULONG nope.
79#endif
80#ifndef NO_ULONG
81 typedef unsigned long ULONG;
82 typedef unsigned long HMODULE;
83#endif
84#endif //!__WINE_WINDEF_H
85
86#ifndef SYSTEM
87# define SYSTEM _System
88#endif
89
90
91int SYSTEM WriteLog(char *tekst, ...);
92int SYSTEM WritePrivateLog(void *logfile, char *tekst, ...);
93
94int SYSTEM WriteLogError(char *tekst, ...);
95
96void SYSTEM DecreaseLogCount();
97void SYSTEM IncreaseLogCount();
98
99void SYSTEM CheckVersion(ULONG version, char *modname);
100
101void SYSTEM CheckVersionFromHMOD(ULONG version, HMODULE hModule);
102
103int SYSTEM DebugErrorBox(ULONG iErrorCode,
104 char* pszFormat,
105 ...);
106
107//To use private logfiles for dlls, you must have these functions and call
108//them when the dll is loaded (open) and the exitlist handler is called (close)
109void OpenPrivateLogFiles();
110void ClosePrivateLogFiles();
111
112#ifdef __cplusplus
113 }
114#endif
115
116
117#include "versionos2.h"
118#include "unicode.h"
119
120#endif
Note: See TracBrowser for help on using the repository browser.