00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: pldebug.h,v 1.1 2004/05/21 21:02:52 maxx Exp $ 00005 | 00006 | Plattform-independent support for PLASSERT_VALID, PLTRACE and 00007 | PLASSERT. 00008 | 00009 | Copyright (c) 1996-1998 Ulrich von Zadow 00010 | 00011 \-------------------------------------------------------------------- 00012 */ 00013 00014 #ifndef INCL_PLDEBUG 00015 #define INCL_PLDEBUG 00016 00017 //------------- PLASSERT_VALID 00018 #ifdef _DEBUG 00019 #define PLASSERT_VALID(pOb) (pOb)->AssertValid() 00020 #else 00021 #define PLASSERT_VALID(pOb) do{} while (0) 00022 #endif 00023 00024 //------------- TRACE 00025 #ifdef _DEBUG 00026 void PLTrace(const char * pszFormat, ...); 00027 #define PLTRACE ::PLTrace 00028 #else 00029 // This will be optimized away in release mode and still allow TRACE 00030 // to take a variable amount of arguments :-). 00031 inline void PLTrace (const char *, ...) { } 00032 #define PLTRACE 1 ? (void)0 : ::PLTrace 00033 #endif 00034 00035 //------------- ASSERT 00036 00037 #ifdef _DEBUG 00038 #ifdef _WINDOWS 00039 #define PLASSERT(f) \ 00040 if (!(f)) \ 00041 { \ 00042 PLTRACE ("Assertion failed at %s, %i\n", __FILE__, __LINE__); \ 00043 __asm { int 3 } \ 00044 } 00045 #else 00046 #define PLASSERT(f) \ 00047 if (!(f)) \ 00048 { \ 00049 PLTRACE ("Assertion failed at %s, %i\n", __FILE__, __LINE__); \ 00050 abort(); \ 00051 } 00052 #endif 00053 #else 00054 #define PLASSERT(f) do{}while (0) 00055 #endif 00056 00057 00058 //------------- CompilerAssert template for conditional 00059 // compile time error generation. 00060 00061 #define PLCOMPILER_ASSERT(cond) (void)sizeof(int[bool(cond)?1:-1]); 00062 00063 00064 #endif // INCL_PLDEBUG 00065 00066 /* 00067 /-------------------------------------------------------------------- 00068 | 00069 | $Log: pldebug.h,v $ 00070 | Revision 1.1 2004/05/21 21:02:52 maxx 00071 | Initial Version of vuVolume, moderatly changed to make it compile on my windows and linux machine. 00072 | 00073 | Revision 1.1 2002/11/13 01:58:21 mspindle 00074 | *** empty log message *** 00075 | 00076 | Revision 1.2 2001/10/21 17:12:39 uzadow 00077 | Added PSD decoder beta, removed BPPWanted from all decoders, added PLFilterPixel. 00078 | 00079 | Revision 1.1 2001/09/16 19:03:22 uzadow 00080 | Added global name prefix PL, changed most filenames. 00081 | 00082 | Revision 1.3 2000/12/04 23:55:40 uzadow 00083 | no message 00084 | 00085 | Revision 1.2 2000/12/04 13:28:17 uzadow 00086 | Changed PLASSERT to use int 3 in windows builds. 00087 | 00088 | Revision 1.1 2000/01/17 23:45:07 Ulrich von Zadow 00089 | MFC-Free version. 00090 | 00091 | 00092 \-------------------------------------------------------------------- 00093 */