update gencpp to latest

This commit is contained in:
Edward R. Gonzalez 2024-10-27 21:44:34 -04:00
parent 208cc67a7f
commit feea8361b5
10 changed files with 11166 additions and 11269 deletions

View File

@ -1,3 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CppCodeStyle/OverridingFunctionStyle/@EntryValue">Override</s:String>
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe</s:String>
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/DotNetCliExePath/@EntryValue">C:\projects\Unreal\Surgo\UE\Engine\Binaries\ThirdParty\DotNet\8.0.300\win-x64\dotnet.exe</s:String>
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">1114112</s:Int64>
<s:Boolean x:Key="/Default/Environment/Hierarchy/Build/BuildTool/RecentDotNetCliExePaths/=C_003A_005Cprojects_005CUnreal_005CSurgo_005CUE_005CEngine_005CBinaries_005CThirdParty_005CDotNet_005C8_002E0_002E300_005Cwin_002Dx64_005Cdotnet_002Eexe/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gasa/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -28,8 +28,8 @@ public class GasaEditor : ModuleRules
PrivateDependencyModuleNames.Add("Gasa");
bWarningsAsErrors = false;
ShadowVariableWarningLevel = UnrealBuildTool.WarningLevel.Warning;
UndefinedIdentifierWarningLevel = UnrealBuildTool.WarningLevel.Warning;
ShadowVariableWarningLevel = UnrealBuildTool.WarningLevel.Off;
UndefinedIdentifierWarningLevel = UnrealBuildTool.WarningLevel.Off;
// gencpp related defines
PublicDefinitions.Add("Build_Debug=1");

View File

@ -48,14 +48,14 @@ void Builder::pad_lines( s32 num )
void Builder::print( Code code )
{
String str = code->to_string();
// const sw len = str.length();
// const ssize len = str.length();
// log_fmt( "%s - print: %.*s\n", File.filename, len > 80 ? 80 : len, str.Data );
Buffer.append( str );
}
void Builder::print_fmt( char const* fmt, ... )
{
sw res;
ssize res;
char buf[ GEN_PRINTF_MAXLEN ] = { 0 };
va_list va;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -57,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 < scast( sw, node->nodes.num() ); ++i )
for ( ssize i = 0; i < scast(ssize, node->nodes.num()); ++i )
{
adt_destroy_branch( node->nodes + i );
}
@ -87,7 +87,7 @@ ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search )
return NULL;
}
for ( sw i = 0; i < scast( sw, node->nodes.num() ); i++ )
for ( ssize i = 0; i < scast(ssize, node->nodes.num()); i++ )
{
if ( ! str_compare( node->nodes[ i ].name, name ) )
{
@ -97,7 +97,7 @@ ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search )
if ( deep_search )
{
for ( sw i = 0; i < scast( sw, node->nodes.num() ); i++ )
for ( ssize i = 0; i < scast(ssize, 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 )
file_stream_open( &tmp, heap(), ( u8* )back, size_of( back ), EFileStream_WRITABLE );
adt_print_number( &tmp, node );
sw fsize = 0;
ssize fsize = 0;
u8* buf = file_stream_buf( &tmp, &fsize );
if ( ! str_compare( ( char const* )buf, value ) )
@ -153,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 < scast( sw, node->nodes.num() ); i++ )
for ( ssize i = 0; i < scast(ssize, node->nodes.num()); i++ )
{
if ( ! str_compare( node->nodes[ i ].name, name ) )
{
@ -228,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 < scast( sw, node->nodes.num() ); i++ )
for ( ssize i = 0; i < scast(ssize, node->nodes.num()); i++ )
{
ADT_Node* child = &node->nodes[ i ];
if ( child->type != EADT_TYPE_OBJECT )
@ -246,7 +246,7 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
/* [value] */
else
{
for ( sw i = 0; i < scast( sw, node->nodes.num() ); i++ )
for ( ssize i = 0; i < scast(ssize, node->nodes.num()); i++ )
{
ADT_Node* child = &node->nodes[ i ];
if ( _adt_get_value( child, l_b2 ) )
@ -277,8 +277,8 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
/* handle array index lookup */
else
{
sw idx = (sw)str_to_i64( buf, NULL, 10 );
if ( idx >= 0 && idx < scast( sw, node->nodes.num() ) )
ssize idx = ( ssize )str_to_i64( buf, NULL, 10 );
if ( idx >= 0 && idx < scast(ssize, node->nodes.num()) )
{
found_node = &node->nodes[ idx ];
@ -293,7 +293,7 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
return found_node;
}
ADT_Node* adt_alloc_at( ADT_Node* parent, sw index )
ADT_Node* adt_alloc_at( ADT_Node* parent, ssize index )
{
if ( ! parent || ( parent->type != EADT_TYPE_OBJECT && parent->type != EADT_TYPE_ARRAY ) )
{
@ -303,7 +303,7 @@ ADT_Node* adt_alloc_at( ADT_Node* parent, sw index )
if ( ! parent->nodes )
return NULL;
if ( index < 0 || index > scast( sw, parent->nodes.num() ) )
if ( index < 0 || index > scast(ssize, parent->nodes.num()) )
return NULL;
ADT_Node o = { 0 };
@ -358,7 +358,7 @@ b8 adt_set_int( ADT_Node* obj, char const* name, s64 value )
return true;
}
ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, sw index )
ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, ssize index )
{
GEN_ASSERT_NOT_NULL( node );
GEN_ASSERT_NOT_NULL( new_parent );
@ -387,8 +387,8 @@ void adt_swap_nodes( ADT_Node* node, ADT_Node* other_node )
GEN_ASSERT_NOT_NULL( other_node );
ADT_Node* parent = node->parent;
ADT_Node* other_parent = other_node->parent;
sw index = ( pointer_diff( parent->nodes, node ) / size_of( ADT_Node ) );
sw index2 = ( pointer_diff( other_parent->nodes, other_node ) / size_of( ADT_Node ) );
ssize index = ( pointer_diff( parent->nodes, node ) / size_of( ADT_Node ) );
ssize index2 = ( pointer_diff( other_parent->nodes, other_node ) / size_of( ADT_Node ) );
ADT_Node temp = parent->nodes[ index ];
temp.parent = other_parent;
other_parent->nodes[ index2 ].parent = parent;
@ -401,7 +401,7 @@ void adt_remove_node( ADT_Node* node )
GEN_ASSERT_NOT_NULL( node );
GEN_ASSERT_NOT_NULL( node->parent );
ADT_Node* parent = node->parent;
sw index = ( pointer_diff( parent->nodes, node ) / size_of( ADT_Node ) );
ssize index = ( pointer_diff( parent->nodes, node ) / size_of( ADT_Node ) );
parent->nodes.remove_at( index );
}
@ -505,7 +505,7 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
node_type = EADT_TYPE_INTEGER;
neg_zero = false;
sw ib = 0;
ssize ib = 0;
char buf[ 48 ] = { 0 };
if ( *e == '+' )
@ -571,7 +571,7 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
f32 eb = 10;
char expbuf[ 6 ] = { 0 };
sw expi = 0;
ssize expi = 0;
if ( *e && ! ! str_find( "eE", *e ) )
{
@ -616,7 +616,7 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
#ifndef GEN_PARSER_DISABLE_ANALYSIS
char *q = buf, *base_string = q, *base_string2 = q;
base_string = zpl_cast( char* ) str_skip( base_string, '.' );
base_string = ccast( char*, str_skip( base_string, '.' ));
*base_string = '\0';
base_string2 = base_string + 1;
char* base_string_off = base_string2;
@ -837,13 +837,13 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
char* beginChar;
char* endChar;
sw columnIndex = 0;
sw totalColumnIndex = 0;
ssize columnIndex = 0;
ssize totalColumnIndex = 0;
do
{
char delimiter = 0;
currentChar = zpl_cast( char* ) str_trim( currentChar, false );
currentChar = ccast( char*, str_trim( currentChar, false ));
if ( *currentChar == 0 )
break;
@ -867,7 +867,7 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
#endif
do
{
endChar = zpl_cast( char* ) str_skip( endChar, '"' );
endChar = ccast( char*, str_skip( endChar, '"' ));
if ( *endChar && *( endChar + 1 ) == '"' )
{
@ -875,7 +875,8 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
}
else
break;
} while ( *endChar );
}
while ( *endChar );
if ( *endChar == 0 )
{
@ -885,7 +886,7 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
}
*endChar = 0;
currentChar = zpl_cast( char* ) str_trim( endChar + 1, true );
currentChar = ccast( char*, str_trim( endChar + 1, true ));
delimiter = * currentChar;
/* unescape escaped quotes (so that unescaped text escapes :) */
@ -898,7 +899,8 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
mem_move( escapedChar, escapedChar + 1, str_len( escapedChar ) );
}
escapedChar++;
} while ( *escapedChar );
}
while ( *escapedChar );
}
}
else if ( *currentChar == delim )
@ -916,11 +918,12 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
do
{
endChar++;
} while ( *endChar && *endChar != delim && *endChar != '\n' );
}
while ( * endChar && * endChar != delim && * endChar != '\n' );
if ( * endChar )
{
currentChar = zpl_cast( char* ) str_trim( endChar, true );
currentChar = ccast( char*, str_trim( endChar, true ));
while ( char_is_space( *( endChar - 1 ) ) )
{
@ -964,7 +967,7 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
}
}
if ( columnIndex >= scast( sw, root->nodes.num() ) )
if ( columnIndex >= scast(ssize, root->nodes.num()) )
{
adt_append_arr( root, NULL );
}
@ -994,7 +997,8 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
if ( delimiter != 0 )
currentChar++;
}
} while ( *currentChar );
}
while ( *currentChar );
if ( root->nodes.num() == 0 )
{
@ -1006,7 +1010,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 < scast( sw, root->nodes.num() ); i++ )
for ( ssize i = 0; i < scast(ssize, root->nodes.num()); i++ )
{
CSV_Object* col = root->nodes + i;
CSV_Object* hdr = col->nodes;
@ -1074,11 +1078,11 @@ void csv_write_delimiter( FileInfo* file, CSV_Object* obj, char delimiter )
GEN_ASSERT_NOT_NULL( file );
GEN_ASSERT_NOT_NULL( obj );
GEN_ASSERT( obj->nodes );
sw cols = obj->nodes.num();
ssize cols = obj->nodes.num();
if ( cols == 0 )
return;
sw rows = obj->nodes[0].nodes.num();
ssize rows = obj->nodes[ 0 ].nodes.num();
if ( rows == 0 )
return;
@ -1086,7 +1090,7 @@ void csv_write_delimiter( FileInfo* file, CSV_Object* obj, char delimiter )
if ( has_headers )
{
for ( sw i = 0; i < cols; i++ )
for ( ssize i = 0; i < cols; i++ )
{
_csv_write_header( file, &obj->nodes[ i ] );
if ( i + 1 != cols )
@ -1097,9 +1101,9 @@ void csv_write_delimiter( FileInfo* file, CSV_Object* obj, char delimiter )
str_fmt_file( file, "\n" );
}
for ( sw r = 0; r < rows; r++ )
for ( ssize r = 0; r < rows; r++ )
{
for ( sw i = 0; i < cols; i++ )
for ( ssize i = 0; i < cols; i++ )
{
_csv_write_record( file, &obj->nodes[ i ].nodes[ r ] );
if ( i + 1 != cols )
@ -1116,7 +1120,8 @@ String csv_write_string_delimiter( AllocatorInfo a, CSV_Object* obj, char delimi
FileInfo tmp;
file_stream_new( &tmp, a );
csv_write_delimiter( &tmp, obj, delimiter );
sw fsize;
ssize fsize;
u8* buf = file_stream_buf( &tmp, &fsize );
String output = String::make_length( a, ( char* )buf, fsize );
file_close( &tmp );

View File

@ -201,7 +201,7 @@ ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search );
* @param index
* @return zpl_adt_node * node
*/
ADT_Node* adt_alloc_at( ADT_Node* parent, sw index );
ADT_Node* adt_alloc_at( ADT_Node* parent, ssize index );
/**
* @brief Allocate an unitialised node within a container.
@ -219,7 +219,7 @@ ADT_Node* adt_alloc( ADT_Node* parent );
* @param index
* @return zpl_adt_node * node
*/
ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, sw index );
ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, ssize index );
/**
* @brief Move an existing node to a new container.
@ -423,28 +423,31 @@ enum CSV_Error : u32
typedef ADT_Node CSV_Object;
GEN_DEF_INLINE u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header );
u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header );
u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header, char delim );
void csv_free( CSV_Object* obj );
GEN_DEF_INLINE void csv_write( FileInfo* file, CSV_Object* obj );
GEN_DEF_INLINE String csv_write_string( AllocatorInfo a, CSV_Object* obj );
void csv_write( FileInfo* file, CSV_Object* obj );
String csv_write_string( AllocatorInfo a, CSV_Object* obj );
void csv_write_delimiter( FileInfo* file, CSV_Object* obj, char delim );
String csv_write_string_delimiter( AllocatorInfo a, CSV_Object* obj, char delim );
/* inline */
GEN_IMPL_INLINE u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header )
inline
u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header )
{
return csv_parse_delimiter( root, text, allocator, has_header, ',' );
}
GEN_IMPL_INLINE void csv_write( FileInfo* file, CSV_Object* obj )
inline
void csv_write( FileInfo* file, CSV_Object* obj )
{
csv_write_delimiter( file, obj, ',' );
}
GEN_IMPL_INLINE String csv_write_string( AllocatorInfo a, CSV_Object* obj )
inline
String csv_write_string( AllocatorInfo a, CSV_Object* obj )
{
return csv_write_string_delimiter( a, obj, ',' );
}
@ -454,7 +457,8 @@ 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.
inline Code scan_file( char const* path )
inline
Code scan_file( char const* path )
{
FileInfo file;
@ -464,7 +468,7 @@ inline Code scan_file( char const* path )
GEN_FATAL( "scan_file: Could not open: %s", path );
}
sw fsize = file_size( &file );
ssize fsize = file_size( & file );
if ( fsize <= 0 )
{
GEN_FATAL("scan_file: %s is empty", path );
@ -480,12 +484,7 @@ inline Code scan_file( char const* path )
{
#define current (*scanner)
#define matched 0
#define move_fwd() \
do \
{ \
++scanner; \
--left; \
} while ( 0 )
#define move_fwd() do { ++ scanner; -- left; } while (0)
const StrC directive_start = txt( "ifdef" );
const StrC directive_end = txt( "endif" );
const StrC def_intellisense = txt("GEN_INTELLISENSE_DIRECTIVES" );
@ -558,6 +557,7 @@ inline Code scan_file( char const* path )
break;
}
}
move_fwd();