[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: Locale Question
From:       Jon <tntjpgriff () tsnxt ! co ! uk>
Date:       2000-11-29 4:36:55
[Download RAW message or body]

On Wednesday 29 November 2000  3:18 am, Dmitry Timoshkov wrote:
> Which crtdll function does need this?

setlocale(), which I arrived at looking to implement isleadbyte(). The crt 
headers define:

#define isleadbyte(_c)  (_pctype[(unsigned char)(_c)] & _LEADBYTE)

Fairly, trivial, just like the regular isxxx functions. but on
http://msdn.microsoft.com/library/devprods/vs6/visualc/vccore/_crt_isleadbyte.htm: 
                  
"The result of the test depends upon the LC_CTYPE category setting of the 
current locale; see setlocale for more information."

The same will hold true for isalpha etc as well, although I havent tested 
them yet. But with the real crtdll (& msvcrt), setting the locale to Japan 
and testing all chars for leadbytes indicates that the tables been modified. 
So it seems I need to update the _ctype table when the locale changes. The 
info I need to update ctype with lead byte flags can be gotten from 
GetCPInfo(). But to call that, I need to get the code page, so I need to 
translate the setlocale() strings from 
http://msdn.microsoft.com/library/devprods/vs6/visualc/vccore/_crt_language_and_country_strings.htm
into an LCID, then a code page number.

> I think that Win32 API should satisfy nearly any crtdll function
> implementation.

I think so, with some effort. I have taken the method of enumerating the 
supported langid's and comparing the country/language names, from the 
ol2nls.c source. But this is _very_ inefficient, and the permutations of 
possible locale string are large. What I may end up doing is building some 
look up tables to map locale parameters into LCIDs instead. The other 
problem that springs to mind is that some locale dependent calls are 
forwarded to libc, so it may be necessay to set libc's locale as well.

I'm away until Monday night so I'll have a think about it over the weekend.

Cheers,
Jon

-- 
"May their negative actions ripen upon me. And may all my virtues ripen upon 
them."
"If it could be talked about, everybody would have told their brother."
tntjpgriff@tsnxt.co.uk , jon_p_griffiths@yahoo.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic