More refactoring, getting rid of meson in favor of just powershell scripts

This commit is contained in:
2023-08-19 08:21:28 -04:00
parent aa928ff446
commit 32a910515e
25 changed files with 731 additions and 304 deletions

View File

@ -12,6 +12,7 @@ Builder Builder::open( char const* path )
result.Buffer = String::make_reserve( GlobalAllocator, Builder_StrBufferReserve );
// log_fmt("$Builder - Opened file: %s\n", result.File.filename );
return result;
}
@ -22,7 +23,11 @@ void Builder::pad_lines( s32 num )
void Builder::print( Code code )
{
Buffer.append( code->to_string() );
String str = code->to_string();
const sw 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, ... )
@ -35,6 +40,7 @@ void Builder::print_fmt( char const* fmt, ... )
res = str_fmt_va( buf, count_of( buf ) - 1, fmt, va ) - 1;
va_end( va );
// log_fmt( "$%s - print_fmt: %.*s\n", File.filename, res > 80 ? 80 : res, buf );
Buffer.append( buf, res );
}
@ -43,8 +49,9 @@ void Builder::write()
bool result = file_write( & File, Buffer, Buffer.length() );
if ( result == false )
log_failure("gen::File::write - Failed to write to file: %s", 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 );
Buffer.free();
}

View File

@ -214,7 +214,7 @@ struct AST
- sizeof(ModuleFlag)
- sizeof(u32)
)
/ sizeof(SpecifierT) -1; // -1 for 4 extra bytes
/ sizeof(SpecifierT) - 1; // -1 for 4 extra bytes
union {
struct

View File

@ -1409,7 +1409,7 @@ CodeAttributes parse_attributes()
using namespace Parser;
push_scope();
Token start;
Token start = NullToken;
s32 len = 0;
if ( check(TokType::Attribute_Open) )
@ -3186,7 +3186,7 @@ CodeConstructor parse_constructor()
{
eat( TokType::Assign_Classifer );
Token initializer_list_tok;
Token initializer_list_tok = NullToken;
s32 level = 0;
while ( left && ( currtok.Type != TokType::BraceCurly_Open || level > 0 ) )

View File

@ -34,22 +34,22 @@ s32 assert_crash( char const* condition );
void process_exit( u32 code );
#if Build_Debug
#define GEN_FATAL( fmt, ... ) \
#define GEN_FATAL( ... ) \
do \
{ \
local_persist thread_local \
char buf[GEN_PRINTF_MAXLEN] = { 0 }; \
\
str_fmt(buf, GEN_PRINTF_MAXLEN, fmt, __VA_ARGS__); \
str_fmt(buf, GEN_PRINTF_MAXLEN, __VA_ARGS__); \
GEN_PANIC(buf); \
} \
while (0)
#else
# define GEN_FATAL( fmt, ... ) \
# define GEN_FATAL( ... ) \
do \
{ \
str_fmt_out_err( fmt, __VA_ARGS__ ); \
str_fmt_out_err( __VA_ARGS__ ); \
process_exit(1); \
} \
while (0)

View File

@ -40,7 +40,7 @@
#define scast( Type, Value ) static_cast< Type >( Value )
// Num Arguments (Varadics)
#if defined(__GNUC__) || defined(__clang__)
// #if defined(__GNUC__) || defined(__clang__)
// Supports 0-50 arguments
#define num_args_impl( _0, \
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
@ -72,37 +72,37 @@
0 \
)
#else
// #else
// 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, \
_51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \
_61, _62, _63, _64, _65, _66, _67, _68, _69, _70, \
_71, _72, _73, _74, _75, _76, _77, _78, _79, _80, \
_81, _82, _83, _84, _85, _86, _87, _88, _89, _90, \
_91, _92, _93, _94, _95, _96, _97, _98, _99, _100, \
N, ... \
) N
// #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, \
// _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \
// _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, \
// _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, \
// _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, \
// _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, \
// N, ... \
// ) N
#define num_args(...) \
num_args_impl( __VA_ARGS__, \
100, 99, 98, 97, 96, 95, 94, 93, 92, 91, \
90, 89, 88, 87, 86, 85, 84, 83, 82, 81, \
80, 79, 78, 77, 76, 75, 74, 73, 72, 71, \
70, 69, 68, 67, 66, 65, 64, 63, 62, 61, \
60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
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 \
)
#endif
// #define num_args(...) \
// num_args_impl( __VA_ARGS__, \
// 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, \
// 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, \
// 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, \
// 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, \
// 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
// 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
// 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 \
// )
// // #endif
// Stringizing
#define stringize_va( ... ) #__VA_ARGS__

View File

@ -61,7 +61,7 @@ CodeBody gen_ecode( char const* path )
CodeBody gen_eoperator( char const* path )
{
char scratch_mem[kilobytes(1)];
char scratch_mem[kilobytes(4)];
Arena scratch = Arena::init_from_memory( scratch_mem, sizeof(scratch_mem) );
file_read_contents( scratch, zero_terminate, path );
@ -116,7 +116,7 @@ CodeBody gen_eoperator( char const* path )
CodeBody gen_especifier( char const* path )
{
char scratch_mem[kilobytes(1)];
char scratch_mem[kilobytes(4)];
Arena scratch = Arena::init_from_memory( scratch_mem, sizeof(scratch_mem) );
file_read_contents( scratch, zero_terminate, path );

View File

@ -1,18 +0,0 @@
project( 'gencpp_bootstrap', 'c', 'cpp', default_options : ['buildtype=debug'] )
includes = include_directories(
[
'../project',
])
sources = [ 'gen.bootstrap.cpp' ]
if get_option('buildtype').startswith('debug')
add_project_arguments('-DBuild_Debug', language : ['c', 'cpp'])
endif
add_project_arguments('-DGEN_TIME', language : ['c', 'cpp'])
executable( 'gencpp_bootstrap', sources, include_directories : includes )