home *** CD-ROM | disk | FTP | other *** search
- /*
- Company: Sensaura Ltd
- Copyright: (C) 2000
-
- File Name: Debug.h
- File Description: Debugging support functions, definitions and macros
- Author: Adam Philp
- Last Update: 04-JAN-00
-
- Target Compiler: Microsoft Visual C++ Version 5.0
- */
-
- #ifndef __DEBUG_H // Only use file if not already included
- #define __DEBUG_H
-
- #define TRY(x) if(!(x)) goto TRY_ERROR;
-
- #ifdef _DEBUG // Debug macros expand to functions only in debug build
-
- #ifndef FALSE
- #define FALSE 0
- #endif
-
- #ifndef TRUE
- #define TRUE (!FALSE)
- #endif
-
- #ifndef PTRACE
- #ifdef _PTRACE
- #define PTRACE DebugTracePrepare(__FILE__, __LINE__); DebugOutput
- #else
- #define PTRACE
- #endif
- #endif
-
- #ifndef TRACE
- #define TRACE DebugTracePrepare(__FILE__, __LINE__); DebugTrace
- #define TRACEDISABLE DebugTraceDisable();
- #define TRACEENABLE DebugTraceEnable();
- #endif
-
- #ifndef TRACEERROR
- #define TRACEERROR DebugTracePrepare(__FILE__, __LINE__); DebugError
- #endif
-
- #ifndef ASSERT
- #include <crtdbg.h>
- #define ASSERT _ASSERT
- #define VERIFY ASSERT
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- extern void DebugTracePrepare(const char* lpcszFileName, int NumLine);
- extern void DebugTrace(int DebugLevel, const char* lpcszFormat, ...);
- extern void DebugError(const char* lpcszFormat, ...);
- extern void DebugOutput(const char* lpcszFormat, ...);
- extern void DebugTraceDisable();
- extern void DebugTraceEnable();
-
- #ifdef __cplusplus
- }
- #endif
-
- #else // (#ifdef _DEBUG) Macros expand to nothing in release build
-
- #define PTRACE
- #define TRACE
- #define TRACEERROR
- #define TRACEDISABLE
- #define TRACEENABLE
- #define ASSERT
- #define VERIFY
- #define END
-
- #endif // (#ifdef _DEBUG)
-
- #endif // __DEBUG_H