update gencpp to latest
This commit is contained in:
parent
208cc67a7f
commit
feea8361b5
@ -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>
|
@ -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");
|
||||
|
@ -1,22 +1,22 @@
|
||||
// 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"
|
||||
# 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"
|
||||
# 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"
|
||||
@ -27,10 +27,10 @@ Builder Builder::open( char const* path )
|
||||
{
|
||||
Builder result;
|
||||
|
||||
FileError error = file_open_mode( &result.File, EFileMode_WRITE, path );
|
||||
FileError error = file_open_mode( & result.File, EFileMode_WRITE, path );
|
||||
if ( error != EFileError_NONE )
|
||||
{
|
||||
log_failure( "gen::File::open - Could not open file: %s", path );
|
||||
log_failure( "gen::File::open - Could not open file: %s", path);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -48,15 +48,15 @@ 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;
|
||||
char buf[GEN_PRINTF_MAXLEN] = { 0 };
|
||||
ssize res;
|
||||
char buf[ GEN_PRINTF_MAXLEN ] = { 0 };
|
||||
|
||||
va_list va;
|
||||
va_start( va, fmt );
|
||||
@ -69,22 +69,22 @@ void Builder::print_fmt( char const* fmt, ... )
|
||||
|
||||
void Builder::write()
|
||||
{
|
||||
b32 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 ) );
|
||||
log_failure("gen::File::write - Failed to write to file: %s\n", file_name( & File ) );
|
||||
|
||||
log_fmt( "Generated: %s\n", File.filename );
|
||||
file_close( &File );
|
||||
file_close( & File );
|
||||
Buffer.free();
|
||||
}
|
||||
|
||||
GEN_NS_END
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
@ -1,22 +1,22 @@
|
||||
// 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"
|
||||
# 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"
|
||||
# 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
|
||||
@ -43,9 +43,9 @@ struct Builder
|
||||
GEN_NS_END
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
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
@ -1,22 +1,22 @@
|
||||
// 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"
|
||||
# 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"
|
||||
# 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"
|
||||
@ -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,9 +87,9 @@ 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 ) )
|
||||
if ( ! str_compare( node->nodes[ i ].name, name ) )
|
||||
{
|
||||
return ( node->nodes + i );
|
||||
}
|
||||
@ -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 );
|
||||
|
||||
@ -125,17 +125,17 @@ internal ADT_Node* _adt_get_value( ADT_Node* node, char const* value )
|
||||
case EADT_TYPE_INTEGER :
|
||||
case EADT_TYPE_REAL :
|
||||
{
|
||||
char back[4096] = { 0 };
|
||||
char back[ 4096 ] = { 0 };
|
||||
FileInfo tmp;
|
||||
|
||||
/* allocate a file descriptor for a memory-mapped number to string conversion, input source buffer is not cloned, however. */
|
||||
file_stream_open( &tmp, heap(), (u8*)back, size_of( back ), EFileStream_WRITABLE );
|
||||
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 ) )
|
||||
if ( ! str_compare( ( char const* )buf, value ) )
|
||||
{
|
||||
file_close( &tmp );
|
||||
return node;
|
||||
@ -153,11 +153,11 @@ 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 ) )
|
||||
if ( ! str_compare( node->nodes[ i ].name, name ) )
|
||||
{
|
||||
ADT_Node* child = &node->nodes[i];
|
||||
ADT_Node* child = &node->nodes[ i ];
|
||||
if ( _adt_get_value( child, value ) )
|
||||
{
|
||||
return node; /* this object does contain a field of a specified value! */
|
||||
@ -191,19 +191,19 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
|
||||
str_fmt_out( "uri: %s\n", uri );
|
||||
#endif
|
||||
|
||||
char * p = (char*)uri, *b = p, *e = p;
|
||||
char * p = ( char* )uri, *b = p, *e = p;
|
||||
ADT_Node* found_node = NULL;
|
||||
|
||||
b = p;
|
||||
p = e = (char*)str_skip( p, '/' );
|
||||
char* buf = str_fmt_buf( "%.*s", (int)( e - b ), b );
|
||||
p = e = ( char* )str_skip( p, '/' );
|
||||
char* buf = str_fmt_buf( "%.*s", ( int )( e - b ), b );
|
||||
|
||||
/* handle field value lookup */
|
||||
if ( *b == '[' )
|
||||
{
|
||||
char *l_p = buf + 1, *l_b = l_p, *l_e = l_p, *l_b2 = l_p, *l_e2 = l_p;
|
||||
l_e = (char*)str_skip( l_p, '=' );
|
||||
l_e2 = (char*)str_skip( l_p, ']' );
|
||||
l_e = ( char* )str_skip( l_p, '=' );
|
||||
l_e2 = ( char* )str_skip( l_p, ']' );
|
||||
|
||||
if ( ( ! *l_e && node->type != EADT_TYPE_ARRAY ) || ! *l_e2 )
|
||||
{
|
||||
@ -228,9 +228,9 @@ 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];
|
||||
ADT_Node* child = &node->nodes[ i ];
|
||||
if ( child->type != EADT_TYPE_OBJECT )
|
||||
{
|
||||
continue;
|
||||
@ -246,9 +246,9 @@ 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];
|
||||
ADT_Node* child = &node->nodes[ i ];
|
||||
if ( _adt_get_value( child, l_b2 ) )
|
||||
{
|
||||
found_node = child;
|
||||
@ -277,10 +277,10 @@ 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];
|
||||
found_node = &node->nodes[ idx ];
|
||||
|
||||
/* go deeper if uri continues */
|
||||
if ( *e )
|
||||
@ -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,13 +387,13 @@ 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 ) );
|
||||
ADT_Node temp = parent->nodes[index];
|
||||
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;
|
||||
parent->nodes[index] = other_parent->nodes[index2];
|
||||
other_parent->nodes[index2] = temp;
|
||||
other_parent->nodes[ index2 ].parent = parent;
|
||||
parent->nodes[ index ] = other_parent->nodes[ index2 ];
|
||||
other_parent->nodes[ index2 ] = temp;
|
||||
}
|
||||
|
||||
void adt_remove_node( ADT_Node* node )
|
||||
@ -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,14 +505,14 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
node_type = EADT_TYPE_INTEGER;
|
||||
neg_zero = false;
|
||||
|
||||
sw ib = 0;
|
||||
char buf[48] = { 0 };
|
||||
ssize ib = 0;
|
||||
char buf[ 48 ] = { 0 };
|
||||
|
||||
if ( *e == '+' )
|
||||
++e;
|
||||
else if ( *e == '-' )
|
||||
{
|
||||
buf[ib++] = *e++;
|
||||
buf[ ib++ ] = *e++;
|
||||
}
|
||||
|
||||
if ( *e == '.' )
|
||||
@ -520,10 +520,10 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
node_type = EADT_TYPE_REAL;
|
||||
node_props = EADT_PROPS_IS_PARSED_REAL;
|
||||
lead_digit = false;
|
||||
buf[ib++] = '0';
|
||||
buf[ ib++ ] = '0';
|
||||
do
|
||||
{
|
||||
buf[ib++] = *e;
|
||||
buf[ ib++ ] = *e;
|
||||
} while ( char_is_digit( *++e ) );
|
||||
}
|
||||
else
|
||||
@ -541,7 +541,7 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
|
||||
while ( char_is_hex_digit( *e ) || char_to_lower( *e ) == 'x' )
|
||||
{
|
||||
buf[ib++] = *e++;
|
||||
buf[ ib++ ] = *e++;
|
||||
}
|
||||
|
||||
if ( *e == '.' )
|
||||
@ -552,13 +552,13 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
|
||||
do
|
||||
{
|
||||
buf[ib++] = *e;
|
||||
buf[ ib++ ] = *e;
|
||||
++step;
|
||||
} while ( char_is_digit( *++e ) );
|
||||
|
||||
if ( step < 2 )
|
||||
{
|
||||
buf[ib++] = '0';
|
||||
buf[ ib++ ] = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -570,8 +570,8 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
}
|
||||
|
||||
f32 eb = 10;
|
||||
char expbuf[6] = { 0 };
|
||||
sw expi = 0;
|
||||
char expbuf[ 6 ] = { 0 };
|
||||
ssize expi = 0;
|
||||
|
||||
if ( *e && ! ! str_find( "eE", *e ) )
|
||||
{
|
||||
@ -588,11 +588,11 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
}
|
||||
while ( char_is_digit( *e ) )
|
||||
{
|
||||
expbuf[expi++] = *e++;
|
||||
expbuf[ expi++ ] = *e++;
|
||||
}
|
||||
}
|
||||
|
||||
orig_exp = exp = (u8)str_to_i64( expbuf, NULL, 10 );
|
||||
orig_exp = exp = ( u8 )str_to_i64( expbuf, NULL, 10 );
|
||||
}
|
||||
|
||||
if ( node_type == EADT_TYPE_INTEGER )
|
||||
@ -600,14 +600,14 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
node->integer = str_to_i64( buf, 0, 0 );
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
/* special case: negative zero */
|
||||
if ( node->integer == 0 && buf[0] == '-' )
|
||||
if ( node->integer == 0 && buf[ 0 ] == '-' )
|
||||
{
|
||||
neg_zero = true;
|
||||
}
|
||||
#endif
|
||||
while ( orig_exp-- > 0 )
|
||||
{
|
||||
node->integer *= (s64)eb;
|
||||
node->integer *= ( s64 )eb;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -616,15 +616,15 @@ 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;
|
||||
while ( *base_string_off++ == '0' )
|
||||
base2_offset++;
|
||||
|
||||
base = (s32)str_to_i64( q, 0, 0 );
|
||||
base2 = (s32)str_to_i64( base_string2, 0, 0 );
|
||||
base = ( s32 )str_to_i64( q, 0, 0 );
|
||||
base2 = ( s32 )str_to_i64( base_string2, 0, 0 );
|
||||
if ( exp )
|
||||
{
|
||||
exp = exp * ( ! ( eb == 10.0f ) ? -1 : 1 );
|
||||
@ -632,7 +632,7 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
}
|
||||
|
||||
/* special case: negative zero */
|
||||
if ( base == 0 && buf[0] == '-' )
|
||||
if ( base == 0 && buf[ 0 ] == '-' )
|
||||
{
|
||||
neg_zero = true;
|
||||
}
|
||||
@ -686,11 +686,11 @@ ADT_Error adt_print_number( FileInfo* file, ADT_Node* node )
|
||||
{
|
||||
if ( node->props == EADT_PROPS_IS_HEX )
|
||||
{
|
||||
_adt_fprintf( file, "0x%llx", (long long)node->integer );
|
||||
_adt_fprintf( file, "0x%llx", ( long long )node->integer );
|
||||
}
|
||||
else
|
||||
{
|
||||
_adt_fprintf( file, "%lld", (long long)node->integer );
|
||||
_adt_fprintf( file, "%lld", ( long long )node->integer );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -728,14 +728,14 @@ ADT_Error adt_print_number( FileInfo* file, ADT_Node* node )
|
||||
}
|
||||
else if ( node->props == EADT_PROPS_IS_EXP )
|
||||
{
|
||||
_adt_fprintf( file, "%lld.%0*d%llde%lld", (long long)node->base, node->base2_offset, 0, (long long)node->base2, (long long)node->exp );
|
||||
_adt_fprintf( file, "%lld.%0*d%llde%lld", ( long long )node->base, node->base2_offset, 0, ( long long )node->base2, ( long long )node->exp );
|
||||
}
|
||||
else if ( node->props == EADT_PROPS_IS_PARSED_REAL )
|
||||
{
|
||||
if ( ! node->lead_digit )
|
||||
_adt_fprintf( file, ".%0*d%lld", node->base2_offset, 0, (long long)node->base2 );
|
||||
_adt_fprintf( file, ".%0*d%lld", node->base2_offset, 0, ( long long )node->base2 );
|
||||
else
|
||||
_adt_fprintf( file, "%lld.%0*d%lld", (long long int)node->base2_offset, 0, (int)node->base, (long long)node->base2 );
|
||||
_adt_fprintf( file, "%lld.%0*d%lld", ( long long int )node->base2_offset, 0, ( int )node->base, ( long long )node->base2 );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -791,7 +791,7 @@ ADT_Error adt_str_to_number( ADT_Node* node )
|
||||
return EADT_ERROR_INVALID_TYPE;
|
||||
}
|
||||
|
||||
adt_parse_number( node, (char*)node->string );
|
||||
adt_parse_number( node, ( char* )node->string );
|
||||
|
||||
return EADT_ERROR_NONE;
|
||||
}
|
||||
@ -807,7 +807,7 @@ ADT_Error adt_str_to_number_strict( ADT_Node* node )
|
||||
return EADT_ERROR_INVALID_TYPE;
|
||||
}
|
||||
|
||||
adt_parse_number_strict( node, (char*)node->string );
|
||||
adt_parse_number_strict( node, ( char* )node->string );
|
||||
|
||||
return EADT_ERROR_NONE;
|
||||
}
|
||||
@ -819,9 +819,9 @@ ADT_Error adt_str_to_number_strict( ADT_Node* node )
|
||||
#pragma region CSV
|
||||
|
||||
#ifdef GEN_CSV_DEBUG
|
||||
#define GEN_CSV_ASSERT( msg ) GEN_PANIC( msg )
|
||||
# define GEN_CSV_ASSERT( msg ) GEN_PANIC( msg )
|
||||
#else
|
||||
#define GEN_CSV_ASSERT( msg )
|
||||
# define GEN_CSV_ASSERT( msg )
|
||||
#endif
|
||||
|
||||
u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header, char delim )
|
||||
@ -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;
|
||||
@ -851,9 +851,9 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
ADT_Node rowItem = { 0 };
|
||||
rowItem.type = EADT_TYPE_STRING;
|
||||
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
rowItem.name_style = EADT_NAME_STYLE_NO_QUOTES;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* handle string literals */
|
||||
if ( *currentChar == '"' )
|
||||
@ -862,12 +862,12 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
beginChar = currentChar;
|
||||
endChar = currentChar;
|
||||
rowItem.string = beginChar;
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
rowItem.name_style = EADT_NAME_STYLE_DOUBLE_QUOTE;
|
||||
#endif
|
||||
#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,8 +886,8 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
}
|
||||
|
||||
*endChar = 0;
|
||||
currentChar = zpl_cast( char* ) str_trim( endChar + 1, true );
|
||||
delimiter = *currentChar;
|
||||
currentChar = ccast( char*, str_trim( endChar + 1, true ));
|
||||
delimiter = * currentChar;
|
||||
|
||||
/* unescape escaped quotes (so that unescaped text escapes :) */
|
||||
{
|
||||
@ -898,12 +899,13 @@ 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 )
|
||||
{
|
||||
delimiter = *currentChar;
|
||||
delimiter = * currentChar;
|
||||
rowItem.string = "";
|
||||
}
|
||||
else if ( *currentChar )
|
||||
@ -916,19 +918,20 @@ 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 )
|
||||
if ( * endChar )
|
||||
{
|
||||
currentChar = zpl_cast( char* ) str_trim( endChar, true );
|
||||
currentChar = ccast( char*, str_trim( endChar, true ));
|
||||
|
||||
while ( char_is_space( *( endChar - 1 ) ) )
|
||||
{
|
||||
endChar--;
|
||||
}
|
||||
|
||||
delimiter = *currentChar;
|
||||
*endChar = 0;
|
||||
delimiter = * currentChar;
|
||||
* endChar = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -941,35 +944,35 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
char* num_p = beginChar;
|
||||
|
||||
// We only consider hexadecimal values if they start with 0x
|
||||
if ( str_len( num_p ) > 2 && num_p[0] == '0' && ( num_p[1] == 'x' || num_p[1] == 'X' ) )
|
||||
if ( str_len(num_p) > 2 && num_p[0] == '0' && (num_p[1] == 'x' || num_p[1] == 'X') )
|
||||
{
|
||||
num_p += 2; // skip '0x' prefix
|
||||
do
|
||||
{
|
||||
if ( ! char_is_hex_digit( *num_p ) )
|
||||
if (!char_is_hex_digit(*num_p))
|
||||
{
|
||||
skip_number = true;
|
||||
break;
|
||||
}
|
||||
} while ( *num_p++ );
|
||||
} while (*num_p++);
|
||||
}
|
||||
else
|
||||
{
|
||||
skip_number = true;
|
||||
}
|
||||
|
||||
if ( ! skip_number )
|
||||
if (!skip_number)
|
||||
{
|
||||
adt_str_to_number( &rowItem );
|
||||
adt_str_to_number(&rowItem);
|
||||
}
|
||||
}
|
||||
|
||||
if ( columnIndex >= scast( sw, root->nodes.num() ) )
|
||||
if ( columnIndex >= scast(ssize, root->nodes.num()) )
|
||||
{
|
||||
adt_append_arr( root, NULL );
|
||||
}
|
||||
|
||||
root->nodes[columnIndex].nodes.append( rowItem );
|
||||
root->nodes[ columnIndex ].nodes.append( rowItem );
|
||||
|
||||
if ( delimiter == delim )
|
||||
{
|
||||
@ -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,21 +1078,21 @@ 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;
|
||||
|
||||
b32 has_headers = obj->nodes[0].name != NULL;
|
||||
b32 has_headers = obj->nodes[ 0 ].name != NULL;
|
||||
|
||||
if ( has_headers )
|
||||
{
|
||||
for ( sw i = 0; i < cols; i++ )
|
||||
for ( ssize i = 0; i < cols; i++ )
|
||||
{
|
||||
_csv_write_header( file, &obj->nodes[i] );
|
||||
_csv_write_header( file, &obj->nodes[ i ] );
|
||||
if ( i + 1 != cols )
|
||||
{
|
||||
str_fmt_file( file, "%c", delimiter );
|
||||
@ -1097,11 +1101,11 @@ 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] );
|
||||
_csv_write_record( file, &obj->nodes[ i ].nodes[ r ] );
|
||||
if ( i + 1 != cols )
|
||||
{
|
||||
str_fmt_file( file, "%c", delimiter );
|
||||
@ -1116,9 +1120,10 @@ 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 );
|
||||
String output = String::make_length( a, ( char* )buf, fsize );
|
||||
file_close( &tmp );
|
||||
return output;
|
||||
}
|
||||
@ -1128,9 +1133,9 @@ String csv_write_string_delimiter( AllocatorInfo a, CSV_Object* obj, char delimi
|
||||
GEN_NS_END
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
@ -3,22 +3,22 @@
|
||||
#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"
|
||||
# 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"
|
||||
# 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"
|
||||
@ -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,41 +457,37 @@ 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;
|
||||
|
||||
FileError error = file_open_mode( &file, EFileMode_READ, path );
|
||||
FileError error = file_open_mode( & file, EFileMode_READ, path );
|
||||
if ( error != EFileError_NONE )
|
||||
{
|
||||
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 );
|
||||
GEN_FATAL("scan_file: %s is empty", path );
|
||||
}
|
||||
|
||||
String str = String::make_reserve( GlobalAllocator, fsize );
|
||||
file_read( &file, str, fsize );
|
||||
file_read( & file, str, fsize );
|
||||
str.get_header().Length = fsize;
|
||||
|
||||
// Skip GEN_INTELLISENSE_DIRECTIVES preprocessor blocks
|
||||
// Its designed so that the directive should be the first thing in the file.
|
||||
// Anything that comes before it will also be omitted.
|
||||
{
|
||||
#define current ( *scanner )
|
||||
#define matched 0
|
||||
#define move_fwd() \
|
||||
do \
|
||||
{ \
|
||||
++scanner; \
|
||||
--left; \
|
||||
} while ( 0 )
|
||||
#define current (*scanner)
|
||||
#define matched 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" );
|
||||
const StrC def_intellisense = txt("GEN_INTELLISENSE_DIRECTIVES" );
|
||||
|
||||
bool found_directive = false;
|
||||
char const* scanner = str.Data;
|
||||
@ -546,7 +545,7 @@ inline Code scan_file( char const* path )
|
||||
move_fwd();
|
||||
|
||||
// sptr skip_size = fsize - left;
|
||||
if ( ( scanner + 2 ) >= ( str.Data + fsize ) )
|
||||
if ( (scanner + 2) >= ( str.Data + fsize ) )
|
||||
{
|
||||
mem_move( str, scanner, left );
|
||||
str.get_header().Length = left;
|
||||
@ -558,16 +557,17 @@ inline Code scan_file( char const* path )
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
move_fwd();
|
||||
}
|
||||
#undef move_fwd
|
||||
#undef matched
|
||||
#undef current
|
||||
#undef move_fwd
|
||||
#undef matched
|
||||
#undef current
|
||||
}
|
||||
|
||||
file_close( &file );
|
||||
file_close( & file );
|
||||
return untyped_str( str );
|
||||
}
|
||||
|
||||
@ -612,9 +612,9 @@ CodeFile scan_file( char const* path )
|
||||
GEN_NS_END
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user