/*---------------------------------------------------------------------------* Project: Horizon File: err_Api.h Copyright (C)2010 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 30422 $ *---------------------------------------------------------------------------*/ #ifndef NN_ERR_CTR_ERR_API_H_ #define NN_ERR_CTR_ERR_API_H_ #include #include #ifdef __cplusplus namespace nn { namespace err { namespace CTR { void ThrowFatalErr( Result result ); }}} // namespace nn::err::CTR #ifndef NN_HARDWARE_CTR_LEGACY #ifdef NN_PROCESSOR_ARM11MPCORE /* エラー表示アプレットに対してFATALエラーを投げます。 Result の LEVEL が FATAL の時のみ実際の通知が行われます。 */ #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) \ do \ { \ ::nn::Result resultLocal = (result); \ if ( resultLocal.GetLevel() == ::nn::Result::LEVEL_FATAL ) \ { \ ::nn::err::ThrowFatalErr(resultLocal); \ } \ } while(0) /* エラー表示アプレットに対してFATALエラーを投げます。 Result の LEVEL が SUCCESS/STATUS/INFO(非推奨) 以外の時 (致命的もしくは本来製品で発生し得ないエラーの場合)に 実際の通知が行われます。 */ #define NN_ERR_THROW_FATAL(result) \ do \ { \ ::nn::Result resultLocal = (result); \ switch ( resultLocal.GetLevel() ) \ { \ case ::nn::Result::LEVEL_INFO: \ case ::nn::Result::LEVEL_SUCCESS: \ case ::nn::Result::LEVEL_STATUS: \ break; \ default: \ ::nn::err::ThrowFatalErr(resultLocal); \ } \ } while(0) /* エラー表示アプレットに対してFATALエラーを投げます。 Result がエラーの場合は全て通知します。 */ #define NN_ERR_THROW_FATAL_ALL(result) \ do \ { \ ::nn::Result resultLocal = (result); \ if ( resultLocal.IsFailure() ) \ { \ ::nn::err::ThrowFatalErr(resultLocal); \ } \ } while(0) #else /* NN_PROCESSOR_ARM11MPCORE */ #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) NN_UTIL_PANIC_IF_FAILED(result) #define NN_ERR_THROW_FATAL(result) NN_UTIL_PANIC_IF_FAILED(result) #define NN_ERR_THROW_FATAL_ALL(result) NN_UTIL_PANIC_IF_FAILED(result) #endif /* NN_PROCESSOR_ARM11MPCORE */ #else /* NN_HARDWARE_CTR_LEGACY */ #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) \ do \ { \ ::nn::Result resultLocal = (result); \ NN_UNUSED_VAR(resultLocal); \ } while(0) #define NN_ERR_THROW_FATAL(result) \ do \ { \ ::nn::Result resultLocal = (result); \ NN_UNUSED_VAR(resultLocal); \ } while(0) #define NN_ERR_THROW_FATAL_ALL(result) \ do \ { \ ::nn::Result resultLocal = (result); \ NN_UNUSED_VAR(resultLocal); \ } while(0) #endif /* NN_HARDWARE_CTR_LEGACY */ #endif // __cplusplus #endif /* NN_ERR_CTR_ERR_API_H_ */