initial commit

This commit is contained in:
Roberto Parolin
2019-05-15 12:52:45 -07:00
commit bf5c149354
21 changed files with 13803 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
tags

4
.p4ignore Normal file
View File

@@ -0,0 +1,4 @@
tags
.p4ignore
/.git/

39
CMakeLists.txt Normal file
View File

@@ -0,0 +1,39 @@
#-------------------------------------------------------------------------------------------
# Copyright (C) Electronic Arts Inc. All rights reserved.
#-------------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.1)
project(EABase CXX)
#-------------------------------------------------------------------------------------------
# Options
#-------------------------------------------------------------------------------------------
option(EABASE_BUILD_TESTS "Enable generation of build files for tests" OFF)
#-------------------------------------------------------------------------------------------
# Defines
#-------------------------------------------------------------------------------------------
add_definitions(-D_CHAR16T)
#-------------------------------------------------------------------------------------------
# Source files
#-------------------------------------------------------------------------------------------
file(GLOB EABASE_SOURCES "include/Common/EABase/*.h" "include/Common/EABase/config/*.h")
if(EABASE_BUILD_TESTS)
add_subdirectory(test)
endif()
#-------------------------------------------------------------------------------------------
# Header only library
#-------------------------------------------------------------------------------------------
add_library(EABase INTERFACE)
#-------------------------------------------------------------------------------------------
# exported include directories
#-------------------------------------------------------------------------------------------
target_include_directories(EABase INTERFACE include/Common)
# HACK: Workaround CMake limitations to have files of interface / header-only
# libaries show up in IDEs
# http://stackoverflow.com/questions/27039019/how-to-have-cmake-show-headers-that-are-not-part-of-any-binary-target-in-the-ide/29218394#29218394
add_custom_target(EABase_ide SOURCES ${EABASE_SOURCES})

309
doc/EABase.html Normal file
View File

@@ -0,0 +1,309 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>EABase Future Plans</title>
<style type="text/css">
.SmallBody{
font-size: 10pt
}
body
{
font-family: Palatino Linotype, Book Antiqua, Times New Roman;
font-size: 11pt;
}
h1
{
font-family: Verdana;
display: block;
background-color: #FFF0B0;
border: solid 2px black;
font-size: 16pt;
font-weight: bold;
padding: 6px;
}
h2
{
font-size: 14pt;
font-family: Verdana;
border-bottom: 2px solid black;
}
h3
{
font-family: Verdana;
font-size: 13pt;
font-weight: bold;
}
.code-example
{
display: block;
background-color: #e0e0f0;
margin-left: 3em;
margin-right: 3em;
margin-top: 1em;
margin-bottom: 1em;
padding: 8px;
border: solid 2px #a0a0d0;
font-family: monospace;
font-size: 10pt;
white-space: pre;
}
.code-example-span
{
font-family: monospace;
font-size: 10pt;
white-space: pre;
}
.code-example-comment
{
background-color: #e0e0f0;
padding: 0px 0px;
font-family: monospace;
font-size: 10pt;
white-space: pre;
color: #999999;
margin: auto auto;
}
.faq-question
{
background-color: #D0E0D0;
font-size: 12pt;
font-weight: bold;
margin-bottom: 0.5em;
margin-top: 0em;
padding-left:8px;
padding-right:8px;
padding-top:2px;
padding-bottom:2px
}
.faq-answer
{
display: block;
margin: 4pt 1em 0.5em 1em;
}
</style>
</head>
<body>
<h1>EABase
</h1>
<h3>What is EABase?
</h3>
<p>EABase is a small set of header files that define platform-independent
data types and macros. As such it is similar to many projects that have
a platform.h, system.h, defines.h, etc. file. The difference is that
EABase is very comprehensive and is the annointed Electronic Arts
worldwide standard for new projects. </p>
<p>With respect to the base types and definitions, many of these are
already present in the most recent C language standard, though the C++
standard has yet to formally adopt them. EABase bridges the gap and
defines these values if they aren't already defined. With respect to
compiler and platform definitions, EABase provides a standard reliable
means of identifying or specifying compilers, platforms, endian-ness,
alignment attributes, etc. </p>
<h3>Usage notes </h3>
<p>You probably don't want to use float_t and double_t. They are there for C99 compatibility but are rarely what you want to use, since their size is variable.</p>
<p>Prid8, etc. are somewhat painful and ugly to use and you may find you don't like them. They too are for C99 compatibility.</p>
<p>intptr_t is not a pointer to an int; it's an int with the same size as a pointer, so you can safely store pointers in it.</p>
<p>EA::result_type is rarely used and exists for backwards compatibility.</p>
<h3>What specifically does EABase define?</h3>
<p>Here we list the things EABase defines, grouped by category. These
defines are up to date as of the file modification date listed at the
top of this file.</p>
<h4>Base Types and Definitions<br>
</h4>
<div style="margin-left: 40px;">bool8_t, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, float_t, double_t, (EAStdC package implements int128_t)<br>
intptr_t, uintptr_t, intmax_t, uintmax_t, ssize_t<br>
char8_t, char16_t, char32_t<br>
INT8_C(), UINT8_C(), etc.<br>
INT8_MIN, INT8_MAX, UINT8_MAX, etc.<br>
PRId8, PRId16, PRId32, etc, SCNd8, SCNd16, SCNd32, etc.</div>
<h4>Result Types and Definitions<br>
</h4>
<div style="margin-left: 40px;">EA::result_type<br>
EA::SUCCESS, EA::FAILURE<br>
EA_SUCCEEDED(), EA_FAILED()</div>
<h4>Compiler Definitions<br>
</h4>
<div style="margin-left: 40px;">EA_COMPILER_GNUC<br>
EA_COMPILER_SN<br>
EA_COMPILER_MSVC<br>
EA_COMPILER_METROWERKS<br>
EA_COMPILER_INTEL<br>
EA_COMPILER_BORLANDC<br>
<br>
EA_COMPILER_VERSION = &lt;integer&gt;<br>
EA_COMPILER_NAME = &lt;string&gt;<br>
EA_COMPILER_STRING = &lt;string&gt;<br>
<br>
EA_COMPILER_NO_STATIC_CONSTANTS<br>
EA_COMPILER_NO_TEMPLATE_SPECIALIZATION<br>
EA_COMPILER_NO_TEMPLATE_PARTIAL_SPECIALIZATION<br>
EA_COMPILER_NO_MEMBER_TEMPLATES<br>
EA_COMPILER_NO_MEMBER_TEMPLATE_SPECIALIZATION<br>
EA_COMPILER_NO_TEMPLATE_TEMPLATES<br>
EA_COMPILER_NO_MEMBER_TEMPLATE_FRIENDS<br>
EA_COMPILER_NO_VOID_RETURNS<br>
EA_COMPILER_NO_COVARIANT_RETURN_TYPE<br>
EA_COMPILER_NO_DEDUCED_TYPENAME<br>
EA_COMPILER_NO_ARGUMENT_DEPENDENT_LOOKUP<br>
EA_COMPILER_NO_EXCEPTION_STD_NAMESPACE<br>
EA_COMPILER_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS<br>
EA_COMPILER_NO_EXCEPTIONS<br>
EA_COMPILER_NO_UNWIND<br>
<br>
EA_COMPILER_IS_ANSIC<br>
EA_COMPILER_IS_C99<br>
EA_COMPILER_HAS_C99_TYPES<br>
EA_COMPILER_IS_CPLUSPLUS<br>
EA_COMPILER_MANAGED_CPP</div>
<h4>Utilities<br>
</h4>
<div style="margin-left: 40px;">
<p>EA_ALIGN_OF()<br>
EA_PREFIX_ALIGN()<br>
EA_POSTFIX_ALIGN()<br>
EA_ALIGNED()<br>
EA_PACKED()<br>
EA_LIKELY()<br>
EA_UNLIKELY()<br>
EA_ASSUME()<br>
EA_PURE<br>
EA_WCHAR_T_NON_NATIVE<br>
EA_WCHAR_SIZE<br>
EA_RESTRICT<br>
EA_DEPRECATED<br>
EA_PREFIX_DEPRECATED<br>
EA_POSTFIX_DEPRECATED <br>
EA_FORCE_INLINE<br>
EA_NO_INLINE<br>
EA_PREFIX_NO_INLINE<br>
EA_POSTFIX_NO_INLINE <br>
EA_PASCAL<br>
EA_PASCAL_FUNC()<br>
EA_SSE = [0 | 1]<br>
EA_IMPORT<br>
EA_EXPORT<br>
EA_OVERRIDE<br>
EA_INIT_PRIORITY<br>
EA_MAY_ALIAS<br>
</p>
</div>
<h4>Platform Definitions<br>
</h4>
<div style="margin-left: 40px;"><br>
EA_PLATFORM_MAC<br>
EA_PLATFORM_OSX<br>
EA_PLATFORM_IPHONE<br>
EA_PLATFORM_ANDROID<br>
EA_PLATFORM_LINUX<br>
EA_PLATFORM_WINDOWS<br>
EA_PLATFORM_WIN32<br>
EA_PLATFORM_WIN64<br>
EA_PLATFORM_HPUX<br>
EA_PLATFORM_SUN<br>
<br>
EA_PLATFORM_NAME<br>
EA_PLATFORM_DESCRIPTION<br>
EA_PROCESSOR_POWERPC, EA_PROCESSOR_X86, EA_PROCESSOR_ARM, etc.<br>
EA_SYSTEM_LITTLE_ENDIAN, EA_SYSTEM_BIG_ENDIAN<br>
EA_ASM_STYLE_ATT, EA_ASM_STYLE_INTEL, EA_ASM_STYLE_MOTOROLA<br>
EA_PLATFORM_PTR_SIZE<br>
EA_PLATFORM_WORD_SIZE</div>
<br>
<hr style="width: 100%; height: 2px;"><br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,725 @@
/*-----------------------------------------------------------------------------
* config/eaplatform.h
*
* Copyright (c) Electronic Arts Inc. All rights reserved.
*-----------------------------------------------------------------------------
* Currently supported platform indentification defines include:
*/
#ifdef EA_PLATFORM_PS4 // ifdef for code stripping purposes
// EA_PLATFORM_PS4 (EA_PLATFORM_KETTLE)
#endif
#ifdef EA_PLATFORM_XBOXONE // ifdef for code stripping purposes
// EA_PLATFORM_XBOXONE (EA_PLATFORM_CAPILANO)
// EA_PLATFORM_XBOXONE_XDK (EA_PLATFORM_CAPILANO_XDK), set by capilano_config package
// EA_PLATFORM_XBOXONE_ADK (EA_PLATFORM_CAPILANO_ADK), set by capilano_config package
#endif
// EA_PLATFORM_ANDROID
// EA_PLATFORM_APPLE
// EA_PLATFORM_IPHONE
// EA_PLATFORM_IPHONE_SIMULATOR
// EA_PLATFORM_OSX
// EA_PLATFORM_LINUX
// EA_PLATFORM_SAMSUNG_TV
// EA_PLATFORM_WINDOWS
// EA_PLATFORM_WIN32
// EA_PLATFORM_WIN64
// EA_PLATFORM_WINDOWS_PHONE
// EA_PLATFORM_WINRT
// EA_PLATFORM_SUN
// EA_PLATFORM_LRB (Larrabee)
// EA_PLATFORM_POSIX (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX, EA_PLATFORM_UNIX, EA_PLATFORM_QNX)
// EA_PLATFORM_UNIX (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX)
// EA_PLATFORM_CYGWIN (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX)
// EA_PLATFORM_MINGW (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS)
// EA_PLATFORM_MICROSOFT (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS)
//
// EA_ABI_ARM_LINUX (a.k.a. "eabi". for all platforms that use the CodeSourcery GNU/Linux toolchain, like Android)
// EA_ABI_ARM_APPLE (similar to eabi but not identical)
// EA_ABI_ARM64_APPLE (similar to eabi but not identical) https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html
// EA_ABI_ARM_WINCE (similar to eabi but not identical)
//
// Other definitions emanated from this file inclue:
// EA_PLATFORM_NAME = <string>
// EA_PLATFORM_DESCRIPTION = <string>
// EA_PROCESSOR_XXX
// EA_MISALIGNED_SUPPORT_LEVEL=0|1|2
// EA_SYSTEM_LITTLE_ENDIAN | EA_SYSTEM_BIG_ENDIAN
// EA_ASM_STYLE_ATT | EA_ASM_STYLE_INTEL | EA_ASM_STYLE_MOTOROLA
// EA_PLATFORM_PTR_SIZE = <integer size in bytes>
// EA_PLATFORM_WORD_SIZE = <integer size in bytes>
// EA_CACHE_LINE_SIZE = <integer size in bytes>
//---------------------------------------------------------------------------
/*
EA_PLATFORM_MOBILE
EA_PLATFORM_MOBILE is a peer to EA_PLATORM_DESKTOP and EA_PLATFORM_CONSOLE. Their definition is qualitative rather
than quantitative, and refers to the general (usually weaker) capabilities of the machine. Mobile devices have a
similar set of weaknesses that are useful to generally categorize. The primary motivation is to avoid code that
tests for multiple mobile platforms on a line and needs to be updated every time we get a new one.
For example, mobile platforms tend to have weaker ARM processors, don't have full multiple processor support,
are hand-held, don't have mice (though may have touch screens or basic cursor controls), have writable solid
state permanent storage. Production user code shouldn't have too many expectations about the meaning of this define.
EA_PLATFORM_DESKTOP
This is similar to EA_PLATFORM_MOBILE in its qualitative nature and refers to platforms that are powerful.
For example, they nearly always have virtual memory, mapped memory, hundreds of GB of writable disk storage,
TCP/IP network connections, mice, keyboards, 512+ MB of RAM, multiprocessing, multiple display support.
Production user code shouldn't have too many expectations about the meaning of this define.
EA_PLATFORM_CONSOLE
This is similar to EA_PLATFORM_MOBILE in its qualitative nature and refers to platforms that are consoles.
This means platforms that are connected to TVs, are fairly powerful (especially graphics-wise), are tightly
controlled by vendors, tend not to have mapped memory, tend to have TCP/IP, don't have multiple process support
though they might have multiple CPUs, support TV output only. Production user code shouldn't have too many
expectations about the meaning of this define.
*/
#ifndef INCLUDED_eaplatform_H
#define INCLUDED_eaplatform_H
// Cygwin
// This is a pseudo-platform which will be defined along with EA_PLATFORM_LINUX when
// using the Cygwin build environment.
#if defined(__CYGWIN__)
#define EA_PLATFORM_CYGWIN 1
#define EA_PLATFORM_DESKTOP 1
#endif
// MinGW
// This is a pseudo-platform which will be defined along with EA_PLATFORM_WINDOWS when
// using the MinGW Windows build environment.
#if defined(__MINGW32__) || defined(__MINGW64__)
#define EA_PLATFORM_MINGW 1
#define EA_PLATFORM_DESKTOP 1
#endif
#if defined(EA_PLATFORM_PS4) || defined(__ORBIS__) || defined(EA_PLATFORM_KETTLE)
// PlayStation 4
// Orbis was Sony's code-name for the platform, which is now obsolete.
// Kettle was an EA-specific code-name for the platform, which is now obsolete.
#if defined(EA_PLATFORM_PS4)
#undef EA_PLATFORM_PS4
#endif
#define EA_PLATFORM_PS4 1
// Backward compatibility:
#if defined(EA_PLATFORM_KETTLE)
#undef EA_PLATFORM_KETTLE
#endif
// End backward compatbility
#define EA_PLATFORM_KETTLE 1
#define EA_PLATFORM_NAME "PS4"
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "PS4 on x64"
#define EA_PLATFORM_CONSOLE 1
#define EA_PLATFORM_SONY 1
#define EA_PLATFORM_POSIX 1
// #define EA_POSIX_THREADS_AVAILABLE 1 // POSIX threading API is available but discouraged. Sony indicated use of the scePthreads* API is preferred.
#define EA_PROCESSOR_X86_64 1
#if defined(__GNUC__) || defined(__clang__)
#define EA_ASM_STYLE_ATT 1
#endif
#elif defined(EA_PLATFORM_XBOXONE) || defined(_DURANGO) || defined(EA_PLATFORM_CAPILANO) || (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES || WINAPI_FAMILY == WINAPI_FAMILY_TV_TITLE))
// XBox One
// Durango was Microsoft's code-name for the platform, which is now obsolete.
// Microsoft uses _DURANGO instead of some variation of _XBOX, though it's not natively defined by the compiler.
// Capilano was an EA-specific code-name for the platform, which is now obsolete.
#if defined(EA_PLATFORM_XBOXONE)
#undef EA_PLATFORM_XBOXONE
#endif
#define EA_PLATFORM_XBOXONE 1
// Backward compatibility:
#if defined(EA_PLATFORM_CAPILANO)
#undef EA_PLATFORM_CAPILANO
#endif
#define EA_PLATFORM_CAPILANO 1
#if defined(EA_PLATFORM_CAPILANO_XDK) && !defined(EA_PLATFORM_XBOXONE_XDK)
#define EA_PLATFORM_XBOXONE_XDK 1
#endif
#if defined(EA_PLATFORM_CAPILANO_ADK) && !defined(EA_PLATFORM_XBOXONE_ADK)
#define EA_PLATFORM_XBOXONE_ADK 1
#endif
// End backward compatibility
#if !defined(_DURANGO)
#define _DURANGO
#endif
#define EA_PLATFORM_NAME "XBox One"
//#define EA_PROCESSOR_X86 Currently our policy is that we don't define this, even though x64 is something of a superset of x86.
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "XBox One on x64"
#define EA_ASM_STYLE_INTEL 1
#define EA_PLATFORM_CONSOLE 1
#define EA_PLATFORM_MICROSOFT 1
// WINAPI_FAMILY defines - mirrored from winapifamily.h
#define EA_WINAPI_FAMILY_APP 1000
#define EA_WINAPI_FAMILY_DESKTOP_APP 1001
#define EA_WINAPI_FAMILY_PHONE_APP 1002
#define EA_WINAPI_FAMILY_TV_APP 1003
#define EA_WINAPI_FAMILY_TV_TITLE 1004
#define EA_WINAPI_FAMILY_GAMES 1006
#if defined(WINAPI_FAMILY)
#include <winapifamily.h>
#if WINAPI_FAMILY == WINAPI_FAMILY_TV_TITLE
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_TV_TITLE
#elif WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
#elif WINAPI_FAMILY == WINAPI_FAMILY_GAMES
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_GAMES
#else
#error Unsupported WINAPI_FAMILY
#endif
#else
#error WINAPI_FAMILY should always be defined on Capilano.
#endif
// Macro to determine if a partition is enabled.
#define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition)
#if EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_DESKTOP_APP
#define EA_WINAPI_PARTITION_CORE 1
#define EA_WINAPI_PARTITION_DESKTOP 1
#define EA_WINAPI_PARTITION_APP 1
#define EA_WINAPI_PARTITION_PC_APP 0
#define EA_WIANPI_PARTITION_PHONE 0
#define EA_WINAPI_PARTITION_TV_APP 0
#define EA_WINAPI_PARTITION_TV_TITLE 0
#define EA_WINAPI_PARTITION_GAMES 0
#elif EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_TV_TITLE
#define EA_WINAPI_PARTITION_CORE 1
#define EA_WINAPI_PARTITION_DESKTOP 0
#define EA_WINAPI_PARTITION_APP 0
#define EA_WINAPI_PARTITION_PC_APP 0
#define EA_WIANPI_PARTITION_PHONE 0
#define EA_WINAPI_PARTITION_TV_APP 0
#define EA_WINAPI_PARTITION_TV_TITLE 1
#define EA_WINAPI_PARTITION_GAMES 0
#elif EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_GAMES
#define EA_WINAPI_PARTITION_CORE 1
#define EA_WINAPI_PARTITION_DESKTOP 0
#define EA_WINAPI_PARTITION_APP 0
#define EA_WINAPI_PARTITION_PC_APP 0
#define EA_WIANPI_PARTITION_PHONE 0
#define EA_WINAPI_PARTITION_TV_APP 0
#define EA_WINAPI_PARTITION_TV_TITLE 0
#define EA_WINAPI_PARTITION_GAMES 1
#else
#error Unsupported WINAPI_FAMILY
#endif
// Larrabee // This part to be removed once __LRB__ is supported by the Larrabee compiler in 2009.
#elif defined(EA_PLATFORM_LRB) || defined(__LRB__) || (defined(__EDG__) && defined(__ICC) && defined(__x86_64__))
#undef EA_PLATFORM_LRB
#define EA_PLATFORM_LRB 1
#define EA_PLATFORM_NAME "Larrabee"
#define EA_PLATFORM_DESCRIPTION "Larrabee on LRB1"
#define EA_PROCESSOR_X86_64 1
#if defined(BYTE_ORDER) && (BYTE_ORDER == 4321)
#define EA_SYSTEM_BIG_ENDIAN 1
#else
#define EA_SYSTEM_LITTLE_ENDIAN 1
#endif
#define EA_PROCESSOR_LRB 1
#define EA_PROCESSOR_LRB1 1 // Larrabee version 1
#define EA_ASM_STYLE_ATT 1 // Both types of asm style
#define EA_ASM_STYLE_INTEL 1 // are supported.
#define EA_PLATFORM_DESKTOP 1
// Android (Google phone OS)
#elif defined(EA_PLATFORM_ANDROID) || defined(__ANDROID__)
#undef EA_PLATFORM_ANDROID
#define EA_PLATFORM_ANDROID 1
#define EA_PLATFORM_LINUX 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_POSIX 1
#define EA_PLATFORM_NAME "Android"
#define EA_ASM_STYLE_ATT 1
#if defined(__arm__)
#define EA_ABI_ARM_LINUX 1 // a.k.a. "ARM eabi"
#define EA_PROCESSOR_ARM32 1
#define EA_PLATFORM_DESCRIPTION "Android on ARM"
#elif defined(__aarch64__)
#define EA_PROCESSOR_ARM64 1
#define EA_PLATFORM_DESCRIPTION "Android on ARM64"
#elif defined(__i386__)
#define EA_PROCESSOR_X86 1
#define EA_PLATFORM_DESCRIPTION "Android on x86"
#elif defined(__x86_64)
#define EA_PROCESSOR_X86_64 1
#define EA_PLATFORM_DESCRIPTION "Android on x64"
#else
#error Unknown processor
#endif
#if !defined(EA_SYSTEM_BIG_ENDIAN) && !defined(EA_SYSTEM_LITTLE_ENDIAN)
#define EA_SYSTEM_LITTLE_ENDIAN 1
#endif
#define EA_PLATFORM_MOBILE 1
// Samsung SMART TV - a Linux-based smart TV
#elif defined(EA_PLATFORM_SAMSUNG_TV)
#undef EA_PLATFORM_SAMSUNG_TV
#define EA_PLATFORM_SAMSUNG_TV 1
#define EA_PLATFORM_LINUX 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_POSIX 1
#define EA_PLATFORM_NAME "SamsungTV"
#define EA_PLATFORM_DESCRIPTION "Samsung SMART TV on ARM"
#define EA_ASM_STYLE_ATT 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PROCESSOR_ARM32 1
#define EA_ABI_ARM_LINUX 1 // a.k.a. "ARM eabi"
#define EA_PROCESSOR_ARM7 1
#elif defined(__APPLE__) && __APPLE__
#include <TargetConditionals.h>
// Apple family of operating systems.
#define EA_PLATFORM_APPLE
#define EA_PLATFORM_POSIX 1
// iPhone
// TARGET_OS_IPHONE will be undefined on an unknown compiler, and will be defined on gcc.
#if defined(EA_PLATFORM_IPHONE) || defined(__IPHONE__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
#undef EA_PLATFORM_IPHONE
#define EA_PLATFORM_IPHONE 1
#define EA_PLATFORM_NAME "iPhone"
#define EA_ASM_STYLE_ATT 1
#define EA_POSIX_THREADS_AVAILABLE 1
#if defined(__arm__)
#define EA_ABI_ARM_APPLE 1
#define EA_PROCESSOR_ARM32 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "iPhone on ARM"
#elif defined(__aarch64__) || defined(__AARCH64)
#define EA_ABI_ARM64_APPLE 1
#define EA_PROCESSOR_ARM64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "iPhone on ARM64"
#elif defined(__i386__)
#define EA_PLATFORM_IPHONE_SIMULATOR 1
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "iPhone simulator on x86"
#elif defined(__x86_64) || defined(__amd64)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "iPhone simulator on x64"
#else
#error Unknown processor
#endif
#define EA_PLATFORM_MOBILE 1
// Macintosh OSX
// TARGET_OS_MAC is defined by the Metrowerks and older AppleC compilers.
// Howerver, TARGET_OS_MAC is defined to be 1 in all cases.
// __i386__ and __intel__ are defined by the GCC compiler.
// __dest_os is defined by the Metrowerks compiler.
// __MACH__ is defined by the Metrowerks and GCC compilers.
// powerc and __powerc are defined by the Metrowerks and GCC compilers.
#elif defined(EA_PLATFORM_OSX) || defined(__MACH__) || (defined(__MSL__) && (__dest_os == __mac_os_x))
#undef EA_PLATFORM_OSX
#define EA_PLATFORM_OSX 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_POSIX 1
//#define EA_PLATFORM_BSD 1 We don't currently define this. OSX has some BSD history but a lot of the API is different.
#define EA_PLATFORM_NAME "OSX"
#if defined(__i386__) || defined(__intel__)
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on x86"
#elif defined(__x86_64) || defined(__amd64)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on x64"
#elif defined(__arm__)
#define EA_ABI_ARM_APPLE 1
#define EA_PROCESSOR_ARM32 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on ARM"
#elif defined(__aarch64__) || defined(__AARCH64)
#define EA_ABI_ARM64_APPLE 1
#define EA_PROCESSOR_ARM64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on ARM64"
#elif defined(__POWERPC64__) || defined(__powerpc64__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_64 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on PowerPC 64"
#elif defined(__POWERPC__) || defined(__powerpc__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_32 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on PowerPC"
#else
#error Unknown processor
#endif
#if defined(__GNUC__)
#define EA_ASM_STYLE_ATT 1
#else
#define EA_ASM_STYLE_MOTOROLA 1
#endif
#define EA_PLATFORM_DESKTOP 1
#else
#error Unknown Apple Platform
#endif
// Linux
// __linux and __linux__ are defined by the GCC and Borland compiler.
// __i386__ and __intel__ are defined by the GCC compiler.
// __i386__ is defined by the Metrowerks compiler.
// _M_IX86 is defined by the Borland compiler.
// __sparc__ is defined by the GCC compiler.
// __powerpc__ is defined by the GCC compiler.
// __ARM_EABI__ is defined by GCC on an ARM v6l (Raspberry Pi 1)
// __ARM_ARCH_7A__ is defined by GCC on an ARM v7l (Raspberry Pi 2)
#elif defined(EA_PLATFORM_LINUX) || (defined(__linux) || defined(__linux__))
#undef EA_PLATFORM_LINUX
#define EA_PLATFORM_LINUX 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_POSIX 1
#define EA_PLATFORM_NAME "Linux"
#if defined(__i386__) || defined(__intel__) || defined(_M_IX86)
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Linux on x86"
#elif defined(__ARM_ARCH_7A__) || defined(__ARM_EABI__)
#define EA_ABI_ARM_LINUX 1
#define EA_PROCESSOR_ARM32 1
#define EA_PLATFORM_DESCRIPTION "Linux on ARM 6/7 32-bits"
#elif defined(__aarch64__) || defined(__AARCH64)
#define EA_PROCESSOR_ARM64 1
#define EA_PLATFORM_DESCRIPTION "Linux on ARM64"
#elif defined(__x86_64__)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Linux on x64"
#elif defined(__powerpc64__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_64 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Linux on PowerPC 64"
#elif defined(__powerpc__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_32 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Linux on PowerPC"
#else
#error Unknown processor
#error Unknown endianness
#endif
#if defined(__GNUC__)
#define EA_ASM_STYLE_ATT 1
#endif
#define EA_PLATFORM_DESKTOP 1
#elif defined(EA_PLATFORM_BSD) || (defined(__BSD__) || defined(__FreeBSD__))
#undef EA_PLATFORM_BSD
#define EA_PLATFORM_BSD 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_POSIX 1 // BSD's posix complaince is not identical to Linux's
#define EA_PLATFORM_NAME "BSD Unix"
#if defined(__i386__) || defined(__intel__)
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "BSD on x86"
#elif defined(__x86_64__)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "BSD on x64"
#elif defined(__powerpc64__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_64 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "BSD on PowerPC 64"
#elif defined(__powerpc__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_32 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "BSD on PowerPC"
#else
#error Unknown processor
#error Unknown endianness
#endif
#if !defined(EA_PLATFORM_FREEBSD) && defined(__FreeBSD__)
#define EA_PLATFORM_FREEBSD 1 // This is a variation of BSD.
#endif
#if defined(__GNUC__)
#define EA_ASM_STYLE_ATT 1
#endif
#define EA_PLATFORM_DESKTOP 1
#elif defined(EA_PLATFORM_WINDOWS_PHONE)
#undef EA_PLATFORM_WINDOWS_PHONE
#define EA_PLATFORM_WINDOWS_PHONE 1
#define EA_PLATFORM_NAME "Windows Phone"
#if defined(_M_AMD64) || defined(_AMD64_) || defined(__x86_64__)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows Phone on x64"
#elif defined(_M_IX86) || defined(_X86_)
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows Phone on X86"
#elif defined(_M_ARM)
#define EA_ABI_ARM_WINCE 1
#define EA_PROCESSOR_ARM32 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows Phone on ARM"
#else //Possibly other Windows Phone variants
#error Unknown processor
#error Unknown endianness
#endif
#define EA_PLATFORM_MICROSOFT 1
// WINAPI_FAMILY defines - mirrored from winapifamily.h
#define EA_WINAPI_FAMILY_APP 1
#define EA_WINAPI_FAMILY_DESKTOP_APP 2
#define EA_WINAPI_FAMILY_PHONE_APP 3
#if defined(WINAPI_FAMILY)
#include <winapifamily.h>
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_PHONE_APP
#else
#error Unsupported WINAPI_FAMILY for Windows Phone
#endif
#else
#error WINAPI_FAMILY should always be defined on Windows Phone.
#endif
// Macro to determine if a partition is enabled.
#define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition)
// Enable the appropriate partitions for the current family
#if EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_PHONE_APP
# define EA_WINAPI_PARTITION_CORE 1
# define EA_WINAPI_PARTITION_PHONE 1
# define EA_WINAPI_PARTITION_APP 1
#else
# error Unsupported WINAPI_FAMILY for Windows Phone
#endif
// Windows
// _WIN32 is defined by the VC++, Intel and GCC compilers.
// _WIN64 is defined by the VC++, Intel and GCC compilers.
// __WIN32__ is defined by the Borland compiler.
// __INTEL__ is defined by the Metrowerks compiler.
// _M_IX86, _M_AMD64 and _M_IA64 are defined by the VC++, Intel, and Borland compilers.
// _X86_, _AMD64_, and _IA64_ are defined by the Metrowerks compiler.
// _M_ARM is defined by the VC++ compiler.
#elif (defined(EA_PLATFORM_WINDOWS) || (defined(_WIN32) || defined(__WIN32__) || defined(_WIN64))) && !defined(CS_UNDEFINED_STRING)
#undef EA_PLATFORM_WINDOWS
#define EA_PLATFORM_WINDOWS 1
#define EA_PLATFORM_NAME "Windows"
#ifdef _WIN64 // VC++ defines both _WIN32 and _WIN64 when compiling for Win64.
#define EA_PLATFORM_WIN64 1
#else
#define EA_PLATFORM_WIN32 1
#endif
#if defined(_M_AMD64) || defined(_AMD64_) || defined(__x86_64__)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows on x64"
#elif defined(_M_IX86) || defined(_X86_)
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows on X86"
#elif defined(_M_IA64) || defined(_IA64_)
#define EA_PROCESSOR_IA64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows on IA-64"
#elif defined(_M_ARM)
#define EA_ABI_ARM_WINCE 1
#define EA_PROCESSOR_ARM32 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows on ARM"
#else //Possibly other Windows CE variants
#error Unknown processor
#error Unknown endianness
#endif
#if defined(__GNUC__)
#define EA_ASM_STYLE_ATT 1
#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__ICL)
#define EA_ASM_STYLE_INTEL 1
#endif
#define EA_PLATFORM_DESKTOP 1
#define EA_PLATFORM_MICROSOFT 1
// WINAPI_FAMILY defines to support Windows 8 Metro Apps - mirroring winapifamily.h in the Windows 8 SDK
#define EA_WINAPI_FAMILY_APP 1000
#define EA_WINAPI_FAMILY_DESKTOP_APP 1001
#if defined(WINAPI_FAMILY)
#if defined(_MSC_VER)
#pragma warning(push, 0)
#endif
#include <winapifamily.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#if WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
#elif WINAPI_FAMILY == WINAPI_FAMILY_APP
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_APP
#else
#error Unsupported WINAPI_FAMILY
#endif
#else
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
#endif
#define EA_WINAPI_PARTITION_DESKTOP 1
#define EA_WINAPI_PARTITION_APP 1
#define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition)
// EA_PLATFORM_WINRT
// This is a subset of Windows which is used for tablets and the "Metro" (restricted) Windows user interface.
// WinRT doesn't doesn't have access to the Windows "desktop" API, but WinRT can nevertheless run on
// desktop computers in addition to tablets. The Windows Phone API is a subset of WinRT and is not included
// in it due to it being only a part of the API.
#if (defined(EA_PLATFORM_WINDOWS) && !EA_WINAPI_FAMILY_PARTITION(EA_WINAPI_PARTITION_DESKTOP))
#define EA_PLATFORM_WINRT 1
#endif
// Sun (Solaris)
// __SUNPRO_CC is defined by the Sun compiler.
// __sun is defined by the GCC compiler.
// __i386 is defined by the Sun and GCC compilers.
// __sparc is defined by the Sun and GCC compilers.
#else
#error Unknown platform
#error Unknown processor
#error Unknown endianness
#endif
#ifndef EA_PROCESSOR_ARM
#if defined(EA_PROCESSOR_ARM32) || defined(EA_PROCESSOR_ARM64) || defined(EA_PROCESSOR_ARM7)
#define EA_PROCESSOR_ARM
#endif
#endif
// EA_PLATFORM_PTR_SIZE
// Platform pointer size; same as sizeof(void*).
// This is not the same as sizeof(int), as int is usually 32 bits on
// even 64 bit platforms.
//
// _WIN64 is defined by Win64 compilers, such as VC++.
// _M_IA64 is defined by VC++ and Intel compilers for IA64 processors.
// __LP64__ is defined by HP compilers for the LP64 standard.
// _LP64 is defined by the GCC and Sun compilers for the LP64 standard.
// __ia64__ is defined by the GCC compiler for IA64 processors.
// __arch64__ is defined by the Sparc compiler for 64 bit processors.
// __mips64__ is defined by the GCC compiler for MIPS processors.
// __powerpc64__ is defined by the GCC compiler for PowerPC processors.
// __64BIT__ is defined by the AIX compiler for 64 bit processors.
// __sizeof_ptr is defined by the ARM compiler (armcc, armcpp).
//
#ifndef EA_PLATFORM_PTR_SIZE
#if defined(__WORDSIZE) // Defined by some variations of GCC.
#define EA_PLATFORM_PTR_SIZE ((__WORDSIZE) / 8)
#elif defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(_M_IA64) || defined(__ia64__) || defined(__arch64__) || defined(__aarch64__) || defined(__mips64__) || defined(__64BIT__) || defined(__Ptr_Is_64)
#define EA_PLATFORM_PTR_SIZE 8
#elif defined(__CC_ARM) && (__sizeof_ptr == 8)
#define EA_PLATFORM_PTR_SIZE 8
#else
#define EA_PLATFORM_PTR_SIZE 4
#endif
#endif
// EA_PLATFORM_WORD_SIZE
// This defines the size of a machine word. This will be the same as
// the size of registers on the machine but not necessarily the same
// as the size of pointers on the machine. A number of 64 bit platforms
// have 64 bit registers but 32 bit pointers.
//
#ifndef EA_PLATFORM_WORD_SIZE
#define EA_PLATFORM_WORD_SIZE EA_PLATFORM_PTR_SIZE
#endif
// EA_PLATFORM_MIN_MALLOC_ALIGNMENT
// This defines the minimal alignment that the platform's malloc
// implementation will return. This should be used when writing custom
// allocators to ensure that the alignment matches that of malloc
#ifndef EA_PLATFORM_MIN_MALLOC_ALIGNMENT
#if defined(EA_PLATFORM_APPLE)
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 16
#elif defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_ARM)
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 8
#elif defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_X86_64)
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 8
#else
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT (EA_PLATFORM_PTR_SIZE * 2)
#endif
#endif
// EA_MISALIGNED_SUPPORT_LEVEL
// Specifies if the processor can read and write built-in types that aren't
// naturally aligned.
// 0 - not supported. Likely causes an exception.
// 1 - supported but slow.
// 2 - supported and fast.
//
#ifndef EA_MISALIGNED_SUPPORT_LEVEL
#if defined(EA_PROCESSOR_X86_64)
#define EA_MISALIGNED_SUPPORT_LEVEL 2
#else
#define EA_MISALIGNED_SUPPORT_LEVEL 0
#endif
#endif
// Macro to determine if a Windows API partition is enabled. Always false on non Microsoft platforms.
#if !defined(EA_WINAPI_FAMILY_PARTITION)
#define EA_WINAPI_FAMILY_PARTITION(Partition) (0)
#endif
// EA_CACHE_LINE_SIZE
// Specifies the cache line size broken down by compile target.
// This the expected best guess values for the targets that we can make at compilation time.
#ifndef EA_CACHE_LINE_SIZE
#if defined(EA_PROCESSOR_X86)
#define EA_CACHE_LINE_SIZE 32 // This is the minimum possible value.
#elif defined(EA_PROCESSOR_X86_64)
#define EA_CACHE_LINE_SIZE 64 // This is the minimum possible value
#elif defined(EA_PROCESSOR_ARM32)
#define EA_CACHE_LINE_SIZE 32 // This varies between implementations and is usually 32 or 64.
#elif defined(EA_PROCESSOR_ARM64)
#define EA_CACHE_LINE_SIZE 64 // Cache line Cortex-A8 (64 bytes) http://shervinemami.info/armAssembly.html however this remains to be mostly an assumption at this stage
#elif (EA_PLATFORM_WORD_SIZE == 4)
#define EA_CACHE_LINE_SIZE 32 // This is the minimum possible value
#else
#define EA_CACHE_LINE_SIZE 64 // This is the minimum possible value
#endif
#endif
#endif // INCLUDED_eaplatform_H

View File

@@ -0,0 +1,985 @@
/*-----------------------------------------------------------------------------
* eabase.h
*
* Copyright (c) Electronic Arts Inc. All rights reserved.
*---------------------------------------------------------------------------*/
#ifndef INCLUDED_eabase_H
#define INCLUDED_eabase_H
// Identify the compiler and declare the EA_COMPILER_xxxx defines
#include <EABase/config/eacompiler.h>
// Identify traits which this compiler supports, or does not support
#include <EABase/config/eacompilertraits.h>
// Identify the platform and declare the EA_xxxx defines
#include <EABase/config/eaplatform.h>
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result.
#endif
// Always include version.h for backwards compatibility.
#include <EABase/version.h>
// Define common SI unit macros
#include <EABase/eaunits.h>
// ------------------------------------------------------------------------
// The C++ standard defines size_t as a built-in type. Some compilers are
// not standards-compliant in this respect, so we need an additional include.
// The case is similar with wchar_t under C++.
#if defined(EA_COMPILER_GNUC) || defined(EA_COMPILER_MSVC) || defined(EA_WCHAR_T_NON_NATIVE) || defined(EA_PLATFORM_KETTLE)
#if defined(EA_COMPILER_MSVC)
#pragma warning(push, 0)
#pragma warning(disable: 4265 4365 4836 4574)
#endif
#include <stddef.h>
#if defined(EA_COMPILER_MSVC)
#pragma warning(pop)
#endif
#endif
// ------------------------------------------------------------------------
// Include stddef.h on Apple's clang compiler to ensure the ptrdiff_t type
// is defined.
#if defined(EA_COMPILER_CLANG) && defined(EA_PLATFORM_APPLE)
#include <stddef.h>
#endif
// ------------------------------------------------------------------------
// Include assert.h on C11 supported compilers so we may allow static_assert usage
// http://en.cppreference.com/w/c/error/static_assert
// C11 standard(ISO / IEC 9899:2011) :
// 7.2/3 Diagnostics <assert.h>(p : 186)
#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201100L
#include <assert.h>
#endif
// ------------------------------------------------------------------------
// By default, GCC defines NULL as ((void*)0), which is the
// C definition. This causes all sort of problems for C++ code, so it is
// worked around by undefining NULL.
#if defined(NULL)
#undef NULL
#endif
// ------------------------------------------------------------------------
// Define the NULL pointer. This is normally defined in <stddef.h>, but we
// don't want to force a global dependency on that header, so the definition
// is duplicated here.
#if defined(__cplusplus)
#define NULL 0
#else
#define NULL ((void*)0)
#endif
// ------------------------------------------------------------------------
// C98/99 Standard typedefs. From the ANSI ISO/IEC 9899 standards document
// Most recent versions of the gcc-compiler come with these defined in
// inttypes.h or stddef.h. Determining if they are predefined can be
// tricky, so we expect some problems on non-standard compilers
//#if (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && !defined(PRId64)
// #error "<inttypes.h> was #included before eabase.h, but without __STDC_FORMAT_MACROS #defined. You must #include eabase.h or an equivalent before #including C99 headers, or you must define __STDC_FORMAT_MACRO before #including system headrs."
//#endif
// ------------------------------------------------------------------------
// We need to test this after we potentially include stddef.h, otherwise we
// would have put this into the compilertraits header.
#if !defined(EA_COMPILER_HAS_INTTYPES) && (!defined(_MSC_VER) || (_MSC_VER > 1500)) && (defined(EA_COMPILER_IS_C99) || defined(INT8_MIN) || defined(EA_COMPILER_HAS_C99_TYPES) || defined(_SN_STDINT_H))
#define EA_COMPILER_HAS_INTTYPES
#endif
#ifdef EA_COMPILER_HAS_INTTYPES // If the compiler supports inttypes...
// ------------------------------------------------------------------------
// Include the stdint header to define and derive the required types.
// Additionally include inttypes.h as many compilers, including variations
// of GCC define things in inttypes.h that the C99 standard says goes
// in stdint.h.
//
// The C99 standard specifies that inttypes.h only define printf/scanf
// format macros if __STDC_FORMAT_MACROS is defined before #including
// inttypes.h. For consistency, we do that here.
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
// The GCC PSP compiler defines standard int types (e.g. uint32_t) but not PRId8, etc.
// MSVC added support for inttypes.h header in VS2013.
#if !defined(EA_COMPILER_MSVC) || (defined(EA_COMPILER_MSVC) && EA_COMPILER_VERSION >= 1800)
#include <inttypes.h> // PRId8, SCNd8, etc.
#endif
#if defined(_MSC_VER)
#pragma warning(push, 0)
#endif
#include <stdint.h> // int32_t, INT64_C, UINT8_MAX, etc.
#include <math.h> // float_t, double_t, etc.
#include <float.h> // FLT_EVAL_METHOD.
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#if !defined(FLT_EVAL_METHOD) && (defined(__FLT_EVAL_METHOD__) || defined(_FEVAL)) // GCC 3.x defines __FLT_EVAL_METHOD__ instead of the C99 standard FLT_EVAL_METHOD.
#ifdef __FLT_EVAL_METHOD__
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#else
#define FLT_EVAL_METHOD _FEVAL
#endif
#endif
// MinGW GCC (up to at least v4.3.0-20080502) mistakenly neglects to define float_t and double_t.
// This appears to be an acknowledged bug as of March 2008 and is scheduled to be fixed.
// Similarly, Android uses a mix of custom standard library headers which prior to SDK API level 21
// don't define float_t and double_t.
#if defined(__MINGW32__) || (defined(EA_PLATFORM_ANDROID) && !(defined(EA_ANDROID_SDK_LEVEL) && EA_ANDROID_SDK_LEVEL >= 21))
#if defined(__FLT_EVAL_METHOD__)
#if(__FLT_EVAL_METHOD__== 0)
typedef float float_t;
typedef double double_t;
#elif(__FLT_EVAL_METHOD__ == 1)
typedef double float_t;
typedef double double_t;
#elif(__FLT_EVAL_METHOD__ == 2)
typedef long double float_t;
typedef long double double_t;
#endif
#else
typedef float float_t;
typedef double double_t;
#endif
#endif
// The CodeSourcery definitions of PRIxPTR and SCNxPTR are broken for 32 bit systems.
#if defined(__SIZEOF_SIZE_T__) && (__SIZEOF_SIZE_T__ == 4) && (defined(__have_long64) || defined(__have_longlong64))
#undef PRIdPTR
#define PRIdPTR "d"
#undef PRIiPTR
#define PRIiPTR "i"
#undef PRIoPTR
#define PRIoPTR "o"
#undef PRIuPTR
#define PRIuPTR "u"
#undef PRIxPTR
#define PRIxPTR "x"
#undef PRIXPTR
#define PRIXPTR "X"
#undef SCNdPTR
#define SCNdPTR "d"
#undef SCNiPTR
#define SCNiPTR "i"
#undef SCNoPTR
#define SCNoPTR "o"
#undef SCNuPTR
#define SCNuPTR "u"
#undef SCNxPTR
#define SCNxPTR "x"
#endif
#else // else we must implement types ourselves.
#if !defined(__BIT_TYPES_DEFINED__) && !defined(__int8_t_defined)
typedef signed char int8_t; //< 8 bit signed integer
#endif
#if !defined( __int8_t_defined )
typedef signed short int16_t; //< 16 bit signed integer
typedef signed int int32_t; //< 32 bit signed integer. This works for both 32 bit and 64 bit platforms, as we assume the LP64 is followed.
#define __int8_t_defined
#endif
typedef unsigned char uint8_t; //< 8 bit unsigned integer
typedef unsigned short uint16_t; //< 16 bit unsigned integer
#if !defined( __uint32_t_defined )
typedef unsigned int uint32_t; //< 32 bit unsigned integer. This works for both 32 bit and 64 bit platforms, as we assume the LP64 is followed.
#define __uint32_t_defined
#endif
// According to the C98/99 standard, FLT_EVAL_METHOD defines control the
// width used for floating point _t types.
#if defined(_MSC_VER) && _MSC_VER >= 1800
// MSVC's math.h provides float_t, double_t under this condition.
#elif defined(FLT_EVAL_METHOD)
#if (FLT_EVAL_METHOD == 0)
typedef float float_t;
typedef double double_t;
#elif (FLT_EVAL_METHOD == 1)
typedef double float_t;
typedef double double_t;
#elif (FLT_EVAL_METHOD == 2)
typedef long double float_t;
typedef long double double_t;
#endif
#endif
#if defined(EA_COMPILER_MSVC) || defined(EA_COMPILER_BORLAND)
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
#endif
#endif
// ------------------------------------------------------------------------
// macros for declaring constants in a portable way.
//
// e.g. int64_t x = INT64_C(1234567812345678);
// e.g. int64_t x = INT64_C(0x1111111122222222);
// e.g. uint64_t x = UINT64_C(0x1111111122222222);
//
// Microsoft VC++'s definitions of INT8_C/UINT8_C/INT16_C/UINT16_C are like so:
// #define INT8_C(x) (x)
// #define INT16_C(x) (x)
// #define UINT8_C(x) (x)
// #define UINT16_C(x) (x)
// To consider: undefine Microsoft's and use the casting versions below.
// ------------------------------------------------------------------------
#ifndef INT8_C_DEFINED // If the user hasn't already defined these...
#define INT8_C_DEFINED
// VC++ 7.0 and earlier don't handle the LL suffix.
#if defined(EA_COMPILER_MSVC) || defined(EA_COMPILER_BORLAND)
#ifndef INT8_C
#define INT8_C(x) int8_t(x) // x##i8 doesn't work satisfactorilly because -128i8 generates an out of range warning.
#endif
#ifndef UINT8_C
#define UINT8_C(x) uint8_t(x)
#endif
#ifndef INT16_C
#define INT16_C(x) int16_t(x) // x##i16 doesn't work satisfactorilly because -32768i8 generates an out of range warning.
#endif
#ifndef UINT16_C
#define UINT16_C(x) uint16_t(x)
#endif
#ifndef INT32_C
#define INT32_C(x) x##i32
#endif
#ifndef UINT32_C
#define UINT32_C(x) x##ui32
#endif
#ifndef INT64_C
#define INT64_C(x) x##i64
#endif
#ifndef UINT64_C
#define UINT64_C(x) x##ui64
#endif
#else
#ifndef INT8_C
#define INT8_C(x) int8_t(x) // For the majority of compilers and platforms, long is 32 bits and long long is 64 bits.
#endif
#ifndef UINT8_C
#define UINT8_C(x) uint8_t(x)
#endif
#ifndef INT16_C
#define INT16_C(x) int16_t(x)
#endif
#ifndef UINT16_C
#define UINT16_C(x) uint16_t(x) // Possibly we should make this be uint16_t(x##u). Let's see how compilers react before changing this.
#endif
#ifndef INT32_C
#define INT32_C(x) x##L
#endif
#ifndef UINT32_C
#define UINT32_C(x) x##UL
#endif
#ifndef INT64_C
#define INT64_C(x) x##LL // The way to deal with this is to compare ULONG_MAX to 0xffffffff and if not equal, then remove the L.
#endif
#ifndef UINT64_C
#define UINT64_C(x) x##ULL // We need to follow a similar approach for LL.
#endif
#endif
#endif
// ------------------------------------------------------------------------
// type sizes
#ifndef INT8_MAX_DEFINED // If the user hasn't already defined these...
#define INT8_MAX_DEFINED
// The value must be 2^(n-1)-1
#ifndef INT8_MAX
#define INT8_MAX 127
#endif
#ifndef INT16_MAX
#define INT16_MAX 32767
#endif
#ifndef INT32_MAX
#define INT32_MAX 2147483647
#endif
#ifndef INT64_MAX
#define INT64_MAX INT64_C(9223372036854775807)
#endif
// The value must be either -2^(n-1) or 1-2(n-1).
#ifndef INT8_MIN
#define INT8_MIN -128
#endif
#ifndef INT16_MIN
#define INT16_MIN -32768
#endif
#ifndef INT32_MIN
#define INT32_MIN (-INT32_MAX - 1) // -2147483648
#endif
#ifndef INT64_MIN
#define INT64_MIN (-INT64_MAX - 1) // -9223372036854775808
#endif
// The value must be 2^n-1
#ifndef UINT8_MAX
#define UINT8_MAX 0xffU // 255
#endif
#ifndef UINT16_MAX
#define UINT16_MAX 0xffffU // 65535
#endif
#ifndef UINT32_MAX
#define UINT32_MAX UINT32_C(0xffffffff) // 4294967295
#endif
#ifndef UINT64_MAX
#define UINT64_MAX UINT64_C(0xffffffffffffffff) // 18446744073709551615
#endif
#endif
#ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD 0
typedef float float_t;
typedef double double_t;
#endif
#if defined(EA_COMPILER_HAS_INTTYPES) && (!defined(EA_COMPILER_MSVC) || (defined(EA_COMPILER_MSVC) && EA_COMPILER_VERSION >= 1800))
#define EA_COMPILER_HAS_C99_FORMAT_MACROS
#endif
#ifndef EA_COMPILER_HAS_C99_FORMAT_MACROS
// ------------------------------------------------------------------------
// sized printf and scanf format specifiers
// See the C99 standard, section 7.8.1 -- Macros for format specifiers.
//
// The C99 standard specifies that inttypes.h only define printf/scanf
// format macros if __STDC_FORMAT_MACROS is defined before #including
// inttypes.h. For consistency, we define both __STDC_FORMAT_MACROS and
// the printf format specifiers here. We also skip the "least/most"
// variations of these specifiers, as we've decided to do so with
// basic types.
//
// For 64 bit systems, we assume the LP64 standard is followed
// (as opposed to ILP64, etc.) For 32 bit systems, we assume the
// ILP32 standard is followed. See:
// http://www.opengroup.org/public/tech/aspen/lp64_wp.htm
// for information about this. Thus, on both 32 and 64 bit platforms,
// %l refers to 32 bit data while %ll refers to 64 bit data.
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#if defined(EA_COMPILER_MSVC) || defined(EA_COMPILER_BORLAND) // VC++ 7.1+ understands long long as a data type but doesn't accept %ll as a printf specifier.
#define EA_PRI_64_LENGTH_SPECIFIER "I64"
#define EA_SCN_64_LENGTH_SPECIFIER "I64"
#else
#define EA_PRI_64_LENGTH_SPECIFIER "ll"
#define EA_SCN_64_LENGTH_SPECIFIER "ll"
#endif // It turns out that some platforms use %q to represent a 64 bit value, but these are not relevant to us at this time.
// Printf format specifiers
#if defined(EA_COMPILER_IS_C99) || defined(EA_COMPILER_GNUC)
#define PRId8 "hhd"
#define PRIi8 "hhi"
#define PRIo8 "hho"
#define PRIu8 "hhu"
#define PRIx8 "hhx"
#define PRIX8 "hhX"
#else // VC++, Borland, etc. which have no way to specify 8 bit values other than %c.
#define PRId8 "c" // This may not work properly but it at least will not crash. Try using 16 bit versions instead.
#define PRIi8 "c" // "
#define PRIo8 "o" // "
#define PRIu8 "u" // "
#define PRIx8 "x" // "
#define PRIX8 "X" // "
#endif
#define PRId16 "hd"
#define PRIi16 "hi"
#define PRIo16 "ho"
#define PRIu16 "hu"
#define PRIx16 "hx"
#define PRIX16 "hX"
#define PRId32 "d" // This works for both 32 bit and 64 bit systems, as we assume LP64 conventions.
#define PRIi32 "i"
#define PRIo32 "o"
#define PRIu32 "u"
#define PRIx32 "x"
#define PRIX32 "X"
#define PRId64 EA_PRI_64_LENGTH_SPECIFIER "d"
#define PRIi64 EA_PRI_64_LENGTH_SPECIFIER "i"
#define PRIo64 EA_PRI_64_LENGTH_SPECIFIER "o"
#define PRIu64 EA_PRI_64_LENGTH_SPECIFIER "u"
#define PRIx64 EA_PRI_64_LENGTH_SPECIFIER "x"
#define PRIX64 EA_PRI_64_LENGTH_SPECIFIER "X"
#if (EA_PLATFORM_PTR_SIZE == 4)
#define PRIdPTR PRId32 // Usage of pointer values will generate warnings with
#define PRIiPTR PRIi32 // some compilers because they are defined in terms of
#define PRIoPTR PRIo32 // integers. However, you can't simply use "p" because
#define PRIuPTR PRIu32 // 'p' is interpreted in a specific and often different
#define PRIxPTR PRIx32 // way by the library.
#define PRIXPTR PRIX32
#elif (EA_PLATFORM_PTR_SIZE == 8)
#define PRIdPTR PRId64
#define PRIiPTR PRIi64
#define PRIoPTR PRIo64
#define PRIuPTR PRIu64
#define PRIxPTR PRIx64
#define PRIXPTR PRIX64
#endif
// Scanf format specifiers
#if defined(EA_COMPILER_IS_C99) || defined(EA_COMPILER_GNUC)
#define SCNd8 "hhd"
#define SCNi8 "hhi"
#define SCNo8 "hho"
#define SCNu8 "hhu"
#define SCNx8 "hhx"
#else // VC++, Borland, etc. which have no way to specify 8 bit values other than %c.
#define SCNd8 "c" // This will not work properly but it at least will not crash. Try using 16 bit versions instead.
#define SCNi8 "c" // "
#define SCNo8 "c" // "
#define SCNu8 "c" // "
#define SCNx8 "c" // "
#endif
#define SCNd16 "hd"
#define SCNi16 "hi"
#define SCNo16 "ho"
#define SCNu16 "hu"
#define SCNx16 "hx"
#define SCNd32 "d" // This works for both 32 bit and 64 bit systems, as we assume LP64 conventions.
#define SCNi32 "i"
#define SCNo32 "o"
#define SCNu32 "u"
#define SCNx32 "x"
#define SCNd64 EA_SCN_64_LENGTH_SPECIFIER "d"
#define SCNi64 EA_SCN_64_LENGTH_SPECIFIER "i"
#define SCNo64 EA_SCN_64_LENGTH_SPECIFIER "o"
#define SCNu64 EA_SCN_64_LENGTH_SPECIFIER "u"
#define SCNx64 EA_SCN_64_LENGTH_SPECIFIER "x"
#if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1900)
#define SCNdPTR PRIdPTR
#define SCNiPTR PRIiPTR
#define SCNoPTR PRIoPTR
#define SCNuPTR PRIuPTR
#define SCNxPTR PRIxPTR
#elif (EA_PLATFORM_PTR_SIZE == 4)
#define SCNdPTR SCNd32 // Usage of pointer values will generate warnings with
#define SCNiPTR SCNi32 // some compilers because they are defined in terms of
#define SCNoPTR SCNo32 // integers. However, you can't simply use "p" because
#define SCNuPTR SCNu32 // 'p' is interpreted in a specific and often different
#define SCNxPTR SCNx32 // way by the library.
#elif (EA_PLATFORM_PTR_SIZE == 8)
#define SCNdPTR SCNd64
#define SCNiPTR SCNi64
#define SCNoPTR SCNo64
#define SCNuPTR SCNu64
#define SCNxPTR SCNx64
#endif
#endif
// ------------------------------------------------------------------------
// bool8_t
// The definition of a bool8_t is controversial with some, as it doesn't
// act just like built-in bool. For example, you can assign -100 to it.
//
#ifndef BOOL8_T_DEFINED // If the user hasn't already defined this...
#define BOOL8_T_DEFINED
#if defined(EA_COMPILER_MSVC) || (defined(EA_COMPILER_INTEL) && defined(EA_PLATFORM_WINDOWS)) || defined(EA_COMPILER_BORLAND)
#if defined(__cplusplus)
typedef bool bool8_t;
#else
typedef int8_t bool8_t;
#endif
#else // EA_COMPILER_GNUC generally uses 4 bytes per bool.
typedef int8_t bool8_t;
#endif
#endif
// ------------------------------------------------------------------------
// intptr_t / uintptr_t
// Integer type guaranteed to be big enough to hold
// a native pointer ( intptr_t is defined in STDDEF.H )
//
#if !defined(_INTPTR_T_DEFINED) && !defined(_intptr_t_defined) && !defined(EA_COMPILER_HAS_C99_TYPES)
#if (EA_PLATFORM_PTR_SIZE == 4)
typedef int32_t intptr_t;
#elif (EA_PLATFORM_PTR_SIZE == 8)
typedef int64_t intptr_t;
#endif
#define _intptr_t_defined
#define _INTPTR_T_DEFINED
#endif
#if !defined(_UINTPTR_T_DEFINED) && !defined(_uintptr_t_defined) && !defined(EA_COMPILER_HAS_C99_TYPES)
#if (EA_PLATFORM_PTR_SIZE == 4)
typedef uint32_t uintptr_t;
#elif (EA_PLATFORM_PTR_SIZE == 8)
typedef uint64_t uintptr_t;
#endif
#define _uintptr_t_defined
#define _UINTPTR_T_DEFINED
#endif
#if !defined(EA_COMPILER_HAS_INTTYPES)
#ifndef INTMAX_T_DEFINED
#define INTMAX_T_DEFINED
// At this time, all supported compilers have int64_t as the max
// integer type. Some compilers support a 128 bit integer type,
// but in some cases it is not a true int128_t but rather a
// crippled data type. Also, it turns out that Unix 64 bit ABIs
// require that intmax_t be int64_t and nothing larger. So we
// play it safe here and set intmax_t to int64_t, even though
// an int128_t type may exist.
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
#endif
#endif
// ------------------------------------------------------------------------
// ssize_t
// signed equivalent to size_t.
// This is defined by GCC (except the QNX implementation of GCC) but not by other compilers.
//
#if !defined(__GNUC__)
// As of this writing, all non-GCC compilers significant to us implement
// uintptr_t the same as size_t. However, this isn't guaranteed to be
// so for all compilers, as size_t may be based on int, long, or long long.
#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
#define _SSIZE_T_
#define _SSIZE_T_DEFINED
#if defined(_MSC_VER) && (EA_PLATFORM_PTR_SIZE == 8)
typedef __int64 ssize_t;
#else
typedef long ssize_t;
#endif
#endif
#else
#include <sys/types.h>
#endif
// ------------------------------------------------------------------------
// Character types
//
#if defined(EA_COMPILER_MSVC) || defined(EA_COMPILER_BORLAND)
#if defined(EA_WCHAR_T_NON_NATIVE)
// In this case, wchar_t is not defined unless we include
// wchar.h or if the compiler makes it built-in.
#ifdef EA_COMPILER_MSVC
#pragma warning(push, 3)
#endif
#include <wchar.h>
#ifdef EA_COMPILER_MSVC
#pragma warning(pop)
#endif
#endif
#endif
// ------------------------------------------------------------------------
// char8_t -- Guaranteed to be equal to the compiler's char data type.
// Some compilers implement char8_t as unsigned, though char
// is usually set to be signed.
//
// char16_t -- This is set to be an unsigned 16 bit value. If the compiler
// has wchar_t as an unsigned 16 bit value, then char16_t is
// set to be the same thing as wchar_t in order to allow the
// user to use char16_t with standard wchar_t functions.
//
// char32_t -- This is set to be an unsigned 32 bit value. If the compiler
// has wchar_t as an unsigned 32 bit value, then char32_t is
// set to be the same thing as wchar_t in order to allow the
// user to use char32_t with standard wchar_t functions.
//
// EA_CHAR16_NATIVE
// EA_CHAR32_NATIVE
// EA_WCHAR_UNIQUE
//
// VS2010 unilaterally defines char16_t and char32_t in its yvals.h header
// unless _HAS_CHAR16_T_LANGUAGE_SUPPORT or _CHAR16T are defined.
// However, VS2010 does not support the C++0x u"" and U"" string literals,
// which makes its definition of char16_t and char32_t somewhat useless.
// Until VC++ supports string literals, the build system should define
// _CHAR16T and let EABase define char16_t and EA_CHAR16.
//
// GCC defines char16_t and char32_t in the C compiler in -std=gnu99 mode,
// as __CHAR16_TYPE__ and __CHAR32_TYPE__, and for the C++ compiler
// in -std=c++0x and -std=gnu++0x modes, as char16_t and char32_t too.
//
// The EA_WCHAR_UNIQUE symbol is defined to 1 if wchar_t is distinct from
// char8_t, char16_t, and char32_t, and defined to 0 if not. In some cases,
// if the compiler does not support char16_t/char32_t, one of these two types
// is typically a typedef or define of wchar_t. For compilers that support
// the C++11 unicode character types often overloads must be provided to
// support existing code that passes a wide char string to a function that
// takes a unicode string.
#if !defined(EA_CHAR16_NATIVE)
// To do: Change this to be based on EA_COMPILER_NO_NEW_CHARACTER_TYPES.
#if defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT // VS2010+
#define EA_CHAR16_NATIVE 1
#elif defined(EA_COMPILER_CLANG) && defined(EA_COMPILER_CPP11_ENABLED)
#if __has_feature(cxx_unicode_literals)
#define EA_CHAR16_NATIVE 1
#elif (EA_COMPILER_VERSION >= 300) && !(defined(EA_PLATFORM_IPHONE) || defined(EA_PLATFORM_OSX))
#define EA_CHAR16_NATIVE 1
#elif defined(EA_PLATFORM_APPLE)
#define EA_CHAR16_NATIVE 1
#else
#define EA_CHAR16_NATIVE 0
#endif
#elif defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 404) && defined(__CHAR16_TYPE__) && defined(EA_COMPILER_CPP11_ENABLED)// EDG 4.4+.
#define EA_CHAR16_NATIVE 1
#elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) && !defined(EA_COMPILER_EDG) && (defined(EA_COMPILER_CPP11_ENABLED) || defined(__STDC_VERSION__)) // g++ (C++ compiler) 4.4+ with -std=c++0x or gcc (C compiler) 4.4+ with -std=gnu99
#define EA_CHAR16_NATIVE 1
#else
#define EA_CHAR16_NATIVE 0
#endif
#endif
#if !defined(EA_CHAR32_NATIVE) // Microsoft currently ties char32_t language support to char16_t language support. So we use CHAR16_T here.
// To do: Change this to be based on EA_COMPILER_NO_NEW_CHARACTER_TYPES.
#if defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT // VS2010+
#define EA_CHAR32_NATIVE 1
#elif defined(EA_COMPILER_CLANG) && defined(EA_COMPILER_CPP11_ENABLED)
#if __has_feature(cxx_unicode_literals)
#define EA_CHAR32_NATIVE 1
#elif (EA_COMPILER_VERSION >= 300) && !(defined(EA_PLATFORM_IPHONE) || defined(EA_PLATFORM_OSX))
#define EA_CHAR32_NATIVE 1
#elif defined(EA_PLATFORM_APPLE)
#define EA_CHAR32_NATIVE 1
#else
#define EA_CHAR32_NATIVE 0
#endif
#elif defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 404) && defined(__CHAR32_TYPE__) && defined(EA_COMPILER_CPP11_ENABLED)// EDG 4.4+.
#define EA_CHAR32_NATIVE 1
#elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) && !defined(EA_COMPILER_EDG) && (defined(EA_COMPILER_CPP11_ENABLED) || defined(__STDC_VERSION__)) // g++ (C++ compiler) 4.4+ with -std=c++0x or gcc (C compiler) 4.4+ with -std=gnu99
#define EA_CHAR32_NATIVE 1
#else
#define EA_CHAR32_NATIVE 0
#endif
#endif
#if EA_CHAR16_NATIVE || EA_CHAR32_NATIVE
#define EA_WCHAR_UNIQUE 1
#else
#define EA_WCHAR_UNIQUE 0
#endif
// Feature check for native char8_t support. Currently only enabled
// in Clang since r346892 when -std=c++2a is specified.
#if defined(__cpp_char8_t)
#define CHAR8_T_DEFINED
#endif
#ifndef CHAR8_T_DEFINED // If the user hasn't already defined these...
#define CHAR8_T_DEFINED
#if defined(EA_PLATFORM_APPLE)
#define char8_t char // The Apple debugger is too stupid to realize char8_t is typedef'd to char, so we #define it.
#else
typedef char char8_t;
#endif
#if EA_CHAR16_NATIVE
// In C++, char16_t and char32_t are already defined by the compiler.
// In MS C, char16_t and char32_t are already defined by the compiler/standard library.
// In GCC C, __CHAR16_TYPE__ and __CHAR32_TYPE__ are defined instead, and we must define char16_t and char32_t from these.
#if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(__CHAR16_TYPE__) // If using GCC and compiling in C...
typedef __CHAR16_TYPE__ char16_t;
typedef __CHAR32_TYPE__ char32_t;
#endif
#elif (EA_WCHAR_SIZE == 2)
#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) // if VS2010+ or using platforms that use Dinkumware under a compiler that doesn't natively support C++11 char16_t.
#if !defined(_CHAR16T)
#define _CHAR16T
#endif
#if !defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) || !_HAS_CHAR16_T_LANGUAGE_SUPPORT
typedef wchar_t char16_t;
typedef uint32_t char32_t;
#endif
#else
typedef wchar_t char16_t;
typedef uint32_t char32_t;
#endif
#else
typedef uint16_t char16_t;
#if defined(__cplusplus)
typedef wchar_t char32_t;
#else
typedef uint32_t char32_t;
#endif
#endif
#endif
// CHAR8_MIN, CHAR8_MAX, etc.
//
#define EA_LIMITS_DIGITS_S(T) ((sizeof(T) * 8) - 1)
#define EA_LIMITS_DIGITS_U(T) ((sizeof(T) * 8))
#define EA_LIMITS_DIGITS(T) ((EA_LIMITS_IS_SIGNED(T) ? EA_LIMITS_DIGITS_S(T) : EA_LIMITS_DIGITS_U(T)))
#define EA_LIMITS_IS_SIGNED(T) ((T)(-1) < 0)
#define EA_LIMITS_MIN_S(T) ((T)((T)1 << EA_LIMITS_DIGITS_S(T)))
#define EA_LIMITS_MIN_U(T) ((T)0)
#define EA_LIMITS_MIN(T) ((EA_LIMITS_IS_SIGNED(T) ? EA_LIMITS_MIN_S(T) : EA_LIMITS_MIN_U(T)))
#define EA_LIMITS_MAX_S(T) ((T)(((((T)1 << (EA_LIMITS_DIGITS(T) - 1)) - 1) << 1) + 1))
#define EA_LIMITS_MAX_U(T) ((T)~(T)0)
#define EA_LIMITS_MAX(T) ((EA_LIMITS_IS_SIGNED(T) ? EA_LIMITS_MAX_S(T) : EA_LIMITS_MAX_U(T)))
#if !defined(CHAR8_MIN)
#define CHAR8_MIN EA_LIMITS_MIN(char8_t)
#endif
#if !defined(CHAR8_MAX)
#define CHAR8_MAX EA_LIMITS_MAX(char8_t)
#endif
#if !defined(CHAR16_MIN)
#define CHAR16_MIN EA_LIMITS_MIN(char16_t)
#endif
#if !defined(CHAR16_MAX)
#define CHAR16_MAX EA_LIMITS_MAX(char16_t)
#endif
#if !defined(CHAR32_MIN)
#define CHAR32_MIN EA_LIMITS_MIN(char32_t)
#endif
#if !defined(CHAR32_MAX)
#define CHAR32_MAX EA_LIMITS_MAX(char32_t)
#endif
// EA_CHAR8 / EA_CHAR16 / EA_CHAR32 / EA_WCHAR
//
// Supports usage of portable string constants.
//
// Example usage:
// const char16_t* str = EA_CHAR16("Hello world");
// const char32_t* str = EA_CHAR32("Hello world");
// const char16_t c = EA_CHAR16('\x3001');
// const char32_t c = EA_CHAR32('\x3001');
//
#ifndef EA_CHAR8
#define EA_CHAR8(s) s
#endif
#ifndef EA_WCHAR
#define EA_WCHAR_(s) L ## s
#define EA_WCHAR(s) EA_WCHAR_(s)
#endif
#ifndef EA_CHAR16
#if EA_CHAR16_NATIVE && !defined(_MSC_VER) // Microsoft doesn't support char16_t string literals.
#define EA_CHAR16_(s) u ## s
#define EA_CHAR16(s) EA_CHAR16_(s)
#elif (EA_WCHAR_SIZE == 2)
#if defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(__cplusplus) // VS2015 supports u"" string literals.
#define EA_CHAR16_(s) u ## s
#define EA_CHAR16(s) EA_CHAR16_(s)
#else
#define EA_CHAR16_(s) L ## s
#define EA_CHAR16(s) EA_CHAR16_(s)
#endif
#else
//#define EA_CHAR16(s) // Impossible to implement efficiently.
#endif
#endif
#ifndef EA_CHAR32
#if EA_CHAR32_NATIVE && !defined(_MSC_VER) // Microsoft doesn't support char32_t string literals.
#define EA_CHAR32_(s) U ## s
#define EA_CHAR32(s) EA_CHAR32_(s)
#elif (EA_WCHAR_SIZE == 2)
#if defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(__cplusplus) // VS2015 supports u"" string literals.
#define EA_CHAR32_(s) U ## s
#define EA_CHAR32(s) EA_CHAR32_(s)
#else
//#define EA_CHAR32(s) // Impossible to implement.
#endif
#elif (EA_WCHAR_SIZE == 4)
#define EA_CHAR32_(s) L ## s
#define EA_CHAR32(s) EA_CHAR32_(s)
#else
#error Unexpected size of wchar_t
#endif
#endif
// EAText8 / EAText16
//
// Provided for backwards compatibility with older code.
//
#if defined(EABASE_ENABLE_EATEXT_MACROS)
#define EAText8(x) x
#define EAChar8(x) x
#define EAText16(x) EA_CHAR16(x)
#define EAChar16(x) EA_CHAR16(x)
#endif
// ------------------------------------------------------------------------
// EAArrayCount
//
// Returns the count of items in a built-in C array. This is a common technique
// which is often used to help properly calculate the number of items in an
// array at runtime in order to prevent overruns, etc.
//
// Example usage:
// int array[75];
// size_t arrayCount = EAArrayCount(array); // arrayCount is 75.
//
#if defined(EA_COMPILER_NO_CONSTEXPR)
#ifndef EAArrayCount
#define EAArrayCount(x) (sizeof(x) / sizeof(x[0]))
#endif
#else
// This C++11 version is a little smarter than the macro version above;
// it can tell the difference between arrays and pointers. Other simpler
// templated versions have failed in various subtle ways.
template <typename T, size_t N>
char (&EAArraySizeHelper(T (&x)[N]))[N];
template <typename T, size_t N>
char (&EAArraySizeHelper(T (&&x)[N]))[N];
#define EAArrayCount(x) (sizeof(EAArraySizeHelper(x)))
#endif
// ------------------------------------------------------------------------
// static_assert
//
// C++11 static_assert (a.k.a. compile-time assert).
//
// Specification:
// void static_assert(bool const_expression, const char* description);
//
// Example usage:
// static_assert(sizeof(int) == 4, "int must be 32 bits");
//
#if defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(__cplusplus)
// static_assert is defined by the compiler for both C and C++.
#elif !defined(__cplusplus) && defined(EA_PLATFORM_ANDROID)
// AndroidNDK does not support static_assert despite claiming it's a C11 compiler
#define NEED_CUSTOM_STATIC_ASSERT
#elif defined(__clang__) && defined(__cplusplus)
// We need to separate these checks on a new line, as the pre-processor on other compilers will fail on the _has_feature macros
#if !(__has_feature(cxx_static_assert) || __has_extension(cxx_static_assert))
#define NEED_CUSTOM_STATIC_ASSERT
#endif
#elif defined(__GNUC__) && (defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && (__cplusplus >= 201103L)))
// static_assert is defined by the compiler.
#elif defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) && defined(EA_COMPILER_CPP11_ENABLED)
// static_assert is defined by the compiler.
#elif !defined(__cplusplus) && defined(__GLIBC__) && defined(__USE_ISOC11)
// static_assert is defined by the compiler.
#elif !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201100L
// static_assert is defined by the compiler.
#else
#define NEED_CUSTOM_STATIC_ASSERT
#endif
#ifdef NEED_CUSTOM_STATIC_ASSERT
#ifdef __GNUC__
// On GCC the 'unused' attribute can be used to indicate a typedef is not actually used
// (such as in the static_assert implementation below). New versions of GCC generate
// warnings for unused typedefs in function/method scopes.
#define EA_STATIC_ASSERT_UNUSED_ATTRIBUTE __attribute__((unused))
#else
#define EA_STATIC_ASSERT_UNUSED_ATTRIBUTE
#endif
#define EA_STATIC_ASSERT_TOKEN_PASTE(a,b) a ## b
#define EA_STATIC_ASSERT_CONCATENATE_HELPER(a,b) EA_STATIC_ASSERT_TOKEN_PASTE(a,b)
#if defined(__COUNTER__) // If this extension is available, which allows multiple statements per line...
#define static_assert(expression, description) typedef char EA_STATIC_ASSERT_CONCATENATE_HELPER(compileTimeAssert,__COUNTER__) [((expression) != 0) ? 1 : -1] EA_STATIC_ASSERT_UNUSED_ATTRIBUTE
#else
#define static_assert(expression, description) typedef char EA_STATIC_ASSERT_CONCATENATE_HELPER(compileTimeAssert,__LINE__) [((expression) != 0) ? 1 : -1] EA_STATIC_ASSERT_UNUSED_ATTRIBUTE
#endif
#undef NEED_CUSTOM_STATIC_ASSERT
#endif
// ------------------------------------------------------------------------
// EA_IS_ENABLED
//
// EA_IS_ENABLED is intended to be used for detecting if compile time features are enabled or disabled.
//
// It has some advantages over using a standard #if or #ifdef tests:
// 1) Fails to compile when passes numeric macro values. Valid options are strictly enabled or disabled.
// 2) Fails to compile when passed undefined macro values rather than disabling by default
// 3) Fails to compile when the passed macro is defined to but empty
//
// To use the macro, the calling code should create a define for the feature to enable or disable. This feature define
// must be set to either EA_ENABLED or EA_DISABLED. (Do not try to set the feature define directly to some other
// value.)
//
// Note: These macros are analogous to the Frostbite macro FB_USING used in combination with FB_OFF / FB_ON and are
// designed to be compatible to support gradual migration.
//
// Example usage:
//
// // The USER_PROVIDED_FEATURE_DEFINE should be defined as either
// // EA_ENABLED or EA_DISABLED.
// #define USER_PROVIDED_FEATURE_DEFINE EA_ENABLED
//
// #if EA_IS_ENABLED(USER_PROVIDED_FEATURE_DEFINE)
// // USER_PROVIDED_FEATURE_DEFINE is enabled
// #else
// // USER_PROVIDED_FEATURE_DEFINE is disabled
// #endif
//
#define EA_ENABLED 111-
#define EA_DISABLED 333-
// NOTE: Numeric values for x will produce a parse error while empty values produce a divide by zero, and the test is a bool for proper negation behavior
#define EA_IS_ENABLED(x) (333 == 333 * 111 / ((x 0) * (((x 0) == 333 ? 1 : 0) + ((x 0) == 111 ? 1 : 0))))
// Define int128_t / uint128_t types.
// NOTE(rparolin): include file at the end because we want all the signed integral types defined.
#ifdef __cplusplus
#include <EABase/int128.h>
#endif
#endif // Header include guard

View File

@@ -0,0 +1,877 @@
/*-----------------------------------------------------------------------------
* eahave.h
*
* Copyright (c) Electronic Arts Inc. All rights reserved.
*---------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
This file's functionality is preliminary and won't be considered stable until
a future EABase version.
*---------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
This header identifies if the given facilities are available in the
standard build environment the current compiler/linker/standard library/
operating system combination. This file may in some cases #include standard
headers in order to make availability determinations, such as to check
compiler or SDK version numbers. However, it cannot be perfect.
This header does not identify compiler features, as those are defined in
eacompiler.h and eacompilertraits.h. Rather this header is about library support.
This header does not identify platform or library conventions either, such
as whether the file paths use \ or / for directory separators.
We provide three types of HAVE features here:
- EA_HAVE_XXX_FEATURE - Have compiler feature.
Identifies if the compiler has or lacks some feature in the
current build. Sometimes you need to check to see if the
compiler is running in some mode in able to write portable code
against it. For example, some compilers (e.g. VC++) have a
mode in which all language extensions are disabled. If you want
to write code that works with that but still uses the extensions
when available then you can check #if defined(EA_HAVE_EXTENSIONS_FEATURE).
Features can be forcibly cancelled via EA_NO_HAVE_XXX_FEATURE.
EA_NO_HAVE is useful for a build system or user to override the
defaults because it happens to know better.
- EA_HAVE_XXX_H - Have header file information.
Identifies if a given header file is available to the current
compile configuration. For example, some compilers provide a
malloc.h header, while others don't. For the former we define
EA_HAVE_MALLOC_H, while for the latter it remains undefined.
If a header is missing then it may still be that the functions
the header usually declares are declared in some other header.
EA_HAVE_XXX does not include the possibility that our own code
provides versions of these headers, and in fact a purpose of
EA_HAVE_XXX is to decide if we should be using our own because
the system doesn't provide one.
Header availability can be forcibly cancelled via EA_NO_HAVE_XXX_H.
EA_NO_HAVE is useful for a build system or user to override the
defaults because it happens to know better.
- EA_HAVE_XXX_DECL - Have function declaration information.
Identifies if a given function declaration is provided by
the current compile configuration. For example, some compiler
standard libraries declare a wcslen function, while others
don't. For the former we define EA_HAVE_WCSLEN_DECL, while for
the latter it remains undefined. If a declaration of a function
is missing then we assume the implementation is missing as well.
EA_HAVE_XXX_DECL does not include the possibility that our
own code provides versions of these declarations, and in fact a
purpose of EA_HAVE_XXX_DECL is to decide if we should be using
our own because the system doesn't provide one.
Declaration availability can be forcibly cancelled via EA_NO_HAVE_XXX_DECL.
EA_NO_HAVE is useful for a build system or user to override the
defaults because it happens to know better.
- EA_HAVE_XXX_IMPL - Have function implementation information.
Identifies if a given function implementation is provided by
the current compile and link configuration. For example, it's
commonly the case that console platforms declare a getenv function
but don't provide a linkable implementation.
In this case the user needs to provide such a function manually
as part of the link. If the implementation is available then
we define EA_HAVE_GETENV_IMPL, otherwise it remains undefined.
Beware that sometimes a function may not seem to be present in
the Standard Library but in reality you need to link some auxiliary
provided library for it. An example of this is the Unix real-time
functions such as clock_gettime.
EA_HAVE_XXX_IMPL does not include the possibility that our
own code provides versions of these implementations, and in fact a
purpose of EA_HAVE_XXX_IMPL is to decide if we should be using
our own because the system doesn't provide one.
Implementation availability can be forcibly cancelled via EA_NO_HAVE_XXX_IMPL.
EA_NO_HAVE is useful for a build system or user to override the
defaults because it happens to know better.
It's not practical to define EA_HAVE macros for every possible header,
declaration, and implementation, and so the user must simply know that
some headers, declarations, and implementations tend to require EA_HAVE
checking. Nearly every C Standard Library we've seen has a <string.h>
header, a strlen declaration, and a linkable strlen implementation,
so there's no need to provide EA_HAVE support for this. On the other hand
it's commonly the case that the C Standard Library doesn't have a malloc.h
header or an inet_ntop declaration.
---------------------------------------------------------------------------*/
#ifndef INCLUDED_eahave_H
#define INCLUDED_eahave_H
#include <EABase/eabase.h>
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result.
#endif
/* EA_HAVE_XXX_FEATURE */
#if !defined(EA_HAVE_EXTENSIONS_FEATURE) && !defined(EA_NO_HAVE_EXTENSIONS_FEATURE)
#define EA_HAVE_EXTENSIONS_FEATURE 1
#endif
/* EA_HAVE_XXX_LIBRARY */
// Dinkumware
#if !defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && !defined(EA_NO_HAVE_DINKUMWARE_CPP_LIBRARY)
#if defined(__cplusplus)
EA_DISABLE_ALL_VC_WARNINGS()
#include <cstddef> // Need to trigger the compilation of yvals.h without directly using <yvals.h> because it might not exist.
EA_RESTORE_ALL_VC_WARNINGS()
#endif
#if defined(__cplusplus) && defined(_CPPLIB_VER) /* If using the Dinkumware Standard library... */
#define EA_HAVE_DINKUMWARE_CPP_LIBRARY 1
#else
#define EA_NO_HAVE_DINKUMWARE_CPP_LIBRARY 1
#endif
#endif
// GCC libstdc++
#if !defined(EA_HAVE_LIBSTDCPP_LIBRARY) && !defined(EA_NO_HAVE_LIBSTDCPP_LIBRARY)
#if defined(__GLIBCXX__) /* If using libstdc++ ... */
#define EA_HAVE_LIBSTDCPP_LIBRARY 1
#else
#define EA_NO_HAVE_LIBSTDCPP_LIBRARY 1
#endif
#endif
// Clang libc++
#if !defined(EA_HAVE_LIBCPP_LIBRARY) && !defined(EA_NO_HAVE_LIBCPP_LIBRARY)
#if defined(__clang__)
#if defined(__cplusplus) && __has_include(<__config>)
#define EA_HAVE_LIBCPP_LIBRARY 1 // We could also #include <ciso646> and check if defined(_LIBCPP_VERSION).
#endif
#endif
#if !defined(EA_HAVE_LIBCPP_LIBRARY)
#define EA_NO_HAVE_LIBCPP_LIBRARY 1
#endif
#endif
/* EA_HAVE_XXX_H */
// #include <sys/types.h>
#if !defined(EA_HAVE_SYS_TYPES_H) && !defined(EA_NO_HAVE_SYS_TYPES_H)
#define EA_HAVE_SYS_TYPES_H 1
#endif
// #include <io.h> (and not sys/io.h or asm/io.h)
#if !defined(EA_HAVE_IO_H) && !defined(EA_NO_HAVE_IO_H)
// Unix doesn't have Microsoft's <io.h> but has the same functionality in <fcntl.h> and <sys/stat.h>.
#if defined(EA_PLATFORM_MICROSOFT)
#define EA_HAVE_IO_H 1
#else
#define EA_NO_HAVE_IO_H 1
#endif
#endif
// #include <inttypes.h>
#if !defined(EA_HAVE_INTTYPES_H) && !defined(EA_NO_HAVE_INTTYPES_H)
#if !defined(EA_PLATFORM_MICROSOFT)
#define EA_HAVE_INTTYPES_H 1
#else
#define EA_NO_HAVE_INTTYPES_H 1
#endif
#endif
// #include <unistd.h>
#if !defined(EA_HAVE_UNISTD_H) && !defined(EA_NO_HAVE_UNISTD_H)
#if defined(EA_PLATFORM_UNIX)
#define EA_HAVE_UNISTD_H 1
#else
#define EA_NO_HAVE_UNISTD_H 1
#endif
#endif
// #include <sys/time.h>
#if !defined(EA_HAVE_SYS_TIME_H) && !defined(EA_NO_HAVE_SYS_TIME_H)
#if !defined(EA_PLATFORM_MICROSOFT) && !defined(_CPPLIB_VER) /* _CPPLIB_VER indicates Dinkumware. */
#define EA_HAVE_SYS_TIME_H 1 /* defines struct timeval */
#else
#define EA_NO_HAVE_SYS_TIME_H 1
#endif
#endif
// #include <ptrace.h>
#if !defined(EA_HAVE_SYS_PTRACE_H) && !defined(EA_NO_HAVE_SYS_PTRACE_H)
#if defined(EA_PLATFORM_UNIX) && !defined(__CYGWIN__) && (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_SERVER))
#define EA_HAVE_SYS_PTRACE_H 1 /* declares the ptrace function */
#else
#define EA_NO_HAVE_SYS_PTRACE_H 1
#endif
#endif
// #include <sys/stat.h>
#if !defined(EA_HAVE_SYS_STAT_H) && !defined(EA_NO_HAVE_SYS_STAT_H)
#if (defined(EA_PLATFORM_UNIX) && !(defined(EA_PLATFORM_SONY) && defined(EA_PLATFORM_CONSOLE))) || defined(__APPLE__) || defined(EA_PLATFORM_ANDROID)
#define EA_HAVE_SYS_STAT_H 1 /* declares the stat struct and function */
#else
#define EA_NO_HAVE_SYS_STAT_H 1
#endif
#endif
// #include <locale.h>
#if !defined(EA_HAVE_LOCALE_H) && !defined(EA_NO_HAVE_LOCALE_H)
#define EA_HAVE_LOCALE_H 1
#endif
// #include <signal.h>
#if !defined(EA_HAVE_SIGNAL_H) && !defined(EA_NO_HAVE_SIGNAL_H)
#if !defined(EA_PLATFORM_BSD) && !defined(EA_PLATFORM_SONY) && !defined(CS_UNDEFINED_STRING)
#define EA_HAVE_SIGNAL_H 1
#else
#define EA_NO_HAVE_SIGNAL_H 1
#endif
#endif
// #include <sys/signal.h>
#if !defined(EA_HAVE_SYS_SIGNAL_H) && !defined(EA_NO_HAVE_SYS_SIGNAL_H)
#if defined(EA_PLATFORM_BSD) || defined(EA_PLATFORM_KETTLE)
#define EA_HAVE_SYS_SIGNAL_H 1
#else
#define EA_NO_HAVE_SYS_SIGNAL_H 1
#endif
#endif
// #include <pthread.h>
#if !defined(EA_HAVE_PTHREAD_H) && !defined(EA_NO_HAVE_PTHREAD_H)
#if defined(EA_PLATFORM_UNIX) || defined(EA_PLATFORM_APPLE) || defined(EA_PLATFORM_POSIX)
#define EA_HAVE_PTHREAD_H 1 /* It can be had under Microsoft/Windows with the http://sourceware.org/pthreads-win32/ library */
#else
#define EA_NO_HAVE_PTHREAD_H 1
#endif
#endif
// #include <wchar.h>
#if !defined(EA_HAVE_WCHAR_H) && !defined(EA_NO_HAVE_WCHAR_H)
#if defined(EA_PLATFORM_DESKTOP) && defined(EA_PLATFORM_UNIX) && defined(EA_PLATFORM_SONY) && defined(EA_PLATFORM_APPLE)
#define EA_HAVE_WCHAR_H 1
#else
#define EA_NO_HAVE_WCHAR_H 1
#endif
#endif
// #include <malloc.h>
#if !defined(EA_HAVE_MALLOC_H) && !defined(EA_NO_HAVE_MALLOC_H)
#if defined(_MSC_VER) || defined(__MINGW32__)
#define EA_HAVE_MALLOC_H 1
#else
#define EA_NO_HAVE_MALLOC_H 1
#endif
#endif
// #include <alloca.h>
#if !defined(EA_HAVE_ALLOCA_H) && !defined(EA_NO_HAVE_ALLOCA_H)
#if !defined(EA_HAVE_MALLOC_H) && !defined(EA_PLATFORM_KETTLE)
#define EA_HAVE_ALLOCA_H 1
#else
#define EA_NO_HAVE_ALLOCA_H 1
#endif
#endif
// #include <execinfo.h>
#if !defined(EA_HAVE_EXECINFO_H) && !defined(EA_NO_HAVE_EXECINFO_H)
#if (defined(EA_PLATFORM_LINUX) || defined(EA_PLATFORM_OSX)) && !defined(EA_PLATFORM_ANDROID)
#define EA_HAVE_EXECINFO_H 1
#else
#define EA_NO_HAVE_EXECINFO_H 1
#endif
#endif
// #include <semaphore.h> (Unix semaphore support)
#if !defined(EA_HAVE_SEMAPHORE_H) && !defined(EA_NO_HAVE_SEMAPHORE_H)
#if defined(EA_PLATFORM_UNIX)
#define EA_HAVE_SEMAPHORE_H 1
#else
#define EA_NO_HAVE_SEMAPHORE_H 1
#endif
#endif
// #include <dirent.h> (Unix semaphore support)
#if !defined(EA_HAVE_DIRENT_H) && !defined(EA_NO_HAVE_DIRENT_H)
#if defined(EA_PLATFORM_UNIX) && !defined(EA_PLATFORM_CONSOLE)
#define EA_HAVE_DIRENT_H 1
#else
#define EA_NO_HAVE_DIRENT_H 1
#endif
#endif
// #include <array>, <forward_list>, <ununordered_set>, <unordered_map>
#if !defined(EA_HAVE_CPP11_CONTAINERS) && !defined(EA_NO_HAVE_CPP11_CONTAINERS)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
#define EA_HAVE_CPP11_CONTAINERS 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) // Actually GCC 4.3 supports array and unordered_
#define EA_HAVE_CPP11_CONTAINERS 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_CONTAINERS 1
#else
#define EA_NO_HAVE_CPP11_CONTAINERS 1
#endif
#endif
// #include <atomic>
#if !defined(EA_HAVE_CPP11_ATOMIC) && !defined(EA_NO_HAVE_CPP11_ATOMIC)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
#define EA_HAVE_CPP11_ATOMIC 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
#define EA_HAVE_CPP11_ATOMIC 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_ATOMIC 1
#else
#define EA_NO_HAVE_CPP11_ATOMIC 1
#endif
#endif
// #include <condition_variable>
#if !defined(EA_HAVE_CPP11_CONDITION_VARIABLE) && !defined(EA_NO_HAVE_CPP11_CONDITION_VARIABLE)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
#define EA_HAVE_CPP11_CONDITION_VARIABLE 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
#define EA_HAVE_CPP11_CONDITION_VARIABLE 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_CONDITION_VARIABLE 1
#else
#define EA_NO_HAVE_CPP11_CONDITION_VARIABLE 1
#endif
#endif
// #include <mutex>
#if !defined(EA_HAVE_CPP11_MUTEX) && !defined(EA_NO_HAVE_CPP11_MUTEX)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
#define EA_HAVE_CPP11_MUTEX 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
#define EA_HAVE_CPP11_MUTEX 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_MUTEX 1
#else
#define EA_NO_HAVE_CPP11_MUTEX 1
#endif
#endif
// #include <thread>
#if !defined(EA_HAVE_CPP11_THREAD) && !defined(EA_NO_HAVE_CPP11_THREAD)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
#define EA_HAVE_CPP11_THREAD 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
#define EA_HAVE_CPP11_THREAD 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_THREAD 1
#else
#define EA_NO_HAVE_CPP11_THREAD 1
#endif
#endif
// #include <future>
#if !defined(EA_HAVE_CPP11_FUTURE) && !defined(EA_NO_HAVE_CPP11_FUTURE)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
#define EA_HAVE_CPP11_FUTURE 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4005)
#define EA_HAVE_CPP11_FUTURE 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_FUTURE 1
#else
#define EA_NO_HAVE_CPP11_FUTURE 1
#endif
#endif
// #include <type_traits>
#if !defined(EA_HAVE_CPP11_TYPE_TRAITS) && !defined(EA_NO_HAVE_CPP11_TYPE_TRAITS)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
#define EA_HAVE_CPP11_TYPE_TRAITS 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007) // Prior versions of libstdc++ have incomplete support for C++11 type traits.
#define EA_HAVE_CPP11_TYPE_TRAITS 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_TYPE_TRAITS 1
#else
#define EA_NO_HAVE_CPP11_TYPE_TRAITS 1
#endif
#endif
// #include <tuple>
#if !defined(EA_HAVE_CPP11_TUPLES) && !defined(EA_NO_HAVE_CPP11_TUPLES)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
#define EA_HAVE_CPP11_TUPLES 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4003)
#define EA_HAVE_CPP11_TUPLES 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_TUPLES 1
#else
#define EA_NO_HAVE_CPP11_TUPLES 1
#endif
#endif
// #include <regex>
#if !defined(EA_HAVE_CPP11_REGEX) && !defined(EA_NO_HAVE_CPP11_REGEX)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) && (defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS) // Dinkumware. VS2012+
#define EA_HAVE_CPP11_REGEX 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4003)
#define EA_HAVE_CPP11_REGEX 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_REGEX 1
#else
#define EA_NO_HAVE_CPP11_REGEX 1
#endif
#endif
// #include <random>
#if !defined(EA_HAVE_CPP11_RANDOM) && !defined(EA_NO_HAVE_CPP11_RANDOM)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
#define EA_HAVE_CPP11_RANDOM 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4005)
#define EA_HAVE_CPP11_RANDOM 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_RANDOM 1
#else
#define EA_NO_HAVE_CPP11_RANDOM 1
#endif
#endif
// #include <chrono>
#if !defined(EA_HAVE_CPP11_CHRONO) && !defined(EA_NO_HAVE_CPP11_CHRONO)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
#define EA_HAVE_CPP11_CHRONO 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007) // chrono was broken in glibc prior to 4.7.
#define EA_HAVE_CPP11_CHRONO 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_CHRONO 1
#else
#define EA_NO_HAVE_CPP11_CHRONO 1
#endif
#endif
// #include <scoped_allocator>
#if !defined(EA_HAVE_CPP11_SCOPED_ALLOCATOR) && !defined(EA_NO_HAVE_CPP11_SCOPED_ALLOCATOR)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
#define EA_HAVE_CPP11_SCOPED_ALLOCATOR 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
#define EA_HAVE_CPP11_SCOPED_ALLOCATOR 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_SCOPED_ALLOCATOR 1
#else
#define EA_NO_HAVE_CPP11_SCOPED_ALLOCATOR 1
#endif
#endif
// #include <initializer_list>
#if !defined(EA_HAVE_CPP11_INITIALIZER_LIST) && !defined(EA_NO_HAVE_CPP11_INITIALIZER_LIST)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) // Dinkumware. VS2010+
#define EA_HAVE_CPP11_INITIALIZER_LIST 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_CLANG) && (EA_COMPILER_VERSION >= 301) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) && !defined(EA_PLATFORM_APPLE)
#define EA_HAVE_CPP11_INITIALIZER_LIST 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBCPP_LIBRARY) && defined(EA_COMPILER_CLANG) && (EA_COMPILER_VERSION >= 301) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) && !defined(EA_PLATFORM_APPLE)
#define EA_HAVE_CPP11_INITIALIZER_LIST 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) && !defined(EA_PLATFORM_APPLE)
#define EA_HAVE_CPP11_INITIALIZER_LIST 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS)
#define EA_HAVE_CPP11_INITIALIZER_LIST 1
#else
#define EA_NO_HAVE_CPP11_INITIALIZER_LIST 1
#endif
#endif
// #include <system_error>
#if !defined(EA_HAVE_CPP11_SYSTEM_ERROR) && !defined(EA_NO_HAVE_CPP11_SYSTEM_ERROR)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
#define EA_HAVE_CPP11_SYSTEM_ERROR 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_CLANG) && (EA_COMPILER_VERSION >= 301) && !defined(EA_PLATFORM_APPLE)
#define EA_HAVE_CPP11_SYSTEM_ERROR 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) && !defined(EA_PLATFORM_APPLE)
#define EA_HAVE_CPP11_SYSTEM_ERROR 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_SYSTEM_ERROR 1
#else
#define EA_NO_HAVE_CPP11_SYSTEM_ERROR 1
#endif
#endif
// #include <codecvt>
#if !defined(EA_HAVE_CPP11_CODECVT) && !defined(EA_NO_HAVE_CPP11_CODECVT)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
#define EA_HAVE_CPP11_CODECVT 1
// Future versions of libc++ may support this header. However, at the moment there isn't
// a reliable way of detecting if this header is available.
//#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4008)
// #define EA_HAVE_CPP11_CODECVT 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_CODECVT 1
#else
#define EA_NO_HAVE_CPP11_CODECVT 1
#endif
#endif
// #include <typeindex>
#if !defined(EA_HAVE_CPP11_TYPEINDEX) && !defined(EA_NO_HAVE_CPP11_TYPEINDEX)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
#define EA_HAVE_CPP11_TYPEINDEX 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
#define EA_HAVE_CPP11_TYPEINDEX 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_TYPEINDEX 1
#else
#define EA_NO_HAVE_CPP11_TYPEINDEX 1
#endif
#endif
/* EA_HAVE_XXX_DECL */
#if !defined(EA_HAVE_mkstemps_DECL) && !defined(EA_NO_HAVE_mkstemps_DECL)
#if defined(EA_PLATFORM_APPLE) || defined(CS_UNDEFINED_STRING)
#define EA_HAVE_mkstemps_DECL 1
#else
#define EA_NO_HAVE_mkstemps_DECL 1
#endif
#endif
#if !defined(EA_HAVE_gettimeofday_DECL) && !defined(EA_NO_HAVE_gettimeofday_DECL)
#if defined(EA_PLATFORM_POSIX) /* Posix means Linux, Unix, and Macintosh OSX, among others (including Linux-based mobile platforms). */
#define EA_HAVE_gettimeofday_DECL 1
#else
#define EA_NO_HAVE_gettimeofday_DECL 1
#endif
#endif
#if !defined(EA_HAVE_strcasecmp_DECL) && !defined(EA_NO_HAVE_strcasecmp_DECL)
#if !defined(EA_PLATFORM_MICROSOFT)
#define EA_HAVE_strcasecmp_DECL 1 /* This is found as stricmp when not found as strcasecmp */
#define EA_HAVE_strncasecmp_DECL 1
#else
#define EA_HAVE_stricmp_DECL 1
#define EA_HAVE_strnicmp_DECL 1
#endif
#endif
#if !defined(EA_HAVE_mmap_DECL) && !defined(EA_NO_HAVE_mmap_DECL)
#if defined(EA_PLATFORM_POSIX)
#define EA_HAVE_mmap_DECL 1 /* mmap functionality varies significantly between systems. */
#else
#define EA_NO_HAVE_mmap_DECL 1
#endif
#endif
#if !defined(EA_HAVE_fopen_DECL) && !defined(EA_NO_HAVE_fopen_DECL)
#define EA_HAVE_fopen_DECL 1 /* C FILE functionality such as fopen */
#endif
#if !defined(EA_HAVE_ISNAN) && !defined(EA_NO_HAVE_ISNAN)
#if defined(EA_PLATFORM_MICROSOFT) && !defined(EA_PLATFORM_MINGW)
#define EA_HAVE_ISNAN(x) _isnan(x) /* declared in <math.h> */
#define EA_HAVE_ISINF(x) !_finite(x)
#elif defined(EA_PLATFORM_APPLE)
#define EA_HAVE_ISNAN(x) std::isnan(x) /* declared in <cmath> */
#define EA_HAVE_ISINF(x) std::isinf(x)
#elif defined(EA_PLATFORM_ANDROID)
#define EA_HAVE_ISNAN(x) __builtin_isnan(x) /* There are a number of standard libraries for Android and it's hard to tell them apart, so just go with builtins */
#define EA_HAVE_ISINF(x) __builtin_isinf(x)
#elif defined(__GNUC__) && defined(__CYGWIN__)
#define EA_HAVE_ISNAN(x) __isnand(x) /* declared nowhere, it seems. */
#define EA_HAVE_ISINF(x) __isinfd(x)
#else
#define EA_HAVE_ISNAN(x) std::isnan(x) /* declared in <cmath> */
#define EA_HAVE_ISINF(x) std::isinf(x)
#endif
#endif
#if !defined(EA_HAVE_itoa_DECL) && !defined(EA_NO_HAVE_itoa_DECL)
#if defined(EA_COMPILER_MSVC)
#define EA_HAVE_itoa_DECL 1
#else
#define EA_NO_HAVE_itoa_DECL 1
#endif
#endif
#if !defined(EA_HAVE_nanosleep_DECL) && !defined(EA_NO_HAVE_nanosleep_DECL)
#if (defined(EA_PLATFORM_UNIX) && !defined(EA_PLATFORM_SONY)) || defined(EA_PLATFORM_IPHONE) || defined(EA_PLATFORM_OSX) || defined(EA_PLATFORM_KETTLE)
#define EA_HAVE_nanosleep_DECL 1
#else
#define EA_NO_HAVE_nanosleep_DECL 1
#endif
#endif
#if !defined(EA_HAVE_utime_DECL) && !defined(EA_NO_HAVE_utime_DECL)
#if defined(EA_PLATFORM_MICROSOFT)
#define EA_HAVE_utime_DECL _utime
#elif EA_PLATFORM_UNIX
#define EA_HAVE_utime_DECL utime
#else
#define EA_NO_HAVE_utime_DECL 1
#endif
#endif
#if !defined(EA_HAVE_ftruncate_DECL) && !defined(EA_NO_HAVE_ftruncate_DECL)
#if !defined(__MINGW32__)
#define EA_HAVE_ftruncate_DECL 1
#else
#define EA_NO_HAVE_ftruncate_DECL 1
#endif
#endif
#if !defined(EA_HAVE_localtime_DECL) && !defined(EA_NO_HAVE_localtime_DECL)
#define EA_HAVE_localtime_DECL 1
#endif
#if !defined(EA_HAVE_pthread_getattr_np_DECL) && !defined(EA_NO_HAVE_pthread_getattr_np_DECL)
#if defined(EA_PLATFORM_LINUX)
#define EA_HAVE_pthread_getattr_np_DECL 1
#else
#define EA_NO_HAVE_pthread_getattr_np_DECL 1
#endif
#endif
/* EA_HAVE_XXX_IMPL*/
#if !defined(EA_HAVE_WCHAR_IMPL) && !defined(EA_NO_HAVE_WCHAR_IMPL)
#if defined(EA_PLATFORM_DESKTOP)
#define EA_HAVE_WCHAR_IMPL 1 /* Specifies if wchar_t string functions are provided, such as wcslen, wprintf, etc. Implies EA_HAVE_WCHAR_H */
#else
#define EA_NO_HAVE_WCHAR_IMPL 1
#endif
#endif
#if !defined(EA_HAVE_getenv_IMPL) && !defined(EA_NO_HAVE_getenv_IMPL)
#if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_WINRT)
#define EA_HAVE_getenv_IMPL 1
#else
#define EA_NO_HAVE_getenv_IMPL 1
#endif
#endif
#if !defined(EA_HAVE_setenv_IMPL) && !defined(EA_NO_HAVE_setenv_IMPL)
#if defined(EA_PLATFORM_UNIX) && defined(EA_PLATFORM_POSIX)
#define EA_HAVE_setenv_IMPL 1
#else
#define EA_NO_HAVE_setenv_IMPL 1
#endif
#endif
#if !defined(EA_HAVE_unsetenv_IMPL) && !defined(EA_NO_HAVE_unsetenv_IMPL)
#if defined(EA_PLATFORM_UNIX) && defined(EA_PLATFORM_POSIX)
#define EA_HAVE_unsetenv_IMPL 1
#else
#define EA_NO_HAVE_unsetenv_IMPL 1
#endif
#endif
#if !defined(EA_HAVE_putenv_IMPL) && !defined(EA_NO_HAVE_putenv_IMPL)
#if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_WINRT)
#define EA_HAVE_putenv_IMPL 1 /* With Microsoft compilers you may need to use _putenv, as they have deprecated putenv. */
#else
#define EA_NO_HAVE_putenv_IMPL 1
#endif
#endif
#if !defined(EA_HAVE_time_IMPL) && !defined(EA_NO_HAVE_time_IMPL)
#define EA_HAVE_time_IMPL 1
#define EA_HAVE_clock_IMPL 1
#endif
// <cstdio> fopen()
#if !defined(EA_HAVE_fopen_IMPL) && !defined(EA_NO_HAVE_fopen_IMPL)
#define EA_HAVE_fopen_IMPL 1 /* C FILE functionality such as fopen */
#endif
// <arpa/inet.h> inet_ntop()
#if !defined(EA_HAVE_inet_ntop_IMPL) && !defined(EA_NO_HAVE_inet_ntop_IMPL)
#if (defined(EA_PLATFORM_UNIX) || defined(EA_PLATFORM_POSIX)) && !defined(EA_PLATFORM_SONY) && !defined(CS_UNDEFINED_STRING)
#define EA_HAVE_inet_ntop_IMPL 1 /* This doesn't identify if the platform SDK has some alternative function that does the same thing; */
#define EA_HAVE_inet_pton_IMPL 1 /* it identifies strictly the <arpa/inet.h> inet_ntop and inet_pton functions. For example, Microsoft has InetNtop in <Ws2tcpip.h> */
#else
#define EA_NO_HAVE_inet_ntop_IMPL 1
#define EA_NO_HAVE_inet_pton_IMPL 1
#endif
#endif
// <time.h> clock_gettime()
#if !defined(EA_HAVE_clock_gettime_IMPL) && !defined(EA_NO_HAVE_clock_gettime_IMPL)
#if defined(EA_PLATFORM_LINUX) || defined(__CYGWIN__) || (defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)) || (defined(EA_PLATFORM_POSIX) && defined(_CPPLIB_VER) /*Dinkumware*/)
#define EA_HAVE_clock_gettime_IMPL 1 /* You need to link the 'rt' library to get this */
#else
#define EA_NO_HAVE_clock_gettime_IMPL 1
#endif
#endif
#if !defined(EA_HAVE_getcwd_IMPL) && !defined(EA_NO_HAVE_getcwd_IMPL)
#if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_ANDROID) && !defined(EA_PLATFORM_WINRT)
#define EA_HAVE_getcwd_IMPL 1 /* With Microsoft compilers you may need to use _getcwd, as they have deprecated getcwd. And in any case it's present at <direct.h> */
#else
#define EA_NO_HAVE_getcwd_IMPL 1
#endif
#endif
#if !defined(EA_HAVE_tmpnam_IMPL) && !defined(EA_NO_HAVE_tmpnam_IMPL)
#if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_ANDROID)
#define EA_HAVE_tmpnam_IMPL 1
#else
#define EA_NO_HAVE_tmpnam_IMPL 1
#endif
#endif
// nullptr, the built-in C++11 type.
// This EA_HAVE is deprecated, as EA_COMPILER_NO_NULLPTR is more appropriate, given that nullptr is a compiler-level feature and not a library feature.
#if !defined(EA_HAVE_nullptr_IMPL) && !defined(EA_NO_HAVE_nullptr_IMPL)
#if defined(EA_COMPILER_NO_NULLPTR)
#define EA_NO_HAVE_nullptr_IMPL 1
#else
#define EA_HAVE_nullptr_IMPL 1
#endif
#endif
// <cstddef> std::nullptr_t
// Note that <EABase/nullptr.h> implements a portable nullptr implementation, but this
// EA_HAVE specifically refers to std::nullptr_t from the standard libraries.
#if !defined(EA_HAVE_nullptr_t_IMPL) && !defined(EA_NO_HAVE_nullptr_t_IMPL)
#if defined(EA_COMPILER_CPP11_ENABLED)
// VS2010+ with its default Dinkumware standard library.
#if defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY)
#define EA_HAVE_nullptr_t_IMPL 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) // clang/llvm libc++
#define EA_HAVE_nullptr_t_IMPL 1
#elif defined(EA_HAVE_LIBSTDCPP_LIBRARY) // GNU libstdc++
// Unfortunately __GLIBCXX__ date values don't go strictly in version ordering.
#if (__GLIBCXX__ >= 20110325) && (__GLIBCXX__ != 20120702) && (__GLIBCXX__ != 20110428)
#define EA_HAVE_nullptr_t_IMPL 1
#else
#define EA_NO_HAVE_nullptr_t_IMPL 1
#endif
// We simply assume that the standard library (e.g. Dinkumware) provides std::nullptr_t.
#elif defined(__clang__)
#define EA_HAVE_nullptr_t_IMPL 1
// With GCC compiler >= 4.6, std::nullptr_t is always defined in <cstddef>, in practice.
#elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
#define EA_HAVE_nullptr_t_IMPL 1
// The EDG compiler provides nullptr, but uses an older standard library that doesn't support std::nullptr_t.
#elif defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403)
#define EA_HAVE_nullptr_t_IMPL 1
#else
#define EA_NO_HAVE_nullptr_t_IMPL 1
#endif
#else
#define EA_NO_HAVE_nullptr_t_IMPL 1
#endif
#endif
// <exception> std::terminate
#if !defined(EA_HAVE_std_terminate_IMPL) && !defined(EA_NO_HAVE_std_terminate_IMPL)
#if !defined(EA_PLATFORM_IPHONE) && !defined(EA_PLATFORM_ANDROID)
#define EA_HAVE_std_terminate_IMPL 1 /* iOS doesn't appear to provide an implementation for std::terminate under the armv6 target. */
#else
#define EA_NO_HAVE_std_terminate_IMPL 1
#endif
#endif
// <iterator>: std::begin, std::end, std::prev, std::next, std::move_iterator.
#if !defined(EA_HAVE_CPP11_ITERATOR_IMPL) && !defined(EA_NO_HAVE_CPP11_ITERATOR_IMPL)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
#define EA_HAVE_CPP11_ITERATOR_IMPL 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
#define EA_HAVE_CPP11_ITERATOR_IMPL 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_ITERATOR_IMPL 1
#else
#define EA_NO_HAVE_CPP11_ITERATOR_IMPL 1
#endif
#endif
// <memory>: std::weak_ptr, std::shared_ptr, std::unique_ptr, std::bad_weak_ptr, std::owner_less
#if !defined(EA_HAVE_CPP11_SMART_POINTER_IMPL) && !defined(EA_NO_HAVE_CPP11_SMART_POINTER_IMPL)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
#define EA_HAVE_CPP11_SMART_POINTER_IMPL 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
#define EA_HAVE_CPP11_SMART_POINTER_IMPL 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_SMART_POINTER_IMPL 1
#else
#define EA_NO_HAVE_CPP11_SMART_POINTER_IMPL 1
#endif
#endif
// <functional>: std::function, std::mem_fn, std::bad_function_call, std::is_bind_expression, std::is_placeholder, std::reference_wrapper, std::hash, std::bind, std::ref, std::cref.
#if !defined(EA_HAVE_CPP11_FUNCTIONAL_IMPL) && !defined(EA_NO_HAVE_CPP11_FUNCTIONAL_IMPL)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
#define EA_HAVE_CPP11_FUNCTIONAL_IMPL 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
#define EA_HAVE_CPP11_FUNCTIONAL_IMPL 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_FUNCTIONAL_IMPL 1
#else
#define EA_NO_HAVE_CPP11_FUNCTIONAL_IMPL 1
#endif
#endif
// <exception> std::current_exception, std::rethrow_exception, std::exception_ptr, std::make_exception_ptr
#if !defined(EA_HAVE_CPP11_EXCEPTION_IMPL) && !defined(EA_NO_HAVE_CPP11_EXCEPTION_IMPL)
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
#define EA_HAVE_CPP11_EXCEPTION_IMPL 1
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
#define EA_HAVE_CPP11_EXCEPTION_IMPL 1
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
#define EA_HAVE_CPP11_EXCEPTION_IMPL 1
#else
#define EA_NO_HAVE_CPP11_EXCEPTION_IMPL 1
#endif
#endif
/* Implementations that all platforms seem to have: */
/*
alloca
malloc
calloc
strtoll
strtoull
vsprintf
vsnprintf
*/
/* Implementations that we don't care about: */
/*
bcopy -- Just use memmove or some customized equivalent. bcopy offers no practical benefit.
strlcpy -- So few platforms have this built-in that we get no benefit from using it. Use EA::StdC::Strlcpy instead.
strlcat -- "
*/
/*-----------------------------------------------------------------------------
EABASE_USER_HAVE_HEADER
This allows the user to define a header file to be #included after the
eahave.h's contents are compiled. A primary use of this is to override
the contents of this header file. You can define the overhead header
file name in-code or define it globally as part of your build file.
Example usage:
#define EABASE_USER_HAVE_HEADER "MyHaveOverrides.h"
#include <EABase/eahave.h>
---------------------------------------------------------------------------*/
#ifdef EABASE_USER_HAVE_HEADER
#include EABASE_USER_HAVE_HEADER
#endif
#endif /* Header include guard */

View File

@@ -0,0 +1,62 @@
/*-----------------------------------------------------------------------------
* earesult.h
*
* Copyright (c) Electronic Arts Inc. All rights reserved.
*---------------------------------------------------------------------------*/
#ifndef INCLUDED_earesult_H
#define INCLUDED_earesult_H
#include <EABase/eabase.h>
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once /* Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. */
#endif
/* This result type is width-compatible with most systems. */
typedef int32_t ea_result_type;
namespace EA
{
typedef int32_t result_type;
enum
{
#ifndef SUCCESS
// Deprecated
// Note: a public MS header has created a define of this name which causes a build error. Fortunately they
// define it to 0 which is compatible.
// see: WindowsSDK\8.1.51641-fb\installed\Include\um\RasError.h
SUCCESS = 0,
#endif
// Deprecated
FAILURE = -1,
// These values are now the preferred constants
EA_SUCCESS = 0,
EA_FAILURE = -1,
};
}
/* Macro to simplify testing for success. */
#ifndef EA_SUCCEEDED
#define EA_SUCCEEDED(result) ((result) >= 0)
#endif
/* Macro to simplfify testing for general failure. */
#ifndef EA_FAILED
#define EA_FAILED(result) ((result) < 0)
#endif
#endif

View File

@@ -0,0 +1,99 @@
/*-----------------------------------------------------------------------------
* eastdarg.h
*
* Copyright (c) Electronic Arts Inc. All rights reserved.
*---------------------------------------------------------------------------*/
#ifndef INCLUDED_eastdarg_H
#define INCLUDED_eastdarg_H
#include <EABase/eabase.h>
#include <stdarg.h>
// VA_ARG_COUNT
//
// Returns the number of arguments passed to a macro's ... argument.
// This applies to macros only and not functions.
//
// Example usage:
// assert(VA_ARG_COUNT() == 0);
// assert(VA_ARG_COUNT(a) == 1);
// assert(VA_ARG_COUNT(a, b) == 2);
// assert(VA_ARG_COUNT(a, b, c) == 3);
//
#if !defined(VA_ARG_COUNT)
#define VA_ARG_COUNT(...) VA_ARG_COUNT_II((VA_ARG_COUNT_PREFIX_ ## __VA_ARGS__ ## _VA_ARG_COUNT_POSTFIX,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0))
#define VA_ARG_COUNT_II(__args) VA_ARG_COUNT_I __args
#define VA_ARG_COUNT_PREFIX__VA_ARG_COUNT_POSTFIX ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0
#define VA_ARG_COUNT_I(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,N,...) N
#endif
// va_copy
//
// va_copy is required by C++11
// C++11 and C99 require va_copy to be #defined and implemented.
// http://en.cppreference.com/w/cpp/utility/variadic/va_copy
//
// Example usage:
// void Func(char* p, ...){
// va_list args, argsCopy;
// va_start(args, p);
// va_copy(argsCopy, args);
// (use args)
// (use argsCopy, which acts the same as args)
// va_end(args);
// va_end(argsCopy);
// }
//
#ifndef va_copy
#if defined(__va_copy) // GCC and others define this for non-C99 compatibility.
#define va_copy(dest, src) __va_copy((dest), (src))
#else
// This may not work for some platforms, depending on their ABI.
// It works for Microsoft x86,x64, and PowerPC-based platforms.
#define va_copy(dest, src) memcpy(&(dest), &(src), sizeof(va_list))
#endif
#endif
// va_list_reference
//
// va_list_reference is not part of the C or C++ standards.
// It allows you to pass a va_list by reference to another
// function instead of by value. You cannot simply use va_list&
// as that won't work with many va_list implementations because
// they are implemented as arrays (which can't be passed by
// reference to a function without decaying to a pointer).
//
// Example usage:
// void Test(va_list_reference args){
// printf("%d", va_arg(args, int));
// }
// void Func(char* p, ...){
// va_list args;
// va_start(args, p);
// Test(args); // Upon return args will be modified.
// va_end(args);
// }
#ifndef va_list_reference
#if defined(EA_PLATFORM_MICROSOFT) || (EA_PLATFORM_PTR_SIZE == 4) || (defined(EA_PLATFORM_APPLE) && defined(EA_PROCESSOR_ARM64)) || defined(CS_UNDEFINED_STRING) || (defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_ARM64))
// This is required for platform ABIs in which va_list is a struct or pointer.
#define va_list_reference va_list&
#else
// This is required for platform ABIs in which va_list is defined to be an array.
#define va_list_reference va_list
#endif
#endif
#endif /* Header include guard */

View File

@@ -0,0 +1,54 @@
/*-----------------------------------------------------------------------------
* eaunits.h
*
* Copyright (c) Electronic Arts Inc. All rights reserved.
*---------------------------------------------------------------------------*/
#ifndef INCLUDED_eaunits_h
#define INCLUDED_eaunits_h
#include <EABase/eabase.h>
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result.
#endif
// Defining common SI unit macros.
//
// The mebibyte is a multiple of the unit byte for digital information. Technically a
// megabyte (MB) is a power of ten, while a mebibyte (MiB) is a power of two,
// appropriate for binary machines. Many Linux distributions use the unit, but it is
// not widely acknowledged within the industry or media.
// Reference: https://en.wikipedia.org/wiki/Mebibyte
//
// Examples:
// auto size1 = EA_KILOBYTE(16);
// auto size2 = EA_MEGABYTE(128);
// auto size3 = EA_MEBIBYTE(8);
// auto size4 = EA_GIBIBYTE(8);
// define byte for completeness
#define EA_BYTE(x) (x)
// Decimal SI units
#define EA_KILOBYTE(x) (size_t(x) * 1000)
#define EA_MEGABYTE(x) (size_t(x) * 1000 * 1000)
#define EA_GIGABYTE(x) (size_t(x) * 1000 * 1000 * 1000)
#define EA_TERABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000)
#define EA_PETABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000)
#define EA_EXABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000 * 1000)
// Binary SI units
#define EA_KIBIBYTE(x) (size_t(x) * 1024)
#define EA_MEBIBYTE(x) (size_t(x) * 1024 * 1024)
#define EA_GIBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024)
#define EA_TEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024)
#define EA_PEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024)
#define EA_EXBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024 * 1024)
#endif // INCLUDED_earesult_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,102 @@
/*-----------------------------------------------------------------------------
* nullptr.h
*
* Copyright (c) Electronic Arts Inc. All rights reserved.
*---------------------------------------------------------------------------*/
#include <EABase/eabase.h>
#include <EABase/eahave.h>
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once /* Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. */
#endif
#if defined(EA_COMPILER_CPP11_ENABLED) && !defined(EA_COMPILER_NO_NULLPTR) && !defined(EA_HAVE_nullptr_t_IMPL)
// The compiler supports nullptr, but the standard library doesn't implement a declaration for std::nullptr_t. So we provide one.
namespace std { typedef decltype(nullptr) nullptr_t; }
#endif
#if defined(EA_COMPILER_NO_NULLPTR) // If the compiler lacks a native version...
namespace std
{
class nullptr_t
{
public:
template<class T> // When tested a pointer, acts as 0.
operator T*() const
{ return 0; }
template<class C, class T> // When tested as a member pointer, acts as 0.
operator T C::*() const
{ return 0; }
typedef void* (nullptr_t::*bool_)() const;
operator bool_() const // An rvalue of type std::nullptr_t can be converted to an rvalue of type bool; the resulting value is false.
{ return false; } // We can't use operator bool(){ return false; } because bool is convertable to int which breaks other required functionality.
// We can't enable this without generating warnings about nullptr being uninitialized after being used when created without "= {}".
//void* mSizeofVoidPtr; // sizeof(nullptr_t) == sizeof(void*). Needs to be public if nullptr_t is to be a POD.
private:
void operator&() const; // Address cannot be taken.
};
inline nullptr_t nullptr_get()
{
nullptr_t n = { }; // std::nullptr exists.
return n;
}
#if !defined(nullptr) // If somebody hasn't already defined nullptr in a custom way...
#define nullptr nullptr_get()
#endif
} // namespace std
template<class T>
inline bool operator==(T* p, const std::nullptr_t)
{ return p == 0; }
template<class T>
inline bool operator==(const std::nullptr_t, T* p)
{ return p == 0; }
template<class T, class U>
inline bool operator==(T U::* p, const std::nullptr_t)
{ return p == 0; }
template<class T, class U>
inline bool operator==(const std::nullptr_t, T U::* p)
{ return p == 0; }
inline bool operator==(const std::nullptr_t, const std::nullptr_t)
{ return true; }
inline bool operator!=(const std::nullptr_t, const std::nullptr_t)
{ return false; }
inline bool operator<(const std::nullptr_t, const std::nullptr_t)
{ return false; }
inline bool operator>(const std::nullptr_t, const std::nullptr_t)
{ return false; }
inline bool operator<=(const std::nullptr_t, const std::nullptr_t)
{ return true; }
inline bool operator>=(const std::nullptr_t, const std::nullptr_t)
{ return true; }
using std::nullptr_t; // exported to global namespace.
using std::nullptr_get; // exported to global namespace.
#endif // EA_COMPILER_NO_NULLPTR

View File

@@ -0,0 +1,36 @@
/*-----------------------------------------------------------------------------
* version.h
*
* Copyright (c) Electronic Arts Inc. All rights reserved.
*---------------------------------------------------------------------------*/
#ifndef INCLUDED_EABASE_VERSION_H
#define INCLUDED_EABASE_VERSION_H
///////////////////////////////////////////////////////////////////////////////
// EABASE_VERSION
//
// We more or less follow the conventional EA packaging approach to versioning
// here. A primary distinction here is that minor versions are defined as two
// digit entities (e.g. .03") instead of minimal digit entities ".3"). The logic
// here is that the value is a counter and not a floating point fraction.
// Note that the major version doesn't have leading zeros.
//
// Example version strings:
// "0.91.00" // Major version 0, minor version 91, patch version 0.
// "1.00.00" // Major version 1, minor and patch version 0.
// "3.10.02" // Major version 3, minor version 10, patch version 02.
// "12.03.01" // Major version 12, minor version 03, patch version
//
// Example usage:
// printf("EABASE version: %s", EABASE_VERSION);
// printf("EABASE version: %d.%d.%d", EABASE_VERSION_N / 10000 % 100, EABASE_VERSION_N / 100 % 100, EABASE_VERSION_N % 100);
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EABASE_VERSION
#define EABASE_VERSION "2.09.04"
#define EABASE_VERSION_N 20904
#endif
#endif

42
test/CMakeLists.txt Normal file
View File

@@ -0,0 +1,42 @@
#-------------------------------------------------------------------------------------------
# Copyright (C) Electronic Arts Inc. All rights reserved.
#-------------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------------
# CMake info
#-------------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.1)
project(EABaseTest CXX)
include(CTest)
#-------------------------------------------------------------------------------------------
# Include directories
#-------------------------------------------------------------------------------------------
include_directories(source "../include")
#-------------------------------------------------------------------------------------------
# Source files
#-------------------------------------------------------------------------------------------
file(GLOB EABASETEST_SOURCES "source/*.cpp" "source/*.inl" "source/*.h")
set(SOURCES ${EABASETEST_SOURCES})
#-------------------------------------------------------------------------------------------
# Defines
#-------------------------------------------------------------------------------------------
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
add_definitions(-DEASTL_OPENSOURCE=1)
add_definitions(-D_CHAR16T)
#-------------------------------------------------------------------------------------------
# Executable definition
#-------------------------------------------------------------------------------------------
add_executable(EABaseTest ${SOURCES})
#-------------------------------------------------------------------------------------------
# Run Unit tests and verify the results.
#-------------------------------------------------------------------------------------------
add_test(EABaseTestRuns EABaseTest)
set_tests_properties (EABaseTestRuns PROPERTIES PASS_REGULAR_EXPRESSION "RETURNCODE=0")

View File

@@ -0,0 +1,4 @@
// EAMain/EAEntryPointMain.inl contains C++ code but it exposes the application entry point with C linkage.
#include "EAMain/EAEntryPointMain.inl"
#include "EATest/EASTLNewOperatorGuard.inl"

3708
test/source/TestEABase.cpp Normal file

File diff suppressed because it is too large Load Diff

40
test/source/TestEABase.h Normal file
View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (c) Electronic Arts Inc. All rights reserved.
/////////////////////////////////////////////////////////////////////////////
#include <EABase/eabase.h>
#include <EABase/version.h>
// What we do here is verify that EA_PRAGMA_ONCE_SUPPORTED works as intended.
// This header file should be #included two times by TestEABase.cpp
// in order to test this.
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once
const int EABaseOncePerTranslationUnitTestVariable = 0; // This should get compiled only once ever for a compilation unit.
#else
// Just implement a classic manual header include guard.
// In this case we aren't really testing anything.
#ifndef TESTEABASE_H
#define TESTEABASE_H
const int EABaseOncePerTranslationUnitTestVariable = 0;
#endif
#endif
// EA_EXTERN_TEMPLATE / EA_COMPILER_NO_EXTERN_TEMPLATE
#if defined(__cplusplus)
template <typename T>
struct eabase_template
{
T value;
T GetValue() const { return value; }
};
EA_EXTERN_TEMPLATE(struct eabase_template<char>);
#endif

1215
test/source/TestEABaseC.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
// The purpose of this compilation unit is to test EABase in the absence of other system headers.
// For example TestEABase.cpp directly includes system headers like ctype.h, stddef.h, stdarg, etc.
// However, these headers make it impossible to verify that certain definitions are being provided
// by EABase instead of the system headers being included directly.
#include <EABase/eabase.h>
// This structure tests that EABase types are properly defined.
struct EABaseDefinedTypesStruct
{
char8_t mChar8_t;
char16_t mChar16_t;
char32_t mChar32_t;
wchar_t mWchar_t;
bool8_t mBool8_t;
int8_t mInt8_t;
int16_t mInt16_t;
int32_t mInt32_t;
int64_t mInt64_t;
uint8_t mUint8_t;
uint16_t mUint16_t;
uint32_t mUint32_t;
uint64_t mUint64_t;
intmax_t mIntmax_t;
uintmax_t mUintmax_t;
size_t mSize_t;
ssize_t mSsize_t;
float_t mFloat_t;
double_t mDouble_t;
intptr_t mIntptr_t;
uintptr_t mUintptr_t;
ptrdiff_t mPtrdiff_t;
};