1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - MB - demos - multiboot-wfs - child 3 File: func_3.cpp 4 5 Copyright 2005-2008 Nintendo. 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 $Date:: $ 14 $Rev:$ 15 $Author:$ 16 *---------------------------------------------------------------------------*/ 17 18 #ifdef SDK_TWL 19 #include <twl.h> 20 #else 21 #include <nitro.h> 22 #endif 23 24 #include "func.h" 25 26 27 /******************************************************************************/ 28 /* Local implement */ 29 30 namespace 31 { 32 33 /* Test class for constructors/destructors */ 34 class Foo 35 { 36 private: 37 const int line_; 38 public: Foo(int line)39 Foo(int line):line_(line) 40 { 41 OS_TPrintf("func_3_cpp::Foo::constructor called. (object is at func_3_cpp:%d)\n", 42 line_); 43 } ~Foo()44 ~Foo() 45 { 46 OS_TPrintf("func_3_cpp::Foo::destructor called. (object is at func_3_cpp:%d)\n", line_); 47 } 48 }; 49 50 } // Unnamed namespace 51 52 53 /******************************************************************************/ 54 /* Variables */ 55 56 static int i = 0; 57 58 /* 59 * This is constructed when FS_StartOverlay() is run. 60 * This is destroyed when FS_EndOverlay() is run. 61 */ 62 static Foo foo1(__LINE__); 63 64 65 /******************************************************************************/ 66 /* Functions */ 67 68 #if defined(__cplusplus) 69 extern "C" 70 { 71 #endif 72 73 func_3(char * dst)74 void func_3(char *dst) 75 { 76 /* 77 * This is constructed during the first function call. 78 * If it has been constructed, it will be destroyed when FS_EndOverlay() is run. 79 */ 80 static Foo foo2(__LINE__); 81 82 ++i; 83 (void)OS_SPrintf(dst, "func_3. called %d time%s.\n", i, (i == 1) ? "" : "s", &i); 84 } 85 86 87 #if defined(__cplusplus) 88 } /* extern "C" */ 89 #endif 90 91 92 /******************************************************************************/ 93