1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     os_Utility.h
4 
5   Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain proprietary
8   information of Nintendo and/or its licensed developers and are protected by
9   national and international copyright laws. They may not be disclosed to third
10   parties or copied or duplicated in any form, in whole or in part, without the
11   prior written consent of Nintendo.
12 
13   The content herein is highly confidential and should be handled accordingly.
14 
15   $Revision: 31311 $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NW_OS_UTILITY_H_
19 #define NW_OS_UTILITY_H_
20 
21 #include <nw/types.h>
22 #include <cstdarg>
23 #include <nn/config.h>
24 
25 #ifdef NW_RELEASE
26   #define nwosPrintf(...)       ((void)0)
27   #define nwosVPrintf(...)      ((void)0)
28   #define nwosPanic(...)        ::nw::os::Halt()
29   #define nwosWarning(...)      ((void)0)
30 #else
31   #define nwosPrintf            ::nw::os::internal::Printf
32   #define nwosVPrintf           ::nw::os::internal::VPrintf
33   #define nwosPanic(...)        ::nw::os::internal::Panic( NN_FILE_NAME, __LINE__, __VA_ARGS__ )
34   #define nwosWarning(...)      ::nw::os::internal::Warning( NN_FILE_NAME, __LINE__, __VA_ARGS__ )
35 #endif
36 
37 namespace nw {
38 namespace os {
39 
40 namespace internal {
41 
42     void Printf(const char *fmt, ...);
43     void VPrintf(const char *fmt, std::va_list vlist);
44     void Warning( const char* fileName, int line, const char* fmt, ...);
45     void Panic( const char* fileName, int line, const char* fmt, ...);
46 
47 } // namespace internal
48 
49 int SNPrintf(char* dst, size_t len, const char* fmt, ...);
50 int VSNPrintf(char* dst, size_t len, const char* fmt, std::va_list vlist);
51 
52 void  Halt();
53 
54 
55 } // namespace os
56 } // namespace nw
57 
58 
59 /* NW_OS_UTILITY_H_ */
60 #endif
61