1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     os_Utility.h
4 
5   Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc.  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   $Revision: 13725 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NW_OS_UTILITY_H_
17 #define NW_OS_UTILITY_H_
18 
19 #include <nw/types.h>
20 #include <cstdarg>
21 #include <nn/config.h>
22 
23 #ifdef NW_RELEASE
24   #define nwosPrintf(...)       ((void)0)
25   #define nwosVPrintf(...)      ((void)0)
26   #define nwosPanic(...)        ::nw::os::Halt()
27   #define nwosWarning(...)      ((void)0)
28 #else
29   #define nwosPrintf            ::nw::os::internal::Printf
30   #define nwosVPrintf           ::nw::os::internal::VPrintf
31   #define nwosPanic(...)        ::nw::os::internal::Panic( NN_FILE_NAME, __LINE__, __VA_ARGS__ )
32   #define nwosWarning(...)      ::nw::os::internal::Warning( NN_FILE_NAME, __LINE__, __VA_ARGS__ )
33 #endif
34 
35 namespace nw {
36 namespace os {
37 
38 namespace internal {
39 
40     void Printf(const char *fmt, ...);
41     void VPrintf(const char *fmt, std::va_list vlist);
42     void Warning( const char* fileName, int line, const char* fmt, ...);
43     void Panic( const char* fileName, int line, const char* fmt, ...);
44 
45 } // namespace internal
46 
47 int SNPrintf(char* dst, size_t len, const char* fmt, ...);
48 int VSNPrintf(char* dst, size_t len, const char* fmt, std::va_list vlist);
49 
50 void  Halt();
51 
52 
53 } // namespace os
54 } // namespace nw
55 
56 
57 /* NW_OS_UTILITY_H_ */
58 #endif
59