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/structs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/stdlib/structs.c') diff --git a/src/stdlib/structs.c b/src/stdlib/structs.c index 9a14779e..d4a22d93 100644 --- a/src/stdlib/structs.c +++ b/src/stdlib/structs.c @@ -143,10 +143,12 @@ PUREFUNC public Text_t Struct$as_text(const void *obj, bool colorize, const Type { if (!obj) return Text$from_str(type->StructInfo.name); - if (type->StructInfo.is_secret || type->StructInfo.is_opaque) - return Text$format(colorize ? "\x1b[0;1m%s\x1b[m(...)" : "%s(...)", type->StructInfo.name); + Text_t name = Text$from_str(type->StructInfo.name); + if (type->StructInfo.is_secret || type->StructInfo.is_opaque) { + return colorize ? Texts(Text("\x1b[0;1m"), name, Text("\x1b[m(...)")) : Texts(name, Text("(...)")); + } - Text_t text = Text$format(colorize ? "\x1b[0;1m%s\x1b[m(" : "%s(", type->StructInfo.name); + Text_t text = colorize ? Texts(Text("\x1b[0;1m"), name, Text("\x1b[m(")) : Texts(name, Text("(")); ptrdiff_t byte_offset = 0; ptrdiff_t bit_offset = 0; for (int i = 0; i < type->StructInfo.num_fields; i++) { -- cgit v1.2.3