mirror of
https://github.com/Ed94/gencpp.git
synced 2025-07-01 19:31:02 -07:00
Parser constructor passes all current tests...
Pretty much have a working library now... Albiet with problably quite a few hidden bugs in parsing. Next steps are to start converting library to use its own Arena, Pool, Array, HashTable types. And either work on zpl dependency gutting or making a more robust set of tests.
This commit is contained in:
@ -23,7 +23,7 @@ Code gen__array_base()
|
||||
return def_global_body( 2, header, grow_formula );
|
||||
}
|
||||
|
||||
Code gen__array( StrC type, sw type_size )
|
||||
Code gen__array( StrC type )
|
||||
{
|
||||
static Code t_allocator_info = def_type( name(AllocatorInfo) );
|
||||
static Code v_nullptr = untyped_str( code(nullptr));
|
||||
@ -299,11 +299,10 @@ struct GenArrayRequest
|
||||
{
|
||||
StrC Dependency;
|
||||
StrC Type;
|
||||
sw Size;
|
||||
};
|
||||
Array(GenArrayRequest) GenArrayRequests;
|
||||
|
||||
void gen__array_request( StrC type, sw size, StrC dep = {} )
|
||||
void gen__array_request( StrC type, StrC dep = {} )
|
||||
{
|
||||
do_once_start
|
||||
array_init( GenArrayRequests, Memory::GlobalAllocator );
|
||||
@ -321,10 +320,10 @@ void gen__array_request( StrC type, sw size, StrC dep = {} )
|
||||
return;
|
||||
}
|
||||
|
||||
GenArrayRequest request = { dep, type, size };
|
||||
GenArrayRequest request = { dep, type };
|
||||
array_append( GenArrayRequests, request );
|
||||
}
|
||||
#define gen_array( type ) gen__array_request( { txt_to_StrC(type) }, sizeof(type) )
|
||||
#define gen_array( type ) gen__array_request( { txt_to_StrC(type) } )
|
||||
|
||||
u32 gen_array_file()
|
||||
{
|
||||
@ -344,7 +343,7 @@ u32 gen_array_file()
|
||||
{
|
||||
GenArrayRequest const& request = * current;
|
||||
|
||||
Code generated_array = gen__array( request.Type, request.Size );
|
||||
Code generated_array = gen__array( request.Type );
|
||||
|
||||
if ( request.Dependency )
|
||||
{
|
||||
|
@ -48,7 +48,6 @@ Code gen__hashtable( StrC type, sw type_size )
|
||||
s32 len = str_len( name_str );
|
||||
|
||||
StringCached ht_entry_name = get_cached_string({ len, name_str });
|
||||
sw const entry_size = sizeof( u64 ) + sizeof( sw ) + type_size;
|
||||
|
||||
t_ht_entry = def_type( ht_entry_name );
|
||||
ht_entry = def_struct( ht_entry_name, def_struct_body( 3
|
||||
@ -57,7 +56,7 @@ Code gen__hashtable( StrC type, sw type_size )
|
||||
, def_variable( t_type, name(Value))
|
||||
));
|
||||
|
||||
array_ht_entry = gen__array( ht_entry_name, entry_size );
|
||||
array_ht_entry = gen__array( ht_entry_name );
|
||||
t_array_ht_entry = def_type( array_ht_entry->Name );
|
||||
}
|
||||
|
||||
@ -90,7 +89,7 @@ Code gen__hashtable( StrC type, sw type_size )
|
||||
|
||||
Code clear = def_function( name(clear), __, t_void
|
||||
, def_execution( code(
|
||||
for ( s32 idx = 0; idx < Hashes.num(), idx++ )
|
||||
for ( s32 idx = 0; idx < Hashes.num(); idx++ )
|
||||
Hashes[ idx ] = -1;
|
||||
|
||||
Entries.clear();
|
||||
@ -222,7 +221,7 @@ Code gen__hashtable( StrC type, sw type_size )
|
||||
);
|
||||
Code body = def_execution( token_fmt( tmpl, 1, "type", name ) );
|
||||
|
||||
rehash = def_function( name(rehash), def_param( t_sw, name(new_num)), t_void, body, spec_inline);
|
||||
rehash = def_function( name(rehash), def_param( t_sw, name(new_num)), t_void, body );
|
||||
}
|
||||
|
||||
Code rehash_fast;
|
||||
@ -435,7 +434,7 @@ u32 gen_hashtable_file()
|
||||
|
||||
gen_buffer_file.print( def_include( StrC::from("Bloat.hpp")) );
|
||||
gen_buffer_file.print( def_include( StrC::from("Array.NonParsed.hpp")) );
|
||||
gen_buffer_file.print( def_include( StrC::from("array.gen.hpp")) );
|
||||
gen_buffer_file.print( def_include( StrC::from("array.NonParsed.gen.hpp")) );
|
||||
|
||||
gen_buffer_file.print( gen__hashtable_base());
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
//
|
@ -197,7 +197,7 @@ u32 gen_ring_file()
|
||||
gen_ring_file.open( "ring.NonParsed.gen.hpp" );
|
||||
|
||||
gen_ring_file.print( def_include( StrC::from("Bloat.hpp")) );
|
||||
gen_ring_file.print( def_include( StrC::from("buffer.gen.hpp")) );
|
||||
gen_ring_file.print( def_include( StrC::from("buffer.NonParsed.gen.hpp")) );
|
||||
// gen_ring_file.print( gen__ring_base() );
|
||||
|
||||
GenRingRequest* current = GenRingRequests;
|
||||
|
Reference in New Issue
Block a user