diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-04-05 14:26:33 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-04-05 14:26:33 +0200 |
commit | 450fd004b8f8358dc46e1bcc1bceae821f7ae158 (patch) | |
tree | c3e59514c6f6a9d5d94419f025748ce7c51a9e29 /lib/unicode/prop/uprop_is_wspace.c | |
parent | 0abf844cd9c22623e22f462c91f380f16524c7e8 (diff) |
Add boolean properties to unicode/prop.h
Diffstat (limited to 'lib/unicode/prop/uprop_is_wspace.c')
-rw-r--r-- | lib/unicode/prop/uprop_is_wspace.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/unicode/prop/uprop_is_wspace.c b/lib/unicode/prop/uprop_is_wspace.c new file mode 100644 index 0000000..3306eec --- /dev/null +++ b/lib/unicode/prop/uprop_is_wspace.c @@ -0,0 +1,34 @@ +/* This file is autogenerated by gen/prop/bool-props; DO NOT EDIT. */ + +#include "__bsearch.h" +#include "bitset.h" +#include "rune.h" +#include "unicode/prop.h" + +/* clang-format off */ + +static constexpr bitset(bs, LATIN1_MAX) = { + 0x00, 0x3E, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +static const struct { + rune lo, hi; +} lookup[] = { + {RUNE_C(0x001680), RUNE_C(0x001680)}, + {RUNE_C(0x002000), RUNE_C(0x00200A)}, + {RUNE_C(0x002028), RUNE_C(0x002029)}, + {RUNE_C(0x00202F), RUNE_C(0x00202F)}, + {RUNE_C(0x00205F), RUNE_C(0x00205F)}, + {RUNE_C(0x003000), RUNE_C(0x003000)}, +}; + +__MLIB_DEFINE_BSEARCH_CONTAINS(lookup) + +bool +uprop_is_wspace(rune ch) +{ + return ch <= LATIN1_MAX ? TESTBIT(bs, ch) : mlib_lookup_contains(ch); +} |