Started to move over zpl depndencies and use templated containers.

Still have a ways to go.
This commit is contained in:
2023-07-11 18:29:45 -04:00
parent 661630a88f
commit 20d307759b
15 changed files with 2485 additions and 1340 deletions

View File

@ -21,7 +21,7 @@ Code gen__hashtable_base()
return find_result;
}
Code gen__hashtable( StrC type, sw type_size )
Code gen__hashtable( StrC type )
{
static Code t_allocator_info = def_type( name(AllocatorInfo) );
@ -397,20 +397,19 @@ struct GenHashTableRequest
{
StrC Dependency;
StrC Type;
sw TypeSize;
};
Array(GenHashTableRequest) GenHashTableRequests;
Array<GenHashTableRequest> GenHashTableRequests;
void gen__hashtable_request( StrC type, sw size, StrC dep = {} )
void gen__hashtable_request( StrC type, StrC dep = {} )
{
do_once_start
array_init( GenHashTableRequests, Memory::GlobalAllocator );
GenHashTableRequests = Array<GenHashTableRequest>::init( Memory::GlobalAllocator );
gen_array( sw );
do_once_end
// Make sure we don't already have a request for the type.
for ( sw idx = 0; idx < array_count( GenHashTableRequests ); ++idx )
for ( sw idx = 0; idx < GenHashTableRequests.num(); ++idx )
{
StrC const reqest_type = GenHashTableRequests[ idx ].Type;
@ -421,10 +420,10 @@ void gen__hashtable_request( StrC type, sw size, StrC dep = {} )
return;
}
GenHashTableRequest request = { dep, type, size};
array_append( GenHashTableRequests, request );
GenHashTableRequest request = { dep, type };
GenHashTableRequests.append( request );
}
#define gen_hashtable( type ) gen__hashtable_request( { txt_to_StrC(type) }, sizeof( type ))
#define gen_hashtable( type ) gen__hashtable_request( { txt_to_StrC(type) } )
u32 gen_hashtable_file()
{
@ -439,12 +438,12 @@ u32 gen_hashtable_file()
gen_buffer_file.print( gen__hashtable_base());
GenHashTableRequest* current = GenHashTableRequests;
s32 left = array_count( GenHashTableRequests );
s32 left = GenHashTableRequests.num();
while (left--)
{
GenHashTableRequest const& request = * current;
Code generated_buffer = gen__hashtable( current->Type, current->TypeSize );
Code generated_buffer = gen__hashtable( current->Type );
if ( request.Dependency )
{