From 4a6c0438f9a2c82e834116e3e1bc110b8cae8432 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 23 Dec 2025 13:58:33 -0500 Subject: Big speedup my trimming down MAP_LIST macro and inlining some applications of it. --- src/stdlib/text.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/stdlib/text.h') diff --git a/src/stdlib/text.h b/src/stdlib/text.h index 9ad7441c..776ea8ec 100644 --- a/src/stdlib/text.h +++ b/src/stdlib/text.h @@ -63,8 +63,9 @@ OptionalText_t Text$cluster(Text_t text, Int_t index_int); Int_t index = index_expr; \ OptionalText_t cluster = Text$cluster(text, index); \ if (unlikely(cluster.tag == TEXT_NONE)) \ - fail_source(__SOURCE_FILE__, start, end, "Invalid text index: ", index, " (text has length ", \ - (int64_t)text.length, ")\n"); \ + fail_source(__SOURCE_FILE__, start, end, \ + Text$concat(Text("Invalid text index: "), convert_to_text(index), Text(" (text has length "), \ + convert_to_text((int64_t)text.length), Text(")\n"))); \ cluster; \ }) OptionalText_t Text$from_str(const char *str); -- cgit v1.2.3 From 44f822a3d52051986df6d7b0fbd5c2a2a1bf6cf5 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 23 Dec 2025 15:33:25 -0500 Subject: Add support for convert_to_text(Int_t) --- src/stdlib/text.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/stdlib/text.h') diff --git a/src/stdlib/text.h b/src/stdlib/text.h index 776ea8ec..08423cfe 100644 --- a/src/stdlib/text.h +++ b/src/stdlib/text.h @@ -45,7 +45,8 @@ static inline Text_t Text_from_text(Text_t t) { return t; } int32_t: Int32$value_as_text, \ int64_t: Int64$value_as_text, \ double: Num$value_as_text, \ - float: Num32$value_as_text)(x) + float: Num32$value_as_text, \ + Int_t: Int$value_as_text)(x) Text_t Text$_concat(int n, Text_t items[n]); #define Text$concat(...) Text$_concat(sizeof((Text_t[]){__VA_ARGS__}) / sizeof(Text_t), (Text_t[]){__VA_ARGS__}) -- cgit v1.2.3 From cfce376f585e0cd0231e95843617f75bd65b6c07 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 28 Dec 2025 17:27:05 -0500 Subject: Change autoformatter to no longer allow single-line functions --- src/stdlib/text.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/stdlib/text.h') diff --git a/src/stdlib/text.h b/src/stdlib/text.h index 08423cfe..856b173a 100644 --- a/src/stdlib/text.h +++ b/src/stdlib/text.h @@ -33,7 +33,9 @@ static inline Text_t Text_from_str_literal(const char *str) { return (Text_t){.length = strlen(str), .tag = TEXT_ASCII, .ascii = str}; } -static inline Text_t Text_from_text(Text_t t) { return t; } +static inline Text_t Text_from_text(Text_t t) { + return t; +} #define convert_to_text(x) \ _Generic(x, \ -- cgit v1.2.3