1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: dbg_DebugString.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: 35043 $ 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 /* Please see man pages for details 31 32 33 34 */ 35 36 /* Please see man pages for details 37 38 */ 39 #define NN_DBG_PRINTF_BUFFER_LENGTH 256 40 41 // Buffer size for TPrintf 42 #define NN_DBG_TPRINTF_BUFFER_LENGTH 128 43 44 //------------------------------------------------------------------- 45 // NN_LOG 46 47 /* Please see man pages for details 48 49 50 51 52 53 54 */ 55 #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT 56 #ifdef __cplusplus 57 #define NN_LOG( ... ) (void)nn::dbg::detail::Printf(__VA_ARGS__) 58 #else // ifdef __cplusplus 59 #define NN_LOG( ... ) (void)nndbgDetailPrintf(__VA_ARGS__) 60 #endif // ifdef __cplusplus else 61 #else // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT 62 #define NN_LOG( ... ) ((void)0) 63 #endif // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT else 64 65 //------------------------------------------------------------------- 66 // NN_TLOG_ 67 68 /* 69 70 71 72 73 74 */ 75 #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK 76 #ifdef __cplusplus 77 #define NN_TLOG_( ... ) (void)nn::dbg::detail::TPrintf(__VA_ARGS__) 78 #else // ifdef __cplusplus 79 #define NN_TLOG_( ... ) (void)nndbgDetailTPrintf(__VA_ARGS__) 80 #endif // ifdef __cplusplus else 81 #else // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK 82 #define NN_TLOG_( ... ) ((void)0) 83 #endif // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK else 84 85 //------------------------------------------------------------------- 86 // NN_SLOG_ 87 88 /* 89 90 91 92 93 94 */ 95 #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK 96 #ifdef __cplusplus 97 #define NN_SLOG_( ... ) (void)nn::dbg::detail::Printf(__VA_ARGS__) 98 #else // ifdef __cplusplus 99 #define NN_SLOG_( ... ) (void)nndbgDetailPrintf(__VA_ARGS__) 100 #endif // ifdef __cplusplus else 101 #else // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK 102 #define NN_SLOG_( ... ) ((void)0) 103 #endif // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK else 104 105 106 //------------------------------------------------------------------- 107 // NN_LOGV 108 109 /* Please see man pages for details 110 111 112 113 114 115 116 117 118 */ 119 #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT 120 #ifdef __cplusplus 121 #define NN_LOGV( fmt, arg ) (void)nn::dbg::detail::VPrintf(fmt, arg) 122 #else // ifdef __cplusplus 123 #define NN_LOGV( fmt, arg ) (void)nndbgDetailVPrintf(fmt, arg) 124 #endif // ifdef __cplusplus else 125 #else // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT 126 #define NN_LOGV( ... ) ((void)0) 127 #endif // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT else 128 129 //------------------------------------------------------------------- 130 // NN_PUT 131 132 /* Please see man pages for details 133 134 135 136 137 */ 138 #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT 139 #ifdef __cplusplus 140 #define NN_PUT( text, length ) (void)nn::dbg::detail::PutString(text, length) 141 #else // ifdef __cplusplus 142 #define NN_PUT( text, length ) (void)nndbgDetailPutString(text, length) 143 #endif // ifdef __cplusplus else 144 #else // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT 145 #define NN_PUT( text, length ) ((void)0) 146 #endif // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT else 147 148 /* 149 150 */ 151 152 //------------------------------------------------------------------- 153 // for C++ 154 155 #ifdef __cplusplus 156 namespace nn { namespace dbg { 157 namespace detail 158 { 159 /* 160 161 162 163 */ 164 void Printf(const char* fmt, ...); 165 166 /* 167 168 169 170 */ 171 void TPrintf(const char* fmt, ...); 172 173 /* 174 175 176 177 178 179 180 */ 181 void VPrintf(const char* fmt, ::std::va_list arg); 182 183 /* 184 185 186 187 188 189 190 */ 191 void TVPrintf(const char* fmt, ::std::va_list arg); 192 193 /* 194 195 196 197 198 199 200 */ 201 void PutString(const char* text, s32 length); 202 203 /* 204 205 206 207 208 209 */ 210 void PutString(const char* text); 211 } 212 }} 213 #endif // ifdef __cplusplus 214 215 //------------------------------------------------------------------- 216 // for C / C++ 217 218 #include <nn/util/detail/util_CLibImpl.h> 219 220 #include <nn/dbg/dbg_Break.h> 221 222 #ifdef __cplusplus 223 extern "C" { 224 #endif // ifdef __cplusplus 225 226 /* 227 228 */ 229 void nndbgDetailPrintf(const char* fmt, ...); 230 231 /* 232 233 */ 234 void nndbgDetailTPrintf(const char* fmt, ...); 235 236 /* 237 238 239 240 */ 241 void nndbgDetailVPrintf(const char* fmt, va_list arg); 242 243 /* 244 245 246 247 */ 248 void nndbgDetailTVPrintf(const char* fmt, va_list arg); 249 250 /* 251 252 253 254 */ 255 void nndbgDetailPutString(const char* text, s32 length); 256 257 /* 258 259 260 261 262 263 264 265 266 267 268 */ 269 int nndbgAssertionFailureHandler(bool print, const char* filename, int lineno, const char* fmt, ...); 270 271 /* 272 273 274 275 276 277 278 279 280 281 282 */ 283 int nndbgTAssertionFailureHandler(bool print, const char* filename, int lineno, const char* fmt, ...); 284 285 #ifdef __cplusplus 286 } 287 #endif // ifdef __cplusplus 288 289 #endif // NN_DBG_DBG_DEBUGSTRING_H_ 290