summaryrefslogtreecommitdiff
path: root/src/wctype/wctype.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-06-03 13:56:25 -0400
committerJakob Kaivo <jkk@ung.org>2024-06-03 13:56:25 -0400
commita686d047d79bdfc37c096a4fa350c37e4ccf3cf5 (patch)
treeca631b9095454a239211b6f676bdd3e0cb102156 /src/wctype/wctype.c
parentc575f269ed4a04f89d610b423cc43ce7bd6f008b (diff)
add LC_CTYPE epoch and use separate CT_ categories and CTM_ masks to support detecting change of LC_CTYPE between calls to wctype()/iswctype() and wctrans()/towctrans()
Diffstat (limited to 'src/wctype/wctype.c')
-rw-r--r--src/wctype/wctype.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/wctype/wctype.c b/src/wctype/wctype.c
index 2dd4599f..cf82c4ed 100644
--- a/src/wctype/wctype.c
+++ b/src/wctype/wctype.c
@@ -7,31 +7,32 @@ wctype_t wctype(const char * property)
{
SIGNAL_SAFE(0);
ASSERT_NONNULL(property);
+ wctype_t epoch = ((__get_locale()->ctype_epoch) << CT_EPOCH_SHIFT);
if (!strcmp(property, "alnum")) {
- return CT_ALPHA | CT_DIGIT;
+ return epoch | CT_ALNUM;
} else if (!strcmp(property, "alpha")) {
- return CT_ALPHA;
+ return epoch | CT_ALPHA;
} else if (!strcmp(property, "blank")) {
- return CT_BLANK;
+ return epoch | CT_BLANK;
} else if (!strcmp(property, "cntrl")) {
- return CT_CNTRL;
+ return epoch | CT_CNTRL;
} else if (!strcmp(property, "digit")) {
- return CT_DIGIT;
+ return epoch | CT_DIGIT;
} else if (!strcmp(property, "graph")) {
- return CT_GRAPH;
+ return epoch | CT_GRAPH;
} else if (!strcmp(property, "lower")) {
- return CT_LOWER;
+ return epoch | CT_LOWER;
} else if (!strcmp(property, "print")) {
- return CT_PRINT;
+ return epoch | CT_PRINT;
} else if (!strcmp(property, "punct")) {
- return CT_PUNCT;
+ return epoch | CT_PUNCT;
} else if (!strcmp(property, "space")) {
- return CT_SPACE;
+ return epoch | CT_SPACE;
} else if (!strcmp(property, "upper")) {
- return CT_UPPER;
+ return epoch | CT_UPPER;
} else if (!strcmp(property, "xdigit")) {
- return CT_XDIGIT;
+ return epoch | CT_XDIGIT;
}
return 0;