Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

elog.h

Go to the documentation of this file.
00001 // ELOG.H
00002 //
00003 // (c) 2000-2002 Alfred E. Heggestad
00004 //
00005 //    This program is free software; you can redistribute it and/or modify
00006 //    it under the terms of the GNU General Public License version 2 as
00007 //    published by the Free Software Foundation.
00008 //
00009 #if !defined(ELOG_H__)
00010 #define ELOG_H__
00011 
00019 #if defined(__linux__) && !defined(__SYMBIAN32__)
00020 #define _DEBUG
00021 #define _L8(a) (a)
00022 #endif
00023 
00024 //
00025 // some logging frontend macros
00026 //
00027 
00028 #if defined(_DEBUG)
00029 #define CTOR(a)  ELOG4(_L8("created object %s (%d bytes) at 0x%08x\n"), #a, sizeof(a), this ); 
00030 #define DTOR(a)  ELOG4(_L8("deleted object %s (%d bytes) at 0x%08x\n"), #a, sizeof(a), this );
00031 #else
00032 #define CTOR(a)
00033 #define DTOR(a)
00034 #endif
00035 
00036 
00037 #if defined(_DEBUG) && defined (__SYMBIAN32__)
00038 #define __CHECK_NULL(p) if(p == NULL) \
00039         { \
00040         ELOG3(_L8("unexpected NULL pointer in line %d file %s"), __LINE__, __FILE__); \
00041         User::Panic(_L("NULL"), 0); \
00042         }
00043 #else
00044 #define __CHECK_NULL(p)
00045 #endif
00046 
00047 
00048 #define BOOL_BIT(var,msk) ( (var & msk)==(msk) )
00049 
00050 
00051 //
00052 // normal debugging
00053 //
00054 #if defined(_DEBUG)
00055 
00056 #if defined(__SYMBIAN32__)
00057 
00058 #ifndef __E32DEF_H__
00059   #ifdef NULL
00060   #undef NULL
00061   #endif
00062 #endif
00063 
00064 #include <f32file.h>
00065 #define ELOG(a)           a
00066 #define ELOG1(a)          CEpocLogger::DoLog(a)
00067 #define ELOG2(a, b)       CEpocLogger::DoLog(a, (b) )
00068 #define ELOG3(a, b, c)    CEpocLogger::DoLog(a, b, c)
00069 #define ELOG4(a, b, c, d) CEpocLogger::DoLog(a, b, c, d)
00070 
00071 class CEpocLogger : public CBase
00072         {
00073 public:
00074         static void DoLog(TRefByValue<const TDesC8> aFmt, ...);
00075         };
00076 
00077 #else // __SYMBIAN32__
00078 
00079 // normally linux
00080 
00081 #define ELOG(a)           a
00082 #define ELOG1(a)          printf(a)
00083 #define ELOG2(a, b)       printf(a, b )
00084 #define ELOG3(a, b, c)    printf(a, b, c)
00085 #define ELOG4(a, b, c, d) printf(a, b, c, d)
00086 
00087 #endif // __SYMBIAN32__
00088 
00089 
00090 
00091 #else // no debugging
00092 
00093 #define ELOG(a)
00094 #define ELOG1(a)
00095 #define ELOG2(a, b)
00096 #define ELOG3(a, b, c)
00097 #define ELOG4(a, b, c, d)
00098 
00099 #endif // _DEBUG
00100 
00101 
00102 #endif  // ELOG_H__

Generated on Tue Feb 8 04:07:53 2005 for E32frodo by doxygen 1.3.3