aboutsummaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-02-25 13:19:27 +0100
committerCorinna Vinschen <corinna@vinschen.de>2023-02-25 16:12:51 +0100
commit2b052b3c5080c1b601129fcceda5f6537a442c87 (patch)
tree7886ef6b384da1d04ee41dcd0347ad76ee1c8d8d /newlib
parent98aed7943ee3000281b1226e5a68152a3da7358f (diff)
downloadnewlib-2b052b3c5080c1b601129fcceda5f6537a442c87.zip
newlib-2b052b3c5080c1b601129fcceda5f6537a442c87.tar.gz
newlib-2b052b3c5080c1b601129fcceda5f6537a442c87.tar.bz2
Cygwin: fully support KOI8-T codeset
Commit 89eb4bce152f was pretty half-hearted, missing the codepage character type tables and wctomb/mbtowc mappings. Fixes: 89eb4bce152f ("Cygwin: support KOI8-T codeset") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib')
-rw-r--r--newlib/libc/ctype/ctype_cp.h33
-rw-r--r--newlib/libc/stdlib/mbtowc_r.c12
-rw-r--r--newlib/libc/stdlib/wctomb_r.c11
3 files changed, 50 insertions, 6 deletions
diff --git a/newlib/libc/ctype/ctype_cp.h b/newlib/libc/ctype/ctype_cp.h
index 9370778..192cfa4 100644
--- a/newlib/libc/ctype/ctype_cp.h
+++ b/newlib/libc/ctype/ctype_cp.h
@@ -469,13 +469,31 @@
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_PT154_255 _L
+#define _CTYPE_CP103_128_254 \
+ _L, _L, _P, _U, _P, _P, _P, _P, \
+ 0, _P, _L, _P, _U, _L, _U, 0, \
+ _U, _P, _P, _P, _P, _P, _P, _P, \
+ 0, _P, 0, _P, 0, 0, 0, 0, \
+ 0, _L, _U, _L, _P, _L, _P, _P, \
+ 0, 0, 0, _P, _P, _P, _P, 0, \
+ _P, _P, _P, _U, 0, _U, _P, _P, \
+ 0, _P, 0, _P, 0, 0, 0, _P, \
+ _L, _L, _L, _L, _L, _L, _L, _L, \
+ _L, _L, _L, _L, _L, _L, _L, _L, \
+ _L, _L, _L, _L, _L, _L, _L, _L, \
+ _L, _L, _L, _L, _L, _L, _L, _L, \
+ _U, _U, _U, _U, _U, _U, _U, _U, \
+ _U, _U, _U, _U, _U, _U, _U, _U, \
+ _U, _U, _U, _U, _U, _U, _U, _U, \
+ _U, _U, _U, _U, _U, _U, _U
+#define _CTYPE_CP103_255 _U
#if defined(ALLOW_NEGATIVE_CTYPE_INDEX)
#ifndef __CYGWIN__
static const
#endif
-char __ctype_cp[26][128 + 256] = {
+char __ctype_cp[27][128 + 256] = {
{ _CTYPE_CP437_128_254,
0,
_CTYPE_DATA_0_127,
@@ -632,11 +650,17 @@ char __ctype_cp[26][128 + 256] = {
_CTYPE_PT154_128_254,
_CTYPE_PT154_255
},
+ { _CTYPE_CP103_128_254,
+ 0,
+ _CTYPE_DATA_0_127,
+ _CTYPE_CP103_128_254,
+ _CTYPE_CP103_255
+ },
};
#else /* !defined(ALLOW_NEGATIVE_CTYPE_INDEX) */
-static const char __ctype_cp[26][1 + 256] = {
+static const char __ctype_cp[27][1 + 256] = {
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP437_128_254,
@@ -767,6 +791,11 @@ static const char __ctype_cp[26][1 + 256] = {
_CTYPE_PT154_128_254,
_CTYPE_PT154_255
},
+ { 0,
+ _CTYPE_DATA_0_127,
+ _CTYPE_CP103_128_254,
+ _CTYPE_CP103_255
+ },
};
#endif /* ALLOW_NEGATIVE_CTYPE_INDEX */
diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c
index ca876f9..01e596d 100644
--- a/newlib/libc/stdlib/mbtowc_r.c
+++ b/newlib/libc/stdlib/mbtowc_r.c
@@ -487,7 +487,14 @@ __cp_102_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
return ___cp_mbtowc (r, pwc, s, n, 25, state);
}
-static mbtowc_p __cp_xxx_mbtowc[26] = {
+static int
+__cp_103_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+ mbstate_t *state)
+{
+ return ___cp_mbtowc (r, pwc, s, n, 26, state);
+}
+
+static mbtowc_p __cp_xxx_mbtowc[27] = {
__cp_437_mbtowc,
__cp_720_mbtowc,
__cp_737_mbtowc,
@@ -513,7 +520,8 @@ static mbtowc_p __cp_xxx_mbtowc[26] = {
__cp_20866_mbtowc,
__cp_21866_mbtowc,
__cp_101_mbtowc,
- __cp_102_mbtowc
+ __cp_102_mbtowc,
+ __cp_103_mbtowc,
};
/* val *MUST* be valid! All checks for validity are supposed to be
diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c
index a7f87cd..3081e93 100644
--- a/newlib/libc/stdlib/wctomb_r.c
+++ b/newlib/libc/stdlib/wctomb_r.c
@@ -611,7 +611,13 @@ __cp_102_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
return ___cp_wctomb (r, s, _wchar, 25, state);
}
-static wctomb_p __cp_xxx_wctomb[26] = {
+static int
+__cp_103_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+{
+ return ___cp_wctomb (r, s, _wchar, 26, state);
+}
+
+static wctomb_p __cp_xxx_wctomb[27] = {
__cp_437_wctomb,
__cp_720_wctomb,
__cp_737_wctomb,
@@ -637,7 +643,8 @@ static wctomb_p __cp_xxx_wctomb[26] = {
__cp_20866_wctomb,
__cp_21866_wctomb,
__cp_101_wctomb,
- __cp_102_wctomb
+ __cp_102_wctomb,
+ __cp_103_wctomb,
};
/* val *MUST* be valid! All checks for validity are supposed to be