* libc/locale/locale.c (loadlocale): Allow CP932 as alias for SJIS.

Add to documentation.  Add a few comments to #endif's for Cygwin.
This commit is contained in:
Corinna Vinschen 2010-01-23 16:41:08 +00:00
parent e0c57463f0
commit b0466b3702
2 changed files with 21 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2010-01-23 Corinna Vinschen <corinna@vinschen.de>
* libc/locale/locale.c (loadlocale): Allow CP932 as alias for SJIS.
Add to documentation. Add a few comments to #endif's for Cygwin.
2010-01-23 Corinna Vinschen <corinna@vinschen.de> 2010-01-23 Corinna Vinschen <corinna@vinschen.de>
* libc/locale/locale.c (loadlocale): Disable JIS entirely on Cygwin. * libc/locale/locale.c (loadlocale): Disable JIS entirely on Cygwin.

View File

@ -60,8 +60,8 @@ Additionally to the POSIX specifier, seven extensions are supported for
backward compatibility with older implementations using newlib: backward compatibility with older implementations using newlib:
<<"C-UTF-8">>, <<"C-JIS">>, <<"C-eucJP">>, <<"C-SJIS">>, <<C-KOI8-R>>, <<"C-UTF-8">>, <<"C-JIS">>, <<"C-eucJP">>, <<"C-SJIS">>, <<C-KOI8-R>>,
<<C-KOI8-U>>, <<"C-ISO-8859-x">> with 1 <= x <= 15, or <<"C-CPxxx">> with <<C-KOI8-U>>, <<"C-ISO-8859-x">> with 1 <= x <= 15, or <<"C-CPxxx">> with
xxx in [437, 720, 737, 775, 850, 852, 855, 857, 858, 862, 866, 874, 1125, xxx in [437, 720, 737, 775, 850, 852, 855, 857, 858, 862, 866, 874, 932,
1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258]. 1125, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258].
Instead of <<"C-">>, you can specify also <<"C.">>. Both variations allow Instead of <<"C-">>, you can specify also <<"C.">>. Both variations allow
to specify language neutral locales while using other charsets than ASCII, to specify language neutral locales while using other charsets than ASCII,
@ -71,7 +71,7 @@ but uses the UTF-8 charset.
Even when using POSIX locale strings, the only charsets allowed are Even when using POSIX locale strings, the only charsets allowed are
<<"UTF-8">>, <<"JIS">>, <<"EUCJP">>, <<"SJIS">>, <<KOI8-R>>, <<KOI8-U>>, <<"UTF-8">>, <<"JIS">>, <<"EUCJP">>, <<"SJIS">>, <<KOI8-R>>, <<KOI8-U>>,
<<"ISO-8859-x">> with 1 <= x <= 15, or <<"CPxxx">> with xxx in <<"ISO-8859-x">> with 1 <= x <= 15, or <<"CPxxx">> with xxx in
[437, 720, 737, 775, 850, 852, 855, 857, 858, 862, 866, 874, 1125, 1250, [437, 720, 737, 775, 850, 852, 855, 857, 858, 862, 866, 874, 932, 1125, 1250,
1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258]. 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258].
Charsets are case insensitive. For instance, <<"EUCJP">> and <<"eucJP">> Charsets are case insensitive. For instance, <<"EUCJP">> and <<"eucJP">>
are equivalent. <<"UTF-8">> can also be written without dash, as in are equivalent. <<"UTF-8">> can also be written without dash, as in
@ -190,7 +190,7 @@ char *_PathLocale = NULL;
static static
#ifndef __CYGWIN__ #ifndef __CYGWIN__
_CONST _CONST
#endif #endif /* !__CYGWIN__ */
struct lconv lconv = struct lconv lconv =
{ {
".", "", "", "", "", "", "", "", "", "", ".", "", "", "", "", "", "", "", "", "",
@ -559,7 +559,7 @@ loadlocale(struct _reent *p, int category)
l_mbtowc = __jis_mbtowc; l_mbtowc = __jis_mbtowc;
#endif #endif
break; break;
#endif #endif /* !__CYGWIN__ */
case 'E': case 'E':
case 'e': case 'e':
if (!strcasecmp (charset, "EUCJP") || !strcasecmp (charset, "EUC-JP")) if (!strcasecmp (charset, "EUCJP") || !strcasecmp (charset, "EUC-JP"))
@ -582,7 +582,7 @@ loadlocale(struct _reent *p, int category)
l_mbtowc = __kr_mbtowc; l_mbtowc = __kr_mbtowc;
#endif #endif
} }
#endif #endif /* __CYGWIN__ */
else else
return NULL; return NULL;
break; break;
@ -659,6 +659,13 @@ loadlocale(struct _reent *p, int category)
l_wctomb = __ascii_wctomb; l_wctomb = __ascii_wctomb;
l_mbtowc = __ascii_mbtowc; l_mbtowc = __ascii_mbtowc;
#endif /* _MB_EXTENDED_CHARSETS_WINDOWS */ #endif /* _MB_EXTENDED_CHARSETS_WINDOWS */
#endif
break;
case 932:
mbc_max = 2;
#ifdef _MB_CAPABLE
l_wctomb = __sjis_wctomb;
l_mbtowc = __sjis_mbtowc;
#endif #endif
break; break;
default: default:
@ -766,7 +773,7 @@ loadlocale(struct _reent *p, int category)
ret = __time_load_locale (locale, (void *) l_wctomb, charset); ret = __time_load_locale (locale, (void *) l_wctomb, charset);
if (ret) if (ret)
return NULL; return NULL;
#endif #endif /* __CYGWIN__ */
return strcpy(current_categories[category], new_categories[category]); return strcpy(current_categories[category], new_categories[category]);
} }
@ -851,7 +858,7 @@ _DEFUN(_localeconv_r, (data),
lconv.int_p_sign_posn = m->p_sign_posn[0]; lconv.int_p_sign_posn = m->p_sign_posn[0];
__mlocale_changed = 0; __mlocale_changed = 0;
} }
#endif #endif /* __CYGWIN__ */
return (struct lconv *) &lconv; return (struct lconv *) &lconv;
} }
@ -865,7 +872,7 @@ _DEFUN(setlocale, (category, locale),
{ {
return _setlocale_r (_REENT, category, locale); return _setlocale_r (_REENT, category, locale);
} }
#endif #endif /* __CYGWIN__ */
struct lconv * struct lconv *
_DEFUN_VOID(localeconv) _DEFUN_VOID(localeconv)