Updates to gasagen gencpp library after backporting changes from this project to the gencpp repo.

This commit is contained in:
2024-10-25 05:04:11 -04:00
parent eef7709fc6
commit 208cc67a7f
25 changed files with 3769 additions and 1659 deletions

View File

@ -3,6 +3,7 @@
#define GEN_EXPOSE_BACKEND
// #define GEN_DEFINE_ATTRIBUTE_TOKENS
#define GEN_IMPLEMENTATION
#include "gen.dep.cpp"
#include "gen.cpp"
#include "gen.builder.cpp"
// #include "gen.scanner.hpp"
@ -82,16 +83,16 @@ int gen_main()
PreprocessorDefines.append( get_cached_string(str_UE_REQUIRES));
}
gen_UGasaAttributeSet();
gen_FGasaDevOptionsCache();
gen_UHostWidgetController();
// gen_UGasaAttributeSet();
// gen_FGasaDevOptionsCache();
// gen_UHostWidgetController();
// gen_netslime_interfaces();
// One offs
if (0)
if (1)
{
// ue_parse_testing();
swap_SBlueprintActionMenu_Construct();
ue_parse_testing();
//swap_SBlueprintActionMenu_Construct();
}
return 0;
}

View File

@ -1,4 +1,23 @@
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wvarargs"
#pragma clang diagnostic ignored "-Wunused-function"
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wcomment"
#pragma GCC diagnostic ignored "-Wswitch"
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#include "gen.builder.hpp"
@ -14,6 +33,7 @@ Builder Builder::open( char const* path )
log_failure( "gen::File::open - Could not open file: %s", path );
return result;
}
result.Buffer = String::make_reserve( GlobalAllocator, Builder_StrBufferReserve );
// log_fmt("$Builder - Opened file: %s\n", result.File.filename );
@ -49,7 +69,7 @@ void Builder::print_fmt( char const* fmt, ... )
void Builder::write()
{
bool result = file_write( &File, Buffer, Buffer.length() );
b32 result = file_write( &File, Buffer, Buffer.length() );
if ( result == false )
log_failure( "gen::File::write - Failed to write to file: %s\n", file_name( &File ) );
@ -60,3 +80,11 @@ void Builder::write()
}
GEN_NS_END
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

View File

@ -1,4 +1,23 @@
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wvarargs"
#pragma clang diagnostic ignored "-Wunused-function"
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wcomment"
#pragma GCC diagnostic ignored "-Wswitch"
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#pragma once
@ -22,3 +41,11 @@ struct Builder
};
GEN_NS_END
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

View File

@ -1,8 +1,9 @@
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
#if __clang__
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
@ -10,25 +11,20 @@
#pragma clang diagnostic ignored "-Wunused-function"
#endif
#if __GNUC__
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wcomment"
#pragma GCC diagnostic ignored "-Wswitch"
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#if ! defined( GEN_DONT_ENFORCE_GEN_TIME_GUARD ) && ! defined( GEN_TIME )
#error Gen.hpp : GEN_TIME not defined
#endif
#include "gen.hpp"
//! If its desired to roll your own dependencies, define GEN_ROLL_OWN_DEPENDENCIES before including this file.
//! Dependencies are derived from the c-zpl library: https://github.com/zpl-c/zpl
#ifndef GEN_ROLL_OWN_DEPENDENCIES
#include "gen.dep.cpp"
#endif
GEN_NS_BEGIN
#pragma region StaticData
@ -1654,7 +1650,7 @@ void CodeClass::to_string_def( String& result )
while ( interface )
{
result.append_fmt( ", %S", interface.to_string() );
interface = interface->Next ? interface->Next->cast<CodeType>() : Code { nullptr };
interface = interface->Next ? interface->Next->cast<CodeType>() : CodeType { nullptr };
}
}
else if ( ast->Name )
@ -1950,7 +1946,7 @@ void CodeFn::to_string_def( String& result )
if ( ast->Attributes )
result.append_fmt( " %S ", ast->Attributes.to_string() );
b32 prefix_specs = false;
bool prefix_specs = false;
if ( ast->Specs )
{
for ( SpecifierT spec : ast->Specs )
@ -2003,7 +1999,7 @@ void CodeFn::to_string_fwd( String& result )
if ( ast->Attributes )
result.append_fmt( "%S ", ast->Attributes.to_string() );
bool prefix_specs = false;
b32 prefix_specs = false;
if ( ast->Specs )
{
for ( SpecifierT spec : ast->Specs )
@ -2232,7 +2228,14 @@ void CodeOpCast::to_string_def( String& result )
{
if ( ast->Specs )
{
// TODO : Add support for specifies before the operator keyword
for ( SpecifierT spec : ast->Specs )
{
if ( ! ESpecifier::is_trailing( spec ) )
{
StrC spec_str = ESpecifier::to_str( spec );
result.append_fmt( "%*s ", spec_str.Len, spec_str.Ptr );
}
}
if ( ast->Name && ast->Name.length() )
result.append_fmt( "%Soperator %S()", ast->Name, ast->ValueType.to_string() );
@ -2262,7 +2265,14 @@ void CodeOpCast::to_string_fwd( String& result )
{
if ( ast->Specs )
{
// TODO : Add support for specifies before the operator keyword
for ( SpecifierT spec : ast->Specs )
{
if ( ! ESpecifier::is_trailing( spec ) )
{
StrC spec_str = ESpecifier::to_str( spec );
result.append_fmt( "%*s ", spec_str.Len, spec_str.Ptr );
}
}
result.append_fmt( "operator %S()", ast->ValueType.to_string() );
@ -2316,7 +2326,7 @@ void CodeParam::to_string( String& result )
if ( ast->PostNameMacro )
{
result.append_fmt(" %S", ast->PostNameMacro.to_string() );
result.append_fmt( " %S", ast->PostNameMacro.to_string() );
}
if ( ast->Value )
@ -2461,7 +2471,7 @@ void CodeStruct::to_string_def( String& result )
while ( interface )
{
result.append_fmt( ", %S", interface.to_string() );
interface = interface->Next ? interface->Next->cast<CodeType>() : Code { nullptr };
interface = interface->Next ? interface->Next->cast<CodeType>() : CodeType { nullptr };
}
}
else if ( ast->Name )
@ -2569,7 +2579,7 @@ String CodeType::to_string()
void CodeType::to_string( String& result )
{
#if GEN_USE_NEW_TYPENAME_PARSING
#if defined( GEN_USE_NEW_TYPENAME_PARSING )
if ( ast->ReturnType && ast->Params )
{
if ( ast->Attributes )
@ -2734,12 +2744,20 @@ void CodeVar::to_string( String& result )
}
if ( ast->Value )
result.append_fmt( " = %S", ast->Value.to_string() );
{
if ( ast->VarConstructorInit )
result.append_fmt( "( %S ", ast->Value.to_string() );
else
result.append_fmt( " = %S", ast->Value.to_string() );
}
// Keep the chain going...
if ( ast->NextVar )
result.append_fmt( ", %S", ast->NextVar.to_string() );
if ( ast->VarConstructorInit )
result.append( " )" );
return;
}
@ -2772,11 +2790,19 @@ void CodeVar::to_string( String& result )
result.append_fmt( " : %S", ast->BitfieldSize.to_string() );
if ( ast->Value )
result.append_fmt( " = %S", ast->Value.to_string() );
{
if ( ast->VarConstructorInit )
result.append_fmt( "( %S ", ast->Value.to_string() );
else
result.append_fmt( " = %S", ast->Value.to_string() );
}
if ( ast->NextVar )
result.append_fmt( ", %S", ast->NextVar.to_string() );
if ( ast->VarConstructorInit )
result.append( " )" );
if ( ast->InlineCmt )
result.append_fmt( "; %S", ast->InlineCmt->Content );
else
@ -2804,11 +2830,19 @@ void CodeVar::to_string( String& result )
result.append_fmt( "%S %S", ast->ValueType.to_string(), ast->Name );
if ( ast->Value )
result.append_fmt( " = %S", ast->Value.to_string() );
{
if ( ast->VarConstructorInit )
result.append_fmt( "( %S ", ast->Value.to_string() );
else
result.append_fmt( " = %S", ast->Value.to_string() );
}
if ( ast->NextVar )
result.append_fmt( ", %S", ast->NextVar.to_string() );
if ( ast->VarConstructorInit )
result.append( " )" );
result.append( ";" );
if ( ast->InlineCmt )
@ -3185,7 +3219,7 @@ AllocatorInfo get_string_allocator( s32 str_length )
uw size_req = str_length + sizeof( String::Header ) + sizeof( char* );
if ( last->TotalUsed + size_req > last->TotalSize )
if ( last->TotalUsed + sw( size_req ) > last->TotalSize )
{
Arena new_arena = Arena::init_from_allocator( Allocator_StringArena, SizePer_StringArena );
@ -5674,8 +5708,8 @@ namespace parser
#define GEN_DEFINE_ATTRIBUTE_TOKENS \
Entry( Attribute_API_Export, "GEN_API_Export_Code" ) Entry( Attribute_API_Import, "GEN_API_Import_Code" ) \
Entry( Attribute_UE_DEPRECATED, "UE_DEPRECATED" ) Entry( Attribute_UMG_API, "UMG_API" ) Entry( Attribute_COREUOBJECT_API, "COREUOBJECT_API" ) \
Entry( Attribute_ENGINE_API, "ENGINE_API" ) Entry( Attribute_GASA_API, "GASA_API" ) \
Entry( Attribute_GAMEPLAYABILITIES_API, "GAMEPLAYABILITIES_API" )
Entry( Attribute_ENGINE_API, "ENGINE_API" ) Entry( Attribute_GAMEPLAYABILITIES_API, "GAMEPLAYABILITIES_API" ) \
Entry( Attribute_GASA_API, "GASA_API" )
enum Type : u32
{
@ -5780,12 +5814,12 @@ namespace parser
Attribute_UMG_API,
Attribute_COREUOBJECT_API,
Attribute_ENGINE_API,
Attribute_GASA_API,
Attribute_GAMEPLAYABILITIES_API,
Attribute_GASA_API,
NumTokens
};
StrC to_str( Type type )
inline StrC to_str( Type type )
{
local_persist StrC lookup[] {
{ sizeof( "__invalid__" ), "__invalid__" },
@ -5889,13 +5923,13 @@ namespace parser
{ sizeof( "UMG_API" ), "UMG_API" },
{ sizeof( "COREUOBJECT_API" ), "COREUOBJECT_API" },
{ sizeof( "ENGINE_API" ), "ENGINE_API" },
{ sizeof( "GASA_API" ), "GASA_API" },
{ sizeof( "GAMEPLAYABILITIES_API" ), "GAMEPLAYABILITIES_API" },
{ sizeof( "GASA_API" ), "GASA_API" },
};
return lookup[type];
}
Type to_type( StrC str )
inline Type to_type( StrC str )
{
local_persist u32 keymap[NumTokens];
do_once_start for ( u32 index = 0; index < NumTokens; index++ )
@ -6121,7 +6155,8 @@ namespace parser
Lex_ReturnNull,
};
FORCEINLINE s32 lex_preprocessor_directive( StrC& content, s32& left, char const*& scanner, s32& line, s32& column, HashTable<StrC>& defines, Token& token )
FORCEINLINE
s32 lex_preprocessor_directive( StrC& content, s32& left, char const*& scanner, s32& line, s32& column, HashTable<StrC>& defines, Token& token )
{
char const* hash = scanner;
Tokens.append( { hash, 1, TokType::Preprocess_Hash, line, column, TF_Preprocess } );
@ -6365,7 +6400,8 @@ namespace parser
return Lex_Continue; // Skip found token, its all handled here.
}
FORCEINLINE void lex_found_token( StrC& content, s32& left, char const*& scanner, s32& line, s32& column, HashTable<StrC>& defines, Token& token )
FORCEINLINE
void lex_found_token( StrC& content, s32& left, char const*& scanner, s32& line, s32& column, HashTable<StrC>& defines, Token& token )
{
if ( token.Type != TokType::Invalid )
{
@ -6492,7 +6528,7 @@ namespace parser
{
s32 length = 0;
char const* scanner = entry.Data;
while ( entry.length() > length && char_is_alphanumeric( *scanner ) || *scanner == '_' )
while ( entry.length() > length && ( char_is_alphanumeric( *scanner ) || *scanner == '_' ) )
{
scanner++;
length++;
@ -7102,6 +7138,26 @@ namespace parser
move_forward();
token.Length++;
}
// Handle number literal suffixes in a botched way
if ( left
&& ( current == 'l' || current == 'L' || // long/long long
current == 'u' || current == 'U' || // unsigned
current == 'f' || current == 'F' || // float
current == 'i' || current == 'I' || // imaginary
current == 'z' || current == 'Z' ) ) // complex
{
char prev = current;
move_forward();
token.Length++;
// Handle 'll'/'LL' as a special case when we just processed an 'l'/'L'
if ( left && ( prev == 'l' || prev == 'L' ) && ( current == 'l' || current == 'L' ) )
{
move_forward();
token.Length++;
}
}
}
goto FoundToken;
@ -8480,6 +8536,10 @@ namespace parser
s32 level = 0;
while ( left && currtok.Type != TokType::Statement_End && ( currtok.Type != TokType::Comma || level > 0 ) )
{
if ( currtok.Type == TokType::BraceCurly_Open )
level++;
if ( currtok.Type == TokType::BraceCurly_Close )
level--;
if ( currtok.Type == TokType::Capture_Start )
level++;
else if ( currtok.Type == TokType::Capture_End )
@ -8525,8 +8585,6 @@ namespace parser
return CodeInvalid;
}
return CodeInvalid;
}
// Function parsing is handled in multiple places because its initial signature is shared with variable parsing
@ -8960,7 +9018,7 @@ namespace parser
if ( found_operator_cast_outside_class_implmentation )
{
member = parse_operator_cast();
member = parse_operator_cast( specifiers );
// <Attributes> <Specifiers> <Name>::operator <Type>() { ... }
break;
}
@ -9628,10 +9686,17 @@ namespace parser
}
else
{
Token name = parse_identifier();
Context.Scope->Name = name;
Token name = parse_identifier();
Context.Scope->Name = name;
if ( check( TokType::Capture_Start ) )
bool detected_capture = check( TokType::Capture_Start );
// Check three tokens ahead to make sure that were not dealing with a constructor initialization...
// ( 350.0f , <--- Could be the scenario
// Example : <Capture_Start> <Value> <Comma>
// idx +1 +2
bool detected_comma = Context.Tokens.Arr[Context.Tokens.Idx + 2].Type == TokType::Comma;
if ( detected_capture && ! detected_comma )
{
// Dealing with a function
result = parse_function_after_name( ModuleFlag::None, attributes, specifiers, type, name );
@ -9762,7 +9827,7 @@ namespace parser
// template<class T UE_REQUIRES(TPointerIsConvertibleFromTo<T, UInterface>::Value)>
// class T ... and then ^this^ UE_REQUIRES shows up
// So we need to consume that.
if ( check( TokType::Preprocess_Macro ))
if ( check( TokType::Preprocess_Macro ) )
{
post_name_macro = parse_simple_preprocess( ETokType::Preprocess_Macro );
}
@ -9786,7 +9851,8 @@ namespace parser
s32 capture_level = 0;
s32 template_level = 0;
while ( left && ( currtok.Type != TokType::Comma ) && template_level >= 0 && CheckEndParams() || capture_level > 0 || template_level > 0 )
while ( ( left && ( currtok.Type != TokType::Comma ) && template_level >= 0 && CheckEndParams() ) || ( capture_level > 0 || template_level > 0 )
)
{
if ( currtok.Text[0] == '<' )
++template_level;
@ -9874,7 +9940,7 @@ namespace parser
// template<class T UE_REQUIRES(TPointerIsConvertibleFromTo<T, UInterface>::Value)>
// class T ... and then ^this^ UE_REQUIRES shows up
// So we need to consume that.
if ( check( TokType::Preprocess_Macro ))
if ( check( TokType::Preprocess_Macro ) )
{
post_name_macro = parse_simple_preprocess( ETokType::Preprocess_Macro );
}
@ -9898,7 +9964,8 @@ namespace parser
s32 capture_level = 0;
s32 template_level = 0;
while ( left && currtok.Type != TokType::Comma && template_level >= 0 && CheckEndParams() || capture_level > 0 || template_level > 0 )
while ( ( left && currtok.Type != TokType::Comma && template_level >= 0 && CheckEndParams() ) || ( capture_level > 0 || template_level > 0 )
)
{
if ( currtok.Text[0] == '<' )
++template_level;
@ -9974,7 +10041,7 @@ namespace parser
}
CodePreprocessCond cond = (CodePreprocessCond)make_code();
cond->Type = scast( CodeT, currtok.Type - ( ETokType::Preprocess_If - ECode::Preprocess_If ) );
cond->Type = scast( CodeT, currtok.Type - ( TokType::Preprocess_If - ECode::Preprocess_If ) );
eat( currtok.Type );
// #<Conditional>
@ -10154,9 +10221,11 @@ namespace parser
{
push_scope();
Code array_expr = parse_array_decl();
Code expr = { nullptr };
Code bitfield_expr = { nullptr };
Code array_expr = parse_array_decl();
Code expr = { nullptr };
Code bitfield_expr = { nullptr };
b32 using_constructor_initializer = false;
if ( bitfield_is_equal( u32, currtok.Flags, TF_Assign ) )
{
@ -10189,6 +10258,33 @@ namespace parser
// <Attributes> <Specifiers> <ValueType> <Name> = { <Expression> }
}
if ( currtok.Type == TokType::Capture_Start )
{
eat( TokType::Capture_Start );
// <Attributes> <Specifiers> <ValueType> <Name> (
Token expr_token = currtok;
using_constructor_initializer = true;
s32 level = 0;
while ( left && ( currtok.Type != TokType::Capture_End || level > 0 ) )
{
if ( currtok.Type == TokType::Capture_Start )
level++;
else if ( currtok.Type == TokType::Capture_End && level > 0 )
level--;
eat( currtok.Type );
}
expr_token.Length = ( (sptr)prevtok.Text + prevtok.Length ) - (sptr)expr_token.Text;
expr = untyped_str( expr_token );
eat( TokType::Capture_End );
// <Attributes> <Specifiers> <ValueType> <Name> ( <Expression> )
}
if ( currtok.Type == TokType::Assign_Classifer )
{
eat( TokType::Assign_Classifer );
@ -10282,6 +10378,8 @@ namespace parser
result->NextVar->Parent = result;
}
result->VarConstructorInit = using_constructor_initializer;
Context.pop();
return result;
}
@ -10340,6 +10438,8 @@ namespace parser
break;
}
// eat(currtok.Type);
if ( specifiers )
specifiers.append( spec );
else
@ -10737,6 +10837,13 @@ namespace parser
// <Name> = <Expression> <Macro>,
}
// Consume inline comments
// if ( currtok.Type == TokType::Comment && prevtok.Line == currtok.Line )
// {
// eat( TokType::Comment );
// <Name> = <Expression> <Macro>, // <Inline Comment>
// }
entry.Length = ( (sptr)prevtok.Text + prevtok.Length ) - (sptr)entry.Text;
member = untyped_str( entry );
@ -11105,8 +11212,6 @@ namespace parser
{
push_scope();
// TODO : Specifiers attributed to the cast
// Operator's namespace if not within same class.
Token name = NullToken;
if ( check( TokType::Identifier ) )
@ -11532,6 +11637,18 @@ else if ( currtok.Type == TokType::DeclType )
name = currtok;
eat( TokType::Type_Typename );
// <typename>
if ( ! from_template )
{
name = parse_identifier();
Context.Scope->Name = name;
if ( ! name )
{
log_failure( "Error, failed to type signature\n%s", Context.to_string() );
Context.pop();
return CodeInvalid;
}
}
}
// The usual Identifier type signature that may have namespace qualifiers
@ -12864,10 +12981,10 @@ Code untyped_token_fmt( s32 num_tokens, ... )
GEN_NS_END
#if __clang__
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#if __GNUC__
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

View File

@ -1,7 +1,25 @@
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
// This file is intended to be included within gen.cpp (There is no pragma diagnostic ignores)
#include "gen.dep.hpp"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wvarargs"
#pragma clang diagnostic ignored "-Wunused-function"
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wcomment"
#pragma GCC diagnostic ignored "-Wswitch"
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#pragma region Macros and Includes
@ -1651,7 +1669,7 @@ bool String::make_space_for( char const* str, sw add_len )
Data = rcast( char*, header + 1 );
return str;
return true;
}
}
@ -2238,7 +2256,7 @@ internal GEN_FILE_WRITE_AT_PROC( _memory_file_write )
{
Array<u8> arr = { d->buf };
if ( arr.get_header()->Capacity < new_cap )
if ( arr.get_header()->Capacity < uw( new_cap ) )
{
if ( ! arr.grow( (s64)( new_cap ) ) )
return false;
@ -2448,3 +2466,11 @@ f64 time_rel( void )
#pragma endregion Timing
GEN_NS_END
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

View File

@ -1,9 +1,26 @@
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
// This file is intended to be included within gen.hpp (There is no pragma diagnostic ignores)
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
#pragma once
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wvarargs"
#pragma clang diagnostic ignored "-Wunused-function"
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wcomment"
#pragma GCC diagnostic ignored "-Wswitch"
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#pragma region Platform Detection
/* Platform architecture */
@ -133,6 +150,10 @@
#endif
GEN_NS_BEGIN
#ifdef GEN_INTELLISENSE_DIRECTIVES
#pragma once
#include "header_start.hpp"
#endif
#pragma region Macros
@ -140,10 +161,11 @@ GEN_NS_BEGIN
// Keywords
#define global static // Global variables
#define global // Global variables
#define internal static // Internal linkage
#define local_persist static // Local Persisting variables
#pragma region ForceInline Definition
#ifdef GEN_COMPILER_MSVC
#define FORCEINLINE __forceinline
#define neverinline __declspec( noinline )
@ -162,18 +184,23 @@ GEN_NS_BEGIN
#define FORCEINLINE
#define neverinline
#endif
#pragma endregion ForceInline Definition
// Bits
#ifndef bit
#define bit( Value ) ( 1 << Value )
#define bitfield_is_equal( Type, Field, Mask ) ( ( Type( Mask ) & Type( Field ) ) == Type( Mask ) )
#endif
// Casting
#ifndef ccast
#define ccast( Type, Value ) ( *const_cast<Type*>( &( Value ) ) )
#define pcast( Type, Value ) ( *reinterpret_cast<Type*>( &( Value ) ) )
#define rcast( Type, Value ) reinterpret_cast<Type>( Value )
#define scast( Type, Value ) static_cast<Type>( Value )
#endif
// Num Arguments (Varadics)
// #if defined(__GNUC__) || defined(__clang__)
@ -1090,11 +1117,17 @@ struct Arena
return alignment_offset;
}
// This id is defined by Unreal for asserts
#pragma push_macro( "check" )
#undef check
void check()
{
GEN_ASSERT( TempCount == 0 );
}
#pragma pop_macro( "check" )
void free()
{
if ( Backing.Proc )
@ -1557,7 +1590,7 @@ struct Array
{
return 2 * value + 8;
}
bool append( Array other )
{
return append( other, other.num() );
@ -1671,7 +1704,7 @@ struct Array
if ( begin < 0 || end > header.Num )
return false;
for ( sw idx = begin; idx < end; idx++ )
for ( sw idx = sw( begin ); idx < sw( end ); idx++ )
{
Data[idx] = value;
}
@ -1829,7 +1862,7 @@ struct HashTable
static HashTable init( AllocatorInfo allocator )
{
HashTable<Type> result = init_reserve(allocator, 8);
HashTable<Type> result = init_reserve( allocator, 8 );
return result;
}
@ -1837,10 +1870,10 @@ struct HashTable
{
HashTable<Type> result = { { nullptr }, { nullptr } };
result.Hashes = Array<sw>::init_reserve( allocator, num );
result.Hashes = Array<sw>::init_reserve( allocator, num );
result.Hashes.get_header()->Num = num;
result.Hashes.resize( num );
result.Hashes.fill( 0, num, -1);
result.Hashes.fill( 0, num, -1 );
result.Entries = Array<Entry>::init_reserve( allocator, num );
return result;
@ -1849,7 +1882,7 @@ struct HashTable
void clear( void )
{
Entries.clear();
Hashes.fill( 0, Hashes.num(), -1);
Hashes.fill( 0, Hashes.num(), -1 );
}
void destroy( void )
@ -1876,7 +1909,7 @@ struct HashTable
{
GEN_ASSERT_NOT_NULL( map_proc );
for ( sw idx = 0; idx < Entries.num(); idx++ )
for ( sw idx = 0; idx < sw( Entries.num() ); ++idx )
{
map_proc( Entries[idx].Key, Entries[idx].Value );
}
@ -1888,7 +1921,7 @@ struct HashTable
{
GEN_ASSERT_NOT_NULL( map_proc );
for ( sw idx = 0; idx < Entries.num(); idx++ )
for ( sw idx = 0; idx < sw( Entries.num() ); ++idx )
{
map_proc( Entries[idx].Key, &Entries[idx].Value );
}
@ -1905,7 +1938,7 @@ struct HashTable
sw last_added_index;
HashTable<Type> new_ht = init_reserve( Hashes.get_header()->Allocator, new_num );
for ( sw idx = 0; idx < Entries.num(); ++idx )
for ( sw idx = 0; idx < sw( Entries.num() ); ++idx )
{
FindResult find_result;
@ -1930,13 +1963,13 @@ struct HashTable
{
sw idx;
for ( idx = 0; idx < Entries.num(); idx++ )
for ( idx = 0; idx < sw( Entries.num() ); idx++ )
Entries[idx].Next = -1;
for ( idx = 0; idx < Hashes.num(); idx++ )
for ( idx = 0; idx < sw( Hashes.num() ); idx++ )
Hashes[idx] = -1;
for ( idx = 0; idx < Entries.num(); idx++ )
for ( idx = 0; idx < sw( Entries.num() ); idx++ )
{
Entry* entry;
FindResult find_result;
@ -2002,7 +2035,7 @@ struct HashTable
sw slot( u64 key )
{
for ( sw idx = 0; idx < Hashes.num(); ++idx )
for ( sw idx = 0; idx < sw( Hashes.num() ); ++idx )
if ( Hashes[idx] == key )
return idx;
@ -2047,8 +2080,8 @@ protected:
b32 full()
{
uw critical_load = uw( CriticalLoadScale * f32(Hashes.num()) );
b32 result = Entries.num() > critical_load;
uw critical_load = uw( CriticalLoadScale * f32( Hashes.num() ) );
b32 result = Entries.num() > critical_load;
return result;
}
};
@ -2070,25 +2103,25 @@ struct StrC
sw Len;
char const* Ptr;
char const& operator[]( sw index ) const
{
return Ptr[index];
}
operator char const*() const
{
return Ptr;
}
char const& operator[]( sw index ) const
{
return Ptr[index];
}
};
#define cast_to_strc( str ) *rcast( StrC*, str - sizeof( sw ) )
#define txt( text ) \
StrC \
{ \
sizeof( (text) ) - 1, (text) \
#define cast_to_strc( str ) *rcast( StrC*, ( str ) - sizeof( sw ) )
#define txt( text ) \
StrC \
{ \
sizeof( text ) - 1, ( text ) \
}
StrC to_str( char const* str )
inline StrC to_str( char const* str )
{
return { str_len( str ), str };
}
@ -2160,7 +2193,7 @@ struct String
static bool are_equal( String lhs, StrC rhs )
{
if ( lhs.length() != (rhs.Len - 1) )
if ( lhs.length() != ( rhs.Len ) )
return false;
for ( sw idx = 0; idx < lhs.length(); ++idx )
@ -2199,7 +2232,7 @@ struct String
header.Length = curr_len + length;
}
return str;
return str != nullptr;
}
bool append( StrC str )
@ -2238,24 +2271,6 @@ struct String
get_header().Length = 0;
}
b32 starts_with( StrC substring ) const
{
if (substring.Len > length())
return false;
b32 result = str_compare(Data, substring.Ptr, substring.Len ) == 0;
return result;
}
b32 starts_with( String substring ) const
{
if (substring.length() > length())
return false;
b32 result = str_compare(Data, substring, substring.length() - 1 ) == 0;
return result;
}
String duplicate( AllocatorInfo allocator ) const
{
return make_length( allocator, Data, length() );
@ -2283,6 +2298,24 @@ struct String
return header.Length;
}
b32 starts_with( StrC substring ) const
{
if ( substring.Len > length() )
return false;
b32 result = str_compare( Data, substring.Ptr, substring.Len ) == 0;
return result;
}
b32 starts_with( String substring ) const
{
if ( substring.length() > length() )
return false;
b32 result = str_compare( Data, substring, substring.length() - 1 ) == 0;
return result;
}
void skip_line()
{
#define current ( *scanner )
@ -2409,7 +2442,7 @@ struct String
operator bool()
{
return Data;
return Data != nullptr;
}
operator char*()
@ -2856,3 +2889,11 @@ u64 time_rel_ms( void );
#pragma endregion Timing
GEN_NS_END
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,23 @@
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wvarargs"
#pragma clang diagnostic ignored "-Wunused-function"
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wcomment"
#pragma GCC diagnostic ignored "-Wswitch"
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#include "gen.scanner.hpp"
@ -38,7 +57,7 @@ u8 adt_destroy_branch( ADT_Node* node )
GEN_ASSERT_NOT_NULL( node );
if ( ( node->type == EADT_TYPE_OBJECT || node->type == EADT_TYPE_ARRAY ) && node->nodes )
{
for ( sw i = 0; i < node->nodes.num(); ++i )
for ( sw i = 0; i < scast( sw, node->nodes.num() ); ++i )
{
adt_destroy_branch( node->nodes + i );
}
@ -68,7 +87,7 @@ ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search )
return NULL;
}
for ( sw i = 0; i < node->nodes.num(); i++ )
for ( sw i = 0; i < scast( sw, node->nodes.num() ); i++ )
{
if ( ! str_compare( node->nodes[i].name, name ) )
{
@ -78,7 +97,7 @@ ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search )
if ( deep_search )
{
for ( sw i = 0; i < node->nodes.num(); i++ )
for ( sw i = 0; i < scast( sw, node->nodes.num() ); i++ )
{
ADT_Node* res = adt_find( node->nodes + i, name, deep_search );
@ -134,7 +153,7 @@ internal ADT_Node* _adt_get_value( ADT_Node* node, char const* value )
internal ADT_Node* _adt_get_field( ADT_Node* node, char* name, char* value )
{
for ( sw i = 0; i < node->nodes.num(); i++ )
for ( sw i = 0; i < scast( sw, node->nodes.num() ); i++ )
{
if ( ! str_compare( node->nodes[i].name, name ) )
{
@ -209,7 +228,7 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
/* run a value comparison against any child that is an object node */
else if ( node->type == EADT_TYPE_ARRAY )
{
for ( sw i = 0; i < node->nodes.num(); i++ )
for ( sw i = 0; i < scast( sw, node->nodes.num() ); i++ )
{
ADT_Node* child = &node->nodes[i];
if ( child->type != EADT_TYPE_OBJECT )
@ -227,7 +246,7 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
/* [value] */
else
{
for ( sw i = 0; i < node->nodes.num(); i++ )
for ( sw i = 0; i < scast( sw, node->nodes.num() ); i++ )
{
ADT_Node* child = &node->nodes[i];
if ( _adt_get_value( child, l_b2 ) )
@ -259,7 +278,7 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
else
{
sw idx = (sw)str_to_i64( buf, NULL, 10 );
if ( idx >= 0 && idx < node->nodes.num() )
if ( idx >= 0 && idx < scast( sw, node->nodes.num() ) )
{
found_node = &node->nodes[idx];
@ -284,7 +303,7 @@ ADT_Node* adt_alloc_at( ADT_Node* parent, sw index )
if ( ! parent->nodes )
return NULL;
if ( index < 0 || index > parent->nodes.num() )
if ( index < 0 || index > scast( sw, parent->nodes.num() ) )
return NULL;
ADT_Node o = { 0 };
@ -945,7 +964,7 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
}
}
if ( columnIndex >= root->nodes.num() )
if ( columnIndex >= scast( sw, root->nodes.num() ) )
{
adt_append_arr( root, NULL );
}
@ -987,7 +1006,7 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
/* consider first row as a header. */
if ( has_header )
{
for ( sw i = 0; i < root->nodes.num(); i++ )
for ( sw i = 0; i < scast( sw, root->nodes.num() ); i++ )
{
CSV_Object* col = root->nodes + i;
CSV_Object* hdr = col->nodes;
@ -1107,3 +1126,11 @@ String csv_write_string_delimiter( AllocatorInfo a, CSV_Object* obj, char delimi
#pragma endregion CSV
GEN_NS_END
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

View File

@ -1,7 +1,26 @@
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
#pragma once
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wvarargs"
#pragma clang diagnostic ignored "-Wunused-function"
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wcomment"
#pragma GCC diagnostic ignored "-Wswitch"
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#include "gen.hpp"
GEN_NS_BEGIN
@ -435,7 +454,7 @@ GEN_IMPL_INLINE String csv_write_string( AllocatorInfo a, CSV_Object* obj )
// This is a simple file reader that reads the entire file into memory.
// It has an extra option to skip the first few lines for undesired includes.
// This is done so that includes can be kept in dependency and component files so that intellisense works.
Code scan_file( char const* path )
inline Code scan_file( char const* path )
{
FileInfo file;
@ -591,3 +610,11 @@ CodeFile scan_file( char const* path )
}
#endif
GEN_NS_END
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif