mirror of
https://github.com/Ed94/gencpp.git
synced 2025-07-30 00:46:59 -07:00
More dependency movement from zpl, incremental design improvements.
Made token_fmt more ergonomic, going to have to use a similar behavior with the upfront body constructors.
This commit is contained in:
@@ -32,8 +32,8 @@ Code gen__array( StrC type )
|
||||
name = { name_len, name_str };
|
||||
};
|
||||
|
||||
Code array = parse_struct( token_fmt(
|
||||
txt(
|
||||
Code array = parse_struct( token_fmt( "ArrayType", name, "type", type,
|
||||
stringize(
|
||||
struct <ArrayType>
|
||||
{
|
||||
using Header = ArrayHeader;
|
||||
@@ -208,11 +208,7 @@ Code gen__array( StrC type )
|
||||
return Data;
|
||||
}
|
||||
};
|
||||
),
|
||||
// Tokens
|
||||
2
|
||||
, "ArrayType", (char const*) name
|
||||
, "type", (char const*) type
|
||||
)
|
||||
));
|
||||
|
||||
return array;
|
||||
@@ -226,7 +222,7 @@ struct GenArrayRequest
|
||||
};
|
||||
Array<GenArrayRequest> GenArrayRequests;
|
||||
|
||||
void gen__array_request( StrC type, sw size, StrC dep = {} )
|
||||
void gen__array_request( StrC type, StrC dep = {} )
|
||||
{
|
||||
do_once_start
|
||||
GenArrayRequests = Array<GenArrayRequest>::init( Memory::GlobalAllocator );
|
||||
@@ -247,7 +243,7 @@ void gen__array_request( StrC type, sw size, StrC dep = {} )
|
||||
GenArrayRequest request = { dep, type };
|
||||
GenArrayRequests.append( request );
|
||||
}
|
||||
#define gen_array( type ) gen__array_request( { txt_to_StrC(type) }, sizeof(type) )
|
||||
#define gen_array( type ) gen__array_request( code(type) )
|
||||
|
||||
u32 gen_array_file()
|
||||
{
|
||||
@@ -255,9 +251,11 @@ u32 gen_array_file()
|
||||
gen_array_file;
|
||||
gen_array_file.open( "array.Parsed.gen.hpp" );
|
||||
|
||||
Code include_zpl = def_include( StrC::from("Bloat.hpp") );
|
||||
Code include_zpl = def_include( txt_StrC("Bloat.hpp") );
|
||||
gen_array_file.print( include_zpl );
|
||||
|
||||
gen_array_file.print( def_using_namespace( name(gen)));
|
||||
|
||||
Code array_base = gen__array_base();
|
||||
gen_array_file.print( array_base );
|
||||
|
||||
|
@@ -27,8 +27,8 @@ Code gen__buffer( StrC type )
|
||||
name = { name_len, name_str };
|
||||
};
|
||||
|
||||
Code buffer = parse_struct( token_fmt(
|
||||
txt(
|
||||
Code buffer = parse_struct( token_fmt( "BufferName", name, "type", type,
|
||||
stringize(
|
||||
struct <BufferName>
|
||||
{
|
||||
using Header = BufferHeader;
|
||||
@@ -123,10 +123,7 @@ Code gen__buffer( StrC type )
|
||||
|
||||
Type* Data;
|
||||
};
|
||||
),
|
||||
2
|
||||
, "BufferName", (char const*) name
|
||||
, "type", (char const*) type
|
||||
)
|
||||
));
|
||||
|
||||
return buffer;
|
||||
@@ -160,7 +157,7 @@ void gen__buffer_request( StrC type, StrC dep = {} )
|
||||
GenBufferRequest request = { dep, type };
|
||||
GenBufferRequests.append( request );
|
||||
}
|
||||
#define gen_buffer( type ) gen__buffer_request( { txt_to_StrC(type) } )
|
||||
#define gen_buffer( type ) gen__buffer_request( code(type) )
|
||||
|
||||
u32 gen_buffer_file()
|
||||
{
|
||||
@@ -168,7 +165,9 @@ u32 gen_buffer_file()
|
||||
gen_buffer_file;
|
||||
gen_buffer_file.open( "buffer.Parsed.gen.hpp" );
|
||||
|
||||
gen_buffer_file.print( def_include( StrC::from("Bloat.hpp")) );
|
||||
gen_buffer_file.print( def_include( txt_StrC("Bloat.hpp")) );
|
||||
gen_buffer_file.print( def_using_namespace( name(gen)));
|
||||
|
||||
gen_buffer_file.print( gen__buffer_base() );
|
||||
|
||||
GenBufferRequest* current = GenBufferRequests;
|
||||
|
@@ -18,7 +18,7 @@ Code gen__hashtable_base()
|
||||
));
|
||||
}
|
||||
|
||||
Code gen__hashtable( StrC type, sw type_size )
|
||||
Code gen__hashtable( StrC type )
|
||||
{
|
||||
StringCached name;
|
||||
{
|
||||
@@ -28,26 +28,23 @@ Code gen__hashtable( StrC type, sw type_size )
|
||||
name = get_cached_string({ len, name_str });
|
||||
}
|
||||
|
||||
Code ht_entry = parse_struct( token_fmt(
|
||||
txt(
|
||||
Code ht_entry = parse_struct( token_fmt( "HashTableName", (StrC)name, "type", type,
|
||||
stringize(
|
||||
struct <HashTableName>_Entry
|
||||
{
|
||||
u64 Key;
|
||||
sw Next;
|
||||
<type> Value;
|
||||
};
|
||||
),
|
||||
2
|
||||
, "HashTableName", (char const*) name
|
||||
, "type", (char const*) type
|
||||
)
|
||||
));
|
||||
|
||||
StringCached ht_entry_name = get_cached_string( token_fmt( "<HashTableName>_Entry", 1, "HashTableName", name ) );
|
||||
StringCached ht_entry_name = get_cached_string( token_fmt( "HashTableName", (StrC)name, "<HashTableName>_Entry" ));
|
||||
|
||||
Code array_ht_entry = gen__array( ht_entry_name );
|
||||
|
||||
Code hashtable = parse_struct( token_fmt(
|
||||
txt(
|
||||
Code hashtable = parse_struct( token_fmt( "HashTableName", (StrC)name, "type", type,
|
||||
stringize(
|
||||
struct <HashTableName>
|
||||
{
|
||||
using Type = <type>;
|
||||
@@ -275,10 +272,7 @@ Code gen__hashtable( StrC type, sw type_size )
|
||||
return 0.75f * Hashes.num() < Entries.num();
|
||||
}
|
||||
};
|
||||
),
|
||||
2
|
||||
, "HashTableName", (char const*) name
|
||||
, "type", (char const*) type
|
||||
)
|
||||
));
|
||||
|
||||
return def_global_body( 3, ht_entry, array_ht_entry, hashtable );
|
||||
@@ -288,11 +282,10 @@ struct GenHashTableRequest
|
||||
{
|
||||
StrC Dependency;
|
||||
StrC Type;
|
||||
sw TypeSize;
|
||||
};
|
||||
Array<GenHashTableRequest> GenHashTableRequests;
|
||||
|
||||
void gen__hashtable_request( StrC type, sw size, StrC dep = {} )
|
||||
void gen__hashtable_request( StrC type, StrC dep = {} )
|
||||
{
|
||||
do_once_start
|
||||
GenHashTableRequests = Array<GenHashTableRequest>::init( Memory::GlobalAllocator );
|
||||
@@ -312,21 +305,24 @@ void gen__hashtable_request( StrC type, sw size, StrC dep = {} )
|
||||
return;
|
||||
}
|
||||
|
||||
GenHashTableRequest request = { dep, type, size};
|
||||
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( code(type) )
|
||||
|
||||
u32 gen_hashtable_file()
|
||||
{
|
||||
Builder
|
||||
gen_buffer_file;
|
||||
gen_buffer_file.open( "hashtable.Parsed.gen.hpp" );
|
||||
gen_hashtable_file;
|
||||
gen_hashtable_file.open( "hashtable.Parsed.gen.hpp" );
|
||||
|
||||
gen_buffer_file.print( def_include( StrC::from("Bloat.hpp")) );
|
||||
gen_buffer_file.print( def_include( StrC::from("Array.Parsed.hpp")) );
|
||||
gen_buffer_file.print( def_include( StrC::from("array.Parsed.gen.hpp")) );
|
||||
gen_buffer_file.print( gen__hashtable_base());
|
||||
gen_hashtable_file.print( def_include( txt_StrC("Bloat.hpp")) );
|
||||
gen_hashtable_file.print( def_include( txt_StrC("Array.Parsed.hpp")) );
|
||||
gen_hashtable_file.print( def_include( txt_StrC("array.Parsed.gen.hpp")) );
|
||||
|
||||
gen_hashtable_file.print( def_using_namespace( name(gen)));
|
||||
|
||||
gen_hashtable_file.print( gen__hashtable_base());
|
||||
|
||||
GenHashTableRequest* current = GenHashTableRequests;
|
||||
s32 left = GenHashTableRequests.num();
|
||||
@@ -334,7 +330,7 @@ u32 gen_hashtable_file()
|
||||
{
|
||||
GenHashTableRequest const& request = * current;
|
||||
|
||||
Code generated_buffer = gen__hashtable( current->Type, current->TypeSize );
|
||||
Code generated_buffer = gen__hashtable( current->Type );
|
||||
|
||||
if ( request.Dependency )
|
||||
{
|
||||
@@ -344,15 +340,15 @@ u32 gen_hashtable_file()
|
||||
Code cmt = def_comment( { cmt_len, cmt_str } );
|
||||
Code include = def_include( request.Dependency );
|
||||
|
||||
gen_buffer_file.print( cmt );
|
||||
gen_buffer_file.print( include );
|
||||
gen_hashtable_file.print( cmt );
|
||||
gen_hashtable_file.print( include );
|
||||
}
|
||||
|
||||
gen_buffer_file.print( generated_buffer );
|
||||
gen_hashtable_file.print( generated_buffer );
|
||||
current++;
|
||||
}
|
||||
|
||||
gen_buffer_file.write();
|
||||
gen_hashtable_file.write();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@ Code gen__ring( StrC type )
|
||||
{
|
||||
static Code t_allocator_info = def_type( name(AllocatorInfo) );
|
||||
|
||||
String name;
|
||||
StringCached name;
|
||||
{
|
||||
char const* name_str = str_fmt_buf( "Ring_%s\0", type.Ptr );
|
||||
s32 name_len = str_len( name_str );
|
||||
@@ -18,8 +18,10 @@ Code gen__ring( StrC type )
|
||||
name = get_cached_string({ name_len, name_str });
|
||||
};
|
||||
|
||||
Code ring = parse_struct( token_fmt(
|
||||
txt(
|
||||
StrC buffer_name = to_StrC( str_fmt_buf( "Buffer_%s", type.Ptr ));
|
||||
|
||||
Code ring = parse_struct( token_fmt( "RingName", (StrC)name, "type", type, "BufferName", buffer_name,
|
||||
stringize(
|
||||
struct <RingName>
|
||||
{
|
||||
using Type = <type>;
|
||||
@@ -87,11 +89,7 @@ Code gen__ring( StrC type )
|
||||
uw Tail;
|
||||
<BufferName> Buffer;
|
||||
};
|
||||
),
|
||||
3
|
||||
, "RingName", (char const*) name
|
||||
, "type", (char const*) type
|
||||
, "BufferName", str_fmt_buf( "Buffer_%s", type.Ptr )
|
||||
)
|
||||
));
|
||||
|
||||
return ring;
|
||||
@@ -104,7 +102,7 @@ struct GenRingRequest
|
||||
};
|
||||
Array<GenRingRequest> GenRingRequests;
|
||||
|
||||
void gen__ring_request( StrC type, sw size, StrC dep = {} )
|
||||
void gen__ring_request( StrC type, StrC dep = {} )
|
||||
{
|
||||
do_once_start
|
||||
GenRingRequests = Array<GenRingRequest>::init( Memory::GlobalAllocator );
|
||||
@@ -128,7 +126,7 @@ void gen__ring_request( StrC type, sw size, StrC dep = {} )
|
||||
GenRingRequest request = { dep, type };
|
||||
GenRingRequests.append( request );
|
||||
}
|
||||
#define gen_ring( type ) gen__ring_request( { txt_to_StrC(type) }, sizeof( type ))
|
||||
#define gen_ring( type ) gen__ring_request( code(type) )
|
||||
|
||||
u32 gen_ring_file()
|
||||
{
|
||||
@@ -136,10 +134,12 @@ u32 gen_ring_file()
|
||||
gen_ring_file;
|
||||
gen_ring_file.open( "ring.Parsed.gen.hpp" );
|
||||
|
||||
gen_ring_file.print( def_include( StrC::from("Bloat.hpp")) );
|
||||
gen_ring_file.print( def_include( StrC::from("buffer.Parsed.gen.hpp")) );
|
||||
gen_ring_file.print( def_include( txt_StrC("Bloat.hpp")) );
|
||||
gen_ring_file.print( def_include( txt_StrC("buffer.Parsed.gen.hpp")) );
|
||||
// gen_ring_file.print( gen__ring_base() );
|
||||
|
||||
gen_ring_file.print( def_using_namespace( name(gen)));
|
||||
|
||||
GenRingRequest* current = GenRingRequests;
|
||||
s32 left = GenRingRequests.num();
|
||||
while (left--)
|
||||
|
@@ -10,7 +10,7 @@ u32 gen_sanity()
|
||||
gen_sanity_file;
|
||||
gen_sanity_file.open("./sanity.Parsed.gen.hpp");
|
||||
|
||||
gen_sanity_file.print( def_comment( StrC::from(
|
||||
gen_sanity_file.print( def_comment( txt_StrC(
|
||||
"The following will show a series of base cases for the gen parsed api.\n"
|
||||
)));
|
||||
|
||||
@@ -36,7 +36,7 @@ u32 gen_sanity()
|
||||
{};
|
||||
));
|
||||
|
||||
empty_body.body()->add_entry( def_comment( StrC::from("Empty class body") ) );
|
||||
empty_body.body()->add_entry( def_comment( txt_StrC("Empty class body") ) );
|
||||
|
||||
gen_sanity_file.print(fwd);
|
||||
gen_sanity_file.print(empty_body);
|
||||
@@ -72,7 +72,7 @@ u32 gen_sanity()
|
||||
|
||||
// External Linkage
|
||||
{
|
||||
Code empty_comment = def_comment( StrC::from("Empty external linkage") );
|
||||
Code empty_comment = def_comment( txt_StrC("Empty external linkage") );
|
||||
|
||||
Code c_extern = parse_extern_link( code(
|
||||
extern "C"
|
||||
@@ -118,7 +118,7 @@ u32 gen_sanity()
|
||||
}
|
||||
));
|
||||
|
||||
def.body()->add_entry( def_comment( StrC::from("Empty function body") ) );
|
||||
def.body()->add_entry( def_comment( txt_StrC("Empty function body") ) );
|
||||
|
||||
gen_sanity_file.print(fwd);
|
||||
gen_sanity_file.print(def);
|
||||
@@ -134,7 +134,7 @@ u32 gen_sanity()
|
||||
}
|
||||
));
|
||||
|
||||
def.body()->add_entry( def_comment( StrC::from("Empty namespace body") ) );
|
||||
def.body()->add_entry( def_comment( txt_StrC("Empty namespace body") ) );
|
||||
|
||||
gen_sanity_file.print(def);
|
||||
}
|
||||
@@ -201,7 +201,7 @@ u32 gen_sanity()
|
||||
}
|
||||
));
|
||||
|
||||
def.body()->add_entry( def_comment( StrC::from("Empty function body") ) );
|
||||
def.body()->add_entry( def_comment( txt_StrC("Empty function body") ) );
|
||||
|
||||
gen_sanity_file.print(fwd);
|
||||
gen_sanity_file.print(def);
|
||||
@@ -237,7 +237,7 @@ u32 gen_sanity()
|
||||
{};
|
||||
));
|
||||
|
||||
empty_body.body()->add_entry( def_comment( StrC::from("Empty struct body") ) );
|
||||
empty_body.body()->add_entry( def_comment( txt_StrC("Empty struct body") ) );
|
||||
|
||||
gen_sanity_file.print(fwd);
|
||||
gen_sanity_file.print(empty_body);
|
||||
@@ -253,7 +253,7 @@ u32 gen_sanity()
|
||||
};
|
||||
));
|
||||
|
||||
empty.body()->add_entry( def_comment( StrC::from("Empty union body") ) );
|
||||
empty.body()->add_entry( def_comment( txt_StrC("Empty union body") ) );
|
||||
|
||||
gen_sanity_file.print( parse_typedef( code( typedef unsigned short u16; )) );
|
||||
gen_sanity_file.print( parse_typedef( code( typedef unsigned long u32; )) );
|
||||
@@ -330,7 +330,7 @@ u32 gen_sanity()
|
||||
|
||||
gen_sanity_file.print_fmt("\n");
|
||||
|
||||
gen_sanity_file.print( def_comment( StrC::from(
|
||||
gen_sanity_file.print( def_comment( txt_StrC(
|
||||
"End of base case tests\n"
|
||||
)));
|
||||
|
||||
|
@@ -8,7 +8,4 @@ be better on in c++ as templates, since the templates they generate are trivial
|
||||
An exmaple of a non-trival generation is a container for elements with SOA or AOS policy for layout.
|
||||
(If a unified element syntax is desired)
|
||||
|
||||
The test is divided between two major sets of tests: Parsed and Nonparsed.
|
||||
|
||||
Parsed uses the parsing api strictly.
|
||||
NonParsed only uses the upfront and incremental constructors.
|
||||
The test is divided between two major sets of tests: Parsed and Upfront.
|
||||
|
40
test/SOA.hpp
40
test/SOA.hpp
@@ -30,17 +30,15 @@ Code gen_SOA( Code struct_def, bool use_dynamic = false )
|
||||
Code entry_arr = { nullptr };
|
||||
if ( use_dynamic)
|
||||
{
|
||||
entry_arr = parse_variable( token_fmt( "Array<<type>> <name>;", 2
|
||||
, "type", (char const*)var_type->Name
|
||||
, "name", (char const*)struct_mem->Name )
|
||||
);
|
||||
entry_arr = parse_variable( token_fmt( "type", (StrC)var_type->Name, "name", (StrC)struct_mem->Name,
|
||||
stringize( Array<<type>> <name>; )
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
entry_arr = parse_variable( token_fmt( "<type> <name>[100];", 2
|
||||
, "type", (char const*)var_type->Name
|
||||
, "name", (char const*)struct_mem->Name )
|
||||
);
|
||||
entry_arr = parse_variable( token_fmt( "type", (StrC)var_type->Name, "name", (StrC)struct_mem->Name,
|
||||
stringize( <type> <name>[100]; )
|
||||
));
|
||||
}
|
||||
|
||||
vars.append( entry_arr );
|
||||
@@ -51,15 +49,14 @@ Code gen_SOA( Code struct_def, bool use_dynamic = false )
|
||||
|
||||
Code make;
|
||||
{
|
||||
make = parse_function( token_fmt(
|
||||
txt(
|
||||
static
|
||||
<SOA_Type> make( AllocatorInfo allocator )
|
||||
{
|
||||
<SOA_Type> soa = {};
|
||||
}
|
||||
),
|
||||
1, "SOA_Type", (char const*)name
|
||||
make = parse_function( token_fmt("SOA_Type", name,
|
||||
stringize(
|
||||
static
|
||||
<SOA_Type> make( AllocatorInfo allocator )
|
||||
{
|
||||
<SOA_Type> soa = {};
|
||||
}
|
||||
)
|
||||
));
|
||||
|
||||
if ( use_dynamic )
|
||||
@@ -68,9 +65,8 @@ Code gen_SOA( Code struct_def, bool use_dynamic = false )
|
||||
{
|
||||
Code member = vars[idx];
|
||||
|
||||
Code arr_init = def_execution( token_fmt( "soa.<var_name> = <var_type>::init( allocator );", 2
|
||||
, "var_name", (char const*)member->Name
|
||||
, "var_type", (char const*)member->entry(0)->Name
|
||||
Code arr_init = def_execution( token_fmt( "var_name", (StrC)member->Name, "var_type", (StrC)member->entry(0)->Name,
|
||||
stringize( soa.<var_name> = <var_type>::init( allocator ); )
|
||||
));
|
||||
|
||||
make.body()->add_entry( arr_init );
|
||||
@@ -94,8 +90,8 @@ Code gen_SOA( Code struct_def, bool use_dynamic = false )
|
||||
{
|
||||
Code member = vars[idx];
|
||||
|
||||
content.append_fmt( token_fmt( "<var_name>[idx],", 1
|
||||
, "var_name", (char const*)member->Name
|
||||
content.append_fmt( token_fmt( "var_name", (StrC)member->Name,
|
||||
"<var_name>[idx],"
|
||||
));
|
||||
}
|
||||
|
||||
|
@@ -94,16 +94,18 @@ Code gen__array( StrC type )
|
||||
|
||||
Code append = def_function( name(append), def_param(t_alias, name(value)), t_bool
|
||||
, def_execution( code(
|
||||
Header& header = get_header();
|
||||
Header* header = get_header();
|
||||
|
||||
if ( header.Num == header.Capacity )
|
||||
if ( header->Num == header->Capacity )
|
||||
{
|
||||
if ( ! grow( header.Capacity ))
|
||||
if ( ! grow( header->Capacity ))
|
||||
return false;
|
||||
|
||||
header = get_header();
|
||||
}
|
||||
|
||||
Data[ header.Num ] = value;
|
||||
header.Num++;
|
||||
Data[ header->Num ] = value;
|
||||
header->Num++;
|
||||
|
||||
return true;
|
||||
))
|
||||
@@ -111,14 +113,14 @@ Code gen__array( StrC type )
|
||||
|
||||
Code back = def_function( name(back), __, t_alias_ref
|
||||
, def_execution( code(
|
||||
Header& header = get_header();
|
||||
Header& header = * get_header();
|
||||
return Data[ header.Num - 1 ];
|
||||
))
|
||||
);
|
||||
|
||||
Code clear = def_function( name(clear), __, t_void
|
||||
, def_execution( code(
|
||||
Header& header = get_header();
|
||||
Header& header = * get_header();
|
||||
header.Num = 0;
|
||||
))
|
||||
);
|
||||
@@ -132,7 +134,7 @@ Code gen__array( StrC type )
|
||||
);
|
||||
|
||||
Code body = untyped_str( code(
|
||||
Header& header = get_header();
|
||||
Header& header = * get_header();
|
||||
|
||||
if ( begin < 0 || end >= header.Num )
|
||||
return false;
|
||||
@@ -150,20 +152,20 @@ Code gen__array( StrC type )
|
||||
|
||||
Code free = def_function( name(free), __, t_void
|
||||
, def_execution( code(
|
||||
Header& header = get_header();
|
||||
zpl::free( header.Allocator, & header );
|
||||
Header* header = get_header();
|
||||
gen::free( header->Allocator, header );
|
||||
))
|
||||
);
|
||||
|
||||
Code get_header = def_function( name(get_header), __, t_header_ref
|
||||
Code get_header = def_function( name(get_header), __, t_header_ptr
|
||||
, def_execution( code(
|
||||
return * ( rcast( Header*, Data ) - 1 );
|
||||
return rcast( Header*, Data ) - 1;
|
||||
))
|
||||
);
|
||||
|
||||
Code grow = def_function( name(grow), def_param( t_uw, name(min_capacity)), t_bool
|
||||
, def_execution( code(
|
||||
Header& header = get_header();
|
||||
Header& header = * get_header();
|
||||
|
||||
uw new_capacity = grow_formula( header.Capacity );
|
||||
|
||||
@@ -176,13 +178,13 @@ Code gen__array( StrC type )
|
||||
|
||||
Code num = def_function( name(num), __, t_uw
|
||||
, def_execution( code(
|
||||
return get_header().Num;
|
||||
return get_header()->Num;
|
||||
))
|
||||
);
|
||||
|
||||
Code pop = def_function( name(pop), __, t_bool
|
||||
, def_execution( code(
|
||||
Header& header = get_header();
|
||||
Header& header = * get_header();
|
||||
|
||||
ZPL_ASSERT( header.Num > 0 );
|
||||
header.Num--;
|
||||
@@ -191,7 +193,7 @@ Code gen__array( StrC type )
|
||||
|
||||
Code remove_at = def_function( name(remove_at), def_param( t_uw, name(idx)), t_void
|
||||
, def_execution( code(
|
||||
Header* header = & get_header();
|
||||
Header* header = get_header();
|
||||
ZPL_ASSERT( idx < header->Num );
|
||||
|
||||
mem_move( header + idx, header + idx + 1, sizeof( Type ) * ( header->Num - idx - 1 ) );
|
||||
@@ -201,7 +203,7 @@ Code gen__array( StrC type )
|
||||
|
||||
Code reserve = def_function( name(reserve), def_param( t_uw, name(new_capacity)), t_bool
|
||||
, def_execution( code(
|
||||
Header& header = get_header();
|
||||
Header& header = * get_header();
|
||||
|
||||
if ( header.Capacity < new_capacity )
|
||||
return set_capacity( new_capacity );
|
||||
@@ -212,15 +214,17 @@ Code gen__array( StrC type )
|
||||
|
||||
Code resize = def_function( name(resize), def_param( t_uw, name(num)), t_bool
|
||||
, def_execution( code(
|
||||
Header& header = get_header();
|
||||
Header* header = get_header();
|
||||
|
||||
if ( num > header.Capacity )
|
||||
if ( num > header->Capacity )
|
||||
{
|
||||
if ( ! grow( header.Capacity ))
|
||||
if ( ! grow( header->Capacity ))
|
||||
return false;
|
||||
|
||||
header = get_header();
|
||||
}
|
||||
|
||||
header.Num = num;
|
||||
header->Num = num;
|
||||
return true;
|
||||
))
|
||||
);
|
||||
@@ -228,7 +232,7 @@ Code gen__array( StrC type )
|
||||
Code set_capacity;
|
||||
{
|
||||
Code body = def_execution( code(
|
||||
Header& header = get_header();
|
||||
Header& header = * get_header();
|
||||
|
||||
if ( new_capacity == header.Capacity )
|
||||
return true;
|
||||
@@ -244,13 +248,11 @@ Code gen__array( StrC type )
|
||||
|
||||
mem_move( new_header, & header, sizeof( Header ) + sizeof(Type) * header.Num );
|
||||
|
||||
new_header->Allocator = header.Allocator;
|
||||
new_header->Num = header.Num;
|
||||
new_header->Capacity = new_capacity;
|
||||
new_header->Capacity = new_capacity;
|
||||
|
||||
zpl::free( header.Allocator, & header );
|
||||
gen::free( header.Allocator, & header );
|
||||
|
||||
Data = (Type*) new_header + 1;
|
||||
Data = rcast( Type*, new_header + 1);
|
||||
|
||||
return true;
|
||||
));
|
||||
@@ -323,17 +325,19 @@ void gen__array_request( StrC type, StrC dep = {} )
|
||||
GenArrayRequest request = { dep, type };
|
||||
GenArrayRequests.append( request );
|
||||
}
|
||||
#define gen_array( type ) gen__array_request( { txt_to_StrC(type) } )
|
||||
#define gen_array( type ) gen__array_request( code(type) )
|
||||
|
||||
u32 gen_array_file()
|
||||
{
|
||||
Builder
|
||||
gen_array_file;
|
||||
gen_array_file.open( "array.NonParsed.gen.hpp" );
|
||||
gen_array_file.open( "array.Upfront.gen.hpp" );
|
||||
|
||||
Code include_zpl = def_include( StrC::from("Bloat.hpp") );
|
||||
Code include_zpl = def_include( txt_StrC("Bloat.hpp") );
|
||||
gen_array_file.print( include_zpl );
|
||||
|
||||
gen_array_file.print( def_using_namespace( name(gen)));
|
||||
|
||||
Code array_base = gen__array_base();
|
||||
gen_array_file.print( array_base );
|
||||
|
@@ -208,7 +208,7 @@ struct GenBufferRequest
|
||||
};
|
||||
Array<GenBufferRequest> GenBufferRequests;
|
||||
|
||||
void gen__buffer_request( StrC type, sw size, StrC dep = {} )
|
||||
void gen__buffer_request( StrC type, StrC dep = {} )
|
||||
{
|
||||
do_once_start
|
||||
GenBufferRequests = Array<GenBufferRequest>::init( Memory::GlobalAllocator );
|
||||
@@ -226,18 +226,20 @@ void gen__buffer_request( StrC type, sw size, StrC dep = {} )
|
||||
return;
|
||||
}
|
||||
|
||||
GenBufferRequest request = { dep, type, size};
|
||||
GenBufferRequest request = { dep, type};
|
||||
GenBufferRequests.append( request );
|
||||
}
|
||||
#define gen_buffer( type ) gen__buffer_request( { txt_to_StrC(type) }, sizeof( type ))
|
||||
#define gen_buffer( type ) gen__buffer_request( code(type))
|
||||
|
||||
u32 gen_buffer_file()
|
||||
{
|
||||
Builder
|
||||
gen_buffer_file;
|
||||
gen_buffer_file.open( "buffer.NonParsed.gen.hpp" );
|
||||
gen_buffer_file.open( "buffer.Upfront.gen.hpp" );
|
||||
|
||||
gen_buffer_file.print( def_include( txt_StrC("Bloat.hpp")) );
|
||||
gen_buffer_file.print( def_using_namespace( name(gen)) );
|
||||
|
||||
gen_buffer_file.print( def_include( StrC::from("Bloat.hpp")) );
|
||||
gen_buffer_file.print( gen__buffer_base() );
|
||||
|
||||
GenBufferRequest* current = GenBufferRequests;
|
@@ -2,7 +2,7 @@
|
||||
|
||||
#if gen_time
|
||||
#include "gen.hpp"
|
||||
#include "Array.NonParsed.hpp"
|
||||
#include "Array.Upfront.hpp"
|
||||
|
||||
using namespace gen;
|
||||
|
||||
@@ -74,7 +74,7 @@ Code gen__hashtable( StrC type )
|
||||
|
||||
Code init;
|
||||
{
|
||||
char const* tmpl = txt(
|
||||
char const* tmpl = stringize(
|
||||
<type> result = { 0 };
|
||||
|
||||
result.Hashes = Array_sw ::init( allocator );
|
||||
@@ -82,11 +82,31 @@ Code gen__hashtable( StrC type )
|
||||
|
||||
return result;
|
||||
);
|
||||
Code body = def_execution( token_fmt( tmpl, 1, "type", name ) );
|
||||
Code body = def_execution( token_fmt( "type", (StrC)name, tmpl ) );
|
||||
|
||||
init = def_function( name(init), def_param( t_allocator_info, name(allocator)), t_ht_type, body, spec_static_member );
|
||||
}
|
||||
|
||||
|
||||
Code init_reserve;
|
||||
{
|
||||
char const* tmpl = stringize(
|
||||
<type> result = { { nullptr }, { nullptr } };
|
||||
|
||||
result.Hashes = Array_sw::init_reserve( allocator, num );
|
||||
result.Hashes.get_header()->Num = num;
|
||||
|
||||
result.Entries = Array_Entry::init_reserve( allocator, num );
|
||||
|
||||
return result;
|
||||
);
|
||||
Code body = def_execution( token_fmt( "type", (StrC)name, tmpl ) );
|
||||
|
||||
Code params = def_params( 2, def_param( t_allocator_info, name(allocator)), def_param( t_sw, name(num)));
|
||||
|
||||
init_reserve = def_function( name(init_reserve), params, t_ht_type, body, spec_static_member );
|
||||
}
|
||||
|
||||
Code clear = def_function( name(clear), __, t_void
|
||||
, def_execution( code(
|
||||
for ( s32 idx = 0; idx < Hashes.num(); idx++ )
|
||||
@@ -98,9 +118,9 @@ Code gen__hashtable( StrC type )
|
||||
|
||||
Code destroy = def_function( name(destroy), __, t_void
|
||||
, def_execution( code(
|
||||
if ( Hashes )
|
||||
if ( Hashes && Hashes.get_header()->Capacity )
|
||||
Hashes.free();
|
||||
if ( Entries )
|
||||
if ( Entries && Hashes.get_header()->Capacity )
|
||||
Entries.free();
|
||||
))
|
||||
);
|
||||
@@ -108,7 +128,7 @@ Code gen__hashtable( StrC type )
|
||||
Code get = def_function( name(get), def_param( t_u64, name(key)), t_type_ptr
|
||||
, def_execution( code(
|
||||
sw idx = find( key ).EntryIndex;
|
||||
if ( idx > 0 )
|
||||
if ( idx >= 0 )
|
||||
return & Entries[ idx ].Value;
|
||||
|
||||
return nullptr;
|
||||
@@ -117,10 +137,10 @@ Code gen__hashtable( StrC type )
|
||||
|
||||
Code using_map_proc;
|
||||
{
|
||||
char const* tmpl = txt(
|
||||
char const* tmpl = stringize(
|
||||
void (*) ( u64 key, <type> value )
|
||||
);
|
||||
Code value = untyped_str( token_fmt( tmpl, 1, "type", t_type.to_string() ) );
|
||||
Code value = untyped_str( token_fmt( "type", (StrC)t_type.to_string(), tmpl ) );
|
||||
|
||||
using_map_proc = def_using ( name(MapProc), value);
|
||||
}
|
||||
@@ -143,10 +163,10 @@ Code gen__hashtable( StrC type )
|
||||
|
||||
Code using_map_mut_proc;
|
||||
{
|
||||
char const* tmpl = txt(
|
||||
char const* tmpl = stringize(
|
||||
void (*) ( u64 key, <type> value )
|
||||
);
|
||||
Code value = untyped_str( token_fmt( tmpl, 1, "type", t_type_ptr.to_string() ) );
|
||||
Code value = untyped_str( token_fmt( "type", (StrC)t_type_ptr.to_string(), tmpl ) );
|
||||
|
||||
using_map_mut_proc = def_using ( name(MapMutProc), value);
|
||||
}
|
||||
@@ -176,14 +196,13 @@ Code gen__hashtable( StrC type )
|
||||
|
||||
Code rehash;
|
||||
{
|
||||
char const* tmpl = txt(
|
||||
char const* tmpl = stringize(
|
||||
sw idx;
|
||||
sw last_added_index;
|
||||
|
||||
<type> new_ht = <type>::init( Hashes.get_header().Allocator );
|
||||
<type> new_ht = init_reserve( Hashes.get_header()->Allocator, new_num );
|
||||
|
||||
new_ht.Hashes.resize( new_num );
|
||||
new_ht.Entries.reserve( new_ht.Hashes.num() );
|
||||
Array_sw::Header* hash_header = new_ht.Hashes.get_header();
|
||||
|
||||
for ( idx = 0; idx < new_ht.Hashes.num(); ++idx )
|
||||
new_ht.Hashes[ idx ] = -1;
|
||||
@@ -211,22 +230,17 @@ Code gen__hashtable( StrC type )
|
||||
new_ht.Entries[ last_added_index ].Value = entry.Value;
|
||||
}
|
||||
|
||||
// *this = new_ht;
|
||||
|
||||
// old_ht.destroy();
|
||||
|
||||
destroy();
|
||||
Hashes = new_ht.Hashes;
|
||||
Entries = new_ht.Entries;
|
||||
*this = new_ht;
|
||||
);
|
||||
Code body = def_execution( token_fmt( tmpl, 1, "type", name ) );
|
||||
Code body = def_execution( token_fmt( "type", (StrC)name, tmpl ) );
|
||||
|
||||
rehash = def_function( name(rehash), def_param( t_sw, name(new_num)), t_void, body );
|
||||
}
|
||||
|
||||
Code rehash_fast;
|
||||
{
|
||||
char const* tmpl = txt(
|
||||
char const* tmpl = stringize(
|
||||
sw idx;
|
||||
|
||||
for ( idx = 0; idx < Entries.num(); idx++ )
|
||||
@@ -242,7 +256,7 @@ Code gen__hashtable( StrC type )
|
||||
FindResult find_result;
|
||||
}
|
||||
);
|
||||
Code body = def_execution( token_fmt( tmpl, 1, "type", name ) );
|
||||
Code body = def_execution( token_fmt( "type", name, tmpl ) );
|
||||
|
||||
rehash_fast = def_function( name(rehash_fast), __, t_void, body );
|
||||
}
|
||||
@@ -358,7 +372,7 @@ Code gen__hashtable( StrC type )
|
||||
))
|
||||
);
|
||||
|
||||
hashtable = def_struct( name, def_struct_body( 24
|
||||
hashtable = def_struct( name, def_struct_body( 25
|
||||
, using_entry
|
||||
, using_array_entry
|
||||
, using_find_result
|
||||
@@ -366,6 +380,7 @@ Code gen__hashtable( StrC type )
|
||||
, using_map_mut_proc
|
||||
|
||||
, init
|
||||
, init_reserve
|
||||
|
||||
, clear
|
||||
, destroy
|
||||
@@ -423,19 +438,21 @@ void gen__hashtable_request( StrC type, StrC dep = {} )
|
||||
GenHashTableRequest request = { dep, type };
|
||||
GenHashTableRequests.append( request );
|
||||
}
|
||||
#define gen_hashtable( type ) gen__hashtable_request( { txt_to_StrC(type) } )
|
||||
#define gen_hashtable( type ) gen__hashtable_request( code(type))
|
||||
|
||||
u32 gen_hashtable_file()
|
||||
{
|
||||
Builder
|
||||
gen_buffer_file;
|
||||
gen_buffer_file.open( "hashtable.NonParsed.gen.hpp" );
|
||||
gen_hashtable_file;
|
||||
gen_hashtable_file.open( "hashtable.Upfront.gen.hpp" );
|
||||
|
||||
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.NonParsed.gen.hpp")) );
|
||||
gen_hashtable_file.print( def_include( txt_StrC("Bloat.hpp")) );
|
||||
gen_hashtable_file.print( def_include( txt_StrC("Array.Upfront.hpp")) );
|
||||
gen_hashtable_file.print( def_include( txt_StrC("array.Upfront.gen.hpp")) );
|
||||
|
||||
gen_buffer_file.print( gen__hashtable_base());
|
||||
gen_hashtable_file.print( def_using_namespace( name(gen)));
|
||||
|
||||
gen_hashtable_file.print( gen__hashtable_base());
|
||||
|
||||
GenHashTableRequest* current = GenHashTableRequests;
|
||||
s32 left = GenHashTableRequests.num();
|
||||
@@ -453,15 +470,15 @@ u32 gen_hashtable_file()
|
||||
Code cmt = def_comment( { cmt_len, cmt_str } );
|
||||
Code include = def_include( request.Dependency );
|
||||
|
||||
gen_buffer_file.print( cmt );
|
||||
gen_buffer_file.print( include );
|
||||
gen_hashtable_file.print( cmt );
|
||||
gen_hashtable_file.print( include );
|
||||
}
|
||||
|
||||
gen_buffer_file.print( generated_buffer );
|
||||
gen_hashtable_file.print( generated_buffer );
|
||||
current++;
|
||||
}
|
||||
|
||||
gen_buffer_file.write();
|
||||
gen_hashtable_file.write();
|
||||
return 0;
|
||||
}
|
||||
|
@@ -2,11 +2,11 @@
|
||||
|
||||
#if gen_time
|
||||
#include "gen.hpp"
|
||||
#include "Buffer.NonParsed.hpp"
|
||||
#include "Buffer.Upfront.hpp"
|
||||
|
||||
using namespace gen;
|
||||
|
||||
Code gen__ring( StrC type, sw type_size )
|
||||
Code gen__ring( StrC type )
|
||||
{
|
||||
static Code t_allocator_info = def_type( name(AllocatorInfo) );
|
||||
|
||||
@@ -50,7 +50,7 @@ Code gen__ring( StrC type, sw type_size )
|
||||
, def_param( t_uw, name(max_size) )
|
||||
);
|
||||
|
||||
char const* tmpl = txt(
|
||||
char const* tmpl = stringize(
|
||||
<type> result = { 0 };
|
||||
|
||||
result.Backing = allocator;
|
||||
@@ -64,10 +64,7 @@ Code gen__ring( StrC type, sw type_size )
|
||||
|
||||
return result;
|
||||
);
|
||||
Code body = def_execution( token_fmt( tmpl, 2
|
||||
, "type", (char const*)name
|
||||
, "data_type", (char const*)type
|
||||
));
|
||||
Code body = def_execution( token_fmt( "type", (StrC)name, "data_type", type, tmpl ));
|
||||
|
||||
init = def_function( name(init), params, t_ring_type, body, spec_static_member );
|
||||
}
|
||||
@@ -160,11 +157,10 @@ struct GenRingRequest
|
||||
{
|
||||
StrC Dependency;
|
||||
StrC Type;
|
||||
sw TypeSize;
|
||||
};
|
||||
Array<GenRingRequest> GenRingRequests;
|
||||
|
||||
void gen__ring_request( StrC type, sw size, StrC dep = {} )
|
||||
void gen__ring_request( StrC type, StrC dep = {} )
|
||||
{
|
||||
do_once_start
|
||||
GenRingRequests = Array<GenRingRequest>::init( Memory::GlobalAllocator );
|
||||
@@ -183,22 +179,23 @@ void gen__ring_request( StrC type, sw size, StrC dep = {} )
|
||||
}
|
||||
|
||||
// Ring definition depends on a array and buffer definition.
|
||||
gen__buffer_request( type, size, dep );
|
||||
gen__buffer_request( type, dep );
|
||||
|
||||
GenRingRequest request = { dep, type, size};
|
||||
GenRingRequest request = { dep, type };
|
||||
GenRingRequests.append( request );
|
||||
}
|
||||
#define gen_ring( type ) gen__ring_request( { txt_to_StrC(type) }, sizeof( type ))
|
||||
#define gen_ring( type ) gen__ring_request( code(type) )
|
||||
|
||||
u32 gen_ring_file()
|
||||
{
|
||||
Builder
|
||||
gen_ring_file;
|
||||
gen_ring_file.open( "ring.NonParsed.gen.hpp" );
|
||||
gen_ring_file.open( "ring.Upfront.gen.hpp" );
|
||||
|
||||
gen_ring_file.print( def_include( StrC::from("Bloat.hpp")) );
|
||||
gen_ring_file.print( def_include( StrC::from("buffer.NonParsed.gen.hpp")) );
|
||||
// gen_ring_file.print( gen__ring_base() );
|
||||
gen_ring_file.print( def_include( txt_StrC("Bloat.hpp")) );
|
||||
gen_ring_file.print( def_include( txt_StrC("buffer.Upfront.gen.hpp")) );
|
||||
|
||||
gen_ring_file.print( def_using_namespace( name(gen)));
|
||||
|
||||
GenRingRequest* current = GenRingRequests;
|
||||
s32 left = GenRingRequests.num();
|
||||
@@ -206,7 +203,7 @@ u32 gen_ring_file()
|
||||
{
|
||||
GenRingRequest const& request = * current;
|
||||
|
||||
Code generated_ring = gen__ring( current->Type, current->TypeSize );
|
||||
Code generated_ring = gen__ring( current->Type );
|
||||
|
||||
if ( request.Dependency )
|
||||
{
|
@@ -7,17 +7,17 @@ u32 gen_sanity()
|
||||
{
|
||||
Builder
|
||||
gen_sanity_file;
|
||||
gen_sanity_file.open("./sanity.NonParsed.gen.hpp");
|
||||
gen_sanity_file.open("./sanity.Upfront.gen.hpp");
|
||||
|
||||
// Comment
|
||||
{
|
||||
Code comment_test = def_comment( StrC::from("Sanity check: def_comment test") );
|
||||
Code comment_test = def_comment( txt_StrC("Sanity check: def_comment test") );
|
||||
|
||||
gen_sanity_file.print(comment_test);
|
||||
}
|
||||
|
||||
gen_sanity_file.print_fmt("\n");
|
||||
gen_sanity_file.print( def_comment( StrC::from(
|
||||
gen_sanity_file.print( def_comment( txt_StrC(
|
||||
"The following will show a series of base cases for the gen api.\n"
|
||||
)));
|
||||
|
||||
@@ -26,7 +26,7 @@ u32 gen_sanity()
|
||||
Code fwd = def_class( name(TestEmptyClass) );
|
||||
Code empty_body;
|
||||
{
|
||||
Code cmt = def_comment( StrC::from("Empty class body") );
|
||||
Code cmt = def_comment( txt_StrC("Empty class body") );
|
||||
Code body = def_class_body( 1, cmt );
|
||||
|
||||
empty_body = def_class( name(TestEmptyClass), body );
|
||||
@@ -74,7 +74,7 @@ u32 gen_sanity()
|
||||
// External Linkage
|
||||
{
|
||||
Code body = def_extern_link_body( 1
|
||||
, def_comment( StrC::from("Empty extern body") )
|
||||
, def_comment( txt_StrC("Empty extern body") )
|
||||
);
|
||||
|
||||
Code c_extern = def_extern_link( name(C), body );
|
||||
@@ -102,7 +102,7 @@ u32 gen_sanity()
|
||||
Code def;
|
||||
{
|
||||
Code body = def_function_body( 1
|
||||
, def_comment( StrC::from("Empty function body") )
|
||||
, def_comment( txt_StrC("Empty function body") )
|
||||
);
|
||||
|
||||
def = def_function( name(test_function), __, __, body );
|
||||
@@ -116,7 +116,7 @@ u32 gen_sanity()
|
||||
|
||||
// Include
|
||||
{
|
||||
Code include = def_include( StrC::from("../DummyInclude.hpp") );
|
||||
Code include = def_include( txt_StrC("../DummyInclude.hpp") );
|
||||
|
||||
gen_sanity_file.print(include);
|
||||
}
|
||||
@@ -144,7 +144,7 @@ u32 gen_sanity()
|
||||
Code namespace_def;
|
||||
{
|
||||
Code body = def_namespace_body( 1
|
||||
, def_comment( StrC::from("Empty namespace body") )
|
||||
, def_comment( txt_StrC("Empty namespace body") )
|
||||
);
|
||||
|
||||
namespace_def = def_namespace( name(TestNamespace), body );
|
||||
@@ -215,7 +215,7 @@ u32 gen_sanity()
|
||||
Code def, def2;
|
||||
{
|
||||
Code body = def_function_body( 1
|
||||
, def_comment( StrC::from("Empty function body") )
|
||||
, def_comment( txt_StrC("Empty function body") )
|
||||
);
|
||||
|
||||
Code params = def_params( 2
|
||||
@@ -261,7 +261,7 @@ u32 gen_sanity()
|
||||
Code fwd = def_class( name(TestEmptyStruct) );
|
||||
Code empty_body;
|
||||
{
|
||||
Code cmt = def_comment( StrC::from("Empty struct body") );
|
||||
Code cmt = def_comment( txt_StrC("Empty struct body") );
|
||||
Code body = def_class_body( 1, cmt );
|
||||
|
||||
empty_body = def_class( name(TestEmptyStruct), body );
|
||||
@@ -276,7 +276,7 @@ u32 gen_sanity()
|
||||
// Union
|
||||
{
|
||||
Code body = def_union_body( 1
|
||||
, def_comment( StrC::from("Empty union body") )
|
||||
, def_comment( txt_StrC("Empty union body") )
|
||||
);
|
||||
|
||||
Code def = def_union( name(TestEmptyUnion), body );
|
||||
@@ -314,7 +314,7 @@ u32 gen_sanity()
|
||||
|
||||
Code 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( StrC::from("Empty template function body")))
|
||||
, def_function_body(1, def_comment( txt_StrC("Empty template function body")))
|
||||
)
|
||||
);
|
||||
|
||||
@@ -323,7 +323,7 @@ u32 gen_sanity()
|
||||
|
||||
gen_sanity_file.print_fmt("\n");
|
||||
|
||||
gen_sanity_file.print( def_comment( StrC::from(
|
||||
gen_sanity_file.print( def_comment( txt_StrC(
|
||||
"End of base case tests.\n"
|
||||
)));
|
||||
|
@@ -11,8 +11,7 @@ includes = include_directories(
|
||||
# get_sources = files('./get_sources.ps1')
|
||||
# sources = files(run_command('powershell', get_sources, check: true).stdout().strip().split('\n'))
|
||||
|
||||
sources = [ '../test.NonParsed.cpp' ]
|
||||
sources_parsed = [ '../test.Parsed.cpp' ]
|
||||
sources = [ '../test.cpp' ]
|
||||
|
||||
if get_option('buildtype').startswith('debug')
|
||||
|
||||
@@ -26,4 +25,3 @@ endif
|
||||
add_project_arguments('-Dgen_time', language : ['c', 'cpp'])
|
||||
|
||||
executable( 'gencpp', sources, include_directories : includes )
|
||||
executable( 'gencpp_parsed', sources_parsed, include_directories : includes )
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "Bloat.cpp"
|
||||
#include "NonParsed\Array.NonParsed.hpp"
|
||||
#include "NonParsed\Buffer.NonParsed.hpp"
|
||||
#include "NonParsed\HashTable.NonParsed.hpp"
|
||||
#include "NonParsed\Ring.NonParsed.hpp"
|
||||
#include "NonParsed\Sanity.NonParsed.hpp"
|
||||
#include "Upfront\Array.Upfront.hpp"
|
||||
#include "Upfront\Buffer.Upfront.hpp"
|
||||
#include "Upfront\HashTable.Upfront.hpp"
|
||||
#include "Upfront\Ring.Upfront.hpp"
|
||||
#include "Upfront\Sanity.Upfront.hpp"
|
||||
|
||||
|
||||
#ifdef gen_time
|
||||
@@ -20,7 +20,7 @@ int gen_main()
|
||||
gen_sanity();
|
||||
|
||||
gen_array( u8 );
|
||||
// gen_array( sw );
|
||||
gen_array( sw );
|
||||
|
||||
gen_buffer( u8 );
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
using namespace gen;
|
||||
|
||||
// TODO : Rewrite this to include both upfront and parsed testing.
|
||||
|
||||
int gen_main()
|
||||
{
|
||||
@@ -41,7 +42,7 @@ int gen_main()
|
||||
using u16 = unsigned short;
|
||||
)));
|
||||
|
||||
soa_test.print( def_include( StrC::from("Bloat.hpp")));
|
||||
soa_test.print( def_include( txt_StrC("Bloat.hpp")));
|
||||
|
||||
soa_test.print( def_using_namespace( name(gen) ) );
|
||||
|
||||
@@ -55,7 +56,7 @@ int gen_main()
|
||||
u64 D;
|
||||
};
|
||||
)),
|
||||
true
|
||||
false
|
||||
));
|
||||
|
||||
soa_test.write();
|
Reference in New Issue
Block a user