[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Globalization Compare
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Globalization CompareInfo.cs,1.13,1.14 CultureInfo.cs,1.21,1.22 |
Date: |
Sun, 01 Jun 2003 05:29:28 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Globalization
In directory subversions:/tmp/cvs-serv31897/runtime/System/Globalization
Modified Files:
CompareInfo.cs CultureInfo.cs
Log Message:
Remove the culture name table from "mscorlib" because it is now in "I18N".
Index: CompareInfo.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Globalization/CompareInfo.cs,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** CompareInfo.cs 31 May 2003 05:47:41 -0000 1.13
--- CompareInfo.cs 1 Jun 2003 09:29:26 -0000 1.14
***************
*** 72,76 ****
}
#if CONFIG_REFLECTION
! return
GetCompareInfo(CultureInfo.MapNameToID(culture, true));
#else
return InvariantCompareInfo;
--- 72,76 ----
}
#if CONFIG_REFLECTION
! return (new CultureInfo(culture)).CompareInfo;
#else
return InvariantCompareInfo;
Index: CultureInfo.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Globalization/CultureInfo.cs,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** CultureInfo.cs 31 May 2003 05:47:41 -0000 1.21
--- CultureInfo.cs 1 Jun 2003 09:29:26 -0000 1.22
***************
*** 23,27 ****
using System;
- using System.Private;
using System.Runtime.CompilerServices;
using System.Text;
--- 23,26 ----
***************
*** 51,55 ****
private bool userOverride;
#if CONFIG_REFLECTION
- private CultureName cultureName;
private CultureInfo handler;
--- 50,53 ----
***************
*** 71,74 ****
--- 69,77 ----
public CultureInfo(int culture, bool useUserOverride)
{
+ if(culture < 0)
+ {
+ throw new ArgumentOutOfRangeException
+ ("culture",
_("ArgRange_NonNegative"));
+ }
if((culture & 0x40000000) != 0)
{
***************
*** 79,93 ****
return;
}
- if(culture < 0)
- {
- throw new ArgumentOutOfRangeException
- ("culture",
_("ArgRange_NonNegative"));
- }
#if CONFIG_REFLECTION
if(culture == TraditionalSpanish)
{
cultureID = culture;
- cultureName =
CultureNameTable.GetNameInfoByID
- (0x0C0A, true);
handler = GetCultureHandler(cultureID,
useUserOverride);
}
--- 82,89 ----
***************
*** 95,109 ****
{
cultureID = 0x007F;
- cultureName =
- new CultureName
- ("", 0x007F, "iv",
"IVL", "IVL",
- "Invariant Language
(Invariant Country)",
- "Invariant Language
(Invariant Country)");
}
else
{
cultureID = culture;
- cultureName =
CultureNameTable.GetNameInfoByID
- (culture, true);
handler = GetCultureHandler(cultureID,
useUserOverride);
}
--- 91,98 ----
***************
*** 120,127 ****
}
#if CONFIG_REFLECTION
- cultureName =
CultureNameTable.GetNameInfoByName(name, true);
- cultureID = cultureName.cultureID;
userOverride = useUserOverride;
! handler = GetCultureHandler(cultureID,
useUserOverride);
#else
cultureID = 0x007F;
--- 109,115 ----
}
#if CONFIG_REFLECTION
userOverride = useUserOverride;
! handler = GetCultureHandler(name,
useUserOverride);
! cultureID = handler.LCID;
#else
cultureID = 0x007F;
***************
*** 129,132 ****
--- 117,128 ----
#endif
}
+ #if CONFIG_REFLECTION
+ private CultureInfo(CultureInfo handler, bool useUserOverride)
+ {
+ this.handler = handler;
+ this.userOverride = useUserOverride;
+ this.cultureID = handler.LCID;
+ }
+ #endif
// Get the invariant culture object.
***************
*** 176,206 ****
gettingCurrent = true;
int id = InternalCultureID();
if(id <= 0)
{
! // Try getting the name
instead, in case this
// engine doesn't know
about culture ID's.
String name =
InternalCultureName();
! id = MapNameToID(name,
false);
! }
! if(id <= 0 ||
GetCultureHandler(id, true) == null)
! {
! // TODO: this is a
temporary hack - it must
! // be removed once
there are real culture
! // handlers in the I18N
assemblies.
! if(id == 0x007F || id
<= 0)
{
! currentCulture
= InvariantCulture;
}
else
{
! currentCulture
= new CultureInfo(id);
!
currentCulture.readOnly = true;
}
}
else
{
! currentCulture = new
CultureInfo(id);
! currentCulture.readOnly
= true;
}
gettingCurrent = false;
return currentCulture;
--- 172,207 ----
gettingCurrent = true;
int id = InternalCultureID();
+ CultureInfo handler;
if(id <= 0)
{
! // Try getting by name
instead, in case the
// engine doesn't know
about culture ID's.
String name =
InternalCultureName();
! if(name != null)
{
! handler =
GetCultureHandler(name, true);
}
else
{
! handler = null;
}
}
+ else if(id == 0x007F)
+ {
+ handler = null;
+ }
else
{
! handler =
GetCultureHandler(id, true);
}
+ if(handler == null)
+ {
+ // Could not find a
handler, so use invariant.
+ currentCulture =
InvariantCulture;
+ gettingCurrent = false;
+ return currentCulture;
+ }
+ currentCulture = new
CultureInfo(handler, true);
+ currentCulture.readOnly = true;
gettingCurrent = false;
return currentCulture;
***************
*** 413,417 ****
// We use the prevailing resources to
translate
// the english name into a display name.
! return _(cultureName.englishName);
}
}
--- 414,418 ----
// We use the prevailing resources to
translate
// the english name into a display name.
! return _(EnglishName);
}
}
***************
*** 422,426 ****
get
{
! return cultureName.englishName;
}
}
--- 423,431 ----
get
{
! if(handler != null)
! {
! return handler.EnglishName;
! }
! return "Invariant Language (Invariant
Country)";
}
}
***************
*** 449,453 ****
get
{
! return cultureName.name;
}
}
--- 454,462 ----
get
{
! if(handler != null)
! {
! return handler.Name;
! }
! return "";
}
}
***************
*** 458,462 ****
get
{
! return cultureName.nativeName;
}
}
--- 467,475 ----
get
{
! if(handler != null)
! {
! return handler.NativeName;
! }
! return "Invariant Language (Invariant
Country)";
}
}
***************
*** 614,618 ****
get
{
! return cultureName.threeLetterISOName;
}
}
--- 627,635 ----
get
{
! if(handler != null)
! {
! return
handler.ThreeLetterISOLanguageName;
! }
! return "IVL";
}
}
***************
*** 623,627 ****
get
{
! return
cultureName.threeLetterWindowsName;
}
}
--- 640,648 ----
get
{
! if(handler != null)
! {
! return
handler.ThreeLetterWindowsLanguageName;
! }
! return "IVL";
}
}
***************
*** 632,636 ****
get
{
! return cultureName.twoLetterISOName;
}
}
--- 653,661 ----
get
{
! if(handler != null)
! {
! return
handler.TwoLetterISOLanguageName;
! }
! return "iv";
}
}
***************
*** 700,718 ****
#if CONFIG_REFLECTION
- // Map a culture name to an identifier.
- internal static int MapNameToID(String name, bool throwOnError)
- {
- CultureName cultureName =
-
CultureNameTable.GetNameInfoByName(name, throwOnError);
- if(cultureName != null)
- {
- return cultureName.cultureID;
- }
- else
- {
- return 0;
- }
- }
-
// Get the culture handler for a specific culture.
internal static CultureInfo GetCultureHandler
--- 725,728 ----
***************
*** 727,730 ****
--- 737,747 ----
("GetCulture", culture &
0x03FF, useUserOverride);
}
+ return (CultureInfo)obj;
+ }
+ internal static CultureInfo GetCultureHandler
+ (String culture, bool useUserOverride)
+ {
+ Object obj = Encoding.InvokeI18N
+ ("GetCulture", culture,
useUserOverride);
return (CultureInfo)obj;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Globalization CompareInfo.cs,1.13,1.14 CultureInfo.cs,1.21,1.22,
Rhys Weatherley <address@hidden> <=