Allow recursive function definitions as long as they are pointers #1182. Add 'zstr' variants for string::new_format / string::tformat.

This commit is contained in:
Christoffer Lerno
2024-04-16 19:42:32 +02:00
parent 9ed8831500
commit 8b6735a6aa
6 changed files with 24 additions and 6 deletions

View File

@@ -38,6 +38,13 @@ macro String tformat(String fmt, ...)
return str.str_view();
}
macro ZString tformat_zstr(String fmt, ...)
{
DString str = dstring::temp_with_capacity(fmt.len + $vacount * 8);
str.appendf(fmt, $vasplat());
return str.zstr_view();
}
macro String new_format(String fmt, ..., Allocator* allocator = allocator::heap())
{
@pool(allocator)
@@ -48,6 +55,15 @@ macro String new_format(String fmt, ..., Allocator* allocator = allocator::heap(
};
}
macro ZString new_format_zstr(String fmt, ..., Allocator* allocator = allocator::heap())
{
@pool(allocator)
{
DString str = dstring::temp_with_capacity(fmt.len + $vacount * 8);
str.appendf(fmt, $vasplat());
return str.copy_zstr(allocator);
};
}
macro bool char_in_set(char c, String set)
{