Author: dgorbachev
Date: Sat May 19 14:11:48 2007
New Revision: 26836
URL:
http://svn.reactos.org/svn/reactos?rev=26836&view=rev
Log:
- Handle DBCS codepages.
- Add Armenian locale definitions from Wine.
Added:
trunk/reactos/dll/win32/kernel32/nls/hye.nls
Modified:
trunk/reactos/dll/win32/kernel32/locale_rc.rc
trunk/reactos/dll/win32/kernel32/misc/nls.c
Modified: trunk/reactos/dll/win32/kernel32/locale_rc.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/locale_…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/locale_rc.rc (original)
+++ trunk/reactos/dll/win32/kernel32/locale_rc.rc Sat May 19 14:11:48 2007
@@ -175,7 +175,7 @@
//#include "nls/vit.nls" /* 0x042a LANG_VIETNAMESE, SUBLANG_NEUTRAL */
-//#include "nls/hye.nls" /* 0x042b LANG_ARMENIAN, SUBLANG_NEUTRAL */
+#include "nls/hye.nls" /* 0x042b LANG_ARMENIAN, SUBLANG_NEUTRAL */
//#include "nls/azl.nls" /* 0x042c LANG_AZERI, SUBLANG_AZERI_LATIN */
//#include "nls/aze.nls" /* 0x082c LANG_AZERI, SUBLANG_AZERI_CYRILLIC */
Modified: trunk/reactos/dll/win32/kernel32/misc/nls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/nl…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/nls.c (original)
+++ trunk/reactos/dll/win32/kernel32/misc/nls.c Sat May 19 14:11:48 2007
@@ -399,10 +399,64 @@
/* Different handling for DBCS code pages. */
if (CodePageTable->MaximumCharacterSize > 1)
{
- /* UNIMPLEMENTED */
- return 0;
- }
- else
+ /* FIXME */
+
+ UCHAR Char;
+ USHORT DBCSOffset;
+ LPCSTR MbsEnd = MultiByteString + MultiByteCount;
+ ULONG Count;
+
+ /* Does caller query for output buffer size? */
+ if (WideCharCount == 0)
+ {
+ for (; MultiByteString < MbsEnd; WideCharCount++)
+ {
+ Char = *MultiByteString++;
+
+ if (Char < 0x80)
+ continue;
+
+ DBCSOffset = CodePageTable->DBCSOffsets[Char];
+
+ if (!DBCSOffset)
+ continue;
+
+ if (MultiByteString < MbsEnd)
+ MultiByteString++;
+ }
+
+ return WideCharCount;
+ }
+
+ for (Count = 0; Count < WideCharCount && MultiByteString < MbsEnd;
Count++)
+ {
+ Char = *MultiByteString++;
+
+ if (Char < 0x80)
+ {
+ *WideCharString++ = Char;
+ continue;
+ }
+
+ DBCSOffset = CodePageTable->DBCSOffsets[Char];
+
+ if (!DBCSOffset)
+ {
+ *WideCharString++ = CodePageTable->MultiByteTable[Char];
+ continue;
+ }
+
+ if (MultiByteString < MbsEnd)
+ *WideCharString++ =
+ CodePageTable->DBCSOffsets[DBCSOffset + *(PUCHAR)MultiByteString++];
+ }
+
+ if (MultiByteString < MbsEnd)
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+
+ return Count;
+ }
+ else /* Not DBCS code page */
{
/* Check for invalid characters. */
if (Flags & MB_ERR_INVALID_CHARS)
@@ -554,10 +608,81 @@
/* Different handling for DBCS code pages. */
if (CodePageTable->MaximumCharacterSize > 1)
{
- DPRINT1("WideCharToMultiByte for DBCS codepages is not implemented!\n");
- return 0;
- }
- else
+ /* FIXME */
+
+ USHORT WideChar;
+ USHORT MbChar;
+
+ /* Does caller query for output buffer size? */
+ if (MultiByteCount == 0)
+ {
+ for (TempLength = 0; WideCharCount; WideCharCount--, TempLength++)
+ {
+ WideChar = *WideCharString++;
+
+ if (WideChar < 0x80)
+ continue;
+
+ MbChar = ((PWCHAR)CodePageTable->WideCharTable)[WideChar];
+
+ if (!(MbChar & 0xff00))
+ continue;
+
+ TempLength++;
+ }
+
+ return TempLength;
+ }
+
+ for (TempLength = MultiByteCount; WideCharCount; WideCharCount--)
+ {
+ WideChar = *WideCharString++;
+
+ if (WideChar < 0x80)
+ {
+ if (!TempLength)
+ {
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ break;
+ }
+ TempLength--;
+
+ *MultiByteString++ = (CHAR)WideChar;
+ continue;
+ }
+
+ MbChar = ((PWCHAR)CodePageTable->WideCharTable)[WideChar];
+
+ if (!(MbChar & 0xff00))
+ {
+ if (!TempLength)
+ {
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ break;
+ }
+ TempLength--;
+
+ *MultiByteString++ = (CHAR)MbChar;
+ continue;;
+ }
+
+ if (TempLength >= 2)
+ {
+ MultiByteString[1] = (CHAR)MbChar; MbChar >>= 8;
+ MultiByteString[0] = (CHAR)MbChar;
+ MultiByteString += 2;
+ TempLength -= 2;
+ }
+ else
+ {
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ break;
+ }
+ }
+
+ return MultiByteCount - TempLength;
+ }
+ else /* Not DBCS code page */
{
/* Does caller query for output buffer size? */
if (MultiByteCount == 0)
Added: trunk/reactos/dll/win32/kernel32/nls/hye.nls
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/nls/hye…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/nls/hye.nls (added)
+++ trunk/reactos/dll/win32/kernel32/nls/hye.nls Sat May 19 14:11:48 2007
@@ -1,0 +1,155 @@
+/*
+ * Locale definitions for Armenian
+ *
+ * Copyright 2002 Alexandre Julliard for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#pragma code_page(0) /* Unicode only */
+
+STRINGTABLE LANGUAGE LANG_ARMENIAN, SUBLANG_DEFAULT
+{
+ LOCALE_FONTSIGNATURE
L"\x042f\x8000\x3808\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x4000\x0013\x0000\x0000\xc5d4"
+ LOCALE_ICALENDARTYPE L"1"
+ LOCALE_ICENTURY L"1"
+ LOCALE_ICOUNTRY L"374"
+ LOCALE_ICURRDIGITS L"2"
+ LOCALE_ICURRENCY L"3"
+ LOCALE_IDATE L"1"
+ LOCALE_IDAYLZERO L"1"
+ LOCALE_IDEFAULTANSICODEPAGE L"0"
+ LOCALE_IDEFAULTCODEPAGE L"1"
+ LOCALE_IDEFAULTCOUNTRY L"374"
+ LOCALE_IDEFAULTEBCDICCODEPAGE L"500"
+ LOCALE_IDEFAULTLANGUAGE L"042b"
+ LOCALE_IDEFAULTMACCODEPAGE L"2"
+//FIXME LOCALE_IDEFAULTUNIXCODEPAGE L"65001"
+ LOCALE_IDIGITS L"2"
+ LOCALE_IDIGITSUBSTITUTION L"1"
+ LOCALE_IFIRSTDAYOFWEEK L"0"
+ LOCALE_IFIRSTWEEKOFYEAR L"0"
+ LOCALE_IINTLCURRDIGITS L"2"
+ LOCALE_ILANGUAGE L"042b"
+ LOCALE_ILDATE L"1"
+ LOCALE_ILZERO L"1"
+ LOCALE_IMEASURE L"0"
+ LOCALE_IMONLZERO L"1"
+ LOCALE_INEGCURR L"8"
+ LOCALE_INEGNUMBER L"1"
+ LOCALE_INEGSEPBYSPACE L"1"
+ LOCALE_INEGSIGNPOSN L"1"
+ LOCALE_INEGSYMPRECEDES L"0"
+ LOCALE_IOPTIONALCALENDAR L"0"
+ LOCALE_IPAPERSIZE L"9"
+ LOCALE_IPOSSEPBYSPACE L"1"
+ LOCALE_IPOSSIGNPOSN L"1"
+ LOCALE_IPOSSYMPRECEDES L"0"
+ LOCALE_ITIME L"1"
+ LOCALE_ITIMEMARKPOSN L"0"
+ LOCALE_ITLZERO L"0"
+ LOCALE_S1159 L""
+ LOCALE_S2359 L""
+ LOCALE_SABBREVCTRYNAME L"ARM"
+ LOCALE_SABBREVDAYNAME1 L"\x0535\x0580\x056f"
+ LOCALE_SABBREVDAYNAME2 L"\x0535\x0580\x0584"
+ LOCALE_SABBREVDAYNAME3 L"\x0549\x0580\x0584"
+ LOCALE_SABBREVDAYNAME4 L"\x0540\x0576\x0563"
+ LOCALE_SABBREVDAYNAME5 L"\x0548\x0552\x0580"
+ LOCALE_SABBREVDAYNAME6 L"\x0547\x0562\x0569"
+ LOCALE_SABBREVDAYNAME7 L"\x053f\x056b\x0580"
+ LOCALE_SABBREVLANGNAME L"HYE"
+ LOCALE_SABBREVMONTHNAME1 L"\x0540\x0546\x054e"
+ LOCALE_SABBREVMONTHNAME2 L"\x0553\x054f\x054e"
+ LOCALE_SABBREVMONTHNAME3 L"\x0544\x0550\x054f"
+ LOCALE_SABBREVMONTHNAME4 L"\x0531\x054a\x0550"
+ LOCALE_SABBREVMONTHNAME5 L"\x0544\x0545\x054d"
+ LOCALE_SABBREVMONTHNAME6 L"\x0540\x0546\x054d"
+ LOCALE_SABBREVMONTHNAME7 L"\x0540\x053c\x054d"
+ LOCALE_SABBREVMONTHNAME8 L"\x0555\x0533\x054d"
+ LOCALE_SABBREVMONTHNAME9 L"\x054d\x0535\x054a"
+ LOCALE_SABBREVMONTHNAME10 L"\x0540\x0548\x053f"
+ LOCALE_SABBREVMONTHNAME11 L"\x0546\x0548\x0545"
+ LOCALE_SABBREVMONTHNAME12 L"\x0534\x0535\x053f"
+ LOCALE_SABBREVMONTHNAME13 L""
+ LOCALE_SCOUNTRY L"Armenia"
+ LOCALE_SCURRENCY L"\x0564\x0580."
+ LOCALE_SDATE L"."
+ LOCALE_SDAYNAME1
L"\x0535\x0580\x056f\x0578\x0582\x0577\x0561\x0562\x0569\x056b"
+ LOCALE_SDAYNAME2 L"\x0535\x0580\x0565\x0584\x0577\x0561\x0562\x0569\x056b"
+ LOCALE_SDAYNAME3
L"\x0549\x0578\x0580\x0565\x0584\x0577\x0561\x0562\x0569\x056b"
+ LOCALE_SDAYNAME4 L"\x0540\x056b\x0576\x0563\x0577\x0561\x0562\x0569\x056b"
+ LOCALE_SDAYNAME5 L"\x0548\x0552\x0580\x0562\x0561\x0569"
+ LOCALE_SDAYNAME6 L"\x0547\x0561\x0562\x0561\x0569"
+ LOCALE_SDAYNAME7 L"\x053f\x056b\x0580\x0561\x056f\x056b"
+ LOCALE_SDECIMAL L"."
+ LOCALE_SENGCOUNTRY L"Armenia"
+ LOCALE_SENGCURRNAME L"Armenian Dram"
+ LOCALE_SENGLANGUAGE L"Armenian"
+ LOCALE_SGROUPING L"3;0"
+ LOCALE_SINTLSYMBOL L"AMD"
+ LOCALE_SISO3166CTRYNAME L"AM"
+ LOCALE_SISO639LANGNAME L"hy"
+ LOCALE_SLANGUAGE L"Armenian"
+ LOCALE_SLIST L","
+ LOCALE_SLONGDATE L"d MMMM, yyyy"
+ LOCALE_SMONDECIMALSEP L"."
+ LOCALE_SMONGROUPING L"3;0"
+ LOCALE_SMONTHNAME1 L"\x0540\x0578\x0582\x0576\x057e\x0561\x0580"
+ LOCALE_SMONTHNAME2 L"\x0553\x0565\x057f\x0580\x057e\x0561\x0580"
+ LOCALE_SMONTHNAME3 L"\x0544\x0561\x0580\x057f"
+ LOCALE_SMONTHNAME4 L"\x0531\x057a\x0580\x056b\x056c"
+ LOCALE_SMONTHNAME5 L"\x0544\x0561\x0575\x056b\x057d"
+ LOCALE_SMONTHNAME6 L"\x0540\x0578\x0582\x0576\x056b\x057d"
+ LOCALE_SMONTHNAME7 L"\x0540\x0578\x0582\x056c\x056b\x057d"
+ LOCALE_SMONTHNAME8 L"\x0555\x0563\x0578\x057d\x057f\x0578\x057d"
+ LOCALE_SMONTHNAME9 L"\x054d\x0565\x057a\x057f\x0565\x0574\x0562\x0565\x0580"
+ LOCALE_SMONTHNAME10
L"\x0540\x0578\x056f\x057f\x0565\x0574\x0562\x0565\x0580"
+ LOCALE_SMONTHNAME11 L"\x0546\x0578\x0575\x0565\x0574\x0562\x0565\x0580"
+ LOCALE_SMONTHNAME12
L"\x0534\x0565\x056f\x057f\x0565\x0574\x0562\x0565\x0580"
+ LOCALE_SMONTHNAME13 L""
+ LOCALE_SMONTHOUSANDSEP L","
+// LOCALE_SNAME L"hy-AM"
+ LOCALE_SNATIVECTRYNAME L"\x0540\x0561\x0575\x0561\x057d\x057f\x0561\x0576"
+ LOCALE_SNATIVECURRNAME L"\x0564\x0580\x0561\x0574"
+ LOCALE_SNATIVEDIGITS L"0123456789"
+ LOCALE_SNATIVELANGNAME L"\x0540\x0561\x0575\x0565\x0580\x0565\x0576"
+ LOCALE_SNEGATIVESIGN L"-"
+ LOCALE_SPOSITIVESIGN L""
+ LOCALE_SSHORTDATE L"dd.MM.yyyy"
+ LOCALE_SSORTNAME L"Default"
+ LOCALE_STHOUSAND L","
+ LOCALE_STIME L":"
+ LOCALE_STIMEFORMAT L"H:mm:ss"
+ LOCALE_SYEARMONTH L"MMMM, yyyy"
+
+ LGRPID_WESTERN_EUROPE+LGRPID_RES_BASE L"Western Europe and United States"
+ LGRPID_CENTRAL_EUROPE+LGRPID_RES_BASE L"Central Europe"
+ LGRPID_BALTIC+LGRPID_RES_BASE L"Baltic"
+ LGRPID_GREEK+LGRPID_RES_BASE L"Greek"
+ LGRPID_CYRILLIC+LGRPID_RES_BASE L"Cyrillic"
+ LGRPID_TURKISH+LGRPID_RES_BASE L"Turkic"
+ LGRPID_JAPANESE+LGRPID_RES_BASE L"Japanese"
+ LGRPID_KOREAN+LGRPID_RES_BASE L"Korean"
+ LGRPID_TRADITIONAL_CHINESE+LGRPID_RES_BASE L"Traditional Chinese"
+ LGRPID_SIMPLIFIED_CHINESE+LGRPID_RES_BASE L"Simplified Chinese"
+ LGRPID_THAI+LGRPID_RES_BASE L"Thai"
+ LGRPID_HEBREW+LGRPID_RES_BASE L"Hebrew"
+ LGRPID_ARABIC+LGRPID_RES_BASE L"Arabic"
+ LGRPID_VIETNAMESE+LGRPID_RES_BASE L"Vietnamese"
+ LGRPID_INDIC+LGRPID_RES_BASE L"Indic"
+ LGRPID_GEORGIAN+LGRPID_RES_BASE L"Georgian"
+ LGRPID_ARMENIAN+LGRPID_RES_BASE L"Armenian"
+}