source: trunk/include/misc.h@ 2061

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

added support for private logfiles

File size: 2.4 KB
Line 
1/* $Id: misc.h,v 1.12 1999-12-12 14:31:29 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#ifndef _OS2WIN_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
50#ifdef DEBUG_ENABLELOG_LEVEL2
51#ifdef PRIVATE_LOGGING
52 #define dprintf2(a) WritePrivateLog a
53#else
54 #define dprintf2(a) WriteLog a
55#endif
56#else
57 #define dprintf2(a)
58#endif
59
60#else
61 #define dprintfGlobal(a)
62 #define dprintf(a)
63 #define dprintf2(a)
64 #define eprintf(a)
65 #define dassert(a, b)
66 #define dbgCheckObj(a)
67#endif
68
69
70// necessary types
71#ifdef ULONG
72 #error ULONG definition is bad.
73 #define ULONG nope.
74#endif
75#ifndef NO_ULONG
76 typedef unsigned long ULONG;
77 typedef unsigned long HMODULE;
78#endif
79
80#ifndef SYSTEM
81# define SYSTEM _System
82#endif
83
84
85int SYSTEM WriteLog(char *tekst, ...);
86int SYSTEM WritePrivateLog(void *logfile, char *tekst, ...);
87
88int SYSTEM WriteLogError(char *tekst, ...);
89
90void SYSTEM CheckVersion(ULONG version, char *modname);
91
92void SYSTEM CheckVersionFromHMOD(ULONG version, HMODULE hModule);
93
94int SYSTEM DebugErrorBox(ULONG iErrorCode,
95 char* pszFormat,
96 ...);
97
98//To use private logfiles for dlls, you must have these functions and call
99//them when the dll is loaded (open) and the exitlist handler is called (close)
100void OpenPrivateLogFiles();
101void ClosePrivateLogFiles();
102
103#ifdef __cplusplus
104 }
105#endif
106
107
108#include "versionos2.h"
109#include "unicode.h"
110
111#endif
Note: See TracBrowser for help on using the repository browser.