Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@ -29,7 +29,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if MONO_FEATURE_CONSOLE
using System.Text;
using System.Runtime.InteropServices;

View File

@ -31,7 +31,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if MONO_FEATURE_CONSOLE
using System;
using System.Text;

View File

@ -41,7 +41,7 @@ namespace System
{
public static partial class Console
{
#if !MOBILE
#if MONO_FEATURE_CONSOLE
private class WindowsConsole
{
public static bool ctrlHandlerAdded = false;
@ -96,14 +96,11 @@ namespace System
static Console ()
{
#if MONO_FEATURE_CONSOLE
if (Environment.IsRunningOnWindows) {
//
// On Windows, follow the Windows tradition
//
#if MOBILE
// should never happen since Moonlight does not run on windows
inputEncoding = outputEncoding = Encoding.Default;
#else
try {
inputEncoding = Encoding.GetEncoding (WindowsConsole.GetInputCodePage ());
outputEncoding = Encoding.GetEncoding (WindowsConsole.GetOutputCodePage ());
@ -113,8 +110,9 @@ namespace System
// Use Latin 1 as it is fast and UTF-8 is never used as console code page
inputEncoding = outputEncoding = Encoding.Default;
}
} else
#endif
} else {
{
//
// On Unix systems (128), do not output the
// UTF-8 ZWNBSP (zero-width non-breaking space).
@ -134,13 +132,13 @@ namespace System
static void SetupStreams (Encoding inputEncoding, Encoding outputEncoding)
{
#if !MOBILE
#if MONO_FEATURE_CONSOLE
if (!Environment.IsRunningOnWindows && ConsoleDriver.IsConsole) {
stdin = new CStreamReader (OpenStandardInput (0), inputEncoding);
stdout = TextWriter.Synchronized (new CStreamWriter (OpenStandardOutput (0), outputEncoding, true) { AutoFlush = true });
stderr = TextWriter.Synchronized (new CStreamWriter (OpenStandardError (0), outputEncoding, true) { AutoFlush = true });
} else
#endif
#endif
{
stdin = TextReader.Synchronized (new UnexceptionalStreamReader (OpenStandardInput (0), inputEncoding));
@ -487,8 +485,7 @@ namespace System
stdout.WriteLine (String.Format (format, args));
}
#if !MOBILE
#if MONO_FEATURE_CONSOLE
public static int Read ()
{
if ((stdin is CStreamReader) && ConsoleDriver.IsConsole) {
@ -516,7 +513,6 @@ namespace System
{
return stdin.ReadLine ();
}
#endif
// FIXME: Console should use these encodings when changed
@ -539,7 +535,7 @@ namespace System
}
}
#if !MOBILE
#if MONO_FEATURE_CONSOLE
public static ConsoleColor BackgroundColor {
get { return ConsoleDriver.BackgroundColor; }
set { ConsoleDriver.BackgroundColor = value; }

View File

@ -27,7 +27,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if MONO_FEATURE_CONSOLE
using System.IO;
using System.Runtime.CompilerServices;

View File

@ -48,16 +48,11 @@ namespace System {
public static partial class Environment {
/*
* This is the version number of the corlib-runtime interface. When
* making changes to this interface (by changing the layout
* of classes the runtime knows about, changing icall signature or
* semantics etc), increment this variable. Also increment the
* pair of this variable in the runtime in metadata/appdomain.c.
* Changes which are already detected at runtime, like the addition
* of icalls, do not require an increment.
* This is the version number of the corlib-runtime interface.
* It is defined in configure.ac.
*/
#pragma warning disable 169
private const int mono_corlib_version = 156;
private const int mono_corlib_version = Consts.MonoCorlibVersion;
#pragma warning restore 169
[ComVisible (true)]
@ -488,7 +483,7 @@ namespace System {
/// </summary>
public static string GetEnvironmentVariable (string variable)
{
#if !MOBILE
#if MONO_FEATURE_CAS
if (SecurityManager.SecurityEnabled) {
new EnvironmentPermission (EnvironmentPermissionAccess.Read, variable).Demand ();
}
@ -573,7 +568,7 @@ namespace System {
else
dir = UnixGetFolderPath (folder, option);
#if !MOBILE
#if MONO_FEATURE_CAS
if ((dir != null) && (dir.Length > 0) && SecurityManager.SecurityEnabled) {
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, dir).Demand ();
}
@ -1040,6 +1035,15 @@ namespace System {
// Do not include a trailing newline for backwards compatibility
return st.ToString( System.Diagnostics.StackTrace.TraceFormat.Normal );
}
// Copied from referencesource Environment
internal static bool IsWinRTSupported
{
get
{
return true;
}
}
}
}

View File

@ -26,7 +26,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if MONO_FEATURE_CONSOLE
using System.Runtime.InteropServices;
using System.Text;
namespace System {

View File

@ -33,7 +33,7 @@
// https://github.com/dotnet/corefx
// src/System.Console/src/System/ConsolePal.Unix.cs
//
#if !MOBILE
#if MONO_FEATURE_CONSOLE
//
// Defining this writes the output to console.log
@ -1556,22 +1556,52 @@ namespace System {
case 'O': // logical
int second = stack.Pop().Int32; // it's a stack... the second value was pushed last
int first = stack.Pop().Int32;
char c = format[pos];
stack.Push(
c == '+' ? (first + second) :
c == '-' ? (first - second) :
c == '*' ? (first * second) :
c == '/' ? (first / second) :
c == 'm' ? (first % second) :
c == '^' ? (first ^ second) :
c == '&' ? (first & second) :
c == '|' ? (first | second) :
c == '=' ? AsInt(first == second) :
c == '>' ? AsInt(first > second) :
c == '<' ? AsInt(first < second) :
c == 'A' ? AsInt(AsBool(first) && AsBool(second)) :
c == 'O' ? AsInt(AsBool(first) || AsBool(second)) :
0); // not possible; we just validated above
int res;
switch (format[pos]) {
case '+':
res = first + second;
break;
case '-':
res = first - second;
break;
case '*':
res = first * second;
break;
case '/':
res = first / second;
break;
case 'm':
res = first % second;
break;
case '^':
res = first ^ second;
break;
case '&':
res = first & second;
break;
case '|':
res = first | second;
break;
case '=':
res = AsInt(first == second);
break;
case '>':
res = AsInt(first > second);
break;
case '<':
res = AsInt(first < second);
break;
case 'A':
res = AsInt(AsBool(first) && AsBool(second));
break;
case 'O':
res = AsInt(AsBool(first) || AsBool(second));
break;
default:
res = 0;
break;
}
stack.Push(res);
break;
// Unary operations

View File

@ -27,7 +27,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if MONO_FEATURE_CONSOLE
// These values are taken from 'man 5 terminfo' and /usr/include/term.h.
// They are the indexes for the numeric capabilities in a terminfo file.

View File

@ -27,7 +27,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if MONO_FEATURE_CONSOLE
using System.IO;
using System.Text;
namespace System {

View File

@ -27,7 +27,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if MONO_FEATURE_CONSOLE
// These values are taken from 'man 5 terminfo' and /usr/include/term.h.
// They are the indexes for the string capabilities in a terminfo file.

View File

@ -553,11 +553,10 @@ namespace System {
return sign * (hour * 60) * 60;
}
static TimeZoneInfo defaultZone;
internal static TimeZoneInfo Local {
get {
var id = GetDefaultTimeZoneName ();
return defaultZone = GetTimeZone (id, id);
return GetTimeZone (id, id);
}
}

View File

@ -105,10 +105,10 @@ namespace System
try {
ret = readlink (path, buf, buf.Length);
} catch (DllNotFoundException e) {
} catch (DllNotFoundException) {
readlinkNotFound = true;
return null;
} catch (EntryPointNotFoundException e) {
} catch (EntryPointNotFoundException) {
readlinkNotFound = true;
return null;
}
@ -149,10 +149,10 @@ namespace System
return true;
}
#if !MOBILE || MOBILE_STATIC
#if !MONODROID && !MONOTOUCH && !XAMMAC
static TimeZoneInfo CreateLocal ()
{
#if !MOBILE_STATIC
#if !FULL_AOT_DESKTOP || WIN_PLATFORM
if (IsWindows && LocalZoneKey != null) {
string name = (string)LocalZoneKey.GetValue ("TimeZoneKeyName");
if (name == null)
@ -204,7 +204,7 @@ namespace System
static void GetSystemTimeZonesCore (List<TimeZoneInfo> systemTimeZones)
{
#if !MOBILE_STATIC
#if !FULL_AOT_DESKTOP || WIN_PLATFORM
if (TimeZoneKey != null) {
foreach (string id in TimeZoneKey.GetSubKeyNames ()) {
try {
@ -237,7 +237,7 @@ namespace System
throw new NotImplementedException ("This method is not implemented for this platform");
#endif
}
#endif
#endif // !MONODROID && !MONOTOUCH && !XAMMAC
string standardDisplayName;
public string StandardName {
@ -273,7 +273,7 @@ namespace System
#endif
private AdjustmentRule [] adjustmentRules;
#if !MOBILE || MOBILE_STATIC
#if !MOBILE || !FULL_AOT_DESKTOP || WIN_PLATFORM
/// <summary>
/// Determine whether windows of not (taken Stephane Delcroix's code)
/// </summary>
@ -301,7 +301,7 @@ namespace System
return str.Substring (Istart, Iend-Istart+1);
}
#if !MOBILE_STATIC
#if !FULL_AOT_DESKTOP || WIN_PLATFORM
static RegistryKey timeZoneKey;
static RegistryKey TimeZoneKey {
get {
@ -330,7 +330,7 @@ namespace System
}
}
#endif
#endif
#endif // !MOBILE || !FULL_AOT_DESKTOP || WIN_PLATFORM
private static bool TryAddTicks (DateTime date, long ticks, out DateTime result, DateTimeKind kind = DateTimeKind.Unspecified)
{
@ -538,7 +538,7 @@ namespace System
//FIXME: this method should check for cached values in systemTimeZones
if (id == null)
throw new ArgumentNullException ("id");
#if !MOBILE
#if WIN_PLATFORM
if (TimeZoneKey != null)
{
if (id == "Coordinated Universal Time")
@ -568,7 +568,7 @@ namespace System
}
#endif
#if !MOBILE
#if WIN_PLATFORM
private static TimeZoneInfo FromRegistryKey (string id, RegistryKey key)
{
byte [] reg_tzi = (byte []) key.GetValue ("TZI");
@ -811,9 +811,16 @@ namespace System
return tz.BaseUtcOffset;
}
if (tzRule != null && tz.IsInDST (tzRule, stdUtcDateTime) && tz.IsInDST (tzRule, dstUtcDateTime)) {
if (tzRule != null && tz.IsInDST (tzRule, stdUtcDateTime)) {
// Replicate what .NET does when given a time which falls into the hour which is lost when
// DST starts. isDST should always be true but the offset should be BaseUtcOffset without the
// DST delta while in that hour.
isDST = true;
return tz.BaseUtcOffset + tzRule.DaylightDelta;
if (tz.IsInDST (tzRule, dstUtcDateTime)) {
return tz.BaseUtcOffset + tzRule.DaylightDelta;
} else {
return tz.BaseUtcOffset;
}
}
return tz.BaseUtcOffset;
@ -958,12 +965,17 @@ namespace System
} else {
AdjustmentRule first = null, last = null;
// Rule start/end dates are either very specific or very broad depending on the platform
// 2015-10-04..2016-04-03 - Rule for a time zone in southern hemisphere on non-Windows platforms
// 2016-03-27..2016-10-03 - Rule for a time zone in northern hemisphere on non-Windows platforms
// 0001-01-01..9999-12-31 - Rule for a time zone on Windows
foreach (var rule in GetAdjustmentRules ()) {
if (rule.DateStart.Year != year && rule.DateEnd.Year != year)
if (rule.DateStart.Year > year || rule.DateEnd.Year < year)
continue;
if (rule.DateStart.Year == year)
if (rule.DateStart.Year <= year && (first == null || rule.DateStart.Year > first.DateStart.Year))
first = rule;
if (rule.DateEnd.Year == year)
if (rule.DateEnd.Year >= year && (last == null || rule.DateEnd.Year < last.DateEnd.Year))
last = rule;
}
@ -1172,16 +1184,27 @@ namespace System
return false;
}
var inDelta = false;
for (var i = transitions.Count - 1; i >= 0; i--) {
var pair = transitions [i];
DateTime ttime = pair.Key;
TimeType ttype = pair.Value;
if (ttime > date)
var delta = new TimeSpan (0, 0, ttype.Offset) - BaseUtcOffset;
if ((ttime + delta) > date) {
inDelta = ttime <= date;
continue;
}
offset = new TimeSpan (0, 0, ttype.Offset);
isDst = ttype.IsDst;
if (inDelta) {
// Replicate what .NET does when given a time which falls into the hour which is lost when
// DST starts. isDST should be true but the offset should be the non-DST offset.
isDst = transitions [i - 1].Value.IsDst;
} else {
isDst = ttype.IsDst;
}
return true;
}

View File

@ -70,6 +70,18 @@ namespace System {
{
return Append (new Text.StringBuilder ()).ToString ();
}
public int Rank {
get {
return dimensions;
}
}
public bool IsBound {
get {
return bound;
}
}
}
internal class PointerSpec : ModifierSpec

View File

@ -26,7 +26,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MOBILE
#if MONO_FEATURE_CONSOLE
using System.Runtime.InteropServices;
using System.Text;
namespace System {

View File

@ -255,7 +255,7 @@ namespace System
#else
namespace System
{
// this is a shim class so we can AOT during mobile_static build without --enable-minimal=com
// this is a shim class so we can AOT during full AOT builds without --enable-minimal=com
internal class __ComObject
{
__ComObject ()