mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-15 03:01:47 -07:00
WIP : Fixes and other changes
* Number literals weren't getting properly lexed * Fixes for compiler errors with Unreal Engine configuration. * Support for "post-name" macros in parameters * Support for variables initializing directly using constructor syntax. * Explicitly added inline keyword to header inlines for compiling compile library in multiple translation units.
This commit is contained in:
@ -50,6 +50,11 @@ struct Array
|
||||
return 2 * value + 8;
|
||||
}
|
||||
|
||||
bool append( Array other )
|
||||
{
|
||||
return append( other, other.num() );
|
||||
}
|
||||
|
||||
bool append( Type value )
|
||||
{
|
||||
Header* header = get_header();
|
||||
@ -158,7 +163,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;
|
||||
}
|
||||
@ -365,7 +370,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 );
|
||||
}
|
||||
@ -377,7 +382,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 );
|
||||
}
|
||||
|
@ -594,7 +594,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;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#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 )
|
||||
@ -31,18 +32,23 @@
|
||||
# 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__)
|
||||
|
@ -445,10 +445,14 @@ 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()
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ bool String::make_space_for( char const* str, sw add_len )
|
||||
|
||||
Data = rcast( char*, header + 1 );
|
||||
|
||||
return str;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#pragma endregion String
|
||||
|
@ -139,7 +139,7 @@ struct String
|
||||
|
||||
header.Length = curr_len + length;
|
||||
}
|
||||
return str;
|
||||
return str != nullptr;
|
||||
}
|
||||
|
||||
bool append( StrC str)
|
||||
@ -353,7 +353,7 @@ struct String
|
||||
|
||||
operator bool()
|
||||
{
|
||||
return Data;
|
||||
return Data != nullptr;
|
||||
}
|
||||
|
||||
operator char* ()
|
||||
|
Reference in New Issue
Block a user