//
// Asura_Assert.h
//
// Created by Kevin Lea - 12/06/2001 11:14:30
// 
// Copyright (C) 2001 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef __ASURA_PLATFORM_ASSERT_H__
#define __ASURA_PLATFORM_ASSERT_H__

// Stdlib independent.
#include <stdlib.h>
//#include <intrin.h>

#ifdef ASURA_ASSERT

#define ASURA_PLATFORM_DEBUGBREAK() __debugbreak()
	
		// Internal functions
		const char* Asura_Platform_Assert_GetLogFileName();

#else // not def ASURA_ASSERT

#define ASURA_PLATFORM_DEBUGBREAK()
	
#endif // else not def ASURA_ASSERT

// KJFL - 22 March 2006 - Static, i.e. compile-time, assertions
// For documentation see http://asurawiki.rebellion.co.uk/twiki/bin/viewauth/Programming/AsuraStaticAssert
//
// KJFL - 23 March 2006 - changed macro to use __COUNTER__ instead of __LINE__
//
template<bool b> struct ASURA_STATIC_ASSERTION_FAILURE;
template <> struct ASURA_STATIC_ASSERTION_FAILURE<true> {};

#define ASURA_COMBINE_LITERALS( a, b ) a ## b
#define ASURA_STATIC_ASSERT_UNIQUENAME( a ) ASURA_COMBINE_LITERALS( ASURA_STATIC_ASSERT_FAILED_, a )

#define ASURA_STATIC_ASSERT( bCondition ) static ASURA_STATIC_ASSERTION_FAILURE<(bCondition != 0)> ASURA_STATIC_ASSERT_UNIQUENAME(__COUNTER__)

#endif // __ASURA_PLATFORM_ASSERT_H__
