///////////////////////////////////////////////////////////////////////////////
/// @file deOS.hpp
///
/// @Header containing various things to help the porting to multiple platforms
///
/// @author CILCoder
///
/// This file is the intellectual property of Novus Delta, LLC.. Usage of the
/// contents of this file is subject to the Destiny3D Member License which
/// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
///
/// This file is distributed "AS IS" without warranty of any kind.  Novus
/// Delta, LLC. does not guarantee the fitness of the contents of this file
/// for any particular purpose.
///
/// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
///
/// <hr>
///                                 Change History
/// <hr>
///
/// @date May 2003
/// @author JesusFreak
/// @remarks Creation
///
///////////////////////////////////////////////////////////////////////////////
#ifndef DE_OS_HPP
#define DE_OS_HPP

// platforms

#if defined(linux)
#	undef _WIN32
#	undef WIN32
#	undef DESTINY3D_PLATFORM_WIN32
#	define DESTINY3D_PLATFORM_LINUX
#	define DE3D_HANDLES_ARE_VOID
#	define DEDLL_EXPORT
#	define DEDLL_IMPORT
#	define strcmpi strcasecmp

#elif defined(_WIN32)
#	undef linux
#	undef LINUX
#	undef DESTINY3D_PLATFORM_LINUX
#	define DESTINY3D_PLATFORM_WIN32
#	define DEDLL_EXPORT __declspec(dllexport)
#	define DEDLL_IMPORT __declspec(dllimport)

#else
#	error "Unsupported Platform - please notify Novus Delta"
#endif



// CPU's
#if (defined(__i386__)) || (defined(_M_IX86) && _M_IX86 >= 500)
#	define DE3D_CPU_LITTLE_ENDIAN (1)
#	define DE3D_CPU_BIG_ENDIAN (0)
#	define DE3D_CPU_I386
#   define DE3D_CPU "I386"
#else
#	error "Unsupported CPU type - please notify Novus Delta"
#endif



// compilers
#if defined (__GNUC__)
	// GCC
#	if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90)
#		error "gcc version unsupported"
#	endif
#	define DESTINY3D_COMPILER "GNU C++ version " __VERSION__
#	define DE3D_INT64_IS_LONG_LONG
#	define DE3D_INTERFACE(iface,baseiface) class iface : virtual public baseiface
#	define DE3D_INTERFACE_(iface) class iface

#elif defined (__BORLANDC__)
	// Borland
#	define DESTINY3D_COMPILER "Borland C++ version " DESTRINGIZE_VALUE(__BORLANDC__)
#	if (__BORLANDC__ >= 0x561)
#		define DE3D_INT64_IS_LONG_LONG
#	elif (__BORLANDC__ >= 0x530)
#		define DE3D_INT64_IS_MS_INT64
#	endif

#elif defined (__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
	// Intel
#	if (defined (_MSC_VER) && (_MSC_VER >= 1200))
#		define DE3D_INT64_IS_MS_INT64
#	endif

#elif defined (_MSC_VER)
	// Microsoft Visual C++ (only if tested last, other compilers define it also)
#	if (_MSC_VER >= 1200) // MSVC 6
#		define DE3D_INT64_IS_MS_INT64
#		define DESTINY3D_COMPILER "Microsoft Visual C++ version 6.0"
#		define DE3D_NOVTABLE __declspec(novtable) 
#		define DE3D_INTERFACE(iface,baseiface) class DE3D_NOVTABLE iface : virtual public baseiface
#		define DE3D_INTERFACE_(iface) class DE3D_NOVTABLE iface
#		pragma warning (disable : 4514) // unreferenced inline discarded. Lots of them. that's nice, now shut up.
#		pragma warning (disable : 4251) // base class needs to have dll-interface to be used by clients of class - gives endless pain on templated classes
#		pragma warning (disable : 4710) // function not inlined - another pain on templated classes
#		pragma warning (disable : 4127) // conditional expression is constant
#		pragma warning (disable : 4505) // unreferenced local function removed
#		pragma warning (disable : 4250) // x inherits y via dominance
#		pragma warning (disable : 4201) // nameless struct or union
#		if (NDEBUG)
#			pragma warning (disable : 4390) // empty controlled statement (such as in asserts)
#		endif
#	else
#		error "Unsupported MSVC Compiler - please notify Novus Delta"
#	endif

#	if (_MSC_VER >= 1300) // MSVC 7 (.NET)
#		undef DESTINY3D_COMPILER
#		define DESTINY3D_COMPILER "Microsoft Visual C++ version 7.0"
#	endif

#	if (_MSC_VER >= 1310) // MSVC 7.1 (.NET)
#		define DE3D_INT64_IS_LONG_LONG
#		undef DESTINY3D_COMPILER
#		define DESTINY3D_COMPILER "Microsoft Visual C++ version 7.1"
#	endif

#else
#	error "Unsupported Compiler - please notify Novus Delta"
#endif


#endif // DE_OS_HPP
