* Makefile.in (DLL_OFILES): Add nlsfunc.o and strfmon.o.
* autoload.cc (LocaleNameToLCID): Define. * cygwin.din (strfmon): Export. * nlsfuncs.cc: New file. Define a lot of internal functions called from setlocale. (wcscoll): Implement locale-aware here, using CompareStringW function. (strcoll): Ditto. (wcsxfrm): Implement locale-aware here, usingLCMapStringW function. (strxfrm): Ditto. (__set_charset_from_locale): Replace __set_charset_from_codepage. Return Linux-compatible charset. * strfuncs.cc (__set_charset_from_codepage): Remove. * wchar.h (__set_charset_from_codepage): Drop definition. * wincap.h (wincaps::has_localenames): New element. * wincap.cc: Implement above element throughout. * libc/strfmon.c: New file. * libc/strptime.cc: Remove locale constant strings in favor of access to locale-specifc data. (strptime): Point _CurrentTimeLocale to locale-specific data. Throughout use correct locale-specific format fields for all locale-specific formats. * include/monetary.h: New file. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
This commit is contained in:
@ -352,87 +352,6 @@ __big5_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
|
||||
return __db_mbtowc (r, pwc, s, n, 950, state);
|
||||
}
|
||||
|
||||
/* Convert Windows codepage to a setlocale compatible character set code.
|
||||
Called from newlib's setlocale() with codepage set to 0, if the
|
||||
charset isn't given explicitely in the POSIX compatible locale specifier.
|
||||
The function also returns a pointer to the corresponding _mbtowc_r
|
||||
function. */
|
||||
extern "C" mbtowc_p
|
||||
__set_charset_from_codepage (UINT cp, char *charset)
|
||||
{
|
||||
if (cp == 0)
|
||||
cp = GetACP ();
|
||||
switch (cp)
|
||||
{
|
||||
case 437:
|
||||
case 720:
|
||||
case 737:
|
||||
case 775:
|
||||
case 850:
|
||||
case 852:
|
||||
case 855:
|
||||
case 857:
|
||||
case 858:
|
||||
case 862:
|
||||
case 866:
|
||||
case 874:
|
||||
case 1125:
|
||||
case 1250:
|
||||
case 1251:
|
||||
case 1252:
|
||||
case 1253:
|
||||
case 1254:
|
||||
case 1255:
|
||||
case 1256:
|
||||
case 1257:
|
||||
case 1258:
|
||||
case 20866:
|
||||
case 21866:
|
||||
__small_sprintf (charset, "CP%u", cp);
|
||||
return __cp_mbtowc;
|
||||
case 28591:
|
||||
case 28592:
|
||||
case 28593:
|
||||
case 28594:
|
||||
case 28595:
|
||||
case 28596:
|
||||
case 28597:
|
||||
case 28598:
|
||||
case 28599:
|
||||
case 28603:
|
||||
case 28605:
|
||||
__small_sprintf (charset, "ISO-8859-%u", cp - 28590);
|
||||
return __iso_mbtowc;
|
||||
case 932:
|
||||
strcpy (charset, "SJIS");
|
||||
return __sjis_mbtowc;
|
||||
case 936:
|
||||
strcpy (charset, "GBK");
|
||||
return __gbk_mbtowc;
|
||||
case 949:
|
||||
case 51949:
|
||||
strcpy (charset, "EUCKR");
|
||||
return __kr_mbtowc;
|
||||
case 950:
|
||||
strcpy (charset, "BIG5");
|
||||
return __big5_mbtowc;
|
||||
case 50220:
|
||||
strcpy (charset, "JIS");
|
||||
return __jis_mbtowc;
|
||||
case 20932:
|
||||
case 51932:
|
||||
strcpy (charset, "EUCJP");
|
||||
return __eucjp_mbtowc;
|
||||
case 65001:
|
||||
strcpy (charset, "UTF-8");
|
||||
return __utf8_mbtowc;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
strcpy (charset, "ASCII");
|
||||
return __ascii_mbtowc;
|
||||
}
|
||||
|
||||
/* Our own sys_wcstombs/sys_mbstowcs functions differ from the
|
||||
wcstombs/mbstowcs API in three ways:
|
||||
|
||||
|
Reference in New Issue
Block a user