On Thu, 16 Mar 2000, Dmitry Timoshkov wrote:
> Ove Kaaven <[EMAIL PROTECTED]> wrote:
>
> >> Yes, filling RTL_NLS_DATA structure is absolutely no problem. The problem is
> >> again to introduce Wine-own-internal interface. There are already plenty of
> >> them. I think that using not exported, own, internal functions from external
> >> modules such as x11drv is a bad idea. Is it?
> >
> >Can't data for X11 encodings just be internal to x11drv?
>
> Are the X11 encodings such specific and can not be replaced by the standard
> encodings? Having such common feature as support for various encodings in one
> place (kernel/ntdll) should help to minimize bugs in handling of encodings
> and help in providing additional drivers without excessive complications.
Well, you can surely use RtlCustomCP routines even if the tables are in
the X11 module, and you can probably use the same tools to build the
tables no matter where they are? I can't see anything that should make the
solution any buggier.
And what "standard" encodings would you be talking about? Pretty much NONE
of the Microsoft codepages are standard encodings. Even CP1252 is a little
different from iso8859-1. And as far as I know, there is no codepage that
corresponds to any of the other major encodings... like koi8-r, for
example?
I think that since X11 encodings (which are standard) have nothing in
common with codepages (which is ordinary Microsoft non-standard), the
tables could just as well be linked into the X11 module.
> Let's take c_20261.nls from NT4 and c_950.nls from NT2000:
> (chars and offsets in hex)
> ==============================================================
> Trying to open NT c_950.nls
> Windows NT format NLS
> wSize: 000D
> CodePage: 950
> MaxCharSize: 2
> DefaultChar: 3F 00
> UnicodeDefaultChar: 3F
> unknown1: 3F
> unknown2: 3F
> LeadByte[0] = 0081
> LeadByte[1] = 00FE
> LeadByte[2] = 0000
> LeadByte[3] = 0000
> LeadByte[4] = 0000
> LeadByte[5] = 0000
> LeadByte[6] = 0000
> LeadByte[7] = 0000
> LeadByte[8] = 0000
> LeadByte[9] = 0000
> LeadByte[10] = 0000
> LeadByte[11] = 0000
> Size of tables in words 8003 <----
> CP_to_Unicode starts at 0000001C, ends at 00010022
> Testing CP_to_Unicode table
> table[0x30 ('0')] = 0x30 ('0') OK
> table[0x39 ('9')] = 0x39 ('9') OK
> table[0x41 ('A')] = 0x41 ('A') OK
> table[0x5A ('Z')] = 0x5A ('Z') OK
> Unicode_to_CP starts at 00010022, ends at 00030022
> dwTableSize = 0x20000, dwFileSize = 0x30022
> Testing CP_to_Unicode table
> table[0x30 ('0')] = 0x30 ('0') OK
> table[0x39 ('9')] = 0x39 ('9') OK
> table[0x41 ('A')] = 0x41 ('A') OK
> table[0x5A ('Z')] = 0x5A ('Z') OK
> ==============================================================
> Trying to open NT c_20261.nls
> Windows NT format NLS
> wSize: 000D
> CodePage: 20261
> MaxCharSize: 2
> DefaultChar: 3F 00
> UnicodeDefaultChar: 3F
> unknown1: 3F
> unknown2: 3F
> LeadByte[0] = 00C1
> LeadByte[1] = 00CF
> LeadByte[2] = 0000
> LeadByte[3] = 0000
> LeadByte[4] = 0000
> LeadByte[5] = 0000
> LeadByte[6] = 0000
> LeadByte[7] = 0000
> LeadByte[8] = 0000
> LeadByte[9] = 0000
> LeadByte[10] = 0000
> LeadByte[11] = 0000
> Size of tables in words 1103 <----
> CP_to_Unicode starts at 0000001C, ends at 00002222
> Testing CP_to_Unicode table
> table[0x30 ('0')] = 0x30 ('0') OK
> table[0x39 ('9')] = 0x39 ('9') OK
> table[0x41 ('A')] = 0x41 ('A') OK
> table[0x5A ('Z')] = 0x5A ('Z') OK
> Unicode_to_CP starts at 00002222, ends at 00022222
> dwTableSize = 0x20000, dwFileSize = 0x22222
> Testing CP_to_Unicode table
> table[0x30 ('0')] = 0x30 ('0') OK
> table[0x39 ('9')] = 0x39 ('9') OK
> table[0x41 ('A')] = 0x41 ('A') OK
> table[0x5A ('Z')] = 0x5A ('Z') OK
> ==============================================================
>
> Why the sizes are so different? Or cp950 has additional OEM tables
> (with displayable symbols)?
No, cp950 has a much broader lead byte range (81-FE, i.e. 126 lead byte
codes), and each lead byte obviously need an additional 256-char trail
byte conversion table.
(Oh, and I decided to also reverse engineer the DBCS conversion stuff in
NT, and so I've updated my webpages with the new information, if you want
to see it.)