00001
00002
00012
00013
00014 #ifndef __CSIBCDebug_H__
00015 #define __CSIBCDebug_H__
00016
00018
00020 #ifndef _WIN32_WCE
00021 #include <assert.h>
00022 #else
00023 #endif
00024
00025 #include "SIBCArray.h"
00026 #include "SIBCString.h"
00027
00028
00029
00030
00031
00032
00033 #if defined( DEBUG ) && defined( _PSX2 )
00034
00037 class CSIDebug
00038 {
00039 public:
00042 CSIDebug();
00045 ~CSIDebug();
00048 void Dump();
00055 int RegisterLabel( char * in_sLabel, char * in_sDescription, bool in_bSet );
00060 int LookupLabel( char * in_sLabel );
00065 bool CheckLabel( int in_iLabel );
00072 int Printf( int in_iLabel, char *, ... );
00077 void ParseArguments( int * in_nArgs, char ** in_asArgs );
00081 void Set( int in_sLabel );
00082
00083 private:
00084 CSIBCArray < CSIBCString > m_LabelArray;
00085 CSIBCArray < CSIBCString > m_DescriptionArray;
00086 CSIBCArray < bool > m_ValueArray;
00087 };
00088
00089 extern int g_iVerbose;
00090 extern CSIDebug * g_pSIDebug;
00091
00093
00095 #define CSIDebugRegisterLabel( v, l, d ) v = g_pSIDebug->RegisterLabel( l, d, false )
00096 #define CSIDebugLookupLabel( l ) g_pSIDebug->CheckLabel( i )
00097 #define CSIDebugCheck( i ) g_pSIDebug->CheckLabel( i )
00098 #define CSIDebugDump( i ) g_pSIDebug->Dump()
00099 #define CSIDebugPrintf g_pSIDebug->Printf
00100 #define CSIDebugPrintf0( i, f ) g_pSIDebug->Printf( i, f )
00101 #define CSIDebugPrintf1( i, f, a ) g_pSIDebug->Printf( i, f, a )
00102 #define CSIDebugPrintf2( i, f, a, b ) g_pSIDebug->Printf( i, f, a, b )
00103 #define CSIDebugPrintf3( i, f, a, b, c ) g_pSIDebug->Printf( i, f, a, b, c )
00104 #define CSIDebugPrintf4( i, f, a, b, c, d ) g_pSIDebug->Printf( i, f, a, b, c, d )
00105 #define CSIDebugLabel( name ) static int name
00106 #define CSIDebugParseArguments( n, a ) g_pSIDebug->ParseArguments( n, a )
00107 #define CSIDebugDeclare() CSIDebug * g_pSIDebug
00108 #define CSIDebugInit() g_pSIDebug = new CSIDebug()
00109 #define CSIDebugCleanUp() delete g_pSIDebug
00110 #define CSIDebugSet( i ) g_pSIDebug->Set( i );
00111 #else
00112 #define CSIDebugRegisterLabel( v, l, d ) 0
00113 #define CSIDebugLookupLabel( l ) 0
00114 #define CSIDebugCheck( i ) 0
00115 #define CSIDebugDump( i )
00116 #define CSIDebugSet( i )
00117 #define CSIDebugPrintf This shouldnt compile
00118 #define CSIDebugPrintf0( i, f )
00119 #define CSIDebugPrintf1( i, f, a )
00120 #define CSIDebugPrintf2( i, f, a, b )
00121 #define CSIDebugPrintf3( i, f, a, b, c )
00122 #define CSIDebugPrintf4( i, f, a, b, c, d )
00123 #define CSIDebugLabel( name )
00124 void CSIDebugParseArguments( int * in_nArgs, char ** in_asArgs );
00125 #define CSIDebugDeclare()
00126 #define CSIDebugInit()
00127 #define CSIDebugCleanUp()
00128 #endif
00129
00131
00133
00134
00135
00136
00137
00138 #endif // __CSIBCDebug_H__