mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-14 18:51:47 -07:00
inital implemention of UE library variant generator completed
This commit is contained in:
@ -28,8 +28,7 @@ inline bool Code::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -96,8 +95,7 @@ inline bool CodeBody::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -164,8 +162,7 @@ inline bool CodeAttributes::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -252,8 +249,7 @@ inline bool CodeComment::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -340,8 +336,7 @@ inline bool CodeConstructor::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -428,8 +423,7 @@ inline bool CodeClass::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -496,8 +490,7 @@ inline bool CodeDefine::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -584,8 +577,7 @@ inline bool CodeDestructor::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -672,8 +664,7 @@ inline bool CodeEnum::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -760,8 +751,7 @@ inline bool CodeExec::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -848,8 +838,7 @@ inline bool CodeExtern::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -936,8 +925,7 @@ inline bool CodeFriend::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1024,8 +1012,7 @@ inline bool CodeFn::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1112,8 +1099,7 @@ inline bool CodeInclude::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1200,8 +1186,7 @@ inline bool CodeModule::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1288,8 +1273,7 @@ inline bool CodeNS::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1376,8 +1360,7 @@ inline bool CodeOperator::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1464,8 +1447,7 @@ inline bool CodeOpCast::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1552,8 +1534,7 @@ inline bool CodeParam::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1620,8 +1601,7 @@ inline bool CodePragma::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1708,8 +1688,7 @@ inline bool CodePreprocessCond::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1796,8 +1775,7 @@ inline bool CodeSpecifiers::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1864,8 +1842,7 @@ inline bool CodeStruct::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1932,8 +1909,7 @@ inline bool CodeTemplate::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -2020,8 +1996,7 @@ inline bool CodeType::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -2108,8 +2083,7 @@ inline bool CodeTypedef::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -2196,8 +2170,7 @@ inline bool CodeUnion::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -2284,8 +2257,7 @@ inline bool CodeUsing::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -2372,8 +2344,7 @@ inline bool CodeVar::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
|
@ -124,11 +124,11 @@ CodeParam CodeParam::get( s32 idx )
|
||||
if ( ! ++ param )
|
||||
return { nullptr };
|
||||
|
||||
return { (AST_Param*) param.raw()->Next };
|
||||
param = { (AST_Param*) param.raw()->Next };
|
||||
}
|
||||
while ( --idx );
|
||||
|
||||
return { nullptr };
|
||||
return param;
|
||||
}
|
||||
|
||||
inline
|
||||
|
@ -2699,7 +2699,7 @@ CodeParam parse_params( bool use_template_capture )
|
||||
|
||||
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;
|
||||
@ -2811,10 +2811,10 @@ CodeParam parse_params( bool use_template_capture )
|
||||
|
||||
s32 capture_level = 0;
|
||||
s32 template_level = 0;
|
||||
while ( left
|
||||
while ( (left
|
||||
&& currtok.Type != TokType::Comma
|
||||
&& template_level >= 0
|
||||
&& (CheckEndParams() || capture_level > 0 || template_level > 0) )
|
||||
&& CheckEndParams()) || (capture_level > 0 || template_level > 0) )
|
||||
{
|
||||
if (currtok.Text[ 0 ] == '<')
|
||||
++ template_level;
|
||||
|
@ -36,7 +36,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 );
|
||||
}
|
||||
@ -66,7 +66,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 ) )
|
||||
{
|
||||
@ -76,7 +76,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 );
|
||||
|
||||
@ -132,7 +132,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 ) )
|
||||
{
|
||||
@ -207,7 +207,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 )
|
||||
@ -225,7 +225,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 ) )
|
||||
@ -257,7 +257,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 ];
|
||||
|
||||
@ -282,7 +282,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 };
|
||||
@ -946,7 +946,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 );
|
||||
}
|
||||
@ -989,7 +989,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;
|
||||
|
@ -18,6 +18,7 @@ struct StrC
|
||||
#define cast_to_strc( str ) * rcast( StrC*, (str) - sizeof(sw) )
|
||||
#define txt( text ) StrC { sizeof( text ) - 1, ( text ) }
|
||||
|
||||
inline
|
||||
StrC to_str( char const* str )
|
||||
{
|
||||
return { str_len( str ), str };
|
||||
|
@ -371,8 +371,8 @@ CodeBody gen_ast_inlines()
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
// Just check if they're both null.
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
// log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return ast == nullptr && other.ast == nullptr;
|
||||
}
|
||||
return rcast(AST*, ast)->is_equal( other.ast );
|
||||
}
|
||||
|
Reference in New Issue
Block a user