aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/structs.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/structs.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/structs.c')
-rw-r--r--src/stdlib/structs.c8
1 files changed, 5 insertions, 3 deletions
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++) {