From fe57329f991a0b347d40a5c97d9a62285eb708fe Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 22 Jan 2010 13:03:42 +0000 Subject: * libc/locale/lmonetary.c (__monetary_load_locale): Take additional parameters for wide char to multibyte conversion. Call __set_lc_monetary_from_win on Cygwin. * libc/locale/lmonetary.h: Make C++-safe. (__monetary_load_locale): Change declaration. * libc/locale/lnumeric.c (__numeric_load_locale): Take additional parameters for wide char to multibyte conversion. Call __set_lc_numeric_from_win on Cygwin. * libc/locale/lnumeric.h: Make C++-safe. (__numeric_load_locale): Change declaration. * libc/locale/locale.c (lconv): De-constify for Cygwin. (__set_charset_from_locale): Rename from __set_charset_from_codepage. Take locale as parameter instead of a codepage. (loadlocale): Allow "EUC-JP" for "EUCJP" and "EUC-KR" for "EUCKR". Change documnetation accordingly. Enable LC_COLLATE, LC_MONETARY, LC_NUMERIC, and LC_TIME handling on Cygwin. (_localeconv_r): On Cygwin, copy values from monetary and numeric domain if change has been noted. * libc/locale/nl_langinfo.c (nl_langinfo): Accommodate change of am/pm layout in struct lc_time_T. * libc/locale/timelocal.c (_C_time_locale): Accommodate redefinition of am/pm members. (__time_load_locale): Take additional parameters for wide char to multibyte conversion. Call __set_lc_time_from_win on Cygwin. * libc/locale/timelocal.h: Make C++-safe. (struct lc_time_T): Convert am and pm to a am_pm array for easier consumption by strftime and strptime. (__time_load_locale): Change declaration. * libc/time/strftime.c: Change documentation to reflect changes to strftime. Remove locale constant strings in favor of access to locale-specifc data. (_ctloc): Define access method for locale-specifc data. (TOLOWER): Define for tolower conversion. (strftime): Throughout, convert locale-specific formats to use locale-specific data. Add GNU-specific "%P" format. * libc/time/strptime.c: Remove locale constant strings in favor of access to locale-specifc data. (_ctloc): Define access method for locale-specifc data. (strptime): Throughout, convert locale-specific formats to use locale-specific data. --- newlib/libc/locale/lnumeric.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'newlib/libc/locale/lnumeric.c') diff --git a/newlib/libc/locale/lnumeric.c b/newlib/libc/locale/lnumeric.c index 90b404ca2..5bf0a7d11 100644 --- a/newlib/libc/locale/lnumeric.c +++ b/newlib/libc/locale/lnumeric.c @@ -48,10 +48,28 @@ static int _numeric_using_locale; static char *_numeric_locale_buf; int -__numeric_load_locale(const char *name) { - +__numeric_load_locale(const char *name , void *f_wctomb, const char *charset) +{ int ret; +#ifdef __CYGWIN__ + extern int __set_lc_numeric_from_win (const char *, + struct lc_numeric_T *, + void *, const char *); + int old_numeric_using_locale = _numeric_using_locale; + _numeric_using_locale = 0; + ret = __set_lc_numeric_from_win (name, &_numeric_locale, + f_wctomb, charset); + /* ret == -1: error, ret == 0: C/POSIX, ret > 0: valid */ + if (ret < 0) + _numeric_using_locale = old_numeric_using_locale; + else + { + _numeric_using_locale = ret; + __nlocale_changed = 1; + ret = 0; + } +#else __nlocale_changed = 1; ret = __part_load_locale(name, &_numeric_using_locale, _numeric_locale_buf, "LC_NUMERIC", @@ -60,6 +78,7 @@ __numeric_load_locale(const char *name) { if (ret == 0 && _numeric_using_locale) _numeric_locale.grouping = __fix_locale_grouping_str(_numeric_locale.grouping); +#endif return ret; } -- cgit v1.2.3