mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-30 19:01:02 -07:00
Parsing constructors work, finally reached parity.
This commit is contained in:
@ -32,7 +32,7 @@ Code gen__array( StrC type )
|
||||
name = { name_len, name_str };
|
||||
};
|
||||
|
||||
Code array = parse_struct( token_fmt( "ArrayType", name, "type", type,
|
||||
CodeStruct array = parse_struct( token_fmt( "ArrayType", name, "type", type,
|
||||
stringize(
|
||||
struct <ArrayType>
|
||||
{
|
||||
@ -108,7 +108,7 @@ Code gen__array( StrC type )
|
||||
void free( void )
|
||||
{
|
||||
Header& header = get_header();
|
||||
zpl::free( header.Allocator, &header );
|
||||
gen::free( header.Allocator, &header );
|
||||
}
|
||||
|
||||
Header& get_header( void )
|
||||
@ -136,14 +136,14 @@ Code gen__array( StrC type )
|
||||
{
|
||||
Header& header = get_header();
|
||||
|
||||
ZPL_ASSERT( header.Num > 0 );
|
||||
GEN_ASSERT( header.Num > 0 );
|
||||
header.Num--;
|
||||
}
|
||||
|
||||
void remove_at( uw idx )
|
||||
{
|
||||
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--;
|
||||
@ -195,7 +195,7 @@ Code gen__array( StrC type )
|
||||
new_header->Num = header.Num;
|
||||
new_header->Capacity = new_capacity;
|
||||
|
||||
zpl::free( header.Allocator, &header );
|
||||
gen::free( header.Allocator, &header );
|
||||
|
||||
Data = ( Type* )new_header + 1;
|
||||
return true;
|
||||
@ -251,8 +251,8 @@ u32 gen_array_file()
|
||||
gen_array_file;
|
||||
gen_array_file.open( "array.Parsed.gen.hpp" );
|
||||
|
||||
Code include_zpl = def_include( txt_StrC("gen.hpp") );
|
||||
gen_array_file.print( include_zpl );
|
||||
Code include_gen = def_include( txt_StrC("gen.hpp") );
|
||||
gen_array_file.print( include_gen );
|
||||
|
||||
gen_array_file.print( def_using_namespace( name(gen)));
|
||||
|
||||
|
@ -75,7 +75,7 @@ Code gen__buffer( StrC type )
|
||||
void append( Type* values, sw num )
|
||||
{
|
||||
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 ) );
|
||||
header.Num += num;
|
||||
@ -96,7 +96,7 @@ Code gen__buffer( StrC type )
|
||||
void free( void )
|
||||
{
|
||||
Header& header = get_header();
|
||||
zpl::free( header.Backing, &header );
|
||||
gen::free( header.Backing, &header );
|
||||
}
|
||||
|
||||
Header& get_header( void )
|
||||
|
@ -99,7 +99,7 @@ Code gen__hashtable( StrC type )
|
||||
|
||||
void map( MapProc map_proc )
|
||||
{
|
||||
ZPL_ASSERT_NOT_NULL( map_proc );
|
||||
GEN_ASSERT_NOT_NULL( map_proc );
|
||||
|
||||
for ( sw idx = 0; idx < Entries.num(); idx++ )
|
||||
{
|
||||
@ -109,7 +109,7 @@ Code gen__hashtable( StrC type )
|
||||
|
||||
void map_mut( MapMutProc map_proc )
|
||||
{
|
||||
ZPL_ASSERT_NOT_NULL( map_proc );
|
||||
GEN_ASSERT_NOT_NULL( map_proc );
|
||||
|
||||
for ( sw idx = 0; idx < Entries.num(); idx++ )
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ u32 gen_sanity()
|
||||
|
||||
// Typedef
|
||||
{
|
||||
Code u8_typedef = parse_typedef( code(
|
||||
CodeTypedef u8_typedef = parse_typedef( code(
|
||||
typedef unsigned char u8;
|
||||
));
|
||||
|
||||
@ -46,11 +46,11 @@ u32 gen_sanity()
|
||||
|
||||
// Enum
|
||||
{
|
||||
Code fwd = parse_enum( code(
|
||||
CodeEnum fwd = parse_enum( code(
|
||||
enum ETestEnum : u8;
|
||||
));
|
||||
|
||||
Code def = parse_enum( code(
|
||||
CodeEnum def = parse_enum( code(
|
||||
enum ETestEnum : u8
|
||||
{
|
||||
A,
|
||||
@ -59,7 +59,7 @@ u32 gen_sanity()
|
||||
};
|
||||
));
|
||||
|
||||
Code fwd_enum_class = parse_enum( code(
|
||||
CodeEnum fwd_enum_class = parse_enum( code(
|
||||
enum class ETestEnumClass : u8;
|
||||
));
|
||||
|
||||
@ -89,11 +89,11 @@ u32 gen_sanity()
|
||||
|
||||
// Friend
|
||||
{
|
||||
Code fwd = parse_class( code(
|
||||
CodeClass fwd = parse_class( code(
|
||||
class TestFriendClass;
|
||||
));
|
||||
|
||||
Code def = parse_class( code(
|
||||
CodeClass def = parse_class( code(
|
||||
class TestFriend
|
||||
{
|
||||
friend class TestFriendClass;
|
||||
@ -143,7 +143,7 @@ u32 gen_sanity()
|
||||
|
||||
// Operator
|
||||
{
|
||||
Code bitflagtest = parse_enum( code(
|
||||
CodeEnum bitflagtest = parse_enum( code(
|
||||
enum class EBitFlagTest : u8
|
||||
{
|
||||
A = 1 << 0,
|
||||
@ -152,11 +152,11 @@ u32 gen_sanity()
|
||||
};
|
||||
));
|
||||
|
||||
Code op_fwd = parse_operator( code(
|
||||
CodeOperator op_fwd = parse_operator( code(
|
||||
EBitFlagTest operator | ( EBitFlagTest a, EBitFlagTest b );
|
||||
));
|
||||
|
||||
Code op_or = parse_operator( code(
|
||||
CodeOperator op_or = parse_operator( code(
|
||||
EBitFlagTest operator | ( EBitFlagTest a, EBitFlagTest b )
|
||||
{
|
||||
return EBitFlagTest( (u8)a | (u8)b );
|
||||
@ -211,12 +211,12 @@ u32 gen_sanity()
|
||||
|
||||
// Specifiers
|
||||
{
|
||||
Code fwd_fn = parse_function( code(
|
||||
CodeFn fwd_fn = parse_function( code(
|
||||
inline
|
||||
void test_function_specifiers();
|
||||
));
|
||||
|
||||
Code typedef_u8_ptr = parse_typedef( code(
|
||||
CodeTypedef typedef_u8_ptr = parse_typedef( code(
|
||||
typedef u8* u8_ptr;
|
||||
));
|
||||
|
||||
@ -258,7 +258,7 @@ u32 gen_sanity()
|
||||
gen_sanity_file.print( parse_typedef( code( typedef unsigned short u16; )) );
|
||||
gen_sanity_file.print( parse_typedef( code( typedef unsigned long u32; )) );
|
||||
|
||||
Code def = parse_union( code(
|
||||
CodeUnion def = parse_union( code(
|
||||
union TestUnion
|
||||
{
|
||||
u8 a;
|
||||
@ -275,18 +275,18 @@ u32 gen_sanity()
|
||||
|
||||
// Using
|
||||
{
|
||||
Code reg = parse_using( code(
|
||||
CodeUsing reg = (CodeUsing) parse_using( code(
|
||||
using TestUsing = u8;
|
||||
));
|
||||
|
||||
Code nspace = parse_namespace( code(
|
||||
CodeNamespace nspace = parse_namespace( code(
|
||||
namespace TestNamespace
|
||||
{
|
||||
};
|
||||
|
||||
));
|
||||
|
||||
Code npspace_using = parse_using( code(
|
||||
CodeUsingNamespace npspace_using = (CodeUsingNamespace) parse_using( code(
|
||||
using namespace TestNamespace;
|
||||
));
|
||||
|
||||
@ -299,11 +299,11 @@ u32 gen_sanity()
|
||||
|
||||
// Variable
|
||||
{
|
||||
Code bss = parse_variable( code(
|
||||
CodeVar bss = parse_variable( code(
|
||||
u8 test_variable;
|
||||
));
|
||||
|
||||
Code data = parse_variable( code(
|
||||
CodeVar data = parse_variable( code(
|
||||
u8 test_variable = 0x12;
|
||||
));
|
||||
|
||||
@ -317,7 +317,7 @@ u32 gen_sanity()
|
||||
{
|
||||
#pragma push_macro("template")
|
||||
#undef template
|
||||
Code tmpl = parse_template( code(
|
||||
CodeTemplate tmpl = parse_template( code(
|
||||
template< typename Type >
|
||||
void test_template( Type a )
|
||||
{
|
||||
|
Reference in New Issue
Block a user