1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: dbg_DebugString.h 4 5 Copyright (C)2009-2012 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: 47340 $ 14 *---------------------------------------------------------------------------*/ 15 16 /* Please see man pages for details 17 18 19 20 */ 21 22 #ifndef NN_DBG_DBG_DEBUGSTRING_H_ 23 #define NN_DBG_DBG_DEBUGSTRING_H_ 24 25 #include <nn/config.h> 26 #include <nn/types.h> 27 #include <nn/Result.h> 28 #include <nn/dbg/dbg_Result.h> 29 30 // 31 // 32 // 33 34 // 35 // 36 37 // 38 #define NN_DBG_PRINTF_BUFFER_LENGTH 256 39 40 // Buffer size for TPrintf 41 #define NN_DBG_TPRINTF_BUFFER_LENGTH 128 42 43 // 44 45 46 47 /* ------------------------------------------------------------------------ 48 Dummy for reference use 49 ------------------------------------------------------------------------ */ 50 51 // 52 // 53 54 //--------------------------------------------------------------------------- 55 // 56 // 57 // 58 // 59 // 60 // 61 // 62 // 63 // 64 //--------------------------------------------------------------------------- 65 #define NN_LOG( ... ) 66 67 68 //--------------------------------------------------------------------------- 69 // 70 // 71 // 72 // 73 // 74 // 75 // 76 // 77 // 78 // 79 // 80 //--------------------------------------------------------------------------- 81 #define NN_LOGV( fmt, arg ) 82 83 84 //--------------------------------------------------------------------------- 85 // 86 // 87 // 88 // 89 // 90 // 91 // 92 //--------------------------------------------------------------------------- 93 #define NN_PUT( text, length ) 94 95 // 96 97 // 98 99 #undef NN_LOG 100 #undef NN_LOGV 101 #undef NN_PUT 102 103 104 105 /* ------------------------------------------------------------------------ 106 Definition entity 107 ------------------------------------------------------------------------ */ 108 109 #ifndef NN_BUILD_DOCUMENT 110 #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT 111 #ifdef __cplusplus 112 #define NN_LOG( ... ) (void)nn::dbg::detail::Printf(__VA_ARGS__) 113 #define NN_LOGV( fmt, arg ) (void)nn::dbg::detail::VPrintf((fmt), (arg)) 114 #define NN_PUT( text, length ) (void)nn::dbg::detail::PutString((text), (length)) 115 #else // ifdef __cplusplus 116 #define NN_LOG( ... ) (void)nndbgDetailPrintf(__VA_ARGS__) 117 #define NN_LOGV( fmt, arg ) (void)nndbgDetailVPrintf((fmt), (arg)) 118 #define NN_PUT( text, length ) (void)nndbgDetailPutString((text), (length)) 119 #endif // ifdef __cplusplus else 120 #else // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT 121 #define NN_LOG( ... ) ((void)0) 122 #define NN_LOGV( ... ) ((void)0) 123 #define NN_PUT( text, length ) ((void)0) 124 #endif // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT else 125 126 #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK 127 #ifdef __cplusplus 128 #define NN_TLOG_( ... ) (void)nn::dbg::detail::TPrintf(__VA_ARGS__) 129 #define NN_SLOG_( ... ) (void)nn::dbg::detail::Printf(__VA_ARGS__) 130 #define NN_TLOGV_( fmt, arg ) (void)nn::dbg::detail::TVPrintf((fmt), (arg)) 131 #else // ifdef __cplusplus 132 #define NN_TLOG_( ... ) (void)nndbgDetailTPrintf(__VA_ARGS__) 133 #define NN_SLOG_( ... ) (void)nndbgDetailPrintf(__VA_ARGS__) 134 #define NN_TLOGV_( fmt, arg ) (void)nndbgDetailTVPrintf((fmt), (arg)) 135 #endif // ifdef __cplusplus else 136 #else // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK 137 #define NN_TLOG_( ... ) ((void)0) 138 #define NN_SLOG_( ... ) ((void)0) 139 #define NN_TLOGV_( ... ) ((void)0) 140 #endif // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK else 141 #endif 142 143 144 145 //------------------------------------------------------------------- 146 // for C++ 147 148 #ifdef __cplusplus 149 namespace nn { namespace dbg { 150 namespace detail 151 { 152 void Printf(const char* fmt, ...); 153 void TPrintf(const char* fmt, ...); 154 void VPrintf(const char* fmt, ::std::va_list arg); 155 void TVPrintf(const char* fmt, ::std::va_list arg); 156 void PutString(const char* text, s32 length); 157 void PutString(const char* text); 158 } 159 }} 160 #endif // ifdef __cplusplus 161 162 163 164 //------------------------------------------------------------------- 165 // for C / C++ 166 167 #include <nn/dbg/dbg_Break.h> 168 169 #ifdef __cplusplus 170 extern "C" { 171 #endif // ifdef __cplusplus 172 173 void nndbgDetailPrintf(const char* fmt, ...); 174 void nndbgDetailTPrintf(const char* fmt, ...); 175 void nndbgDetailVPrintf(const char* fmt, va_list arg); 176 void nndbgDetailTVPrintf(const char* fmt, va_list arg); 177 void nndbgDetailPutString(const char* text, s32 length); 178 179 void nndbgPrintWarning_ (const char* filename, int lineno, const char* fmt, ...); 180 void nndbgTPrintWarning_(const char* filename, int lineno, const char* fmt, ...); 181 182 #ifdef __cplusplus 183 } 184 #endif // ifdef __cplusplus 185 186 #endif // NN_DBG_DBG_DEBUGSTRING_H_ 187