JD2022-TU1/main/extern/dtest/dtcore/inc/dtdefinitions.h

142 lines
6.3 KiB
C++

#pragma once
#pragma warning(push)
#include <ealdef.h>
#include <stdint.h>
#pragma warning(pop)
namespace dt
{
#define DT_EAL_VERSION 800
#define DT_EAL_ID (EAL_ID_TYPE_TG | (33 << EAL_ID_OWNER_SHIFT))
#define DT_EAL_THREAD_CONNECTION_ID (DT_EAL_ID | 0x00000001)
#define DT_EAL_THREAD_SERVICE_ID (DT_EAL_ID | 0x00000002)
#define DT_EAL_THREAD_HEALTH_ID (DT_EAL_ID | 0x00000003)
#define DT_EAL_THREAD_EMAIL_ID (DT_EAL_ID | 0x00000004)
#define DT_EAL_THREAD_CONNECTION_ACCEPT_ID (DT_EAL_ID | 0x00000005)
#define DT_EAL_THREAD_LOGGER_ID (DT_EAL_ID | 0x00000006)
#define DT_EAL_THREAD_CONSOLE_ID (DT_EAL_ID | 0x00000007)
#define DT_EAL_THREAD_COMMAND_RUNNER_ID (DT_EAL_ID | 0x00000008)
#define DT_EAL_THREAD_SERVICE_ADVERTISER_ID (DT_EAL_ID | 0x00000009)
#define DT_EAL_THREAD_SERVICE_TEST_ID (DT_EAL_ID | 0x0000000A)
#define DT_EAL_THREAD_SERVICE_LOG_ID (DT_EAL_ID | 0x0000000B)
#define DT_EAL_THREAD_BACKGROUND_INVOKE (DT_EAL_ID | 0x0000000C)
#define DT_EAL_THREAD_SCHEDULER_ID (DT_EAL_ID | 0x0000000D)
#if defined (DT_PLATFORM_X64) || defined (DT_PLATFORM_LINUX) || defined (DT_PLATFORM_GGP) || \
defined (DT_PLATFORM_DURANGO) || defined (DT_PLATFORM_ORBIS) || defined(DT_PLATFORM_PROSPERO) || \
defined (DT_PLATFORM_NX) || defined (DT_PLATFORM_SCARLETT) || defined(DT_PLATFORM_DURANGO_GDK)
// OK
#else
#error Platform not defined!
#endif
#if defined (DT_TARGET_DEBUG) || defined (DT_TARGET_RELEASE) || defined (DT_TARGET_TOOL_DEBUG) || defined (DT_TARGET_TOOL_RELEASE)
// OK
#else
#error Target not defined!
#endif
#if defined (DT_PLATFORM_X64) || defined (DT_PLATFORM_DURANGO) || defined(DT_PLATFORM_DURANGO_GDK) || defined (DT_PLATFORM_SCARLETT)
#define DT_NO_INLINE __declspec(noinline)
#define DT_SNPRINTF sprintf_s
#define DT_VSNPRINTF vsnprintf_s
#define DT_SSCANF sscanf_s
#define DT_STRCASECMP _stricmp
#else
#define DT_NO_INLINE __attribute__((noinline))
#define DT_SNPRINTF snprintf
#define DT_VSNPRINTF vsnprintf
#define DT_SSCANF sscanf
#define DT_STRCASECMP strcasecmp
#endif
#if defined(DT_CORE_DLL_EXPORT)
#define DT_CORE_DLL_ENTRY __declspec(dllexport)
#elif defined(DT_CORE_DLL_IMPORT)
#define DT_CORE_DLL_ENTRY __declspec(dllimport)
#define DT_USING_DLL
#else
#define DT_CORE_DLL_ENTRY
#endif
#if defined(DT_PLATFORM_ORBIS) || defined(DT_PLATFORM_PROSPERO)
#define DT_HW_BREAK() {__asm volatile ("int $0x41");}
#elif defined(DT_PLATFORM_LINUX) || defined(DT_PLATFORM_GGP)
#define DT_HW_BREAK() { asm volatile("int3"); } // __builtin_trap() is available but, with some distributions, it breaks a level above in the callstack.
#elif defined(DT_PLATFORM_X64) || defined(DT_PLATFORM_DURANGO) || defined(DT_PLATFORM_DURANGO_GDK) || defined(DT_PLATFORM_SCARLETT)
#define DT_HW_BREAK() {__debugbreak();}
#elif defined(DT_PLATFORM_NX)
#define DT_HW_BREAK() {__builtin_debugtrap();}
#else
#error "Unknown platform"
#endif
typedef eal_s32 Id;
typedef eal_u8 Byte;
typedef eal_s8 S8;
typedef eal_u8 U8;
typedef eal_s16 S16;
typedef eal_u16 U16;
typedef eal_s32 S32;
typedef eal_u32 U32;
typedef eal_s64 S64;
typedef eal_u64 U64;
typedef wchar_t Wchar;
typedef eal_s64 SizeT;
// unused warning helper
#define DT_UNUSED(p) ((void)&p)
#define DT_ENDL "\r\n"
#if defined(DT_RAISE_DEPRECIATION_WARNINGS)
#if defined(DT_PLATFORM_X64) || defined(DT_PLATFORM_DURANGO) || defined(DT_PLATFORM_DURANGO_GDK) || defined(DT_PLATFORM_SCARLETT)
#define DT_DEPRECATE( ... ) __declspec(deprecated(__VA_ARGS__))
#define DT_DEPRECATED( msg ) DT_DEPRECATE( msg )
#endif
#if defined(DT_PLATFORM_LINUX) || defined(DT_PLATFORM_GGP) || defined(DT_PLATFORM_ORBIS) || defined(DT_PLATFORM_PROSPERO) || defined(DT_PLATFORM_NX)
#define DT_DEPRECATE( ... ) __attribute__((deprecated(__VA_ARGS__)))
#define DT_DEPRECATED( msg ) DT_DEPRECATE( msg )
#endif
#else
#define DT_DEPRECATE(...)
#define DT_DEPRECATED( msg )
#endif
// unique identifiers
#define DT_CONCAT_INTERNAL(a, b) a##b
#define DT_CONCAT(a, b) DT_CONCAT_INTERNAL(a, b)
#define DT_UNIQUE_IDENTIFIER(prefix) DT_CONCAT(prefix, __LINE__)
#if defined(DT_PLATFORM_X64) || defined(DT_PLATFORM_DURANGO) || defined(DT_PLATFORM_DURANGO_GDK) || defined(DT_PLATFORM_SCARLETT)
#define DT_COMPILER_WARNING_TAG_INTERNAL(msg) __declspec(deprecated(msg))
#elif defined(DT_PLATFORM_LINUX) || defined(DT_PLATFORM_GGP) || defined(DT_PLATFORM_ORBIS) || defined(DT_PLATFORM_PROSPERO) || defined(DT_PLATFORM_NX)
#define DT_COMPILER_WARNING_TAG_INTERNAL(msg) __attribute__((deprecated(msg)))
#endif
#define DT_COMPILER_WARNING(msg) \
struct DT_UNIQUE_IDENTIFIER(_) \
{ \
DT_COMPILER_WARNING_TAG_INTERNAL(msg) static int DT_UNIQUE_IDENTIFIER(WARNING_)() { return 0; }; \
}; \
static int DT_UNIQUE_IDENTIFIER(warningVar) = DT_UNIQUE_IDENTIFIER(_)::DT_UNIQUE_IDENTIFIER(WARNING_)();
#if !defined(DT_PLATFORM_ORBIS) && !defined(DT_PLATFORM_PROSPERO) && !defined(DT_PLATFORM_NX) && !defined(_ITERATOR_DEBUG_LEVEL) && defined(DT_TARGET_DEBUG)
DT_COMPILER_WARNING("No _ITERATOR_DEBUG_LEVEL defined, defaulting to 2. Please define _ITERATOR_DEBUG_LEVEL as needed, " \
"either in the build flags or in your source code.")
#define _ITERATOR_DEBUG_LEVEL 2
#endif
#if _ITERATOR_DEBUG_LEVEL != 0
#if defined(DT_TARGET_TOOL_DEBUG)
#error Checked iterators/debug iterator are not supported in tool mode
#endif
#define DT_STATIC_DECLARE_IF_NO_ITERATOR_DEBUG(stm) stm
#define DT_STATIC_IMPLEMENT_IF_NO_ITERATOR_DEBUG(stm)
#else
#define DT_STATIC_DECLARE_IF_NO_ITERATOR_DEBUG(stm) static stm;
#define DT_STATIC_IMPLEMENT_IF_NO_ITERATOR_DEBUG(stm) stm
#endif
}