1 /*---------------------------------------------------------------------------* 2 3 Copyright (C) 2010-2012 Nintendo. All rights reserved. 4 5 These coded instructions, statements, and computer programs contain 6 proprietary information of Nintendo of America Inc. and/or Nintendo 7 Company Ltd., and are protected by Federal copyright law. They may 8 not be disclosed to third parties or copied or duplicated in any form, 9 in whole or in part, without the prior written consent of Nintendo. 10 11 *---------------------------------------------------------------------------*/ 12 13 // gx2Verify.h 14 // 15 16 #ifndef _CAFE_GX2_VERIFY_H_ 17 #define _CAFE_GX2_VERIFY_H_ 18 19 #ifdef __cplusplus 20 extern "C" 21 { 22 #endif // __cplusplus 23 24 /// @addtogroup GX2VerifyGroup 25 /// @{ 26 27 /// \brief Specifies level of severity of runtime warnings. 28 /// 29 30 typedef enum { 31 GX2_VERIFY_WARNING_NONE, ///< Disables runtime warnings. 32 GX2_VERIFY_WARNING_SEVERE, ///< Checks and reports only on critical warnings. 33 GX2_VERIFY_WARNING_MEDIUM, ///< Checks and reports only on critical and medium-level warnings. 34 GX2_VERIFY_WARNING_ALL ///< Checks and reports on all warnings. 35 } GX2VerifyLevel; 36 37 /// \brief Typedef for GX2VerifyCallback. 38 /// 39 /// \param file Filename where warning occurred. 40 /// \param level Warning level. 41 /// \param line Line number where warning is triggered. 42 /// \param format Format string. 43 /// 44 typedef void (*GX2VerifyCallback)(const char* file, 45 GX2VerifyLevel level, 46 u32 line, 47 const char* format, 48 ...); 49 50 /// \brief Used with the debug GX2 library to control the types of warnings generated at runtime. 51 /// 52 /// This function is used with the debug GX2 library to control the types of warnings generated at runtime. 53 /// 54 /// \param level Setting level to GX2_VERIFY_WARNING_NONE will disable all runtime warnings. <br> 55 /// Setting level to GX2_VERIFY_WARNING_SEVERE will print only fatal errors. <br> 56 /// Setting level to GX2_VERIFY_WARNING_MEDIUM will print out moderate warnings and all fatal errors. <br> 57 /// Setting level to GX2_VERIFY_WARNING_ALL will print out all the advice that the system has to offer. <br> 58 /// 59 /// Severe warnings represent existence of illegal or unsupported GX2 setting in your code. 60 /// Therefore, we recommend that you eliminate all fatal errors. Regarding other levels of warning, 61 /// you do not always have to take notice because some of them are generated just for reference, 62 /// though they might still provide useful information to debug your code. 63 /// 64 /// By default, GX2Init will set level to GX2_VERIFY_WARNING_ALL in the debug version of the library. 65 /// 66 /// \donotcall \fgonly \notthreadsafe \devonly \enddonotcall 67 /// 68 void GX2API GX2SetVerifyLevel( GX2VerifyLevel level ); 69 70 /// \brief Registers a callback that is invoked whenever a verify warning is encountered by the GX2 API (only for debug builds) 71 /// 72 /// This function installs a callback that is invoked whenever a verify warning is encountered by the GX2 API (only in debug builds). 73 /// 74 /// \param cb Pointer to the warning callback function. 75 /// \returns Pointer to a previously set callback function. 76 /// 77 /// GX2 verification is enabled using GX2SetVerifyLevel. A default callback is installed by GX2Init as shown below: 78 /// \verbatim 79 // void __GX2VerifyDefaultCallback(const char* file, 80 // GX2VerifyLevel level, 81 // u32 line, 82 // const char* format, 83 // ...) 84 // { 85 // va_list list; 86 // va_start(list, format); 87 // OSReport("*** LEVEL %d WARNING at line %04d in %s: ", level, line, file); 88 // vprintf(format, list); 89 // va_end(list); 90 // ASSERT(level != GX2_VERIFY_WARNING_SEVERE); 91 // } 92 /// \endverbatim 93 /// The callback's argument file is used to specify the file in which the warning occurred. Line is the line number. Level is the level of the warning encountered. 94 /// Level 1 represents severe warnings, level 2 signifies medium warnings, and level 3 denotes minor warnings. 95 /// The argument format is a pointer to the warning format string. Note that the message strings are subject to change as GX2 is revised. 96 /// 97 /// \donotcall \fgonly \notthreadsafe \devonly \enddonotcall 98 /// 99 GX2VerifyCallback GX2API GX2SetVerifyCallback( GX2VerifyCallback cb ); 100 101 /// @} 102 103 #ifdef __cplusplus 104 } 105 #endif // __cplusplus 106 107 #endif // _CAFE_GX2_VERIFY_H_ 108