00001 //*************************************************************************************** 00002 // 00003 // File supervisor: Crosswalk team 00004 // 00005 // Copyright 2008 Autodesk, Inc. All rights reserved. 00006 // Use of this software is subject to the terms of the Autodesk license agreement 00007 // provided at the time of installation or download, or which otherwise accompanies 00008 // this software in either electronic or hard copy form. 00009 // 00010 //*************************************************************************************** 00011 00012 // ******************* OBJECT SCRIPTING DOCUMENTATION ****************************** 00013 // <object id="CSIDebug" introduced="X.XX"> 00014 // <description> Debug mechanism. </description> 00015 // <methods> 00016 // <!-- method - - - - - - - - - - - - - - - - - - - - - - - - --> 00017 // <method id="CSIDebug.CSIDebug"> 00018 // <description> CSIDebug Default constructor </description> 00019 // <parameters> 00020 // <parameter name="void" required="yes" io="Input"> 00021 // <type>Void</type> 00022 // <description> Void </description> 00023 // </parameter> 00024 // </parameters> 00025 // <return>Void</return> 00026 // </method> 00027 // <!-- method - - - - - - - - - - - - - - - - - - - - - - - - --> 00028 // <method id="CSIDebug.Dump"> 00029 // <description> Dump debugging information. </description> 00030 // <parameters> 00031 // <parameter name="void" required="yes" io="Input"> 00032 // <type>Void</type> 00033 // <description> Void </description> 00034 // </parameter> 00035 // </parameters> 00036 // <return>Void</return> 00037 // </method> 00038 // <!-- method - - - - - - - - - - - - - - - - - - - - - - - - --> 00039 // <method id="CSIDebug.RegisterLabel"> 00040 // <description> Register Label. </description> 00041 // <parameters> 00042 // <parameter name="in_sLabel" required="yes" io="Input"> 00043 // <type>char*</type> 00044 // <description> Label </description> 00045 // </parameter> 00046 // <parameter name="in_sDescription" required="yes" io="Input"> 00047 // <type>char</type> 00048 // <description> Description </description> 00049 // </parameter> 00050 // <parameter name="in_bSet" required="yes" io="Input"> 00051 // <type>bool</type> 00052 // <description> Set </description> 00053 // </parameter> 00054 // </parameters> 00055 // <return>Returns number of used Labels. (int)</return> 00056 // </method> 00057 // <!-- method - - - - - - - - - - - - - - - - - - - - - - - - --> 00058 // <method id="CSIDebug.CheckLabel"> 00059 // <description> Check the label. </description> 00060 // <parameters> 00061 // <parameter name="in_iLabel" required="yes" io="Input"> 00062 // <type>int</type> 00063 // <description> Label </description> 00064 // </parameter> 00065 // </parameters> 00066 // <return>Returns bool. (SI_Bool)</return> 00067 // </method> 00068 // <!-- method - - - - - - - - - - - - - - - - - - - - - - - - --> 00069 // <method id="CSIDebug.LookupLabel" status="not-impl"> 00070 // <description> Get label index </description> 00071 // <parameters> 00072 // <parameter name="in_sLabel" required="yes" io="Input"> 00073 // <type>char*</type> 00074 // <description> Label </description> 00075 // </parameter> 00076 // </parameters> 00077 // <return>Returns label index. (int)</return> 00078 // </method> 00079 // <!-- method - - - - - - - - - - - - - - - - - - - - - - - - --> 00080 // <method id="CSIDebug.Printf"> 00081 // <description> Print out debugginf information. </description> 00082 // <parameters> 00083 // <parameter name="in_iLabel" required="yes" io="Input"> 00084 // <type>int</type> 00085 // <description> Label </description> 00086 // </parameter> 00087 // <parameter name="in_sFormat" required="yes" io="Input"> 00088 // <type>char*</type> 00089 // <description> Character string. </description> 00090 // </parameter> 00091 // <parameter name="..." required="yes" io="Input"> 00092 // <type></type> 00093 // <description> Argument list </description> 00094 // </parameter> 00095 // </parameters> 00096 // <return>Returns 0 if no info.</return> 00097 // </method> 00098 // <!-- method - - - - - - - - - - - - - - - - - - - - - - - - --> 00099 // <method id="CSIDebug.ParseArguments"> 00100 // <description> Parses arguments. </description> 00101 // <parameters> 00102 // <parameter name="io_nArgs" required="yes" io="Input"> 00103 // <type>int*</type> 00104 // <description> Number of I/O arguments. </description> 00105 // </parameter> 00106 // <parameter name="io_asArhs" required="yes" io="Input"> 00107 // <type>char**</type> 00108 // <description> I/O arguments. </description> 00109 // </parameter> 00110 // </parameters> 00111 // <return>Void</return> 00112 // </method> 00113 // <!-- method - - - - - - - - - - - - - - - - - - - - - - - - --> 00114 // <method id="CSIDebug.Set"> 00115 // <description> Set the Label. </description> 00116 // <parameters> 00117 // <parameter name="in_sLabel" required="yes" io="Input"> 00118 // <type>int</type> 00119 // <description> Label </description> 00120 // </parameter> 00121 // </parameters> 00122 // <return>Void</return> 00123 // </method> 00124 // </methods> 00125 // </object> 00126 00127 00128 00129 #ifndef __CSIBCDebug_H__ 00130 #define __CSIBCDebug_H__ 00131 00133 // Includes 00135 #ifndef _WIN32_WCE 00136 #include <assert.h> 00137 #else 00138 #endif 00139 00140 #include "SIBCArray.h" 00141 #include "SIBCString.h" 00142 00143 00144 //************************************************************************************** 00145 // @class CSIDebug | Debug mechanism. 00146 //************************************************************************************** 00147 00148 #if defined( DEBUG ) && defined( _PSX2 ) 00149 00150 class CSIDebug 00151 { 00152 public: 00153 CSIDebug(); // Constructor 00154 ~CSIDebug(); // Destructor 00155 void Dump(); // Prints out all labels 00156 int RegisterLabel( char * in_sLabel, char * in_sDescription, bool in_bSet ); // Label registration 00157 int LookupLabel( char * in_sLabel ); // Get label index 00158 bool CheckLabel( int in_iLabel ); // Check if label exist 00159 int Printf( int in_iLabel, char *, ... ); // Print method 00160 void ParseArguments( int * in_nArgs, char ** in_asArgs ); // Parse arguments 00161 void Set( int in_sLabel ); // Activate label 00162 00163 private: 00164 CSIBCArray < CSIBCString > m_LabelArray; 00165 CSIBCArray < CSIBCString > m_DescriptionArray; 00166 CSIBCArray < bool > m_ValueArray; 00167 }; 00168 00169 extern int g_iVerbose; 00170 extern CSIDebug * g_pSIDebug; 00171 00173 // Defines 00175 #define CSIDebugRegisterLabel( v, l, d ) v = g_pSIDebug->RegisterLabel( l, d, false ) 00176 #define CSIDebugLookupLabel( l ) g_pSIDebug->CheckLabel( i ) 00177 #define CSIDebugCheck( i ) g_pSIDebug->CheckLabel( i ) 00178 #define CSIDebugDump( i ) g_pSIDebug->Dump() 00179 #define CSIDebugPrintf g_pSIDebug->Printf 00180 #define CSIDebugPrintf0( i, f ) g_pSIDebug->Printf( i, f ) 00181 #define CSIDebugPrintf1( i, f, a ) g_pSIDebug->Printf( i, f, a ) 00182 #define CSIDebugPrintf2( i, f, a, b ) g_pSIDebug->Printf( i, f, a, b ) 00183 #define CSIDebugPrintf3( i, f, a, b, c ) g_pSIDebug->Printf( i, f, a, b, c ) 00184 #define CSIDebugPrintf4( i, f, a, b, c, d ) g_pSIDebug->Printf( i, f, a, b, c, d ) 00185 #define CSIDebugLabel( name ) static int name 00186 #define CSIDebugParseArguments( n, a ) g_pSIDebug->ParseArguments( n, a ) 00187 #define CSIDebugDeclare() CSIDebug * g_pSIDebug 00188 #define CSIDebugInit() g_pSIDebug = new CSIDebug() 00189 #define CSIDebugCleanUp() delete g_pSIDebug 00190 #define CSIDebugSet( i ) g_pSIDebug->Set( i ); 00191 #else 00192 #define CSIDebugRegisterLabel( v, l, d ) 0 00193 #define CSIDebugLookupLabel( l ) 0 00194 #define CSIDebugCheck( i ) 0 00195 #define CSIDebugDump( i ) 00196 #define CSIDebugSet( i ) 00197 #define CSIDebugPrintf This shouldnt compile 00198 #define CSIDebugPrintf0( i, f ) 00199 #define CSIDebugPrintf1( i, f, a ) 00200 #define CSIDebugPrintf2( i, f, a, b ) 00201 #define CSIDebugPrintf3( i, f, a, b, c ) 00202 #define CSIDebugPrintf4( i, f, a, b, c, d ) 00203 #define CSIDebugLabel( name ) 00204 void CSIDebugParseArguments( int * in_nArgs, char ** in_asArgs ); 00205 #define CSIDebugDeclare() 00206 #define CSIDebugInit() 00207 #define CSIDebugCleanUp() 00208 #endif 00209 00211 // Inline code 00213 00214 00215 00216 00217 00218 #endif // __CSIBCDebug_H__