mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-08 08:38:47 +00:00
base progress
This commit is contained in:
Vendored
+3
-1
@@ -11,6 +11,8 @@
|
|||||||
"algorithm": "cpp",
|
"algorithm": "cpp",
|
||||||
"optional": "cpp",
|
"optional": "cpp",
|
||||||
"type_traits": "cpp",
|
"type_traits": "cpp",
|
||||||
"xtr1common": "cpp"
|
"xtr1common": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"xmemory": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifdef MD_INTELLISENSE_DIRECTIVES
|
#ifdef MD_INTELLISENSE_DIRECTIVES
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "base_types.h"
|
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
#include "base_types.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Copyright (c) 2024 Epic Games Tools
|
// Copyright (c) 2024 Epic Games Tools
|
||||||
@@ -59,7 +59,8 @@ struct TempArena
|
|||||||
//- rjf: arena creation/destruction
|
//- rjf: arena creation/destruction
|
||||||
internal Arena* arena_alloc_(ArenaParams *params);
|
internal Arena* arena_alloc_(ArenaParams *params);
|
||||||
#define arena_alloc(...) arena_alloc_( & ( ArenaParams) { .reserve_size = MB(64), .commit_size = KB(64), __VA_ARGS__ } )
|
#define arena_alloc(...) arena_alloc_( & ( ArenaParams) { .reserve_size = MB(64), .commit_size = KB(64), __VA_ARGS__ } )
|
||||||
internal void rarena_release(Arena *arena);
|
|
||||||
|
internal void arena_release(Arena *arena);
|
||||||
|
|
||||||
//- rjf: arena push/pop/pos core functions
|
//- rjf: arena push/pop/pos core functions
|
||||||
internal void *arena_push(Arena *arena, U64 size, U64 align);
|
internal void *arena_push(Arena *arena, U64 size, U64 align);
|
||||||
@@ -76,6 +77,6 @@ internal void temp_arena_end(TempArena temp);
|
|||||||
|
|
||||||
//- rjf: push helper macros
|
//- rjf: push helper macros
|
||||||
#define push_array_no_zero_aligned(a, T, c, align) (T *)arena_push((a), sizeof(T)*(c), (align))
|
#define push_array_no_zero_aligned(a, T, c, align) (T *)arena_push((a), sizeof(T)*(c), (align))
|
||||||
#define push_array_aligned(a, T, c, align) (T *)MemoryZero(push_array_no_zero_aligned(a, T, c, align), sizeof(T)*(c))
|
#define push_array_aligned(a, T, c, align) (T *)memory_zero(push_array_no_zero_aligned(a, T, c, align), sizeof(T)*(c))
|
||||||
#define push_array_no_zero(a, T, c) push_array_no_zero_aligned(a, T, c, Max(8, AlignOf(T)))
|
#define push_array_no_zero(a, T, c) push_array_no_zero_aligned(a, T, c, max(8, align_of(T)))
|
||||||
#define push_array(a, T, c) push_array_aligned(a, T, c, Max(8, AlignOf(T)))
|
#define push_array(a, T, c) push_array_aligned(a, T, c, max(8, align_of(T)))
|
||||||
@@ -0,0 +1,259 @@
|
|||||||
|
#if MD_INTELLISENSE_DIRECTIVES
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma region Compiler Vendor
|
||||||
|
|
||||||
|
#if defined( _MSC_VER )
|
||||||
|
# pragma message("Detected MSVC")
|
||||||
|
// # define MD_COMPILER_CLANG 0
|
||||||
|
# define MD_COMPILER_MSVC 1
|
||||||
|
// # define MD_COMPILER_GCC 0
|
||||||
|
# if _MSC_VER >= 1920
|
||||||
|
# define MD_COMPILER_MSVC_YEAR 2019
|
||||||
|
# elif _MSC_VER >= 1910
|
||||||
|
# define MD_COMPILER_MSVC_YEAR 2017
|
||||||
|
# elif _MSC_VER >= 1900
|
||||||
|
# define MD_COMPILER_MSVC_YEAR 2015
|
||||||
|
# elif _MSC_VER >= 1800
|
||||||
|
# define MD_COMPILER_MSVC_YEAR 2013
|
||||||
|
# elif _MSC_VER >= 1700
|
||||||
|
# define MD_COMPILER_MSVC_YEAR 2012
|
||||||
|
# elif _MSC_VER >= 1600
|
||||||
|
# define MD_COMPILER_MSVC_YEAR 2010
|
||||||
|
# elif _MSC_VER >= 1500
|
||||||
|
# define M_DCOMPILER_MSVC_YEAR 2008
|
||||||
|
# elif _MSC_VER >= 1400
|
||||||
|
# define MD_COMPILER_MSVC_YEAR 2005
|
||||||
|
# else
|
||||||
|
# define MD_COMPILER_MSVC_YEAR 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#elif defined( __GNUC__ )
|
||||||
|
# pragma message("Detected GCC")
|
||||||
|
// # define MD_COMPILER_CLANG 0
|
||||||
|
// # define MD_COMPILER_MSVC 0
|
||||||
|
# define MD_COMPILER_GCC 1
|
||||||
|
#elif defined( __clang__ )
|
||||||
|
# pragma message("Detected CLANG")
|
||||||
|
# define MD_COMPILER_CLANG 1
|
||||||
|
// # define MD_COMPILER_MSVC 0
|
||||||
|
// # define MD_COMPILER_GCC 0
|
||||||
|
#else
|
||||||
|
# error Unknown compiler
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( __has_attribute )
|
||||||
|
# define MD_HAS_ATTRIBUTE( attribute ) __has_attribute( attribute )
|
||||||
|
#else
|
||||||
|
# define MD_HAS_ATTRIBUTE( attribute ) ( 0 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MD_GCC_VERSION_CHECK)
|
||||||
|
# undef MD_GCC_VERSION_CHECK
|
||||||
|
#endif
|
||||||
|
#if defined(GEN_GCC_VERSION)
|
||||||
|
# define MD_GCC_VERSION_CHECK(major,minor,patch) (GEN_GCC_VERSION >= GEN_VERSION_ENCODE(major, minor, patch))
|
||||||
|
#else
|
||||||
|
# define MD_GCC_VERSION_CHECK(major,minor,patch) (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma endregion Compiler Vendor
|
||||||
|
|
||||||
|
#pragma endregion Language
|
||||||
|
|
||||||
|
#if ! defined(MD_LANG_C)
|
||||||
|
# ifdef __cplusplus
|
||||||
|
# define MD_LANG_C 0
|
||||||
|
# define MD_LANG_CPP 1
|
||||||
|
# else
|
||||||
|
# if defined(__STDC__)
|
||||||
|
# define MD_LANG_C 1
|
||||||
|
# define MD_LANG_CPP 0
|
||||||
|
# else
|
||||||
|
// Fallback for very old C compilers
|
||||||
|
# define MD_LANG_C 1
|
||||||
|
# define MD_LANG_CPP 0
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MD_LANG_C
|
||||||
|
# pragma message("MD: Detected C")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MD_LANG_CPP
|
||||||
|
# pragma message("MD: Detected CPP")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma endregion Langauge
|
||||||
|
|
||||||
|
#pragma region Hardware Architecture
|
||||||
|
|
||||||
|
#if MD_COMPILER_CLANG
|
||||||
|
# if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
|
||||||
|
# define MD_ARCH_X64 1
|
||||||
|
# elif defined(i386) || defined(__i386) || defined(__i386__)
|
||||||
|
# define MD_ARCH_X86 1
|
||||||
|
# elif defined(__aarch64__)
|
||||||
|
# define MD_ARCH_ARM64 1
|
||||||
|
# elif defined(__arm__)
|
||||||
|
# define MD_ARCH_ARM32 1
|
||||||
|
# else
|
||||||
|
# error Architecture not supported.
|
||||||
|
# endif
|
||||||
|
#endif // MD_COMPILER_CLANG
|
||||||
|
|
||||||
|
#if MD_COMPILER_MSVC
|
||||||
|
# if defined(_M_AMD64)
|
||||||
|
# define MD_ARCH_X64 1
|
||||||
|
# elif defined(_M_IX86)
|
||||||
|
# define MD_ARCH_X86 1
|
||||||
|
# elif defined(_M_ARM64)
|
||||||
|
# define MD_ARCH_ARM64 1
|
||||||
|
# elif defined(_M_ARM)
|
||||||
|
# define MD_ARCH_ARM32 1
|
||||||
|
# else
|
||||||
|
# error Architecture not supported.
|
||||||
|
# endif
|
||||||
|
#endif // MD_COMPILER_MSVC
|
||||||
|
|
||||||
|
#if MD_COMPILER_GCC
|
||||||
|
# if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
|
||||||
|
# define MD_ARCH_X64 1
|
||||||
|
# elif defined(i386) || defined(__i386) || defined(__i386__)
|
||||||
|
# define MD_ARCH_X86 1
|
||||||
|
# elif defined(__aarch64__)
|
||||||
|
# define MD_ARCH_ARM64 1
|
||||||
|
# elif defined(__arm__)
|
||||||
|
# define MD_ARCH_ARM32 1
|
||||||
|
# else
|
||||||
|
# error Architecture not supported.
|
||||||
|
# endif
|
||||||
|
#endif // MD_COMPILER_GCC
|
||||||
|
|
||||||
|
#if defined(MD_ARCH_X64)
|
||||||
|
# define MD_ARCH_64BIT 1
|
||||||
|
#elif defined(MD_ARCH_X86)
|
||||||
|
# define MD_ARCH_32BIT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MD_ARCH_ARM32 || MD_ARCH_ARM64 || MD_ARCH_X64 || MD_ARCH_X86
|
||||||
|
# define MD_ARCH_LITTLE_ENDIAN 1
|
||||||
|
#else
|
||||||
|
# error Endianness of this architecture not understood by context cracker.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma endregion Hardware Architecture
|
||||||
|
|
||||||
|
#pragma region Operating System
|
||||||
|
|
||||||
|
#if defined( _WIN32 ) || defined( _WIN64 )
|
||||||
|
# ifndef MD_OS_WINDOWS
|
||||||
|
# define MD_OS_WINDOWS 1
|
||||||
|
# endif
|
||||||
|
#elif defined( __APPLE__ ) && defined( __MACH__ )
|
||||||
|
# ifndef MD_OS_OSX
|
||||||
|
# define MD_OS_OSX 1
|
||||||
|
# endif
|
||||||
|
# ifndef MD_OS_MACOS
|
||||||
|
# define MD_OS_MACOS 1
|
||||||
|
# endif
|
||||||
|
#elif defined( __unix__ )
|
||||||
|
# ifndef MD_OS_UNIX
|
||||||
|
# define MD_OS_UNIX 1
|
||||||
|
# endif
|
||||||
|
# if defined( ANDROID ) || defined( __ANDROID__ )
|
||||||
|
# ifndef MD_OS_ANDROID
|
||||||
|
# define MD_OS_ANDROID 1
|
||||||
|
# endif
|
||||||
|
# ifndef MD_OS_LINUX
|
||||||
|
# define MD_OS_LINUX 1
|
||||||
|
# endif
|
||||||
|
# elif defined( __linux__ )
|
||||||
|
# ifndef MD_OS_LINUX
|
||||||
|
# define MD_OS_LINUX 1
|
||||||
|
# endif
|
||||||
|
# elif defined( __FreeBSD__ ) || defined( __FreeBSD_kernel__ )
|
||||||
|
# ifndef MD_OS_FREEBSD
|
||||||
|
# define MD_OS_FREEBSD 1
|
||||||
|
# endif
|
||||||
|
# elif defined( __OpenBSD__ )
|
||||||
|
# ifndef MD_OS_OPENBSD
|
||||||
|
# define MD_OS_OPENBSD 1
|
||||||
|
# endif
|
||||||
|
# elif defined( __EMSCRIPTEN__ )
|
||||||
|
# ifndef MD_OS_EMSCRIPTEN
|
||||||
|
# define MD_OS_EMSCRIPTEN 1
|
||||||
|
# endif
|
||||||
|
# elif defined( __CYGWIN__ )
|
||||||
|
# ifndef MD_OS_CYGWIN
|
||||||
|
# define MD_OS_CYGWIN 1
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# error This UNIX operating system is not supported
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# error This operating system is not supported
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma endregion Operating System
|
||||||
|
|
||||||
|
#pragma region Language
|
||||||
|
#pragma endregion Langage
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Zero All Undefined Options
|
||||||
|
|
||||||
|
#if !defined(MD_ARCH_32BIT)
|
||||||
|
# define MD_ARCH_32BIT 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_ARCH_64BIT)
|
||||||
|
# define MD_ARCH_64BIT 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_ARCH_X64)
|
||||||
|
# define MD_ARCH_X64 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_ARCH_X86)
|
||||||
|
# define MD_ARCH_X86 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_ARCH_ARM64)
|
||||||
|
# define MD_ARCH_ARM64 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_ARCH_ARM32)
|
||||||
|
# define MD_ARCH_ARM32 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_COMPILER_MSVC)
|
||||||
|
# define MD_COMPILER_MSVC 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD-COMPILER_GCC)
|
||||||
|
# define MD_COMPILER_GCC 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_COMPILER_CLANG)
|
||||||
|
# define MD_COMPILER_CLANG 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_OS_WINDOWS)
|
||||||
|
# define MD_OS_WINDOWS 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_OS_LINUX)
|
||||||
|
# define MD_OS_LINUX 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_OS_MAC)
|
||||||
|
# define MD_OS_MAC 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_LANG_CPP)
|
||||||
|
# define MD_LANG_CPP 0
|
||||||
|
#endif
|
||||||
|
#if !defined(MD_LANG_C)
|
||||||
|
# define MD_LANG_C 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Unsupported Errors
|
||||||
|
|
||||||
|
#if MD_ARCH_X86
|
||||||
|
# error You tried to build in x86 (32 bit) mode, but currently, only building in x64 (64 bit) mode is supported.
|
||||||
|
#endif
|
||||||
|
#if ! MD_ARCH_X64
|
||||||
|
# error You tried to build with an unsupported architecture. Currently, only building in x64 mode is supported.
|
||||||
|
#endif
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#if MD_INTELLISENSE_DIRECTIVES
|
|
||||||
#pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined( _WIN64 ) || defined( __x86_64__ ) || defined( _M_X64 ) || defined( __64BIT__ ) || defined( __powerpc64__ ) || defined( __ppc64__ ) || defined( __aarch64__ )
|
|
||||||
# ifndef MD_ARCH_64_BIT
|
|
||||||
# define MD_ARCH_64_BIT 1
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# ifndef MD_ARCH_32_BIT
|
|
||||||
# define MD_ARCH_32_BIT 1
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
#if MD_INTELLISENSE_DIRECTIVES
|
|
||||||
#pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined( _MSC_VER )
|
|
||||||
# pragma message("Detected MSVC")
|
|
||||||
// # define MD_COMPILER_CLANG 0
|
|
||||||
# define MD_COMPILER_MSVC 1
|
|
||||||
// # define MD_COMPILER_GCC 0
|
|
||||||
#elif defined( __GNUC__ )
|
|
||||||
# pragma message("Detected GCC")
|
|
||||||
// # define MD_COMPILER_CLANG 0
|
|
||||||
// # define MD_COMPILER_MSVC 0
|
|
||||||
# define MD_COMPILER_GCC 1
|
|
||||||
#elif defined( __clang__ )
|
|
||||||
# pragma message("Detected CLANG")
|
|
||||||
# define MD_COMPILER_CLANG 1
|
|
||||||
// # define MD_COMPILER_MSVC 0
|
|
||||||
// # define MD_COMPILER_GCC 0
|
|
||||||
#else
|
|
||||||
# error Unknown compiler
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined( __has_attribute )
|
|
||||||
# define MD_HAS_ATTRIBUTE( attribute ) __has_attribute( attribute )
|
|
||||||
#else
|
|
||||||
# define MD_HAS_ATTRIBUTE( attribute ) ( 0 )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MD_GCC_VERSION_CHECK)
|
|
||||||
# undef MD_GCC_VERSION_CHECK
|
|
||||||
#endif
|
|
||||||
#if defined(GEN_GCC_VERSION)
|
|
||||||
# define MD_GCC_VERSION_CHECK(major,minor,patch) (GEN_GCC_VERSION >= GEN_VERSION_ENCODE(major, minor, patch))
|
|
||||||
#else
|
|
||||||
# define MD_GCC_VERSION_CHECK(major,minor,patch) (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ! defined(MD_COMPILER_C)
|
|
||||||
# ifdef __cplusplus
|
|
||||||
# define MD_COMPILER_C 0
|
|
||||||
# define MD_COMPILER_CPP 1
|
|
||||||
# else
|
|
||||||
# if defined(__STDC__)
|
|
||||||
# define MD_COMPILER_C 1
|
|
||||||
# define MD_COMPILER_CPP 0
|
|
||||||
# else
|
|
||||||
// Fallback for very old C compilers
|
|
||||||
# define MD_COMPILER_C 1
|
|
||||||
# define MD_COMPILER_CPP 0
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MD_COMPILER_C
|
|
||||||
#pragma message("MD: Detected C")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MD_COMPILER_CPP
|
|
||||||
#pragma message("MD: Detected CPP")
|
|
||||||
#endif
|
|
||||||
@@ -1,52 +1,3 @@
|
|||||||
#if MD_INTELLISENSE_DIRECTIVES
|
#if MD_INTELLISENSE_DIRECTIVES
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( _WIN32 ) || defined( _WIN64 )
|
|
||||||
# ifndef MD_OS_WINDOWS
|
|
||||||
# define MD_OS_WINDOWS 1
|
|
||||||
# endif
|
|
||||||
#elif defined( __APPLE__ ) && defined( __MACH__ )
|
|
||||||
# ifndef MD_OS_OSX
|
|
||||||
# define MD_OS_OSX 1
|
|
||||||
# endif
|
|
||||||
# ifndef MD_OS_MACOS
|
|
||||||
# define MD_OS_MACOS 1
|
|
||||||
# endif
|
|
||||||
#elif defined( __unix__ )
|
|
||||||
# ifndef MD_OS_UNIX
|
|
||||||
# define MD_OS_UNIX 1
|
|
||||||
# endif
|
|
||||||
# if defined( ANDROID ) || defined( __ANDROID__ )
|
|
||||||
# ifndef MD_OS_ANDROID
|
|
||||||
# define MD_OS_ANDROID 1
|
|
||||||
# endif
|
|
||||||
# ifndef MD_OS_LINUX
|
|
||||||
# define MD_OS_LINUX 1
|
|
||||||
# endif
|
|
||||||
# elif defined( __linux__ )
|
|
||||||
# ifndef MD_OS_LINUX
|
|
||||||
# define MD_OS_LINUX 1
|
|
||||||
# endif
|
|
||||||
# elif defined( __FreeBSD__ ) || defined( __FreeBSD_kernel__ )
|
|
||||||
# ifndef MD_OS_FREEBSD
|
|
||||||
# define MD_OS_FREEBSD 1
|
|
||||||
# endif
|
|
||||||
# elif defined( __OpenBSD__ )
|
|
||||||
# ifndef MD_OS_OPENBSD
|
|
||||||
# define MD_OS_OPENBSD 1
|
|
||||||
# endif
|
|
||||||
# elif defined( __EMSCRIPTEN__ )
|
|
||||||
# ifndef MD_OS_EMSCRIPTEN
|
|
||||||
# define MD_OS_EMSCRIPTEN 1
|
|
||||||
# endif
|
|
||||||
# elif defined( __CYGWIN__ )
|
|
||||||
# ifndef MD_OS_CYGWIN
|
|
||||||
# define MD_OS_CYGWIN 1
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# error This UNIX operating system is not supported
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# error This operating system is not supported
|
|
||||||
#endif
|
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Branch Predictor Hints
|
//~ rjf: Branch Predictor Hints
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if MD_COMPILER_CLANG
|
||||||
# define expect(expr, val) __builtin_expect((expr), (val))
|
# define expect(expr, val) __builtin_expect((expr), (val))
|
||||||
#else
|
#else
|
||||||
# define expect(expr, val) (expr)
|
# define expect(expr, val) (expr)
|
||||||
|
|||||||
+44
-16
@@ -147,16 +147,36 @@
|
|||||||
#define set_nil(nil,p) ((p) = nil)
|
#define set_nil(nil,p) ((p) = nil)
|
||||||
|
|
||||||
//- rjf: doubly-linked-lists
|
//- rjf: doubly-linked-lists
|
||||||
#define dll_insert_npz(nil, f, l, p, n, next, prev) \
|
#define dll_insert_npz(nil, f, l, p, n, next, prev) ( \
|
||||||
(check_nil(nil, f) ? \
|
check_nil(nil, f) ? ( \
|
||||||
((f) = (l) = (n), set_nil(nil, (n)->next), set_nil(nil, (n)->prev)) \
|
(f) = (l) = (n), \
|
||||||
: CheckNil(nil,p) ? \
|
set_nil(nil, (n)->next), \
|
||||||
((n)->next = (f), (f)->prev = (n), (f) = (n), SetNil(nil,(n)->prev)) \
|
set_nil(nil, (n)->prev) \
|
||||||
: ((p) == (l)) ? \
|
) \
|
||||||
((l)->next = (n), (n)->prev = (l), (l) = (n), SetNil(nil, (n)->next)) \
|
: ( \
|
||||||
: ( ((!CheckNil(nil, p) && CheckNil(nil, (p)->next) ) ? \
|
check_nil(nil,p) ? ( \
|
||||||
|
(n)->next = (f), \
|
||||||
|
(f)->prev = (n), \
|
||||||
|
(f) = (n), \
|
||||||
|
set_nil(nil,(n)->prev) \
|
||||||
|
) \
|
||||||
|
: ((p) == (l)) ? ( \
|
||||||
|
(l)->next = (n), \
|
||||||
|
(n)->prev = (l), \
|
||||||
|
(l) = (n), \
|
||||||
|
set_nil(nil, (n)->next) \
|
||||||
|
) \
|
||||||
|
: ( \
|
||||||
|
( \
|
||||||
|
( ! check_nil(nil, p) && check_nil(nil, (p)->next) ) ? \
|
||||||
(0) \
|
(0) \
|
||||||
: ((p)->next->prev = (n))), ((n)->next = (p)->next), ((p)->next = (n)), ((n)->prev = (p))) \
|
: ( (p)->next->prev = (n) ) \
|
||||||
|
), \
|
||||||
|
((n)->next = (p)->next), \
|
||||||
|
((p)->next = (n)), \
|
||||||
|
((n)->prev = (p)) \
|
||||||
|
) \
|
||||||
|
) \
|
||||||
) \
|
) \
|
||||||
|
|
||||||
#define dll_push_back_npz(nil, f, l, n, next, prev) dll_insert_npz(nil, f, l, l, n, next, prev)
|
#define dll_push_back_npz(nil, f, l, n, next, prev) dll_insert_npz(nil, f, l, l, n, next, prev)
|
||||||
@@ -173,13 +193,21 @@
|
|||||||
(l) = (l)->prev \
|
(l) = (l)->prev \
|
||||||
: (0) \
|
: (0) \
|
||||||
), \
|
), \
|
||||||
(CheckNil(nil,(n)->prev) ? (0) :\
|
( \
|
||||||
((n)->prev->next = (n)->next)),\
|
CheckNil(nil,(n)->prev) ? \
|
||||||
(CheckNil(nil,(n)->next) ? (0) :\
|
(0) \
|
||||||
((n)->next->prev = (n)->prev)))
|
: ((n)->prev->next = (n)->next) \
|
||||||
|
), \
|
||||||
|
( \
|
||||||
|
CheckNil(nil,(n)->next) ? \
|
||||||
|
(0) \
|
||||||
|
: ((n)->next->prev = (n)->prev) \
|
||||||
|
) \
|
||||||
|
)
|
||||||
|
|
||||||
//- rjf: singly-linked, doubly-headed lists (queues)
|
//- rjf: singly-linked, doubly-headed lists (queues)
|
||||||
#define SLLQueuePush_NZ(nil,f,l,n,next) (CheckNil(nil,f)?\
|
#define SLLQueuePush_NZ(nil,f,l,n,next) ( \
|
||||||
|
CheckNil(nil,f)?\
|
||||||
((f)=(l)=(n),SetNil(nil,(n)->next)):\
|
((f)=(l)=(n),SetNil(nil,(n)->next)):\
|
||||||
((l)->next=(n),(l)=(n),SetNil(nil,(n)->next)))
|
((l)->next=(n),(l)=(n),SetNil(nil,(n)->next)))
|
||||||
#define SLLQueuePushFront_NZ(nil,f,l,n,next) (CheckNil(nil,f)?\
|
#define SLLQueuePushFront_NZ(nil,f,l,n,next) (CheckNil(nil,f)?\
|
||||||
@@ -238,8 +266,8 @@
|
|||||||
|
|
||||||
#if ASAN_ENABLED
|
#if ASAN_ENABLED
|
||||||
#pragma comment(lib, "clang_rt.asan-x86_64.lib")
|
#pragma comment(lib, "clang_rt.asan-x86_64.lib")
|
||||||
C_LINKAGE void __asan_poison_memory_region(void const volatile *addr, size_t size);
|
MD_C_API void __asan_poison_memory_region(void const volatile *addr, size_t size);
|
||||||
C_LINKAGE void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
|
MD_C_API void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
|
||||||
# define AsanPoisonMemoryRegion(addr, size) __asan_poison_memory_region((addr), (size))
|
# define AsanPoisonMemoryRegion(addr, size) __asan_poison_memory_region((addr), (size))
|
||||||
# define AsanUnpoisonMemoryRegion(addr, size) __asan_unpoison_memory_region((addr), (size))
|
# define AsanUnpoisonMemoryRegion(addr, size) __asan_unpoison_memory_region((addr), (size))
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -119,4 +119,3 @@ constexpr AllocatorInfo heap( void ) { AllocatorInfo allocator = { heap_allocato
|
|||||||
|
|
||||||
//! Helper to free memory allocated by heap allocator.
|
//! Helper to free memory allocated by heap allocator.
|
||||||
#define mfree( ptr ) free( heap(), ptr )
|
#define mfree( ptr ) free( heap(), ptr )
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifdef MD_INTELLISENSE_DIRECTIVES
|
#ifdef MD_INTELLISENSE_DIRECTIVES
|
||||||
# pragma once
|
# pragma once
|
||||||
#include "cracking_arch.h"
|
# include "cracking_compiler.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// C++ namespace support
|
// C++ namespace support
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#else
|
#else
|
||||||
namespace MD {}
|
namespace MD {}
|
||||||
namespace md = MD;
|
namespace md = MD;
|
||||||
|
|
||||||
# define MD_NS MD::
|
# define MD_NS MD::
|
||||||
# define MD_NS_BEGIN namespace MD {
|
# define MD_NS_BEGIN namespace MD {
|
||||||
# define MD_NS_END }
|
# define MD_NS_END }
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
#if MD_INTELLISENSE_DIRECTIVES
|
#if MD_INTELLISENSE_DIRECTIVES
|
||||||
# pragma once
|
# pragma once
|
||||||
#include "cracking_arch.h"
|
# include "context_cracking.h"
|
||||||
#include "cracking_os.h"
|
|
||||||
#include "cracking_compiler.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma region Mandatory Includes
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
@@ -18,5 +14,3 @@
|
|||||||
# include <assert.h>
|
# include <assert.h>
|
||||||
# include <stdbool.h>
|
# include <stdbool.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma endregion Mandatory Includes
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#ifdef MD_INTELLISENSE_DIRECTIVES
|
||||||
|
#include "text.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#ifdef MD_INTELLISENSE_DIRECTIVES
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#ifdef MD_INTELLISENSE_DIRECTIVES
|
||||||
|
#include "toolchain.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// metadesk source: intended for "As-Is" library usage
|
||||||
|
|
||||||
|
#include "metadesk.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -2,12 +2,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// base outline
|
// metadesk header: intended for "As-Is" library usage
|
||||||
// intended for "As-Is" library usage
|
|
||||||
|
|
||||||
#include "base/cracking_arch.h"
|
// base
|
||||||
#include "base/cracking_compiler.h"
|
|
||||||
#include "base/cracking_os.h"
|
#include "base/context_cracking.h"
|
||||||
#include "base/linkage.h"
|
#include "base/linkage.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/namespace.h"
|
#include "base/namespace.h"
|
||||||
@@ -15,10 +14,17 @@
|
|||||||
|
|
||||||
MD_NS_BEGIN
|
MD_NS_BEGIN
|
||||||
|
|
||||||
#include "os.h"
|
|
||||||
#include "base/base_types.h"
|
#include "base/base_types.h"
|
||||||
|
#include "base/memory_substrate.h"
|
||||||
#include "base/memory.h"
|
#include "base/memory.h"
|
||||||
#include "base/zpl_memory.h"
|
|
||||||
#include "base/strings.h"
|
#include "base/strings.h"
|
||||||
|
|
||||||
MD_NS_END
|
MD_NS_END
|
||||||
|
|
||||||
|
// mdesk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// metagen
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
#ifdef MD_INTELLISENSE_DIRECTIVES
|
#ifdef MD_INTELLISENSE_DIRECTIVES
|
||||||
# pragma once
|
# pragma once
|
||||||
|
# include "base/cracking_arch.h"
|
||||||
|
# include "base/cracking_compiler.h"
|
||||||
|
# include "base/cracking_os.h"
|
||||||
|
# include "base/linkage.h"
|
||||||
# include "base/base_types.h"
|
# include "base/base_types.h"
|
||||||
|
# include "base/strings.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Copyright (c) 2024 Epic Games Tools
|
// Copyright (c) 2024 Epic Games Tools
|
||||||
|
|||||||
Reference in New Issue
Block a user