inital implemention of UE library variant generator completed

This commit is contained in:
2024-10-25 05:01:37 -04:00
parent 33f992ef56
commit f90c0a59b6
17 changed files with 402 additions and 215 deletions

View File

@ -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;

View File

@ -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 };