mirror of
https://github.com/reactos/reactos.git
synced 2025-05-23 11:04:52 +00:00
[CRT]
- make some functions locale aware - add implementation of ___mb_cur_max_func and _isctype_l [MSVCRT20] - keep up with msvcrt [MSVCRT40] - ditto svn path=/trunk/; revision=57838
This commit is contained in:
parent
90b34c856c
commit
cece806823
11 changed files with 71 additions and 27 deletions
|
@ -133,7 +133,7 @@
|
||||||
@ cdecl ___lc_codepage_func()
|
@ cdecl ___lc_codepage_func()
|
||||||
# @ cdecl ___lc_collate_cp_func()
|
# @ cdecl ___lc_collate_cp_func()
|
||||||
@ cdecl ___lc_handle_func()
|
@ cdecl ___lc_handle_func()
|
||||||
# @ cdecl ___mb_cur_max_func() MSVCRT___mb_cur_max_func
|
@ cdecl ___mb_cur_max_func()
|
||||||
@ cdecl ___setlc_active_func()
|
@ cdecl ___setlc_active_func()
|
||||||
@ cdecl ___unguarded_readlc_active_add_func()
|
@ cdecl ___unguarded_readlc_active_add_func()
|
||||||
@ extern __argc
|
@ extern __argc
|
||||||
|
@ -492,7 +492,7 @@
|
||||||
@ cdecl _isatty(long)
|
@ cdecl _isatty(long)
|
||||||
# stub _iscntrl_l
|
# stub _iscntrl_l
|
||||||
@ cdecl _isctype(long long)
|
@ cdecl _isctype(long long)
|
||||||
# stub _isctype_l
|
@ cdecl _isctype_l(long long ptr)
|
||||||
# stub _isdigit_l
|
# stub _isdigit_l
|
||||||
# stub _isgraph_l
|
# stub _isgraph_l
|
||||||
# stub _isleadbyte_l
|
# stub _isleadbyte_l
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <internal/wine/msvcrt.h>
|
#include <internal/wine/msvcrt.h>
|
||||||
|
#include <internal/locale.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <mbctype.h>
|
#include <mbctype.h>
|
||||||
|
|
||||||
|
@ -93,17 +94,11 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
||||||
|
|
||||||
/* Initialization of the WINE code */
|
/* Initialization of the WINE code */
|
||||||
msvcrt_init_mt_locks();
|
msvcrt_init_mt_locks();
|
||||||
//if(!msvcrt_init_locale()) {
|
|
||||||
// msvcrt_free_mt_locks();
|
|
||||||
// msvcrt_free_tls_mem();
|
|
||||||
// return FALSE;
|
|
||||||
//}
|
|
||||||
//msvcrt_init_math();
|
//msvcrt_init_math();
|
||||||
msvcrt_init_io();
|
msvcrt_init_io();
|
||||||
//msvcrt_init_console();
|
//msvcrt_init_console();
|
||||||
//msvcrt_init_args();
|
//msvcrt_init_args();
|
||||||
//msvcrt_init_signals();
|
//msvcrt_init_signals();
|
||||||
_setmbcp(_MB_CP_LOCALE);
|
|
||||||
TRACE("Attach done\n");
|
TRACE("Attach done\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -126,7 +121,8 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
||||||
msvcrt_free_tls_mem();
|
msvcrt_free_tls_mem();
|
||||||
if (!msvcrt_free_tls())
|
if (!msvcrt_free_tls())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
//MSVCRT__free_locale(MSVCRT_locale);
|
if(global_locale)
|
||||||
|
MSVCRT__free_locale(global_locale);
|
||||||
|
|
||||||
if (__winitenv && __winitenv != _wenviron)
|
if (__winitenv && __winitenv != _wenviron)
|
||||||
FreeEnvironment((char**)__winitenv);
|
FreeEnvironment((char**)__winitenv);
|
||||||
|
@ -169,4 +165,4 @@ void CDECL MSVCRT20__wgetmainargs( int *argc, WCHAR** *wargv, WCHAR** *wenvp,
|
||||||
__wgetmainargs( argc, wargv, wenvp, expand_wildcards, &new_mode );
|
__wgetmainargs( argc, wargv, wenvp, expand_wildcards, &new_mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <internal/wine/msvcrt.h>
|
#include <internal/wine/msvcrt.h>
|
||||||
|
#include <internal/locale.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <mbctype.h>
|
#include <mbctype.h>
|
||||||
|
|
||||||
|
@ -88,17 +89,11 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
||||||
|
|
||||||
/* Initialization of the WINE code */
|
/* Initialization of the WINE code */
|
||||||
msvcrt_init_mt_locks();
|
msvcrt_init_mt_locks();
|
||||||
//if(!msvcrt_init_locale()) {
|
|
||||||
// msvcrt_free_mt_locks();
|
|
||||||
// msvcrt_free_tls_mem();
|
|
||||||
// return FALSE;
|
|
||||||
//}
|
|
||||||
//msvcrt_init_math();
|
//msvcrt_init_math();
|
||||||
msvcrt_init_io();
|
msvcrt_init_io();
|
||||||
//msvcrt_init_console();
|
//msvcrt_init_console();
|
||||||
//msvcrt_init_args();
|
//msvcrt_init_args();
|
||||||
//msvcrt_init_signals();
|
//msvcrt_init_signals();
|
||||||
_setmbcp(_MB_CP_LOCALE);
|
|
||||||
TRACE("Attach done\n");
|
TRACE("Attach done\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -121,7 +116,8 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
||||||
msvcrt_free_tls_mem();
|
msvcrt_free_tls_mem();
|
||||||
if (!msvcrt_free_tls())
|
if (!msvcrt_free_tls())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
//MSVCRT__free_locale(MSVCRT_locale);
|
if(global_locale)
|
||||||
|
MSVCRT__free_locale(global_locale);
|
||||||
|
|
||||||
if (__winitenv && __winitenv != _wenviron)
|
if (__winitenv && __winitenv != _wenviron)
|
||||||
FreeEnvironment((char**)__winitenv);
|
FreeEnvironment((char**)__winitenv);
|
||||||
|
@ -140,4 +136,4 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -33,7 +33,7 @@ typedef struct MSVCRT_threadmbcinfostruct {
|
||||||
int ismbcodepage;
|
int ismbcodepage;
|
||||||
int mblcid;
|
int mblcid;
|
||||||
unsigned short mbulinfo[6];
|
unsigned short mbulinfo[6];
|
||||||
char mbctype[257];
|
unsigned char mbctype[257];
|
||||||
char mbcasemap[256];
|
char mbcasemap[256];
|
||||||
} MSVCRT_threadmbcinfo;
|
} MSVCRT_threadmbcinfo;
|
||||||
|
|
||||||
|
|
|
@ -17,5 +17,5 @@
|
||||||
*/
|
*/
|
||||||
int _ismbbkana(unsigned int c)
|
int _ismbbkana(unsigned int c)
|
||||||
{
|
{
|
||||||
return (_mbctype[c & 0xff] & _MBKANA);
|
return (get_mbcinfo()->mbctype[c & 0xff] & _MBKANA);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,5 +16,5 @@
|
||||||
*/
|
*/
|
||||||
int _ismbbkalnum( unsigned int c )
|
int _ismbbkalnum( unsigned int c )
|
||||||
{
|
{
|
||||||
return (_mbctype[c & 0xff] & _MKMOJI);
|
return (get_mbcinfo()->mbctype[c & 0xff] & _MKMOJI);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
int _ismbblead(unsigned int c)
|
int _ismbblead(unsigned int c)
|
||||||
{
|
{
|
||||||
return (_mbctype[(c&0xff) + 1] & _M1) != 0;
|
return (get_mbcinfo()->mbctype[(c&0xff) + 1] & _M1) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -47,7 +47,7 @@ int _ismbslead( const unsigned char *start, const unsigned char *str)
|
||||||
*/
|
*/
|
||||||
unsigned char *__p__mbctype(void)
|
unsigned char *__p__mbctype(void)
|
||||||
{
|
{
|
||||||
return _mbctype;
|
return get_mbcinfo()->mbctype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
int _ismbbpunct(unsigned int c)
|
int _ismbbpunct(unsigned int c)
|
||||||
{
|
{
|
||||||
// (0xA1 <= c <= 0xA6)
|
// (0xA1 <= c <= 0xA6)
|
||||||
return (_mbctype[c & 0xff] & _MBPUNCT);
|
return (get_mbcinfo()->mbctype[c & 0xff] & _MBPUNCT);
|
||||||
}
|
}
|
||||||
|
|
||||||
//iskana() :(0xA1 <= c <= 0xDF)
|
//iskana() :(0xA1 <= c <= 0xDF)
|
||||||
|
|
|
@ -22,7 +22,7 @@ size_t _mbclen2(const unsigned int s);
|
||||||
*/
|
*/
|
||||||
int _ismbbtrail(unsigned int c)
|
int _ismbbtrail(unsigned int c)
|
||||||
{
|
{
|
||||||
return (_mbctype[(c&0xff) + 1] & _M2) != 0;
|
return (get_mbcinfo()->mbctype[(c&0xff) + 1] & _M2) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -426,7 +426,15 @@ errno_t _get_osplatform(unsigned int *pValue)
|
||||||
*/
|
*/
|
||||||
int *__p___mb_cur_max(void)
|
int *__p___mb_cur_max(void)
|
||||||
{
|
{
|
||||||
return &__mb_cur_max;
|
return &get_locinfo()->mb_cur_max;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
* ___mb_cur_max_func(MSVCRT.@)
|
||||||
|
*/
|
||||||
|
int CDECL ___mb_cur_max_func(void)
|
||||||
|
{
|
||||||
|
return get_locinfo()->mb_cur_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
#define __MINGW_IMPORT
|
#define __MINGW_IMPORT
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#ifndef _LIBCNT_
|
||||||
|
#include <precomp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef _pctype
|
#undef _pctype
|
||||||
#undef _pwctype
|
#undef _pwctype
|
||||||
|
|
||||||
|
@ -567,10 +571,50 @@ const unsigned short* __cdecl __pwctype_func(void)
|
||||||
return _pwctype;
|
return _pwctype;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _isctype (int c, int ctypeFlags)
|
#ifdef _LIBCNT_
|
||||||
|
int __cdecl _isctype (int c, int ctypeFlags)
|
||||||
{
|
{
|
||||||
return (_pctype[(unsigned char)(c & 0xFF)] & ctypeFlags);
|
return (_pctype[(unsigned char)(c & 0xFF)] & ctypeFlags);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
/*********************************************************************
|
||||||
|
* _isctype_l (MSVCRT.@)
|
||||||
|
*/
|
||||||
|
int __cdecl _isctype_l(int c, int type, _locale_t locale)
|
||||||
|
{
|
||||||
|
MSVCRT_pthreadlocinfo locinfo;
|
||||||
|
|
||||||
|
if(!locale)
|
||||||
|
locinfo = get_locinfo();
|
||||||
|
else
|
||||||
|
locinfo = ((MSVCRT__locale_t)locale)->locinfo;
|
||||||
|
|
||||||
|
if (c >= -1 && c <= 255)
|
||||||
|
return locinfo->pctype[c] & type;
|
||||||
|
|
||||||
|
if (locinfo->mb_cur_max != 1 && c > 0)
|
||||||
|
{
|
||||||
|
/* FIXME: Is there a faster way to do this? */
|
||||||
|
WORD typeInfo;
|
||||||
|
char convert[3], *pconv = convert;
|
||||||
|
|
||||||
|
if (locinfo->pctype[(UINT)c >> 8] & _LEADBYTE)
|
||||||
|
*pconv++ = (UINT)c >> 8;
|
||||||
|
*pconv++ = c & 0xff;
|
||||||
|
*pconv = 0;
|
||||||
|
|
||||||
|
if (GetStringTypeExA(locinfo->lc_handle[LC_CTYPE],
|
||||||
|
CT_CTYPE1, convert, convert[1] ? 2 : 1, &typeInfo))
|
||||||
|
return typeInfo & type;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __cdecl _isctype (int c, int ctypeFlags)
|
||||||
|
{
|
||||||
|
return _isctype_l(c, ctypeFlags, NULL);
|
||||||
|
}
|
||||||
|
#endif /* _LIBCNT_ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
|
|
Loading…
Reference in a new issue