1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: err_Api.h 4 5 Copyright (C)2010 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 30422 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_ERR_CTR_ERR_API_H_ 17 #define NN_ERR_CTR_ERR_API_H_ 18 19 #include <nn/types.h> 20 #include <nn/Result.h> 21 22 #ifdef __cplusplus 23 namespace nn { 24 namespace err { 25 namespace CTR { 26 27 void ThrowFatalErr( Result result ); 28 29 }}} // namespace nn::err::CTR 30 31 #ifndef NN_HARDWARE_CTR_LEGACY 32 #ifdef NN_PROCESSOR_ARM11MPCORE 33 34 /* 35 エラー表示アプレットに対してFATALエラーを投げます。 36 Result の LEVEL が FATAL の時のみ実際の通知が行われます。 37 */ 38 #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) \ 39 do \ 40 { \ 41 ::nn::Result resultLocal = (result); \ 42 if ( resultLocal.GetLevel() == ::nn::Result::LEVEL_FATAL ) \ 43 { \ 44 ::nn::err::ThrowFatalErr(resultLocal); \ 45 } \ 46 } while(0) 47 48 /* 49 エラー表示アプレットに対してFATALエラーを投げます。 50 Result の LEVEL が SUCCESS/STATUS/INFO(非推奨) 以外の時 51 (致命的もしくは本来製品で発生し得ないエラーの場合)に 52 実際の通知が行われます。 53 */ 54 #define NN_ERR_THROW_FATAL(result) \ 55 do \ 56 { \ 57 ::nn::Result resultLocal = (result); \ 58 switch ( resultLocal.GetLevel() ) \ 59 { \ 60 case ::nn::Result::LEVEL_INFO: \ 61 case ::nn::Result::LEVEL_SUCCESS: \ 62 case ::nn::Result::LEVEL_STATUS: \ 63 break; \ 64 default: \ 65 ::nn::err::ThrowFatalErr(resultLocal); \ 66 } \ 67 } while(0) 68 69 /* 70 エラー表示アプレットに対してFATALエラーを投げます。 71 Result がエラーの場合は全て通知します。 72 */ 73 #define NN_ERR_THROW_FATAL_ALL(result) \ 74 do \ 75 { \ 76 ::nn::Result resultLocal = (result); \ 77 if ( resultLocal.IsFailure() ) \ 78 { \ 79 ::nn::err::ThrowFatalErr(resultLocal); \ 80 } \ 81 } while(0) 82 83 84 #else /* NN_PROCESSOR_ARM11MPCORE */ 85 86 #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) NN_UTIL_PANIC_IF_FAILED(result) 87 #define NN_ERR_THROW_FATAL(result) NN_UTIL_PANIC_IF_FAILED(result) 88 #define NN_ERR_THROW_FATAL_ALL(result) NN_UTIL_PANIC_IF_FAILED(result) 89 90 #endif /* NN_PROCESSOR_ARM11MPCORE */ 91 #else /* NN_HARDWARE_CTR_LEGACY */ 92 93 #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) \ 94 do \ 95 { \ 96 ::nn::Result resultLocal = (result); \ 97 NN_UNUSED_VAR(resultLocal); \ 98 } while(0) 99 100 #define NN_ERR_THROW_FATAL(result) \ 101 do \ 102 { \ 103 ::nn::Result resultLocal = (result); \ 104 NN_UNUSED_VAR(resultLocal); \ 105 } while(0) 106 107 #define NN_ERR_THROW_FATAL_ALL(result) \ 108 do \ 109 { \ 110 ::nn::Result resultLocal = (result); \ 111 NN_UNUSED_VAR(resultLocal); \ 112 } while(0) 113 114 #endif /* NN_HARDWARE_CTR_LEGACY */ 115 #endif // __cplusplus 116 117 118 #endif /* NN_ERR_CTR_ERR_API_H_ */ 119