1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: nstd_Printf.h 4 5 Copyright (C)2009 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: 21974 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_NSTD_PRINTF_H_ 17 #define NN_NSTD_PRINTF_H_ 18 19 #include <nn/types.h> 20 21 #ifdef __cplusplus 22 23 namespace nn { namespace nstd { 24 25 /* 26 @brief 文字列を出力します。vsnprintf の省メモリ版です。 27 @param[out] dst 結果を格納するバッファを指定します。 28 @param[in] len dst のバッファ長を指定します。 29 @param[in] fmt 一般的な printf のフォーマット文字列を指定します。ただし、浮動小数点系のもの(%%f など) は指定できません。 30 @param[in] vlist パラメータを指定します。 31 32 return 書式文字列を正しく出力した場合の文字数を返します。 33 */ 34 s32 TVSNPrintf(char *dst, size_t len, const char *fmt, va_list vlist); 35 s32 TVSNPrintf(wchar_t *dst, size_t len, const wchar_t *fmt, va_list vlist); 36 37 /* 38 @brief 文字列を出力します。snprintf の省メモリ版です。 39 @param[out] dst 結果を格納するバッファを指定します。 40 @param[in] len dst のバッファ長を指定します。 41 @param[in] fmt 一般的な printf のフォーマット文字列を指定します。ただし、浮動小数点系のもの(%%f など) は指定できません。 42 @param[in] ... フォーマット文字列に対応する引数を指定します。 43 44 return 書式文字列を正しく出力した場合の文字数を返します。 45 */ 46 s32 TSNPrintf(char *dst, size_t len, const char *fmt, ...); 47 s32 TSNPrintf(wchar_t *dst, size_t len, const wchar_t *fmt, ...); 48 49 /* 50 @brief 文字列を出力します。sprintf の省メモリ版です。 51 @param[out] dst 結果を格納するバッファを指定します。 52 @param[in] fmt 一般的な printf のフォーマット文字列を指定します。ただし、浮動小数点系のもの(%%f など) は指定できません。 53 @param[in] ... フォーマット文字列に対応する引数を指定します。 54 55 return 書式文字列を正しく出力した場合の文字数を返します。 56 */ 57 s32 TSPrintf(char *dst, const char *fmt, ...); 58 s32 TSPrintf(wchar_t *dst, const wchar_t *fmt, ...); 59 60 }} 61 62 #endif 63 64 // 以下、C 用宣言 65 66 #include <nn/util/detail/util_CLibImpl.h> 67 68 NN_EXTERN_C s32 nnnstdTVSNPrintf(char *dst, size_t len, const char *fmt, va_list vlist); 69 NN_EXTERN_C s32 nnnstdTSNPrintf(char *dst, size_t len, const char *fmt, ...); 70 NN_EXTERN_C s32 nnnstdTSPrintf(char *dst, const char *fmt, ...); 71 NN_EXTERN_C s32 nnnstdTVSNWPrintf(wchar_t *dst, size_t len, const wchar_t *fmt, va_list vlist); 72 NN_EXTERN_C s32 nnnstdTSNWPrintf(wchar_t *dst, size_t len, const wchar_t *fmt, ...); 73 NN_EXTERN_C s32 nnnstdTSWPrintf(wchar_t *dst, const wchar_t *fmt, ...); 74 75 #endif /* NN_NSTD_PRINTF_H_ */ 76