mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 05:48:40 +00:00
raddbgi cons: more overrides work
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
//- rjf: memory set
|
//- rjf: memory set
|
||||||
|
|
||||||
#if !defined(raddbgic_memset)
|
#if !defined(RADDBGIC_MEMSET_OVERRIDE)
|
||||||
RADDBGI_PROC void *
|
RADDBGI_PROC void *
|
||||||
raddbgic_memset_fallback(void *dst, RADDBGI_U8 c, RADDBGI_U64 size)
|
raddbgic_memset_fallback(void *dst, RADDBGI_U8 c, RADDBGI_U64 size)
|
||||||
{
|
{
|
||||||
@@ -37,19 +37,41 @@ raddbgic_str8(RADDBGI_U8 *str, RADDBGI_U64 size)
|
|||||||
|
|
||||||
//- rjf: arenas
|
//- rjf: arenas
|
||||||
|
|
||||||
RADDBGI_PROC void *
|
#if !defined (RADDBGIC_ARENA_OVERRIDE)
|
||||||
raddbgic_arena_push(RADDBGIC_Arena *arena, RADDBGI_U64 size)
|
|
||||||
|
RADDBGI_PROC RADDBGIC_Arena *
|
||||||
|
raddbgic_arena_alloc_fallback(void)
|
||||||
{
|
{
|
||||||
void *result = RADDBGIC_Arena_PushImpl((arena), (size));
|
RADDBGIC_Arena *arena = 0;
|
||||||
return result;
|
return arena;
|
||||||
}
|
}
|
||||||
|
|
||||||
RADDBGI_PROC void
|
RADDBGI_PROC void
|
||||||
raddbgic_arena_pop_to(RADDBGIC_Arena *arena, RADDBGI_U64 pos)
|
raddbgic_arena_release_fallback(RADDBGIC_Arena *arena)
|
||||||
{
|
{
|
||||||
RADDBGIC_Arena_PopToImpl((arena), (pos));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RADDBGI_PROC RADDBGI_U64
|
||||||
|
raddbgic_arena_pos_fallback(RADDBGIC_Arena *arena)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
RADDBGI_PROC void *
|
||||||
|
raddbgic_arena_push_fallback(RADDBGIC_Arena *arena, RADDBGI_U64 size)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
RADDBGI_PROC void
|
||||||
|
raddbgic_arena_pop_to_fallback(RADDBGIC_Arena *arena, RADDBGI_U64 pos)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
//- rjf: type lists
|
//- rjf: type lists
|
||||||
|
|
||||||
RADDBGI_PROC void
|
RADDBGI_PROC void
|
||||||
@@ -194,7 +216,7 @@ raddbgic_sort_key_array(RADDBGIC_Arena *arena, RADDBGIC_SortKey *keys, RADDBGI_U
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RADDBGIC_SortKey *keys_swap = push_array_no_zero(arena, RADDBGIC_SortKey, count);
|
RADDBGIC_SortKey *keys_swap = raddbgic_push_array_no_zero(arena, RADDBGIC_SortKey, count);
|
||||||
RADDBGIC_SortKey *src = keys;
|
RADDBGIC_SortKey *src = keys;
|
||||||
RADDBGIC_SortKey *dst = keys_swap;
|
RADDBGIC_SortKey *dst = keys_swap;
|
||||||
RADDBGIC_OrderedRange *src_ranges = ranges_first;
|
RADDBGIC_OrderedRange *src_ranges = ranges_first;
|
||||||
|
|||||||
@@ -7,10 +7,15 @@
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Overrideable Memory Operations
|
//~ rjf: Overrideable Memory Operations
|
||||||
|
|
||||||
|
// To override the slow/default memset implementation used by the library,
|
||||||
|
// do the following:
|
||||||
|
//
|
||||||
|
// #define RADDBGIC_MEMSET_OVERRIDE
|
||||||
|
// #define raddbgic_memset <name of memset implementation>
|
||||||
|
|
||||||
#if !defined(raddbgic_memset)
|
#if !defined(raddbgic_memset)
|
||||||
# define raddbgic_memset raddbgic_memset_fallback
|
# define raddbgic_memset raddbgic_memset_fallback
|
||||||
#endif
|
#endif
|
||||||
#define raddbgic_memzero(ptr, size) raddbgic_memset((ptr), 0, (size))
|
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Overrideable String View Types
|
//~ rjf: Overrideable String View Types
|
||||||
@@ -57,12 +62,13 @@ struct RADDBGIC_String8List
|
|||||||
|
|
||||||
// To override the arena allocator type used by the library, do the following:
|
// To override the arena allocator type used by the library, do the following:
|
||||||
//
|
//
|
||||||
|
// #define RADDBGIC_ARENA_OVERRIDE
|
||||||
// #define RADDBGIC_Arena <name of your arena type here>
|
// #define RADDBGIC_Arena <name of your arena type here>
|
||||||
// #define RADDBGIC_Arena_AllocImpl <name of your creation function - must be (void) -> Arena*>
|
// #define raddbgic_arena_alloc <name of your creation function - must be (void) -> Arena*>
|
||||||
// #define RADDBGIC_Arena_ReleaseImpl <name of your release function - must be (Arena*) -> void>
|
// #define raddbgic_arena_release <name of your release function - must be (Arena*) -> void>
|
||||||
// #define RADDBGIC_Arena_PosImpl <name of your position function - must be (Arena*) -> U64>
|
// #define raddbgic_arena_pos <name of your position function - must be (Arena*) -> U64>
|
||||||
// #define RADDBGIC_Arena_PushImpl <name of your pushing function - must be (Arena*, U64 size) -> void*>
|
// #define raddbgic_arena_push <name of your pushing function - must be (Arena*, U64 size) -> void*>
|
||||||
// #define RADDBGIC_Arena_PopToImpl <name of your popping function - must be (Arena*, U64 pos) -> void>
|
// #define raddbgic_arena_pop_to <name of your popping function - must be (Arena*, U64 pos) -> void>
|
||||||
|
|
||||||
#if !defined(RADDBGIC_Arena)
|
#if !defined(RADDBGIC_Arena)
|
||||||
typedef struct RADDBGIC_Arena RADDBGIC_Arena;
|
typedef struct RADDBGIC_Arena RADDBGIC_Arena;
|
||||||
@@ -79,6 +85,19 @@ struct RADDBGIC_Arena
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(raddbgic_arena_alloc)
|
||||||
|
# define raddbgic_arena_alloc raddbgic_arena_alloc_fallback
|
||||||
|
#endif
|
||||||
|
#if !defined(raddbgic_arena_release)
|
||||||
|
# define raddbgic_arena_release raddbgic_arena_release_fallback
|
||||||
|
#endif
|
||||||
|
#if !defined(raddbgic_arena_pos)
|
||||||
|
# define raddbgic_arena_pos raddbgic_arena_pos_fallback
|
||||||
|
#endif
|
||||||
|
#if !defined(raddbgic_arena_push)
|
||||||
|
# define raddbgic_arena_push raddbgic_arena_push_fallback
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct RADDBGIC_Temp RADDBGIC_Temp;
|
typedef struct RADDBGIC_Temp RADDBGIC_Temp;
|
||||||
struct RADDBGIC_Temp
|
struct RADDBGIC_Temp
|
||||||
{
|
{
|
||||||
@@ -902,18 +921,24 @@ struct RADDBGIC_BakeCtx
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Basic Helpers
|
//~ rjf: Basic Helpers
|
||||||
|
|
||||||
//- rjf: memory set
|
//- rjf: memory operations
|
||||||
#if !defined(raddbgic_memset)
|
#if !defined(RADDBGIC_MEMSET_OVERRIDE)
|
||||||
RADDBGI_PROC void *raddbgic_memset_fallback(void *dst, RADDBGI_U8 c, RADDBGI_U64 size);
|
RADDBGI_PROC void *raddbgic_memset_fallback(void *dst, RADDBGI_U8 c, RADDBGI_U64 size);
|
||||||
#endif
|
#endif
|
||||||
|
#define raddbgic_memzero(ptr, size) raddbgic_memset((ptr), 0, (size))
|
||||||
|
|
||||||
//- rjf: strings
|
//- rjf: strings
|
||||||
RADDBGI_PROC RADDBGIC_String8 raddbgic_str8(RADDBGI_U8 *str, RADDBGI_U64 size);
|
RADDBGI_PROC RADDBGIC_String8 raddbgic_str8(RADDBGI_U8 *str, RADDBGI_U64 size);
|
||||||
#define raddbgic_str8_lit(S) raddbgic_str8((U8*)(S), sizeof(S) - 1)
|
#define raddbgic_str8_lit(S) raddbgic_str8((U8*)(S), sizeof(S) - 1)
|
||||||
|
|
||||||
//- rjf: arenas
|
//- rjf: arenas
|
||||||
RADDBGI_PROC void *raddbgic_arena_push(RADDBGIC_Arena *arena, RADDBGI_U64 size);
|
#if !defined (RADDBGIC_ARENA_OVERRIDE)
|
||||||
RADDBGI_PROC void raddbgic_arena_pop_to(RADDBGIC_Arena *arena, RADDBGI_U64 pos);
|
RADDBGI_PROC RADDBGIC_Arena *raddbgic_arena_alloc_fallback(void);
|
||||||
|
RADDBGI_PROC void raddbgic_arena_release_fallback(RADDBGIC_Arena *arena);
|
||||||
|
RADDBGI_PROC RADDBGI_U64 raddbgic_arena_pos_fallback(RADDBGIC_Arena *arena);
|
||||||
|
RADDBGI_PROC void *raddbgic_arena_push_fallback(RADDBGIC_Arena *arena, RADDBGI_U64 size);
|
||||||
|
RADDBGI_PROC void raddbgic_arena_pop_to_fallback(RADDBGIC_Arena *arena, RADDBGI_U64 pos);
|
||||||
|
#endif
|
||||||
#define raddbgic_push_array_no_zero(a,T,c) (T*)raddbgic_arena_push((a), sizeof(T)*(c))
|
#define raddbgic_push_array_no_zero(a,T,c) (T*)raddbgic_arena_push((a), sizeof(T)*(c))
|
||||||
#define raddbgic_push_array(a,T,c) (T*)raddbgic_memzero(raddbgic_push_array_no_zero(a,T,c), sizeof(T)*(c))
|
#define raddbgic_push_array(a,T,c) (T*)raddbgic_memzero(raddbgic_push_array_no_zero(a,T,c), sizeof(T)*(c))
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,11 @@
|
|||||||
#define RADDBGI_CONS_LOCAL_H
|
#define RADDBGI_CONS_LOCAL_H
|
||||||
|
|
||||||
// rjf: base layer memory ops
|
// rjf: base layer memory ops
|
||||||
|
#define RADDBGIC_MEMSET_OVERRIDE
|
||||||
#define raddbgic_memset memset
|
#define raddbgic_memset memset
|
||||||
|
|
||||||
// rjf: base layer string overrides
|
// rjf: base layer string overrides
|
||||||
|
#define RADDBGI_STRING8_OVERRIDE
|
||||||
#define RADDBGIC_String8 String8
|
#define RADDBGIC_String8 String8
|
||||||
#define RADDBGIC_String8_BaseMember str
|
#define RADDBGIC_String8_BaseMember str
|
||||||
#define RADDBGIC_String8_SizeMember size
|
#define RADDBGIC_String8_SizeMember size
|
||||||
@@ -15,12 +17,13 @@
|
|||||||
#define RADDBGIC_String8List String8List
|
#define RADDBGIC_String8List String8List
|
||||||
|
|
||||||
// rjf: base layer arena overrides
|
// rjf: base layer arena overrides
|
||||||
|
#define RADDBGIC_ARENA_OVERRIDE
|
||||||
#define RADDBGIC_Arena Arena
|
#define RADDBGIC_Arena Arena
|
||||||
#define RADDBGIC_Arena_AllocImpl arena_alloc
|
#define raddbgic_arena_alloc arena_alloc
|
||||||
#define RADDBGIC_Arena_ReleaseImpl arena_release
|
#define raddbgic_arena_release arena_release
|
||||||
#define RADDBGIC_Arena_PosImpl arena_pos
|
#define raddbgic_arena_pos arena_pos
|
||||||
#define RADDBGIC_Arena_PushImpl arena_push
|
#define raddbgic_arena_push arena_push
|
||||||
#define RADDBGIC_Arena_PopToImpl arena_pop_to
|
#define raddbgic_arena_pop_to arena_pop_to
|
||||||
|
|
||||||
#include "raddbgi_cons.h"
|
#include "raddbgi_cons.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user