Heavy refactor..

Isolating large macros to their own directory (components/temp).
- Plan is to remove them soon with proper generation.

Added additional component files, separating the old data_structures header for a set of ast headers.
Header_end also had its inlines extracted out.
Necessary to complete the macro isolation.

ZPL parser dependencies were removed from the core library along with builder, its now generated in bootstrap as pare of making a gen_builder set of files.

Singleheader will be changed in next few commits to reflect this as well (By making builder deps and components a conditional option).

Tests are most likely all broken for now.
This commit is contained in:
2023-08-03 11:01:43 -04:00
parent 114f678f1b
commit 5d7dfaf666
63 changed files with 3341 additions and 1382 deletions

View File

@ -118,3 +118,4 @@ typedef s16 b16;
typedef s32 b32;
#pragma region Basic Types

View File

@ -533,3 +533,4 @@ protected:
};
#pragma endregion Containers

View File

@ -39,3 +39,4 @@ s32 assert_crash( char const* condition )
#endif
#pragma endregion Debug

View File

@ -1,4 +1,4 @@
#pragma endregion Debug
#pragma region Debug
#if defined( _MSC_VER )
# if _MSC_VER < 1300
@ -34,3 +34,4 @@ s32 assert_crash( char const* condition );
void process_exit( u32 code );
#pragma endregion Debug

View File

@ -634,3 +634,4 @@ internal GEN_FILE_CLOSE_PROC( _memory_file_close )
FileOperations const memory_file_operations = { _memory_file_read, _memory_file_write, _memory_file_seek, _memory_file_close };
#pragma endregion File Handling

View File

@ -370,3 +370,4 @@ u8* file_stream_buf( FileInfo* file, sw* size );
extern FileOperations const memory_file_operations;
#pragma endregion File Handling

View File

@ -83,3 +83,4 @@ u64 crc64( void const* data, sw len )
}
#pragma region Hashing

View File

@ -4,3 +4,4 @@ u32 crc32( void const* data, sw len );
u64 crc64( void const* data, sw len );
#pragma endregion Hashing

View File

@ -122,10 +122,21 @@
#pragma endregion Platform Detection
#pragma region Mandatory Includes
# include <stdarg.h>
# include <stddef.h>
# if defined( GEN_SYSTEM_WINDOWS )
# include <intrin.h>
# endif
#pragma endregion Mandatory Includes
#ifdef GEN_DONT_USE_NAMESPACE
# define GEN_NS_BEGIN
# define GEN_NS_END
#else
# define GEN_NS_BEGIN namespace gen {
# define GEN_NS_END }
#endif

View File

@ -14,6 +14,7 @@
#define bitfield_is_equal( Type, Field, Mask ) ( (Type(Mask) & Type(Field)) == Type(Mask) )
// Casting
#define ccast( Type, Value ) ( * const_cast< Type* >( & (Value) ) )
#define pcast( Type, Value ) ( * reinterpret_cast< Type* >( & ( Value ) ) )
#define rcast( Type, Value ) reinterpret_cast< Type >( Value )
@ -21,36 +22,43 @@
// Num Arguments (Varadics)
#if defined(__GNUC__) || defined(__clang__)
// Supports 0-10 arguments
// Supports 0-50 arguments
#define num_args_impl( _0, \
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
_11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
_21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
_31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
_41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
N, ... \
) N
// _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
// _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
// _41, _42, _43, _44, _45, _46, _47, _48, _49, _50,
// ## deletes preceding comma if _VA_ARGS__ is empty (GCC, Clang)
#define num_args(...) \
num_args_impl(_, ## __VA_ARGS__, \
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, \
0 \
)
// 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
// 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
// 30, 29, 28, 27, 26, 25, 24, 23, 22, 21,
#else
// Supports 1-10 arguments
// Supports 1-50 arguments
#define num_args_impl( \
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
_11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
_21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
_31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
_41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
N, ... \
) N
#define num_args(...) \
num_args_impl( __VA_ARGS__, \
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
10, 9, 8, 7, 6, 5, 4, 3, 2, 1 \
)
@ -105,3 +113,4 @@ void swap( Type& a, Type& b )
}
#pragma endregion Macros

View File

@ -387,3 +387,4 @@ void Pool::clear()
}
#pragma endregion Memory

View File

@ -484,3 +484,4 @@ struct Pool
};
#pragma endregion Memory

View File

@ -1104,3 +1104,4 @@ String csv_write_string_delimiter( AllocatorInfo a, CSV_Object* obj, char delimi
}
#pragma endregion CSV

View File

@ -423,3 +423,4 @@ GEN_IMPL_INLINE String csv_write_string( AllocatorInfo a, CSV_Object* obj )
}
#pragma endregion CSV

View File

@ -562,3 +562,4 @@ sw str_fmt_out_err( char const* fmt, ... )
}
#pragma endregion Printing

View File

@ -13,9 +13,6 @@ sw str_fmt_va ( char* str, sw n, char const* fmt, va_list va );
sw str_fmt_out_va ( char const* fmt, va_list va );
sw str_fmt_out_err ( char const* fmt, ... );
sw str_fmt_out_err_va( char const* fmt, va_list va );
// TODO : Move these to file handling.
sw str_fmt_file ( FileInfo* f, char const* fmt, ... );
sw str_fmt_file_va ( FileInfo* f, char const* fmt, va_list va );

View File

@ -78,3 +78,4 @@
#endif
#pragma endregion Macros and Includes

View File

@ -37,3 +37,4 @@ bool String::append_fmt( char const* fmt, ... )
}
#pragma endregion String

View File

@ -373,3 +373,4 @@ struct String_POD
static_assert( sizeof( String_POD ) == sizeof( String ), "String is not a POD" );
#pragma endregion String

View File

@ -207,3 +207,4 @@ f64 str_to_f64( const char* str, char** end_ptr )
}
#pragma endregion String Ops

View File

@ -260,3 +260,4 @@ GEN_IMPL_INLINE void str_to_upper( char* str )
}
#pragma endregion String Ops

View File

@ -160,3 +160,4 @@
#endif
#pragma endregion Timing

View File

@ -12,3 +12,4 @@ u64 time_rel_ms( void );
#endif
#pragma endregion Timing