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/enums.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/stdlib/enums.c') diff --git a/src/stdlib/enums.c b/src/stdlib/enums.c index 0c5cf196..404e3c50 100644 --- a/src/stdlib/enums.c +++ b/src/stdlib/enums.c @@ -74,8 +74,10 @@ public Text_t Enum$as_text(const void *obj, bool colorize, const TypeInfo_t *typ int32_t tag = *(int32_t*)obj; NamedType_t value = type->EnumInfo.tags[tag-1]; - if (!value.type || value.type->size == 0) - return Text$format(colorize ? "\x1b[1m%s\x1b[m" : "%s", value.name); + if (!value.type || value.type->size == 0) { + Text_t text = Text$from_str(value.name); + return colorize ? Texts(Text("\x1b[1m"), text, Text("\x1b[m")) : text; + } ptrdiff_t byte_offset = sizeof(int32_t); if (value.type->align && byte_offset % value.type->align > 0) -- cgit v1.2.3