Upfront constructors work again (test case wise)

Doing parsing set next
This commit is contained in:
2023-07-15 22:27:38 -04:00
parent ade4c3345d
commit 1e79c9190e
12 changed files with 128 additions and 101 deletions

View File

@ -128,11 +128,11 @@ Code gen__array( StrC type )
CodeFn fill;
{
CodeParam params = def_params( 3
, def_param( t_uw, name(begin) )
CodeParam params = def_params( args(
def_param( t_uw, name(begin) )
, def_param( t_uw, name(end) )
, def_param( t_alias, name(value) )
);
));
Code body = untyped_str( code(
Header& header = * get_header();
@ -187,7 +187,7 @@ Code gen__array( StrC type )
, def_execution( code(
Header& header = * get_header();
ZPL_ASSERT( header.Num > 0 );
GEN_ASSERT( header.Num > 0 );
header.Num--;
))
);
@ -195,7 +195,7 @@ Code gen__array( StrC type )
CodeFn remove_at = def_function( name(remove_at), def_param( t_uw, name(idx)), t_void
, def_execution( code(
Header* header = get_header();
ZPL_ASSERT( idx < header->Num );
GEN_ASSERT( idx < header->Num );
mem_move( header + idx, header + idx + 1, sizeof( Type ) * ( header->Num - idx - 1 ) );
header->Num--;
@ -334,8 +334,8 @@ u32 gen_array_file()
gen_array_file;
gen_array_file.open( "array.Upfront.gen.hpp" );
CodeInclude include_zpl = def_include( txt_StrC("Bloat.hpp") );
gen_array_file.print( include_zpl );
CodeInclude include_gen = def_include( txt_StrC("gen.hpp") );
gen_array_file.print( include_gen );
gen_array_file.print( def_using_namespace( name(gen)));

View File

@ -115,7 +115,7 @@ Code gen__buffer( StrC type, sw type_size )
, def_execution( code(
Header& header = get_header();
ZPL_ASSERT( header.Num + num <= header.Capacity);
GEN_ASSERT( header.Num + num <= header.Capacity);
mem_copy( Data + header.Num, values, num * sizeof( Type ) );
@ -141,7 +141,7 @@ Code gen__buffer( StrC type, sw type_size )
CodeFn free = def_function( name(free), __, t_void
, def_execution( code(
Header& header = get_header();
zpl::free( header.Backing, & header );
gen::free( header.Backing, & header );
))
);
@ -238,7 +238,7 @@ u32 gen_buffer_file()
gen_buffer_file;
gen_buffer_file.open( "buffer.Upfront.gen.hpp" );
gen_buffer_file.print( def_include( txt_StrC("Bloat.hpp")) );
gen_buffer_file.print( def_include( txt_StrC("gen.hpp")) );
gen_buffer_file.print( def_using_namespace( name(gen)) );
gen_buffer_file.print( gen__buffer_base() );

View File

@ -151,7 +151,7 @@ Code gen__hashtable( StrC type )
CodeType t_map_proc = def_type( name(MapProc) );
Code body = def_execution( code(
ZPL_ASSERT_NOT_NULL( map_proc );
GEN_ASSERT_NOT_NULL( map_proc );
for ( sw idx = 0; idx < Entries.num(); idx++ )
{
@ -177,7 +177,7 @@ Code gen__hashtable( StrC type )
CodeType t_map_mut_proc = def_type( name(MapMutProc));
Code body = def_execution( code(
ZPL_ASSERT_NOT_NULL( map_proc );
GEN_ASSERT_NOT_NULL( map_proc );
for ( sw idx = 0; idx < Entries.num(); idx++ )
{
@ -447,7 +447,7 @@ u32 gen_hashtable_file()
gen_hashtable_file;
gen_hashtable_file.open( "hashtable.Upfront.gen.hpp" );
gen_hashtable_file.print( def_include( txt_StrC("Bloat.hpp")) );
gen_hashtable_file.print( def_include( txt_StrC("gen.hpp")) );
gen_hashtable_file.print( def_include( txt_StrC("Array.Upfront.hpp")) );
gen_hashtable_file.print( def_include( txt_StrC("array.Upfront.gen.hpp")) );

View File

@ -192,7 +192,7 @@ u32 gen_ring_file()
gen_ring_file;
gen_ring_file.open( "ring.Upfront.gen.hpp" );
gen_ring_file.print( def_include( txt_StrC("Bloat.hpp")) );
gen_ring_file.print( def_include( txt_StrC("gen.hpp")) );
gen_ring_file.print( def_include( txt_StrC("buffer.Upfront.gen.hpp")) );
gen_ring_file.print( def_using_namespace( name(gen)));

View File

@ -11,7 +11,7 @@ u32 gen_sanity_upfront()
// Comment
{
Code comment_test = def_comment( txt_StrC("Sanity check: def_comment test") );
CodeComment comment_test = def_comment( txt_StrC("Sanity check: def_comment test") );
gen_sanity_file.print(comment_test);
}
@ -50,7 +50,7 @@ u32 gen_sanity_upfront()
// Enum
{
Code fwd = def_enum( name(ETestEnum), NoCode, t_u8 );
CodeEnum fwd = def_enum( name(ETestEnum), NoCode, t_u8 );
CodeEnum def;
{
Code body = untyped_str( code(
@ -62,7 +62,7 @@ u32 gen_sanity_upfront()
def = def_enum( name(ETestEnum), body, t_u8 );
}
Code fwd_enum_class = def_enum( name(ETestEnumClass), NoCode, t_u8, EnumClass );
CodeEnum fwd_enum_class = def_enum( name(ETestEnumClass), NoCode, t_u8, EnumClass );
gen_sanity_file.print(fwd);
gen_sanity_file.print(def);
@ -73,7 +73,7 @@ u32 gen_sanity_upfront()
// External Linkage
{
Code body = def_extern_link_body( 1
CodeBody body = def_extern_link_body( 1
, def_comment( txt_StrC("Empty extern body") )
);
@ -114,7 +114,7 @@ u32 gen_sanity_upfront()
// Include
{
Code include = def_include( txt_StrC("../DummyInclude.hpp") );
CodeInclude include = def_include( txt_StrC("../DummyInclude.hpp") );
gen_sanity_file.print(include);
}
@ -124,9 +124,9 @@ u32 gen_sanity_upfront()
// Module
if (0)
{
Code module_export = def_module( name(TestModule), ModuleFlag::Export );
Code module_import = def_module( name(TestModule), ModuleFlag::Import );
Code module_both = def_module( name(TestModule), ModuleFlag::Export | ModuleFlag::Import );
CodeModule module_export = def_module( name(TestModule), ModuleFlag::Export );
CodeModule module_import = def_module( name(TestModule), ModuleFlag::Import );
CodeModule module_both = def_module( name(TestModule), ModuleFlag::Export | ModuleFlag::Import );
gen_sanity_file.print(module_global_fragment);
gen_sanity_file.print(module_private_fragment);
@ -141,7 +141,7 @@ u32 gen_sanity_upfront()
{
CodeNamespace namespace_def;
{
Code body = def_namespace_body( 1
CodeBody body = def_namespace_body( 1
, def_comment( txt_StrC("Empty namespace body") )
);
@ -157,9 +157,9 @@ u32 gen_sanity_upfront()
{
// Going to make a bit flag set of overloads for this.
Code bitflagtest;
CodeEnum bitflagtest;
{
Code body = def_enum_body( 1, untyped_str( code(
CodeBody body = def_enum_body( 1, untyped_str( code(
A = 1 << 0,
B = 1 << 1,
C = 1 << 2
@ -192,9 +192,9 @@ u32 gen_sanity_upfront()
{
CodeType t_u8_ptr = def_type( name(u8), __, spec_ptr );
Code op_ptr = def_operator_cast( t_u8_ptr, __ );
CodeOpCast op_ptr = def_operator_cast( t_u8_ptr, __ );
Code op_class = def_class( name(TestOperatorCast), def_class_body( args( op_ptr) ) );
CodeClass op_class = def_class( name(TestOperatorCast), def_class_body( args( op_ptr) ) );
gen_sanity_file.print(op_class);
}
@ -297,8 +297,8 @@ u32 gen_sanity_upfront()
// Variable
{
Code bss = def_variable( t_u8, name(test_variable) );
Code data = def_variable( t_u8, name(test_variable2), untyped_str( code( 0x12 )) );
CodeVar bss = def_variable( t_u8, name(test_variable) );
CodeVar data = def_variable( t_u8, name(test_variable2), untyped_str( code( 0x12 )) );
gen_sanity_file.print(bss);
gen_sanity_file.print(data);
@ -310,7 +310,7 @@ u32 gen_sanity_upfront()
{
CodeType t_Type = def_type( name(Type) );
Code tmpl = def_template( def_param( t_class, name(Type) )
CodeTemplate tmpl = def_template( def_param( t_class, name(Type) )
, def_function( name(test_template), def_param( t_Type, name(a) ), __
, def_function_body(1, def_comment( txt_StrC("Empty template function body")))
)