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
RevLine 
[2061]1/* $Id: misc.h,v 1.12 1999-12-12 14:31:29 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
[780]12#ifndef _OS2WIN_H
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>
23#endif
24
[4]25#ifdef DEBUG
[13]26 #define DebugInt3() _interrupt(3)
[4]27#else
[13]28 #define DebugInt3()
[4]29#endif
30
31
32#ifdef DEBUG
[2061]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
[13]44 #define dprintf(a) WriteLog a
[2061]45#endif
[13]46 #define eprintf(a) WriteLog a ; WriteLogError a
47 #define dassert(a, b) if(!(a)) WriteLogError b
48 #define dbgCheckObj(a) a->checkObject()
[1669]49
50#ifdef DEBUG_ENABLELOG_LEVEL2
[2061]51#ifdef PRIVATE_LOGGING
52 #define dprintf2(a) WritePrivateLog a
[4]53#else
[2061]54 #define dprintf2(a) WriteLog a
55#endif
56#else
[1669]57 #define dprintf2(a)
58#endif
59
60#else
[2061]61 #define dprintfGlobal(a)
[13]62 #define dprintf(a)
[1953]63 #define dprintf2(a)
[13]64 #define eprintf(a)
65 #define dassert(a, b)
66 #define dbgCheckObj(a)
[4]67#endif
68
[17]69
[780]70// necessary types
71#ifdef ULONG
72 #error ULONG definition is bad.
73 #define ULONG nope.
[17]74#endif
[1616]75#ifndef NO_ULONG
76 typedef unsigned long ULONG;
77 typedef unsigned long HMODULE;
78#endif
[17]79
80#ifndef SYSTEM
81# define SYSTEM _System
82#endif
83
84
[13]85int SYSTEM WriteLog(char *tekst, ...);
[2061]86int SYSTEM WritePrivateLog(void *logfile, char *tekst, ...);
[924]87
[13]88int SYSTEM WriteLogError(char *tekst, ...);
[924]89
[4]90void SYSTEM CheckVersion(ULONG version, char *modname);
[924]91
[4]92void SYSTEM CheckVersionFromHMOD(ULONG version, HMODULE hModule);
93
[924]94int SYSTEM DebugErrorBox(ULONG iErrorCode,
95 char* pszFormat,
96 ...);
97
[2061]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();
[924]102
[4]103#ifdef __cplusplus
104 }
105#endif
106
[13]107
[4]108#include "versionos2.h"
109#include "unicode.h"
110
111#endif
Note: See TracBrowser for help on using the repository browser.