fixes etc for gasa gen

This commit is contained in:
2024-12-15 18:22:59 -05:00
parent f55e96ec6a
commit c895772cff
19 changed files with 2066 additions and 1824 deletions

View File

@ -39,7 +39,9 @@ Builder builder_open( char const* path )
return result;
}
result.Buffer = strbuilder_make_reserve( _ctx->Allocator_Temp, _ctx->InitSize_BuilderBuffer );
Context* ctx = get_context();
GEN_ASSERT_NOT_NULL(ctx);
result.Buffer = strbuilder_make_reserve( ctx->Allocator_Temp, ctx->InitSize_BuilderBuffer );
// log_fmt("$Builder - Opened file: %s\n", result.File.filename );
return result;

View File

@ -3403,6 +3403,10 @@ void deinit(Context* ctx)
-- context_counter;
}
Context* get_context() {
return _ctx;
}
void reset(Context* ctx)
{
s32 index = 0;

View File

@ -883,7 +883,7 @@ template<typename Type> mem_ptr_const to_mem_ptr_const( Type ptr ) { return (mem
// NOTE: Things that shouldn't happen with a message!
#define GEN_PANIC( msg, ... ) GEN_ASSERT_MSG( 0, msg, ##__VA_ARGS__ )
#if GEN_BULD_DEBUG
#if GEN_BUILD_DEBUG
#define GEN_FATAL( ... ) \
do \
{ \

View File

@ -886,7 +886,7 @@ inline TokType str_to_toktype( Str str )
enum TokFlags : u32
{
TF_Operator = bit(0),
TF_Operator = bit(0),
TF_Assign = bit(1),
TF_Preprocess = bit(2),
TF_Preprocess_Cond = bit(3),
@ -3980,6 +3980,9 @@ GEN_API void init(Context* ctx);
// However on Windows at least, it doesn't need to occur as the OS will clean up after the process.
GEN_API void deinit(Context* ctx);
// Retrieves the active context (not usually needed, but here in case...)
GEN_API Context* get_contex();
// Clears the allocations, but doesn't free the memoery, then calls init() again.
// Ease of use.
GEN_API void reset(Context* ctx);