From baf990e65c62f42e45fe25ac385db9536d3f1788 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 27 Apr 2025 16:49:38 -0400 Subject: Update stdlib to use `print` instead of `printf` in all cases. This means bringing in fpconv to do float-to-string conversion and a few updates to integer and number methods for string formatting. --- src/stdlib/pointers.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/stdlib/pointers.c') diff --git a/src/stdlib/pointers.c b/src/stdlib/pointers.c index d766a9b3..6874dd3c 100644 --- a/src/stdlib/pointers.c +++ b/src/stdlib/pointers.c @@ -41,12 +41,15 @@ public Text_t Pointer$as_text(const void *x, bool colorize, const TypeInfo_t *ty if (top_level) { root = ptr; } else if (ptr == root) { - return Text$format(colorize ? "\x1b[34;1m%s~1\x1b[m" : "%s~1", ptr_info.sigil); + Text_t text = Texts(Text$from_str(ptr_info.sigil), Text("~1")); + return colorize ? Texts(Text("\x1b[34;1m"), text, Text("\x1b[m")) : text; } else { TypeInfo_t rec_table = *Table$info(type, &Int64$info); int64_t *id = Table$get(pending, x, &rec_table); - if (id) - return Text$format(colorize ? "\x1b[34;1m%s~%ld\x1b[m" : "%s~%ld", ptr_info.sigil, *id); + if (id) { + Text_t text = Texts(Text$from_str(ptr_info.sigil), Int64$as_text(id, false, &Int64$info)); + return colorize ? Texts(Text("\x1b[34;1m"), text, Text("\x1b[m")) : text; + } int64_t next_id = pending.entries.length + 2; Table$set(&pending, x, &next_id, &rec_table); } -- cgit v1.2.3