mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-14 18:51:47 -07:00
Added is_body to AST and Code types
This commit is contained in:
@ -4406,6 +4406,7 @@ CodeTemplate parse_template()
|
||||
result->Params = params;
|
||||
result->Declaration = definition;
|
||||
result->ModuleFlags = mflags;
|
||||
// result->Name = definition->Name;
|
||||
|
||||
Context.pop();
|
||||
return result;
|
||||
|
@ -14,20 +14,17 @@ template<class TType>
|
||||
using TRemoveConst = typename RemoveConst<TType>::Type;
|
||||
|
||||
#pragma region Array
|
||||
#if ! GEN_COMPILER_C
|
||||
#define Array(Type) Array<Type>
|
||||
|
||||
// #define array_init(Type, ...) array_init <Type>(__VA_ARGS__)
|
||||
// #define array_init_reserve(Type, ...) array_init_reserve<Type>(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
struct ArrayHeader;
|
||||
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES
|
||||
template<class Type> struct Array;
|
||||
template<class Type> struct Array;
|
||||
#else
|
||||
template<class Type>
|
||||
using Array = Type*;
|
||||
template<class Type> using Array = Type*;
|
||||
#endif
|
||||
|
||||
usize array_grow_formula(ssize value);
|
||||
|
@ -205,7 +205,7 @@
|
||||
# define foreach(Type, entry_id, iterable) for ( Type entry_id : iterable )
|
||||
#endif
|
||||
|
||||
#if GENC_COMPILERC
|
||||
#if GEN_COMPILER_C
|
||||
# if __STDC_VERSION__ >= 202311L
|
||||
# define enum_underlying(type) : type
|
||||
# else
|
||||
|
@ -14,23 +14,13 @@
|
||||
#define GEN__HIGHS ( GEN__ONES * ( GEN_U8_MAX / 2 + 1 ) )
|
||||
#define GEN__HAS_ZERO( x ) ( ( ( x ) - GEN__ONES ) & ~( x ) & GEN__HIGHS )
|
||||
|
||||
#if ! GEN_COMPILER_C
|
||||
template< class Type >
|
||||
void swap( Type& a, Type& b )
|
||||
{
|
||||
Type tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
#else
|
||||
#define swap( a, b ) \
|
||||
do { \
|
||||
typeof(a) \
|
||||
temp = (a); \
|
||||
(a) = (b); \
|
||||
(b) = temp; \
|
||||
} while(0)
|
||||
#endif
|
||||
template< class Type >
|
||||
void swap( Type& a, Type& b )
|
||||
{
|
||||
Type tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
|
||||
//! Checks if value is power of 2.
|
||||
b32 is_power_of_two( ssize x );
|
||||
|
@ -106,7 +106,7 @@
|
||||
# define GEN_GCC_VERSION_CHECK(major,minor,patch) (0)
|
||||
#endif
|
||||
|
||||
#ifndef GEN_COMPIELR_C
|
||||
#ifndef GEN_COMPILER_C
|
||||
# if defined(__STDC_VERSION__)
|
||||
# define GEN_COMPILER_C 1
|
||||
# else
|
||||
|
@ -11,8 +11,10 @@ struct StrC
|
||||
ssize Len;
|
||||
char const* Ptr;
|
||||
|
||||
#if ! GEN_COMPILER_C
|
||||
operator char const* () const { return Ptr; }
|
||||
char const& operator[]( ssize index ) const { return Ptr[index]; }
|
||||
#endif
|
||||
};
|
||||
|
||||
#define cast_to_strc( str ) * rcast( StrC*, (str) - sizeof(ssize) )
|
||||
@ -29,12 +31,7 @@ StrC to_str( char const* str ) {
|
||||
// I kept it for simplicty of porting but its not necessary to keep it that way.
|
||||
#pragma region String
|
||||
struct StringHeader;
|
||||
|
||||
#if GEN_COMPILER_C
|
||||
typedef char* String;
|
||||
#else
|
||||
struct String;
|
||||
#endif
|
||||
|
||||
String string_make(AllocatorInfo allocator, char const* str);
|
||||
String string_make(AllocatorInfo allocator, StrC str);
|
||||
|
Reference in New Issue
Block a user