From 8753d41e835ad070f439a1bb10ee5b7f13fd83b1 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 27 Jun 2025 20:39:13 -0400 Subject: [PATCH] progress on str8_fmt_kt1l (taking break) --- Odin/watl.v0.odin | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Odin/watl.v0.odin b/Odin/watl.v0.odin index b7b2e47..8315be1 100644 --- a/Odin/watl.v0.odin +++ b/Odin/watl.v0.odin @@ -36,6 +36,7 @@ copy_non_overlapping :: proc { } end :: proc { slice_end, + string_end, } push :: proc { farena_push, @@ -327,6 +328,7 @@ Raw_String :: struct { len: int, } string_copy :: proc(dst, src: string) { slice_copy (transmute([]byte) dst, transmute([]byte) src) } +string_end :: proc(s: string) -> ^u8 { return slice_end (transmute([]byte) s) } string_assert :: proc(s: string) { slice_assert(transmute([]byte) s) } //#endregion("Strings") @@ -1220,6 +1222,25 @@ str8_fmt_kt1l :: proc(ainfo: AllocatorInfo, buffer: []byte, table: []KT1L_Slot(s cursor_buffer := uintptr(raw_data(buffer)) buffer_remaining := len(buffer) + curr_code := fmt_template[0] + cursor_fmt := cast(uintptr) raw_data(fmt_template) + left_fmt := len(fmt_template) + for ; left_fmt > 0 && buffer_remaining > 0; + { + // Forward until we hit the delimiter '<' or the template's contents are exhausted. + for ; curr_code != '<' && cursor_fmt != cast(uintptr) end(fmt_template); { + cursor_buffer = cursor_fmt + cursor_buffer += 1 + cursor_fmt += 1 + buffer_remaining -= 1 + left_fmt -= 1 + curr_code = fmt_template[cursor_fmt] + } + if curr_code == '<' + { + + } + } return {} }