Expose missing Global/Encoding APIs in coreclr and remove empty stubs
authorTarek Mahmoud Sayed <tarekms@microsoft.com>
Tue, 30 Aug 2016 22:46:50 +0000 (15:46 -0700)
committerTarek Mahmoud Sayed <tarekms@microsoft.com>
Tue, 30 Aug 2016 22:46:50 +0000 (15:46 -0700)
This change is to expose all missing globalization and Encoding APIs in corelib
to have the complete exposed list for such namespaces.
Also we are removing the empty methods stubs for Windows implementation
And have the actual implementation in-place

Commit migrated from https://github.com/dotnet/coreclr/commit/a4c2d83f439caa7d9a79f4cbc692dc8c8a89f41e

15 files changed:
src/coreclr/clr.coreclr.props
src/coreclr/src/classlibnative/inc/nlsinfo.h
src/coreclr/src/classlibnative/nls/nlsinfo.cpp
src/coreclr/src/mscorlib/model.xml
src/coreclr/src/mscorlib/mscorlib.shared.sources.props
src/coreclr/src/mscorlib/ref/mscorlib.cs
src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.cs
src/coreclr/src/mscorlib/src/System/Globalization/CultureNotFoundException.cs
src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs
src/coreclr/src/mscorlib/src/System/Globalization/RegionInfo.cs
src/coreclr/src/mscorlib/src/System/Globalization/STUBS.cs [deleted file]
src/coreclr/src/mscorlib/src/System/Globalization/SortVersion.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/src/System/Globalization/TextInfo.cs
src/coreclr/src/mscorlib/src/System/Text/Normalization.cs
src/coreclr/src/vm/ecalllist.h

index d7f6421..f6ac42f 100644 (file)
@@ -32,7 +32,6 @@
     <FeatureMergeCultureSupportAndEngine>true</FeatureMergeCultureSupportAndEngine>
     <FeatureMergeJitAndEngine>true</FeatureMergeJitAndEngine>
     <FeatureMulticoreJIT>true</FeatureMulticoreJIT>
-    <FeatureNormIdnaOnly>true</FeatureNormIdnaOnly>
     <FeaturePrejit>true</FeaturePrejit>
     <FeatureStandaloneSn>true</FeatureStandaloneSn>
     <FeatureStrongnameDelaySigningAllowed>true</FeatureStrongnameDelaySigningAllowed>
index 8f868a8..1c1ff01 100644 (file)
@@ -225,7 +225,7 @@ private:
     //  Definitions.
     //
 
-#ifndef FEATURE_CORECLR
+#ifndef FEATURE_COREFX_GLOBALIZATION
     // Normalization
     static HMODULE m_hNormalization;
     static PFN_NORMALIZATION_IS_NORMALIZED_STRING m_pfnNormalizationIsNormalizedStringFunc;
index da54a5b..864f998 100644 (file)
@@ -127,7 +127,7 @@ inline BOOL IsCustomCultureId(LCID lcid)
     return (lcid == LOCALE_CUSTOM_DEFAULT || lcid == LOCALE_CUSTOM_UNSPECIFIED);
 }
 
-#ifndef FEATURE_CORECLR
+#ifndef FEATURE_COREFX_GLOBALIZATION
 //
 // Normalization Implementation
 //
@@ -136,7 +136,7 @@ HMODULE COMNlsInfo::m_hNormalization = NULL;
 PFN_NORMALIZATION_IS_NORMALIZED_STRING COMNlsInfo::m_pfnNormalizationIsNormalizedStringFunc = NULL;
 PFN_NORMALIZATION_NORMALIZE_STRING COMNlsInfo::m_pfnNormalizationNormalizeStringFunc = NULL;
 PFN_NORMALIZATION_INIT_NORMALIZATION COMNlsInfo::m_pfnNormalizationInitNormalizationFunc = NULL;
-#endif
+#endif // FEATURE_COREFX_GLOBALIZATION
 
 #if FEATURE_CODEPAGES_FILE
 /*============================nativeCreateOpenFileMapping============================
@@ -2623,7 +2623,7 @@ FCIMPL0(CodePageDataItem *, COMNlsInfo::nativeGetCodePageTableDataPointer)
 FCIMPLEND
 
 
-#ifndef FEATURE_CORECLR
+#ifndef FEATURE_COREFX_GLOBALIZATION
 //
 // Normalization
 //
@@ -2722,12 +2722,15 @@ void QCALLTYPE COMNlsInfo::nativeNormalizationInitNormalization(int NormForm, BY
             if (!hNormalization)
                ThrowLastError();
         }
+#ifndef FEATURE_CORECLR
+        // in coreclr we should always find the normalization in kernel32 as it supports Win7 and up 
         else
         {
             HRESULT hr = g_pCLRRuntime->LoadLibrary(NORMALIZATION_DLL, &hNormalization);
             if (FAILED(hr))
                 ThrowHR(hr);
         }
+#endif // FEATURE_CORECLR
 
         _ASSERTE(hNormalization != NULL);
         m_hNormalization = hNormalization;
@@ -2767,7 +2770,7 @@ void QCALLTYPE COMNlsInfo::nativeNormalizationInitNormalization(int NormForm, BY
     END_QCALL;
 }
 
-#endif // FEATURE_CORECLR
+#endif // FEATURE_COREFX_GLOBALIZATION
 
 
 //
index 106408d..01ef3a7 100644 (file)
       <Member Name="Insert(System.Int32,System.String)" />
       <Member Name="Intern(System.String)" />
       <Member Name="IsInterned(System.String)" />
-<!--
       <Member Name="IsNormalized" />
       <Member Name="IsNormalized(System.Text.NormalizationForm)" />
--->
       <Member Name="IsNullOrEmpty(System.String)" />
       <Member Name="IsNullOrWhiteSpace(System.String)" />
       <Member Name="Join(System.String,System.Object[])" />
       <Member Name="LastIndexOfAny(System.Char[])" />
       <Member Name="LastIndexOfAny(System.Char[],System.Int32)" />
       <Member Name="LastIndexOfAny(System.Char[],System.Int32,System.Int32)" />
-<!--
       <Member Name="Normalize" />
       <Member Name="Normalize(System.Text.NormalizationForm)" />
--->
       <Member Name="op_Equality(System.String,System.String)" />
       <Member Name="op_Inequality(System.String,System.String)" />
       <Member Name="PadLeft(System.Int32)" />
       <Member Name="GetHashCode" />
       <Member MemberType="Property" Name="MaxCharCount" />
     </Type>
+    <Type Name="System.Text.EncoderExceptionFallbackBuffer">
+      <Member Name="#ctor" />
+      <Member Name="Fallback(System.Char,System.Char,System.Int32)" />
+      <Member Name="Fallback(System.Char,System.Int32)" />
+      <Member Name="get_Remaining" />
+      <Member Name="GetNextChar" />
+      <Member Name="MovePrevious" />
+      <Member MemberType="Property" Name="Remaining" />
+    </Type>
     <Type Name="System.Text.EncoderFallbackException">
       <Member Name="#ctor" />
       <Member Name="#ctor(System.String)" />
       <Member Name="GetPreamble" />
       <Member Name="GetString(System.Byte[])" />
       <Member Name="GetString(System.Byte[],System.Int32,System.Int32)" />
-<!--
       <Member Name="IsAlwaysNormalized" />
       <Member Name="IsAlwaysNormalized(System.Text.NormalizationForm)" />
-    -->
       <Member Status="ImplRoot" Name="OnDeserialized(System.Runtime.Serialization.StreamingContext)" />
       <Member Status="ImplRoot" Name="OnDeserializing(System.Runtime.Serialization.StreamingContext)" />
       <Member Status="ImplRoot" Name="OnSerializing(System.Runtime.Serialization.StreamingContext)" />
       <Member MemberType="Property" Name="UTF8" />
       <Member MemberType="Property" Name="WebName" />
     </Type>
+    <Type Name="System.Text.EncodingInfo">
+      <Member Name="Equals(System.Object)" />
+      <Member Name="get_CodePage" />
+      <Member Name="get_DisplayName" />
+      <Member Name="get_Name" />
+      <Member Name="GetEncoding" />
+      <Member Name="GetHashCode" />
+      <Member MemberType="Property" Name="CodePage" />
+      <Member MemberType="Property" Name="DisplayName" />
+      <Member MemberType="Property" Name="Name" />
+    </Type>
+    <Type Name="System.Text.NormalizationForm">
+      <Member MemberType="Field" Name="FormC" />
+      <Member MemberType="Field" Name="FormD" />
+      <Member MemberType="Field" Name="FormKC" />
+      <Member MemberType="Field" Name="FormKD" />
+      <Member MemberType="Field" Name="value__" />
+    </Type>
     <Type Name="System.Text.StringBuilder">
       <Member Name="#ctor" />
       <Member Name="#ctor(System.Int32)" />
       <Member Status="ImplRoot" Name="ReplaceBufferAnsiInternal(System.SByte*,System.Int32)" /> <!-- EE - il stubs -->
     </Type>
     <Type Name="System.Text.UnicodeEncoding">
+      <Member MemberType="Field" Name="CharSize" />
       <Member Name="#ctor" />
       <Member Name="#ctor(System.Boolean,System.Boolean)" />
       <Member Name="#ctor(System.Boolean,System.Boolean,System.Boolean)" />
index ba4c214..d7beb13 100644 (file)
     <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\DaylightTime.cs" />
   </ItemGroup>
   <ItemGroup Condition="'$(FeatureCoreFxGlobalization)' != 'true'">
-    <GlobalizationSources Condition="'$(FeatureCoreClr)'=='true'" Include="$(BclSourcesRoot)\System\Globalization\STUBS.cs" />
     <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\BidiCategory.cs" />
     <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\Calendar.cs" />
     <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\CalendarData.cs" />
     <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\KoreanCalendar.cs" />
     <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\RegionInfo.cs" />
     <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\SortKey.cs" />
+    <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\SortVersion.cs" />
     <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\StringInfo.cs" />
     <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\TaiwanCalendar.cs" />
     <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\TextElementEnumerator.cs" />
index dac7cba..b1ca4b8 100644 (file)
@@ -3206,6 +3206,9 @@ namespace System
         public static System.String Intern(System.String str) { throw null; }
         [System.Security.SecuritySafeCriticalAttribute]
         public static System.String IsInterned(System.String str) { throw null; }
+        public bool IsNormalized() { throw null; }
+        [System.Security.SecuritySafeCriticalAttribute]
+        public bool IsNormalized(System.Text.NormalizationForm normalizationForm) { throw null; }
         public static bool IsNullOrEmpty(System.String value) { throw null; }
         public static bool IsNullOrWhiteSpace(System.String value) { throw null; }
         [System.Runtime.InteropServices.ComVisibleAttribute(false)]
@@ -3233,6 +3236,9 @@ namespace System
         [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
         [System.Security.SecuritySafeCriticalAttribute]
         public int LastIndexOfAny(char[] anyOf, int startIndex, int count) { throw null; }
+        public System.String Normalize() { throw null; }
+        [System.Security.SecuritySafeCriticalAttribute]
+        public System.String Normalize(System.Text.NormalizationForm normalizationForm) { throw null; }
         public static bool operator ==(System.String a, System.String b) { throw null; }
         public static bool operator !=(System.String a, System.String b) { throw null; }
         public System.String PadLeft(int totalWidth) { throw null; }
@@ -12206,6 +12212,15 @@ namespace System.Text
         public override bool Equals(object value) { throw null; }
         public override int GetHashCode() { throw null; }
     }
+    public sealed partial class EncoderExceptionFallbackBuffer : System.Text.EncoderFallbackBuffer
+    {
+        public EncoderExceptionFallbackBuffer() { }
+        public override int Remaining { get { throw null; } }
+        public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index) { throw null; }
+        public override bool Fallback(char charUnknown, int index) { throw null; }
+        public override char GetNextChar() { throw null; }
+        public override bool MovePrevious() { throw null; }
+    }
     public abstract partial class EncoderFallback
     {
         protected EncoderFallback() { }
@@ -12338,12 +12353,20 @@ namespace System.Text
         public unsafe string GetString(byte* bytes, int byteCount) { throw null; }
         public virtual string GetString(byte[] bytes) { throw null; }
         public virtual string GetString(byte[] bytes, int index, int count) { throw null; }
+        [System.Runtime.InteropServices.ComVisibleAttribute(false)]
+        public bool IsAlwaysNormalized() { throw null; }
+        [System.Runtime.InteropServices.ComVisibleAttribute(false)]
+        public virtual bool IsAlwaysNormalized(System.Text.NormalizationForm form) { throw null; }
         public static void RegisterProvider(System.Text.EncodingProvider provider) { }
     }
     public sealed partial class EncodingInfo
     {
         internal EncodingInfo() { }
+        public int CodePage { get { throw null; } }
+        public string DisplayName { get { throw null; } }
+        public string Name { get { throw null; } }
         public override bool Equals(object value) { throw null; }
+        public System.Text.Encoding GetEncoding() { throw null; }
         public override int GetHashCode() { throw null; }
     }
     [System.Runtime.InteropServices.ComVisibleAttribute(true)]
@@ -12356,6 +12379,14 @@ namespace System.Text
         public virtual System.Text.Encoding GetEncoding(string name, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
     }
     [System.Runtime.InteropServices.ComVisibleAttribute(true)]
+    public enum NormalizationForm
+    {
+        FormC = 1,
+        FormD = 2,
+        FormKC = 5,
+        FormKD = 6,
+    }
+    [System.Runtime.InteropServices.ComVisibleAttribute(true)]
     public sealed partial class StringBuilder
     {
         public StringBuilder() { }
@@ -12457,6 +12488,7 @@ namespace System.Text
     [System.Runtime.InteropServices.ComVisibleAttribute(true)]
     public partial class UnicodeEncoding : System.Text.Encoding
     {
+        public const int CharSize = 2;
         public UnicodeEncoding() { }
         public UnicodeEncoding(bool bigEndian, bool byteOrderMark) { }
         public UnicodeEncoding(bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) { }
index dd6867c..d620d2d 100644 (file)
@@ -581,7 +581,6 @@ namespace System.Globalization {
         // if we can't find a bigger name.  That doesn't help with things like "zh" though, so
         // the approach is of questionable value
         //
-#if !FEATURE_CORECLR
         public static CultureInfo CreateSpecificCulture(String name) {
             Contract.Ensures(Contract.Result<CultureInfo>() != null);
 
@@ -622,7 +621,6 @@ namespace System.Globalization {
 
             return (new CultureInfo(culture.m_cultureData.SSPECIFICCULTURE));
         }
-#endif // !FEATURE_CORECLR
 
         internal static bool VerifyCultureName(String cultureName, bool throwException) 
         {
@@ -988,7 +986,6 @@ namespace System.Globalization {
         }
 #endif
 
-#if !FEATURE_CORECLR
         public static CultureInfo[] GetCultures(CultureTypes types) {
             Contract.Ensures(Contract.Result<CultureInfo[]>() != null);
             // internally we treat UserCustomCultures as Supplementals but v2
@@ -999,7 +996,6 @@ namespace System.Globalization {
             }
             return (CultureData.GetCultures(types));
         }
-#endif
 
         ////////////////////////////////////////////////////////////////////////
         //
@@ -1124,7 +1120,6 @@ namespace System.Globalization {
             }
         }
 
-#if !FEATURE_CORECLR
         // ie: eng
         public virtual String ThreeLetterISOLanguageName {
             [System.Security.SecuritySafeCritical]  // auto-generated
@@ -1149,7 +1144,6 @@ namespace System.Globalization {
                 return (this.m_cultureData.SABBREVLANGNAME);
             }
         }
-#endif
 
         ////////////////////////////////////////////////////////////////////////
         //
@@ -1901,7 +1895,6 @@ namespace System.Globalization {
         }
 
 
-#if !FEATURE_CORECLR
         // This function is deprecated, we don't like it
         public static CultureInfo GetCultureInfoByIetfLanguageTag(string name)
         {
@@ -1929,7 +1922,7 @@ namespace System.Globalization {
             
             return ci;
         }
-#endif
+
         private static volatile bool s_isTaiwanSku;
         private static volatile bool s_haveIsTaiwanSku;
         internal static bool IsTaiwanSku
index 3db110f..0486cc9 100644 (file)
@@ -15,9 +15,7 @@ namespace System.Globalization {
     public partial class CultureNotFoundException : ArgumentException, ISerializable
     {
         private string          m_invalidCultureName; // unrecognized culture name
-#if !FEATURE_CORECLR
         private Nullable<int>   m_invalidCultureId;   // unrecognized culture Lcid
-#endif //!FEATURE_CORECLR
 
         public CultureNotFoundException()
             : base(DefaultMessage)
@@ -38,7 +36,7 @@ namespace System.Globalization {
             : base(message, innerException)
         {
         }
-#if !FEATURE_CORECLR
+
         public CultureNotFoundException(String paramName, int invalidCultureId, String message)
             : base(message, paramName)
         {
@@ -50,7 +48,6 @@ namespace System.Globalization {
         {
             m_invalidCultureId = invalidCultureId;
         }
-#endif //!FEATURE_CORECLR
 
         public CultureNotFoundException(String paramName, string invalidCultureName, String message)
             : base(message, paramName)
@@ -65,9 +62,7 @@ namespace System.Globalization {
         }
 
         protected CultureNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) {
-#if !FEATURE_CORECLR
             m_invalidCultureId      = (Nullable<int>) info.GetValue("InvalidCultureId", typeof(Nullable<int>));
-#endif //!FEATURE_CORECLR
             m_invalidCultureName    = (string) info.GetValue("InvalidCultureName", typeof(string));
         }
 
@@ -79,18 +74,14 @@ namespace System.Globalization {
             Contract.EndContractBlock();
             base.GetObjectData(info, context);
             Nullable<int> invalidCultureId = null;
-#if !FEATURE_CORECLR
             invalidCultureId = m_invalidCultureId;
-#endif //!FEATURE_CORECLR
             info.AddValue("InvalidCultureId", invalidCultureId, typeof(Nullable<int>));
             info.AddValue("InvalidCultureName", m_invalidCultureName, typeof(string));
         }
-#if !FEATURE_CORECLR
         public virtual Nullable<int> InvalidCultureId
         {
             get { return m_invalidCultureId; }
         }
-#endif //!FEATURE_CORECLR
 
         public virtual string InvalidCultureName
         {
@@ -109,13 +100,11 @@ namespace System.Globalization {
         {
             get
             {
-#if !FEATURE_CORECLR
                 if (InvalidCultureId != null)
                 {
                     return String.Format(CultureInfo.InvariantCulture,
                                         "{0} (0x{0:x4})", (int)InvalidCultureId);
                 }
-#endif //!FEATURE_CORECLR
                 return InvalidCultureName;
             }
         }
@@ -126,9 +115,7 @@ namespace System.Globalization {
             {
                 String s = base.Message;
                 if (
-#if !FEATURE_CORECLR
                     m_invalidCultureId != null || 
-#endif //!FEATURE_CORECLR
                     m_invalidCultureName != null) 
                 {
                     String valueMessage = Environment.GetResourceString("Argument_CultureInvalidIdentifier", FormatedInvalidCultureId);
index 7c95e87..00c2d1f 100644 (file)
@@ -353,7 +353,6 @@ namespace System.Globalization {
 #endif
         private void InitializeOverridableProperties(CultureData cultureData, int calendarID)
         {
-#if !FEATURE_CORECLR
             // Silverlight 2.0 never took a snapshot of the user's overridable properties
             // This has a substantial performance impact so skip when CoreCLR
             Contract.Requires(cultureData != null);
@@ -381,7 +380,6 @@ namespace System.Globalization {
 
             this.allYearMonthPatterns = cultureData.YearMonths(calendarID);
             Contract.Assert(this.allYearMonthPatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some year month patterns");
-#endif
         }
 
 #region Serialization
@@ -390,7 +388,6 @@ namespace System.Globalization {
         private int    CultureID;
         [OptionalField(VersionAdded = 1)]
         private bool   m_useUserOverride;
-#if !FEATURE_CORECLR
         [OptionalField(VersionAdded = 1)]
         private bool bUseCalendarInfo;
         [OptionalField(VersionAdded = 1)]
@@ -399,7 +396,6 @@ namespace System.Globalization {
         internal bool m_isDefaultCalendar;                // NEVER USED, DO NOT USE THIS! (Serialized in Whidbey)
         [OptionalField(VersionAdded = 2)]
         private static volatile Hashtable s_calendarNativeNames;   // NEVER USED, DO NOT USE THIS! (Serialized in Whidbey)
-#endif // !FEATURE_CORECLR
 
         // This was synthesized by Whidbey so we knew what words might appear in the middle of a date string
         // Now we always synthesize so its not helpful
@@ -860,15 +856,12 @@ namespace System.Globalization {
                 return (this.dateSeparator);
             }
 
-#if FEATURE_CORECLR
-            set { throw new NotImplementedException(); }
-#endif
-
-#if !FEATURE_CORECLR
-            set {
+            set 
+            {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
-                if (value == null) {
+                if (value == null) 
+                {
                     throw new ArgumentNullException("value",
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
@@ -876,7 +869,6 @@ namespace System.Globalization {
                 ClearTokenHashTable();
                 this.dateSeparator = value;
             }
-#endif
         }
 
 
@@ -1310,15 +1302,12 @@ namespace System.Globalization {
                 return (timeSeparator);
             }
 
-#if FEATURE_CORECLR
-            set { throw new NotImplementedException(); }
-#endif
-
-#if !FEATURE_CORECLR
-            set {
+            set 
+            {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
-                if (value == null) {
+                if (value == null) 
+                {
                     throw new ArgumentNullException("value",
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
@@ -1327,7 +1316,6 @@ namespace System.Globalization {
 
                 timeSeparator = value;
             }
-#endif
         }
 
 
index 6a6d36a..f06d63f 100644 (file)
@@ -458,7 +458,6 @@ namespace System.Globalization {
         }
 
 
-#if !FEATURE_CORECLR
         ////////////////////////////////////////////////////////////////////////
         //
         //  ThreeLetterISORegionName
@@ -490,7 +489,6 @@ namespace System.Globalization {
                 return (this.m_cultureData.SABBREVCTRYNAME);
             }
         }
-#endif
 
         ////////////////////////////////////////////////////////////////////////
         //
diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/STUBS.cs b/src/coreclr/src/mscorlib/src/System/Globalization/STUBS.cs
deleted file mode 100644 (file)
index d8aa1f0..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-namespace System.Globalization
-{
-    public partial class CultureInfo : System.ICloneable, System.IFormatProvider
-    {
-        public virtual string ThreeLetterISOLanguageName { get { throw new NotImplementedException(); } }
-        public virtual string ThreeLetterWindowsLanguageName { get { throw new NotImplementedException(); } }
-        public static System.Globalization.CultureInfo CreateSpecificCulture(string name) { throw new NotImplementedException(); }
-        public static System.Globalization.CultureInfo GetCultureInfoByIetfLanguageTag(string name) { throw new NotImplementedException(); }
-        public static System.Globalization.CultureInfo[] GetCultures(System.Globalization.CultureTypes types) { throw new NotImplementedException(); }
-    }
-
-    public partial class CultureNotFoundException : System.ArgumentException, System.Runtime.Serialization.ISerializable
-    {
-        public CultureNotFoundException(string message, int invalidCultureId, System.Exception innerException) { throw new NotImplementedException(); }
-        public CultureNotFoundException(string paramName, int invalidCultureId, string message) { throw new NotImplementedException(); }
-        public virtual System.Nullable<int> InvalidCultureId { get { throw new NotImplementedException(); } }
-    }
-
-    /*public partial class DateTimeFormatInfo
-    {
-        Can't do partials here so implement the stub in the main class
-        public String DateSeparator { set { throw null; } }
-        public String TimeSeparator { set { throw null; } }
-    }*/
-
-    public partial class RegionInfo
-    {
-        public virtual string ThreeLetterISORegionName { get { throw new NotImplementedException(); } }
-        public virtual string ThreeLetterWindowsRegionName { get { throw new NotImplementedException(); } }
-    }
-
-    public partial class SortKey
-    {
-        internal SortKey() { throw new NotImplementedException(); }
-    }
-
-    public sealed partial class SortVersion : System.IEquatable<System.Globalization.SortVersion>
-    {
-        public SortVersion(int fullVersion, System.Guid sortId) { throw new NotImplementedException(); }
-        public int FullVersion { get { throw new NotImplementedException(); } }
-        public System.Guid SortId { get { throw new NotImplementedException(); } }
-        public bool Equals(System.Globalization.SortVersion other) { throw new NotImplementedException(); }
-        public override bool Equals(object obj) { throw new NotImplementedException(); }
-        public override int GetHashCode() { throw new NotImplementedException(); }
-        public static bool operator ==(System.Globalization.SortVersion left, System.Globalization.SortVersion right) { throw new NotImplementedException(); }
-        public static bool operator !=(System.Globalization.SortVersion left, System.Globalization.SortVersion right) { throw new NotImplementedException(); }
-    }
-
-    public partial class TextInfo : System.ICloneable, System.Runtime.Serialization.IDeserializationCallback 
-    {
-        public virtual int ANSICodePage { get { throw new NotImplementedException(); } }
-        public virtual int EBCDICCodePage { get { throw new NotImplementedException(); } }
-        [System.Runtime.InteropServices.ComVisibleAttribute(false)]
-        public virtual int MacCodePage { get { throw new NotImplementedException(); } }
-        public virtual int OEMCodePage { get { throw new NotImplementedException(); } }
-        public string ToTitleCase(string str) { throw new NotImplementedException(); }
-    }
-}
\ No newline at end of file
diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/SortVersion.cs b/src/coreclr/src/mscorlib/src/System/Globalization/SortVersion.cs
new file mode 100644 (file)
index 0000000..24fe854
--- /dev/null
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Globalization 
+{
+    using System;
+    using System.Diagnostics.Contracts;
+
+    [Serializable]
+    public sealed class SortVersion : IEquatable<SortVersion> 
+    {
+        private int m_NlsVersion;
+        private Guid m_SortId;
+
+        public int FullVersion 
+        {
+            get 
+            {
+                return m_NlsVersion;
+            }
+        }
+
+        public Guid SortId 
+        {
+            get 
+            {
+                return m_SortId;
+            }
+        }
+
+        public SortVersion(int fullVersion, Guid sortId) 
+        {           
+            m_SortId = sortId;
+            m_NlsVersion = fullVersion;
+        }
+
+        internal SortVersion(int nlsVersion, int effectiveId, Guid customVersion) 
+        {
+            m_NlsVersion = nlsVersion;
+
+            if (customVersion == Guid.Empty) 
+            {
+                byte[] b = BitConverter.GetBytes(effectiveId);
+                byte b1 = (byte) ((uint) effectiveId >> 24);
+                byte b2 = (byte) ((effectiveId  & 0x00FF0000) >> 16);
+                byte b3 = (byte) ((effectiveId  & 0x0000FF00) >> 8);
+                byte b4 = (byte) (effectiveId  & 0xFF);
+                customVersion = new Guid(0,0,0,0,0,0,0,b1,b2,b3,b4);
+            }
+
+            m_SortId = customVersion;
+        }
+
+        public override bool Equals(object obj) 
+        {
+            SortVersion n = obj as SortVersion;
+            if(n != null) 
+            {
+                return this.Equals(n);
+            }
+
+            return false;
+        }
+
+        public bool Equals(SortVersion other) 
+        {
+            if (other == null) 
+            {
+                return false;
+            }
+
+            return m_NlsVersion == other.m_NlsVersion && m_SortId == other.m_SortId;
+        }
+
+        public override int GetHashCode() 
+        { 
+            return m_NlsVersion * 7 | m_SortId.GetHashCode(); 
+        }
+
+        public static bool operator ==(SortVersion left, SortVersion right) 
+        {
+            if (((object) left) != null) 
+            {
+                return left.Equals(right);
+            }
+
+            if (((object) right) != null) 
+            {
+                return right.Equals(left);
+            }
+
+            // Both null.
+            return true;
+        }
+
+        public static bool operator !=(SortVersion left, SortVersion right) 
+        {
+            return !(left == right);
+        }
+    }
+}
\ No newline at end of file
index ccdeef0..97e50f0 100644 (file)
@@ -346,35 +346,40 @@ namespace System.Globalization {
         ////////////////////////////////////////////////////////////////////////
 
 
-#if !FEATURE_CORECLR
-        public virtual int ANSICodePage {
-            get {
+        public virtual int ANSICodePage 
+        {
+            get 
+            {
                 return (this.m_cultureData.IDEFAULTANSICODEPAGE);
             }
         }
 
  
-        public virtual int OEMCodePage {
-            get {
+        public virtual int OEMCodePage 
+        {
+            get 
+            {
                 return (this.m_cultureData.IDEFAULTOEMCODEPAGE);
             }
         }
 
 
-        public virtual int MacCodePage {
-            get {
+        public virtual int MacCodePage 
+        {
+            get 
+            {
                 return (this.m_cultureData.IDEFAULTMACCODEPAGE);
             }
         }
 
 
-        public virtual int EBCDICCodePage {
-            get {
+        public virtual int EBCDICCodePage 
+        {
+            get 
+            {
                 return (this.m_cultureData.IDEFAULTEBCDICCODEPAGE);
             }
         }
-#endif
-
 
         ////////////////////////////////////////////////////////////////////////
         //
@@ -683,25 +688,29 @@ namespace System.Globalization {
         // titlecasing.  Windows 7 is expected to be the first release with this feature.  On the Macintosh side,
         // titlecasing is not available as of version 10.5 of the operating system.
         //
-#if !FEATURE_CORECLR
-        public unsafe String ToTitleCase(String str) {
-            if (str==null)  {
+        public unsafe String ToTitleCase(String str) 
+        {
+            if (str == null)  
+            {
                 throw new ArgumentNullException("str");
             }
             Contract.EndContractBlock();
-            if (str.Length == 0) {
+            if (str.Length == 0) 
+            {
                 return (str);
             }
 
             StringBuilder result = new StringBuilder();
             String lowercaseData = null;
 
-            for (int i = 0; i < str.Length; i++) {
+            for (int i = 0; i < str.Length; i++) 
+            {
                 UnicodeCategory charType;
                 int charLen;
 
                 charType = CharUnicodeInfo.InternalGetUnicodeCategory(str, i, out charLen);
-                if (Char.CheckLetter(charType)) {
+                if (Char.CheckLetter(charType)) 
+                {
                     // Do the titlecasing for the first character of the word.
                     i = AddTitlecaseLetter(ref result, ref str, i, charLen) + 1;
                      
@@ -717,30 +726,43 @@ namespace System.Globalization {
                     //
                     bool hasLowerCase = (charType == UnicodeCategory.LowercaseLetter);
                     // Use a loop to find all of the other letters following this letter.
-                    while (i < str.Length) {
+                    while (i < str.Length) 
+                    {
                         charType = CharUnicodeInfo.InternalGetUnicodeCategory(str, i, out charLen);
-                        if (IsLetterCategory(charType)) {
-                            if (charType == UnicodeCategory.LowercaseLetter) {
+                        if (IsLetterCategory(charType)) 
+                        {
+                            if (charType == UnicodeCategory.LowercaseLetter) 
+                            {
                                 hasLowerCase = true;
                             }
                             i += charLen;
-                        } else if (str[i] == '\'') {
+                        } 
+                        else if (str[i] == '\'') 
+                        {
                             i++;
-                            if (hasLowerCase) {
-                                if (lowercaseData==null) {
+                            if (hasLowerCase) 
+                            {
+                                if (lowercaseData == null) 
+                                {
                                     lowercaseData = this.ToLower(str);
                                 }
                                 result.Append(lowercaseData, lowercaseStart, i - lowercaseStart);
-                            } else {
+                            } 
+                            else 
+                            {
                                 result.Append(str, lowercaseStart, i - lowercaseStart);
                             }
                             lowercaseStart = i;
                             hasLowerCase = true;
-                        } else if (!IsWordSeparator(charType)) {
+                        } 
+                        else if (!IsWordSeparator(charType)) 
+                        {
                             // This category is considered to be part of the word.
                             // This is any category that is marked as false in wordSeprator array.
                             i+= charLen;
-                        } else {
+                        } 
+                        else 
+                        {
                             // A word separator. Break out of the loop.
                             break;
                         }
@@ -748,23 +770,30 @@ namespace System.Globalization {
 
                     int count = i - lowercaseStart;
 
-                    if (count>0) {
-                        if (hasLowerCase) {
-                            if (lowercaseData==null) {
+                    if (count>0) 
+                    {
+                        if (hasLowerCase) 
+                        {
+                            if (lowercaseData == null) 
+                            {
                                 lowercaseData = this.ToLower(str);
                             }
                             result.Append(lowercaseData, lowercaseStart, count);
-                        } else {
+                        } 
+                        else 
+                        {
                             result.Append(str, lowercaseStart, count);
                         }
                     }
 
-                    if (i < str.Length) {
+                    if (i < str.Length) 
+                    {
                         // not a letter, just append it
                         i = AddNonLetter(ref result, ref str, i, charLen);
                     }
                 }
-                else {
+                else 
+                {
                     // not a letter, just append it
                     i = AddNonLetter(ref result, ref str, i, charLen);
                 }
@@ -772,31 +801,38 @@ namespace System.Globalization {
             return (result.ToString());
         }
 
-        private static int AddNonLetter(ref StringBuilder result, ref String input, int inputIndex, int charLen) {
+        private static int AddNonLetter(ref StringBuilder result, ref String input, int inputIndex, int charLen) 
+        {
             Contract.Assert(charLen == 1 || charLen == 2, "[TextInfo.AddNonLetter] CharUnicodeInfo.InternalGetUnicodeCategory returned an unexpected charLen!");
-            if (charLen == 2) {
+            if (charLen == 2) 
+            {
                 // Surrogate pair
                 result.Append(input[inputIndex++]);
                 result.Append(input[inputIndex]);
             }
-            else {
+            else 
+            {
                 result.Append(input[inputIndex]);
             }                   
             return inputIndex;
         }
 
 
-        private int AddTitlecaseLetter(ref StringBuilder result, ref String input, int inputIndex, int charLen) {
+        private int AddTitlecaseLetter(ref StringBuilder result, ref String input, int inputIndex, int charLen) 
+        {
             Contract.Assert(charLen == 1 || charLen == 2, "[TextInfo.AddTitlecaseLetter] CharUnicodeInfo.InternalGetUnicodeCategory returned an unexpected charLen!");
 
             // for surrogate pairs do a simple ToUpper operation on the substring
-            if (charLen == 2) {
+            if (charLen == 2) 
+            {
                 // Surrogate pair
                 result.Append( this.ToUpper(input.Substring(inputIndex, charLen)) );
                 inputIndex++;
             }
-            else {
-                switch (input[inputIndex]) {
+            else 
+            {
+                switch (input[inputIndex]) 
+                {
                     //
                     // For AppCompat, the Titlecase Case Mapping data from NDP 2.0 is used below.
                     case (char)0x01C4:  // DZ with Caron -> Dz with Caron
@@ -865,19 +901,19 @@ namespace System.Globalization {
             /* true  */ (1 << 28) | // OtherSymbol = 28,
             /* false */ (0 << 29);  // OtherNotAssigned = 29;
 
-        private static bool IsWordSeparator(UnicodeCategory category) {
+        private static bool IsWordSeparator(UnicodeCategory category) 
+        {
             return (wordSeparatorMask & (1 << (int)category)) != 0;
         }
 
-        private static bool IsLetterCategory(UnicodeCategory uc) {
+        private static bool IsLetterCategory(UnicodeCategory uc) 
+        {
             return (uc == UnicodeCategory.UppercaseLetter
                  || uc == UnicodeCategory.LowercaseLetter
                  || uc == UnicodeCategory.TitlecaseLetter
                  || uc == UnicodeCategory.ModifierLetter
                  || uc == UnicodeCategory.OtherLetter);
         }
-#endif
-
 
         // IsRightToLeft
         //
index 2a9aa8c..ce3c0c8 100644 (file)
@@ -305,7 +305,7 @@ namespace System.Text
             return new String(cBuffer, 0, iLength);
         }
 
-#if !FEATURE_CORECLR
+#if !FEATURE_COREFX_GLOBALIZATION
         [System.Security.SecurityCritical]  // auto-generated
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         unsafe private static extern int nativeNormalizationNormalizeString(
index 2b04019..8d4164e 100644 (file)
@@ -369,13 +369,13 @@ FCFuncStart(gSafeBufferFuncs)
     FCFuncElement("StructureToPtrNative", SafeBuffer::StructureToPtr)
 FCFuncEnd()
 
-#ifndef FEATURE_CORECLR
+#ifndef FEATURE_COREFX_GLOBALIZATION
 FCFuncStart(gNormalizationFuncs)
     FCFuncElement("nativeNormalizationIsNormalizedString", COMNlsInfo::nativeNormalizationIsNormalizedString)
     FCFuncElement("nativeNormalizationNormalizeString", COMNlsInfo::nativeNormalizationNormalizeString)
     QCFuncElement("nativeNormalizationInitNormalization", COMNlsInfo::nativeNormalizationInitNormalization)
 FCFuncEnd()
-#endif // FEATURE_CORECLR
+#endif // FEATURE_COREFX_GLOBALIZATION
 
 FCFuncStart(gTypedReferenceFuncs)
     FCFuncElement("InternalToObject", ReflectionInvocation::TypedReferenceToObject)
@@ -2280,9 +2280,9 @@ FCClassElement("MngdSafeArrayMarshaler", "System.StubHelpers", gMngdSafeArrayMar
 FCClassElement("ModuleBuilder", "System.Reflection.Emit", gCOMModuleBuilderFuncs)
 FCClassElement("ModuleHandle", "System", gCOMModuleHandleFuncs)
 FCClassElement("Monitor", "System.Threading", gMonitorFuncs)
-#ifndef FEATURE_CORECLR
+#ifndef FEATURE_COREFX_GLOBALIZATION
 FCClassElement("Normalization", "System.Text", gNormalizationFuncs)
-#endif // FEATURE_CORECLR
+#endif // FEATURE_COREFX_GLOBALIZATION
 FCClassElement("Number", "System", gNumberFuncs)
 #ifdef FEATURE_COMINTEROP
 FCClassElement("OAVariantLib", "Microsoft.Win32", gOAVariantFuncs)