aboutsummaryrefslogtreecommitdiff
path: root/include/unicode
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-05-31 19:11:52 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-05-31 19:16:00 +0200
commitc0e510b356643089d132688b58a4e02f28f05677 (patch)
treeed75a964a2ec9ad4a01ae03f16510eda00ecc2dc /include/unicode
parent114b88f931c7d99d88ad976f6e7c5bb67f1a830d (diff)
Add uprop_get_wdth() and ucswdth()
Diffstat (limited to 'include/unicode')
-rw-r--r--include/unicode/prop.h1
-rw-r--r--include/unicode/string.h2
2 files changed, 3 insertions, 0 deletions
diff --git a/include/unicode/prop.h b/include/unicode/prop.h
index a7e90ad..e11aa21 100644
--- a/include/unicode/prop.h
+++ b/include/unicode/prop.h
@@ -1144,6 +1144,7 @@ enum uprop_wb : uint_least8_t {
[[_mlib_pure]] enum uprop_sc uprop_get_sc(rune);
[[_mlib_pure]] enum uprop_vo uprop_get_vo(rune);
[[_mlib_pure]] enum uprop_wb uprop_get_wb(rune);
+[[_mlib_pure]] int uprop_get_wdth(rune);
[[_mlib_pure]] rune uprop_get_bmg(rune);
[[_mlib_pure]] rune uprop_get_bpb(rune);
[[_mlib_pure]] rune uprop_get_equideo(rune);
diff --git a/include/unicode/string.h b/include/unicode/string.h
index 975e4eb..ed082a1 100644
--- a/include/unicode/string.h
+++ b/include/unicode/string.h
@@ -30,6 +30,7 @@ enum normform {
/* clang-format on */
+[[nodiscard]] size_t u8wdth(struct u8view);
[[nodiscard]] size_t u8gcnt(struct u8view);
[[nodiscard]] size_t u8wcnt(struct u8view);
[[nodiscard]] size_t u8wcnt_human(struct u8view);
@@ -48,6 +49,7 @@ size_t u8wnext_human(struct u8view *, struct u8view *);
enum normform);
/* Encoding-generic macros */
+#define ucswdth(sv) _Generic((sv), struct u8view: u8wdth)((sv))
#define ucsgcnt(sv) _Generic((sv), struct u8view: u8gcnt)((sv))
#define ucswcnt(sv) _Generic((sv), struct u8view: u8wcnt)((sv))
#define ucswcnt_human(sv) _Generic((sv), struct u8view: u8wcnt_human)((sv))