WIP(broken): Converting base library to use c-linkage symbols only

This commit is contained in:
2024-12-04 11:01:53 -05:00
parent 6081834687
commit 3a55af9ce4
31 changed files with 1283 additions and 1062 deletions

View File

@ -21,7 +21,7 @@ Builder Builder::open( char const* path )
void Builder::pad_lines( s32 num )
{
append( & Buffer, "\n" );
string_append_strc( & Buffer, txt("\n") );
}
void Builder::print( Code code )
@ -29,7 +29,7 @@ void Builder::print( Code code )
String str = to_string(code);
// const ssize len = str.length();
// log_fmt( "%s - print: %.*s\n", File.filename, len > 80 ? 80 : len, str.Data );
append( & Buffer, str );
string_append_string( & Buffer, str );
}
void Builder::print_fmt( char const* fmt, ... )
@ -43,17 +43,17 @@ void Builder::print_fmt( char const* fmt, ... )
va_end( va );
// log_fmt( "$%s - print_fmt: %.*s\n", File.filename, res > 80 ? 80 : res, buf );
append( (String*) & Buffer, (char const*)buf, res );
string_append_c_str_len( (String*) & Buffer, (char const*)buf, res );
}
void Builder::write()
{
b32 result = file_write( & File, Buffer, length(Buffer) );
b32 result = file_write( & File, Buffer, string_length(Buffer) );
if ( result == false )
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 );
free(& Buffer);
string_free(& Buffer);
}

View File

@ -25,7 +25,7 @@ Code scan_file( char const* path )
String str = string_make_reserve( GlobalAllocator, fsize );
file_read( & file, str, fsize );
get_header(str)->Length = fsize;
string_get_header(str)->Length = fsize;
// Skip GEN_INTELLISENSE_DIRECTIVES preprocessor blocks
// Its designed so that the directive should be the first thing in the file.
@ -52,7 +52,7 @@ Code scan_file( char const* path )
if ( ! found_directive )
{
if ( left && str_compare( scanner, directive_start.Ptr, directive_start.Len ) == matched )
if ( left && str_compare_len( scanner, directive_start.Ptr, directive_start.Len ) == matched )
{
scanner += directive_start.Len;
left -= directive_start.Len;
@ -60,7 +60,7 @@ Code scan_file( char const* path )
while ( left && char_is_space( current ) )
move_fwd();
if ( left && str_compare( scanner, def_intellisense.Ptr, def_intellisense.Len ) == matched )
if ( left && str_compare_len( scanner, def_intellisense.Ptr, def_intellisense.Len ) == matched )
{
scanner += def_intellisense.Len;
left -= def_intellisense.Len;
@ -80,7 +80,7 @@ Code scan_file( char const* path )
continue;
}
if ( left && str_compare( scanner, directive_end.Ptr, directive_end.Len ) == matched )
if ( left && str_compare_len( scanner, directive_end.Ptr, directive_end.Len ) == matched )
{
scanner += directive_end.Len;
left -= directive_end.Len;
@ -97,12 +97,12 @@ Code scan_file( char const* path )
if ( (scanner + 2) >= ( (char const*) str + fsize ) )
{
mem_move( str, scanner, left );
get_header(str)->Length = left;
string_get_header(str)->Length = left;
break;
}
mem_move( str, scanner, left );
get_header(str)->Length = left;
string_get_header(str)->Length = left;
break;
}
@ -116,7 +116,7 @@ Code scan_file( char const* path )
}
file_close( & file );
return untyped_str( to_strc(str) );
return untyped_str( string_to_strc(str) );
}
#if 0