diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-09-01 13:20:39 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-09-01 13:20:39 -0400 |
| commit | d6d3f5711de85ab1c21f515b9d125d316d853c92 (patch) | |
| tree | dc083bbe83b2dae82c47fdd78950941d53399bad /src/stdlib/text.h | |
| parent | db6107c33df6a4fdb592ad29074d1159c37dc048 (diff) | |
| parent | ee020c72d92c3807fa4afcd1e170d3df81688b97 (diff) | |
Merge branch 'main' into formatter
Diffstat (limited to 'src/stdlib/text.h')
| -rw-r--r-- | src/stdlib/text.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/stdlib/text.h b/src/stdlib/text.h index d118cffd..7f7fc2c6 100644 --- a/src/stdlib/text.h +++ b/src/stdlib/text.h @@ -7,7 +7,9 @@ #include <stdint.h> #include "datatypes.h" +#include "integers.h" // IWYU pragma: export #include "mapmacro.h" +#include "nums.h" // IWYU pragma: export #include "types.h" #include "util.h" @@ -31,7 +33,17 @@ static inline Text_t Text_from_str_literal(const char *str) { static inline Text_t Text_from_text(Text_t t) { return t; } -#define convert_to_text(x) _Generic(x, Text_t: Text_from_text, char *: Text$from_str, const char *: Text$from_str)(x) +#define convert_to_text(x) \ + _Generic(x, \ + Text_t: Text_from_text, \ + char *: Text$from_str, \ + const char *: Text$from_str, \ + int8_t: Int8$value_as_text, \ + int16_t: Int16$value_as_text, \ + int32_t: Int32$value_as_text, \ + int64_t: Int64$value_as_text, \ + double: Num$value_as_text, \ + float: Num32$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__}) |
