aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/pointers.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-27 16:49:38 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-27 16:49:38 -0400
commitbaf990e65c62f42e45fe25ac385db9536d3f1788 (patch)
tree7b89cecde1d6cd3b600b9295e0ad22a702cd1065 /src/stdlib/pointers.c
parent1a8a8bc3e2ebd9c282db8131902f9bb5de8c03cb (diff)
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.
Diffstat (limited to 'src/stdlib/pointers.c')
-rw-r--r--src/stdlib/pointers.c9
1 files changed, 6 insertions, 3 deletions
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);
}