124 lines
3.5 KiB
C
124 lines
3.5 KiB
C
|
/* UCMS_VERSION_ID("@(#)pcpdebug.h 61EX:1 readonly 17/05/95 12:58(#)@") */
|
||
|
/*****************************************************************************
|
||
|
*
|
||
|
* $Workfile:: PCPDEBUG.H $
|
||
|
*
|
||
|
* $Logfile:: $
|
||
|
*
|
||
|
* Library:: CLASSLIB
|
||
|
*
|
||
|
* Makefile:: MAKEFILE
|
||
|
*
|
||
|
* $Date:: 5-7-1993 $
|
||
|
*
|
||
|
* $Revision:: 0.00 $
|
||
|
*
|
||
|
* $Author:: Klaas van Ditzhuyzen $
|
||
|
*
|
||
|
* Functions:: DEBUG_PRINTF
|
||
|
*
|
||
|
* Logging of debug strings under OS/2 PM. Uses DBLOG.H when debug macros
|
||
|
* wanted.
|
||
|
* INCLUDE in the application's .DEF file:
|
||
|
*
|
||
|
IMPORTS
|
||
|
DEBUG_PRINTF=PMDEBUG.PMDEBUG
|
||
|
*
|
||
|
*
|
||
|
* $Log:: $
|
||
|
*
|
||
|
*****************************************************************************/
|
||
|
|
||
|
|
||
|
#ifndef PCPDEBUG_H
|
||
|
|
||
|
#ifdef UDEBUG
|
||
|
/* Use Uniface debug macros from Leen Kuiper .... */
|
||
|
#undef DEBUG /* Set to ONE anyway ... */
|
||
|
#define DEBUG 1
|
||
|
#define DEBUG_PRINTF_FUNCDEF(x)
|
||
|
#define DEBUG_ON() (utraDbg('I'))
|
||
|
#define DEBUG_PRINTF utraTrace
|
||
|
#include "utra.h"
|
||
|
|
||
|
#define UCONSTANT
|
||
|
|
||
|
#else
|
||
|
|
||
|
#define UCONSTANT const
|
||
|
#endif
|
||
|
|
||
|
#ifdef __IBMC__
|
||
|
#define SYSCALL _Optlink
|
||
|
#else
|
||
|
#define SYSCALL
|
||
|
#endif
|
||
|
|
||
|
#ifndef DEBUG_PRINTF /* define it to prevent later redefinition */
|
||
|
#define DEBUG_PRINTF DEBUG_PRINTF
|
||
|
#endif
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
#define _CFUNC_ extern "C"
|
||
|
#else
|
||
|
#define _CFUNC_
|
||
|
#endif
|
||
|
|
||
|
#ifndef UDEBUG
|
||
|
_CFUNC_ int SYSCALL DEBUG_PRINTF(const char *, ...);
|
||
|
#endif
|
||
|
|
||
|
#define _D_PREFIX "@#`~$"
|
||
|
|
||
|
#define _D_PMDEBUG1 _D_PREFIX "PMMSG"
|
||
|
#define _D_PMDEBUG2 _D_PREFIX "ASSERT"
|
||
|
#define _D_PMDEBUG6 _D_PREFIX "MSGINF"
|
||
|
#define _D_PMDEBUG7 _D_PREFIX "BSEERR%d"
|
||
|
#define _D_PMDEBUG8 _D_PREFIX "PMERR%d"
|
||
|
#define _D_PMDEBUG9 _D_PREFIX "PMWIN0x%08lX"
|
||
|
|
||
|
#ifndef assert
|
||
|
#ifndef NDEBUG
|
||
|
|
||
|
#if DEBUG
|
||
|
|
||
|
#define assert( expr ) \
|
||
|
( ( expr ) ? ( void )0 : (void) DEBUG_PRINTF( _D_PMDEBUG2, #expr, __FILE__, __LINE__ ) )
|
||
|
#else /* do not save expression */
|
||
|
#define assert( expr ) \
|
||
|
( ( expr ) ? ( void )0 : (void) DEBUG_PRINTF( _D_PMDEBUG2, NULL , __FILE__, __LINE__ ) )
|
||
|
|
||
|
#endif /* DEBUG */
|
||
|
|
||
|
#else
|
||
|
|
||
|
#define assert( ignore ) ( ( void )0 )
|
||
|
|
||
|
#endif /* NDEBUG */
|
||
|
#endif /* assert */
|
||
|
|
||
|
|
||
|
/* These two lines can be commented out when */
|
||
|
#include "pcpdbg.h"
|
||
|
/* debug macros are not needed. */
|
||
|
|
||
|
#if DEBUG
|
||
|
EXTERN_C void DEBUG_SETPARAMETERS(const char * envstr, const char * logfile, void * winconsole, void * reserved) ;
|
||
|
static char _debug_tmpbuf[50];
|
||
|
#define DEBUG_GETPMMESSAGE(msg) ((char*)DEBUG_PRINTF( _D_PMDEBUG6 , msg, _debug_tmpbuf))
|
||
|
#define DEBUG_GETBSEERR(msg) ((char*)DEBUG_PRINTF( _D_PMDEBUG7 , msg, _debug_tmpbuf))
|
||
|
#define DEBUG_GETPMERR(msg) ((char*)DEBUG_PRINTF( _D_PMDEBUG8 , msg, _debug_tmpbuf))
|
||
|
#define DEBUG_LOGWINDATA(hwnd,text) ( (void)DEBUG_PRINTF( _D_PMDEBUG9 , hwnd, text))
|
||
|
#define DEBUG_LOGPMMSG(qmsg) if (DEBUG_ON()) DEBUG_PRINTF( _D_PMDEBUG1 , (void*)qmsg)
|
||
|
#else
|
||
|
#define DEBUG_SETPARAMETERS(a,b,c,d)
|
||
|
#define DEBUG_GETPMMESSAGE(msg)
|
||
|
#define DEBUG_GETBSEERR(msg)
|
||
|
#define DEBUG_GETPMERR(msg)
|
||
|
#define DEBUG_LOGWINDATA(hwnd,text)
|
||
|
#define DEBUG_LOGPMMSG(qmsg)
|
||
|
#endif
|
||
|
|
||
|
|
||
|
#endif /* PCPDEBUG_H */
|