13#error ULANG_PLATFORM must be defined.
16#ifndef ULANG_PLATFORM_WINDOWS
18#define ULANG_PLATFORM_WINDOWS 0
21#if !defined(ULANG_PLATFORM_MAC)
22#define ULANG_PLATFORM_MAC 0
25#if !defined(ULANG_PLATFORM_LINUX)
26#define ULANG_PLATFORM_LINUX 0
29#define ULANG_PLATFORM_POSIX (ULANG_PLATFORM_MAC || ULANG_PLATFORM_LINUX)
31#ifndef ULANG_PLATFORM_EXTENSION
32#define ULANG_PLATFORM_EXTENSION 0
37#define ULANG_STRINGIFY(x) ULANG_STRINGIFY_INNER(x)
38#define ULANG_STRINGIFY_INNER(x) #x
40#define ULANG_PREPROCESSOR_JOIN(x, y) ULANG_PREPROCESSOR_JOIN_INNER(x, y)
41#define ULANG_PREPROCESSOR_JOIN_INNER(x, y) x##y
44#if ULANG_PLATFORM_EXTENSION
45#define ULANG_PLATFORM_HEADER_NAME(Suffix) ULANG_STRINGIFY(ULANG_PREPROCESSOR_JOIN(ULANG_PLATFORM, Suffix))
47#define ULANG_PLATFORM_HEADER_NAME(Suffix) ULANG_STRINGIFY(ULANG_PREPROCESSOR_JOIN(ULANG_PLATFORM/ULANG_PLATFORM, Suffix))
51#if ULANG_PLATFORM_EXTENSION
52#define ULANG_PLATFORM_HEADER_NAME_WITH_PREFIX(Prefix, Suffix) ULANG_STRINGIFY(Prefix/ULANG_PREPROCESSOR_JOIN(ULANG_PLATFORM, Suffix))
54#define ULANG_PLATFORM_HEADER_NAME_WITH_PREFIX(Prefix, Suffix) ULANG_STRINGIFY(Prefix/ULANG_PLATFORM/ULANG_PREPROCESSOR_JOIN(ULANG_PLATFORM, Suffix))
59#include ULANG_PLATFORM_HEADER_NAME_WITH_PREFIX(uLang/Common/Platform,Common.h)
63#define ULANG_API_VERSION 2
69 #define DLLIMPORT ULANG_DLLIMPORT
70 #define DLLEXPORT ULANG_DLLEXPORT
73#ifndef DLLIMPORT_VTABLE
74 #define DLLIMPORT_VTABLE ULANG_DLLIMPORT_VTABLE
75 #define DLLEXPORT_VTABLE ULANG_DLLEXPORT_VTABLE
81#if defined(__GNUC__) || defined(__clang__)
82 #define ULANG_THIRD_PARTY_INCLUDES_START \
83 _Pragma("GCC diagnostic push") \
84 _Pragma("GCC diagnostic ignored \"-Wundef\"") \
85 _Pragma("GCC diagnostic ignored \"-Wswitch-default\"") \
86 _Pragma("GCC diagnostic ignored \"-Wswitch-enum\"")
87 _Pragma(
"GCC diagnostic ignored \"-Wenum-compare\"")
88 #define ULANG_THIRD_PARTY_INCLUDES_END \
89 _Pragma("GCC diagnostic pop")
91 _Pragma(
"GCC diagnostic ignored \"-Wunused-function\"")
93#elif defined(_MSC_VER)
94 #pragma warning(disable: 4100)
95 #pragma warning(disable: 4127)
96 #pragma warning(disable: 4251)
97 #pragma warning(disable: 4275)
98 #pragma warning(disable: 6255)
99 #pragma warning(disable: 6326)
102 #define ULANG_THIRD_PARTY_INCLUDES_START \
103 __pragma(warning(push)) \
104 __pragma(warning(disable: 4141 4189 4244 4245 4267 4324 4458 4624 4668 6313 4389 5054))
105 #define ULANG_THIRD_PARTY_INCLUDES_END \
106 __pragma(warning(pop))
108 #define ULANG_THIRD_PARTY_INCLUDES_START
109 #define ULANG_THIRD_PARTY_INCLUDES_END
112#if defined(__clang__)
113 #define ULANG_IGNORE_CLASS_MEMACCESS_WARNING_START \
114 _Pragma("GCC diagnostic push") \
115 _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
116 _Pragma("GCC diagnostic ignored \"-Wdynamic-class-memaccess\"")
117 #define ULANG_IGNORE_CLASS_MEMACCESS_WARNING_END \
118 _Pragma("GCC diagnostic pop")
119#elif defined(__GNUC__)
120 #define ULANG_IGNORE_CLASS_MEMACCESS_WARNING_START \
121 _Pragma("GCC diagnostic push") \
122 _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
123 _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
124 _Pragma("GCC diagnostic ignored \"-Wclass-memaccess\"")
125 #define ULANG_IGNORE_CLASS_MEMACCESS_WARNING_END \
126 _Pragma("GCC diagnostic pop")
128 #define ULANG_IGNORE_CLASS_MEMACCESS_WARNING_START
129 #define ULANG_IGNORE_CLASS_MEMACCESS_WARNING_END
132#ifndef ULANG_SILENCE_SECURITY_WARNING_START
133#define ULANG_SILENCE_SECURITY_WARNING_START
135#ifndef ULANG_SILENCE_SECURITY_WARNING_END
136#define ULANG_SILENCE_SECURITY_WARNING_END
143 #define ULANG_DLLIMPORT __declspec(dllimport)
144 #define ULANG_DLLEXPORT __declspec(dllexport)
145 #define ULANG_DLLIMPORT_VTABLE
146 #define ULANG_DLLEXPORT_VTABLE
147#elif defined(__clang__)
148 #if ULANG_PLATFORM_POSIX
149 #define ULANG_DLLIMPORT __attribute__((visibility("default")))
150 #define ULANG_DLLEXPORT __attribute__((visibility("default")))
152 #define ULANG_DLLIMPORT __declspec(dllimport)
153 #define ULANG_DLLEXPORT __declspec(dllexport)
155 #define ULANG_DLLIMPORT_VTABLE __attribute__((__type_visibility__("default")))
156 #define ULANG_DLLEXPORT_VTABLE __attribute__((__type_visibility__("default")))
157#elif defined(__GNUC__)
158 #define ULANG_DLLIMPORT __attribute__((visibility("default")))
159 #define ULANG_DLLEXPORT __attribute__((visibility("default")))
160 #define ULANG_DLLIMPORT_VTABLE __attribute__((visibility("default")))
161 #define ULANG_DLLEXPORT_VTABLE __attribute__((visibility("default")))
163 #define ULANG_DLLIMPORT
164 #define ULANG_DLLEXPORT
165 #define ULANG_DLLIMPORT_VTABLE
166 #define ULANG_DLLEXPORT_VTABLE
172#if defined(__clang__) || defined(__GNUC__)
173 #define ULANG_GCC_PACK(n) __attribute__((packed,aligned(n)))
174 #define ULANG_GCC_ALIGN(n) __attribute__((aligned(n)))
176 #define ULANG_GCC_PACK(n)
177 #define ULANG_GCC_ALIGN(n)
180 #define ULANG_MS_ALIGN(n) __declspec(align(n))
182 #define ULANG_MS_ALIGN(n)
188#define ULANG_FORCEINLINE inline
189#define ULANG_FORCENOINLINE
193 #define ULANG_FORCEINLINE __forceinline
194 #define ULANG_FORCENOINLINE __declspec(noinline)
195#elif defined(__clang__) || defined(__GNUC__)
196 #define ULANG_FORCEINLINE inline __attribute__ ((always_inline))
197 #define ULANG_FORCENOINLINE __attribute__((noinline))
199 #define ULANG_FORCEINLINE inline
200 #define ULANG_FORCENOINLINE
207#define ULANG_RESTRICT __restrict
212#if defined(__clang__) || defined(__GNUC__)
213 #define ULANG_LIKELY(x) __builtin_expect(!!(x), 1)
214 #define ULANG_UNLIKELY(x) __builtin_expect(!!(x), 0)
216 #define ULANG_LIKELY(x) (x)
217 #define ULANG_UNLIKELY(x) (x)
223#if defined(_MSC_VER) && (_MSC_VER >= 1400)
224 #define ULANG_COUNTOF(x) _countof(x)
226 #define ULANG_COUNTOF(x) (sizeof(x)/sizeof(x[0]))
232#if __cplusplus >= 201703L
233 #define ULANG_FALLTHROUGH [[fallthrough]]
234#elif defined(__GNUC__) && __GNUC__ >= 7 && !defined(__clang__)
235 #define ULANG_FALLTHROUGH __attribute__((fallthrough))
237 #define ULANG_FALLTHROUGH
243#define ULANG_UNREACHABLE() while(true) { ULANG_BREAK(); }
248#if defined( __clang_analyzer__ )
253 #define ULANG_CA_ASSUME(Expr) (__builtin_expect(!bool(Expr), 0) ? ULANG_CA_AssumeNoReturn() : (void)0)
254#elif defined( _PREFAST_ ) || defined( PVS_STUDIO )
255 #define ULANG_CA_ASSUME(Expr) __analysis_assume( !!( Expr ) )
257 #define ULANG_CA_ASSUME(Expr) ((void)Expr)
268 #define ULANG_ASSERT(expr) { if (ULANG_UNLIKELY((bool)!(expr))) { if ((*::uLang::GetSystemParams()._AssertFailed)(::uLang::EAssertSeverity::Fatal, #expr, __FILE__, __LINE__, "") == ::uLang::EErrorAction::Break) { ULANG_BREAK(); } ULANG_CA_ASSUME(false); } }
269 #define ULANG_VERIFY(expr) { if (ULANG_UNLIKELY((bool)!(expr)) && (*::uLang::GetSystemParams()._AssertFailed)(::uLang::EAssertSeverity::Recoverable, #expr, __FILE__, __LINE__, "") == ::uLang::EErrorAction::Break) ULANG_BREAK(); }
270 #define ULANG_ENSURE(expr) ( ULANG_LIKELY(!!(expr)) || (\
271 ( ((*::uLang::GetSystemParams()._AssertFailed)(::uLang::EAssertSeverity::Recoverable, #expr, __FILE__, __LINE__, "") == ::uLang::EErrorAction::Break) && \
272 ([] ()->bool { ULANG_BREAK(); return false; } ()) \
276 #define ULANG_ERRORF(format, ...) { if ((*::uLang::GetSystemParams()._AssertFailed)(::uLang::EAssertSeverity::Fatal, "", __FILE__, __LINE__, format, ##__VA_ARGS__) == ::uLang::EErrorAction::Break) ULANG_BREAK(); }
277 #define ULANG_ASSERTF(expr, format, ...) { if (ULANG_UNLIKELY((bool)!(expr))) { if ((*::uLang::GetSystemParams()._AssertFailed)(::uLang::EAssertSeverity::Fatal, #expr, __FILE__, __LINE__, format, ##__VA_ARGS__) == ::uLang::EErrorAction::Break) { ULANG_BREAK(); } ULANG_CA_ASSUME(false); } }
278 #define ULANG_VERIFYF(expr, format, ...) { if (ULANG_UNLIKELY((bool)!(expr)) && (*::uLang::GetSystemParams()._AssertFailed)(::uLang::EAssertSeverity::Recoverable, #expr, __FILE__, __LINE__, format, ##__VA_ARGS__) == ::uLang::EErrorAction::Break) ULANG_BREAK(); }
279 #define ULANG_ENSUREF(expr, format, ...) ( ULANG_LIKELY(!!(expr)) || (\
280 ( ((*::uLang::GetSystemParams()._AssertFailed)(::uLang::EAssertSeverity::Recoverable, #expr, __FILE__, __LINE__, format, ##__VA_ARGS__) == ::uLang::EErrorAction::Break) && \
281 ([] ()->bool { ULANG_BREAK(); return false; } ()) \
285 #define ULANG_ASSERT(expr) (void(sizeof(!!(expr))))
286 #define ULANG_VERIFY(expr) (void(sizeof(!!(expr))))
287 #define ULANG_ENSURE(expr) (!!(expr))
289 #define ULANG_ERRORF(format, ...) (void(0))
290 #define ULANG_ASSERTF(expr, format, ...) (void(sizeof(!!(expr))))
291 #define ULANG_VERIFYF(expr, format, ...) (void(sizeof(!!(expr))))
292 #define ULANG_ENSUREF(expr, format, ...) (!!(expr))
298#define VERSE_SUPPRESS_UNUSED(_Variable) (void)(_Variable);
301#define USING_ELogVerbosity \
302 constexpr uLang::ELogVerbosity Error = uLang::ELogVerbosity::Error; VERSE_SUPPRESS_UNUSED(Error) \
303 constexpr uLang::ELogVerbosity Warning = uLang::ELogVerbosity::Warning; VERSE_SUPPRESS_UNUSED(Warning) \
304 constexpr uLang::ELogVerbosity Display = uLang::ELogVerbosity::Display; VERSE_SUPPRESS_UNUSED(Display) \
305 constexpr uLang::ELogVerbosity Log = uLang::ELogVerbosity::Log; VERSE_SUPPRESS_UNUSED(Log) \
306 constexpr uLang::ELogVerbosity Verbose = uLang::ELogVerbosity::Verbose; VERSE_SUPPRESS_UNUSED(Verbose) \
308#define ULANG_LOGF(verbosity, format, ...) \
309 { USING_ELogVerbosity \
310 (*::uLang::GetSystemParams()._LogMessage)(verbosity, format, ##__VA_ARGS__); \
316#if !defined(ULANG_AGGRESSIVE_MEMORY_SAVING)
317 #define ULANG_AGGRESSIVE_MEMORY_SAVING 0
436class CAllocatorInstance;
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
float swift_float2 __attribute__((__ext_vector_type__(2)))
Definition MarketplaceKitWrapper.h:67
const bool
Definition NetworkReplayStreaming.h:178
Definition MemoryBase.h:99
Definition Allocator.h:35
Definition GenericPlatformFile.h:25
Definition VVMEngineEnvironment.h:23
std::nullptr_t NullPtrType
Definition Common.h:325
bool Boolean
Default size for uLang Float Type.
Definition Common.h:331
EDefaultInit
Enum used to force default initialization.
Definition Common.h:378
@ DefaultInit
Definition Common.h:378
EResult
Generic error codes.
Definition Common.h:352
@ Unspecified
Not sure if success or failure.
@ Error
Some error occurred.
SSystemParams & GetSystemParams()
Global variable for efficient access.
Definition Common.cpp:9
bool IsInitialized()
Definition Common.cpp:39
const CAllocatorInstance GSystemAllocatorInstance([](const CAllocatorInstance *, size_t NumBytes) -> void *{ return GetSystemParams()._HeapMalloc(NumBytes);}, [](const CAllocatorInstance *, void *Memory, size_t NumBytes) -> void *{ return GetSystemParams()._HeapRealloc(Memory, NumBytes);}, [](const CAllocatorInstance *, void *Memory) { GetSystemParams()._HeapFree(Memory);})
Definition Common.h:437
EIterateResult
Iteration result returned from an iteration.
Definition Common.h:345
bool operator==(const SSystemParams &Lhs, const SSystemParams &Rhs)
Definition Common.cpp:21
EAssertSeverity
Definition Common.h:387
EIndex
Used to signify an unspecified index.
Definition Common.h:381
@ IndexNone
Definition Common.h:381
ENoInit
Enum used in constructors to indicate they should not initialize anything.
Definition Common.h:375
@ NoInit
Definition Common.h:375
ELogVerbosity
Definition Common.h:393
int64_t Integer
Definition Common.h:329
const uint32_t uint32_invalid
Default size for uLang Boolean Type.
Definition Common.h:333
EErrorAction
Generic action after error has occurred.
Definition Common.h:360
EEquate
Definition Common.h:367
EVisitResult
Result returned from a visitor functor indicating how to continue or to quit early.
Definition Common.h:337
EResult DeInitialize()
Definition Common.cpp:44
void SetGlobalVerbosity(const uLang::ELogVerbosity GlobalVerbosity)
Definition Common.cpp:49
double Float
Default size for uLang Integer Type.
Definition Common.h:330
Parameters to initialize the uLang module.
Definition Common.h:403
ELogVerbosity _Verbosity
Won't print anything under the _Verbosity level.
Definition Common.h:420
void(*)(void *) FFree
Definition Common.h:406
FRealloc _HeapRealloc
Reallocate system heap memory.
Definition Common.h:414
SSystemParams(int APIVersion, FMalloc HeapMalloc, FRealloc HeapRealloc, FFree HeapFree, FAssert AssertFailed, FLog LogMessage=nullptr)
Definition Common.h:422
int _APIVersion
Set this to ULANG_API_VERSION.
Definition Common.h:411
EErrorAction(*)(EAssertSeverity, const char *, const char *, int32_t, const char *,...) FAssert
Definition Common.h:408
void(*)(ELogVerbosity, const char *,...) FLog
Definition Common.h:409
FFree _HeapFree
Free system heap memory.
Definition Common.h:415
void *(*)(void *, size_t) FRealloc
Definition Common.h:405
FLog _LogMessage
Print a message.
Definition Common.h:418
FAssert _AssertFailed
Called when an assert fails.
Definition Common.h:417
FMalloc _HeapMalloc
Allocate system heap memory.
Definition Common.h:413