This commit is contained in:
2024-12-12 12:55:15 -05:00
parent 8d48da0b9e
commit e3172057d3
57 changed files with 2098 additions and 2522 deletions

View File

@ -15,16 +15,16 @@ ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va )
local_persist
StringTable tok_map;
{
tok_map = hashtable_init(StrC, fixed_arena_allocator_info(& tok_map_arena) );
tok_map = hashtable_init(Str, fixed_arena_allocator_info(& tok_map_arena) );
s32 left = num_tokens - 1;
while ( left-- )
{
char const* token = va_arg( va, char const* );
StrC value = va_arg( va, StrC );
Str value = va_arg( va, Str );
u32 key = crc32( token, str_len(token) );
u32 key = crc32( token, c_str_len(token) );
hashtable_set( tok_map, key, value );
}
}
@ -61,7 +61,7 @@ ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va )
char const* token = fmt + 1;
u32 key = crc32( token, tok_len );
StrC* value = hashtable_get(tok_map, key );
Str* value = hashtable_get(tok_map, key );
if ( value )
{
@ -99,7 +99,7 @@ ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va )
return result;
}
Code untyped_str( StrC content )
Code untyped_str( Str content )
{
if ( content.Len == 0 )
{
@ -135,11 +135,11 @@ Code untyped_fmt( char const* fmt, ...)
va_list va;
va_start(va, fmt);
ssize length = str_fmt_va(buf, GEN_PRINTF_MAXLEN, fmt, va);
ssize length = c_str_fmt_va(buf, GEN_PRINTF_MAXLEN, fmt, va);
va_end(va);
StrC buf_str = { str_len_capped(fmt, MaxNameLength), fmt };
StrC uncapped_str = { length, buf };
Str buf_str = { c_str_len_capped(fmt, MaxNameLength), fmt };
Str uncapped_str = { length, buf };
Code
result = make_code();
@ -172,7 +172,7 @@ Code untyped_token_fmt( s32 num_tokens, char const* fmt, ... )
ssize length = token_fmt_va(buf, GEN_PRINTF_MAXLEN, num_tokens, va);
va_end(va);
StrC buf_str = { length, buf };
Str buf_str = { length, buf };
Code
result = make_code();