From c0e510b356643089d132688b58a4e02f28f05677 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 31 May 2024 19:11:52 +0200 Subject: Add uprop_get_wdth() and ucswdth() --- include/unicode/prop.h | 1 + include/unicode/string.h | 2 ++ 2 files changed, 3 insertions(+) (limited to 'include/unicode') 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)) -- cgit v1.2.3