Skip to content

Commit

Permalink
Synchronize src\mscorlib\corefx with the CoreRT fork (dotnet/coreclr#…
Browse files Browse the repository at this point in the history
…8619)

Commit migrated from dotnet/coreclr@1242b3e
  • Loading branch information
jkotas authored and tarekgh committed Dec 13, 2016
1 parent e870a96 commit 395d049
Show file tree
Hide file tree
Showing 28 changed files with 459 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Runtime.CompilerServices;
using System.Globalization;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Runtime.Serialization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Collections.Generic;

namespace System.Globalization
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Diagnostics;
using System.Diagnostics.Contracts;

namespace System.Globalization
{
Expand Down Expand Up @@ -127,7 +125,7 @@ private static double NormalizeLongitude(double longitude)
return longitude;
}

static public double AsDayFraction(double longitude)
public static double AsDayFraction(double longitude)
{
return longitude / FullCircleOfArc;
}
Expand Down Expand Up @@ -221,7 +219,7 @@ private static double EphemerisCorrection(double time)
return DefaultEphemerisCorrection(year);
}

static public double JulianCenturies(double moment)
public static double JulianCenturies(double moment)
{
double dynamicalMoment = moment + EphemerisCorrection(moment);
return (dynamicalMoment - Noon2000Jan01) / DaysInUniformLengthCentury;
Expand Down Expand Up @@ -275,7 +273,7 @@ private static double AsLocalTime(double apparentMidday, double longitude)
}

// midday
static public double Midday(double date, double longitude)
public static double Midday(double date, double longitude)
{
return AsLocalTime(date + TwelveHours, longitude) - AsDayFraction(longitude);
}
Expand All @@ -286,7 +284,7 @@ private static double InitLongitude(double longitude)
}

// midday-in-tehran
static public double MiddayAtPersianObservationSite(double date)
public static double MiddayAtPersianObservationSite(double date)
{
return Midday(date, InitLongitude(52.5)); // 52.5 degrees east - longitude of UTC+3:30 which defines Iranian Standard Time
}
Expand Down Expand Up @@ -363,7 +361,7 @@ private static double Nutation(double julianCenturies)
return (-0.004778 * SinOfDegree(a)) - (0.0003667 * SinOfDegree(b));
}

static public double Compute(double time)
public static double Compute(double time)
{
double julianCenturies = JulianCenturies(time);
double lambda = 282.7771834
Expand All @@ -374,7 +372,7 @@ static public double Compute(double time)
return InitLongitude(longitude);
}

static public double AsSeason(double longitude)
public static double AsSeason(double longitude)
{
return (longitude < 0) ? (longitude + FullCircleOfArc) : longitude;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
//
////////////////////////////////////////////////////////////////////////////

using System;
using System.Threading;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Reflection;
using System.Security;
using System.Diagnostics;
using System.Diagnostics.Contracts;

Expand Down Expand Up @@ -171,7 +165,7 @@ internal static bool IsWhiteSpace(char c)
//
// Note that for ch in the range D800-DFFF we just treat it as any other non-numeric character
//
internal unsafe static double InternalGetNumericValue(int ch)
internal static unsafe double InternalGetNumericValue(int ch)
{
Debug.Assert(ch >= 0 && ch <= 0x10ffff, "ch is not in valid Unicode range.");
// Get the level 2 item from the highest 12 bit (8 - 19) of ch.
Expand All @@ -192,7 +186,7 @@ internal unsafe static double InternalGetNumericValue(int ch)
}
}

internal unsafe static ushort InternalGetDigitValues(int ch)
internal static unsafe ushort InternalGetDigitValues(int ch)
{
Debug.Assert(ch >= 0 && ch <= 0x10ffff, "ch is not in valid Unicode range.");
// Get the level 2 item from the highest 12 bit (8 - 19) of ch.
Expand Down Expand Up @@ -303,7 +297,7 @@ public static UnicodeCategory GetUnicodeCategory(String s, int index)
return InternalGetUnicodeCategory(s, index);
}

internal unsafe static UnicodeCategory InternalGetUnicodeCategory(int ch)
internal static unsafe UnicodeCategory InternalGetUnicodeCategory(int ch)
{
return ((UnicodeCategory)InternalGetCategoryValue(ch, UNICODE_CATEGORY_OFFSET));
}
Expand All @@ -323,7 +317,7 @@ internal unsafe static UnicodeCategory InternalGetUnicodeCategory(int ch)
//
////////////////////////////////////////////////////////////////////////

internal unsafe static byte InternalGetCategoryValue(int ch, int offset)
internal static unsafe byte InternalGetCategoryValue(int ch, int offset)
{
Debug.Assert(ch >= 0 && ch <= 0x10ffff, "ch is not in valid Unicode range.");
// Get the level 2 item from the highest 12 bit (8 - 19) of ch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,10 @@ private static unsafe int FastIndexOfString(string source, string target, int st

int sourceStartIndex = findLastIndex ? startIndex - sourceCount + 1 : startIndex;

#if !TEST_CODEGEN_OPTIMIZATION
fixed (char* pSource = source, spTarget = target)
{
char* spSubSource = pSource + sourceStartIndex;
#else
String.StringPointer spSubSource = source.GetStringPointer(sourceStartIndex);
String.StringPointer spTarget = target.GetStringPointer();
#endif

if (findLastIndex)
{
int startPattern = (sourceCount - 1) - targetCount + 1;
Expand Down Expand Up @@ -348,11 +344,9 @@ private static unsafe int FastIndexOfString(string source, string target, int st
retValue += startIndex;
}
}
#if !TEST_CODEGEN_OPTIMIZATION
}

return retValue;
#endif // TEST_CODEGEN_OPTIMIZATION
}

private unsafe SortKey CreateSortKey(String source, CompareOptions options)
Expand All @@ -362,13 +356,13 @@ private unsafe SortKey CreateSortKey(String source, CompareOptions options)

if ((options & ValidSortkeyCtorMaskOffFlags) != 0)
{
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), nameof(options));
throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
}

throw new NotImplementedException();
}

private unsafe static bool IsSortable(char *text, int length)
private static unsafe bool IsSortable(char *text, int length)
{
// CompareInfo c = CultureInfo.InvariantCulture.CompareInfo;
// return (InternalIsSortable(c.m_dataHandle, c.m_handleOrigin, c.m_sortName, text, text.Length));
Expand Down Expand Up @@ -412,7 +406,7 @@ private static int GetNativeCompareFlags(CompareOptions options)

return nativeCompareFlags;
}

private SortVersion GetSortVersion()
{
throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@
//
////////////////////////////////////////////////////////////////////////////

using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Threading;

namespace System.Globalization
{
Expand Down Expand Up @@ -174,13 +168,13 @@ public static CompareInfo GetCompareInfo(String name)
return CultureInfo.GetCultureInfo(name).CompareInfo;
}

public unsafe static bool IsSortable(char ch)
public static unsafe bool IsSortable(char ch)
{
char *pChar = &ch;
return IsSortable(pChar, 1);
}

public unsafe static bool IsSortable(string text)
public static unsafe bool IsSortable(string text)
{
if (text == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
using System.Text;

#if ENABLE_WINRT
using Internal.Runtime.Augments;
#endif

namespace System.Globalization
{
Expand Down Expand Up @@ -265,19 +267,57 @@ private static CultureData GetCultureDataFromRegionName(String regionName)
return null;
}

private static string GetLanguageDisplayName(string cultureName)
private string GetLanguageDisplayName(string cultureName)
{
#if ENABLE_WINRT
return WinRTInterop.Callbacks.GetLanguageDisplayName(cultureName);
#else
// Usually the UI culture shouldn't be different than what we got from WinRT except
// if DefaultThreadCurrentUICulture was set
CultureInfo ci;

if (CultureInfo.DefaultThreadCurrentUICulture != null &&
((ci = GetUserDefaultCulture()) != null) &&
!CultureInfo.DefaultThreadCurrentUICulture.Name.Equals(ci.Name))
{
return SNATIVEDISPLAYNAME;
}
else
{
return GetLocaleInfo(cultureName, LocaleStringData.LocalizedDisplayName);
}
#endif // ENABLE_WINRT
}

private static string GetRegionDisplayName(string isoCountryCode)
private string GetRegionDisplayName(string isoCountryCode)
{
#if ENABLE_WINRT
return WinRTInterop.Callbacks.GetRegionDisplayName(isoCountryCode);
#else
// Usually the UI culture shouldn't be different than what we got from WinRT except
// if DefaultThreadCurrentUICulture was set
CultureInfo ci;

if (CultureInfo.DefaultThreadCurrentUICulture != null &&
((ci = GetUserDefaultCulture()) != null) &&
!CultureInfo.DefaultThreadCurrentUICulture.Name.Equals(ci.Name))
{
return SNATIVECOUNTRY;
}
else
{
return GetLocaleInfo(LocaleStringData.LocalizedCountryName);
}
#endif // ENABLE_WINRT
}

private static CultureInfo GetUserDefaultCulture()
{
#if ENABLE_WINRT
return (CultureInfo)WinRTInterop.Callbacks.GetUserDefaultCulture();
#else
return CultureInfo.GetUserDefaultCulture();
#endif // ENABLE_WINRT
}

// PAL methods end here.
Expand Down Expand Up @@ -558,73 +598,73 @@ private static unsafe String[] nativeEnumTimeFormats(String localeName, uint dwF

return null;
}
private static int LocaleNameToLCID(string cultureName)

private int LocaleNameToLCID(string cultureName)
{
throw new NotImplementedException();
return GetLocaleInfo(LocaleNumberData.LanguageId);
}

private static string LCIDToLocaleName(int culture)
{
throw new NotImplementedException();
}
private static int GetAnsiCodePage(string cultureName)

private int GetAnsiCodePage(string cultureName)
{
throw new NotImplementedException();
return GetLocaleInfo(LocaleNumberData.AnsiCodePage);
}

private static int GetOemCodePage(string cultureName)
private int GetOemCodePage(string cultureName)
{
throw new NotImplementedException();
return GetLocaleInfo(LocaleNumberData.OemCodePage);
}

private static int GetMacCodePage(string cultureName)
private int GetMacCodePage(string cultureName)
{
throw new NotImplementedException();
return GetLocaleInfo(LocaleNumberData.MacCodePage);
}

private static int GetEbcdicCodePage(string cultureName)
private int GetEbcdicCodePage(string cultureName)
{
throw new NotImplementedException();
return GetLocaleInfo(LocaleNumberData.EbcdicCodePage);
}

private static int GetGeoId(string cultureName)
private int GetGeoId(string cultureName)
{
throw new NotImplementedException();
return GetLocaleInfo(LocaleNumberData.GeoId);
}
private static int GetDigitSubstitution(string cultureName)

private int GetDigitSubstitution(string cultureName)
{
throw new NotImplementedException();
return GetLocaleInfo(LocaleNumberData.DigitSubstitution);
}
private static string GetThreeLetterWindowsLanguageName(string cultureName)

private string GetThreeLetterWindowsLanguageName(string cultureName)
{
throw new NotImplementedException();
return GetLocaleInfo(cultureName, LocaleStringData.AbbreviatedWindowsLanguageName);
}

private static CultureInfo[] EnumCultures(CultureTypes types)
{
throw new NotImplementedException();
}

private static string GetConsoleFallbackName(string cultureName)
private string GetConsoleFallbackName(string cultureName)
{
throw new NotImplementedException();
return GetLocaleInfo(cultureName, LocaleStringData.ConsoleFallbackName);
}

private bool IsSupplementalCustomCulture
internal bool IsFramework
{
get { throw new NotImplementedException(); }
}
private bool IsWin32Installed

internal bool IsWin32Installed
{
get { throw new NotImplementedException(); }
}

private bool IsReplacementCulture
internal bool IsReplacementCulture
{
get { throw new NotImplementedException(); }
}
Expand Down
Loading

0 comments on commit 395d049

Please sign in to comment.