more progress

This commit is contained in:
2024-12-04 11:30:54 -05:00
parent 3a55af9ce4
commit f7709bb64e
13 changed files with 95 additions and 87 deletions

View File

@ -265,7 +265,7 @@ char const* debug_str(Code self)
case CT_Specifiers:
{
string_append_fmt( result, "\n\tNumEntries: %d", self->NumEntries );
string_append_c_str( result, "\n\tArrSpecs: " );
string_append_strc( result, txt("\n\tArrSpecs: ") );
s32 idx = 0;
s32 left = self->NumEntries;
@ -387,7 +387,7 @@ void to_string( Code self, String* result )
#ifdef GEN_DONT_ALLOW_INVALID_CODE
log_failure("Attempted to serialize invalid code! - %S", Parent ? Parent->debug_str() : Name );
#else
append_fmt( result, "Invalid Code!" );
string_append_fmt( result, "Invalid Code!" );
#endif
break;

View File

@ -351,7 +351,7 @@ void reset()
do
{
Pool* code_pool = & CodePools[index];
clear(* code_pool);
pool_clear(code_pool);
index++;
}
while ( left--, left );

View File

@ -907,14 +907,14 @@ CodeInclude def_include( StrC path, Opts_def_include p )
return InvalidCode;
}
StrC content = p.foreign ?
string_to_strc( str_fmt_buf( "<%.*s>", path.Len, path.Ptr ))
: string_to_strc( str_fmt_buf( "\"%.*s\"", path.Len, path.Ptr ));
String content = p.foreign ?
string_fmt_buf( GlobalAllocator, "<%.*s>", path.Len, path.Ptr )
: string_fmt_buf( GlobalAllocator, "\"%.*s\"", path.Len, path.Ptr );
Code
result = make_code();
result->Type = CT_Preprocess_Include;
result->Name = get_cached_string( content );
result->Name = get_cached_string( string_to_strc(content) );
result->Content = result->Name;
return (CodeInclude) result;
@ -938,7 +938,7 @@ CodeNS def_namespace( StrC name, Code body, Opts_def_namespace p )
{
name_check( def_namespace, name );
null_check( def_namespace, body);
if ( body && body->Type != CT_Namespace_Body && body->Type != CT_Untyped )
{
log_failure("gen::def_namespace: body is not of namespace or untyped type %s", debug_str(body));

View File

@ -96,7 +96,7 @@ String to_string(Token tok)
StrC type_str = to_str( tok.Type );
append_fmt( & result, "Line: %d Column: %d, Type: %.*s Content: %.*s"
string_append_fmt( & result, "Line: %d Column: %d, Type: %.*s Content: %.*s"
, tok.Line, tok.Column
, type_str.Len, type_str.Ptr
, tok.Length, tok.Text

View File

@ -365,7 +365,7 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
string_append_c_str_len( & content, cut_ptr, cut_length);
if ( * string_back( content ) != ' ' )
string_append_strc( & content, txt(' '));
string_append_char( & content, ' ' );
move_fwd();
last_cut = sptr(scanner) - sptr(raw_text.Ptr);
@ -391,7 +391,7 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
// Replace with a space
if ( * string_back( content ) != ' ' )
string_append_strc( & content, txt(' ') );
string_append_char( & content, ' ' );
scanner += 2;
tokleft -= 2;
@ -417,8 +417,8 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
string_append_c_str_len( & content, cut_ptr, cut_length );
// Replace with a space
if ( * back( & content ) != ' ' )
string_append_strc( & content, txt(' ') );
if ( * string_back( content ) != ' ' )
string_append_char( & content, ' ' );
move_fwd();
@ -466,9 +466,9 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
last_cut = sptr( scanner ) - sptr( raw_text.Ptr );
// Preserve only 1 space of formattting
char* last = back(& content);
char* last = string_back(content);
if ( last == nullptr || * last != ' ' )
string_append_strc( & content, txt(' ') );
string_append_char( & content, ' ' );
continue;
}