base progress

This commit is contained in:
ed
2025-02-01 22:38:48 -05:00
parent b414214aa4
commit 97e54f15a3
31 changed files with 429 additions and 239 deletions
+3 -1
View File
@@ -11,6 +11,8 @@
"algorithm": "cpp",
"optional": "cpp",
"type_traits": "cpp",
"xtr1common": "cpp"
"xtr1common": "cpp",
"cstddef": "cpp",
"xmemory": "cpp"
}
}
+25 -24
View File
@@ -1,7 +1,7 @@
#ifdef MD_INTELLISENSE_DIRECTIVES
#pragma once
#include "base_types.h"
#include "macros.h"
#include "base_types.h"
#endif
// Copyright (c) 2024 Epic Games Tools
@@ -18,48 +18,49 @@
typedef U32 ArenaFlags;
enum
{
ArenaFlag_NoChain = (1<<0),
ArenaFlag_LargePages = (1<<1),
ArenaFlag_NoChain = ( 1 << 0),
ArenaFlag_LargePages = ( 1 << 1),
};
typedef struct ArenaParams ArenaParams;
struct ArenaParams
{
ArenaFlags flags;
U64 reserve_size;
U64 commit_size;
void *optional_backing_buffer;
ArenaFlags flags;
U64 reserve_size;
U64 commit_size;
void* optional_backing_buffer;
};
typedef struct Arena Arena;
struct Arena
{
Arena *prev; // previous arena in chain
Arena *current; // current arena in chain
ArenaFlags flags;
U32 cmt_size;
U64 res_size;
U64 base_pos;
U64 pos;
U64 cmt;
U64 res;
Arena* prev; // previous arena in chain
Arena* current; // current arena in chain
ArenaFlags flags;
U32 cmt_size;
U64 res_size;
U64 base_pos;
U64 pos;
U64 cmt;
U64 res;
};
static_assert(sizeof(Arena) <= MD_ARENA_HEADER_SIZE, "sizeof(Arena) <= MD_ARENA_HEADER_SIZE");
typedef struct TempArena TempArena;
struct TempArena
{
Arena *arena;
U64 pos;
Arena* arena;
U64 pos;
};
////////////////////////////////
//~ rjf: Arena Functions
//- rjf: arena creation/destruction
internal Arena *arena_alloc_(ArenaParams *params);
#define arena_alloc(...) arena_alloc_(&(ArenaParams){.reserve_size = MB(64), .commit_size = KB(64), __VA_ARGS__})
internal void rarena_release(Arena *arena);
internal Arena* arena_alloc_(ArenaParams *params);
#define arena_alloc(...) arena_alloc_( & ( ArenaParams) { .reserve_size = MB(64), .commit_size = KB(64), __VA_ARGS__ } )
internal void arena_release(Arena *arena);
//- rjf: arena push/pop/pos core functions
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
#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_no_zero(a, T, c) push_array_no_zero_aligned(a, T, c, Max(8, AlignOf(T)))
#define push_array(a, T, c) push_array_aligned(a, T, c, Max(8, AlignOf(T)))
#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, align_of(T)))
#define push_array(a, T, c) push_array_aligned(a, T, c, max(8, align_of(T)))
+259
View File
@@ -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
-13
View File
@@ -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
-61
View File
@@ -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
-49
View File
@@ -1,52 +1,3 @@
#if MD_INTELLISENSE_DIRECTIVES
#pragma once
#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
+8 -8
View File
@@ -1,6 +1,6 @@
#if MD_INTELLISENSE_DIRECTIVES
#pragma once
#include "platform.h"
# pragma once
# include "platform.h"
#endif
#ifndef local_persist
@@ -8,22 +8,22 @@
#endif
#if MD_COMPILER_MSVC
# define thread_static __declspec(thread)
# define thread_static __declspec(thread)
#elif MD_COMPILER_CLANG || MD_COMPILER_GCC
# define thread_static __thread
# define thread_static __thread
#endif
////////////////////////////////
//~ rjf: Branch Predictor Hints
#if defined(__clang__)
#if MD_COMPILER_CLANG
# define expect(expr, val) __builtin_expect((expr), (val))
#else
# define expect(expr, val) (expr)
#endif
#define likely(expr) expect(expr,1)
#define unlikely(expr) expect(expr,0)
#define likely(expr) expect(expr,1)
#define unlikely(expr) expect(expr,0)
////////////////////////////////
//~ erg: type casting
@@ -56,7 +56,7 @@
# endif
#endif
#if ! defined(typeof) && (!MD_COMPILER_C || __STDC_VERSION__ < 202311L)
#if ! defined(typeof) && ( ! MD_COMPILER_C || __STDC_VERSION__ < 202311L)
# if ! MD_COMPILER_C
# define typeof decltype
# elif defined(_MSC_VER)
+64 -36
View File
@@ -31,13 +31,13 @@
//~ rjf: Type -> Alignment
#if MD_COMPILER_MSVC
# define align_of(T) __alignof(T)
# define align_of(T) __alignof(T)
#elif MD_COMPILER_CLANG
# define align_of(T) __alignof(T)
# define align_of(T) __alignof(T)
#elif MD_COMPILER_GCC
# define align_of(T) __alignof__(T)
# define align_of(T) __alignof__(T)
#else
# error AlignOf not defined for this compiler.
# error AlignOf not defined for this compiler.
#endif
////////////////////////////////
@@ -51,8 +51,8 @@
////////////////////////////////
//~ rjf: For-Loop Construct Macros
#define defer_loop(begin, end) for(int _i_ = ((begin), 0); ! _i_; _i_ += 1, (end))
#define defer_loop_checked(begin, end) for(int _i_ = 2 * ! (begin); (_i_ == 2 ? ((end), 0) : !_i_); _i_ += 1, (end))
#define defer_loop(begin, end) for (int _i_ = ((begin), 0); ! _i_; _i_ += 1, (end))
#define defer_loop_checked(begin, end) for (int _i_ = 2 * ! (begin); (_i_ == 2 ? ((end), 0) : !_i_); _i_ += 1, (end))
#define each_enum_val(type, it) type it = (type) 0; it < type ## _COUNT; it = (type)( it + 1 )
#define each_non_zero_enum_val(type, it) type it = (type) 1; it < type ## _COUNT; it = (type)( it + 1 )
@@ -65,21 +65,21 @@
#define memory_compare(a, b, size) memcmp((a), (b), (size))
#define memory_str_len(ptr) cstr_len(ptr)
#define memory_copy_struct(d,s) memory_copy((d), (s), sizeof( *(d)))
#define memory_copy_array(d,s) memory_copy((d), (s), sizeof( d))
#define memory_copy_type(d,s,c) memory_copy((d), (s), sizeof( *(d)) * (c))
#define memory_copy_struct(d,s) memory_copy((d), (s), sizeof( *(d)))
#define memory_copy_array(d,s) memory_copy((d), (s), sizeof( d))
#define memory_copy_type(d,s,c) memory_copy((d), (s), sizeof( *(d)) * (c))
#define memory_zero(s,z) mem_set((s), 0, (z))
#define memory_zero_struct(s) memory_zero((s), sizeof( *(s)))
#define memory_zero_array(a) memroy_zero((a), sizeof(a))
#define memory_zero_type(m,c) memroy_zero((m), sizeof( *(m)) * (c))
#define memory_zero(s,z) mem_set((s), 0, (z))
#define memory_zero_struct(s) memory_zero((s), sizeof( *(s)))
#define memory_zero_array(a) memroy_zero((a), sizeof(a))
#define memory_zero_type(m,c) memroy_zero((m), sizeof( *(m)) * (c))
#define memory_match(a,b,z) (memory_compare((a), (b), (z)) == 0)
#define memory_match_struct(a,b) memory_match((a), (b), sizeof(*(a)))
#define memory_match_array(a,b) memory_match((a), (b), sizeof(a))
#define memory_match(a,b,z) (memory_compare((a), (b), (z)) == 0)
#define memory_match_struct(a,b) memory_match((a), (b), sizeof(*(a)))
#define memory_match_array(a,b) memory_match((a), (b), sizeof(a))
#define memory_read(T,p,e) ( ((p) + sizeof(T) <= (e)) ? ( *(T*)(p)) : (0) )
#define memory_consume(T,p,e) ( ((p) + sizeof(T) <= (e)) ? ((p) += sizeof(T), *(T*)((p) - sizeof(T))) : ((p) = (e),0) )
#define memory_read(T,p,e) ( ((p) + sizeof(T) <= (e)) ? ( *(T*)(p)) : (0) )
#define memory_consume(T,p,e) ( ((p) + sizeof(T) <= (e)) ? ((p) += sizeof(T), *(T*)((p) - sizeof(T))) : ((p) = (e),0) )
////////////////////////////////
//~ rjf: Asserts
@@ -147,17 +147,37 @@
#define set_nil(nil,p) ((p) = nil)
//- rjf: doubly-linked-lists
#define dll_insert_npz(nil, f, l, p, n, next, prev) \
(check_nil(nil, f) ? \
((f) = (l) = (n), set_nil(nil, (n)->next), set_nil(nil, (n)->prev)) \
: CheckNil(nil,p) ? \
((n)->next = (f), (f)->prev = (n), (f) = (n), SetNil(nil,(n)->prev)) \
: ((p) == (l)) ? \
((l)->next = (n), (n)->prev = (l), (l) = (n), SetNil(nil, (n)->next)) \
: ( ((!CheckNil(nil, p) && CheckNil(nil, (p)->next) ) ? \
(0) \
: ((p)->next->prev = (n))), ((n)->next = (p)->next), ((p)->next = (n)), ((n)->prev = (p))) \
) \
#define dll_insert_npz(nil, f, l, p, n, next, prev) ( \
check_nil(nil, f) ? ( \
(f) = (l) = (n), \
set_nil(nil, (n)->next), \
set_nil(nil, (n)->prev) \
) \
: ( \
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) \
: ( (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_front_npz(nil, f, l, n, next, prev) dll_insert_npz(nil, l, f, f, n, prev, next)
@@ -173,13 +193,21 @@
(l) = (l)->prev \
: (0) \
), \
(CheckNil(nil,(n)->prev) ? (0) :\
((n)->prev->next = (n)->next)),\
(CheckNil(nil,(n)->next) ? (0) :\
((n)->next->prev = (n)->prev)))
( \
CheckNil(nil,(n)->prev) ? \
(0) \
: ((n)->prev->next = (n)->next) \
), \
( \
CheckNil(nil,(n)->next) ? \
(0) \
: ((n)->next->prev = (n)->prev) \
) \
)
//- 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)):\
((l)->next=(n),(l)=(n),SetNil(nil,(n)->next)))
#define SLLQueuePushFront_NZ(nil,f,l,n,next) (CheckNil(nil,f)?\
@@ -238,8 +266,8 @@
#if ASAN_ENABLED
#pragma comment(lib, "clang_rt.asan-x86_64.lib")
C_LINKAGE 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_poison_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 AsanUnpoisonMemoryRegion(addr, size) __asan_unpoison_memory_region((addr), (size))
#else
@@ -119,4 +119,3 @@ constexpr AllocatorInfo heap( void ) { AllocatorInfo allocator = { heap_allocato
//! Helper to free memory allocated by heap allocator.
#define mfree( ptr ) free( heap(), ptr )
+7 -6
View File
@@ -1,6 +1,6 @@
#ifdef MD_INTELLISENSE_DIRECTIVES
#pragma once
#include "cracking_arch.h"
# pragma once
# include "cracking_compiler.h"
#endif
// C++ namespace support
@@ -10,14 +10,15 @@
# define MD_NS_BEGIN
# define MD_NS_END
# else
# define MD_NS ::
# define MD_NS ::
# define MD_NS_BEGIN
# define MD_NS_END
# endif
#else
namespace MD {}
namespace md = MD;
# define MD_NS MD::
# define MD_NS_BEGIN namespace MD {
# define MD_NS_END }
# define MD_NS MD::
# define MD_NS_BEGIN namespace MD {
# define MD_NS_END }
#endif
+2 -8
View File
@@ -1,12 +1,8 @@
#if MD_INTELLISENSE_DIRECTIVES
#pragma once
#include "cracking_arch.h"
#include "cracking_os.h"
#include "cracking_compiler.h"
# pragma once
# include "context_cracking.h"
#endif
#pragma region Mandatory Includes
#include <stdarg.h>
#include <stddef.h>
@@ -18,5 +14,3 @@
# include <assert.h>
# include <stdbool.h>
#endif
#pragma endregion Mandatory Includes
+4
View File
@@ -0,0 +1,4 @@
#ifdef MD_INTELLISENSE_DIRECTIVES
#include "text.h"
#endif
+4
View File
@@ -0,0 +1,4 @@
#ifdef MD_INTELLISENSE_DIRECTIVES
#pragma once
#endif
+5
View File
@@ -0,0 +1,5 @@
#ifdef MD_INTELLISENSE_DIRECTIVES
#include "toolchain.h"
#endif
+5
View File
@@ -0,0 +1,5 @@
// metadesk source: intended for "As-Is" library usage
#include "metadesk.h"
+13 -7
View File
@@ -2,12 +2,11 @@
#pragma once
#endif
// base outline
// intended for "As-Is" library usage
// metadesk header: intended for "As-Is" library usage
#include "base/cracking_arch.h"
#include "base/cracking_compiler.h"
#include "base/cracking_os.h"
// base
#include "base/context_cracking.h"
#include "base/linkage.h"
#include "base/macros.h"
#include "base/namespace.h"
@@ -15,10 +14,17 @@
MD_NS_BEGIN
#include "os.h"
#include "base/base_types.h"
#include "base/memory_substrate.h"
#include "base/memory.h"
#include "base/zpl_memory.h"
#include "base/strings.h"
MD_NS_END
// mdesk
// metagen
View File
+30 -25
View File
@@ -1,6 +1,11 @@
#ifdef MD_INTELLISENSE_DIRECTIVES
#pragma once
#include "base/base_types.h"
# 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/strings.h"
#endif
// Copyright (c) 2024 Epic Games Tools
@@ -12,11 +17,11 @@
typedef struct OS_SystemInfo OS_SystemInfo;
struct OS_SystemInfo
{
U32 logical_processor_count;
U64 page_size;
U64 large_page_size;
U64 allocation_granularity;
String8 machine_name;
U32 logical_processor_count;
U64 page_size;
U64 large_page_size;
U64 allocation_granularity;
String8 machine_name;
};
////////////////////////////////
@@ -25,12 +30,12 @@ struct OS_SystemInfo
typedef struct OS_ProcessInfo OS_ProcessInfo;
struct OS_ProcessInfo
{
U32 pid;
String8 binary_path;
String8 initial_path;
String8 user_program_data_path;
String8List module_load_paths;
String8List environment;
U32 pid;
String8 binary_path;
String8 initial_path;
String8 user_program_data_path;
String8List module_load_paths;
String8List environment;
};
////////////////////////////////
@@ -39,12 +44,12 @@ struct OS_ProcessInfo
typedef U32 OS_AccessFlags;
enum
{
OS_AccessFlag_Read = (1<<0),
OS_AccessFlag_Write = (1<<1),
OS_AccessFlag_Execute = (1<<2),
OS_AccessFlag_Append = (1<<3),
OS_AccessFlag_ShareRead = (1<<4),
OS_AccessFlag_ShareWrite = (1<<5),
OS_AccessFlag_Read = (1 << 0),
OS_AccessFlag_Write = (1 << 1),
OS_AccessFlag_Execute = (1 << 2),
OS_AccessFlag_Append = (1 << 3),
OS_AccessFlag_ShareRead = (1 << 4),
OS_AccessFlag_ShareWrite = (1 << 5),
};
////////////////////////////////
@@ -53,23 +58,23 @@ enum
typedef U32 OS_FileIterFlags;
enum
{
OS_FileIterFlag_SkipFolders = (1 << 0),
OS_FileIterFlag_SkipFiles = (1 << 1),
OS_FileIterFlag_SkipHiddenFiles = (1 << 2),
OS_FileIterFlag_Done = (1 << 31),
OS_FileIterFlag_SkipFolders = (1 << 0),
OS_FileIterFlag_SkipFiles = (1 << 1),
OS_FileIterFlag_SkipHiddenFiles = (1 << 2),
OS_FileIterFlag_Done = (1 << 31),
};
typedef struct OS_FileIter OS_FileIter;
struct OS_FileIter
{
OS_FileIterFlags flags;
U8 memory[800];
U8 memory[800];
};
typedef struct OS_FileInfo OS_FileInfo;
struct OS_FileInfo
{
String8 name;
String8 name;
FileProperties props;
};
View File