00001 00002 // 00003 // Copyright (c) 2006 Audiokinetic Inc. / All Rights Reserved 00004 // 00006 00007 #ifndef _AK_AKASSERT_H_ 00008 #define _AK_AKASSERT_H_ 00009 00010 #if defined( _DEBUG ) && !(defined AK_DISABLE_ASSERTS) 00011 #ifndef AK_ENABLE_ASSERTS 00012 #define AK_ENABLE_ASSERTS 00013 #endif 00014 #endif 00015 00016 #if !defined( AKASSERT ) 00017 00018 #include <AK/SoundEngine/Common/AkTypes.h> //For AK_Fail/Success 00019 #include <AK/SoundEngine/Common/AkSoundEngineExport.h> 00020 00021 #if defined( AK_ENABLE_ASSERTS ) 00022 00023 #if defined( __SPU__ ) 00024 00025 #if defined ( _DEBUG ) 00026 // Note: No assert hook on SPU 00027 #include "spu_printf.h" 00028 #include "libsn_spu.h" 00029 #define AKASSERT(Condition) \ 00030 if ( !(Condition) ) \ 00031 { \ 00032 spu_printf( "Assertion triggered in file %s at line %d\n", __FILE__, __LINE__ );\ 00033 /*snPause();*/ \ 00034 } 00035 #else 00036 #define AKASSERT(Condition) 00037 #endif 00038 00039 #else // defined( __SPU__ ) 00040 00041 #ifndef AK_ASSERT_HOOK 00042 AK_CALLBACK( void, AkAssertHook)( 00043 const char * in_pszExpression, 00044 const char * in_pszFileName, 00045 int in_lineNumber 00046 ); 00047 #define AK_ASSERT_HOOK 00048 #endif 00049 00050 extern AKSOUNDENGINE_API AkAssertHook g_pAssertHook; 00051 00052 // These platforms use a built-in g_pAssertHook (and do not fall back to the regular assert macro) 00053 #define AKASSERT(Condition) ((Condition) ? ((void) 0) : g_pAssertHook( #Condition, __FILE__, __LINE__) ) 00054 00055 00056 #endif // defined( __SPU__ ) 00057 00058 #define AKVERIFY AKASSERT 00059 00060 #ifdef _DEBUG 00061 #define AKASSERTD AKASSERT 00062 #else 00063 #define AKASSERTD(Condition) ((void)0) 00064 #endif 00065 00066 #else // defined( AK_ENABLE_ASSERTS ) 00067 00068 #define AKASSERT(Condition) ((void)0) 00069 #define AKASSERTD(Condition) ((void)0) 00070 #define AKVERIFY(x) ((void)(x)) 00071 00072 #endif // defined( AK_ENABLE_ASSERTS ) 00073 00074 #define AKASSERT_RANGE(Value, Min, Max) (AKASSERT(((Value) >= (Min)) && ((Value) <= (Max)))) 00075 00076 #define AKASSERTANDRETURN( __Expression, __ErrorCode )\ 00077 if (!(__Expression))\ 00078 {\ 00079 AKASSERT(__Expression);\ 00080 return __ErrorCode;\ 00081 }\ 00082 00083 #define AKASSERTPOINTERORFAIL( __Pointer ) AKASSERTANDRETURN( __Pointer != NULL, AK_Fail ) 00084 #define AKASSERTSUCCESSORRETURN( __akr ) AKASSERTANDRETURN( __akr == AK_Success, __akr ) 00085 00086 #define AKASSERTPOINTERORRETURN( __Pointer ) \ 00087 if ((__Pointer) == NULL)\ 00088 {\ 00089 AKASSERT((__Pointer) == NULL);\ 00090 return ;\ 00091 }\ 00092 00093 #if defined( AK_WIN ) && ( _MSC_VER >= 1600 ) 00094 // Compile-time assert 00095 #define AKSTATICASSERT( __expr__, __msg__ ) static_assert( (__expr__), (__msg__) ) 00096 #else 00097 // Compile-time assert 00098 #define AKSTATICASSERT( __expr__, __msg__ ) typedef char __AKSTATICASSERT__[(__expr__)?1:-1] 00099 #endif 00100 00101 #endif // ! defined( AKASSERT ) 00102 00103 #ifdef AK_ENABLE_ASSERTS 00104 00105 00106 //Do nothing. This is a dummy function, so that g_pAssertHook is never NULL. 00107 #define DEFINEDUMMYASSERTHOOK void AkAssertHookFunc( \ 00108 const char* in_pszExpression,\ 00109 const char* in_pszFileName,\ 00110 int in_lineNumber)\ 00111 {\ 00112 \ 00113 }\ 00114 AkAssertHook g_pAssertHook = AkAssertHookFunc; 00115 #else 00116 #define DEFINEDUMMYASSERTHOOK 00117 00118 #endif 00119 #endif 00120
프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.
Wwise를 시작해 보세요