* libc/locale/locale.c (loadlocale): Rename charset "CP949" to

"eucKR".  Fix documentation accordingly.
This commit is contained in:
Corinna Vinschen 2009-03-24 18:18:14 +00:00
parent 62e51f09f9
commit 4e4ff45c0b
2 changed files with 35 additions and 24 deletions

View File

@ -1,3 +1,8 @@
2009-03-24 Corinna Vinschen <corinna@vinschen.de>
* libc/locale/locale.c (loadlocale): Rename charset "CP949" to
"eucKR". Fix documentation accordingly.
2009-03-24 Corinna Vinschen <corinna@vinschen.de> 2009-03-24 Corinna Vinschen <corinna@vinschen.de>
* libc/locale/locale.c (loadlocale): Allow charset starting with 'e' * libc/locale/locale.c (loadlocale): Allow charset starting with 'e'

View File

@ -46,19 +46,20 @@ This is a minimal implementation, supporting only the required <<"POSIX">>
and <<"C">> values for <[locale]>; strings representing other locales are not and <<"C">> values for <[locale]>; strings representing other locales are not
honored unless _MB_CAPABLE is defined in which case POSIX locale strings honored unless _MB_CAPABLE is defined in which case POSIX locale strings
are allowed, plus five extensions supported for backward compatibility with are allowed, plus five extensions supported for backward compatibility with
older implementations using newlib: <<"C-UTF-8">>, <<"C-JIS">>, <<"C-EUCJP">>, older implementations using newlib: <<"C-UTF-8">>, <<"C-JIS">>,
<<"C-SJIS">>, <<"C-ISO-8859-x">> with 1 <= x <= 15, or <<"C-CPxxx">> with <<"C-EUCJP">>/<<"C-eucJP">>, <<"C-SJIS">>, <<"C-ISO-8859-x">> with
xxx in [437, 720, 737, 775, 850, 852, 855, 857, 858, 862, 866, 874, 1125, 1250, 1 <= x <= 15, or <<"C-CPxxx">> with xxx in [437, 720, 737, 775, 850, 852,
1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258]. Even when using POSIX 855, 857, 858, 862, 866, 874, 1125, 1250, 1251, 1252, 1253, 1254, 1255, 1256,
locale strings, the only charsets allowed are <<"UTF-8">>, <<"JIS">>, 1257, 1258]. Even when using POSIX locale strings, the only charsets allowed
<<"EUCJP">>, <<"SJIS">>, <<"ISO-8859-x">> with 1 <= x <= 15, or are <<"UTF-8">>, <<"JIS">>, <<"EUCJP">>/<<"eucJP">>, <<"SJIS">>,
<<"CPxxx">> with xxx in [437, 720, 737, 775, 850, 852, 855, 857, 858, 862, 866, <<"ISO-8859-x">> with 1 <= x <= 15, or <<"CPxxx">> with xxx in [437, 720,
874, 1125, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258]. 737, 775, 850, 852, 855, 857, 858, 862, 866, 874, 1125, 1250, 1251, 1252,
1253, 1254, 1255, 1256, 1257, 1258].
(<<"">> is also accepted; if given, the settings are read from the (<<"">> is also accepted; if given, the settings are read from the
corresponding LC_* environment variables and $LANG according to POSIX rules. corresponding LC_* environment variables and $LANG according to POSIX rules.
Under Cygwin, this implementation additionally supports the charsets <<"GBK">>, Under Cygwin, this implementation additionally supports the charsets <<"GBK">>,
<<"CP949">>, and <<"BIG5">>. <<"eucKR">>, and <<"Big5">>.
If you use <<NULL>> as the <[locale]> argument, <<setlocale>> returns If you use <<NULL>> as the <[locale]> argument, <<setlocale>> returns
a pointer to the string representing the current locale (always a pointer to the string representing the current locale (always
@ -464,14 +465,28 @@ loadlocale(struct _reent *p, int category)
break; break;
case 'E': case 'E':
case 'e': case 'e':
if (strcmp (charset, "EUCJP") && strcmp (charset, "eucJP")) if (!strcmp (charset, "EUCJP") || !strcmp (charset, "eucJP"))
return NULL; {
strcpy (charset, "EUCJP"); strcpy (charset, "EUCJP");
mbc_max = 2; mbc_max = 2;
#ifdef _MB_CAPABLE #ifdef _MB_CAPABLE
__wctomb = __eucjp_wctomb; __wctomb = __eucjp_wctomb;
__mbtowc = __eucjp_mbtowc; __mbtowc = __eucjp_mbtowc;
#endif #endif
}
#ifdef __CYGWIN__
else if (!strcmp (charset, "EUCKR") || !strcmp (charset, "eucKR"))
{
strcpy (charset, "EUCKR");
mbc_max = 2;
#ifdef _MB_CAPABLE
__wctomb = __kr_wctomb;
__mbtowc = __kr_mbtowc;
#endif
}
#endif
else
return NULL;
break; break;
case 'S': case 'S':
if (strcmp (charset, "SJIS")) if (strcmp (charset, "SJIS"))
@ -542,15 +557,6 @@ loadlocale(struct _reent *p, int category)
#endif /* _MB_EXTENDED_CHARSETS_WINDOWS */ #endif /* _MB_EXTENDED_CHARSETS_WINDOWS */
#endif #endif
break; break;
#ifdef __CYGWIN__
case 949:
mbc_max = 2;
#ifdef _MB_CAPABLE
__wctomb = __kr_wctomb;
__mbtowc = __kr_mbtowc;
#endif
break;
#endif
default: default:
return NULL; return NULL;
} }