mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-11-03 23:36:12 -08:00 
			
		
		
		
	Started to move over zpl depndencies and use templated containers.
Still have a ways to go.
This commit is contained in:
		@@ -300,16 +300,16 @@ struct GenArrayRequest
 | 
			
		||||
	StrC Dependency;
 | 
			
		||||
	StrC Type;
 | 
			
		||||
};
 | 
			
		||||
Array(GenArrayRequest) GenArrayRequests;
 | 
			
		||||
Array<GenArrayRequest> GenArrayRequests;
 | 
			
		||||
 | 
			
		||||
void gen__array_request( StrC type, StrC dep = {} )
 | 
			
		||||
{
 | 
			
		||||
	do_once_start
 | 
			
		||||
		array_init( GenArrayRequests, Memory::GlobalAllocator );
 | 
			
		||||
		GenArrayRequests = Array<GenArrayRequest>::init( Memory::GlobalAllocator );
 | 
			
		||||
	do_once_end
 | 
			
		||||
 | 
			
		||||
	// Make sure we don't already have a request for the type.
 | 
			
		||||
	for ( sw idx = 0; idx < array_count( GenArrayRequests ); ++idx )
 | 
			
		||||
	for ( sw idx = 0; idx < GenArrayRequests.num(); ++idx )
 | 
			
		||||
	{
 | 
			
		||||
		StrC const reqest_type = GenArrayRequests[ idx ].Type;
 | 
			
		||||
 | 
			
		||||
@@ -321,7 +321,7 @@ void gen__array_request( StrC type, StrC dep = {} )
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	GenArrayRequest request = { dep, type };
 | 
			
		||||
	array_append( GenArrayRequests, request );
 | 
			
		||||
	GenArrayRequests.append( request );
 | 
			
		||||
}
 | 
			
		||||
#define gen_array( type ) gen__array_request( { txt_to_StrC(type) } )
 | 
			
		||||
 | 
			
		||||
@@ -338,7 +338,7 @@ u32 gen_array_file()
 | 
			
		||||
	gen_array_file.print( array_base );
 | 
			
		||||
 | 
			
		||||
	GenArrayRequest* current = GenArrayRequests;
 | 
			
		||||
	s32 left = array_count( GenArrayRequests );
 | 
			
		||||
	s32 left = GenArrayRequests.num();
 | 
			
		||||
	while (left--)
 | 
			
		||||
	{
 | 
			
		||||
		GenArrayRequest const& request = * current;
 | 
			
		||||
 
 | 
			
		||||
@@ -206,16 +206,16 @@ struct GenBufferRequest
 | 
			
		||||
	StrC Type;
 | 
			
		||||
	sw   TypeSize;
 | 
			
		||||
};
 | 
			
		||||
Array(GenBufferRequest) GenBufferRequests;
 | 
			
		||||
Array<GenBufferRequest> GenBufferRequests;
 | 
			
		||||
 | 
			
		||||
void gen__buffer_request( StrC type, sw size, StrC dep = {} )
 | 
			
		||||
{
 | 
			
		||||
	do_once_start
 | 
			
		||||
		array_init( GenBufferRequests, Memory::GlobalAllocator );
 | 
			
		||||
		GenBufferRequests = Array<GenBufferRequest>::init( Memory::GlobalAllocator );
 | 
			
		||||
	do_once_end
 | 
			
		||||
 | 
			
		||||
	// Make sure we don't already have a request for the type.
 | 
			
		||||
	for ( sw idx = 0; idx < array_count( GenBufferRequests ); ++idx )
 | 
			
		||||
	for ( sw idx = 0; idx < GenBufferRequests.num(); ++idx )
 | 
			
		||||
	{
 | 
			
		||||
		StrC const reqest_type = GenBufferRequests[ idx ].Type;
 | 
			
		||||
 | 
			
		||||
@@ -227,7 +227,7 @@ void gen__buffer_request( StrC type, sw size, StrC dep = {} )
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	GenBufferRequest request = { dep, type, size};
 | 
			
		||||
	array_append( GenBufferRequests, request );
 | 
			
		||||
	GenBufferRequests.append( request );
 | 
			
		||||
}
 | 
			
		||||
#define gen_buffer( type ) gen__buffer_request( { txt_to_StrC(type) }, sizeof( type ))
 | 
			
		||||
 | 
			
		||||
@@ -241,7 +241,7 @@ u32 gen_buffer_file()
 | 
			
		||||
	gen_buffer_file.print( gen__buffer_base() );
 | 
			
		||||
 | 
			
		||||
	GenBufferRequest* current = GenBufferRequests;
 | 
			
		||||
	s32 left = array_count( GenBufferRequests );
 | 
			
		||||
	s32 left = GenBufferRequests.num();
 | 
			
		||||
	while (left--)
 | 
			
		||||
	{
 | 
			
		||||
		GenBufferRequest const& request = * current;
 | 
			
		||||
 
 | 
			
		||||
@@ -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 )
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -162,16 +162,16 @@ struct GenRingRequest
 | 
			
		||||
	StrC Type;
 | 
			
		||||
	sw   TypeSize;
 | 
			
		||||
};
 | 
			
		||||
Array(GenRingRequest) GenRingRequests;
 | 
			
		||||
Array<GenRingRequest> GenRingRequests;
 | 
			
		||||
 | 
			
		||||
void gen__ring_request( StrC type, sw size, StrC dep = {} )
 | 
			
		||||
{
 | 
			
		||||
	do_once_start
 | 
			
		||||
		array_init( GenRingRequests, Memory::GlobalAllocator );
 | 
			
		||||
		GenRingRequests = Array<GenRingRequest>::init( Memory::GlobalAllocator );
 | 
			
		||||
	do_once_end
 | 
			
		||||
 | 
			
		||||
	// Make sure we don't already have a request for the type.
 | 
			
		||||
	for ( sw idx = 0; idx < array_count( GenRingRequests ); ++idx )
 | 
			
		||||
	for ( sw idx = 0; idx < GenRingRequests.num(); ++idx )
 | 
			
		||||
	{
 | 
			
		||||
		StrC const reqest_type = GenRingRequests[ idx ].Type;
 | 
			
		||||
 | 
			
		||||
@@ -186,7 +186,7 @@ void gen__ring_request( StrC type, sw size, StrC dep = {} )
 | 
			
		||||
	gen__buffer_request( type, size, dep );
 | 
			
		||||
 | 
			
		||||
	GenRingRequest request = { dep, type, size};
 | 
			
		||||
	array_append( GenRingRequests, request );
 | 
			
		||||
	GenRingRequests.append( request );
 | 
			
		||||
}
 | 
			
		||||
#define gen_ring( type ) gen__ring_request( { txt_to_StrC(type) }, sizeof( type ))
 | 
			
		||||
 | 
			
		||||
@@ -201,7 +201,7 @@ u32 gen_ring_file()
 | 
			
		||||
	// gen_ring_file.print( gen__ring_base() );
 | 
			
		||||
 | 
			
		||||
	GenRingRequest* current = GenRingRequests;
 | 
			
		||||
	s32 left = array_count( GenRingRequests );
 | 
			
		||||
	s32 left = GenRingRequests.num();
 | 
			
		||||
	while (left--)
 | 
			
		||||
	{
 | 
			
		||||
		GenRingRequest const& request = * current;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user