mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-15 03:01:47 -07:00
looking into removing "oop" features from base library
I want to make member functions an optional addition the user can generate a derivative library with. The purpose is to simplify the implementation as to make generating a C-variant simpiler. I also want to use it as a study to see how much simpiler it makes the library without having it.
This commit is contained in:
@ -170,23 +170,20 @@ b32 gen_vm_purge( VirtualMemory vm );
|
||||
//! Retrieve VM's page size and alignment.
|
||||
ssize gen_virtual_memory_page_size( ssize* alignment_out );
|
||||
|
||||
|
||||
struct Arena;
|
||||
void init_from_memory( Arena& arena, void* start, ssize size );
|
||||
|
||||
struct Arena
|
||||
{
|
||||
static
|
||||
void* allocator_proc( void* allocator_data, AllocType type, ssize size, ssize alignment, void* old_memory, ssize old_size, u64 flags );
|
||||
|
||||
static
|
||||
Arena init_from_memory( void* start, ssize size )
|
||||
{
|
||||
return
|
||||
{
|
||||
{ nullptr, nullptr },
|
||||
start,
|
||||
size,
|
||||
0,
|
||||
0
|
||||
};
|
||||
}
|
||||
//forceinline static
|
||||
//Arena init_from_memory( void* start, ssize size ) {
|
||||
// Arena result; GEN_NS init_from_memory( result, start, size );
|
||||
// return result;
|
||||
//}
|
||||
|
||||
static
|
||||
Arena init_from_allocator( AllocatorInfo backing, ssize size )
|
||||
@ -249,16 +246,25 @@ struct Arena
|
||||
|
||||
AllocatorInfo Backing;
|
||||
void* PhysicalStart;
|
||||
ssize TotalSize;
|
||||
ssize TotalUsed;
|
||||
ssize TempCount;
|
||||
ssize TotalSize;
|
||||
ssize TotalUsed;
|
||||
ssize TempCount;
|
||||
|
||||
operator AllocatorInfo()
|
||||
{
|
||||
return { allocator_proc, this };
|
||||
}
|
||||
operator AllocatorInfo() { return { allocator_proc, this }; }
|
||||
};
|
||||
|
||||
void init_from_memory( Arena& arena, void* start, ssize size )
|
||||
{
|
||||
arena =
|
||||
{
|
||||
{ nullptr, nullptr },
|
||||
start,
|
||||
size,
|
||||
0,
|
||||
0
|
||||
};
|
||||
}
|
||||
|
||||
// Just a wrapper around using an arena with memory associated with its scope instead of from an allocator.
|
||||
// Used for static segment or stack allocations.
|
||||
template< s32 Size >
|
||||
|
Reference in New Issue
Block a user