/*---------------------------------------------------------------------------* Project: Horizon File: dbg_DebugString.h Copyright (C)2009 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: 18508 $ *---------------------------------------------------------------------------*/ /*! @file :include nn/dbg.h */ #ifndef NN_DBG_DBG_DEBUGSTRING_H_ #define NN_DBG_DBG_DEBUGSTRING_H_ #include #include #include #include /*! @addtogroup nn_dbg dbg のマクロ定義 @brief デバッグ用のマクロです。 @{ */ /*! @brief @ref NN_LOG のバッファサイズです。 */ #define NN_DBG_PRINTF_BUFFER_LENGTH 256 // TPrintf用バッファサイズ #define NN_DBG_TPRINTF_BUFFER_LENGTH 128 //------------------------------------------------------------------- // NN_LOG /*! @param[in] ... 標準ライブラリの printf の引数と同様です。 @brief 文字列をデバッグウィンドウに出力します。 バッファサイズは @ref NN_DBG_PRINTF_BUFFER_LENGTH です。 @ref NN_DBG_PRINTF_BUFFER_LENGTH よりも大きなサイズの文字列を扱うことはできません。 */ #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT #ifdef __cplusplus #define NN_LOG( ... ) (void)nn::dbg::detail::Printf(__VA_ARGS__) #else // ifdef __cplusplus #define NN_LOG( ... ) (void)nndbgDetailPrintf(__VA_ARGS__) #endif // ifdef __cplusplus else #else // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT #define NN_LOG( ... ) ((void)0) #endif // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT else //------------------------------------------------------------------- // NN_TLOG_ /* @def NN_TLOG_ @brief 文字列をデバッグ出力します。NN_LOG の省メモリ版です。 SDK 内部でのみ使用します。 */ #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK #ifdef __cplusplus #define NN_TLOG_( ... ) (void)nn::dbg::detail::TPrintf(__VA_ARGS__) #else // ifdef __cplusplus #define NN_TLOG_( ... ) (void)nndbgDetailTPrintf(__VA_ARGS__) #endif // ifdef __cplusplus else #else // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK #define NN_TLOG_( ... ) ((void)0) #endif // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK else //------------------------------------------------------------------- // NN_SLOG_ /* @def NN_TLOG_ @brief 文字列をデバッグ出力します。NN_LOG の省メモリ版です。 SDK 内部でのみ使用します。 */ #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK #ifdef __cplusplus #define NN_SLOG_( ... ) (void)nn::dbg::detail::Printf(__VA_ARGS__) #else // ifdef __cplusplus #define NN_SLOG_( ... ) (void)nndbgDetailPrintf(__VA_ARGS__) #endif // ifdef __cplusplus else #else // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK #define NN_SLOG_( ... ) ((void)0) #endif // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK else /*! @} */ //------------------------------------------------------------------- // for C++ #ifdef __cplusplus namespace nn { namespace dbg { namespace detail { /* @brief 文字列をデバッグ出力します。 @param[in] fmt 一般的な printf のフォーマット文字列 */ void Printf(const char* fmt, ...); /* @brief 文字列をデバッグ出力します。Printf の省メモリ版です。 @param[in] fmt 一般的な printf のフォーマット文字列。ただし、浮動小数点系のもの(%%f など) は指定できません。 */ void TPrintf(const char* fmt, ...); /* @brief 文字列をデバッグ出力します。 VPrint は weak シンボルでコンパイルされているため、ユーザ独自の定義に書き換えが可能です。 @param[in] fmt 一般的な printf のフォーマット文字列 @param[in] vlist 可変引数パラメータ */ void VPrintf(const char* fmt, ::std::va_list arg); /* @brief 文字列をデバッグ出力します。VPrintf の省メモリ版です。 TVPrint は weak シンボルでコンパイルされているため、ユーザ独自の定義に書き換えが可能です。 @param[in] fmt 一般的な printf のフォーマット文字列。ただし、浮動小数点系のもの(%%f など) は指定できません。 @param[in] vlist 可変引数パラメータ */ void TVPrintf(const char* fmt, ::std::va_list arg); /* @brief 文字列をデバッグ出力します。 PutString は weak シンボルでコンパイルされているため、ユーザ独自の定義に書き換えが可能です。 @param[in] text 出力文字列 @param[in] length 出力文字列の長さ */ void PutString(const char* text, s32 length); } }} #endif // ifdef __cplusplus //------------------------------------------------------------------- // for C / C++ #include #include #ifdef __cplusplus extern "C" { #endif // ifdef __cplusplus /* @brief 対応する C++ 関数 @ref nn::dbg::detail::Printf を参照してください。 */ void nndbgDetailPrintf(const char* fmt, ...); /* @brief 対応する C++ 関数 @ref nn::dbg::detail::TPrintf を参照してください。 */ void nndbgDetailTPrintf(const char* fmt, ...); /* @brief 対応する C++ 関数 @ref nn::dbg::detail::VPrintf を参照してください。 nndbgDetailVPrintf は weak シンボルでコンパイルされているため、ユーザ独自の定義に書き換えが可能です。 */ void nndbgDetailVPrintf(const char* fmt, va_list arg); /* @brief 対応する C++ 関数 @ref nn::dbg::detail::TVPrintf を参照してください。 nndbgDetailTVPrintf は weak シンボルでコンパイルされているため、ユーザ独自の定義に書き換えが可能です。 */ void nndbgDetailTVPrintf(const char* fmt, va_list arg); /* @brief 文字列を表示し、プログラムを停止します。 nndbgAssertionFailureHandler は weak シンボルでコンパイルされているため、ユーザ独自の定義に書き換えが可能です。 @param[in] print 文字列を表示するかどうかを決定する条件 @param[in] filename ファイル名 @param[in] lineno 行番号 @param[in] fmt 一般的な printf のフォーマット文字列 @return 常に0 */ int nndbgAssertionFailureHandler(bool print, const char* filename, int lineno, const char* fmt, ...); /* @brief 文字列を表示し、プログラムを停止します。nndbgAssertionFailureHandler の省メモリ版です。 nndbgTAssertionFailureHandler は weak シンボルでコンパイルされているため、ユーザ独自の定義に書き換えが可能です。 @param[in] print 文字列を表示するかどうかを決定する条件 @param[in] filename ファイル名 @param[in] lineno 行番号 @param[in] fmt 一般的な printf のフォーマット文字列。ただし、浮動小数点系のもの(%%f など) は指定できません。 @return 常に0 */ int nndbgTAssertionFailureHandler(bool print, const char* filename, int lineno, const char* fmt, ...); #ifdef __cplusplus } #endif // ifdef __cplusplus #endif // NN_DBG_DBG_DEBUGSTRING_H_