SIBCDebug.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Softimage Games/Interactive team
00004 //
00005 // (c) Copyright 2001 Avid Technology, Inc. . All rights reserved.
00006 //
00007 // @doc
00008 //
00009 // @module      CSIDebug.h | Main header file for CSIDebug implementation
00010 //***************************************************************************************
00011 
00012 /****************************************************************************************
00013 THIS CODE IS PUBLISHED AS A SAMPLE ONLY AND IS PROVIDED "AS IS".
00014 IN NO EVENT SHALL SOFTIMAGE, AVID TECHNOLOGY, INC. AND/OR THEIR RESPECTIVE 
00015 SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
00016 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00017 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
00018 CONNECTION WITH THE USE OR PERFORMANCE OF THIS CODE . 
00019  
00020 COPYRIGHT NOTICE. Copyright © 1999-2001 Avid Technology Inc. . All rights reserved. 
00021 
00022 SOFTIMAGE is a registered trademark of Avid Technology Inc. or its subsidiaries 
00023 or divisions. Windows NT is a registered trademark of Microsoft Corp. All other
00024 trademarks contained herein are the property of their respective owners. 
00025 ****************************************************************************************/
00026 
00027 // ******************* OBJECT SCRIPTING DOCUMENTATION ******************************
00028 // <object id="CSIDebug" introduced="X.XX">
00029 // <description> Debug mechanism. </description>
00030 // <methods>
00031 //  <!-- method - - - - - - - - - - - - - - - - - - - - - - - - -->
00032 // <method id="CSIDebug.CSIDebug">
00033 // <description> CSIDebug Default constructor </description>
00034 // <parameters>
00035 // <parameter name="void" required="yes" io="Input">
00036 //  <type>Void</type>
00037 //  <description> Void </description>
00038 // </parameter>
00039 // </parameters>
00040 // <return>Void</return>
00041 // </method>
00042 //  <!-- method - - - - - - - - - - - - - - - - - - - - - - - - -->
00043 // <method id="CSIDebug.Dump">
00044 // <description> Dump debugging information. </description>
00045 // <parameters>
00046 // <parameter name="void" required="yes" io="Input">
00047 //  <type>Void</type>
00048 //  <description> Void </description>
00049 // </parameter>
00050 // </parameters>
00051 // <return>Void</return>
00052 // </method>
00053 //  <!-- method - - - - - - - - - - - - - - - - - - - - - - - - -->
00054 // <method id="CSIDebug.RegisterLabel">
00055 // <description> Register Label. </description>
00056 // <parameters>
00057 // <parameter name="in_sLabel" required="yes" io="Input">
00058 //  <type>char*</type>
00059 //  <description> Label </description>
00060 // </parameter>
00061 // <parameter name="in_sDescription" required="yes" io="Input">
00062 //  <type>char</type>
00063 //  <description> Description </description>
00064 // </parameter>
00065 // <parameter name="in_bSet" required="yes" io="Input">
00066 //  <type>bool</type>
00067 //  <description> Set </description>
00068 // </parameter>
00069 // </parameters>
00070 // <return>Returns number of used Labels. (int)</return>
00071 // </method>
00072 //  <!-- method - - - - - - - - - - - - - - - - - - - - - - - - -->
00073 // <method id="CSIDebug.CheckLabel">
00074 // <description> Check the label. </description>
00075 // <parameters>
00076 // <parameter name="in_iLabel" required="yes" io="Input">
00077 //  <type>int</type>
00078 //  <description> Label </description>
00079 // </parameter>
00080 // </parameters>
00081 // <return>Returns bool. (SI_Bool)</return>
00082 // </method>
00083 //  <!-- method - - - - - - - - - - - - - - - - - - - - - - - - -->
00084 // <method id="CSIDebug.LookupLabel" status="not-impl">
00085 // <description> Get label index </description>
00086 // <parameters>
00087 // <parameter name="in_sLabel" required="yes" io="Input">
00088 //  <type>char*</type>
00089 //  <description> Label </description>
00090 // </parameter>
00091 // </parameters>
00092 // <return>Returns label index. (int)</return>
00093 // </method>
00094 //  <!-- method - - - - - - - - - - - - - - - - - - - - - - - - -->
00095 // <method id="CSIDebug.Printf">
00096 // <description> Print out debugginf information. </description>
00097 // <parameters>
00098 // <parameter name="in_iLabel" required="yes" io="Input">
00099 //  <type>int</type>
00100 //  <description> Label </description>
00101 // </parameter>
00102 // <parameter name="in_sFormat" required="yes" io="Input">
00103 //  <type>char*</type>
00104 //  <description> Character string. </description>
00105 // </parameter>
00106 // <parameter name="..." required="yes" io="Input">
00107 //  <type></type>
00108 //  <description> Argument list </description>
00109 // </parameter>
00110 // </parameters>
00111 // <return>Returns 0 if no info.</return>
00112 // </method>
00113 //  <!-- method - - - - - - - - - - - - - - - - - - - - - - - - -->
00114 // <method id="CSIDebug.ParseArguments">
00115 // <description> Parses arguments. </description>
00116 // <parameters>
00117 // <parameter name="io_nArgs" required="yes" io="Input">
00118 //  <type>int*</type>
00119 //  <description> Number of I/O arguments. </description>
00120 // </parameter>
00121 // <parameter name="io_asArhs" required="yes" io="Input">
00122 //  <type>char**</type>
00123 //  <description> I/O arguments. </description>
00124 // </parameter>
00125 // </parameters>
00126 // <return>Void</return>
00127 // </method>
00128 //  <!-- method - - - - - - - - - - - - - - - - - - - - - - - - -->
00129 // <method id="CSIDebug.Set">
00130 // <description> Set the Label. </description>
00131 // <parameters>
00132 // <parameter name="in_sLabel" required="yes" io="Input">
00133 //  <type>int</type>
00134 //  <description> Label </description>
00135 // </parameter>
00136 // </parameters>
00137 // <return>Void</return>
00138 // </method>
00139 // </methods>
00140 // </object>
00141 
00142 
00143 
00144 #ifndef __CSIBCDebug_H__
00145 #define __CSIBCDebug_H__
00146 
00148 // Includes
00150 #ifndef _WIN32_WCE
00151 #include <assert.h>
00152 #else
00153 #endif
00154 
00155 #include "SIBCArray.h"
00156 #include "SIBCString.h"
00157 
00158 
00159 //**************************************************************************************
00160 // @class CSIDebug | Debug mechanism.
00161 //**************************************************************************************
00162 
00163 #if defined( DEBUG ) && defined( _PSX2 )
00164 
00165 class CSIDebug
00166 {
00167 public:
00168     CSIDebug();                                                                     // Constructor
00169     ~CSIDebug();                                                                    // Destructor
00170     void Dump();                                                                    // Prints out all labels
00171     int RegisterLabel( char * in_sLabel, char * in_sDescription, bool in_bSet );    // Label registration
00172     int LookupLabel( char * in_sLabel );                                            // Get label index
00173     bool CheckLabel( int in_iLabel );                                               // Check if label exist
00174     int Printf( int in_iLabel, char *, ... );                                       // Print method
00175     void ParseArguments( int * in_nArgs, char ** in_asArgs );                       // Parse arguments
00176     void Set( int in_sLabel );                                                      // Activate label
00177     
00178 private:
00179     CSIBCArray < CSIBCString >  m_LabelArray;
00180     CSIBCArray < CSIBCString >  m_DescriptionArray;
00181     CSIBCArray < bool > m_ValueArray;
00182 };
00183 
00184 extern int          g_iVerbose;
00185 extern CSIDebug *   g_pSIDebug;
00186 
00188 // Defines
00190 #define CSIDebugRegisterLabel( v, l, d ) v = g_pSIDebug->RegisterLabel( l, d, false )
00191 #define CSIDebugLookupLabel( l ) g_pSIDebug->CheckLabel( i )
00192 #define CSIDebugCheck( i ) g_pSIDebug->CheckLabel( i )
00193 #define CSIDebugDump( i ) g_pSIDebug->Dump()
00194 #define CSIDebugPrintf g_pSIDebug->Printf
00195 #define CSIDebugPrintf0( i, f ) g_pSIDebug->Printf( i, f )
00196 #define CSIDebugPrintf1( i, f, a ) g_pSIDebug->Printf( i, f, a )
00197 #define CSIDebugPrintf2( i, f, a, b ) g_pSIDebug->Printf( i, f, a, b )
00198 #define CSIDebugPrintf3( i, f, a, b, c ) g_pSIDebug->Printf( i, f, a, b, c )
00199 #define CSIDebugPrintf4( i, f, a, b, c, d ) g_pSIDebug->Printf( i, f, a, b, c, d )
00200 #define CSIDebugLabel( name ) static int name
00201 #define CSIDebugParseArguments( n, a ) g_pSIDebug->ParseArguments( n, a )
00202 #define CSIDebugDeclare() CSIDebug  * g_pSIDebug
00203 #define CSIDebugInit() g_pSIDebug = new CSIDebug()
00204 #define CSIDebugCleanUp() delete g_pSIDebug
00205 #define CSIDebugSet( i ) g_pSIDebug->Set( i );
00206 #else
00207 #define CSIDebugRegisterLabel( v, l, d ) 0
00208 #define CSIDebugLookupLabel( l ) 0
00209 #define CSIDebugCheck( i ) 0
00210 #define CSIDebugDump( i )
00211 #define CSIDebugSet( i )
00212 #define CSIDebugPrintf This shouldnt compile
00213 #define CSIDebugPrintf0( i, f )
00214 #define CSIDebugPrintf1( i, f, a )
00215 #define CSIDebugPrintf2( i, f, a, b )
00216 #define CSIDebugPrintf3( i, f, a, b, c )
00217 #define CSIDebugPrintf4( i, f, a, b, c, d )
00218 #define CSIDebugLabel( name )
00219 void CSIDebugParseArguments( int * in_nArgs, char ** in_asArgs );
00220 #define CSIDebugDeclare()
00221 #define CSIDebugInit()
00222 #define CSIDebugCleanUp()
00223 #endif
00224 
00226 // Inline code
00228 
00229 
00230 
00231 
00232 
00233 #endif // __CSIBCDebug_H__