diff --git a/core/runtime/core.odin b/core/runtime/core.odin index db08995c4..7d1a7bdd5 100644 --- a/core/runtime/core.odin +++ b/core/runtime/core.odin @@ -298,10 +298,6 @@ Context :: struct { assertion_failure_proc: Assertion_Failure_Proc, logger: Logger, - // stdin: os.Handle, - // stdout: os.Handle, - // stderr: os.Handle, - thread_id: int, user_data: any, diff --git a/core/strings/builder.odin b/core/strings/builder.odin index a772af10e..6897a70d4 100644 --- a/core/strings/builder.odin +++ b/core/strings/builder.odin @@ -86,6 +86,24 @@ write_bytes :: proc(b: ^Builder, x: []byte) { append(&b.buf, ..x); } +pop_byte :: proc(b: ^Builder) -> (r: byte) { + if len(b.buf) == 0 { + return 0; + } + r = b.buf[len(b.buf)-1]; + d := cast(^mem.Raw_Dynamic_Array)&b.buf; + d.len = max(d.len-1, 0); + return; +} + +pop_rune :: proc(b: ^Builder) -> (r: rune, width: int) { + r, width = utf8.decode_last_rune(b.buf[:]); + d := cast(^mem.Raw_Dynamic_Array)&b.buf; + d.len = max(d.len-width, 0); + return; +} + + @(private, static) DIGITS_LOWER := "0123456789abcdefx";