diff options
| author | Jakob Kaivo <jkk@ung.org> | 2024-06-03 13:56:25 -0400 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2024-06-03 13:56:25 -0400 |
| commit | a686d047d79bdfc37c096a4fa350c37e4ccf3cf5 (patch) | |
| tree | ca631b9095454a239211b6f676bdd3e0cb102156 /src/ctype | |
| parent | c575f269ed4a04f89d610b423cc43ce7bd6f008b (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/ctype')
| -rw-r--r-- | src/ctype/_ctype.h | 39 | ||||
| -rw-r--r-- | src/ctype/isblank.c | 2 | ||||
| -rw-r--r-- | src/ctype/iscntrl.c | 2 | ||||
| -rw-r--r-- | src/ctype/isgraph.c | 2 | ||||
| -rw-r--r-- | src/ctype/islower.c | 2 | ||||
| -rw-r--r-- | src/ctype/isprint.c | 2 | ||||
| -rw-r--r-- | src/ctype/ispunct.c | 2 | ||||
| -rw-r--r-- | src/ctype/isspace.c | 2 | ||||
| -rw-r--r-- | src/ctype/isupper.c | 2 | ||||
| -rw-r--r-- | src/ctype/isxdigit.c | 2 |
10 files changed, 36 insertions, 21 deletions
diff --git a/src/ctype/_ctype.h b/src/ctype/_ctype.h index d167ef8b..cc823848 100644 --- a/src/ctype/_ctype.h +++ b/src/ctype/_ctype.h @@ -18,18 +18,33 @@ #endif typedef enum { - CT_ALPHA = (1 << 0), - CT_CNTRL = (1 << 1), - CT_DIGIT = (1 << 2), - CT_GRAPH = (1 << 3), - CT_LOWER = (1 << 4), - CT_PRINT = (1 << 5), - CT_PUNCT = (1 << 6), - CT_SPACE = (1 << 7), - CT_UPPER = (1 << 8), - CT_XDIGIT = (1 << 9), - CT_BLANK = (1 << 10), -} ctype_t; + CT_ALPHA = 0, + CT_CNTRL = 1, + CT_DIGIT = 2, + CT_GRAPH = 3, + CT_LOWER = 4, + CT_PRINT = 5, + CT_PUNCT = 6, + CT_SPACE = 7, + CT_UPPER = 8, + CT_XDIGIT = 9, + CT_BLANK = 10, + CT_ALNUM = 11, +} c_type; + +typedef enum { + CTM_ALPHA = (1 << CT_ALPHA), + CTM_CNTRL = (1 << CT_CNTRL), + CTM_DIGIT = (1 << CT_DIGIT), + CTM_GRAPH = (1 << CT_GRAPH), + CTM_LOWER = (1 << CT_LOWER), + CTM_PRINT = (1 << CT_PRINT), + CTM_PUNCT = (1 << CT_PUNCT), + CTM_SPACE = (1 << CT_SPACE), + CTM_UPPER = (1 << CT_UPPER), + CTM_XDIGIT = (1 << CT_XDIGIT), + CTM_BLANK = (1 << CT_BLANK), +} c_type_mask; /* STDC(-1) diff --git a/src/ctype/isblank.c b/src/ctype/isblank.c index 3568241c..8649ea6e 100644 --- a/src/ctype/isblank.c +++ b/src/ctype/isblank.c @@ -9,7 +9,7 @@ int isblank(int c) SIGNAL_SAFE(0); ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, "unsigned char", EOF); - return c == EOF ? 0 : map[c] & CT_BLANK; + return c == EOF ? 0 : map[c] & CTM_BLANK; } CHECK_1(int, 0, isblank, int) diff --git a/src/ctype/iscntrl.c b/src/ctype/iscntrl.c index a8107d05..d39a79ee 100644 --- a/src/ctype/iscntrl.c +++ b/src/ctype/iscntrl.c @@ -9,7 +9,7 @@ int iscntrl(int c) SIGNAL_SAFE(0); ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF); - return c == EOF ? 0 : map[c] & CT_CNTRL; + return c == EOF ? 0 : map[c] & CTM_CNTRL; } CHECK_1(int, 0, iscntrl, int) diff --git a/src/ctype/isgraph.c b/src/ctype/isgraph.c index be28a436..a45a2740 100644 --- a/src/ctype/isgraph.c +++ b/src/ctype/isgraph.c @@ -9,7 +9,7 @@ int isgraph(int c) SIGNAL_SAFE(0); ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF); - return c == EOF ? 0 : map[c] & CT_GRAPH; + return c == EOF ? 0 : map[c] & CTM_GRAPH; } CHECK_1(int, 0, isgraph, int) diff --git a/src/ctype/islower.c b/src/ctype/islower.c index 30aa16d1..6715e64a 100644 --- a/src/ctype/islower.c +++ b/src/ctype/islower.c @@ -9,7 +9,7 @@ int islower(int c) SIGNAL_SAFE(0); ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF); - return c == EOF ? 0 : map[c] & CT_LOWER; + return c == EOF ? 0 : map[c] & CTM_LOWER; } CHECK_1(int, 0, islower, int) diff --git a/src/ctype/isprint.c b/src/ctype/isprint.c index 5cbc726c..fcb88b8e 100644 --- a/src/ctype/isprint.c +++ b/src/ctype/isprint.c @@ -9,7 +9,7 @@ int isprint(int c) SIGNAL_SAFE(0); ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF); - return c == EOF ? 0 : map[c] & CT_PRINT; + return c == EOF ? 0 : map[c] & CTM_PRINT; } CHECK_1(int, 0, isprint, int) diff --git a/src/ctype/ispunct.c b/src/ctype/ispunct.c index 17bd3e76..90bd5683 100644 --- a/src/ctype/ispunct.c +++ b/src/ctype/ispunct.c @@ -9,7 +9,7 @@ int ispunct(int c) SIGNAL_SAFE(0); ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF); - return c == EOF ? 0 : map[c] & CT_PUNCT; + return c == EOF ? 0 : map[c] & CTM_PUNCT; } CHECK_1(int, 0, ispunct, int) diff --git a/src/ctype/isspace.c b/src/ctype/isspace.c index 654d50fb..20dcf6cc 100644 --- a/src/ctype/isspace.c +++ b/src/ctype/isspace.c @@ -9,7 +9,7 @@ int isspace(int c) SIGNAL_SAFE(0); ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF); - return c == EOF ? 0 : map[c] & CT_SPACE; + return c == EOF ? 0 : map[c] & CTM_SPACE; } CHECK_1(int, 0, isspace, int) diff --git a/src/ctype/isupper.c b/src/ctype/isupper.c index c21be203..95c2a787 100644 --- a/src/ctype/isupper.c +++ b/src/ctype/isupper.c @@ -9,7 +9,7 @@ int isupper(int c) SIGNAL_SAFE(0); ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF); - return c == EOF ? 0 : map[c] & CT_UPPER; + return c == EOF ? 0 : map[c] & CTM_UPPER; } CHECK_1(int, 0, isupper, int) diff --git a/src/ctype/isxdigit.c b/src/ctype/isxdigit.c index 8a227e2a..dfaa13ea 100644 --- a/src/ctype/isxdigit.c +++ b/src/ctype/isxdigit.c @@ -9,7 +9,7 @@ int isxdigit(int c) SIGNAL_SAFE(0); ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF); - return c == EOF ? 0 : map[c] & CT_XDIGIT; + return c == EOF ? 0 : map[c] & CTM_XDIGIT; } CHECK_1(int, 0, isxdigit, int) |
