1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 20:12:21 +02:00

Removed 'internal' protection - it's all about [Friend] now

This commit is contained in:
Brian Fiete 2020-03-09 06:34:16 -07:00
parent 81af04a1ce
commit 14ac27c977
119 changed files with 1339 additions and 1388 deletions

View file

@ -714,7 +714,7 @@ namespace Beefy.geom
ThrowUnimplemented();
}
internal Matrix4 ToMatrix()
public Matrix4 ToMatrix()
{
Matrix4 matrix = Matrix4.Identity;
ToMatrix(out matrix);
@ -762,7 +762,7 @@ namespace Beefy.geom
matrix.m33 = 1.0f;
}
internal Vector3 XYZ
public Vector3 XYZ
{
get
{

View file

@ -347,7 +347,7 @@ namespace Beefy.gfx
}
}
internal bool Load(StringView fontName, float pointSize = -1)
public bool Load(StringView fontName, float pointSize = -1)
{
Dispose();

View file

@ -93,7 +93,7 @@ namespace Beefy.gfx
public int32 mDrawNestingDepth;
internal this()
public this()
{
mZDepthStack = StateStack<float>(256, 0.0f, new => PopZDepth);
@ -433,7 +433,7 @@ namespace Beefy.gfx
[StdCall, CLink]
extern static void Gfx_SetTexture_TextureSegment(int32 textureIdx, void* textureSegment);
internal this()
public this()
{
mRenderStateDisposeProxy.mDisposeProxyDelegate = new => PopRenderState;
}

View file

@ -69,7 +69,7 @@ namespace Beefy.gfx
[StdCall, CLink]
static extern int32 Gfx_Texture_GetHeight(void* textureSegment);
internal this()
public this()
{
}

View file

@ -68,7 +68,7 @@ namespace Beefy.gfx
[StdCall, CLink]
extern static void ModelDefAnimation_Clip(void* nativeAnimation, int32 startFrame, int32 numFrames);
internal this(void* nativeModelDefAnimation)
public this(void* nativeModelDefAnimation)
{
mNativeModelDefAnimation = nativeModelDefAnimation;
mFrameCount = ModelDefAnimation_GetFrameCount(mNativeModelDefAnimation);
@ -166,7 +166,7 @@ namespace Beefy.gfx
public float mAnimSpeed = 1.0f;
public bool mLoop;
internal this(void* nativeModelInstance, ModelDef modelDef)
public this(void* nativeModelInstance, ModelDef modelDef)
{
mNativeRenderCmd = nativeModelInstance;
mModelDef = modelDef;

View file

@ -46,12 +46,12 @@ namespace Beefy.gfx
public void* mNativeRenderState;
public bool mIsFromDefaultRenderState;
internal this()
public this()
{
}
internal ~this()
public ~this()
{
RenderState_Delete(mNativeRenderState);
}

View file

@ -8,7 +8,7 @@ namespace Beefy.gfx
{
public void* mNativeShaderParam;
internal this(void* shaderParam)
public this(void* shaderParam)
{
}
}
@ -38,7 +38,7 @@ namespace Beefy.gfx
return aShader;
}
internal this(void* nativeShader)
public this(void* nativeShader)
{
mNativeShader = nativeShader;
}

View file

@ -76,7 +76,7 @@ namespace Beefy.gfx
}
#endif
internal this()
public this()
{
}

View file

@ -22,7 +22,7 @@ namespace Beefy.sys
public Event<MenuItemUpdateHandler> mOnMenuItemUpdate ~ _.Dispose();
public List<SysMenu> mChildren ~ DeleteContainerAndItems!(_);
internal this()
public this()
{
}

View file

@ -555,8 +555,8 @@ namespace Beefy.theme.dark
if (mChildItems != null)
{
//mChildItems.BinarySearch()
float drawStartY = g.mClipRect.mValue.mY - g.mMatrix.ty;
float drawEndY = g.mClipRect.mValue.Bottom - g.mMatrix.ty;
float drawStartY = g.mClipRect.Value.mY - g.mMatrix.ty;
float drawEndY = g.mClipRect.Value.Bottom - g.mMatrix.ty;
int itemStart = 0;
if (drawStartY > 0)
itemStart = Math.Max(0, FindItemAtY(drawStartY) - 1);

View file

@ -915,11 +915,11 @@ namespace Beefy.widgets
mCursorTextPos = Math.Clamp(mCursorTextPos + (int32)ofs, 0, mData.mTextLength + 1);
if (HasSelection())
{
if (((ofs > 0) && (mSelection.mValue.mStartPos >= index)) ||
((ofs < 0) && (mSelection.mValue.mStartPos > index)))
mSelection.mValue.mStartPos += (int32)ofs;
if (mSelection.mValue.mEndPos > index)
mSelection.mValue.mEndPos += (int32)ofs;
if (((ofs > 0) && (mSelection.Value.mStartPos >= index)) ||
((ofs < 0) && (mSelection.Value.mStartPos > index)))
mSelection.ValueRef.mStartPos += (int32)ofs;
if (mSelection.Value.mEndPos > index)
mSelection.ValueRef.mEndPos += (int32)ofs;
}
}
@ -3052,8 +3052,8 @@ namespace Beefy.widgets
lineCharIdx--;
if (prevSelection != null)
{
prevSelection.mValue.mStartPos--;
prevSelection.mValue.mEndPos--;
prevSelection.ValueRef.mStartPos--;
prevSelection.ValueRef.mEndPos--;
}
Backspace();
if (c == '\t')

View file

@ -27,7 +27,7 @@ namespace Beefy.widgets
//int mIdx = sIdx++;
//static int sIdx = 0;
internal this()
public this()
{
}
@ -715,7 +715,7 @@ namespace Beefy.widgets
return null;
}
internal virtual ListViewItem CreateListViewItem_Internal()
public virtual ListViewItem CreateListViewItem_Internal()
{
var listViewItem = CreateListViewItem();
listViewItem.Init(this);

View file

@ -127,19 +127,19 @@ namespace System
public static void Sort<T>(T[] array, Comparison<T> comp)
{
var sorter = Sorter<T, void>(&array.[Friend]mFirstElement, null, array.[Friend]mLength, comp);
sorter.Sort(0, array.[Friend]mLength);
sorter.[Friend]Sort(0, array.[Friend]mLength);
}
public static void Sort<T, T2>(T[] keys, T2[] items, Comparison<T> comp)
{
var sorter = Sorter<T, T2>(&keys.[Friend]mFirstElement, &items.[Friend]mFirstElement, keys.[Friend]mLength, comp);
sorter.Sort(0, keys.[Friend]mLength);
sorter.[Friend]Sort(0, keys.[Friend]mLength);
}
public static void Sort<T>(T[] array, int index, int count, Comparison<T> comp)
{
var sorter = Sorter<T, void>(&array.[Friend]mFirstElement, null, array.[Friend]mLength, comp);
sorter.Sort(index, count);
sorter.[Friend]Sort(index, count);
}
}
@ -228,7 +228,7 @@ namespace System
protected override void GCMarkMembers()
{
let type = typeof(T);
if ((type.mTypeFlags & .WantsMark) == 0)
if ((type.[Friend]mTypeFlags & .WantsMark) == 0)
return;
for (int i = 0; i < mLength; i++)
{

View file

@ -26,10 +26,12 @@ namespace System
Invocation = 0x10000,
MemberAccess = 0x20000,
Alloc = 0x40000,
Delete = 0x80000,
All = Assembly | Module | Class | Struct | Enum | Constructor |
Method | Property | Field | StaticField | Interface | Parameter |
Delegate | Function | ReturnValue | GenericParameter | Invocation | MemberAccess,
Delegate | Function | ReturnValue | GenericParameter | Invocation | MemberAccess |
Alloc | Delete,
}
public enum ReflectKind
@ -58,22 +60,22 @@ namespace System
public sealed struct AttributeUsageAttribute : Attribute
{
internal AttributeTargets mAttributeTarget = .All;
internal AttributeFlags mAttributeFlags = .None;
internal ReflectKind mReflectUser = .None;
AttributeTargets mAttributeTarget = .All;
AttributeFlags mAttributeFlags = .None;
ReflectKind mReflectUser = .None;
public this(AttributeTargets validOn)
{
mAttributeTarget = validOn;
}
internal this(AttributeTargets validOn, AttributeFlags flags)
public this(AttributeTargets validOn, AttributeFlags flags)
{
mAttributeTarget = validOn;
mAttributeFlags = flags;
}
internal this(AttributeTargets validOn, bool allowMultiple, bool inherited)
public this(AttributeTargets validOn, bool allowMultiple, bool inherited)
{
mAttributeTarget = validOn;
if (!allowMultiple)
@ -126,7 +128,7 @@ namespace System
}
}
[AttributeUsage(.MemberAccess)]
[AttributeUsage(.MemberAccess | .Alloc)]
public struct FriendAttribute : Attribute
{

View file

@ -2,17 +2,17 @@ namespace System
{
struct Char16 : char16, IHashable
{
internal const int UNICODE_PLANE00_END = 0x00ffff;
const int UNICODE_PLANE00_END = 0x00ffff;
// The starting codepoint for Unicode plane 1. Plane 1 contains 0x010000 ~ 0x01ffff.
internal const int UNICODE_PLANE01_START = 0x10000;
const int UNICODE_PLANE01_START = 0x10000;
// The end codepoint for Unicode plane 16. This is the maximum code point value allowed for Unicode.
// Plane 16 contains 0x100000 ~ 0x10ffff.
internal const int UNICODE_PLANE16_END = 0x10ffff;
const int UNICODE_PLANE16_END = 0x10ffff;
internal const char16 HIGH_SURROGATE_START = (char16)0xd800;
internal const char16 LOW_SURROGATE_END = (char16)0xdfff;
internal const char16 HIGH_SURROGATE_END = (char16)0xdbff;
internal const char16 LOW_SURROGATE_START = (char16)0xdc00;
const char16 HIGH_SURROGATE_START = (char16)0xd800;
const char16 LOW_SURROGATE_END = (char16)0xdfff;
const char16 HIGH_SURROGATE_END = (char16)0xdbff;
const char16 LOW_SURROGATE_START = (char16)0xdc00;
public int GetHashCode()
{

View file

@ -218,7 +218,7 @@ namespace System.Collections.Generic
public Enumerator GetEnumerator()
{
return Enumerator(this, Enumerator.KeyValuePair);
return Enumerator(this, Enumerator.[Friend]KeyValuePair);
}
[DisableObjectAccessChecks]
@ -572,10 +572,10 @@ namespace System.Collections.Generic
//private KeyValuePair<TKey, TValue> current;
private int_cosize mGetEnumeratorRetType; // What should Enumerator.Current return?
internal const int_cosize DictEntry = 1;
internal const int_cosize KeyValuePair = 2;
const int_cosize DictEntry = 1;
const int_cosize KeyValuePair = 2;
internal this(Dictionary<TKey, TValue> dictionary, int_cosize getEnumeratorRetType)
public this(Dictionary<TKey, TValue> dictionary, int_cosize getEnumeratorRetType)
{
mDictionary = dictionary;
#if VERSION_DICTIONARY
@ -718,10 +718,10 @@ namespace System.Collections.Generic
private int_cosize mIndex;
private TValue mCurrent;
internal const int_cosize cDictEntry = 1;
internal const int_cosize cKeyValuePair = 2;
const int_cosize cDictEntry = 1;
const int_cosize cKeyValuePair = 2;
internal this(Dictionary<TKey, TValue> dictionary)
public this(Dictionary<TKey, TValue> dictionary)
{
mDictionary = dictionary;
#if VERSION_DICTIONARY
@ -819,10 +819,10 @@ namespace System.Collections.Generic
private int_cosize mIndex;
private TKey* mCurrent;
internal const int_cosize DictEntry = 1;
internal const int_cosize KeyValuePair = 2;
const int_cosize DictEntry = 1;
const int_cosize KeyValuePair = 2;
internal this(Dictionary<TKey, TValue> dictionary)
public this(Dictionary<TKey, TValue> dictionary)
{
mDictionary = dictionary;
#if VERSION_DICTIONARY

View file

@ -988,7 +988,7 @@ namespace System.Collections.Generic
}*/
/// Copies this to an array. Used for DebugView
internal T[] ToArray()
T[] ToArray()
{
T[] newArray = new T[Count];
CopyTo(newArray);
@ -1074,17 +1074,17 @@ namespace System.Collections.Generic
#endregion
// used for set checking operations (using enumerables) that rely on counting
internal struct ElementCount
struct ElementCount
{
internal int32 mUniqueCount;
internal int32 mUnfoundCount;
public int32 mUniqueCount;
public int32 mUnfoundCount;
}
internal struct Slot
struct Slot
{
internal int32 mHashCode; // Lower 31 bits of hash code, -1 if unused
internal T mValue;
internal int32 mNext; // Index of next entry, -1 if last
public int32 mHashCode; // Lower 31 bits of hash code, -1 if unused
public T mValue;
public int32 mNext; // Index of next entry, -1 if last
}
public struct Enumerator : IEnumerator<T>
@ -1096,7 +1096,7 @@ namespace System.Collections.Generic
#endif
private T mCurrent;
internal this(HashSet<T> set)
public this(HashSet<T> set)
{
this.mSet = set;
mIndex = 0;

View file

@ -530,7 +530,7 @@ namespace System.Collections.Generic
public void Sort(Comparison<T> comp)
{
var sorter = Sorter<T, void>(mItems, null, mSize, comp);
sorter.Sort(0, mSize);
sorter.[Friend]Sort(0, mSize);
}
public int RemoveAll(Predicate<T> match)
@ -622,7 +622,7 @@ namespace System.Collections.Generic
if (mItems == null)
return;
let type = typeof(T);
if ((type.mTypeFlags & .WantsMark) == 0)
if ((type.[Friend]mTypeFlags & .WantsMark) == 0)
return;
for (int i < mSize)
{
@ -639,7 +639,7 @@ namespace System.Collections.Generic
#endif
private T* mCurrent;
internal this(List<T> list)
public this(List<T> list)
{
mList = list;
mIndex = 0;

View file

@ -196,7 +196,7 @@ namespace System.Collections.Generic
return false;
}
internal T GetElement(int i)
T GetElement(int i)
{
return mArray[(mHead + i) % mArray.Count];
}
@ -270,7 +270,7 @@ namespace System.Collections.Generic
#endif
private T mCurrentElement;
internal this(Queue<T> q)
public this(Queue<T> q)
{
mQueue = q;
#if VERSION_QUEUE

View file

@ -16,7 +16,7 @@ namespace System.Collections.Generic
private int mCount;
private Comparison<T> comparer;
internal this(T* keys, T2* items, int count, Comparison<T> comparer)
public this(T* keys, T2* items, int count, Comparison<T> comparer)
{
this.keys = keys;
this.items = items;
@ -24,7 +24,7 @@ namespace System.Collections.Generic
this.comparer = comparer;
}
internal static int FloorLog2(int n)
static int FloorLog2(int n)
{
int result = 0;
int val = n;
@ -44,7 +44,7 @@ namespace System.Collections.Generic
return low + ((hi - low) >> 1);
}
internal void SwapIfGreaterWithItems(int a, int b)
void SwapIfGreaterWithItems(int a, int b)
{
if (a != b)
{
@ -77,7 +77,7 @@ namespace System.Collections.Generic
}
}
internal void Sort(int left, int length)
void Sort(int left, int length)
{
IntrospectiveSort(left, length);
}

View file

@ -36,12 +36,12 @@ namespace System
// Number of days from 1/1/0001 to 12/30/1899
private const int32 DaysTo1899 = DaysPer400Years * 4 + DaysPer100Years * 3 - 367;
// Number of days from 1/1/0001 to 12/31/1969
internal const int32 DaysTo1970 = DaysPer400Years * 4 + DaysPer100Years * 3 + DaysPer4Years * 17 + DaysPerYear; // 719,162
private const int32 DaysTo1970 = DaysPer400Years * 4 + DaysPer100Years * 3 + DaysPer4Years * 17 + DaysPerYear; // 719,162
// Number of days from 1/1/0001 to 12/31/9999
private const int32 DaysTo10000 = DaysPer400Years * 25 - 366; // 3652059
internal const int64 MinTicks = 0;
internal const int64 MaxTicks = DaysTo10000 * TicksPerDay - 1;
private const int64 MinTicks = 0;
private const int64 MaxTicks = DaysTo10000 * TicksPerDay - 1;
private const int64 MaxMillis = (int64)DaysTo10000 * MillisPerDay;
private const int64 FileTimeOffset = DaysTo1601 * TicksPerDay;
@ -90,7 +90,7 @@ namespace System
// UTC time.
private uint64 dateData;
internal int64 InternalTicks
int64 InternalTicks
{
get
{
@ -138,7 +138,7 @@ namespace System
this.dateData = ((uint64)ticks | ((uint64)kind << KindShift));
}
internal this(int64 ticks, DateTimeKind kind, bool isAmbiguousDst)
public this(int64 ticks, DateTimeKind kind, bool isAmbiguousDst)
{
if (ticks < MinTicks || ticks > MaxTicks)
{
@ -203,7 +203,7 @@ namespace System
//we need to put some error checking out here.
if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >= 0 && second < 60)
{
return (TimeSpan.TimeToTicks(hour, minute, second));
return (TimeSpan.[Friend]TimeToTicks(hour, minute, second));
}
return .Err;
}
@ -354,7 +354,7 @@ namespace System
}
}
internal bool IsAmbiguousDaylightSavingTime()
bool IsAmbiguousDaylightSavingTime()
{
return (InternalKind == KindLocalAmbiguousDst);
}
@ -440,7 +440,7 @@ namespace System
DateTime utc = UtcNow;
bool isAmbiguousLocalDst = false;
int64 offset = TimeZoneInfo.GetDateTimeNowUtcOffsetFromUtc(utc, out isAmbiguousLocalDst).Ticks;
int64 offset = TimeZoneInfo.[Friend]GetDateTimeNowUtcOffsetFromUtc(utc, out isAmbiguousLocalDst).Ticks;
int64 tick = utc.Ticks + offset;
if (tick > DateTime.MaxTicks)
{
@ -768,7 +768,7 @@ namespace System
return ToLocalTime(false);
}
internal DateTime ToLocalTime(bool throwOnOverflow)
DateTime ToLocalTime(bool throwOnOverflow)
{
if (Kind == DateTimeKind.Local)
{
@ -779,7 +779,7 @@ namespace System
bool isAmbiguousLocalDst = false;
//int64 offset = 0;
//ThrowUnimplemented();
int64 offset = TimeZoneInfo.GetUtcOffsetFromUtc(this, TimeZoneInfo.Local, out isDaylightSavings, out isAmbiguousLocalDst).Ticks;
int64 offset = TimeZoneInfo.[Friend]GetUtcOffsetFromUtc(this, TimeZoneInfo.Local, out isDaylightSavings, out isAmbiguousLocalDst).Ticks;
#unwarn
int64 tick = Ticks + offset;
if (tick > DateTime.MaxTicks)
@ -802,47 +802,47 @@ namespace System
public void ToLongDateString(String outString)
{
DateTimeFormat.Format(this, "D", DateTimeFormatInfo.CurrentInfo, outString);
DateTimeFormat.[Friend]Format(this, "D", DateTimeFormatInfo.CurrentInfo, outString);
}
public void ToLongTimeString(String outString)
{
DateTimeFormat.Format(this, "T", DateTimeFormatInfo.CurrentInfo, outString);
DateTimeFormat.[Friend]Format(this, "T", DateTimeFormatInfo.CurrentInfo, outString);
}
public void ToShortDateString(String outString)
{
DateTimeFormat.Format(this, "d", DateTimeFormatInfo.CurrentInfo, outString);
DateTimeFormat.[Friend]Format(this, "d", DateTimeFormatInfo.CurrentInfo, outString);
}
public void ToShortTimeString(String outString)
{
DateTimeFormat.Format(this, "t", DateTimeFormatInfo.CurrentInfo, outString);
DateTimeFormat.[Friend]Format(this, "t", DateTimeFormatInfo.CurrentInfo, outString);
}
public void ToString(String outString)
{
DateTimeFormat.Format(this, .(), DateTimeFormatInfo.CurrentInfo, outString);
DateTimeFormat.[Friend]Format(this, .(), DateTimeFormatInfo.CurrentInfo, outString);
}
public void ToString(String outString, String format)
{
DateTimeFormat.Format(this, format, DateTimeFormatInfo.CurrentInfo, outString);
DateTimeFormat.[Friend]Format(this, format, DateTimeFormatInfo.CurrentInfo, outString);
}
public void ToString(String outString, IFormatProvider provider)
{
DateTimeFormat.Format(this, .(), DateTimeFormatInfo.GetInstance(provider), outString);
DateTimeFormat.[Friend]Format(this, .(), DateTimeFormatInfo.GetInstance(provider), outString);
}
public void ToString(String outString, String format, IFormatProvider provider)
{
DateTimeFormat.Format(this, format, DateTimeFormatInfo.GetInstance(provider), outString);
DateTimeFormat.[Friend]Format(this, format, DateTimeFormatInfo.GetInstance(provider), outString);
}
public DateTime ToUniversalTime()
{
return TimeZoneInfo.ConvertTimeToUtc(this, TimeZoneInfoOptions.NoThrowOnInvalidTime);
return TimeZoneInfo.[Friend]ConvertTimeToUtc(this, TimeZoneInfoOptions.NoThrowOnInvalidTime);
}
@ -865,7 +865,7 @@ namespace System
return DateTimeParse.TryParseExactMultiple(s, formats, DateTimeFormatInfo.GetInstance(provider), style, out result);
}*/
internal static Result<DateTime> TryCreate(int year, int month, int day, int hour, int minute, int second, int millisecond)
static Result<DateTime> TryCreate(int year, int month, int day, int hour, int minute, int second, int millisecond)
{
if (year < 1 || year > 9999 || month < 1 || month > 12)
{

View file

@ -32,16 +32,16 @@ namespace System {
public struct DateTimeOffset : IHashable // : IFormattable,IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>
{
// Constants
internal const int64 MaxOffset = TimeSpan.TicksPerHour * 14;
internal const int64 MinOffset = -MaxOffset;
const int64 MaxOffset = TimeSpan.TicksPerHour * 14;
const int64 MinOffset = -MaxOffset;
private const int64 UnixEpochTicks = TimeSpan.TicksPerDay * DateTime.DaysTo1970; // 621,355,968,000,000,000
private const int64 UnixEpochTicks = TimeSpan.TicksPerDay * DateTime.[Friend]DaysTo1970; // 621,355,968,000,000,000
private const int64 UnixEpochSeconds = UnixEpochTicks / TimeSpan.TicksPerSecond; // 62,135,596,800
private const int64 UnixEpochMilliseconds = UnixEpochTicks / TimeSpan.TicksPerMillisecond; // 62,135,596,800,000
// Static Fields
public static readonly DateTimeOffset MinValue = DateTimeOffset(DateTime.MinTicks, TimeSpan.Zero);
public static readonly DateTimeOffset MaxValue = DateTimeOffset(DateTime.MaxTicks, TimeSpan.Zero);
public static readonly DateTimeOffset MinValue = DateTimeOffset(DateTime.[Friend]MinTicks, TimeSpan.Zero);
public static readonly DateTimeOffset MaxValue = DateTimeOffset(DateTime.[Friend]MaxTicks, TimeSpan.Zero);
// Instance Fields
private DateTime m_dateTime;
@ -66,7 +66,7 @@ namespace System {
if (dateTime.Kind != DateTimeKind.Utc)
{
// Local and Unspecified are both treated as Local
offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
offset = TimeZoneInfo.[Friend]GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
}
else {
offset = TimeSpan(0);
@ -80,7 +80,7 @@ namespace System {
// the offset corresponds to the local.
public this(DateTime dateTime, TimeSpan offset) {
if (dateTime.Kind == DateTimeKind.Local) {
if (offset != TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime)) {
if (offset != TimeZoneInfo.[Friend]GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime)) {
//throw new ArgumentException(Environment.GetResourceString("Argument_OffsetLocalMismatch"), "offset");
Runtime.FatalError();
}
@ -473,8 +473,8 @@ namespace System {
}
public static Result<DateTimeOffset> FromUnixTimeSeconds(int64 seconds) {
const int64 MinSeconds = DateTime.MinTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds;
const int64 MaxSeconds = DateTime.MaxTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds;
const int64 MinSeconds = DateTime.[Friend]MinTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds;
const int64 MaxSeconds = DateTime.[Friend]MaxTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds;
if (seconds < MinSeconds || seconds > MaxSeconds) {
return .Err;
@ -487,8 +487,8 @@ namespace System {
}
public static Result<DateTimeOffset> FromUnixTimeMilliseconds(int64 milliseconds) {
const int64 MinMilliseconds = DateTime.MinTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds;
const int64 MaxMilliseconds = DateTime.MaxTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds;
const int64 MinMilliseconds = DateTime.[Friend]MinTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds;
const int64 MaxMilliseconds = DateTime.[Friend]MaxTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds;
if (milliseconds < MinMilliseconds || milliseconds > MaxMilliseconds) {
return .Err;
@ -656,9 +656,9 @@ namespace System {
return ToLocalTime(false);
}
internal DateTimeOffset ToLocalTime(bool throwOnOverflow)
DateTimeOffset ToLocalTime(bool throwOnOverflow)
{
return DateTimeOffset(UtcDateTime.ToLocalTime(throwOnOverflow));
return DateTimeOffset(UtcDateTime.[Friend]ToLocalTime(throwOnOverflow));
}
/*public override String ToString() {
@ -763,7 +763,7 @@ namespace System {
// This operation cannot overflow because offset should have already been validated to be within
// 14 hours and the DateTime instance is more than that distance from the boundaries of Int64.
int64 utcTicks = dateTime.Ticks - offset.Ticks;
if (utcTicks < DateTime.MinTicks || utcTicks > DateTime.MaxTicks)
if (utcTicks < DateTime.[Friend]MinTicks || utcTicks > DateTime.[Friend]MaxTicks)
{
return .Err;
//throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("Argument_UTCOutOfRange"));

View file

@ -5,11 +5,11 @@ using System.Collections.Generic;
namespace System.Diagnostics
{
internal delegate void UserCallBack(String data);
delegate void UserCallBack(String data);
class AsyncStreamReader
{
internal const int32 DefaultBufferSize = 1024; // Byte buffer size
private const int32 DefaultBufferSize = 1024; // Byte buffer size
private const int32 MinBufferSize = 128;
private Stream stream;
@ -41,12 +41,12 @@ namespace System.Diagnostics
// Cache the last position scanned in sb when searching for lines.
private int currentLinePos;
internal this(Process process, Stream stream, UserCallBack callback, Encoding encoding)
this(Process process, Stream stream, UserCallBack callback, Encoding encoding)
: this(process, stream, callback, encoding, DefaultBufferSize)
{
}
internal ~this()
~this()
{
for (var msg in messageQueue)
delete msg;
@ -57,7 +57,7 @@ namespace System.Diagnostics
// character encoding is set by encoding and the buffer size,
// in number of 16-bit characters, is set by bufferSize.
//
internal this(Process process, Stream stream, UserCallBack callback, Encoding encoding, int32 bufferSize)
this(Process process, Stream stream, UserCallBack callback, Encoding encoding, int32 bufferSize)
{
Debug.Assert(process != null && stream != null && encoding != null && callback != null, "Invalid arguments!");
Debug.Assert(stream.CanRead, "Stream must be readable!");
@ -116,7 +116,7 @@ namespace System.Diagnostics
}
// User calls BeginRead to start the asynchronous read
internal void BeginReadLine()
void BeginReadLine()
{
if (cancelOperation)
{
@ -134,7 +134,7 @@ namespace System.Diagnostics
}
}
internal void CancelOperation()
void CancelOperation()
{
cancelOperation = true;
}
@ -290,7 +290,7 @@ namespace System.Diagnostics
// Wait until we hit EOF. This is called from Process.WaitForExit
// We will lose some information if we don't do this.
internal void WaitUtilEOF()
void WaitUtilEOF()
{
if (eofEvent != null)
{

View file

@ -12,9 +12,9 @@ namespace System.Diagnostics
public class DataReceivedEventArgs : EventArgs
{
internal String _data;
String _data;
internal this(String data)
this(String data)
{
_data = data;
}

View file

@ -34,7 +34,7 @@ namespace System.Diagnostics
public static void AssertNotStack(Object obj)
{
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
if ((obj != null) && (obj.GetFlags() & 8 != 0))
if ((obj != null) && (obj.[Friend]GetFlags() & 8 != 0))
Internal.FatalError("Assert failed", 1);
#endif
}

View file

@ -3,7 +3,7 @@ using System.Threading;
namespace System.Diagnostics
{
internal static class ProcessManager
static class ProcessManager
{
#if BF_PLATFORM_WINDOWS

View file

@ -14,10 +14,10 @@ namespace System.Diagnostics
//public Windows.Handle ErrorDialogParentHandle;
//public ProcessWindowStyle WindowStyle;
internal String mFileName = new String() ~ delete _;
internal String mArguments = new String() ~ delete _;
internal String mDirectory = new String() ~ delete _;
internal String mVerb = new String("Open") ~ delete _;
String mFileName = new String() ~ delete _;
String mArguments = new String() ~ delete _;
String mDirectory = new String() ~ delete _;
String mVerb = new String("Open") ~ delete _;
public Dictionary<String, String> mEnvironmentVariables ~ DeleteDictionaryAndKeysAndItems!(_);
@ -27,8 +27,8 @@ namespace System.Diagnostics
public bool RedirectStandardError { get { return mRedirectStandardError; } set { mRedirectStandardError = value; } };
public bool CreateNoWindow { get { return mCreateNoWindow; } set { mCreateNoWindow = value; } };
internal Encoding StandardOutputEncoding;
internal Encoding StandardErrorEncoding;
Encoding StandardOutputEncoding;
Encoding StandardErrorEncoding;
//public bool redirectStandardInput { get { return redirectStandardInput; } set { redirectStandardInput = value; } };
//public bool redirectStandardInput { get { return redirectStandardInput; } set { redirectStandardInput = value; } };

View file

@ -47,7 +47,7 @@ namespace System.Diagnostics
public Result<void> Start(ProcessStartInfo startInfo)
{
String fileName = startInfo.mFileName;
String fileName = startInfo.[Friend]mFileName;
Platform.BfpSpawnFlags spawnFlags = .None;
if (startInfo.ErrorDialog)
@ -55,8 +55,8 @@ namespace System.Diagnostics
if (startInfo.UseShellExecute)
{
spawnFlags |= .UseShellExecute;
if (!startInfo.mVerb.IsEmpty)
fileName = scope:: String(fileName, "|", startInfo.mVerb);
if (!startInfo.[Friend]mVerb.IsEmpty)
fileName = scope:: String(fileName, "|", startInfo.[Friend]mVerb);
}
if (startInfo.CreateNoWindow)
spawnFlags |= .NoWindow;
@ -75,7 +75,7 @@ namespace System.Diagnostics
Span<char8> envSpan = env;
Platform.BfpSpawnResult result = .Ok;
mSpawn = Platform.BfpSpawn_Create(fileName, startInfo.mArguments, startInfo.mDirectory, envSpan.Ptr, spawnFlags, &result);
mSpawn = Platform.BfpSpawn_Create(fileName, startInfo.[Friend]mArguments, startInfo.[Friend]mDirectory, envSpan.Ptr, spawnFlags, &result);
if ((mSpawn == null) || (result != .Ok))
return .Err;

View file

@ -21,7 +21,7 @@ namespace System
public const double PositiveInfinity = (double)1.0 / (double)(0.0);
public const double NaN = (double)0.0 / (double)0.0;
internal static double NegativeZero = BitConverter.Convert<int64, double>(0x8000000000000000UL);
static double NegativeZero = BitConverter.Convert<int64, double>(0x8000000000000000UL);
public static int operator<=>(Double a, Double b)
{
@ -79,7 +79,7 @@ namespace System
}
}
internal bool IsNegative
public bool IsNegative
{
get
{

View file

@ -8,7 +8,7 @@ namespace System
{
for (var field in type.GetFields())
{
if (field.mFieldData.mConstValue == iVal)
if (field.[Friend]mFieldData.[Friend]mConstValue == iVal)
{
strBuffer.Append(field.Name);
return;
@ -23,8 +23,8 @@ namespace System
var typeInst = (TypeInstance)typeof(T);
for (var field in typeInst.GetFields())
{
if (str.Equals(field.mFieldData.mName, ignoreCase))
return .Ok(*((T*)(&field.mFieldData.mConstValue)));
if (str.Equals(field.[Friend]mFieldData.mName, ignoreCase))
return .Ok(*((T*)(&field.[Friend]mFieldData.mConstValue)));
}
return .Err;

View file

@ -20,19 +20,19 @@ namespace System
public const bool IsFileSystemCaseSensitive = true;
#endif
internal static String GetResourceString(String key)
static String GetResourceString(String key)
{
return key;
//return GetResourceFromDefault(key);
}
internal static String GetResourceString(String key, params Object[] values)
static String GetResourceString(String key, params Object[] values)
{
return key;
//return GetResourceFromDefault(key);
}
internal static String GetRuntimeResourceString(String key, String defaultValue = null)
static String GetRuntimeResourceString(String key, String defaultValue = null)
{
if (defaultValue != null)
return defaultValue;

View file

@ -63,7 +63,7 @@ namespace System.FFI
if (type.IsTypedPrimitive)
type = type.UnderlyingType;
switch (type.mTypeCode)
switch (type.[Friend]mTypeCode)
{
case .None:
return &FFIType.Void;
@ -100,8 +100,8 @@ namespace System.FFI
}
FFIType* ffiType = (FFIType*)allocBytes;
ffiType.mSize = type.mSize;
ffiType.mAlignment = type.mAlign;
ffiType.mSize = type.[Friend]mSize;
ffiType.mAlignment = type.[Friend]mAlign;
ffiType.mElements = null;
ffiType.mTypeKind = .Struct;
return ffiType;

View file

@ -31,62 +31,62 @@ namespace System.Globalization {
{
// Number of 100ns (10E-7 second) ticks per time unit
internal const int64 TicksPerMillisecond = 10000;
internal const int64 TicksPerSecond = TicksPerMillisecond * 1000;
internal const int64 TicksPerMinute = TicksPerSecond * 60;
internal const int64 TicksPerHour = TicksPerMinute * 60;
internal const int64 TicksPerDay = TicksPerHour * 24;
protected const int64 TicksPerMillisecond = 10000;
protected const int64 TicksPerSecond = TicksPerMillisecond * 1000;
protected const int64 TicksPerMinute = TicksPerSecond * 60;
protected const int64 TicksPerHour = TicksPerMinute * 60;
protected const int64 TicksPerDay = TicksPerHour * 24;
// Number of milliseconds per time unit
internal const int MillisPerSecond = 1000;
internal const int MillisPerMinute = MillisPerSecond * 60;
internal const int MillisPerHour = MillisPerMinute * 60;
internal const int MillisPerDay = MillisPerHour * 24;
protected const int MillisPerSecond = 1000;
protected const int MillisPerMinute = MillisPerSecond * 60;
protected const int MillisPerHour = MillisPerMinute * 60;
protected const int MillisPerDay = MillisPerHour * 24;
// Number of days in a non-leap year
internal const int DaysPerYear = 365;
protected const int DaysPerYear = 365;
// Number of days in 4 years
internal const int DaysPer4Years = DaysPerYear * 4 + 1;
protected const int DaysPer4Years = DaysPerYear * 4 + 1;
// Number of days in 100 years
internal const int DaysPer100Years = DaysPer4Years * 25 - 1;
protected const int DaysPer100Years = DaysPer4Years * 25 - 1;
// Number of days in 400 years
internal const int DaysPer400Years = DaysPer100Years * 4 + 1;
protected const int DaysPer400Years = DaysPer100Years * 4 + 1;
// Number of days from 1/1/0001 to 1/1/10000
internal const int DaysTo10000 = DaysPer400Years * 25 - 366;
protected const int DaysTo10000 = DaysPer400Years * 25 - 366;
internal const int64 MaxMillis = (int64)DaysTo10000 * MillisPerDay;
protected const int64 MaxMillis = (int64)DaysTo10000 * MillisPerDay;
//
// Calendar ID Values. This is used to get data from calendar.nlp.
// The order of calendar ID means the order of data items in the table.
//
internal const int CAL_GREGORIAN = 1 ; // Gregorian (localized) calendar
internal const int CAL_GREGORIAN_US = 2 ; // Gregorian (U.S.) calendar
internal const int CAL_JAPAN = 3 ; // Japanese Emperor Era calendar
internal const int CAL_TAIWAN = 4 ; // Taiwan Era calendar
internal const int CAL_KOREA = 5 ; // Korean Tangun Era calendar
internal const int CAL_HIJRI = 6 ; // Hijri (Arabic Lunar) calendar
internal const int CAL_THAI = 7 ; // Thai calendar
internal const int CAL_HEBREW = 8 ; // Hebrew (Lunar) calendar
internal const int CAL_GREGORIAN_ME_FRENCH = 9 ; // Gregorian Middle East French calendar
internal const int CAL_GREGORIAN_ARABIC = 10; // Gregorian Arabic calendar
internal const int CAL_GREGORIAN_XLIT_ENGLISH = 11; // Gregorian Transliterated English calendar
internal const int CAL_GREGORIAN_XLIT_FRENCH = 12;
internal const int CAL_JULIAN = 13;
internal const int CAL_JAPANESELUNISOLAR = 14;
internal const int CAL_CHINESELUNISOLAR = 15;
internal const int CAL_SAKA = 16; // reserved to match Office but not implemented in our code
internal const int CAL_LUNAR_ETO_CHN = 17; // reserved to match Office but not implemented in our code
internal const int CAL_LUNAR_ETO_KOR = 18; // reserved to match Office but not implemented in our code
internal const int CAL_LUNAR_ETO_ROKUYOU = 19; // reserved to match Office but not implemented in our code
internal const int CAL_KOREANLUNISOLAR = 20;
internal const int CAL_TAIWANLUNISOLAR = 21;
internal const int CAL_PERSIAN = 22;
internal const int CAL_UMALQURA = 23;
const int CAL_GREGORIAN = 1 ; // Gregorian (localized) calendar
const int CAL_GREGORIAN_US = 2 ; // Gregorian (U.S.) calendar
const int CAL_JAPAN = 3 ; // Japanese Emperor Era calendar
const int CAL_TAIWAN = 4 ; // Taiwan Era calendar
const int CAL_KOREA = 5 ; // Korean Tangun Era calendar
const int CAL_HIJRI = 6 ; // Hijri (Arabic Lunar) calendar
const int CAL_THAI = 7 ; // Thai calendar
const int CAL_HEBREW = 8 ; // Hebrew (Lunar) calendar
const int CAL_GREGORIAN_ME_FRENCH = 9 ; // Gregorian Middle East French calendar
const int CAL_GREGORIAN_ARABIC = 10; // Gregorian Arabic calendar
const int CAL_GREGORIAN_XLIT_ENGLISH = 11; // Gregorian Transliterated English calendar
const int CAL_GREGORIAN_XLIT_FRENCH = 12;
const int CAL_JULIAN = 13;
const int CAL_JAPANESELUNISOLAR = 14;
const int CAL_CHINESELUNISOLAR = 15;
const int CAL_SAKA = 16; // reserved to match Office but not implemented in our code
const int CAL_LUNAR_ETO_CHN = 17; // reserved to match Office but not implemented in our code
const int CAL_LUNAR_ETO_KOR = 18; // reserved to match Office but not implemented in our code
const int CAL_LUNAR_ETO_ROKUYOU = 19; // reserved to match Office but not implemented in our code
const int CAL_KOREANLUNISOLAR = 20;
const int CAL_TAIWANLUNISOLAR = 21;
const int CAL_PERSIAN = 22;
const int CAL_UMALQURA = 23;
internal int m_currentEraValue = -1;
int m_currentEraValue = -1;
private bool m_isReadOnly = false;
@ -116,7 +116,7 @@ namespace System.Globalization {
///
// This can not be abstract, otherwise no one can create a subclass of Calendar.
//
internal virtual int ID {
protected virtual int ID {
get {
return (-1);
}
@ -126,7 +126,7 @@ namespace System.Globalization {
// Return the Base calendar ID for calendars that didn't have defined data in calendarData
//
internal virtual int BaseCalendarID
protected virtual int BaseCalendarID
{
get { return ID; }
}
@ -189,7 +189,7 @@ namespace System.Globalization {
Runtime.NotImplemented();
}
internal Result<void> VerifyWritable()
Result<void> VerifyWritable()
{
if (m_isReadOnly)
{
@ -199,7 +199,7 @@ namespace System.Globalization {
return .Ok;
}
internal void SetReadOnlyState(bool readOnly)
void SetReadOnlyState(bool readOnly)
{
m_isReadOnly = readOnly;
}
@ -214,14 +214,14 @@ namespace System.Globalization {
** The value is from calendar.nlp.
============================================================================*/
internal virtual int CurrentEraValue
protected virtual int CurrentEraValue
{
get
{
// The following code assumes that the current era value can not be -1.
if (m_currentEraValue == -1) {
Contract.Assert(BaseCalendarID > 0, "[Calendar.CurrentEraValue] Expected ID > 0");
m_currentEraValue = CalendarData.GetCalendarData(BaseCalendarID).iCurrentEra;
m_currentEraValue = CalendarData.[Friend]GetCalendarData(BaseCalendarID).[Friend]iCurrentEra;
}
return (m_currentEraValue);
}
@ -231,9 +231,9 @@ namespace System.Globalization {
public const int CurrentEra = 0;
internal int twoDigitYearMax = -1;
protected int twoDigitYearMax = -1;
internal static Result<void> CheckAddResult(int64 ticks, DateTime minValue, DateTime maxValue) {
static Result<void> CheckAddResult(int64 ticks, DateTime minValue, DateTime maxValue) {
if (ticks < minValue.Ticks || ticks > maxValue.Ticks) {
return .Err;
/*throw new ArgumentException(
@ -244,7 +244,7 @@ namespace System.Globalization {
return .Ok;
}
internal Result<DateTime> Add(DateTime time, double value, int scale) {
Result<DateTime> Add(DateTime time, double value, int scale) {
// From ECMA CLI spec, Partition III, section 3.27:
//
// If overflow occurs converting a floating-point type to an integer, or if the floating-point value
@ -516,7 +516,7 @@ namespace System.Globalization {
** So Week of year = (GetDayOfYear(time) + offset - 1) / 7 + 1
============================================================================*/
internal Result<int> GetFirstDayWeekOfYear(DateTime time, int firstDayOfWeek) {
Result<int> GetFirstDayWeekOfYear(DateTime time, int firstDayOfWeek) {
int dayOfYear = Try!(GetDayOfYear(time)) - 1; // Make the day of year to be 0-based, so that 1/1 is day 0.
// Calculate the day of week for the first day of the year.
// dayOfWeek - (dayOfYear % 7) is the day of week for the first day of this year. Note that
@ -755,7 +755,7 @@ namespace System.Globalization {
public abstract Result<DateTime> ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era);
internal virtual bool TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result) {
protected virtual bool TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result) {
result = DateTime.MinValue;
switch (ToDateTime(year, month, day, hour, minute, second, millisecond, era))
{
@ -766,15 +766,15 @@ namespace System.Globalization {
}
}
internal virtual bool IsValidYear(int year, int era) {
protected virtual bool IsValidYear(int year, int era) {
return (year >= GetYear(MinSupportedDateTime).Get() && year <= GetYear(MaxSupportedDateTime).Get());
}
internal virtual bool IsValidMonth(int year, int month, int era) {
protected virtual bool IsValidMonth(int year, int month, int era) {
return (IsValidYear(year, era) && month >= 1 && month <= GetMonthsInYear(year, era).Get());
}
internal virtual bool IsValidDay(int year, int month, int day, int era)
protected virtual bool IsValidDay(int year, int month, int day, int era)
{
return (IsValidMonth(year, month, era) && day >= 1 && day <= GetDaysInMonth(year, month, era).Get());
}
@ -822,7 +822,7 @@ namespace System.Globalization {
// Return the tick count corresponding to the given hour, minute, second.
// Will check the if the parameters are valid.
internal static Result<int64> TimeToTicks(int hour, int minute, int second, int millisecond)
static Result<int64> TimeToTicks(int hour, int minute, int second, int millisecond)
{
if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >=0 && second < 60)
{
@ -834,16 +834,16 @@ namespace System.Globalization {
Environment.GetResourceString("ArgumentOutOfRange_Range"), 0, MillisPerSecond - 1));*/
return .Err;
}
return Try!(TimeSpan.TimeToTicks(hour, minute, second)) + millisecond * TicksPerMillisecond;
return Try!(TimeSpan.[Friend]TimeToTicks(hour, minute, second)) + millisecond * TicksPerMillisecond;
}
//throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadHourMinuteSecond"));
return .Err;
}
internal static int GetSystemTwoDigitYearSetting(int CalID, int defaultYearValue)
protected static int GetSystemTwoDigitYearSetting(int CalID, int defaultYearValue)
{
// Call nativeGetTwoDigitYearMax
int twoDigitYearMax = CalendarData.nativeGetTwoDigitYearMax(CalID);
int twoDigitYearMax = CalendarData.[Friend]nativeGetTwoDigitYearMax(CalID);
if (twoDigitYearMax < 0)
{
twoDigitYearMax = defaultYearValue;

View file

@ -29,42 +29,42 @@ namespace System.Globalization
// WARNING: The type loader will rearrange class member offsets so the mscorwks!CalendarDataBaseObject
// WARNING: must be manually structured to match the true loaded class layout
//
internal class CalendarData
class CalendarData
{
// Max calendars
internal const int MAX_CALENDARS = 23;
const int MAX_CALENDARS = 23;
// Identity
internal String sNativeName ~ delete _; // Calendar Name for the locale
String sNativeName ~ delete _; // Calendar Name for the locale
// Formats
internal String[] saShortDates ~ DeleteContainerAndItems!(_); // Short Data format, default first
internal String[] saYearMonths ~ DeleteContainerAndItems!(_); // Year/Month Data format, default first
internal String[] saLongDates ~ DeleteContainerAndItems!(_); // Long Data format, default first
internal String sMonthDay ~ delete _; // Month/Day format
String[] saShortDates ~ DeleteContainerAndItems!(_); // Short Data format, default first
String[] saYearMonths ~ DeleteContainerAndItems!(_); // Year/Month Data format, default first
String[] saLongDates ~ DeleteContainerAndItems!(_); // Long Data format, default first
String sMonthDay ~ delete _; // Month/Day format
// Calendar Parts Names
internal String[] saEraNames ~ DeleteContainerAndItems!(_); // Names of Eras
internal String[] saAbbrevEraNames ~ DeleteContainerAndItems!(_); // Abbreviated Era Names
internal String[] saAbbrevEnglishEraNames ~ DeleteContainerAndItems!(_); // Abbreviated Era Names in English
internal String[] saDayNames ~ DeleteContainerAndItems!(_); // Day Names, null to use locale data, starts on Sunday
internal String[] saAbbrevDayNames ~ DeleteContainerAndItems!(_); // Abbrev Day Names, null to use locale data, starts on Sunday
internal String[] saSuperShortDayNames ~ DeleteContainerAndItems!(_); // Super short Day of week names
internal String[] saMonthNames ~ DeleteContainerAndItems!(_); // Month Names (13)
internal String[] saAbbrevMonthNames ~ DeleteContainerAndItems!(_); // Abbrev Month Names (13)
internal String[] saMonthGenitiveNames ~ DeleteContainerAndItems!(_); // Genitive Month Names (13)
internal String[] saAbbrevMonthGenitiveNames~ DeleteContainerAndItems!(_); // Genitive Abbrev Month Names (13)
internal String[] saLeapYearMonthNames ~ DeleteContainerAndItems!(_); // Multiple strings for the month names in a leap year.
String[] saEraNames ~ DeleteContainerAndItems!(_); // Names of Eras
String[] saAbbrevEraNames ~ DeleteContainerAndItems!(_); // Abbreviated Era Names
String[] saAbbrevEnglishEraNames ~ DeleteContainerAndItems!(_); // Abbreviated Era Names in English
String[] saDayNames ~ DeleteContainerAndItems!(_); // Day Names, null to use locale data, starts on Sunday
String[] saAbbrevDayNames ~ DeleteContainerAndItems!(_); // Abbrev Day Names, null to use locale data, starts on Sunday
String[] saSuperShortDayNames ~ DeleteContainerAndItems!(_); // Super short Day of week names
String[] saMonthNames ~ DeleteContainerAndItems!(_); // Month Names (13)
String[] saAbbrevMonthNames ~ DeleteContainerAndItems!(_); // Abbrev Month Names (13)
String[] saMonthGenitiveNames ~ DeleteContainerAndItems!(_); // Genitive Month Names (13)
String[] saAbbrevMonthGenitiveNames~ DeleteContainerAndItems!(_); // Genitive Abbrev Month Names (13)
String[] saLeapYearMonthNames ~ DeleteContainerAndItems!(_); // Multiple strings for the month names in a leap year.
// Integers at end to make marshaller happier
internal int iTwoDigitYearMax=2029 ; // Max 2 digit year (for Y2K bug data entry)
internal int iCurrentEra=0 ; // current era # (usually 1)
int iTwoDigitYearMax=2029 ; // Max 2 digit year (for Y2K bug data entry)
int iCurrentEra=0 ; // current era # (usually 1)
// Use overrides?
internal bool bUseUserOverrides ; // True if we want user overrides.
bool bUseUserOverrides ; // True if we want user overrides.
// Static invariant for the invariant locale
internal static CalendarData Invariant ~ delete _;
static CalendarData Invariant ~ delete _;
// Private constructor
private this() {}
@ -128,7 +128,7 @@ namespace System.Globalization
//
// Get a bunch of data for a calendar
//
internal this(String localeName, int calendarId, bool bUseUserOverrides)
public this(String localeName, int calendarId, bool bUseUserOverrides)
{
String[] Clone(String[] strs)
{
@ -169,16 +169,16 @@ namespace System.Globalization
// Clean up the escaping of the formats
CultureData.ReescapeWin32Strings(this.saShortDates);
CultureData.ReescapeWin32Strings(this.saLongDates);
CultureData.ReescapeWin32Strings(this.saYearMonths);
CultureData.ReescapeWin32String(this.sMonthDay);
CultureData.[Friend]ReescapeWin32Strings(this.saShortDates);
CultureData.[Friend]ReescapeWin32Strings(this.saLongDates);
CultureData.[Friend]ReescapeWin32Strings(this.saYearMonths);
CultureData.[Friend]ReescapeWin32String(this.sMonthDay);
if ((CalendarId)calendarId == CalendarId.TAIWAN)
{
// for Geo----al reasons, the ----ese native name should only be returned when
// for ----ese SKU
if (CultureInfo.IsTaiwanSku)
if (CultureInfo.[Friend]IsTaiwanSku)
{
// We got the month/day names from the OS (same as gregorian), but the native name is wrong
this.sNativeName = "\x4e2d\x83ef\x6c11\x570b\x66c6";
@ -273,7 +273,7 @@ namespace System.Globalization
// for Geo----al reasons, the ----ese native name should only be returned when
// for ----ese SKU
DeleteContainerAndItems!(this.saEraNames);
if (CultureInfo.IsTaiwanSku)
if (CultureInfo.[Friend]IsTaiwanSku)
{
//
this.saEraNames = AllocStrings("\x4e2d\x83ef\x6c11\x570b");
@ -381,7 +381,7 @@ namespace System.Globalization
}
}
internal static CalendarData GetCalendarData(int calendarId)
static CalendarData GetCalendarData(int calendarId)
{
/*//
// Get a calendar.
@ -406,34 +406,34 @@ namespace System.Globalization
{
switch (calendarId)
{
case Calendar.CAL_GREGORIAN_US:
case Calendar.[Friend]CAL_GREGORIAN_US:
return "fa-IR"; // "fa-IR" Iran
case Calendar.CAL_JAPAN:
case Calendar.[Friend]CAL_JAPAN:
return "ja-JP"; // "ja-JP" Japan
case Calendar.CAL_TAIWAN:
case Calendar.[Friend]CAL_TAIWAN:
return "zh-TW"; // zh-TW Taiwan
case Calendar.CAL_KOREA:
case Calendar.[Friend]CAL_KOREA:
return "ko-KR"; // "ko-KR" Korea
case Calendar.CAL_HIJRI:
case Calendar.CAL_GREGORIAN_ARABIC:
case Calendar.CAL_UMALQURA:
case Calendar.[Friend]CAL_HIJRI:
case Calendar.[Friend]CAL_GREGORIAN_ARABIC:
case Calendar.[Friend]CAL_UMALQURA:
return "ar-SA"; // "ar-SA" Saudi Arabia
case Calendar.CAL_THAI:
case Calendar.[Friend]CAL_THAI:
return "th-TH"; // "th-TH" Thailand
case Calendar.CAL_HEBREW:
case Calendar.[Friend]CAL_HEBREW:
return "he-IL"; // "he-IL" Israel
case Calendar.CAL_GREGORIAN_ME_FRENCH:
case Calendar.[Friend]CAL_GREGORIAN_ME_FRENCH:
return "ar-DZ"; // "ar-DZ" Algeria
case Calendar.CAL_GREGORIAN_XLIT_ENGLISH:
case Calendar.CAL_GREGORIAN_XLIT_FRENCH:
case Calendar.[Friend]CAL_GREGORIAN_XLIT_ENGLISH:
case Calendar.[Friend]CAL_GREGORIAN_XLIT_FRENCH:
return "ar-IQ"; // "ar-IQ"; Iraq
default:
@ -482,7 +482,7 @@ namespace System.Globalization
internal static int nativeGetTwoDigitYearMax(int calID)
static int nativeGetTwoDigitYearMax(int calID)
{
Runtime.NotImplemented();
}
@ -494,7 +494,7 @@ namespace System.Globalization
return true;
}
internal static int nativeGetCalendars(String localeName, bool useUserOverride, int[] calendars)
static int nativeGetCalendars(String localeName, bool useUserOverride, int[] calendars)
{
Runtime.NotImplemented();
}

View file

@ -132,7 +132,7 @@ namespace System.Globalization
}
internal void GetNFIValues(NumberFormatInfo nfi)
void GetNFIValues(NumberFormatInfo nfi)
{
}
@ -145,7 +145,7 @@ namespace System.Globalization
}
}
internal Calendar DefaultCalendar
Calendar DefaultCalendar
{
get
{
@ -158,11 +158,11 @@ namespace System.Globalization
return CultureInfo.GetCalendarInstance(defaultCalId);*/
//Runtime.NotImplemented();
// NotImplemented
return CultureInfo.GetCalendarInstance(Calendar.CAL_GREGORIAN);
return CultureInfo.[Friend]GetCalendarInstance(Calendar.[Friend]CAL_GREGORIAN);
}
}
internal StringView CultureName
StringView CultureName
{
get
{
@ -176,7 +176,7 @@ namespace System.Globalization
}
}
internal String[] LongTimes
String[] LongTimes
{
get
{
@ -205,7 +205,7 @@ namespace System.Globalization
}
}
internal String[] ShortTimes
String[] ShortTimes
{
get
{
@ -237,7 +237,7 @@ namespace System.Globalization
}
}
internal static CultureData GetCultureData(StringView cultureName, bool useUserOverride)
static CultureData GetCultureData(StringView cultureName, bool useUserOverride)
{
CultureData culture = CreateCultureData(cultureName, useUserOverride);
return culture;
@ -290,7 +290,7 @@ namespace System.Globalization
//
// We don't build the stringbuilder unless we find something to change
////////////////////////////////////////////////////////////////////////////
static internal void ReescapeWin32String(String inStr)
static void ReescapeWin32String(String inStr)
{
// If we don't have data, then don't try anything
if (inStr == null)
@ -342,7 +342,7 @@ namespace System.Globalization
}
}
static internal void ReescapeWin32Strings(String[] inArray)
static void ReescapeWin32Strings(String[] inArray)
{
if (inArray != null)
{
@ -353,7 +353,7 @@ namespace System.Globalization
}
}
internal bool UseUserOverride
bool UseUserOverride
{
get
{
@ -361,7 +361,7 @@ namespace System.Globalization
}
}
internal bool IsSupplementalCustomCulture
bool IsSupplementalCustomCulture
{
get
{
@ -376,9 +376,9 @@ namespace System.Globalization
Environment.OSVersion.Version < Version(6, 2); // Win7 is 6.1.Build.Revision so we have to check for anything less than 6.2
}
internal CalendarData GetCalendar(int calendarId)
CalendarData GetCalendar(int calendarId)
{
Debug.Assert(calendarId > 0 && calendarId <= CalendarData.MAX_CALENDARS,
Debug.Assert(calendarId > 0 && calendarId <= CalendarData.[Friend]MAX_CALENDARS,
"[CultureData.GetCalendar] Expect calendarId to be in a valid range");
// arrays are 0 based, calendarIds are 1 based
@ -387,7 +387,7 @@ namespace System.Globalization
// Have to have calendars
if (calendars == null)
{
calendars = new CalendarData[CalendarData.MAX_CALENDARS];
calendars = new CalendarData[CalendarData.[Friend]MAX_CALENDARS];
}
// we need the following local variable to avoid returning null
@ -417,77 +417,77 @@ namespace System.Globalization
return calendarData;
}
internal String[] ShortDates(int calendarId)
String[] ShortDates(int calendarId)
{
return GetCalendar(calendarId).saShortDates;
return GetCalendar(calendarId).[Friend]saShortDates;
}
internal String[] LongDates(int calendarId)
String[] LongDates(int calendarId)
{
return GetCalendar(calendarId).saLongDates;
return GetCalendar(calendarId).[Friend]saLongDates;
}
// (user can override) date year/month format.
internal String[] YearMonths(int calendarId)
String[] YearMonths(int calendarId)
{
return GetCalendar(calendarId).saYearMonths;
return GetCalendar(calendarId).[Friend]saYearMonths;
}
// day names
internal String[] DayNames(int calendarId)
String[] DayNames(int calendarId)
{
return GetCalendar(calendarId).saDayNames;
return GetCalendar(calendarId).[Friend]saDayNames;
}
// abbreviated day names
internal String[] AbbreviatedDayNames(int calendarId)
String[] AbbreviatedDayNames(int calendarId)
{
// Get abbreviated day names for this calendar from the OS if necessary
return GetCalendar(calendarId).saAbbrevDayNames;
return GetCalendar(calendarId).[Friend]saAbbrevDayNames;
}
// The super short day names
internal String[] SuperShortDayNames(int calendarId)
String[] SuperShortDayNames(int calendarId)
{
return GetCalendar(calendarId).saSuperShortDayNames;
return GetCalendar(calendarId).[Friend]saSuperShortDayNames;
}
// month names
internal String[] MonthNames(int calendarId)
String[] MonthNames(int calendarId)
{
return GetCalendar(calendarId).saMonthNames;
return GetCalendar(calendarId).[Friend]saMonthNames;
}
// Genitive month names
internal String[] GenitiveMonthNames(int calendarId)
String[] GenitiveMonthNames(int calendarId)
{
return GetCalendar(calendarId).saMonthGenitiveNames;
return GetCalendar(calendarId).[Friend]saMonthGenitiveNames;
}
// month names
internal String[] AbbreviatedMonthNames(int calendarId)
String[] AbbreviatedMonthNames(int calendarId)
{
return GetCalendar(calendarId).saAbbrevMonthNames;
return GetCalendar(calendarId).[Friend]saAbbrevMonthNames;
}
// Genitive month names
internal String[] AbbreviatedGenitiveMonthNames(int calendarId)
String[] AbbreviatedGenitiveMonthNames(int calendarId)
{
return GetCalendar(calendarId).saAbbrevMonthGenitiveNames;
return GetCalendar(calendarId).[Friend]saAbbrevMonthGenitiveNames;
}
// Leap year month names
// Note: This only applies to Hebrew, and it basically adds a "1" to the 6th month name
// the non-leap names skip the 7th name in the normal month name array
internal String[] LeapYearMonthNames(int calendarId)
String[] LeapYearMonthNames(int calendarId)
{
return GetCalendar(calendarId).saLeapYearMonthNames;
return GetCalendar(calendarId).[Friend]saLeapYearMonthNames;
}
// month/day format (single string, no override)
internal String MonthDay(int calendarId)
String MonthDay(int calendarId)
{
return GetCalendar(calendarId).sMonthDay;
return GetCalendar(calendarId).[Friend]sMonthDay;
}
void DoGetLocaleInfo(uint lctype, String outStr)
@ -560,7 +560,7 @@ namespace System.Globalization
GetSeparator(format, "Hhms", outStr);
}
internal String TimeSeparator
String TimeSeparator
{
get
{

View file

@ -21,7 +21,7 @@ namespace System.Globalization
private static CultureInfo tlCurrentUICulture;
String m_name ~ delete _;
internal bool m_isInherited;
bool m_isInherited;
DateTimeFormatInfo dateTimeInfo ~ delete _;
CultureData m_cultureData ~ delete _;
Calendar calendar ~ delete _;
@ -29,12 +29,12 @@ namespace System.Globalization
// LOCALE constants of interest to us internally and privately for LCID functions
// (ie: avoid using these and use names if possible)
internal const int LOCALE_NEUTRAL = 0x0000;
private const int LOCALE_NEUTRAL = 0x0000;
private const int LOCALE_USER_DEFAULT = 0x0400;
private const int LOCALE_SYSTEM_DEFAULT = 0x0800;
internal const int LOCALE_CUSTOM_DEFAULT = 0x0c00;
internal const int LOCALE_CUSTOM_UNSPECIFIED = 0x1000;
internal const int LOCALE_INVARIANT = 0x007F;
private const int LOCALE_CUSTOM_DEFAULT = 0x0c00;
private const int LOCALE_CUSTOM_UNSPECIFIED = 0x1000;
private const int LOCALE_INVARIANT = 0x007F;
private const int LOCALE_TRADITIONAL_SPANISH = 0x040a;
public static CultureInfo DefaultThreadCurrentCulture
@ -121,10 +121,10 @@ namespace System.Globalization
//Contract.Assert(this.m_cultureData.CalendarIds.Length > 0, "this.m_cultureData.CalendarIds.Length > 0");
// Get the default calendar for this culture. Note that the value can be
// from registry if this is a user default culture.
Calendar newObj = this.m_cultureData.DefaultCalendar;
Calendar newObj = this.m_cultureData.[Friend]DefaultCalendar;
Interlocked.Fence();
newObj.SetReadOnlyState(m_isReadOnly);
newObj.[Friend]SetReadOnlyState(m_isReadOnly);
calendar = newObj;
}
return (calendar);
@ -239,14 +239,14 @@ namespace System.Globalization
public this(String name, bool useUserOverride)
{
// Get our data providing record
this.m_cultureData = CultureData.GetCultureData(name, useUserOverride);
this.m_cultureData = CultureData.[Friend]GetCultureData(name, useUserOverride);
if (this.m_cultureData == null) {
//throw new CultureNotFoundException("name", name, Environment.GetResourceString("Argument_CultureNotSupported"));
Runtime.FatalError();
}
this.m_name = new String(this.m_cultureData.CultureName);
this.m_name = new String(this.m_cultureData.[Friend]CultureName);
this.m_isInherited = (this.GetType() != typeof(System.Globalization.CultureInfo));
}
@ -262,7 +262,7 @@ namespace System.Globalization
private static volatile bool s_isTaiwanSku;
private static volatile bool s_haveIsTaiwanSku;
internal static bool IsTaiwanSku
static bool IsTaiwanSku
{
get
{
@ -326,7 +326,7 @@ namespace System.Globalization
// Helper function both both overloads of GetCachedReadOnlyCulture. If lcid is 0, we use the name.
// If lcid is -1, use the altName and create one of those special SQL cultures.
internal static CultureInfo GetCultureInfoHelper(int lcid, StringView name, StringView altName)
static CultureInfo GetCultureInfoHelper(int lcid, StringView name, StringView altName)
{
return new CultureInfo();
}
@ -336,9 +336,9 @@ namespace System.Globalization
//NotImplemented
}
internal static Calendar GetCalendarInstance(int calType)
static Calendar GetCalendarInstance(int calType)
{
if (calType==Calendar.CAL_GREGORIAN) {
if (calType==Calendar.[Friend]CAL_GREGORIAN) {
return new GregorianCalendar();
}
Runtime.NotImplemented();

View file

@ -120,25 +120,24 @@ namespace System {
*/
//This class contains only static members and does not require the serializable attribute.
internal static
class DateTimeFormat {
static class DateTimeFormat {
internal const int MaxSecondsFractionDigits = 7;
internal static readonly TimeSpan NullOffset = TimeSpan.MinValue;
const int MaxSecondsFractionDigits = 7;
static readonly TimeSpan NullOffset = TimeSpan.MinValue;
internal static char8[] allStandardFormats = new char8[]
static char8[] allStandardFormats = new char8[]
{
'd', 'D', 'f', 'F', 'g', 'G',
'm', 'M', 'o', 'O', 'r', 'R',
's', 't', 'T', 'u', 'U', 'y', 'Y',
} ~ delete _;
internal const String RoundtripFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK";
internal const String RoundtripDateTimeUnfixed = "yyyy'-'MM'-'ddTHH':'mm':'ss zzz";
const String RoundtripFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK";
const String RoundtripDateTimeUnfixed = "yyyy'-'MM'-'ddTHH':'mm':'ss zzz";
private const int DEFAULT_ALL_DATETIMES_SIZE = 132;
internal static String[] fixedNumberFormats = new String[] {
static String[] fixedNumberFormats = new String[] {
"0",
"00",
"000",
@ -162,12 +161,12 @@ namespace System {
// The function can format to Int32.MaxValue.
//
////////////////////////////////////////////////////////////////////////////
internal static void FormatDigits(String outputBuffer, int value, int len) {
static void FormatDigits(String outputBuffer, int value, int len) {
Contract.Assert(value >= 0, "DateTimeFormat.FormatDigits(): value >= 0");
FormatDigits(outputBuffer, value, len, false);
}
internal static void FormatDigits(String outputBuffer, int value, int len, bool overrideLengthLimit) {
static void FormatDigits(String outputBuffer, int value, int len, bool overrideLengthLimit) {
Contract.Assert(value >= 0, "DateTimeFormat.FormatDigits(): value >= 0");
var len;
@ -206,7 +205,7 @@ namespace System {
digits.ToString(outputBuffer);
}
internal static int ParseRepeatPattern(StringView format, int pos, char8 patternChar)
static int ParseRepeatPattern(StringView format, int pos, char8 patternChar)
{
int len = format.Length;
int index = pos + 1;
@ -295,7 +294,7 @@ namespace System {
// The pos should point to a quote character. This method will
// get the string encloed by the quote character.
//
internal static Result<int> ParseQuoteString(StringView format, int pos, String result)
static Result<int> ParseQuoteString(StringView format, int pos, String result)
{
var pos;
@ -356,7 +355,7 @@ namespace System {
// Return value of -1 means 'pos' is already at the end of the 'format' string.
// Otherwise, return value is the int value of the next character.
//
internal static int ParseNextChar(StringView format, int pos)
static int ParseNextChar(StringView format, int pos)
{
if (pos >= format.Length - 1)
{
@ -439,7 +438,7 @@ namespace System {
Calendar cal = dtfi.Calendar;
// This is a flag to indicate if we are format the dates using Hebrew calendar.
bool isHebrewCalendar = (cal.ID == Calendar.CAL_HEBREW);
bool isHebrewCalendar = (cal.[Friend]ID == Calendar.[Friend]CAL_HEBREW);
// This is a flag to indicate if we are formating hour/minute/second only.
bool bTimeOnly = true;
@ -480,7 +479,7 @@ namespace System {
case 'F':
tokenLen = ParseRepeatPattern(format, i, ch);
if (tokenLen <= MaxSecondsFractionDigits) {
int64 fraction = (dateTime.Ticks % Calendar.TicksPerSecond);
int64 fraction = (dateTime.Ticks % Calendar.[Friend]TicksPerSecond);
fraction = fraction / (int64)Math.Pow(10, 7 - tokenLen);
if (ch == 'f') {
((int)fraction).ToString(result, fixedNumberFormats[tokenLen - 1], CultureInfo.InvariantCulture);
@ -585,7 +584,7 @@ namespace System {
FormatHebrewMonthName(dateTime, month, tokenLen, dtfi, result);
} else {
if ((dtfi.FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != 0 && tokenLen >= 4) {
dtfi.internalGetMonthName(
dtfi.[Friend]internalGetMonthName(
month,
IsUseGenitiveForm(format, i, tokenLen, 'd')? MonthNameStyles.Genitive : MonthNameStyles.Regular,
false, result);
@ -607,7 +606,7 @@ namespace System {
if (dtfi.HasForceTwoDigitYears) {
FormatDigits(result, year, tokenLen <= 2 ? tokenLen : 2);
}
else if (cal.ID == Calendar.CAL_HEBREW) {
else if (cal.[Friend]ID == Calendar.[Friend]CAL_HEBREW) {
HebrewFormatDigits(result, year);
}
else {
@ -715,10 +714,10 @@ namespace System {
if (dateTimeFormat) {
// No offset. The instance is a DateTime and the output should be the local time zone
if (timeOnly && dateTime.Ticks < Calendar.TicksPerDay) {
if (timeOnly && dateTime.Ticks < Calendar.[Friend]TicksPerDay) {
// For time only format and a time only input, the time offset on 0001/01/01 is less
// accurate than the system's current offset because of daylight saving time.
offset = TimeZoneInfo.GetLocalUtcOffset(DateTime.Now, TimeZoneInfoOptions.NoThrowOnInvalidTime);
offset = TimeZoneInfo.[Friend]GetLocalUtcOffset(DateTime.Now, TimeZoneInfoOptions.NoThrowOnInvalidTime);
} else if (dateTime.Kind == DateTimeKind.Utc) {
#if FEATURE_CORECLR
offset = TimeSpan.Zero;
@ -730,10 +729,10 @@ namespace System {
// explicitly emit the local time offset, which we can do by removing the UTC flag.
InvalidFormatForUtc(format, dateTime);
dateTime = DateTime.SpecifyKind(dateTime, DateTimeKind.Local);
offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
offset = TimeZoneInfo.[Friend]GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
#endif // FEATURE_CORECLR
} else {
offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
offset = TimeZoneInfo.[Friend]GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
}
}
if (offset >= TimeSpan.Zero) {
@ -773,7 +772,7 @@ namespace System {
switch (dateTime.Kind) {
case DateTimeKind.Local:
// This should output the local offset, e.g. "-07:30"
offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
offset = TimeZoneInfo.[Friend]GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
// fall through to shared time zone output code
break;
case DateTimeKind.Utc:
@ -798,7 +797,7 @@ namespace System {
}
internal static Result<void> GetRealFormat(StringView format, DateTimeFormatInfo dtfi, String realFormat)
static Result<void> GetRealFormat(StringView format, DateTimeFormatInfo dtfi, String realFormat)
{
switch (format[0])
{
@ -916,12 +915,12 @@ namespace System {
return .Ok;
}
internal static void Format(DateTime dateTime, StringView format, DateTimeFormatInfo dtfi, String outStr)
static void Format(DateTime dateTime, StringView format, DateTimeFormatInfo dtfi, String outStr)
{
Format(dateTime, format, dtfi, NullOffset, outStr);
}
internal static void Format(DateTime dateTime, StringView format, DateTimeFormatInfo dtfi, TimeSpan offset, String outStr)
static void Format(DateTime dateTime, StringView format, DateTimeFormatInfo dtfi, TimeSpan offset, String outStr)
{
StringView useFormat = format;
@ -933,7 +932,7 @@ namespace System {
if (format.IsEmpty)
{
bool timeOnlySpecialCase = false;
if (dateTime.Ticks < Calendar.TicksPerDay) {
if (dateTime.Ticks < Calendar.[Friend]TicksPerDay) {
// If the time is less than 1 day, consider it as time of day.
// Just print out the short time format.
//
@ -947,14 +946,14 @@ namespace System {
// thrown when we try to get the Japanese year for Gregorian year 0001.
// Therefore, the workaround allows them to call ToString() for time of day from a DateTime by
// formatting as ISO 8601 format.
switch (dtfi.Calendar.ID) {
case Calendar.CAL_JAPAN:
case Calendar.CAL_TAIWAN:
case Calendar.CAL_HIJRI:
case Calendar.CAL_HEBREW:
case Calendar.CAL_JULIAN:
case Calendar.CAL_UMALQURA:
case Calendar.CAL_PERSIAN:
switch (dtfi.Calendar.[Friend]ID) {
case Calendar.[Friend]CAL_JAPAN:
case Calendar.[Friend]CAL_TAIWAN:
case Calendar.[Friend]CAL_HIJRI:
case Calendar.[Friend]CAL_HEBREW:
case Calendar.[Friend]CAL_JULIAN:
case Calendar.[Friend]CAL_UMALQURA:
case Calendar.[Friend]CAL_PERSIAN:
timeOnlySpecialCase = true;
dtfi = DateTimeFormatInfo.InvariantInfo;
break;
@ -992,7 +991,7 @@ namespace System {
FormatCustomized(dateTime, useFormat, dtfi, offset, outStr);
}
internal static Result<void> GetAllDateTimes(DateTime dateTime, char8 format, DateTimeFormatInfo dtfi, List<String> outResults)
static Result<void> GetAllDateTimes(DateTime dateTime, char8 format, DateTimeFormatInfo dtfi, List<String> outResults)
{
Contract.Requires(dtfi != null);
//String [] allFormats = null;
@ -1048,7 +1047,7 @@ namespace System {
return .Ok;
}
internal static String[] GetAllDateTimes(DateTime dateTime, DateTimeFormatInfo dtfi)
static String[] GetAllDateTimes(DateTime dateTime, DateTimeFormatInfo dtfi)
{
List<String> results = new List<String>(DEFAULT_ALL_DATETIMES_SIZE);
for (int i = 0; i < allStandardFormats.Count; i++)
@ -1062,14 +1061,14 @@ namespace System {
// This is a placeholder for an MDA to detect when the user is using a
// local DateTime with a format that will be interpreted as UTC.
internal static void InvalidFormatForLocal(StringView format, DateTime dateTime)
static void InvalidFormatForLocal(StringView format, DateTime dateTime)
{
}
// This is an MDA for cases when the user is using a local format with
// a Utc DateTime.
internal static void InvalidFormatForUtc(StringView format, DateTime dateTime) {
static void InvalidFormatForUtc(StringView format, DateTime dateTime) {
#if MDA_SUPPORTED
Mda.DateTimeInvalidLocalFormat();
#endif

View file

@ -1,13 +1,13 @@
using System.Collections.Generic;
namespace System.Globalization
{
internal enum MonthNameStyles {
enum MonthNameStyles {
Regular = 0x00000000,
Genitive = 0x00000001,
LeapYear = 0x00000002,
}
internal enum DateTimeFormatFlags {
enum DateTimeFormatFlags {
None = 0x00000000,
UseGenitiveMonth = 0x00000001,
UseLeapYearMonth = 0x00000002,
@ -35,7 +35,7 @@ namespace System.Globalization
private CultureData m_cultureData;
// The culture name used to create this DTFI.
internal String m_name = null;
private String m_name = null;
// The language name of the culture used to create this DTFI.
private String m_langName = null;
@ -53,49 +53,49 @@ namespace System.Globalization
//
//NotImpl: Shouldn't be initialized
internal String amDesignator = "AM";
internal String pmDesignator = "PM";
internal String dateSeparator = "/"; // derived from short date (whidbey expects, arrowhead doesn't)
internal String generalShortTimePattern = null; // short date + short time (whidbey expects, arrowhead doesn't)
internal String generalLongTimePattern = null; // short date + long time (whidbey expects, arrowhead doesn't)
internal String timeSeparator = ":"; // derived from long time (whidbey expects, arrowhead doesn't)
internal String monthDayPattern = null;
internal String dateTimeOffsetPattern = null;
String amDesignator = "AM";
String pmDesignator = "PM";
String dateSeparator = "/"; // derived from short date (whidbey expects, arrowhead doesn't)
String generalShortTimePattern = null; // short date + short time (whidbey expects, arrowhead doesn't)
String generalLongTimePattern = null; // short date + long time (whidbey expects, arrowhead doesn't)
String timeSeparator = ":"; // derived from long time (whidbey expects, arrowhead doesn't)
String monthDayPattern = null;
String dateTimeOffsetPattern = null;
//
// The following are constant values.
//
internal const String rfc1123Pattern = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
const String rfc1123Pattern = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
// The sortable pattern is based on ISO 8601.
internal const String sortableDateTimePattern = "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
internal const String universalSortableDateTimePattern = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
const String sortableDateTimePattern = "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
const String universalSortableDateTimePattern = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
//
// The following are affected by calendar settings.
//
internal Calendar calendar = null;
Calendar calendar = null;
internal int firstDayOfWeek = -1;
internal int calendarWeekRule = -1;
int firstDayOfWeek = -1;
int calendarWeekRule = -1;
internal String fullDateTimePattern = null; // long date + long time (whidbey expects, arrowhead doesn't)
String fullDateTimePattern = null; // long date + long time (whidbey expects, arrowhead doesn't)
internal String[] abbreviatedDayNames = null;
String[] abbreviatedDayNames = null;
internal String[] m_superShortDayNames = null;
String[] m_superShortDayNames = null;
internal String[] dayNames = null;
internal String[] abbreviatedMonthNames = null;
internal String[] monthNames = null;
String[] dayNames = null;
String[] abbreviatedMonthNames = null;
String[] monthNames = null;
// Cache the genitive month names that we retrieve from the data table.
internal String[] genitiveMonthNames = null;
String[] genitiveMonthNames = null;
// Cache the abbreviated genitive month names that we retrieve from the data table.
internal String[] m_genitiveAbbreviatedMonthNames = null;
String[] m_genitiveAbbreviatedMonthNames = null;
// Cache the month names of a leap year that we retrieve from the data table.
internal String[] leapYearMonthNames = null;
String[] leapYearMonthNames = null;
// For our "patterns" arrays we have 2 variables, a string and a string[]
//
@ -104,36 +104,36 @@ namespace System.Globalization
// When we initially construct our string[], we set the string to string[0]
// The "default" Date/time patterns
internal String longDatePattern = "dddd, MMMM d, yyyy";
internal String shortDatePattern = "M/d/yyyy";
internal String yearMonthPattern = "MMMM yyyy";
internal String longTimePattern = null;
internal String shortTimePattern = null;
String longDatePattern = "dddd, MMMM d, yyyy";
String shortDatePattern = "M/d/yyyy";
String yearMonthPattern = "MMMM yyyy";
String longTimePattern = null;
String shortTimePattern = null;
// These are Whidbey-serialization compatable arrays (eg: default not included)
// "all" is a bit of a misnomer since the "default" pattern stored above isn't
// necessarily a member of the list
private String[] allYearMonthPatterns = null; // This was wasn't serialized in Whidbey
internal String[] allShortDatePatterns = null;
internal String[] allLongDatePatterns = null;
internal String[] allShortTimePatterns = null;
internal String[] allLongTimePatterns = null;
String[] allYearMonthPatterns = null; // This was wasn't serialized in Whidbey
String[] allShortDatePatterns = null;
String[] allLongDatePatterns = null;
String[] allShortTimePatterns = null;
String[] allLongTimePatterns = null;
// Cache the era names for this DateTimeFormatInfo instance.
internal String[] m_eraNames = null;
internal String[] m_abbrevEraNames = null;
internal String[] m_abbrevEnglishEraNames = null;
String[] m_eraNames = null;
String[] m_abbrevEraNames = null;
String[] m_abbrevEnglishEraNames = null;
internal int[] optionalCalendars = null;
int[] optionalCalendars = null;
private const int DEFAULT_ALL_DATETIMES_SIZE = 132;
// CultureInfo updates this
internal bool m_isReadOnly=false;
bool m_isReadOnly=false;
// This flag gives hints about if formatting/parsing should perform special code path for things like
// genitive form or leap year month names.
internal DateTimeFormatFlags formatFlags = DateTimeFormatFlags.NotInitialized;
DateTimeFormatFlags formatFlags = DateTimeFormatFlags.NotInitialized;
//internal static bool preferExistingTokens = InitPreferExistingTokens();
List<Object> ownedObjects = new .() ~ DeleteContainerAndItems!(_);
@ -166,7 +166,7 @@ namespace System.Globalization
get
{
CultureInfo culture = CultureInfo.CurrentCulture;
if (!culture.m_isInherited)
if (!culture.[Friend]m_isInherited)
{
DateTimeFormatInfo info = culture.[Friend]dateTimeInfo;
if (info != null) {
@ -183,7 +183,7 @@ namespace System.Globalization
if (invariantInfo == null)
{
DateTimeFormatInfo info = new DateTimeFormatInfo();
info.Calendar.SetReadOnlyState(true);
info.Calendar.[Friend]SetReadOnlyState(true);
info.m_isReadOnly = true;
invariantInfo = info;
}
@ -221,7 +221,7 @@ namespace System.Globalization
{
if (timeSeparator == null)
{
timeSeparator = this.m_cultureData.TimeSeparator;
timeSeparator = this.m_cultureData.[Friend]TimeSeparator;
}
return timeSeparator;
}
@ -358,7 +358,7 @@ namespace System.Globalization
{
if (this.monthDayPattern == null)
{
this.monthDayPattern = this.m_cultureData.MonthDay(Calendar.ID);
this.monthDayPattern = this.m_cultureData.[Friend]MonthDay(Calendar.ID);
}
//Contract.Assert(this.monthDayPattern != null, "DateTimeFormatInfo.MonthDayPattern, monthDayPattern != null");
return (this.monthDayPattern);
@ -431,30 +431,30 @@ namespace System.Globalization
public void GetAbbreviatedDayName(DayOfWeek dayofweek, String outStr)
{
outStr.Append(CalendarData.Invariant.saAbbrevDayNames[(int)dayofweek]);
outStr.Append(CalendarData.[Friend]Invariant.[Friend]saAbbrevDayNames[(int)dayofweek]);
}
public void GetDayName(DayOfWeek dayofweek, String outStr)
{
outStr.Append(CalendarData.Invariant.saDayNames[(int)dayofweek]);
outStr.Append(CalendarData.[Friend]Invariant.[Friend]saDayNames[(int)dayofweek]);
}
public void GetAbbreviatedMonthName(int month, String outStr)
{
outStr.Append(CalendarData.Invariant.saAbbrevMonthNames[month - 1]);
outStr.Append(CalendarData.[Friend]Invariant.[Friend]saAbbrevMonthNames[month - 1]);
}
public void GetMonthName(int month, String outStr)
{
outStr.Append(CalendarData.Invariant.saMonthNames[month - 1]);
outStr.Append(CalendarData.[Friend]Invariant.[Friend]saMonthNames[month - 1]);
}
public void GetEraName(int era, String outStr)
{
outStr.Append(CalendarData.Invariant.saEraNames[era]);
outStr.Append(CalendarData.[Friend]Invariant.[Friend]saEraNames[era]);
}
internal void internalGetMonthName(int month, MonthNameStyles style, bool abbreviated, String outStr)
void internalGetMonthName(int month, MonthNameStyles style, bool abbreviated, String outStr)
{
GetMonthName(month, outStr);
}
@ -469,7 +469,7 @@ namespace System.Globalization
// Fast case for a regular CultureInfo
DateTimeFormatInfo info;
CultureInfo cultureProvider = provider as CultureInfo;
if (cultureProvider != null && !cultureProvider.m_isInherited)
if (cultureProvider != null && !cultureProvider.[Friend]m_isInherited)
{
return cultureProvider.DateTimeFormat;
}
@ -495,7 +495,7 @@ namespace System.Globalization
{
if (this.allYearMonthPatterns == null)
{
this.allYearMonthPatterns = this.m_cultureData.YearMonths(this.Calendar.ID);
this.allYearMonthPatterns = this.m_cultureData.[Friend]YearMonths(this.Calendar.ID);
}
return this.allYearMonthPatterns;
@ -508,7 +508,7 @@ namespace System.Globalization
{
if (allShortDatePatterns == null)
{
this.allShortDatePatterns = this.m_cultureData.ShortDates(this.Calendar.ID);
this.allShortDatePatterns = this.m_cultureData.[Friend]ShortDates(this.Calendar.ID);
}
return this.allShortDatePatterns;
@ -521,7 +521,7 @@ namespace System.Globalization
{
if (allLongDatePatterns == null)
{
this.allLongDatePatterns = this.m_cultureData.LongDates(this.Calendar.ID);
this.allLongDatePatterns = this.m_cultureData.[Friend]LongDates(this.Calendar.ID);
}
return this.allLongDatePatterns;
@ -534,7 +534,7 @@ namespace System.Globalization
{
if (this.allShortTimePatterns == null)
{
this.allShortTimePatterns = this.m_cultureData.ShortTimes;
this.allShortTimePatterns = this.m_cultureData.[Friend]ShortTimes;
}
return this.allShortTimePatterns;
@ -547,7 +547,7 @@ namespace System.Globalization
{
if (this.allLongTimePatterns == null)
{
this.allLongTimePatterns = this.m_cultureData.LongTimes;
this.allLongTimePatterns = this.m_cultureData.[Friend]LongTimes;
}
return this.allLongTimePatterns;
@ -555,15 +555,15 @@ namespace System.Globalization
}
private String m_fullTimeSpanPositivePattern ~ delete _;
internal String FullTimeSpanPositivePattern
String FullTimeSpanPositivePattern
{
get
{
if (m_fullTimeSpanPositivePattern == null)
{
CultureData cultureDataWithoutUserOverrides;
if (m_cultureData.UseUserOverride)
cultureDataWithoutUserOverrides = CultureData.GetCultureData(m_cultureData.CultureName, false);
if (m_cultureData.[Friend]UseUserOverride)
cultureDataWithoutUserOverrides = CultureData.[Friend]GetCultureData(m_cultureData.[Friend]CultureName, false);
else
cultureDataWithoutUserOverrides = m_cultureData;
StringView decimalSeparator = scope NumberFormatInfo(cultureDataWithoutUserOverrides).NumberDecimalSeparator;
@ -577,7 +577,7 @@ namespace System.Globalization
}
private String m_fullTimeSpanNegativePattern ~ delete _;
internal String FullTimeSpanNegativePattern
String FullTimeSpanNegativePattern
{
get
{

View file

@ -1,6 +1,6 @@
namespace System.Globalization
{
internal enum CalendarId : uint16
enum CalendarId : uint16
{
GREGORIAN = 1 , // Gregorian (localized) calendar
GREGORIAN_US = 2 , // Gregorian (U.S.) calendar

View file

@ -8,9 +8,9 @@ namespace System.Globalization
// This class represents a starting/ending time for a period of daylight saving time.
public class DaylightTime
{
internal DateTime m_start;
internal DateTime m_end;
internal TimeSpan m_delta;
DateTime m_start;
DateTime m_end;
TimeSpan m_delta;
public this()
{

View file

@ -19,12 +19,12 @@ namespace System.Globalization {
public enum GregorianCalendarTypes
{
Localized = Calendar.CAL_GREGORIAN,
USEnglish = Calendar.CAL_GREGORIAN_US,
MiddleEastFrench = Calendar.CAL_GREGORIAN_ME_FRENCH,
Arabic = Calendar.CAL_GREGORIAN_ARABIC,
TransliteratedEnglish = Calendar.CAL_GREGORIAN_XLIT_ENGLISH,
TransliteratedFrench = Calendar.CAL_GREGORIAN_XLIT_FRENCH,
Localized = Calendar.[Friend]CAL_GREGORIAN,
USEnglish = Calendar.[Friend]CAL_GREGORIAN_US,
MiddleEastFrench = Calendar.[Friend]CAL_GREGORIAN_ME_FRENCH,
Arabic = Calendar.[Friend]CAL_GREGORIAN_ARABIC,
TransliteratedEnglish = Calendar.[Friend]CAL_GREGORIAN_XLIT_ENGLISH,
TransliteratedFrench = Calendar.[Friend]CAL_GREGORIAN_XLIT_FRENCH,
}
// This calendar recognizes two era values:
@ -40,25 +40,25 @@ namespace System.Globalization {
public const int ADEra = 1;
internal const int DatePartYear = 0;
internal const int DatePartDayOfYear = 1;
internal const int DatePartMonth = 2;
internal const int DatePartDay = 3;
const int DatePartYear = 0;
const int DatePartDayOfYear = 1;
const int DatePartMonth = 2;
const int DatePartDay = 3;
//
// This is the max Gregorian year can be represented by DateTime class. The limitation
// is derived from DateTime class.
//
internal const int MaxYear = 9999;
const int MaxYear = 9999;
internal GregorianCalendarTypes m_type;
GregorianCalendarTypes m_type;
internal static readonly int[] DaysToMonth365 = new int[]
static readonly int[] DaysToMonth365 = new int[]
{
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
} ~ delete _;
internal static readonly int[] DaysToMonth366 = new int[]
static readonly int[] DaysToMonth366 = new int[]
{
0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366
} ~ delete _;
@ -115,7 +115,7 @@ namespace System.Globalization {
**Exceptions:
============================================================================*/
internal static Calendar GetDefaultInstance() {
static Calendar GetDefaultInstance() {
if (s_defaultInstance == null) {
s_defaultInstance = new GregorianCalendar();
}
@ -148,7 +148,7 @@ namespace System.Globalization {
}
set {
VerifyWritable();
this.[Friend]VerifyWritable();
switch (value)
{
@ -168,7 +168,7 @@ namespace System.Globalization {
}
}
internal override int ID {
protected override int ID {
get {
// By returning different ID for different variations of GregorianCalendar,
// we can support the Transliterated Gregorian calendar.
@ -180,7 +180,7 @@ namespace System.Globalization {
// Returns a given date part of this DateTime. This method is used
// to compute the year, day-of-year, month, or day part.
internal virtual int GetDatePart(int64 ticks, int part)
protected virtual int GetDatePart(int64 ticks, int part)
{
// n = number of days since 1/1/0001
int n = (int)(ticks / TicksPerDay);
@ -247,7 +247,7 @@ namespace System.Globalization {
**
============================================================================*/
internal static Result<int64> GetAbsoluteDate(int year, int month, int day) {
static Result<int64> GetAbsoluteDate(int year, int month, int day) {
if (year >= 1 && year <= MaxYear && month >= 1 && month <= 12)
{
int[] days = ((year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))) ? DaysToMonth366: DaysToMonth365;
@ -263,7 +263,7 @@ namespace System.Globalization {
// Returns the tick count corresponding to the given year, month, and day.
// Will check the if the parameters are valid.
internal virtual Result<int64> DateToTicks(int year, int month, int day) {
protected virtual Result<int64> DateToTicks(int year, int month, int day) {
return (Try!(GetAbsoluteDate(year, month, day)) * TicksPerDay);
}
@ -320,7 +320,7 @@ namespace System.Globalization {
d = days;
}
int64 ticks = Try!(DateToTicks(y, m, d)) + time.Ticks % TicksPerDay;
Try!(Calendar.CheckAddResult(ticks, MinSupportedDateTime, MaxSupportedDateTime));
Try!(Calendar.[Friend]CheckAddResult(ticks, MinSupportedDateTime, MaxSupportedDateTime));
return (DateTime(ticks));
}
@ -597,9 +597,9 @@ namespace System.Globalization {
return .Err;
}
internal override bool TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result) {
protected override bool TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result) {
if (era == CurrentEra || era == ADEra) {
switch (DateTime.TryCreate(year, month, day, hour, minute, second, millisecond))
switch (DateTime.[Friend]TryCreate(year, month, day, hour, minute, second, millisecond))
{
case .Ok(out result):
return true;
@ -617,13 +617,13 @@ namespace System.Globalization {
{
get {
if (twoDigitYearMax == -1) {
twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
twoDigitYearMax = GetSystemTwoDigitYearSetting([Friend]ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
}
return (twoDigitYearMax);
}
set {
VerifyWritable();
this.[Friend]VerifyWritable();
if (value < 99 || value > MaxYear) {
/*throw new ArgumentOutOfRangeException(
"year",

View file

@ -90,46 +90,45 @@ namespace System.Globalization {
// DO NOT UPDATE THIS WITHOUT UPDATING THAT STRUCTURE. IF YOU ADD BOOL, ADD THEM AT THE END.
// ALSO MAKE SURE TO UPDATE mscorlib.h in the VM directory to check field offsets.
// READTHIS READTHIS READTHIS
internal int32[] numberGroupSizes = new int32[] {3} ~ delete _;
internal int32[] currencyGroupSizes = new int32[] {3} ~ delete _;
internal int32[] percentGroupSizes = new int32[] {3} ~ delete _;
internal OwnedString positiveSign = .("+") ~ _.Dispose();
internal OwnedString negativeSign = .("-") ~ _.Dispose();
internal OwnedString numberDecimalSeparator = .(".") ~ _.Dispose();
internal OwnedString numberGroupSeparator = .(",") ~ _.Dispose();
internal OwnedString currencyGroupSeparator = .(",") ~ _.Dispose();;
internal OwnedString currencyDecimalSeparator = .(".") ~ _.Dispose();
internal OwnedString currencySymbol = .("\u{00a4}") ~ _.Dispose(); // U+00a4 is the symbol for International Monetary Fund.
protected int32[] numberGroupSizes = new int32[] {3} ~ delete _;
protected int32[] currencyGroupSizes = new int32[] {3} ~ delete _;
protected int32[] percentGroupSizes = new int32[] {3} ~ delete _;
protected OwnedString positiveSign = .("+") ~ _.Dispose();
protected OwnedString negativeSign = .("-") ~ _.Dispose();
protected OwnedString numberDecimalSeparator = .(".") ~ _.Dispose();
protected OwnedString numberGroupSeparator = .(",") ~ _.Dispose();
protected OwnedString currencyGroupSeparator = .(",") ~ _.Dispose();;
protected OwnedString currencyDecimalSeparator = .(".") ~ _.Dispose();
protected OwnedString currencySymbol = .("\u{00a4}") ~ _.Dispose(); // U+00a4 is the symbol for International Monetary Fund.
// The alternative currency symbol used in Win9x ANSI codepage, that can not roundtrip between ANSI and Unicode.
// Currently, only ja-JP and ko-KR has non-null values (which is U+005c, backslash)
// NOTE: The only legal values for this string are null and "\u005c"
internal String ansiCurrencySymbol = null;
internal OwnedString nanSymbol = .("NaN") ~ _.Dispose();
internal OwnedString positiveInfinitySymbol = .("Infinity") ~ _.Dispose();
internal OwnedString negativeInfinitySymbol = .("-Infinity") ~ _.Dispose();
internal OwnedString percentDecimalSeparator = .(".") ~ _.Dispose();
internal OwnedString percentGroupSeparator = .(",") ~ _.Dispose();
internal OwnedString percentSymbol = .("%") ~ _.Dispose();
internal OwnedString perMilleSymbol = .("\u{2030}") ~ _.Dispose();
protected String ansiCurrencySymbol = null;
protected OwnedString nanSymbol = .("NaN") ~ _.Dispose();
protected OwnedString positiveInfinitySymbol = .("Infinity") ~ _.Dispose();
protected OwnedString negativeInfinitySymbol = .("-Infinity") ~ _.Dispose();
protected OwnedString percentDecimalSeparator = .(".") ~ _.Dispose();
protected OwnedString percentGroupSeparator = .(",") ~ _.Dispose();
protected OwnedString percentSymbol = .("%") ~ _.Dispose();
protected OwnedString perMilleSymbol = .("\u{2030}") ~ _.Dispose();
internal String[] nativeDigits = new .[] {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} ~ DeleteNativeDigits();
protected String[] nativeDigits = new .[] {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} ~ DeleteNativeDigits();
internal int32 numberDecimalDigits = 2;
internal int32 currencyDecimalDigits = 2;
internal int32 currencyPositivePattern = 0;
internal int32 currencyNegativePattern = 0;
internal int32 numberNegativePattern = 1;
internal int32 percentPositivePattern = 0;
internal int32 percentNegativePattern = 0;
internal int32 percentDecimalDigits = 2;
protected int32 numberDecimalDigits = 2;
protected int32 currencyDecimalDigits = 2;
protected int32 currencyPositivePattern = 0;
protected int32 currencyNegativePattern = 0;
protected int32 numberNegativePattern = 1;
protected int32 percentPositivePattern = 0;
protected int32 percentNegativePattern = 0;
protected int32 percentDecimalDigits = 2;
protected int32 digitSubstitution = 1; // DigitShapes.None
internal int32 digitSubstitution = 1; // DigitShapes.None
internal bool isReadOnly=false;
protected bool isReadOnly=false;
// Is this NumberFormatInfo for invariant culture?
internal bool m_isInvariant=false;
protected bool m_isInvariant=false;
void DeleteNativeDigits()
{
@ -211,13 +210,13 @@ namespace System.Globalization {
// We aren't persisting dataItem any more (since its useless & we weren't using it),
// Ditto with m_useUserOverride. Don't use them, we use a local copy of everything.
internal this(CultureData cultureData)
public this(CultureData cultureData)
{
if (cultureData != null)
{
// We directly use fields here since these data is coming from data table or Win32, so we
// don't need to verify their values (except for invalid parsing situations).
cultureData.GetNFIValues(this);
cultureData.[Friend]GetNFIValues(this);
if (cultureData.IsInvariantCulture)
{
@ -339,7 +338,7 @@ namespace System.Globalization {
// Every element in the groupSize array should be between 1 and 9
// excpet the last element could be zero.
//
static internal void CheckGroupSize(String propName, int[] groupSize)
static protected void CheckGroupSize(String propName, int[] groupSize)
{
for (int i = 0; i < groupSize.Count; i++)
{

View file

@ -12,17 +12,17 @@ namespace System.Globalization {
using System.Globalization;
using System.Collections.Generic;
internal static class TimeSpanFormat
static class TimeSpanFormat
{
private static void IntToString(int n, int digits, String outStr)
{
((int32)n).[Friend]ToString(outStr, digits);
}
internal static readonly FormatLiterals PositiveInvariantFormatLiterals = TimeSpanFormat.FormatLiterals.InitInvariant(false /*isNegative*/) ~ _.Dispose();
internal static readonly FormatLiterals NegativeInvariantFormatLiterals = TimeSpanFormat.FormatLiterals.InitInvariant(true /*isNegative*/) ~ _.Dispose();
protected static readonly FormatLiterals PositiveInvariantFormatLiterals = TimeSpanFormat.FormatLiterals.[Friend]InitInvariant(false /*isNegative*/) ~ _.Dispose();
protected static readonly FormatLiterals NegativeInvariantFormatLiterals = TimeSpanFormat.FormatLiterals.[Friend]InitInvariant(true /*isNegative*/) ~ _.Dispose();
internal enum Pattern {
protected enum Pattern {
None = 0,
Minimum = 1,
Full = 2,
@ -33,7 +33,7 @@ namespace System.Globalization {
//
// Actions: Main method called from TimeSpan.ToString
//
internal static Result<void> Format(TimeSpan value, StringView format, IFormatProvider formatProvider, String outStr)
protected static Result<void> Format(TimeSpan value, StringView format, IFormatProvider formatProvider, String outStr)
{
var format;
@ -54,9 +54,9 @@ namespace System.Globalization {
DateTimeFormatInfo dtfi = DateTimeFormatInfo.GetInstance(formatProvider);
if ((int64)value < 0)
format = dtfi.FullTimeSpanNegativePattern;
format = dtfi.[Friend]FullTimeSpanNegativePattern;
else
format = dtfi.FullTimeSpanPositivePattern;
format = dtfi.[Friend]FullTimeSpanPositivePattern;
if (f == 'g')
pattern = Pattern.Minimum;
else
@ -99,27 +99,27 @@ namespace System.Globalization {
}
else {
literal = FormatLiterals();
literal.Init(format, pattern == Pattern.Full);
literal.[Friend]Init(format, pattern == Pattern.Full);
}
if (fraction != 0) { // truncate the partial second to the specified length
fraction = (int)((int64)fraction / (int64)Math.Pow(10, DateTimeFormat.MaxSecondsFractionDigits - literal.ff));
fraction = (int)((int64)fraction / (int64)Math.Pow(10, DateTimeFormat.[Friend]MaxSecondsFractionDigits - literal.[Friend]ff));
}
// Pattern.Full: [-]dd.hh:mm:ss.fffffff
// Pattern.Minimum: [-][d.]hh:mm:ss[.fffffff]
outStr.Append(literal.Start); // [-]
outStr.Append(literal.[Friend]Start); // [-]
if (pattern == Pattern.Full || day != 0) { //
day.ToString(outStr); // [dd]
outStr.Append(literal.DayHourSep); // [.]
outStr.Append(literal.[Friend]DayHourSep); // [.]
} //
IntToString(hours, literal.hh, outStr); // hh
outStr.Append(literal.HourMinuteSep); // :
IntToString(minutes, literal.mm, outStr); // mm
outStr.Append(literal.MinuteSecondSep); // :
IntToString(seconds, literal.ss, outStr); // ss
IntToString(hours, literal.[Friend]hh, outStr); // hh
outStr.Append(literal.[Friend]HourMinuteSep); // :
IntToString(minutes, literal.[Friend]mm, outStr); // mm
outStr.Append(literal.[Friend]MinuteSecondSep); // :
IntToString(seconds, literal.[Friend]ss, outStr); // ss
if (!isInvariant && pattern == Pattern.Minimum) {
int effectiveDigits = literal.ff;
int effectiveDigits = literal.[Friend]ff;
while (effectiveDigits > 0) {
if (fraction % 10 == 0) {
fraction = fraction / 10;
@ -130,15 +130,15 @@ namespace System.Globalization {
}
}
if (effectiveDigits > 0) {
outStr.Append(literal.SecondFractionSep); // [.FFFFFFF]
(fraction).ToString(outStr, DateTimeFormat.fixedNumberFormats[effectiveDigits - 1], CultureInfo.InvariantCulture);
outStr.Append(literal.[Friend]SecondFractionSep); // [.FFFFFFF]
(fraction).ToString(outStr, DateTimeFormat.[Friend]fixedNumberFormats[effectiveDigits - 1], CultureInfo.InvariantCulture);
}
}
else if (pattern == Pattern.Full || fraction != 0) {
outStr.Append(literal.SecondFractionSep); // [.]
IntToString(fraction, literal.ff, outStr); // [fffffff]
outStr.Append(literal.[Friend]SecondFractionSep); // [.]
IntToString(fraction, literal.[Friend]ff, outStr); // [fffffff]
} //
outStr.Append(literal.End); //
outStr.Append(literal.[Friend]End); //
return .Ok;
}
@ -150,7 +150,7 @@ namespace System.Globalization {
//
// Actions: Format the TimeSpan instance using the specified format.
//
internal static Result<void> FormatCustomized(TimeSpan value, StringView format, DateTimeFormatInfo dtfi, String result)
protected static Result<void> FormatCustomized(TimeSpan value, StringView format, DateTimeFormatInfo dtfi, String result)
{
Contract.Assert(dtfi != null, "dtfi == null");
@ -176,50 +176,50 @@ namespace System.Globalization {
int nextChar;
switch (ch) {
case 'h':
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
if (tokenLen > 2)
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
return .Err;
DateTimeFormat.FormatDigits(result, hours, tokenLen);
DateTimeFormat.[Friend]FormatDigits(result, hours, tokenLen);
break;
case 'm':
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
if (tokenLen > 2)
return .Err;
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
DateTimeFormat.FormatDigits(result, minutes, tokenLen);
DateTimeFormat.[Friend]FormatDigits(result, minutes, tokenLen);
break;
case 's':
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
if (tokenLen > 2)
return .Err;
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
DateTimeFormat.FormatDigits(result, seconds, tokenLen);
DateTimeFormat.[Friend]FormatDigits(result, seconds, tokenLen);
break;
case 'f':
//
// The fraction of a second in single-digit precision. The remaining digits are truncated.
//
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
if (tokenLen > DateTimeFormat.MaxSecondsFractionDigits)
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
if (tokenLen > DateTimeFormat.[Friend]MaxSecondsFractionDigits)
return .Err;
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
tmp = (int64)fraction;
tmp /= (int64)Math.Pow(10, DateTimeFormat.MaxSecondsFractionDigits - tokenLen);
(tmp).ToString(result, DateTimeFormat.fixedNumberFormats[tokenLen - 1], CultureInfo.InvariantCulture);
tmp /= (int64)Math.Pow(10, DateTimeFormat.[Friend]MaxSecondsFractionDigits - tokenLen);
(tmp).ToString(result, DateTimeFormat.[Friend]fixedNumberFormats[tokenLen - 1], CultureInfo.InvariantCulture);
break;
case 'F':
//
// Displays the most significant digit of the seconds fraction. Nothing is displayed if the digit is zero.
//
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
if (tokenLen > DateTimeFormat.MaxSecondsFractionDigits)
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
if (tokenLen > DateTimeFormat.[Friend]MaxSecondsFractionDigits)
return .Err;
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
tmp = (int64)fraction;
tmp /= (int64)Math.Pow(10, DateTimeFormat.MaxSecondsFractionDigits - tokenLen);
tmp /= (int64)Math.Pow(10, DateTimeFormat.[Friend]MaxSecondsFractionDigits - tokenLen);
int effectiveDigits = tokenLen;
while (effectiveDigits > 0) {
if (tmp % 10 == 0) {
@ -231,7 +231,7 @@ namespace System.Globalization {
}
}
if (effectiveDigits > 0) {
(tmp).ToString(result, DateTimeFormat.fixedNumberFormats[effectiveDigits - 1], CultureInfo.InvariantCulture);
(tmp).ToString(result, DateTimeFormat.[Friend]fixedNumberFormats[effectiveDigits - 1], CultureInfo.InvariantCulture);
}
break;
case 'd':
@ -239,23 +239,23 @@ namespace System.Globalization {
// tokenLen == 1 : Day as digits with no leading zero.
// tokenLen == 2+: Day as digits with leading zero for single-digit days.
//
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
if (tokenLen > 8)
return .Err;
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
DateTimeFormat.FormatDigits(result, day, tokenLen, true);
DateTimeFormat.[Friend]FormatDigits(result, day, tokenLen, true);
break;
case '\'':
case '\"':
//StringBuilder enquotedString = new StringBuilder();
tokenLen = DateTimeFormat.ParseQuoteString(format, i, result);
tokenLen = DateTimeFormat.[Friend]ParseQuoteString(format, i, result);
//result.Append(enquotedString);
break;
case '%':
// Optional format character.
// For example, format string "%d" will print day
// Most of the cases, "%" can be ignored.
nextChar = DateTimeFormat.ParseNextChar(format, i);
nextChar = DateTimeFormat.[Friend]ParseNextChar(format, i);
// nextChar will be -1 if we already reach the end of the format string.
// Besides, we will not allow "%%" appear in the pattern.
if (nextChar >= 0 && nextChar != (int)'%')
@ -277,7 +277,7 @@ namespace System.Globalization {
// Escaped character. Can be used to insert character into the format string.
// For example, "\d" will insert the character 'd' into the string.
//
nextChar = DateTimeFormat.ParseNextChar(format, i);
nextChar = DateTimeFormat.[Friend]ParseNextChar(format, i);
if (nextChar >= 0)
{
result.Append(((char8)nextChar));
@ -304,43 +304,43 @@ namespace System.Globalization {
internal struct FormatLiterals {
internal String Start {
protected struct FormatLiterals {
String Start {
get {
return literals[0];
}
}
internal String DayHourSep {
String DayHourSep {
get {
return literals[1];
}
}
internal String HourMinuteSep {
String HourMinuteSep {
get {
return literals[2];
}
}
internal String MinuteSecondSep {
String MinuteSecondSep {
get {
return literals[3];
}
}
internal String SecondFractionSep {
String SecondFractionSep {
get {
return literals[4];
}
}
internal String End {
String End {
get {
return literals[5];
}
}
internal String AppCompatLiteral;
internal int dd;
internal int hh;
internal int mm;
internal int ss;
internal int ff;
String AppCompatLiteral;
int dd;
int hh;
int mm;
int ss;
int ff;
private String[] literals;
private List<String> ownedStrs;
@ -365,7 +365,7 @@ namespace System.Globalization {
}
/* factory method for static invariant FormatLiterals */
internal static FormatLiterals InitInvariant(bool isNegative) {
static FormatLiterals InitInvariant(bool isNegative) {
FormatLiterals x = FormatLiterals();
x.literals = new String[6];
x.literals[0] = isNegative ? "-" : String.Empty;
@ -379,7 +379,7 @@ namespace System.Globalization {
x.hh = 2;
x.mm = 2;
x.ss = 2;
x.ff = DateTimeFormat.MaxSecondsFractionDigits;
x.ff = DateTimeFormat.[Friend]MaxSecondsFractionDigits;
return x;
}
@ -387,7 +387,7 @@ namespace System.Globalization {
// the constants guaranteed to include DHMSF ordered greatest to least significant.
// Once the data becomes more complex than this we will need to write a proper tokenizer for
// parsing and formatting
internal void Init(StringView format, bool useInvariantFieldLengths) mut
void Init(StringView format, bool useInvariantFieldLengths) mut
{
literals = new String[6];
for (int i = 0; i < literals.Count; i++)
@ -498,7 +498,7 @@ namespace System.Globalization {
hh = 2;
mm = 2;
ss = 2;
ff = DateTimeFormat.MaxSecondsFractionDigits;
ff = DateTimeFormat.[Friend]MaxSecondsFractionDigits;
}
else {
if (dd < 1 || dd > 2) dd = 2; // The DTFI property has a problem. let's try to make the best of the situation.

View file

@ -273,13 +273,13 @@ namespace System.IO
}
}
internal struct COMDLG_FILTERSPEC
struct COMDLG_FILTERSPEC
{
internal char16* pszName;
internal char16* pszSpec;
public char16* pszName;
public char16* pszSpec;
}
internal enum FDAP : uint32
enum FDAP : uint32
{
FDAP_BOTTOM = 0x00000000,
FDAP_TOP = 0x00000001,

View file

@ -85,7 +85,7 @@ namespace System.IO
abstract class FileDialog : CommonDialog
{
internal abstract Result<DialogResult> RunFileDialog(ref Windows.OpenFileName ofn);
protected abstract Result<DialogResult> RunFileDialog(ref Windows.OpenFileName ofn);
protected override Result<DialogResult> RunDialog(Windows.HWnd hWndOwner)
{
@ -93,9 +93,9 @@ namespace System.IO
}
private const int32 FILEBUFSIZE = 8192;
internal const int32 OPTION_ADDEXTENSION = (int32)0x80000000;
protected const int32 OPTION_ADDEXTENSION = (int32)0x80000000;
internal int32 mOptions;
protected int32 mOptions;
private String mTitle ~ delete _;
private String mInitialDir ~ delete _;
private String mDefaultExt ~ delete _;
@ -323,12 +323,12 @@ namespace System.IO
return .Ok;
}
internal bool GetOption(int32 option)
protected bool GetOption(int32 option)
{
return (mOptions & option) != 0;
}
internal void SetOption(int32 option, bool value)
protected void SetOption(int32 option, bool value)
{
if (value)
{
@ -496,7 +496,7 @@ namespace System.IO
}
}
internal override Result<DialogResult> RunFileDialog(ref Windows.OpenFileName ofn)
protected override Result<DialogResult> RunFileDialog(ref Windows.OpenFileName ofn)
{
bool result = Windows.GetOpenFileNameW(ref ofn);
if (!result)

View file

@ -38,7 +38,7 @@ namespace System.IO
// Make this public sometime.
// The max total path is 260, and the max individual component length is 255.
// For example, D:\<256 char8 file name> isn't legal, even though it's under 260 char8s.
internal const int32 MaxPath = 260;
protected const int32 MaxPath = 260;
private const int32 MaxDirectoryLength = 255;
public static void GetFullPath(String inPartialPath, String outFullPath)
@ -49,7 +49,7 @@ namespace System.IO
});
}
internal static void CheckInvalidPathChars(StringView path, bool checkAdditional = false)
protected static void CheckInvalidPathChars(StringView path, bool checkAdditional = false)
{
}
@ -74,30 +74,30 @@ namespace System.IO
outFileName.Append(inPath);
}
internal static String NormalizePath(String path, bool fullCheck)
static String NormalizePath(String path, bool fullCheck)
{
return NormalizePath(path, fullCheck, MaxPath);
}
internal static String NormalizePath(String path, bool fullCheck, bool expandShortPaths)
static String NormalizePath(String path, bool fullCheck, bool expandShortPaths)
{
return NormalizePath(path, fullCheck, MaxPath, expandShortPaths);
}
internal static String NormalizePath(String path, bool fullCheck, int32 maxPathLength)
static String NormalizePath(String path, bool fullCheck, int32 maxPathLength)
{
return NormalizePath(path, fullCheck, maxPathLength, true);
}
internal static String NormalizePath(String path, bool fullCheck, int32 maxPathLength, bool expandShortPaths)
static String NormalizePath(String path, bool fullCheck, int32 maxPathLength, bool expandShortPaths)
{
//TODO: Implement
return path;
}
internal static String RemoveLongPathPrefix(String path)
static String RemoveLongPathPrefix(String path)
{
//TODO: Implement
return path;
@ -171,7 +171,7 @@ namespace System.IO
// Gets the length of the root DirectoryInfo or whatever DirectoryInfo markers
// are specified for the first part of the DirectoryInfo name.
//
internal static int GetRootLength(String path)
static int GetRootLength(String path)
{
CheckInvalidPathChars(path);
@ -205,7 +205,7 @@ namespace System.IO
#endif //BF_PLATFORM_WINDOWS
}
internal static bool IsDirectorySeparator(char8 c)
static bool IsDirectorySeparator(char8 c)
{
return (c==DirectorySeparatorChar || c == AltDirectorySeparatorChar);
}

View file

@ -34,7 +34,7 @@ namespace System.IO
}
}
internal override Result<DialogResult> RunFileDialog(ref Windows.OpenFileName ofn)
protected override Result<DialogResult> RunFileDialog(ref Windows.OpenFileName ofn)
{
bool result = Windows.GetSaveFileNameW(ref ofn);
if (!result)

View file

@ -3,8 +3,8 @@ namespace System.IO
[CRepr]
struct SecurityAttributes
{
internal int32 mLength = (int32)sizeof(SecurityAttributes);
internal uint8* mSecurityDescriptor = null;
internal int32 mInheritHandle = 0;
int32 mLength = (int32)sizeof(SecurityAttributes);
uint8* mSecurityDescriptor = null;
int32 mInheritHandle = 0;
}
}

View file

@ -179,15 +179,15 @@ namespace System.IO
// with a single allocation.
private sealed class ReadWriteTask : Task<int>, ITaskCompletionAction
{
internal readonly bool _isRead;
internal Stream _stream;
internal uint8 [] _buffer;
internal int _offset;
internal int _count;
readonly bool _isRead;
Stream _stream;
uint8 [] _buffer;
int _offset;
int _count;
private AsyncCallback _callback;
//private ExecutionContext _context;
internal void ClearBeginState() // Used to allow the args to Read/Write to be made available for GC
void ClearBeginState() // Used to allow the args to Read/Write to be made available for GC
{
_stream = null;
_buffer = null;
@ -243,7 +243,7 @@ namespace System.IO
}
}
internal IAsyncResult BeginReadInternal(uint8[] buffer, int offset, int count, AsyncCallback callback, Object state, bool serializeAsynchronously)
IAsyncResult BeginReadInternal(uint8[] buffer, int offset, int count, AsyncCallback callback, Object state, bool serializeAsynchronously)
{
// To avoid a race with a stream's position pointer & generating ----
// conditions with internal buffer indexes in our own streams that
@ -270,12 +270,12 @@ namespace System.IO
// The ReadWriteTask stores all of the parameters to pass to Read.
// As we're currently inside of it, we can get the current task
// and grab the parameters from it.
var thisTask = Task.InternalCurrent as ReadWriteTask;
var thisTask = Task.[Friend]InternalCurrent as ReadWriteTask;
Contract.Assert(thisTask != null, "Inside ReadWriteTask, InternalCurrent should be the ReadWriteTask");
// Do the Read and return the number of bytes read
int bytesRead = thisTask._stream.TryRead(.(thisTask._buffer, thisTask._offset, thisTask._count));
thisTask.ClearBeginState(); // just to help alleviate some memory pressure
int bytesRead = thisTask.[Friend]_stream.TryRead(.(thisTask.[Friend]_buffer, thisTask.[Friend]_offset, thisTask.[Friend]_count));
thisTask.[Friend]ClearBeginState(); // just to help alleviate some memory pressure
return bytesRead;
}, state, this, buffer, offset, count, callback);
@ -308,7 +308,7 @@ namespace System.IO
{
Runtime.FatalError();
}
else if (!readTask._isRead)
else if (!readTask.[Friend]_isRead)
{
Runtime.FatalError();
}

View file

@ -208,7 +208,7 @@ namespace System.IO
StreamReader mStreamReader;
WaitEvent mDoneEvent = new WaitEvent() ~ delete _;
internal this(StreamReader streamReader)
public this(StreamReader streamReader)
{
Debug.WriteLine("ReadLineTask this {0}", this);
@ -216,7 +216,7 @@ namespace System.IO
ThreadPool.QueueUserWorkItem(new => Proc);
}
internal ~this()
public ~this()
{
//Debug.WriteLine("ReadLineTask ~this waiting {0}", this);
mDoneEvent.WaitFor();
@ -384,7 +384,7 @@ namespace System.IO
}
}
internal virtual Result<int> ReadBuffer()
protected virtual Result<int> ReadBuffer()
{
mCharLen = 0;
mCharPos = 0;
@ -578,7 +578,7 @@ namespace System.IO
String mCurrentLine;
Result<void> mLastReadResult;
internal this(StreamReader streamReader)
public this(StreamReader streamReader)
{
mStreamReader = streamReader;
mCurrentLine = new String();

View file

@ -260,7 +260,7 @@ namespace System
{
if (x.IsNegative)
{
return Double.NegativeZero;
return Double.[Friend]NegativeZero;
}
}
double alternativeResult;

View file

@ -129,47 +129,47 @@ namespace System.Net
#if BF_PLATFORM_WINDOWS
[Import("wsock32.lib"), CLink, StdCall]
internal static extern int32 WSAStartup(uint16 versionRequired, WSAData* wsaData);
static extern int32 WSAStartup(uint16 versionRequired, WSAData* wsaData);
[Import("wsock32.lib"), CLink, StdCall]
internal static extern int32 WSAGetLastError();
static extern int32 WSAGetLastError();
#else
[CLink]
internal static int32 errno;
#endif
[CLink, StdCall]
internal static extern HostEnt* gethostbyname(char8* name);
static extern HostEnt* gethostbyname(char8* name);
[CLink, StdCall]
internal static extern HSocket socket(int32 af, int32 type, int32 protocol);
static extern HSocket socket(int32 af, int32 type, int32 protocol);
[CLink, StdCall]
internal static extern int32 connect(HSocket s, SockAddr* name, int32 nameLen);
static extern int32 connect(HSocket s, SockAddr* name, int32 nameLen);
[CLink, StdCall]
internal static extern int32 closesocket(HSocket s);
static extern int32 closesocket(HSocket s);
[CLink, StdCall]
internal static extern int32 bind(HSocket s, SockAddr* name, int32 nameLen);
static extern int32 bind(HSocket s, SockAddr* name, int32 nameLen);
[CLink, StdCall]
internal static extern int32 listen(HSocket s, int32 backlog);
static extern int32 listen(HSocket s, int32 backlog);
[CLink, StdCall]
internal static extern HSocket accept(HSocket s, SockAddr* addr, int32* addrLen);
static extern HSocket accept(HSocket s, SockAddr* addr, int32* addrLen);
[CLink, StdCall]
internal static extern int32 ioctlsocket(HSocket s, int cmd, int* argp);
static extern int32 ioctlsocket(HSocket s, int cmd, int* argp);
[CLink, StdCall]
internal static extern int32 select(int nfds, FDSet* readFDS, FDSet* writeFDS, FDSet* exceptFDS, TimeVal* timeVal);
static extern int32 select(int nfds, FDSet* readFDS, FDSet* writeFDS, FDSet* exceptFDS, TimeVal* timeVal);
[CLink, StdCall]
internal static extern int32 recv(HSocket s, void* ptr, int32 len, int32 flags);
static extern int32 recv(HSocket s, void* ptr, int32 len, int32 flags);
[CLink, StdCall]
internal static extern int32 send(HSocket s, void* ptr, int32 len, int32 flags);
static extern int32 send(HSocket s, void* ptr, int32 len, int32 flags);
public ~this()
{

View file

@ -6,8 +6,8 @@ namespace System
{
struct Nullable<T> where T : struct
{
internal T mValue;
internal bool mHasValue;
T mValue;
bool mHasValue;
public this(T value)
{

View file

@ -36,7 +36,7 @@ using System.Threading;
namespace System
{
internal sealed class NumberFormatter
sealed class NumberFormatter
{
#region Static Fields

View file

@ -23,7 +23,7 @@ namespace System
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
[NoShow]
internal int32 GetFlags()
int32 GetFlags()
{
return (int32)mClassVData & 0xFF;
}
@ -50,16 +50,16 @@ namespace System
#else
type = mClassVData.mType;
#endif
if ((type.mTypeFlags & TypeFlags.Boxed) != 0)
if ((type.[Friend]mTypeFlags & TypeFlags.Boxed) != 0)
{
//int32 underlyingType = (int32)((TypeInstance)type).mUnderlyingType;
type = Type.GetType(((TypeInstance)type).mUnderlyingType);
type = Type.[Friend]GetType(((TypeInstance)type).[Friend]mUnderlyingType);
}
return type;
}
[NoShow]
internal Type RawGetType()
Type RawGetType()
{
Type type;
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
@ -75,7 +75,7 @@ namespace System
[NoShow]
public virtual Object DynamicCastToTypeId(int32 typeId)
{
if (typeId == (int32)RawGetType().mTypeId)
if (typeId == (int32)RawGetType().[Friend]mTypeId)
return this;
return null;
}

View file

@ -10,7 +10,7 @@ namespace System.Reflection
public static Result<void> GetCustomAttribute(void* inAttrData, Type attributeType, Object targetAttr)
{
TypeId findTypeId = attributeType.mTypeId;
TypeId findTypeId = attributeType.[Friend]mTypeId;
void* data = inAttrData;
data++;
@ -32,11 +32,11 @@ namespace System.Reflection
var methodIdx = Decode!<uint16>(data);
Type attrType = Type.GetType(typeId);
Type attrType = Type.[Friend]GetType(typeId);
TypeInstance attrTypeInst = attrType as TypeInstance;
MethodInfo methodInfo = .(attrTypeInst, attrTypeInst.mMethodDataPtr + methodIdx);
MethodInfo methodInfo = .(attrTypeInst, attrTypeInst.[Friend]mMethodDataPtr + methodIdx);
Object[] args = scope Object[methodInfo.mMethodData.mParamCount];
Object[] args = scope Object[methodInfo.[Friend]mMethodData.mParamCount];
int argIdx = 0;
while (data < endPtr)

View file

@ -4,8 +4,8 @@ namespace System.Reflection
{
static (Type type, void* ptr) GetTypeAndPointer(Object obj)
{
var objType = obj.RawGetType();
void* dataPtr = (uint8*)Internal.UnsafeCastToPtr(obj) + objType.mMemberDataOffset;
var objType = obj.[Friend]RawGetType();
void* dataPtr = (uint8*)Internal.UnsafeCastToPtr(obj) + objType.[Friend]mMemberDataOffset;
if (objType.IsBoxed)
objType = objType.UnderlyingType;
if (objType.IsTypedPrimitive)
@ -16,7 +16,7 @@ namespace System.Reflection
public static Result<int64> ToInt64(Object obj)
{
var (objType, dataPtr) = GetTypeAndPointer(obj);
switch (objType.mTypeCode)
switch (objType.[Friend]mTypeCode)
{
case .Int8: return (.)*(int8*)dataPtr;
case .Int16: return (.)*(int16*)dataPtr;
@ -34,7 +34,7 @@ namespace System.Reflection
public static bool IntCanFit(int64 val, Type type)
{
switch (type.mTypeCode)
switch (type.[Friend]mTypeCode)
{
case .Int8: return (val >= -0x80) && (val <= 0x7F);
case .Int16: return (val >= -0x8000) && (val <= 0x7FFF);
@ -68,7 +68,7 @@ namespace System.Reflection
if (objType.IsInteger)
{
int64 intVal = ToInt64(obj);
switch (type.mTypeCode)
switch (type.[Friend]mTypeCode)
{
case .Float:
float val = (.)intVal;
@ -86,8 +86,8 @@ namespace System.Reflection
}
else if (objType.IsFloatingPoint)
{
if ((type.mTypeCode == .Double) &&
(objType.mTypeCode == .Float))
if ((type.[Friend]mTypeCode == .Double) &&
(objType.[Friend]mTypeCode == .Float))
{
double val = (.)*(float*)dataPtr;
return Variant.Create(type, &val);

View file

@ -11,8 +11,8 @@ namespace System.Reflection
InvalidValueType
}
internal TypeInstance mTypeInstance;
internal TypeInstance.FieldData* mFieldData;
TypeInstance mTypeInstance;
TypeInstance.FieldData* mFieldData;
public this(TypeInstance typeInstance, TypeInstance.FieldData* fieldData)
{
@ -32,7 +32,7 @@ namespace System.Reflection
{
get
{
return Type.GetType(mFieldData.mFieldTypeId);
return Type.[Friend]GetType(mFieldData.mFieldTypeId);
}
}
@ -49,13 +49,13 @@ namespace System.Reflection
int32 dataOffsetAdjust = 0;
if (mTypeInstance.IsStruct)
{
Type boxedType = obj.RawGetType();
Type boxedType = obj.[Friend]RawGetType();
bool typeMatched = false;
if (boxedType.IsBoxed)
{
if (mTypeInstance == boxedType.UnderlyingType)
{
dataOffsetAdjust = boxedType.mMemberDataOffset;
dataOffsetAdjust = boxedType.[Friend]mMemberDataOffset;
typeMatched = true;
}
}
@ -63,11 +63,11 @@ namespace System.Reflection
return .Err(.InvalidTargetType); // "Invalid target type");
}
Type fieldType = Type.GetType(mFieldData.mFieldTypeId);
Type fieldType = Type.[Friend]GetType(mFieldData.mFieldTypeId);
void* fieldDataAddr = ((uint8*)(void*)obj) + mFieldData.mDataOffset + dataOffsetAdjust;
Type rawValueType = value.RawGetType();
void* valueDataAddr = ((uint8*)(void*)value) + rawValueType.mMemberDataOffset;
Type rawValueType = value.[Friend]RawGetType();
void* valueDataAddr = ((uint8*)(void*)value) + rawValueType.[Friend]mMemberDataOffset;
Type valueType = value.GetType();
@ -76,7 +76,7 @@ namespace System.Reflection
if (valueType == fieldType)
{
Internal.MemCpy(fieldDataAddr, valueDataAddr, fieldType.mSize);
Internal.MemCpy(fieldDataAddr, valueDataAddr, fieldType.[Friend]mSize);
}
else
{
@ -107,13 +107,13 @@ namespace System.Reflection
int32 dataOffsetAdjust = 0;
if (mTypeInstance.IsStruct)
{
Type boxedType = obj.RawGetType();
Type boxedType = obj.[Friend]RawGetType();
bool typeMatched = false;
if (boxedType.IsBoxed)
{
if (mTypeInstance == boxedType.UnderlyingType)
{
dataOffsetAdjust = boxedType.mMemberDataOffset;
dataOffsetAdjust = boxedType.[Friend]mMemberDataOffset;
typeMatched = true;
}
}
@ -121,7 +121,7 @@ namespace System.Reflection
return .Err;//("Invalid target type");
}
Type fieldType = Type.GetType(mFieldData.mFieldTypeId);
Type fieldType = Type.[Friend]GetType(mFieldData.mFieldTypeId);
void* dataAddr = ((uint8*)(void*)obj) + mFieldData.mDataOffset + dataOffsetAdjust;
@ -143,7 +143,7 @@ namespace System.Reflection
if (mFieldData.mCustomAttributesIdx == -1)
return .Err;
void* data = mTypeInstance.mCustomAttrDataPtr[mFieldData.mCustomAttributesIdx];
void* data = mTypeInstance.[Friend]mCustomAttrDataPtr[mFieldData.mCustomAttributesIdx];
T attrInst = ?;
switch (AttributeInfo.GetCustomAttribute(data, typeof(T), &attrInst))
@ -156,12 +156,12 @@ namespace System.Reflection
void* GetDataPtrAndType(Object value, out Type type)
{
type = value.RawGetType();
type = value.[Friend]RawGetType();
/*if (type.IsStruct)
return &value;*/
if (type.IsBoxed)
return ((uint8*)(void*)value) + type.mMemberDataOffset;
return ((uint8*)(void*)value) + type.[Friend]mMemberDataOffset;
return ((uint8*)(void*)value);
}
@ -176,15 +176,15 @@ namespace System.Reflection
targetDataAddr = (uint8*)targetDataAddr + mFieldData.mDataOffset;
Type fieldType = Type.GetType(mFieldData.mFieldTypeId);
Type fieldType = Type.[Friend]GetType(mFieldData.mFieldTypeId);
if (tMember.mTypeCode == TypeCode.Object)
if (tMember.[Friend]mTypeCode == TypeCode.Object)
{
if (!tTarget.IsSubtypeOf(mTypeInstance))
Runtime.FatalError();
value = *(TMember*)targetDataAddr;
}
else if (fieldType.mTypeCode == tMember.mTypeCode)
else if (fieldType.[Friend]mTypeCode == tMember.[Friend]mTypeCode)
{
Internal.MemCpy(&value, targetDataAddr, tMember.Size);
}
@ -208,16 +208,16 @@ namespace System.Reflection
targetDataAddr = (uint8*)targetDataAddr + mFieldData.mDataOffset;
Type fieldType = Type.GetType(mFieldData.mFieldTypeId);
Type fieldType = Type.[Friend]GetType(mFieldData.mFieldTypeId);
TypeCode typeCode = fieldType.mTypeCode;
TypeCode typeCode = fieldType.[Friend]mTypeCode;
if (typeCode == TypeCode.Enum)
typeCode = fieldType.UnderlyingType.mTypeCode;
typeCode = fieldType.UnderlyingType.[Friend]mTypeCode;
if (typeCode == TypeCode.Object)
{
value.mStructType = 0;
value.mData = *(int*)targetDataAddr;
value.[Friend]mStructType = 0;
value.[Friend]mData = *(int*)targetDataAddr;
}
else
{
@ -244,21 +244,21 @@ namespace System.Reflection
#unwarn
void* targetDataAddr = (void*)(int)mFieldData.mConstValue;
Type fieldType = Type.GetType(mFieldData.mFieldTypeId);
value.mStructType = (int)(void*)fieldType;
Type fieldType = Type.[Friend]GetType(mFieldData.mFieldTypeId);
value.[Friend]mStructType = (int)(void*)fieldType;
TypeCode typeCode = fieldType.mTypeCode;
TypeCode typeCode = fieldType.[Friend]mTypeCode;
if (typeCode == TypeCode.Enum)
typeCode = fieldType.UnderlyingType.mTypeCode;
typeCode = fieldType.UnderlyingType.[Friend]mTypeCode;
if (typeCode == TypeCode.Int32)
{
*(int32*)&value.mData = *(int32*)targetDataAddr;
*(int32*)&value.[Friend]mData = *(int32*)targetDataAddr;
}
else if (typeCode == TypeCode.Object)
{
value.mStructType = 0;
value.mData = (int)targetDataAddr;
value.[Friend]mStructType = 0;
value.[Friend]mData = (int)targetDataAddr;
}
else
{
@ -268,13 +268,13 @@ namespace System.Reflection
return value;
}
internal struct Enumerator : IEnumerator<FieldInfo>
public struct Enumerator : IEnumerator<FieldInfo>
{
BindingFlags mBindingFlags;
TypeInstance mTypeInstance;
int32 mIdx;
internal this(TypeInstance typeInst, BindingFlags bindingFlags)
public this(TypeInstance typeInst, BindingFlags bindingFlags)
{
mTypeInstance = typeInst;
mBindingFlags = bindingFlags;
@ -298,9 +298,9 @@ namespace System.Reflection
for (;;)
{
mIdx++;
if (mIdx == mTypeInstance.mFieldDataCount)
if (mIdx == mTypeInstance.[Friend]mFieldDataCount)
return false;
var fieldData = &mTypeInstance.mFieldDataPtr[mIdx];
var fieldData = &mTypeInstance.[Friend]mFieldDataPtr[mIdx];
bool matches = (mBindingFlags.HasFlag(BindingFlags.Static) && (fieldData.mFlags.HasFlag(FieldFlags.Static)));
matches |= (mBindingFlags.HasFlag(BindingFlags.Instance) && (!fieldData.mFlags.HasFlag(FieldFlags.Static)));
if (matches)
@ -313,7 +313,7 @@ namespace System.Reflection
{
get
{
var fieldData = &mTypeInstance.mFieldDataPtr[mIdx];
var fieldData = &mTypeInstance.[Friend]mFieldDataPtr[mIdx];
return FieldInfo(mTypeInstance, fieldData);
}
}

View file

@ -9,14 +9,14 @@ namespace System.Reflection
[CRepr, AlwaysInclude]
public struct MethodInfo
{
internal TypeInstance mTypeInstance;
internal TypeInstance.MethodData* mMethodData;
TypeInstance mTypeInstance;
TypeInstance.MethodData* mMethodData;
public StringView Name
{
get
{
return mMethodData.mName;
return mMethodData.[Friend]mName;
}
}
@ -24,7 +24,7 @@ namespace System.Reflection
{
get
{
return mMethodData.mParamCount;
return mMethodData.[Friend]mParamCount;
}
}
@ -49,7 +49,7 @@ namespace System.Reflection
public Type GetParamType(int paramIdx)
{
Debug.Assert((uint)paramIdx < (uint)mMethodData.mParamCount);
return Type.GetType(mMethodData.mParamData[paramIdx].mType);
return Type.[Friend]GetType(mMethodData.mParamData[paramIdx].mType);
}
public StringView GetParamName(int paramIdx)
@ -77,7 +77,7 @@ namespace System.Reflection
public Result<Variant, CallError> Invoke(Object target, params Object[] args)
{
var retType = Type.GetType(mMethodData.mReturnType);
var retType = Type.[Friend]GetType(mMethodData.mReturnType);
FFIABI abi = .Default;
#if BF_PLATFORM_WINDOWS && BF_32_BIT
@ -112,17 +112,17 @@ namespace System.Reflection
SplatArg(type.BaseType, ptr);
bool isEnum = type.IsEnum;
for (int fieldIdx < type.mFieldDataCount)
for (int fieldIdx < type.[Friend]mFieldDataCount)
{
let fieldData = ref type.mFieldDataPtr[fieldIdx];
let fieldType = Type.GetType(fieldData.mFieldTypeId);
let fieldData = ref type.[Friend]mFieldDataPtr[fieldIdx];
let fieldType = Type.[Friend]GetType(fieldData.mFieldTypeId);
if (fieldData.mFlags.HasFlag(.Static))
{
if (isEnum)
break; // Already got payload and discriminator
continue;
}
if (fieldType.mSize == 0)
if (fieldType.[Friend]mSize == 0)
continue;
if (fieldType.IsStruct)
@ -142,8 +142,8 @@ namespace System.Reflection
bool unbox = false;
bool unboxToPtr = false;
let argType = arg.RawGetType();
void* dataPtr = (uint8*)Internal.UnsafeCastToPtr(arg) + argType.mMemberDataOffset;
let argType = arg.[Friend]RawGetType();
void* dataPtr = (uint8*)Internal.UnsafeCastToPtr(arg) + argType.[Friend]mMemberDataOffset;
bool isValid = true;
if (paramType.IsValueType)
@ -201,20 +201,20 @@ namespace System.Reflection
}
else if (splat)
{
if (paramTypeInst.mFieldDataCount > 0)
if (paramTypeInst.[Friend]mFieldDataCount > 0)
{
SplatArg(paramTypeInst, dataPtr);
}
else
{
let splatData = (TypeInstance.FieldSplatData*)paramTypeInst.mFieldDataPtr;
let splatData = (TypeInstance.FieldSplatData*)paramTypeInst.[Friend]mFieldDataPtr;
for (int splatIdx < 3)
{
let splatTypeId = splatData.mSplatTypes[splatIdx];
if (splatTypeId == 0)
break;
let splatType = Type.GetType(splatTypeId);
let splatType = Type.[Friend]GetType(splatTypeId);
ffiParamList.Add(GetFFIType!:mixin(splatType));
ffiArgList.Add((uint8*)dataPtr + splatData.mSplatOffsets[splatIdx]);
}
@ -290,7 +290,7 @@ namespace System.Reflection
for (var arg in ref args)
{
let paramData = ref mMethodData.mParamData[@arg];
let argType = Type.GetType(paramData.mType);
let argType = Type.[Friend]GetType(paramData.mType);
AddArg!::(@arg, arg, &arg, argType, paramData.mParamFlags.HasFlag(.Splat));
}
@ -336,13 +336,13 @@ namespace System.Reflection
return retVal;
}
internal struct Enumerator : IEnumerator<MethodInfo>
public struct Enumerator : IEnumerator<MethodInfo>
{
BindingFlags mBindingFlags;
TypeInstance mTypeInstance;
int32 mIdx;
internal this(TypeInstance typeInst, BindingFlags bindingFlags)
public this(TypeInstance typeInst, BindingFlags bindingFlags)
{
mTypeInstance = typeInst;
mBindingFlags = bindingFlags;
@ -366,10 +366,10 @@ namespace System.Reflection
for (;;)
{
mIdx++;
if (mIdx == mTypeInstance.mMethodDataCount)
if (mIdx == mTypeInstance.[Friend]mMethodDataCount)
return false;
#unwarn
var methodData = &mTypeInstance.mMethodDataPtr[mIdx];
var methodData = &mTypeInstance.[Friend]mMethodDataPtr[mIdx];
/*bool matches = (mBindingFlags.HasFlag(BindingFlags.Static) && (methodData.mFlags.HasFlag(FieldFlags.Static)));
matches |= (mBindingFlags.HasFlag(BindingFlags.Instance) && (!methodData.mFlags.HasFlag(FieldFlags.Static)));*/
bool matches = true;
@ -383,7 +383,7 @@ namespace System.Reflection
{
get
{
var methodData = &mTypeInstance.mMethodDataPtr[mIdx];
var methodData = &mTypeInstance.[Friend]mMethodDataPtr[mIdx];
return MethodInfo(mTypeInstance, methodData);
}
}

View file

@ -21,14 +21,14 @@ namespace System
MethodInfo matched = default;
for (let methodInfo in GetMethods(bindingFlags))
{
if (methodInfo.mMethodData.mName == methodName)
if (methodInfo.[Friend]mMethodData.[Friend]mName == methodName)
{
if (matched.mMethodData != null)
if (matched.[Friend]mMethodData != null)
return .Err(.MultipleResults);
}
}
if (matched.mMethodData == null)
if (matched.[Friend]mMethodData == null)
return .Err(.NoResults);
return .Ok(matched);
}
@ -44,7 +44,7 @@ namespace System.Reflection
for (int32 i = 0; i < mFieldDataCount; i++)
{
FieldData* fieldData = &mFieldDataPtr[i];
if (fieldData.mName == fieldName)
if (fieldData.[Friend]mName == fieldName)
return FieldInfo(this, fieldData);
}
return .Err;

View file

@ -150,7 +150,7 @@ namespace System
static Type Object_GetType(Object obj)
{
#if BF_DBG_RUNTIME
return obj.RawGetType();
return obj.[Friend]RawGetType();
#else
return null;
#endif

View file

@ -12,7 +12,7 @@ namespace System.Threading.Tasks
{
private readonly Task m_task;
internal this(Task task)
public this(Task task)
{
//Contract.Requires(task != null, "Constructing an awaiter requires a task to await.");
m_task = task;
@ -28,10 +28,10 @@ namespace System.Threading.Tasks
ValidateEnd(m_task);
}
internal static void ValidateEnd(Task task)
public static void ValidateEnd(Task task)
{
// Fast checks that can be inlined.
if (task.IsWaitNotificationEnabledOrNotRanToCompletion)
if (task.[Friend]IsWaitNotificationEnabledOrNotRanToCompletion)
{
// If either the end await bit is set or we're not completed successfully,
// fall back to the slower path.
@ -50,7 +50,7 @@ namespace System.Threading.Tasks
// but where for one reason or another synchronous rather than asynchronous waiting is needed.
if (!task.IsCompleted)
{
bool taskCompleted = task.InternalWait(Timeout.Infinite, default(CancellationToken));
bool taskCompleted = task.[Friend]InternalWait(Timeout.Infinite, default(CancellationToken));
Contract.Assert(taskCompleted, "With an infinite timeout, the task should have always completed.");
}
@ -59,7 +59,7 @@ namespace System.Threading.Tasks
//task.NotifyDebuggerOfWaitCompletionIfNecessary();
// And throw an exception if the task is faulted or canceled.
if (!task.IsRanToCompletion)
if (!task.[Friend]IsRanToCompletion)
{
ThrowUnimplemented();
//ThrowForNonSuccess(task);
@ -71,7 +71,7 @@ namespace System.Threading.Tasks
{
private readonly Task<TResult> m_task;
internal this(Task<TResult> task)
public this(Task<TResult> task)
{
//Contract.Requires(task != null, "Constructing an awaiter requires a task to await.");
m_task = task;
@ -85,7 +85,7 @@ namespace System.Threading.Tasks
public TResult GetResult()
{
TaskAwaiter.ValidateEnd(m_task);
return m_task.ResultOnSuccess;
return m_task.[Friend]ResultOnSuccess;
}
}
}

View file

@ -190,7 +190,7 @@ namespace System
private int mIndex;
private T* mCurrent;
internal this(Span<T> list)
public this(Span<T> list)
{
mList = list;
mIndex = 0;

View file

@ -745,7 +745,7 @@ namespace System
Append(str.Ptr + offset, length);
}
internal void Append(char8* appendPtr)
public void Append(char8* appendPtr)
{
int_strsize length = StrLen(appendPtr);
int_strsize newCurrentIndex = mLength + length;
@ -767,7 +767,7 @@ namespace System
mLength = newCurrentIndex;
}
internal void Append(char8* appendPtr, int length)
public void Append(char8* appendPtr, int length)
{
int newCurrentIndex = mLength + length;
char8* ptr;
@ -788,7 +788,7 @@ namespace System
mLength = (int_strsize)newCurrentIndex;
}
internal void Append(char8[] arr, int idx, int length)
public void Append(char8[] arr, int idx, int length)
{
int newCurrentIndex = mLength + length;
char8* ptr;
@ -1474,7 +1474,7 @@ namespace System
mLength = newLength;
}
internal static bool EqualsHelper(char8* a, char8* b, int length)
static bool EqualsHelper(char8* a, char8* b, int length)
{
for (int i = 0; i < length; i++)
if (a[i] != b[i])
@ -1482,7 +1482,7 @@ namespace System
return true;
}
internal static bool EqualsIgnoreCaseHelper(char8* a, char8* b, int length)
static bool EqualsIgnoreCaseHelper(char8* a, char8* b, int length)
{
char8* curA = a;
char8* curB = b;
@ -2682,7 +2682,7 @@ namespace System
return true;
if ((ptr1 == null) || (ptr2 == null))
return false;
return String.EqualsHelper(ptr1, ptr2, val1.mLength);
return String.[Friend]EqualsHelper(ptr1, ptr2, val1.mLength);
}
public static bool operator==(StringView val1, String val2)
@ -2695,7 +2695,7 @@ namespace System
return true;
if ((ptr1 == null) || (ptr2 == null))
return false;
return String.EqualsHelper(ptr1, ptr2, val1.mLength);
return String.[Friend]EqualsHelper(ptr1, ptr2, val1.mLength);
}
public static int Compare(StringView val1, StringView val2, bool ignoreCase = false)
@ -2710,7 +2710,7 @@ namespace System
{
if (mLength != str.[Friend]mLength)
return false;
return String.EqualsHelper(str.Ptr, mPtr, mLength);
return String.[Friend]EqualsHelper(str.Ptr, mPtr, mLength);
}
public bool Equals(StringView str, bool ignoreCase)
@ -2718,8 +2718,8 @@ namespace System
if (mLength != str.[Friend]mLength)
return false;
if (ignoreCase)
return String.EqualsIgnoreCaseHelper(str.Ptr, mPtr, mLength);
return String.EqualsHelper(str.Ptr, mPtr, mLength);
return String.[Friend]EqualsIgnoreCaseHelper(str.Ptr, mPtr, mLength);
return String.[Friend]EqualsHelper(str.Ptr, mPtr, mLength);
}
public int IndexOf(StringView subStr, bool ignoreCase = false)
@ -2813,8 +2813,8 @@ namespace System
if (mLength < b.mLength)
return false;
if (comparisonType == StringComparison.OrdinalIgnoreCase)
return String.EqualsIgnoreCaseHelper(this.Ptr, b.Ptr, b.Length);
return String.EqualsHelper(this.Ptr, b.Ptr, b.mLength);
return String.[Friend]EqualsIgnoreCaseHelper(this.Ptr, b.Ptr, b.Length);
return String.[Friend]EqualsHelper(this.Ptr, b.Ptr, b.mLength);
}
public bool EndsWith(StringView b, StringComparison comparisonType = StringComparison.Ordinal)
@ -2822,8 +2822,8 @@ namespace System
if (mLength < b.mLength)
return false;
if (comparisonType == StringComparison.OrdinalIgnoreCase)
return String.EqualsIgnoreCaseHelper(Ptr + mLength - b.mLength, b.Ptr, b.mLength);
return String.EqualsHelper(this.Ptr + mLength - b.mLength, b.Ptr, b.mLength);
return String.[Friend]EqualsIgnoreCaseHelper(Ptr + mLength - b.mLength, b.Ptr, b.mLength);
return String.[Friend]EqualsHelper(this.Ptr + mLength - b.mLength, b.Ptr, b.mLength);
}
public void TrimEnd() mut

View file

@ -25,7 +25,7 @@ namespace System.Threading
{
get
{
return m_source != null && m_source.CanBeCanceled;
return m_source != null && m_source.[Friend]CanBeCanceled;
}
}
}

View file

@ -18,7 +18,7 @@ namespace System.Threading
get { return m_state >= NOTIFYING; }
}
internal bool CanBeCanceled
bool CanBeCanceled
{
get { return m_state != CANNOT_BE_CANCELED; }
}

View file

@ -2,9 +2,9 @@ namespace System.Threading
{
struct SpinWait
{
internal const int YIELD_THRESHOLD = 10; // When to switch over to a true yield.
internal const int SLEEP_0_EVERY_HOW_MANY_TIMES = 5; // After how many yields should we Sleep(0)?
internal const int SLEEP_1_EVERY_HOW_MANY_TIMES = 20; // After how many yields should we Sleep(1)?
const int YIELD_THRESHOLD = 10; // When to switch over to a true yield.
const int SLEEP_0_EVERY_HOW_MANY_TIMES = 5; // After how many yields should we Sleep(0)?
const int SLEEP_1_EVERY_HOW_MANY_TIMES = 20; // After how many yields should we Sleep(1)?
private int m_count;

View file

@ -9,11 +9,11 @@ namespace System.Threading.Tasks
{
public class Task<TResult> : Task
{
internal TResult m_result; // The value itself, if set.
protected TResult m_result; // The value itself, if set.
protected bool mHasCompleted;
protected int32 mRefCount = 1;
internal TResult ResultOnSuccess
TResult ResultOnSuccess
{
get
{
@ -24,7 +24,7 @@ namespace System.Threading.Tasks
public TResult Result
{
get { return IsWaitNotificationEnabledOrNotRanToCompletion ? GetResultCore(true) : m_result; }
get { return this.[Friend]IsWaitNotificationEnabledOrNotRanToCompletion ? GetResultCore(true) : m_result; }
}
protected this()
@ -33,14 +33,14 @@ namespace System.Threading.Tasks
}
public this(Func<Object, TResult> func, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
: this(func, state, Task.InternalCurrentIfAttached(creationOptions), cancellationToken,
: this(func, state, Task.[Friend]InternalCurrentIfAttached(creationOptions), cancellationToken,
creationOptions, InternalTaskOptions.None, null)
{
//StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
//PossiblyCaptureContext(ref stackMark);
}
internal this(Func<TResult> valueSelector, Task parent, CancellationToken cancellationToken,
this(Func<TResult> valueSelector, Task parent, CancellationToken cancellationToken,
TaskCreationOptions creationOptions, InternalTaskOptions internalOptions, TaskScheduler scheduler) :
base(valueSelector, null, parent, cancellationToken, creationOptions, internalOptions, scheduler)
{
@ -50,7 +50,7 @@ namespace System.Threading.Tasks
}
}
internal this(Delegate valueSelector, Object state, Task parent, CancellationToken cancellationToken,
this(Delegate valueSelector, Object state, Task parent, CancellationToken cancellationToken,
TaskCreationOptions creationOptions, InternalTaskOptions internalOptions, TaskScheduler scheduler) :
base(valueSelector, state, parent, cancellationToken, creationOptions, internalOptions, scheduler)
{
@ -85,10 +85,10 @@ namespace System.Threading.Tasks
}
// Implements Result. Result delegates to this method if the result isn't already available.
internal TResult GetResultCore(bool waitCompletionNotification)
protected TResult GetResultCore(bool waitCompletionNotification)
{
// If the result has not been calculated yet, wait for it.
if (!IsCompleted) InternalWait(Timeout.Infinite, default(CancellationToken)); // won't throw if task faulted or canceled; that's handled below
if (!IsCompleted) this.[Friend]InternalWait(Timeout.Infinite, default(CancellationToken)); // won't throw if task faulted or canceled; that's handled below
// Notify the debugger of the wait completion if it's requested such a notification
//TODO: Implement

View file

@ -11,9 +11,9 @@ namespace System.Threading.Tasks
class Task : IAsyncResult, IThreadPoolWorkItem
{
[ThreadStatic]
internal static Task t_currentTask; // The currently executing task.
static Task t_currentTask; // The currently executing task.
internal Object m_action ~ delete _; // The body of the task. Might be Action<object>, Action<TState> or Action. Or possibly a Func.
Object m_action ~ delete _; // The body of the task. Might be Action<object>, Action<TState> or Action. Or possibly a Func.
// If m_action is set to null it will indicate that we operate in the
// "externally triggered completion" mode, which is exclusively meant
// for the signalling Task<TResult> (aka. promise). In this mode,
@ -21,10 +21,10 @@ namespace System.Threading.Tasks
// the completion event which will be set when the Future class calls Finish().
// But the event would now be signalled if Cancel() is called
internal Object m_stateObject; // A state object that can be optionally supplied, passed to action.
internal TaskScheduler m_taskScheduler; // The task scheduler this task runs under.
internal readonly Task m_parent; // A task's parent, or null if parent-less.
internal volatile int32 m_stateFlags;
protected Object m_stateObject; // A state object that can be optionally supplied, passed to action.
protected TaskScheduler m_taskScheduler; // The task scheduler this task runs under.
protected readonly Task m_parent; // A task's parent, or null if parent-less.
protected volatile int32 m_stateFlags;
// m_continuationObject is set to this when the task completes.
private static readonly Object s_taskCompletionSentinel = new Object() ~ delete _;
@ -41,22 +41,22 @@ namespace System.Threading.Tasks
private const int CANCELLATION_REQUESTED = 0x1;//
private const int32 OptionsMask = 0xFFFF; // signifies the Options portion of m_stateFlags bin: 0000 0000 0000 0000 1111 1111 1111 1111
internal const int32 TASK_STATE_STARTED = 0x10000; //bin: 0000 0000 0000 0001 0000 0000 0000 0000
internal const int32 TASK_STATE_DELEGATE_INVOKED = 0x20000; //bin: 0000 0000 0000 0010 0000 0000 0000 0000
internal const int32 TASK_STATE_DISPOSED = 0x40000; //bin: 0000 0000 0000 0100 0000 0000 0000 0000
internal const int32 TASK_STATE_EXCEPTIONOBSERVEDBYPARENT = 0x80000; //bin: 0000 0000 0000 1000 0000 0000 0000 0000
internal const int32 TASK_STATE_CANCELLATIONACKNOWLEDGED = 0x100000; //bin: 0000 0000 0001 0000 0000 0000 0000 0000
internal const int32 TASK_STATE_FAULTED = 0x200000; //bin: 0000 0000 0010 0000 0000 0000 0000 0000
internal const int32 TASK_STATE_CANCELED = 0x400000; //bin: 0000 0000 0100 0000 0000 0000 0000 0000
internal const int32 TASK_STATE_WAITING_ON_CHILDREN = 0x800000; //bin: 0000 0000 1000 0000 0000 0000 0000 0000
internal const int32 TASK_STATE_RAN_TO_COMPLETION = 0x01000000; //bin: 0000 0001 0000 0000 0000 0000 0000 0000
internal const int32 TASK_STATE_WAITINGFORACTIVATION = 0x02000000; //bin: 0000 0010 0000 0000 0000 0000 0000 0000
internal const int32 TASK_STATE_COMPLETION_RESERVED = 0x04000000; //bin: 0000 0100 0000 0000 0000 0000 0000 0000
internal const int32 TASK_STATE_THREAD_WAS_ABORTED = 0x08000000; //bin: 0000 1000 0000 0000 0000 0000 0000 0000
internal const int32 TASK_STATE_WAIT_COMPLETION_NOTIFICATION = 0x10000000; //bin: 0001 0000 0000 0000 0000 0000 0000 0000
protected const int32 TASK_STATE_STARTED = 0x10000; //bin: 0000 0000 0000 0001 0000 0000 0000 0000
protected const int32 TASK_STATE_DELEGATE_INVOKED = 0x20000; //bin: 0000 0000 0000 0010 0000 0000 0000 0000
protected const int32 TASK_STATE_DISPOSED = 0x40000; //bin: 0000 0000 0000 0100 0000 0000 0000 0000
protected const int32 TASK_STATE_EXCEPTIONOBSERVEDBYPARENT = 0x80000; //bin: 0000 0000 0000 1000 0000 0000 0000 0000
protected const int32 TASK_STATE_CANCELLATIONACKNOWLEDGED = 0x100000; //bin: 0000 0000 0001 0000 0000 0000 0000 0000
protected const int32 TASK_STATE_FAULTED = 0x200000; //bin: 0000 0000 0010 0000 0000 0000 0000 0000
protected const int32 TASK_STATE_CANCELED = 0x400000; //bin: 0000 0000 0100 0000 0000 0000 0000 0000
protected const int32 TASK_STATE_WAITING_ON_CHILDREN = 0x800000; //bin: 0000 0000 1000 0000 0000 0000 0000 0000
protected const int32 TASK_STATE_RAN_TO_COMPLETION = 0x01000000; //bin: 0000 0001 0000 0000 0000 0000 0000 0000
protected const int32 TASK_STATE_WAITINGFORACTIVATION = 0x02000000; //bin: 0000 0010 0000 0000 0000 0000 0000 0000
protected const int32 TASK_STATE_COMPLETION_RESERVED = 0x04000000; //bin: 0000 0100 0000 0000 0000 0000 0000 0000
protected const int32 TASK_STATE_THREAD_WAS_ABORTED = 0x08000000; //bin: 0000 1000 0000 0000 0000 0000 0000 0000
protected const int32 TASK_STATE_WAIT_COMPLETION_NOTIFICATION = 0x10000000; //bin: 0001 0000 0000 0000 0000 0000 0000 0000
//This could be moved to InternalTaskOptions enum
internal const int32 TASK_STATE_EXECUTIONCONTEXT_IS_NULL = 0x20000000; //bin: 0010 0000 0000 0000 0000 0000 0000 0000
internal const int32 TASK_STATE_TASKSCHEDULED_WAS_FIRED = 0x40000000; //bin: 0100 0000 0000 0000 0000 0000 0000 0000
protected const int32 TASK_STATE_EXECUTIONCONTEXT_IS_NULL = 0x20000000; //bin: 0010 0000 0000 0000 0000 0000 0000 0000
protected const int32 TASK_STATE_TASKSCHEDULED_WAS_FIRED = 0x40000000; //bin: 0100 0000 0000 0000 0000 0000 0000 0000
// A mask for all of the final states a task may be in
private const int32 TASK_STATE_COMPLETED_MASK = TASK_STATE_CANCELED | TASK_STATE_FAULTED | TASK_STATE_RAN_TO_COMPLETION;
@ -74,7 +74,7 @@ namespace System.Threading.Tasks
}
protected DetachState mDetachState = default;
internal static Task InternalCurrent
protected static Task InternalCurrent
{
get { return t_currentTask; }
}
@ -115,21 +115,21 @@ namespace System.Threading.Tasks
get { return m_stateObject; }
}
internal class ContingentProperties
protected class ContingentProperties
{
internal CancellationToken m_cancellationToken;
internal volatile int m_internalCancellationRequested;
protected CancellationToken m_cancellationToken;
protected volatile int m_internalCancellationRequested;
//internal CancellationTokenRegistration* m_cancellationRegistration;
internal int m_completionCountdown;
internal volatile WaitEvent m_completionEvent ~ delete _;
protected int m_completionCountdown;
protected volatile WaitEvent m_completionEvent ~ delete _;
internal void SetCompleted()
protected void SetCompleted()
{
var mres = m_completionEvent;
if (mres != null) mres.Set();
}
internal void DeregisterCancellationCallback()
protected void DeregisterCancellationCallback()
{
/*if (m_cancellationRegistration != null)
{
@ -143,26 +143,26 @@ namespace System.Threading.Tasks
}
}
internal volatile ContingentProperties m_contingentProperties;
protected volatile ContingentProperties m_contingentProperties;
internal bool IsCancellationRequested
protected bool IsCancellationRequested
{
get
{
// check both the internal cancellation request flag and the CancellationToken attached to this task
var props = m_contingentProperties;
return props != null &&
(props.m_internalCancellationRequested == CANCELLATION_REQUESTED ||
props.m_cancellationToken.IsCancellationRequested);
(props.[Friend]m_internalCancellationRequested == CANCELLATION_REQUESTED ||
props.[Friend]m_cancellationToken.IsCancellationRequested);
}
}
internal bool IsRanToCompletion
protected bool IsRanToCompletion
{
get { return (m_stateFlags & TASK_STATE_COMPLETED_MASK) == TASK_STATE_RAN_TO_COMPLETION; }
}
internal TaskScheduler ExecutingTaskScheduler
protected TaskScheduler ExecutingTaskScheduler
{
get { return m_taskScheduler; }
}
@ -176,7 +176,7 @@ namespace System.Threading.Tasks
}
}*/
internal TaskCreationOptions Options
protected TaskCreationOptions Options
{
get
{
@ -187,7 +187,7 @@ namespace System.Threading.Tasks
// Similar to Options property, but allows for the use of a cached flags value rather than
// a read of the volatile m_stateFlags field.
internal static TaskCreationOptions OptionsMethod(int32 flags)
protected static TaskCreationOptions OptionsMethod(int32 flags)
{
Contract.Assert((OptionsMask & 1) == 1, "OptionsMask needs a shift in Options.get");
return (TaskCreationOptions)(flags & OptionsMask);
@ -207,7 +207,7 @@ namespace System.Threading.Tasks
get { return Options & (TaskCreationOptions)(~InternalTaskOptions.InternalOptionsMask); }
}
internal bool IsCancellationAcknowledged
protected bool IsCancellationAcknowledged
{
get { return (m_stateFlags & TASK_STATE_CANCELLATIONACKNOWLEDGED) != 0; }
}
@ -220,7 +220,7 @@ namespace System.Threading.Tasks
}
}
internal bool IsDelegateInvoked
protected bool IsDelegateInvoked
{
get
{
@ -228,7 +228,7 @@ namespace System.Threading.Tasks
}
}
internal bool IsWaitNotificationEnabledOrNotRanToCompletion
protected bool IsWaitNotificationEnabledOrNotRanToCompletion
{
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@ -262,7 +262,7 @@ namespace System.Threading.Tasks
//PossiblyCaptureContext(ref stackMark);
}
internal this(Delegate action, Object state, Task parent, CancellationToken cancellationToken,
protected this(Delegate action, Object state, Task parent, CancellationToken cancellationToken,
TaskCreationOptions creationOptions, InternalTaskOptions internalOptions, TaskScheduler scheduler)
{
if (action == null)
@ -334,7 +334,7 @@ namespace System.Threading.Tasks
}
}
internal void FinishStageTwo()
protected void FinishStageTwo()
{
//AddExceptionsFromChildren();
@ -391,15 +391,15 @@ namespace System.Threading.Tasks
var cp = m_contingentProperties;
if (cp != null)
{
cp.SetCompleted();
cp.DeregisterCancellationCallback();
cp.[Friend]SetCompleted();
cp.[Friend]DeregisterCancellationCallback();
}
// ready to run continuations and notify parent.
FinishStageThree();
}
internal void FinishStageThree()
protected void FinishStageThree()
{
delete m_action;
// Release the action so that holding this task object alive doesn't also
@ -427,7 +427,7 @@ namespace System.Threading.Tasks
//TODO:
}
internal void FinishContinuations()
protected void FinishContinuations()
{
// Atomically store the fact that this task is completing. From this point on, the adding of continuations will
// result in the continuations being run/launched directly rather than being added to the continuation list.
@ -548,7 +548,7 @@ namespace System.Threading.Tasks
}
}
internal void ProcessChildCompletion(Task childTask)
protected void ProcessChildCompletion(Task childTask)
{
Contract.Requires(childTask != null);
Contract.Requires(childTask.IsCompleted, "ProcessChildCompletion was called for an uncompleted task");
@ -581,7 +581,7 @@ namespace System.Threading.Tasks
}*/
if (Interlocked.Decrement(ref props.m_completionCountdown) == 0)
if (Interlocked.Decrement(ref props.[Friend]m_completionCountdown) == 0)
{
// This call came from the final child to complete, and apparently we have previously given up this task's right to complete itself.
// So we need to invoke the final finish stage.
@ -590,7 +590,7 @@ namespace System.Threading.Tasks
}
}
internal void Finish(bool bUserDelegateExecuted)
protected void Finish(bool bUserDelegateExecuted)
{
if (!bUserDelegateExecuted)
{
@ -602,12 +602,12 @@ namespace System.Threading.Tasks
var props = m_contingentProperties;
if (props == null || // no contingent properties means no children, so it's safe to complete ourselves
(props.m_completionCountdown == 1 && !IsSelfReplicatingRoot) ||
(props.[Friend]m_completionCountdown == 1 && !IsSelfReplicatingRoot) ||
// Count of 1 => either all children finished, or there were none. Safe to complete ourselves
// without paying the price of an Interlocked.Decrement.
// However we need to exclude self replicating root tasks from this optimization, because
// they can have children joining in, or finishing even after the root task delegate is done.
Interlocked.Decrement(ref props.m_completionCountdown) == 0) // Reaching this sub clause means there may be remaining active children,
Interlocked.Decrement(ref props.[Friend]m_completionCountdown) == 0) // Reaching this sub clause means there may be remaining active children,
// and we could be racing with one of them to call FinishStageTwo().
// So whoever does the final Interlocked.Dec is responsible to finish.
{
@ -641,7 +641,7 @@ namespace System.Threading.Tasks
}
}
internal bool FireTaskScheduledIfNeeded(TaskScheduler ts)
protected bool FireTaskScheduledIfNeeded(TaskScheduler ts)
{
/*var etwLog = TplEtwProvider.Log;
if (etwLog.IsEnabled() && (m_stateFlags & Task.TASK_STATE_TASKSCHEDULED_WAS_FIRED) == 0)
@ -659,7 +659,7 @@ namespace System.Threading.Tasks
return false;
}
internal void TaskConstructorCore(Object action, Object state, CancellationToken cancellationToken,
protected void TaskConstructorCore(Object action, Object state, CancellationToken cancellationToken,
TaskCreationOptions creationOptions, InternalTaskOptions internalOptions, TaskScheduler scheduler)
{
m_action = action;
@ -740,7 +740,7 @@ namespace System.Threading.Tasks
{
if (m_taskScheduler == null)
return false;
return m_taskScheduler.TryRunInline(this, true);
return m_taskScheduler.[Friend]TryRunInline(this, true);
}
private bool SpinWait(int millisecondsTimeout)
@ -754,7 +754,7 @@ namespace System.Threading.Tasks
}
//This code is pretty similar to the custom spinning in MRES except there is no yieling after we exceed the spin count
int spinCount = Platform.IsSingleProcessor ? 1 : System.Threading.SpinWait.YIELD_THRESHOLD; //spin only once if we are running on a single CPU
int spinCount = Platform.IsSingleProcessor ? 1 : System.Threading.SpinWait.[Friend]YIELD_THRESHOLD; //spin only once if we are running on a single CPU
for (int i = 0; i < spinCount; i++)
{
if (IsCompleted)
@ -832,7 +832,7 @@ namespace System.Threading.Tasks
/// The core wait function, which is only accesible internally. It's meant to be used in places in TPL code where
/// the current context is known or cached.
//[MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger
internal bool InternalWait(int millisecondsTimeout, CancellationToken cancellationToken)
protected bool InternalWait(int millisecondsTimeout, CancellationToken cancellationToken)
{
Debug.Assert(!mDetachState.HasFlag(.Deatched));
@ -945,7 +945,7 @@ namespace System.Threading.Tasks
ScheduleAndStart(true);
}
internal bool AtomicStateUpdate(int32 newBits, int32 illegalBits)
protected bool AtomicStateUpdate(int32 newBits, int32 illegalBits)
{
// This could be implemented in terms of:
// internal bool AtomicStateUpdate(int newBits, int illegalBits, ref int oldFlags);
@ -965,7 +965,7 @@ namespace System.Threading.Tasks
while (true);
}
internal bool AtomicStateUpdate(int32 newBits, int32 illegalBits, ref int32 oldFlags)
protected bool AtomicStateUpdate(int32 newBits, int32 illegalBits, ref int32 oldFlags)
{
SpinWait sw = .();
repeat
@ -983,18 +983,18 @@ namespace System.Threading.Tasks
// ASSUMES THAT A SUCCESSFUL CANCELLATION HAS JUST OCCURRED ON THIS TASK!!!
// And this method should be called at most once per task.
internal void CancellationCleanupLogic()
protected void CancellationCleanupLogic()
{
Interlocked.Exchange(ref m_stateFlags, m_stateFlags | TASK_STATE_CANCELED);
}
internal bool MarkStarted()
protected bool MarkStarted()
{
return AtomicStateUpdate(TASK_STATE_STARTED, TASK_STATE_CANCELED | TASK_STATE_STARTED);
}
internal void ScheduleAndStart(bool needsProtection)
protected void ScheduleAndStart(bool needsProtection)
{
Contract.Assert(m_taskScheduler != null, "expected a task scheduler to have been selected");
Contract.Assert((m_stateFlags & TASK_STATE_STARTED) == 0, "task has already started");
@ -1025,7 +1025,7 @@ namespace System.Threading.Tasks
}*/
m_taskScheduler.InternalQueueTask(this);
m_taskScheduler.[Friend]InternalQueueTask(this);
/*try
{
@ -1067,7 +1067,7 @@ namespace System.Threading.Tasks
}*/
}
internal bool ExecuteEntry(bool bPreventDoubleExecution)
protected bool ExecuteEntry(bool bPreventDoubleExecution)
{
if (bPreventDoubleExecution || ((Options & (TaskCreationOptions)InternalTaskOptions.SelfReplicating) != 0))
{
@ -1191,7 +1191,7 @@ namespace System.Threading.Tasks
/// Since a child task can only be created from the thread executing the action delegate
/// of this task, reentrancy is neither required nor supported. This should not be called from
/// anywhere other than the task construction/initialization codepaths.
internal void AddNewChild()
protected void AddNewChild()
{
ThrowUnimplemented();
//TODO:
@ -1221,7 +1221,7 @@ namespace System.Threading.Tasks
return props != null ? props : EnsureContingentPropertiesInitializedCore(needsProtection);
}*/
internal bool IsSelfReplicatingRoot
protected bool IsSelfReplicatingRoot
{
get
{
@ -1236,12 +1236,12 @@ namespace System.Threading.Tasks
return TaskAwaiter(this);
}
internal static Task InternalCurrentIfAttached(TaskCreationOptions creationOptions)
protected static Task InternalCurrentIfAttached(TaskCreationOptions creationOptions)
{
return (creationOptions & TaskCreationOptions.AttachedToParent) != 0 ? InternalCurrent : null;
}
internal void AddCompletionAction(ITaskCompletionAction action)
protected void AddCompletionAction(ITaskCompletionAction action)
{
AddCompletionAction(action, false);
}
@ -1345,7 +1345,7 @@ namespace System.Threading.Tasks
}
}
internal interface ITaskCompletionAction
interface ITaskCompletionAction
{
void Invoke(Task completingTask);
}
@ -1382,7 +1382,7 @@ namespace System.Threading.Tasks
RunContinuationsAsynchronously = 0x40
}
internal enum InternalTaskOptions
public enum InternalTaskOptions
{
/// Specifies "No internal task options"
None,

View file

@ -25,39 +25,39 @@ namespace System.Threading.Tasks
}
}
internal static TaskScheduler InternalCurrent
protected static TaskScheduler InternalCurrent
{
get
{
Task currentTask = Task.InternalCurrent;
Task currentTask = Task.[Friend]InternalCurrent;
return ( (currentTask != null)
&& ((currentTask.CreationOptions & TaskCreationOptions.HideScheduler) == 0)
) ? currentTask.ExecutingTaskScheduler : null;
) ? currentTask.[Friend]ExecutingTaskScheduler : null;
}
}
protected internal abstract void QueueTask(Task task);
protected abstract void QueueTask(Task task);
protected abstract bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued);
/// <summary>
/// Notifies the scheduler that a work item has made progress.
/// </summary>
internal virtual void NotifyWorkItemProgress()
protected virtual void NotifyWorkItemProgress()
{
}
internal bool TryRunInline(Task task, bool taskWasPreviouslyQueued)
protected bool TryRunInline(Task task, bool taskWasPreviouslyQueued)
{
TaskScheduler ets = task.ExecutingTaskScheduler;
TaskScheduler ets = task.[Friend]ExecutingTaskScheduler;
// Delegate cross-scheduler inlining requests to target scheduler
if(ets != this && ets !=null) return ets.TryRunInline(task, taskWasPreviouslyQueued);
//StackGuard currentStackGuard;
if( (ets == null) ||
(task.m_action == null) ||
task.IsDelegateInvoked ||
(task.[Friend]m_action == null) ||
task.[Friend]IsDelegateInvoked ||
task.IsCanceled
//|| (currentStackGuard = Task.CurrentStackGuard).TryBeginInliningScope() == false
)
@ -71,7 +71,7 @@ namespace System.Threading.Tasks
bool bInlined = false;
//try
{
task.FireTaskScheduledIfNeeded(this);
task.[Friend]FireTaskScheduledIfNeeded(this);
bInlined = TryExecuteTaskInline(task, taskWasPreviouslyQueued);
}
/*finally
@ -89,18 +89,18 @@ namespace System.Threading.Tasks
return bInlined;
}
internal void InternalQueueTask(Task task)
protected void InternalQueueTask(Task task)
{
//task.FireTaskScheduledIfNeeded(this);
this.QueueTask(task);
}
protected internal virtual bool TryDequeue(Task task)
protected virtual bool TryDequeue(Task task)
{
return false;
}
internal virtual bool RequiresAtomicStartTransition
protected virtual bool RequiresAtomicStartTransition
{
get { return true; }
}

View file

@ -7,7 +7,7 @@ namespace System.Threading.Tasks
class ThreadPoolTaskScheduler : TaskScheduler
{
/// Constructs a new ThreadPool task scheduler object
internal this()
public this()
{
}
@ -19,14 +19,14 @@ namespace System.Threading.Tasks
//Contract.Requires(obj != null, "TaskScheduler.LongRunningThreadWork: obj is null");
Task t = obj as Task;
//Contract.Assert(t != null, "TaskScheduler.LongRunningThreadWork: t is null");
t.ExecuteEntry(false);
t.[Friend]ExecuteEntry(false);
}
/// Schedules a task to the ThreadPool.
/// @param task The task to schedule.
protected internal override void QueueTask(Task task)
protected override void QueueTask(Task task)
{
if ((task.Options & TaskCreationOptions.LongRunning) != 0)
if ((task.[Friend]Options & TaskCreationOptions.LongRunning) != 0)
{
// Run LongRunning tasks on their own dedicated thread.
Thread thread = new Thread(new => LongRunningThreadWork);
@ -58,7 +58,7 @@ namespace System.Threading.Tasks
bool rval = false;
//try
{
rval = task.ExecuteEntry(false); // handles switching Task.Current etc.
rval = task.[Friend]ExecuteEntry(false); // handles switching Task.Current etc.
}
/*finally
{
@ -69,7 +69,7 @@ namespace System.Threading.Tasks
return rval;
}
protected internal override bool TryDequeue(Task task)
protected override bool TryDequeue(Task task)
{
// just delegate to TP
return ThreadPool.TryPopCustomWorkItem(task);
@ -92,14 +92,14 @@ namespace System.Threading.Tasks
}*/
/// Notifies the scheduler that work is progressing (no-op).
internal override void NotifyWorkItemProgress()
protected override void NotifyWorkItemProgress()
{
//ThreadPool.NotifyWorkItemProgress();
}
/// This is the only scheduler that returns false for this property, indicating that the task entry codepath is unsafe (CAS free)
/// since we know that the underlying scheduler already takes care of atomic transitions from queued to non-queued.
internal override bool RequiresAtomicStartTransition
protected override bool RequiresAtomicStartTransition
{
get { return false; }
}

View file

@ -3,7 +3,7 @@ namespace System.Threading
using System;
using System.Diagnostics;
internal delegate Object InternalCrossContextDelegate(Object[] args);
public delegate Object InternalCrossContextDelegate(Object[] args);
public delegate void ThreadStart();
public delegate void ParameterizedThreadStart(Object obj);

View file

@ -21,7 +21,7 @@ namespace System.Threading
public volatile int32 mActive;
}
internal interface IThreadPoolWorkItem
interface IThreadPoolWorkItem
{
void ExecuteWorkItem();
void MarkAborted();

View file

@ -7,7 +7,7 @@ namespace System.Threading {
public static class Timeout
{
public const int32 Infinite = -1;
internal const uint32 UnsignedInfinite = (uint32)-1;
protected const uint32 UnsignedInfinite = (uint32)-1;
}
}

View file

@ -24,13 +24,13 @@ namespace System
private const int32 MillisPerHour = MillisPerMinute * 60; // 3,600,000
private const int32 MillisPerDay = MillisPerHour * 24; // 86,400,000
internal const int64 MaxSeconds = Int64.MaxValue / TicksPerSecond;
internal const int64 MinSeconds = Int64.MinValue / TicksPerSecond;
protected const int64 MaxSeconds = Int64.MaxValue / TicksPerSecond;
protected const int64 MinSeconds = Int64.MinValue / TicksPerSecond;
internal const int64 MaxMilliSeconds = Int64.MaxValue / TicksPerMillisecond;
internal const int64 MinMilliSeconds = Int64.MinValue / TicksPerMillisecond;
protected const int64 MaxMilliSeconds = Int64.MaxValue / TicksPerMillisecond;
protected const int64 MinMilliSeconds = Int64.MinValue / TicksPerMillisecond;
internal const int64 TicksPerTenthSecond = TicksPerMillisecond * 100;
protected const int64 TicksPerTenthSecond = TicksPerMillisecond * 100;
public static readonly TimeSpan Zero = TimeSpan(0);
@ -134,7 +134,7 @@ namespace System
get { return (double)(int64)this * SecondsPerTick; }
}
internal static Result<int64> TimeToTicks(int hour, int minute, int second) {
protected static Result<int64> TimeToTicks(int hour, int minute, int second) {
// totalSeconds is bounded by 2^31 * 2^12 + 2^31 * 2^8 + 2^31,
// which is less than 2^44, meaning we won't overflow totalSeconds.
int64 totalSeconds = (int64)hour * 3600 + (int64)minute * 60 + (int64)second;
@ -152,17 +152,17 @@ namespace System
public override void ToString(String outStr)
{
TimeSpanFormat.Format(this, .(), null, outStr);
TimeSpanFormat.[Friend]Format(this, .(), null, outStr);
}
public void ToString(String outStr, String format)
{
TimeSpanFormat.Format(this, format, null, outStr);
TimeSpanFormat.[Friend]Format(this, format, null, outStr);
}
public void ToString(String outStr, String format, IFormatProvider formatProvider)
{
TimeSpanFormat.Format(this, format, formatProvider, outStr);
TimeSpanFormat.[Friend]Format(this, format, formatProvider, outStr);
}
}
}

View file

@ -47,13 +47,12 @@ namespace System {
// demand for this alternate behavior.
//
internal enum TimeZoneInfoOptions
enum TimeZoneInfoOptions
{
None = 1,
NoThrowOnInvalidTime = 2
}
sealed public class TimeZoneInfo : IEquatable<TimeZoneInfo>
{
// ---- SECTION: members supporting exposed properties -------------*
@ -355,7 +354,7 @@ namespace System {
bool isAmbiguous = false;
AdjustmentRule rule = GetAdjustmentRuleForTime(adjustedTime);
if (rule != null && rule.HasDaylightSaving) {
if (rule != null && rule.[Friend]HasDaylightSaving) {
DaylightTime daylightTime = scope .();
GetDaylightTime(adjustedTime.Year, rule, daylightTime);
isAmbiguous = GetIsAmbiguousTime(adjustedTime, rule, daylightTime);
@ -369,7 +368,7 @@ namespace System {
// the passed in dateTime is ambiguous in this TimeZoneInfo instance
TimeSpan actualUtcOffset = m_baseUtcOffset + rule.BaseUtcOffsetDelta;
TimeSpan actualUtcOffset = m_baseUtcOffset + rule.[Friend]BaseUtcOffsetDelta;
// the TimeSpan array must be sorted from least to greatest
if (rule.DaylightDelta > TimeSpan.Zero) {
@ -405,7 +404,7 @@ namespace System {
bool isAmbiguous = false;
AdjustmentRule rule = GetAdjustmentRuleForTime(adjustedTime);
if (rule != null && rule.HasDaylightSaving) {
if (rule != null && rule.[Friend]HasDaylightSaving) {
DaylightTime daylightTime = scope .();
GetDaylightTime(adjustedTime.Year, rule, daylightTime);
isAmbiguous = GetIsAmbiguousTime(adjustedTime, rule, daylightTime);
@ -417,7 +416,7 @@ namespace System {
}
// the passed in dateTime is ambiguous in this TimeZoneInfo instance
TimeSpan actualUtcOffset = m_baseUtcOffset + rule.BaseUtcOffsetDelta;
TimeSpan actualUtcOffset = m_baseUtcOffset + rule.[Friend]BaseUtcOffsetDelta;
// the TimeSpan array must be sorted from least to greatest
if (rule.DaylightDelta > TimeSpan.Zero) {
@ -447,12 +446,12 @@ namespace System {
}
// Shortcut for TimeZoneInfo.Local.GetUtcOffset
internal static TimeSpan GetLocalUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags) {
protected static TimeSpan GetLocalUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags) {
CachedData cachedData = s_cachedData;
return cachedData.Local.GetUtcOffset(dateTime, flags, cachedData);
}
internal TimeSpan GetUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags) {
protected TimeSpan GetUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags) {
return GetUtcOffset(dateTime, flags, s_cachedData);
}
@ -517,7 +516,7 @@ namespace System {
return IsAmbiguousTime(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
}
internal bool IsAmbiguousTime(DateTime dateTime, TimeZoneInfoOptions flags) {
protected bool IsAmbiguousTime(DateTime dateTime, TimeZoneInfoOptions flags) {
if (!m_supportsDaylightSavingTime) {
return false;
}
@ -536,7 +535,7 @@ namespace System {
}
AdjustmentRule rule = GetAdjustmentRuleForTime(adjustedTime);
if (rule != null && rule.HasDaylightSaving) {
if (rule != null && rule.[Friend]HasDaylightSaving) {
DaylightTime daylightTime = scope DaylightTime();
GetDaylightTime(adjustedTime.Year, rule, daylightTime);
return GetIsAmbiguousTime(adjustedTime, rule, daylightTime);
@ -563,7 +562,7 @@ namespace System {
return IsDaylightSavingTime(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime, s_cachedData);
}
internal bool IsDaylightSavingTime(DateTime dateTime, TimeZoneInfoOptions flags) {
protected bool IsDaylightSavingTime(DateTime dateTime, TimeZoneInfoOptions flags) {
return IsDaylightSavingTime(dateTime, flags, s_cachedData);
}
@ -615,7 +614,7 @@ namespace System {
// handle the normal cases...
//
AdjustmentRule rule = GetAdjustmentRuleForTime(adjustedTime);
if (rule != null && rule.HasDaylightSaving) {
if (rule != null && rule.[Friend]HasDaylightSaving) {
DaylightTime daylightTime = scope .();
GetDaylightTime(adjustedTime.Year, rule, daylightTime);
return GetIsDaylightSavings(adjustedTime, rule, daylightTime, flags);
@ -640,7 +639,7 @@ namespace System {
// only check Unspecified and (Local when this TimeZoneInfo instance is Local)
AdjustmentRule rule = GetAdjustmentRuleForTime(dateTime);
if (rule != null && rule.HasDaylightSaving) {
if (rule != null && rule.[Friend]HasDaylightSaving) {
DaylightTime daylightTime = scope .();
GetDaylightTime(dateTime.Year, rule, daylightTime);
isInvalid = GetIsInvalidTime(dateTime, rule, daylightTime);
@ -763,7 +762,7 @@ namespace System {
}
static internal DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags) {
static protected DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags) {
return ConvertTime(dateTime, sourceTimeZone, destinationTimeZone, flags, s_cachedData);
}
@ -787,8 +786,8 @@ namespace System {
TimeSpan sourceOffset = sourceTimeZone.BaseUtcOffset;
if (sourceRule != null) {
sourceOffset = sourceOffset + sourceRule.BaseUtcOffsetDelta;
if (sourceRule.HasDaylightSaving) {
sourceOffset = sourceOffset + sourceRule.[Friend]BaseUtcOffsetDelta;
if (sourceRule.[Friend]HasDaylightSaving) {
bool sourceIsDaylightSavings = false;
DaylightTime sourceDaylightTime = scope DaylightTime();
GetDaylightTime(dateTime.Year, sourceRule, sourceDaylightTime);
@ -858,7 +857,7 @@ namespace System {
}
static internal DateTime ConvertTimeToUtc(DateTime dateTime, TimeZoneInfoOptions flags) {
static protected DateTime ConvertTimeToUtc(DateTime dateTime, TimeZoneInfoOptions flags) {
if (dateTime.Kind == DateTimeKind.Utc) {
return dateTime;
}
@ -1414,7 +1413,7 @@ namespace System {
return null;
}
return rule = AdjustmentRule.CreateAdjustmentRule(
return rule = AdjustmentRule.[Friend]CreateAdjustmentRule(
startDate,
endDate,
TimeSpan.Zero, // no daylight saving transition
@ -1441,7 +1440,7 @@ namespace System {
return null;
}
rule = AdjustmentRule.CreateAdjustmentRule(
rule = AdjustmentRule.[Friend]CreateAdjustmentRule(
startDate,
endDate,
TimeSpan(0, -timeZoneInformation.mDaylightBias, 0),
@ -1531,8 +1530,8 @@ namespace System {
if (time.Kind == DateTimeKind.Local) {
// startTime and endTime represent the period from either the start of DST to the end and ***includes*** the
// potentially overlapped times
startTime = rule.IsStartDateMarkerForBeginningOfYear() ? DateTime(daylightTime.Start.Year, 1, 1, 0, 0, 0) : daylightTime.Start + daylightTime.Delta;
endTime = rule.IsEndDateMarkerForEndOfYear() ? new DateTime(daylightTime.End.Year + 1, 1, 1, 0, 0, 0).AddTicks(-1) : daylightTime.End;
startTime = rule.[Friend]IsStartDateMarkerForBeginningOfYear() ? DateTime(daylightTime.Start.Year, 1, 1, 0, 0, 0) : daylightTime.Start + daylightTime.Delta;
endTime = rule.[Friend]IsEndDateMarkerForEndOfYear() ? new DateTime(daylightTime.End.Year + 1, 1, 1, 0, 0, 0).AddTicks(-1) : daylightTime.End;
}
else {
// startTime and endTime represent the period from either the start of DST to the end and
@ -1553,8 +1552,8 @@ namespace System {
// [======== DST ========>)
//
bool invalidAtStart = rule.DaylightDelta > TimeSpan.Zero;
startTime = rule.IsStartDateMarkerForBeginningOfYear() ? DateTime(daylightTime.Start.Year, 1, 1, 0, 0, 0) : daylightTime.Start + (invalidAtStart ? rule.DaylightDelta : TimeSpan.Zero); /* FUTURE: - rule.StandardDelta; */
endTime = rule.IsEndDateMarkerForEndOfYear() ? new DateTime(daylightTime.End.Year + 1, 1, 1, 0, 0, 0).AddTicks(-1) : daylightTime.End + (invalidAtStart ? (TimeSpan)-(int64)rule.DaylightDelta : TimeSpan.Zero);
startTime = rule.[Friend]IsStartDateMarkerForBeginningOfYear() ? DateTime(daylightTime.Start.Year, 1, 1, 0, 0, 0) : daylightTime.Start + (invalidAtStart ? rule.DaylightDelta : TimeSpan.Zero); /* FUTURE: - rule.StandardDelta; */
endTime = rule.[Friend]IsEndDateMarkerForEndOfYear() ? new DateTime(daylightTime.End.Year + 1, 1, 1, 0, 0, 0).AddTicks(-1) : daylightTime.End + (invalidAtStart ? (TimeSpan)-(int64)rule.DaylightDelta : TimeSpan.Zero);
}
bool isDst = CheckIsDst(startTime, time, endTime, false);
@ -1566,7 +1565,7 @@ namespace System {
// clock back. It is theoretically possible to have a positive delta, (which would really be daylight
// reduction time), where you would have to wind the clock back in the begnning.
if (GetIsAmbiguousTime(time, rule, daylightTime)) {
isDst = time.IsAmbiguousDaylightSavingTime();
isDst = time.[Friend]IsAmbiguousDaylightSavingTime();
}
}
@ -1588,7 +1587,7 @@ namespace System {
}
// Get the daylight changes for the year of the specified time.
TimeSpan offset = utc + rule.BaseUtcOffsetDelta; /* FUTURE: + rule.StandardDelta; */
TimeSpan offset = utc + rule.[Friend]BaseUtcOffsetDelta; /* FUTURE: + rule.StandardDelta; */
DaylightTime daylightTime = scope .();
GetDaylightTime(Year, rule, daylightTime);
@ -1605,12 +1604,12 @@ namespace System {
bool ignoreYearAdjustment = false;
DateTime startTime;
if (rule.IsStartDateMarkerForBeginningOfYear() && daylightTime.Start.Year > DateTime.MinValue.Year) {
if (rule.[Friend]IsStartDateMarkerForBeginningOfYear() && daylightTime.Start.Year > DateTime.MinValue.Year) {
AdjustmentRule previousYearRule = zone.GetAdjustmentRuleForTime(DateTime(daylightTime.Start.Year - 1, 12, 31));
if (previousYearRule != null && previousYearRule.IsEndDateMarkerForEndOfYear()) {
if (previousYearRule != null && previousYearRule.[Friend]IsEndDateMarkerForEndOfYear()) {
DaylightTime previousDaylightTime = scope DaylightTime();
GetDaylightTime(daylightTime.Start.Year - 1, previousYearRule, previousDaylightTime);
startTime = previousDaylightTime.Start - utc - previousYearRule.BaseUtcOffsetDelta;
startTime = previousDaylightTime.Start - utc - previousYearRule.[Friend]BaseUtcOffsetDelta;
ignoreYearAdjustment = true;
} else {
startTime = DateTime(daylightTime.Start.Year, 1, 1, 0, 0, 0) - offset;
@ -1620,15 +1619,15 @@ namespace System {
}
DateTime endTime;
if (rule.IsEndDateMarkerForEndOfYear() && daylightTime.End.Year < DateTime.MaxValue.Year) {
if (rule.[Friend]IsEndDateMarkerForEndOfYear() && daylightTime.End.Year < DateTime.MaxValue.Year) {
AdjustmentRule nextYearRule = zone.GetAdjustmentRuleForTime(DateTime(daylightTime.End.Year + 1, 1, 1));
if (nextYearRule != null && nextYearRule.IsStartDateMarkerForBeginningOfYear()) {
if (nextYearRule.IsEndDateMarkerForEndOfYear()) {// next year end with daylight saving on too
endTime = DateTime(daylightTime.End.Year + 1, 12, 31) - utc - nextYearRule.BaseUtcOffsetDelta - nextYearRule.DaylightDelta;
if (nextYearRule != null && nextYearRule.[Friend]IsStartDateMarkerForBeginningOfYear()) {
if (nextYearRule.[Friend]IsEndDateMarkerForEndOfYear()) {// next year end with daylight saving on too
endTime = DateTime(daylightTime.End.Year + 1, 12, 31) - utc - nextYearRule.[Friend]BaseUtcOffsetDelta - nextYearRule.DaylightDelta;
} else {
DaylightTime nextdaylightTime = scope DaylightTime();
GetDaylightTime(daylightTime.End.Year + 1, nextYearRule, nextdaylightTime);
endTime = nextdaylightTime.End - utc - nextYearRule.BaseUtcOffsetDelta - nextYearRule.DaylightDelta;
endTime = nextdaylightTime.End - utc - nextYearRule.[Friend]BaseUtcOffsetDelta - nextYearRule.DaylightDelta;
}
ignoreYearAdjustment = true;
} else {
@ -1735,14 +1734,14 @@ namespace System {
// if at DST start we transition forward in time then there is an ambiguous time range at the DST end
if (rule.DaylightDelta > TimeSpan.Zero) {
if (rule.IsEndDateMarkerForEndOfYear()) { // year end with daylight on so there is no ambiguous time
if (rule.[Friend]IsEndDateMarkerForEndOfYear()) { // year end with daylight on so there is no ambiguous time
return false;
}
startAmbiguousTime = daylightTime.End;
endAmbiguousTime = daylightTime.End - rule.DaylightDelta; /* FUTURE: + rule.StandardDelta; */
}
else {
if (rule.IsStartDateMarkerForBeginningOfYear()) { // year start with daylight on so there is no ambiguous time
if (rule.[Friend]IsStartDateMarkerForBeginningOfYear()) { // year start with daylight on so there is no ambiguous time
return false;
}
startAmbiguousTime = daylightTime.Start;
@ -1800,7 +1799,7 @@ namespace System {
// if at DST start we transition forward in time then there is an ambiguous time range at the DST end
if (rule.DaylightDelta < TimeSpan.Zero) {
// if the year ends with daylight saving on then there cannot be any time-hole's in that year.
if (rule.IsEndDateMarkerForEndOfYear())
if (rule.[Friend]IsEndDateMarkerForEndOfYear())
return false;
startInvalidTime = daylightTime.End;
@ -1808,7 +1807,7 @@ namespace System {
}
else {
// if the year starts with daylight saving on then there cannot be any time-hole's in that year.
if (rule.IsStartDateMarkerForBeginningOfYear())
if (rule.[Friend]IsStartDateMarkerForBeginningOfYear())
return false;
startInvalidTime = daylightTime.Start;
@ -2056,8 +2055,8 @@ namespace System {
AdjustmentRule rule = zone.GetAdjustmentRuleForTime(time);
if (rule != null) {
baseOffset = baseOffset + rule.BaseUtcOffsetDelta;
if (rule.HasDaylightSaving) {
baseOffset = baseOffset + rule.[Friend]BaseUtcOffsetDelta;
if (rule.[Friend]HasDaylightSaving) {
DaylightTime daylightTime = scope DaylightTime();
GetDaylightTime(time.Year, rule, daylightTime);
bool isDaylightSavings = GetIsDaylightSavings(time, rule, daylightTime, flags);
@ -2087,7 +2086,7 @@ namespace System {
}
// DateTime.Now fast path that avoids allocating an historically accurate TimeZoneInfo.Local and just creates a 1-year (current year) accurate time zone
static internal TimeSpan GetDateTimeNowUtcOffsetFromUtc(DateTime time, out bool isAmbiguousLocalDst) {
static protected TimeSpan GetDateTimeNowUtcOffsetFromUtc(DateTime time, out bool isAmbiguousLocalDst) {
bool isDaylightSavings = false;
#if FEATURE_WIN32_REGISTRY
isAmbiguousLocalDst = false;
@ -2098,8 +2097,8 @@ namespace System {
baseOffset = match.offset;
if (match.rule != null) {
baseOffset = baseOffset + match.rule.BaseUtcOffsetDelta;
if (match.rule.HasDaylightSaving) {
baseOffset = baseOffset + match.rule.[Friend]BaseUtcOffsetDelta;
if (match.rule.[Friend]HasDaylightSaving) {
isDaylightSavings = GetIsDaylightSavingsFromUtc(time, timeYear, match.offset, match.rule, out isAmbiguousLocalDst, TimeZoneInfo.Local);
baseOffset += (isDaylightSavings ? match.rule.DaylightDelta : TimeSpan.Zero /* FUTURE: rule.StandardDelta */);
}
@ -2111,7 +2110,7 @@ namespace System {
#endif // FEATURE_WIN32_REGISTRY
}
static internal TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings, out bool isAmbiguousLocalDst) {
static protected TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings, out bool isAmbiguousLocalDst) {
isDaylightSavings = false;
isAmbiguousLocalDst = false;
TimeSpan baseOffset = zone.BaseUtcOffset;
@ -2140,8 +2139,8 @@ namespace System {
if (rule != null)
{
baseOffset = baseOffset + rule.BaseUtcOffsetDelta;
if (rule.HasDaylightSaving) {
baseOffset = baseOffset + rule.[Friend]BaseUtcOffsetDelta;
if (rule.[Friend]HasDaylightSaving) {
isDaylightSavings = GetIsDaylightSavingsFromUtc(time, year, zone.m_baseUtcOffset, rule, out isAmbiguousLocalDst, zone);
baseOffset += (isDaylightSavings ? rule.DaylightDelta : TimeSpan.Zero /* FUTURE: rule.StandardDelta */);
}
@ -3083,7 +3082,7 @@ namespace System {
//
// Helper function that validates the TimeSpan is within +/- 14.0 hours
//
static internal bool UtcOffsetOutOfRange(TimeSpan offset) {
static protected bool UtcOffsetOutOfRange(TimeSpan offset) {
return (offset.TotalHours < -14.0 || offset.TotalHours > 14.0);
}
@ -3224,13 +3223,13 @@ namespace System {
}
}
internal TimeSpan BaseUtcOffsetDelta {
protected TimeSpan BaseUtcOffsetDelta {
get {
return this.m_baseUtcOffsetDelta;
}
}
internal bool HasDaylightSaving {
protected bool HasDaylightSaving {
get {
/*return this.DaylightDelta != TimeSpan.Zero ||
this.DaylightTransitionStart.TimeOfDay != DateTime.MinValue ||
@ -3294,7 +3293,7 @@ namespace System {
return rule;
}
static internal AdjustmentRule CreateAdjustmentRule(
static protected AdjustmentRule CreateAdjustmentRule(
DateTime dateStart,
DateTime dateEnd,
TimeSpan daylightDelta,
@ -3312,7 +3311,7 @@ namespace System {
// When Windows sets the daylight transition start Jan 1st at 12:00 AM, it means the year starts with the daylight saving on.
// We have to special case this value and not adjust it when checking if any date is in the daylight saving period.
//
internal bool IsStartDateMarkerForBeginningOfYear() {
protected bool IsStartDateMarkerForBeginningOfYear() {
return DaylightTransitionStart.Month == 1 && DaylightTransitionStart.Day == 1 && DaylightTransitionStart.TimeOfDay.Hour == 0 &&
DaylightTransitionStart.TimeOfDay.Minute == 0 && DaylightTransitionStart.TimeOfDay.Second == 0 &&
m_dateStart.Year == m_dateEnd.Year;
@ -3322,7 +3321,7 @@ namespace System {
// When Windows sets the daylight transition end Jan 1st at 12:00 AM, it means the year ends with the daylight saving on.
// We have to special case this value and not adjust it when checking if any date is in the daylight saving period.
//
internal bool IsEndDateMarkerForEndOfYear() {
protected bool IsEndDateMarkerForEndOfYear() {
return DaylightTransitionEnd.Month == 1 && DaylightTransitionEnd.Day == 1 && DaylightTransitionEnd.TimeOfDay.Hour == 0 &&
DaylightTransitionEnd.TimeOfDay.Minute == 0 && DaylightTransitionEnd.TimeOfDay.Second == 0 &&
m_dateStart.Year == m_dateEnd.Year;

View file

@ -15,16 +15,16 @@ namespace System
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
public class Type
{
internal extern const Type* sTypes;
extern const Type* sTypes;
protected const BindingFlags cDefaultLookup = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;
internal int32 mSize;
internal TypeId mTypeId;
internal TypeFlags mTypeFlags;
internal int32 mMemberDataOffset;
internal TypeCode mTypeCode;
internal uint8 mAlign;
protected int32 mSize;
protected TypeId mTypeId;
protected TypeFlags mTypeFlags;
protected int32 mMemberDataOffset;
protected TypeCode mTypeCode;
protected uint8 mAlign;
public int32 Size
{
@ -372,12 +372,12 @@ namespace System
return (int32)mTypeId;
}
internal static Type GetType(TypeId typeId)
protected static Type GetType(TypeId typeId)
{
return sTypes[(int32)typeId];
}
internal static Type GetType_(int32 typeId)
protected static Type GetType_(int32 typeId)
{
return sTypes[typeId];
}
@ -493,50 +493,50 @@ namespace System
namespace System.Reflection
{
internal struct TypeId : int32
public struct TypeId : int32
{
public Type ToType()
{
return Type.sTypes[(int32)this];
return Type.[Friend]sTypes[(int32)this];
}
}
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class TypeInstance : Type
public class TypeInstance : Type
{
[CRepr, AlwaysInclude]
internal struct FieldData
public struct FieldData
{
internal String mName;
internal int64 mConstValue;
internal int32 mDataOffset;
internal TypeId mFieldTypeId;
internal FieldFlags mFlags;
internal int32 mCustomAttributesIdx;
public String mName;
public int64 mConstValue;
public int32 mDataOffset;
public TypeId mFieldTypeId;
public FieldFlags mFlags;
public int32 mCustomAttributesIdx;
}
// This is only valid if there is no FieldData on a splattable struct
[CRepr, AlwaysInclude]
internal struct FieldSplatData
public struct FieldSplatData
{
internal TypeId[3] mSplatTypes;
internal int32[3] mSplatOffsets;
public TypeId[3] mSplatTypes;
public int32[3] mSplatOffsets;
}
[CRepr, AlwaysInclude]
internal struct MethodData
public struct MethodData
{
internal String mName; // mName
internal void* mFuncPtr;
internal ParamData* mParamData;
internal TypeId mReturnType;
internal int16 mParamCount;
internal MethodFlags mFlags;
internal int32 mVirtualIdx;
internal int32 mCustomAttributesIdx;
public String mName; // mName
public void* mFuncPtr;
public ParamData* mParamData;
public TypeId mReturnType;
public int16 mParamCount;
public MethodFlags mFlags;
public int32 mVirtualIdx;
public int32 mCustomAttributesIdx;
}
internal enum ParamFlags : int16
public enum ParamFlags : int16
{
None = 0,
Splat = 1,
@ -544,39 +544,39 @@ namespace System.Reflection
}
[CRepr, AlwaysInclude]
internal struct ParamData
public struct ParamData
{
internal String mName;
internal TypeId mType;
internal ParamFlags mParamFlags;
internal int32 mDefaultIdx;
public String mName;
public TypeId mType;
public ParamFlags mParamFlags;
public int32 mDefaultIdx;
}
internal ClassVData* mTypeClassVData;
internal String mName;
internal String mNamespace;
internal int32 mInstSize;
internal int32 mInstAlign;
internal int32 mCustomAttributesIdx;
internal TypeId mBaseType;
internal TypeId mUnderlyingType;
internal TypeId mOuterType;
internal int32 mInheritanceId;
internal int32 mInheritanceCount;
ClassVData* mTypeClassVData;
String mName;
String mNamespace;
int32 mInstSize;
int32 mInstAlign;
int32 mCustomAttributesIdx;
TypeId mBaseType;
TypeId mUnderlyingType;
TypeId mOuterType;
int32 mInheritanceId;
int32 mInheritanceCount;
internal uint8 mInterfaceSlot;
internal uint8 mInterfaceCount;
internal int16 mMethodDataCount;
internal int16 mPropertyDataCount;
internal int16 mFieldDataCount;
internal int16 mConstructorDataCount;
uint8 mInterfaceSlot;
uint8 mInterfaceCount;
int16 mMethodDataCount;
int16 mPropertyDataCount;
int16 mFieldDataCount;
int16 mConstructorDataCount;
internal void* mInterfaceDataPtr;
internal MethodData* mMethodDataPtr;
internal void* mPropertyDataPtr;
internal FieldData* mFieldDataPtr;
internal void* mConstructorDataPtr;
internal void** mCustomAttrDataPtr;
void* mInterfaceDataPtr;
MethodData* mMethodDataPtr;
void* mPropertyDataPtr;
FieldData* mFieldDataPtr;
void* mConstructorDataPtr;
void** mCustomAttrDataPtr;
public override int32 InstanceSize
@ -607,7 +607,7 @@ namespace System.Reflection
{
get
{
return (TypeInstance)Type.GetType(mBaseType);
return (TypeInstance)Type.[Friend]GetType(mBaseType);
}
}
@ -615,7 +615,7 @@ namespace System.Reflection
{
get
{
return (TypeInstance)Type.GetType(mOuterType);
return (TypeInstance)Type.[Friend]GetType(mOuterType);
}
}
@ -623,7 +623,7 @@ namespace System.Reflection
{
get
{
return Type.GetType(mUnderlyingType);
return Type.[Friend]GetType(mUnderlyingType);
}
}
@ -644,7 +644,7 @@ namespace System.Reflection
return true;
if (curType.mBaseType == 0)
return false;
curType = (TypeInstance)Type.GetType(curType.mBaseType);
curType = (TypeInstance)Type.[Friend]GetType(curType.mBaseType);
}
}
@ -657,7 +657,7 @@ namespace System.Reflection
{
if (fieldIdx > 0)
strBuffer.Append(", ");
GetType(mFieldDataPtr[fieldIdx].mFieldTypeId).GetFullName(strBuffer);
GetType(mFieldDataPtr[fieldIdx].[Friend]mFieldTypeId).GetFullName(strBuffer);
}
strBuffer.Append(')');
}
@ -688,7 +688,7 @@ namespace System.Reflection
for (int32 i = 0; i < mFieldDataCount; i++)
{
FieldData* fieldData = &mFieldDataPtr[i];
if (fieldData.mName == fieldName)
if (fieldData.[Friend]mName == fieldName)
return FieldInfo(this, fieldData);
}
return .Err;
@ -701,15 +701,15 @@ namespace System.Reflection
}
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class PointerType : Type
class PointerType : Type
{
internal TypeId mElementType;
TypeId mElementType;
public override Type UnderlyingType
{
get
{
return Type.GetType(mElementType);
return Type.[Friend]GetType(mElementType);
}
}
@ -721,16 +721,16 @@ namespace System.Reflection
}
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class SizedArrayType : Type
class SizedArrayType : Type
{
internal TypeId mElementType;
internal int32 mElementCount;
TypeId mElementType;
int32 mElementCount;
public override Type UnderlyingType
{
get
{
return Type.GetType(mElementType);
return Type.[Friend]GetType(mElementType);
}
}
@ -752,31 +752,31 @@ namespace System.Reflection
}
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class UnspecializedGenericType : TypeInstance
class UnspecializedGenericType : TypeInstance
{
[CRepr, AlwaysInclude]
internal struct GenericParam
struct GenericParam
{
internal String mName;
String mName;
}
internal uint8 mGenericParamCount;
uint8 mGenericParamCount;
}
// Only for resolved types
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class SpecializedGenericType : TypeInstance
class SpecializedGenericType : TypeInstance
{
internal TypeId mUnspecializedType;
internal TypeId* mResolvedTypeRefs;
TypeId mUnspecializedType;
TypeId* mResolvedTypeRefs;
public override int32 GenericParamCount
{
get
{
var unspecializedTypeG = Type.GetType(mUnspecializedType);
var unspecializedTypeG = Type.[Friend]GetType(mUnspecializedType);
var unspecializedType = (UnspecializedGenericType)unspecializedTypeG;
return unspecializedType.mGenericParamCount;
return unspecializedType.[Friend]mGenericParamCount;
}
}
@ -787,7 +787,7 @@ namespace System.Reflection
public override void GetFullName(String strBuffer)
{
var unspecializedTypeG = Type.GetType(mUnspecializedType);
var unspecializedTypeG = Type.[Friend]GetType(mUnspecializedType);
var unspecializedType = (UnspecializedGenericType)unspecializedTypeG;
base.GetFullName(strBuffer);
@ -796,14 +796,14 @@ namespace System.Reflection
if (outerType != null)
outerGenericCount = outerType.GenericParamCount;
if (outerGenericCount < unspecializedType.mGenericParamCount)
if (outerGenericCount < unspecializedType.[Friend]mGenericParamCount)
{
strBuffer.Append('<');
for (int i = outerGenericCount; i < unspecializedType.mGenericParamCount; i++)
for (int i = outerGenericCount; i < unspecializedType.[Friend]mGenericParamCount; i++)
{
if (i > 0)
strBuffer.Append(", ");
Type.GetType(mResolvedTypeRefs[i]).GetFullName(strBuffer);
Type.[Friend]GetType(mResolvedTypeRefs[i]).GetFullName(strBuffer);
}
strBuffer.Append('>');
}
@ -811,15 +811,15 @@ namespace System.Reflection
}
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class ArrayType : SpecializedGenericType
class ArrayType : SpecializedGenericType
{
internal int32 mElementSize;
internal uint8 mRank;
internal uint8 mElementsDataOffset;
int32 mElementSize;
uint8 mRank;
uint8 mElementsDataOffset;
public override void GetFullName(String strBuffer)
{
Type.GetType(mResolvedTypeRefs[0]).GetFullName(strBuffer);
Type.[Friend]GetType(mResolvedTypeRefs[0]).GetFullName(strBuffer);
strBuffer.Append('[');
for (int commaNum < mRank - 1)
strBuffer.Append(',');

View file

@ -4,8 +4,8 @@ namespace System
{
struct Variant
{
internal int mStructType; // 0 = unowned object, 1 = owned object, 2 = null value (mData is type), otherwise is struct type
internal int mData; // This is either an Object reference, struct data, or a pointer to struct data
int mStructType; // 0 = unowned object, 1 = owned object, 2 = null value (mData is type), otherwise is struct type
int mData; // This is either an Object reference, struct data, or a pointer to struct data
public bool OwnsMemory
{
@ -135,12 +135,12 @@ namespace System
if (type.Size <= sizeof(int))
{
variant.mData = 0;
Internal.MemCpy(&variant.mData, val, type.mSize);
Internal.MemCpy(&variant.mData, val, type.[Friend]mSize);
}
else
{
void* data = new uint8[type.mSize]*;
Internal.MemCpy(data, val, type.mSize);
void* data = new uint8[type.[Friend]mSize]*;
Internal.MemCpy(data, val, type.[Friend]mSize);
variant.mData = (int)data;
}
return variant;
@ -164,7 +164,7 @@ namespace System
}
else
{
void* data = new uint8[type.mSize]*;
void* data = new uint8[type.[Friend]mSize]*;
variant.mData = (int)data;
return data;
}
@ -268,9 +268,9 @@ namespace System
return false;
let type = v1.VariantType;
if (type.mSize <= sizeof(int))
if (type.[Friend]mSize <= sizeof(int))
return v1.mData == v2.mData;
for (int i < type.mSize)
for (int i < type.[Friend]mSize)
{
if (((uint8*)(void*)v1.mData)[i] != ((uint8*)(void*)v2.mData)[i])
return false;

View file

@ -196,7 +196,7 @@ namespace System
protected override void GCMarkMembers()
{
let type = typeof(T);
if ((type.mTypeFlags & .WantsMark) == 0)
if ((type.[Friend]mTypeFlags & .WantsMark) == 0)
return;
for (int i = 0; i < mLength; i++)
{

View file

@ -26,10 +26,12 @@ namespace System
Invocation = 0x10000,
MemberAccess = 0x20000,
Alloc = 0x40000,
Delete = 0x80000,
All = Assembly | Module | Class | Struct | Enum | Constructor |
Method | Property | Field | StaticField | Interface | Parameter |
Delegate | Function | ReturnValue | GenericParameter | Invocation | MemberAccess,
Delegate | Function | ReturnValue | GenericParameter | Invocation | MemberAccess |
Alloc | Delete,
}
public enum ReflectKind
@ -58,22 +60,22 @@ namespace System
public sealed struct AttributeUsageAttribute : Attribute
{
internal AttributeTargets mAttributeTarget = AttributeTargets.All;
internal AttributeFlags mAttributeFlags = .None;
internal ReflectKind mReflectUser = .None;
AttributeTargets mAttributeTarget = .All;
AttributeFlags mAttributeFlags = .None;
ReflectKind mReflectUser = .None;
public this(AttributeTargets validOn)
{
mAttributeTarget = validOn;
}
internal this(AttributeTargets validOn, AttributeFlags flags)
public this(AttributeTargets validOn, AttributeFlags flags)
{
mAttributeTarget = validOn;
mAttributeFlags = flags;
}
internal this(AttributeTargets validOn, bool allowMultiple, bool inherited)
public this(AttributeTargets validOn, bool allowMultiple, bool inherited)
{
mAttributeTarget = validOn;
if (!allowMultiple)
@ -126,7 +128,7 @@ namespace System
}
}
[AttributeUsage(.MemberAccess)]
[AttributeUsage(.MemberAccess | .Alloc | .Delete)]
public struct FriendAttribute : Attribute
{

View file

@ -532,7 +532,7 @@ namespace System.Collections.Generic
#endif
private T* mCurrent;
internal this(List<T> list)
public this(List<T> list)
{
mList = list;
mIndex = 0;

View file

@ -16,7 +16,7 @@ namespace System.Collections.Generic
private int mCount;
private Comparison<T> comparer;
internal this(T* keys, T2* items, int count, Comparison<T> comparer)
public this(T* keys, T2* items, int count, Comparison<T> comparer)
{
this.keys = keys;
this.items = items;
@ -24,7 +24,7 @@ namespace System.Collections.Generic
this.comparer = comparer;
}
internal static int FloorLog2(int n)
public static int FloorLog2(int n)
{
int result = 0;
int val = n;
@ -44,7 +44,7 @@ namespace System.Collections.Generic
return low + ((hi - low) >> 1);
}
internal void SwapIfGreaterWithItems(int a, int b)
public void SwapIfGreaterWithItems(int a, int b)
{
if (a != b)
{
@ -77,7 +77,7 @@ namespace System.Collections.Generic
}
}
internal void Sort(int left, int length)
public void Sort(int left, int length)
{
IntrospectiveSort(left, length);
}

View file

@ -37,7 +37,7 @@ namespace System
public const double PositiveInfinity = (double)1.0 / (double)(0.0);
public const double NaN = (double)0.0 / (double)0.0;
internal static double NegativeZero = BitConverter.Int64BitsToDouble((int64)(0x8000000000000000UL));
public static double NegativeZero = BitConverter.Int64BitsToDouble((int64)(0x8000000000000000UL));
public static int operator<=>(Double lhs, Double rhs)
{
@ -95,7 +95,7 @@ namespace System
}
}
internal bool IsNegative
public bool IsNegative
{
get
{

View file

@ -8,19 +8,19 @@ namespace System
static readonly string NewLine = new string("\n");
#endif // !PLATFORM_UNIX
internal static String GetResourceString(String key)
public static String GetResourceString(String key)
{
return key;
//return GetResourceFromDefault(key);
}
internal static String GetResourceString(String key, params Object[] values)
public static String GetResourceString(String key, params Object[] values)
{
return key;
//return GetResourceFromDefault(key);
}
internal static String GetRuntimeResourceString(String key, String defaultValue = null)
public static String GetRuntimeResourceString(String key, String defaultValue = null)
{
if (defaultValue != null)
return defaultValue;

View file

@ -6,8 +6,8 @@ namespace System
{
struct Nullable<T> where T : struct
{
internal T mValue;
internal bool mHasValue;
T mValue;
bool mHasValue;
public this(T value)
{

View file

@ -71,16 +71,16 @@ namespace System
#else
type = mClassVData.mType;
#endif
if ((type.mTypeFlags & TypeFlags.Boxed) != 0)
if ((type.[Friend]mTypeFlags & TypeFlags.Boxed) != 0)
{
//int32 underlyingType = (int32)((TypeInstance)type).mUnderlyingType;
type = Type.GetType(((TypeInstance)type).mUnderlyingType);
type = Type.[Friend]GetType(((TypeInstance)type).[Friend]mUnderlyingType);
}
return type;
}
[NoShow]
internal Type RawGetType()
Type RawGetType()
{
Type type;
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
@ -96,7 +96,7 @@ namespace System
[NoShow]
public virtual Object DynamicCastToTypeId(int32 typeId)
{
if (typeId == (int32)RawGetType().mTypeId)
if (typeId == (int32)RawGetType().[Friend]mTypeId)
return this;
return null;
}
@ -477,8 +477,8 @@ namespace System
var typeInst = (TypeInstance)typeof(T);
for (var field in typeInst.GetFields())
{
if (str == field.mFieldData.mName)
return .Ok(*((T*)(&field.mFieldData.mConstValue)));
if (str == field.[Friend]mFieldData.mName)
return .Ok(*((T*)(&field.[Friend]mFieldData.mConstValue)));
}
return .Err;

View file

@ -5,8 +5,14 @@ namespace System.Reflection
[CRepr, AlwaysInclude]
public struct FieldInfo
{
internal TypeInstance mTypeInstance;
internal TypeInstance.FieldData* mFieldData;
public enum Error
{
InvalidTargetType,
InvalidValueType
}
TypeInstance mTypeInstance;
TypeInstance.FieldData* mFieldData;
public this(TypeInstance typeInstance, TypeInstance.FieldData* fieldData)
{
@ -26,7 +32,7 @@ namespace System.Reflection
{
get
{
return Type.GetType(mFieldData.mFieldTypeId);
return Type.[Friend]GetType(mFieldData.mFieldTypeId);
}
}
@ -38,40 +44,60 @@ namespace System.Reflection
}
}
public Result<void> SetValue(Object obj, Object value)
public Result<void, Error> SetValue(Object obj, Object value)
{
int32 dataOffsetAdjust = 0;
if (mTypeInstance.IsStruct)
{
Type boxedType = obj.RawGetType();
Type boxedType = obj.[Friend]RawGetType();
bool typeMatched = false;
if (boxedType.IsBoxed)
{
if (mTypeInstance == boxedType.UnderlyingType)
{
dataOffsetAdjust = boxedType.mMemberDataOffset;
dataOffsetAdjust = boxedType.[Friend]mMemberDataOffset;
typeMatched = true;
}
}
if (!typeMatched)
return .Err; // "Invalid target type");
return .Err(.InvalidTargetType); // "Invalid target type");
}
Type fieldType = Type.GetType(mFieldData.mFieldTypeId);
//Type objType = obj.GetType();
Type fieldType = Type.[Friend]GetType(mFieldData.mFieldTypeId);
void* fieldDataAddr = ((uint8*)(void*)obj) + mFieldData.mDataOffset + dataOffsetAdjust;
void* dataAddr = ((uint8*)(void*)obj) + mFieldData.mDataOffset + dataOffsetAdjust;
Type rawValueType = value.[Friend]RawGetType();
void* valueDataAddr = ((uint8*)(void*)value) + rawValueType.[Friend]mMemberDataOffset;
switch (fieldType.mTypeCode)
Type valueType = value.GetType();
if ((valueType != fieldType) && (valueType.IsTypedPrimitive))
valueType = valueType.UnderlyingType;
if (valueType == fieldType)
{
case TypeCode.Int32:
Internal.MemCpy(fieldDataAddr, valueDataAddr, fieldType.[Friend]mSize);
}
else
{
return .Err(.InvalidValueType);
}
/*switch (fieldType.mTypeCode)
{
case .Boolean:
if (!value is bool)
return .Err(.InvalidValueType);
*(bool*)(uint8*)dataAddr = (.)value;
break;
case .Int32:
if (!value is int32)
return .Err; //("Invalid type");
*(int32*)(uint8*)dataAddr = (int32)value;
return .Err(.InvalidValueType);
*(int32*)(uint8*)dataAddr = (.)value;
break;
default:
return .Err; //("Invalid type");
}
return .Err(.InvalidValueType);
}*/
return .Ok;
}
@ -81,13 +107,13 @@ namespace System.Reflection
int32 dataOffsetAdjust = 0;
if (mTypeInstance.IsStruct)
{
Type boxedType = obj.RawGetType();
Type boxedType = obj.[Friend]RawGetType();
bool typeMatched = false;
if (boxedType.IsBoxed)
{
if (mTypeInstance == boxedType.UnderlyingType)
{
dataOffsetAdjust = boxedType.mMemberDataOffset;
dataOffsetAdjust = boxedType.[Friend]mMemberDataOffset;
typeMatched = true;
}
}
@ -95,8 +121,7 @@ namespace System.Reflection
return .Err;//("Invalid target type");
}
Type fieldType = Type.GetType(mFieldData.mFieldTypeId);
//Type objType = obj.GetType();
Type fieldType = Type.[Friend]GetType(mFieldData.mFieldTypeId);
void* dataAddr = ((uint8*)(void*)obj) + mFieldData.mDataOffset + dataOffsetAdjust;
@ -105,26 +130,6 @@ namespace System.Reflection
value.CopyValueData(dataAddr);
//TypeCode typeCode = fieldType.mTypeCode;
/*if (typeCode == TypeCode.Enum)
typeCode = fieldType.GetUnderlyingType().mTypeCode;
switch (typeCode)
{
case TypeCode.Int32:
*(int32*)dataAddr = value.Get<int32>();
break;
case TypeCode.Boolean:
*(bool*)dataAddr = value.Get<bool>();
break;
case TypeCode.Object:
*(Object*)dataAddr = value.Get<Object>();
break;
default:
return .Err;//("Invalid type");
}*/
return .Ok;
}
@ -135,12 +140,10 @@ namespace System.Reflection
public Result<T> GetCustomAttribute<T>() where T : Attribute
{
return .Err;
/*if (mFieldData.mCustomAttributesIdx == -1)
return .Err;
void* data = mTypeInstance.mCustomAttrDataPtr[mFieldData.mCustomAttributesIdx];
void* data = mTypeInstance.[Friend]mCustomAttrDataPtr[mFieldData.mCustomAttributesIdx];
T attrInst = ?;
switch (AttributeInfo.GetCustomAttribute(data, typeof(T), &attrInst))
@ -149,21 +152,17 @@ namespace System.Reflection
default:
return .Err;
}*/
return .Err;
}
void* GetDataPtrAndType(Object value, out Type type)
{
type = value.RawGetType();
type = value.[Friend]RawGetType();
/*if (type.IsStruct)
return &value;*/
if (type.IsStruct)
{
NOP!();
}
if (type.IsBoxed)
return ((uint8*)(void*)value) + type.mMemberDataOffset;
return ((uint8*)(void*)value) + type.[Friend]mMemberDataOffset;
return ((uint8*)(void*)value);
}
@ -173,37 +172,26 @@ namespace System.Reflection
Type tTarget;
void* targetDataAddr = GetDataPtrAndType(target, out tTarget);
//Type tTarget = target.RawGetType();
//void* targetDataAddr = (void*)&target;
Type tMember = typeof(TMember);
targetDataAddr = (uint8*)targetDataAddr + mFieldData.mDataOffset;
Type fieldType = Type.GetType(mFieldData.mFieldTypeId);
Type fieldType = Type.[Friend]GetType(mFieldData.mFieldTypeId);
if (tMember.mTypeCode == TypeCode.Object)
if (tMember.[Friend]mTypeCode == TypeCode.Object)
{
if (!tTarget.IsSubtypeOf(mTypeInstance))
Runtime.FatalError();
value = *(TMember*)targetDataAddr;
}
else if (tMember.mTypeCode == TypeCode.Int32)
else if (fieldType.[Friend]mTypeCode == tMember.[Friend]mTypeCode)
{
if (fieldType.mTypeCode == TypeCode.Int32)
{
if (tMember.mTypeCode != TypeCode.Int32)
Runtime.FatalError("Expected int");
*(int32*)&value = *(int32*)targetDataAddr;
Internal.MemCpy(&value, targetDataAddr, tMember.Size);
}
else
{
return .Err;//("Invalid type");
}
}
else
{
return .Err;//("Invalid type");
return .Err;
}
return .Ok;
@ -215,67 +203,28 @@ namespace System.Reflection
Type tTarget;
void* targetDataAddr = GetDataPtrAndType(target, out tTarget);
//Type tTarget = target.RawGetType();
//void* targetDataAddr = (void*)&target;
if (!tTarget.IsSubtypeOf(mTypeInstance))
Runtime.FatalError("Invalid type");
targetDataAddr = (uint8*)targetDataAddr + mFieldData.mDataOffset;
Type fieldType = Type.GetType(mFieldData.mFieldTypeId);
Type fieldType = Type.[Friend]GetType(mFieldData.mFieldTypeId);
/*if (fieldType.IsNullable)
{
var specializedType = (SpecializedGenericType)fieldType;
var genericArg = specializedType.GetGenericArg(0);
bool hasValue = *(bool*)((uint8*)targetDataAddr + genericArg.mSize);
if (!hasValue)
return .Err;
fieldType = genericArg;
}*/
//value.mStructType = (int)(void*)fieldType;
TypeCode typeCode = fieldType.mTypeCode;
TypeCode typeCode = fieldType.[Friend]mTypeCode;
if (typeCode == TypeCode.Enum)
typeCode = fieldType.UnderlyingType.mTypeCode;
typeCode = fieldType.UnderlyingType.[Friend]mTypeCode;
/*if (typeCode == TypeCode.Int32)
if (typeCode == TypeCode.Object)
{
*(int32*)&value.mData = *(int32*)targetDataAddr;
}
else if (typeCode == TypeCode.Boolean)
{
*(bool*)&value.mData = *(bool*)targetDataAddr;
}
else */if (typeCode == TypeCode.Object)
{
value.mStructType = 0;
value.mData = *(int*)targetDataAddr;
value.[Friend]mStructType = 0;
value.[Friend]mData = *(int*)targetDataAddr;
}
else
{
value = Variant.Create(fieldType, targetDataAddr);
}
/*else if (fieldType.mSize <= sizeof(int))
{
value.mStructType = (int)(void*)fieldType;
Internal.MemCpy(&value.mData, targetDataAddr, fieldType.mSize);
}
else
{
value.mStructType = (int)(void*)fieldType;
void* data = new uint8[fieldType.mSize]*;
Internal.MemCpy(data, targetDataAddr, fieldType.mSize);
value.mData = (int)data;
}*/
/*{
return .Err;
}*/
return value;
}
@ -296,21 +245,21 @@ namespace System.Reflection
#unwarn
void* targetDataAddr = (void*)(int)mFieldData.mConstValue;
Type fieldType = Type.GetType(mFieldData.mFieldTypeId);
value.mStructType = (int)(void*)fieldType;
Type fieldType = Type.[Friend]GetType(mFieldData.mFieldTypeId);
value.[Friend]mStructType = (int)(void*)fieldType;
TypeCode typeCode = fieldType.mTypeCode;
TypeCode typeCode = fieldType.[Friend]mTypeCode;
if (typeCode == TypeCode.Enum)
typeCode = fieldType.UnderlyingType.mTypeCode;
typeCode = fieldType.UnderlyingType.[Friend]mTypeCode;
if (typeCode == TypeCode.Int32)
{
*(int32*)&value.mData = *(int32*)targetDataAddr;
*(int32*)&value.[Friend]mData = *(int32*)targetDataAddr;
}
else if (typeCode == TypeCode.Object)
{
value.mStructType = 0;
value.mData = (int)targetDataAddr;
value.[Friend]mStructType = 0;
value.[Friend]mData = (int)targetDataAddr;
}
else
{
@ -320,13 +269,13 @@ namespace System.Reflection
return value;
}
internal struct Enumerator : IEnumerator<FieldInfo>
public struct Enumerator : IEnumerator<FieldInfo>
{
BindingFlags mBindingFlags;
TypeInstance mTypeInstance;
int32 mIdx;
internal this(TypeInstance typeInst, BindingFlags bindingFlags)
public this(TypeInstance typeInst, BindingFlags bindingFlags)
{
mTypeInstance = typeInst;
mBindingFlags = bindingFlags;
@ -350,9 +299,9 @@ namespace System.Reflection
for (;;)
{
mIdx++;
if (mIdx == mTypeInstance.mFieldDataCount)
if (mIdx == mTypeInstance.[Friend]mFieldDataCount)
return false;
var fieldData = &mTypeInstance.mFieldDataPtr[mIdx];
var fieldData = &mTypeInstance.[Friend]mFieldDataPtr[mIdx];
bool matches = (mBindingFlags.HasFlag(BindingFlags.Static) && (fieldData.mFlags.HasFlag(FieldFlags.Static)));
matches |= (mBindingFlags.HasFlag(BindingFlags.Instance) && (!fieldData.mFlags.HasFlag(FieldFlags.Static)));
if (matches)
@ -365,7 +314,7 @@ namespace System.Reflection
{
get
{
var fieldData = &mTypeInstance.mFieldDataPtr[mIdx];
var fieldData = &mTypeInstance.[Friend]mFieldDataPtr[mIdx];
return FieldInfo(mTypeInstance, fieldData);
}
}

View file

@ -150,7 +150,7 @@ namespace System
static Type Object_GetType(Object obj)
{
#if BF_DBG_RUNTIME
return obj.RawGetType();
return obj.[Friend]RawGetType();
#else
return null;
#endif

View file

@ -145,7 +145,7 @@ namespace System
private int mIndex;
private T* mCurrent;
internal this(Span<T> list)
public this(Span<T> list)
{
mList = list;
mIndex = 0;

View file

@ -328,7 +328,7 @@ namespace System
}
}
internal static bool EqualsHelper(char8* a, char8* b, int length)
public static bool EqualsHelper(char8* a, char8* b, int length)
{
for (int i = 0; i < length; i++)
if (a[i] != b[i])
@ -409,7 +409,7 @@ namespace System
mAllocSizeAndFlags = (uint32)newSize | DynAllocFlag | StrPtrFlag;
}
internal void Append(char8* appendPtr, int length)
public void Append(char8* appendPtr, int length)
{
int32 newCurrentIndex = (int32)(mLength + length);
if (newCurrentIndex >= AllocSize)

View file

@ -10,3 +10,17 @@ class Foogie<T> where T : IHashable
val.GetHashCode();
}
}
struct Zorbble
{
public int mA;
public void MainMethod()
{
}
static void Zoff()
{
}
}

View file

@ -3,7 +3,7 @@ namespace System.Threading
using System;
using System.Diagnostics;
internal delegate Object InternalCrossContextDelegate(Object[] args);
public delegate Object InternalCrossContextDelegate(Object[] args);
public delegate void ThreadStart();
public delegate void ParameterizedThreadStart(Object obj);

View file

@ -19,7 +19,7 @@ namespace System.Threading {
//public static readonly TimeSpan InfiniteTimeSpan = TimeSpan(0, 0, 0, 0, Timeout.Infinite);
public const int32 Infinite = -1;
internal const uint32 UnsignedInfinite = unchecked((uint32)-1);
public const uint32 UnsignedInfinite = unchecked((uint32)-1);
}
}

View file

@ -22,20 +22,20 @@ namespace System
private const int32 MillisPerHour = MillisPerMinute * 60; // 3,600,000
private const int32 MillisPerDay = MillisPerHour * 24; // 86,400,000
internal const int64 MaxSeconds = Int64.MaxValue / TicksPerSecond;
internal const int64 MinSeconds = Int64.MinValue / TicksPerSecond;
private const int64 MaxSeconds = Int64.MaxValue / TicksPerSecond;
private const int64 MinSeconds = Int64.MinValue / TicksPerSecond;
internal const int64 MaxMilliSeconds = Int64.MaxValue / TicksPerMillisecond;
internal const int64 MinMilliSeconds = Int64.MinValue / TicksPerMillisecond;
private const int64 MaxMilliSeconds = Int64.MaxValue / TicksPerMillisecond;
private const int64 MinMilliSeconds = Int64.MinValue / TicksPerMillisecond;
internal const int64 TicksPerTenthSecond = TicksPerMillisecond * 100;
private const int64 TicksPerTenthSecond = TicksPerMillisecond * 100;
//public static readonly TimeSpan Zero = new TimeSpan(0);
//public static readonly TimeSpan MaxValue = new TimeSpan(Int64.MaxValue);
//public static readonly TimeSpan MinValue = new TimeSpan(Int64.MinValue);
internal int64 _ticks;
private int64 _ticks;
//public TimeSpan() {
// _ticks = 0;

View file

@ -15,16 +15,16 @@ namespace System
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
public class Type
{
internal extern const Type* sTypes;
extern const Type* sTypes;
protected const BindingFlags cDefaultLookup = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;
internal int32 mSize;
internal TypeId mTypeId;
internal TypeFlags mTypeFlags;
internal int32 mMemberDataOffset;
internal TypeCode mTypeCode;
internal uint8 mAlign;
protected int32 mSize;
protected TypeId mTypeId;
protected TypeFlags mTypeFlags;
protected int32 mMemberDataOffset;
protected TypeCode mTypeCode;
protected uint8 mAlign;
public int32 Size
{
@ -213,6 +213,14 @@ namespace System
}
}
public bool IsPointer
{
get
{
return (mTypeFlags & (TypeFlags.Boxed | TypeFlags.Pointer)) == TypeFlags.Pointer;
}
}
public bool IsBoxed
{
get
@ -221,6 +229,14 @@ namespace System
}
}
public bool IsBoxedStructPtr
{
get
{
return (mTypeFlags & (TypeFlags.Boxed | TypeFlags.Pointer)) == TypeFlags.Boxed | TypeFlags.Pointer;
}
}
public bool IsEnum
{
get
@ -333,6 +349,15 @@ namespace System
}
}
public virtual int32 MinValue
{
[Error("This property can only be accessed directly from a typeof() expression")]
get
{
return 0;
}
}
public virtual int32 MaxValue
{
[Error("This property can only be accessed directly from a typeof() expression")]
@ -342,18 +367,17 @@ namespace System
}
}
public int32 GetTypeId()
{
return (int32)mTypeId;
}
internal static Type GetType(TypeId typeId)
protected static Type GetType(TypeId typeId)
{
return sTypes[(int32)typeId];
}
internal static Type GetType_(int32 typeId)
protected static Type GetType_(int32 typeId)
{
return sTypes[typeId];
}
@ -419,9 +443,9 @@ namespace System
return type == this;
}
public virtual FieldInfo? GetField(String fieldName)
public virtual Result<FieldInfo> GetField(String fieldName)
{
return null;
return .Err;
}
public virtual FieldInfo.Enumerator GetFields(BindingFlags bindingFlags = cDefaultLookup)
@ -469,50 +493,50 @@ namespace System
namespace System.Reflection
{
internal struct TypeId : int32
public struct TypeId : int32
{
public Type ToType()
{
return Type.sTypes[(int32)this];
return Type.[Friend]sTypes[(int32)this];
}
}
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class TypeInstance : Type
public class TypeInstance : Type
{
[CRepr, AlwaysInclude]
internal struct FieldData
public struct FieldData
{
internal String mName;
internal int64 mConstValue;
internal int32 mDataOffset;
internal TypeId mFieldTypeId;
internal FieldFlags mFlags;
internal int32 mCustomAttributesIdx;
public String mName;
public int64 mConstValue;
public int32 mDataOffset;
public TypeId mFieldTypeId;
public FieldFlags mFlags;
public int32 mCustomAttributesIdx;
}
// This is only valid if there is no FieldData on a splattable struct
[CRepr, AlwaysInclude]
internal struct FieldSplatData
public struct FieldSplatData
{
internal TypeId[3] mSplatTypes;
internal int32[3] mSplatOffsets;
public TypeId[3] mSplatTypes;
public int32[3] mSplatOffsets;
}
[CRepr, AlwaysInclude]
internal struct MethodData
public struct MethodData
{
internal String mName; // mName
internal void* mFuncPtr;
internal ParamData* mParamData;
internal TypeId mReturnType;
internal int16 mParamCount;
internal MethodFlags mFlags;
internal int32 mVirtualIdx;
internal int32 mCustomAttributesIdx;
public String mName; // mName
public void* mFuncPtr;
public ParamData* mParamData;
public TypeId mReturnType;
public int16 mParamCount;
public MethodFlags mFlags;
public int32 mVirtualIdx;
public int32 mCustomAttributesIdx;
}
internal enum ParamFlags : int16
public enum ParamFlags : int16
{
None = 0,
Splat = 1,
@ -520,39 +544,39 @@ namespace System.Reflection
}
[CRepr, AlwaysInclude]
internal struct ParamData
public struct ParamData
{
internal String mName;
internal TypeId mType;
internal ParamFlags mParamFlags;
internal int32 mDefaultIdx;
public String mName;
public TypeId mType;
public ParamFlags mParamFlags;
public int32 mDefaultIdx;
}
internal ClassVData* mTypeClassVData;
internal String mName;
internal String mNamespace;
internal int32 mInstSize;
internal int32 mInstAlign;
internal int32 mCustomAttributesIdx;
internal TypeId mBaseType;
internal TypeId mUnderlyingType;
internal TypeId mOuterType;
internal int32 mInheritanceId;
internal int32 mInheritanceCount;
ClassVData* mTypeClassVData;
String mName;
String mNamespace;
int32 mInstSize;
int32 mInstAlign;
int32 mCustomAttributesIdx;
TypeId mBaseType;
TypeId mUnderlyingType;
TypeId mOuterType;
int32 mInheritanceId;
int32 mInheritanceCount;
internal uint8 mInterfaceSlot;
internal uint8 mInterfaceCount;
internal int16 mMethodDataCount;
internal int16 mPropertyDataCount;
internal int16 mFieldDataCount;
internal int16 mConstructorDataCount;
uint8 mInterfaceSlot;
uint8 mInterfaceCount;
int16 mMethodDataCount;
int16 mPropertyDataCount;
int16 mFieldDataCount;
int16 mConstructorDataCount;
internal void* mInterfaceDataPtr;
internal MethodData* mMethodDataPtr;
internal void* mPropertyDataPtr;
internal FieldData* mFieldDataPtr;
internal void* mConstructorDataPtr;
internal void** mCustomAttrDataPtr;
void* mInterfaceDataPtr;
MethodData* mMethodDataPtr;
void* mPropertyDataPtr;
FieldData* mFieldDataPtr;
void* mConstructorDataPtr;
void** mCustomAttrDataPtr;
public override int32 InstanceSize
@ -583,7 +607,7 @@ namespace System.Reflection
{
get
{
return (TypeInstance)Type.GetType(mBaseType);
return (TypeInstance)Type.[Friend]GetType(mBaseType);
}
}
@ -591,7 +615,7 @@ namespace System.Reflection
{
get
{
return (TypeInstance)Type.GetType(mOuterType);
return (TypeInstance)Type.[Friend]GetType(mOuterType);
}
}
@ -599,7 +623,7 @@ namespace System.Reflection
{
get
{
return Type.GetType(mUnderlyingType);
return Type.[Friend]GetType(mUnderlyingType);
}
}
@ -620,7 +644,7 @@ namespace System.Reflection
return true;
if (curType.mBaseType == 0)
return false;
curType = (TypeInstance)Type.GetType(curType.mBaseType);
curType = (TypeInstance)Type.[Friend]GetType(curType.mBaseType);
}
}
@ -633,7 +657,7 @@ namespace System.Reflection
{
if (fieldIdx > 0)
strBuffer.Append(", ");
GetType(mFieldDataPtr[fieldIdx].mFieldTypeId).GetFullName(strBuffer);
GetType(mFieldDataPtr[fieldIdx].[Friend]mFieldTypeId).GetFullName(strBuffer);
}
strBuffer.Append(')');
}
@ -659,15 +683,15 @@ namespace System.Reflection
strBuffer.Append(mName);
}
public override FieldInfo? GetField(String fieldName)
public override Result<FieldInfo> GetField(String fieldName)
{
for (int32 i = 0; i < mFieldDataCount; i++)
{
FieldData* fieldData = &mFieldDataPtr[i];
if (fieldData.mName == fieldName)
if (fieldData.[Friend]mName == fieldName)
return FieldInfo(this, fieldData);
}
return null;
return .Err;
}
public override FieldInfo.Enumerator GetFields(BindingFlags bindingFlags = cDefaultLookup)
@ -677,15 +701,15 @@ namespace System.Reflection
}
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class PointerType : Type
class PointerType : Type
{
internal TypeId mElementType;
TypeId mElementType;
public override Type UnderlyingType
{
get
{
return Type.GetType(mElementType);
return Type.[Friend]GetType(mElementType);
}
}
@ -697,16 +721,16 @@ namespace System.Reflection
}
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class SizedArrayType : Type
class SizedArrayType : Type
{
internal TypeId mElementType;
internal int32 mElementCount;
TypeId mElementType;
int32 mElementCount;
public override Type UnderlyingType
{
get
{
return Type.GetType(mElementType);
return Type.[Friend]GetType(mElementType);
}
}
@ -728,31 +752,31 @@ namespace System.Reflection
}
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class UnspecializedGenericType : TypeInstance
class UnspecializedGenericType : TypeInstance
{
[CRepr, AlwaysInclude]
internal struct GenericParam
struct GenericParam
{
internal String mName;
String mName;
}
internal uint8 mGenericParamCount;
uint8 mGenericParamCount;
}
// Only for resolved types
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class SpecializedGenericType : TypeInstance
class SpecializedGenericType : TypeInstance
{
internal TypeId mUnspecializedType;
internal TypeId* mResolvedTypeRefs;
TypeId mUnspecializedType;
TypeId* mResolvedTypeRefs;
public override int32 GenericParamCount
{
get
{
var unspecializedTypeG = Type.GetType(mUnspecializedType);
var unspecializedTypeG = Type.[Friend]GetType(mUnspecializedType);
var unspecializedType = (UnspecializedGenericType)unspecializedTypeG;
return unspecializedType.mGenericParamCount;
return unspecializedType.[Friend]mGenericParamCount;
}
}
@ -763,7 +787,7 @@ namespace System.Reflection
public override void GetFullName(String strBuffer)
{
var unspecializedTypeG = Type.GetType(mUnspecializedType);
var unspecializedTypeG = Type.[Friend]GetType(mUnspecializedType);
var unspecializedType = (UnspecializedGenericType)unspecializedTypeG;
base.GetFullName(strBuffer);
@ -772,14 +796,14 @@ namespace System.Reflection
if (outerType != null)
outerGenericCount = outerType.GenericParamCount;
if (outerGenericCount < unspecializedType.mGenericParamCount)
if (outerGenericCount < unspecializedType.[Friend]mGenericParamCount)
{
strBuffer.Append('<');
for (int i = outerGenericCount; i < unspecializedType.mGenericParamCount; i++)
for (int i = outerGenericCount; i < unspecializedType.[Friend]mGenericParamCount; i++)
{
if (i > 0)
strBuffer.Append(", ");
Type.GetType(mResolvedTypeRefs[i]).GetFullName(strBuffer);
Type.[Friend]GetType(mResolvedTypeRefs[i]).GetFullName(strBuffer);
}
strBuffer.Append('>');
}
@ -787,15 +811,15 @@ namespace System.Reflection
}
[CRepr, AlwaysInclude(AssumeInstantiated=true)]
internal class ArrayType : SpecializedGenericType
class ArrayType : SpecializedGenericType
{
internal int32 mElementSize;
internal uint8 mRank;
internal uint8 mElementsDataOffset;
int32 mElementSize;
uint8 mRank;
uint8 mElementsDataOffset;
public override void GetFullName(String strBuffer)
{
Type.GetType(mResolvedTypeRefs[0]).GetFullName(strBuffer);
Type.[Friend]GetType(mResolvedTypeRefs[0]).GetFullName(strBuffer);
strBuffer.Append('[');
for (int commaNum < mRank - 1)
strBuffer.Append(',');
@ -820,7 +844,7 @@ namespace System.Reflection
SizedArray = 0x0800,
Splattable = 0x1000,
Union = 0x2000,
Sys_PointerT = 0x4000, // System.Pointer<T>
//
WantsMark = 0x8000,
Delegate = 0x10000,
HasDestructor = 0x20000,
@ -848,7 +872,6 @@ namespace System.Reflection
EnumDiscriminator = 0x0200
}
[AllowDuplicates]
public enum MethodFlags : int16
{
MethodAccessMask = 0x0007,
@ -870,8 +893,9 @@ namespace System.Reflection
// vtable layout mask - Use this mask to retrieve vtable attributes.
VtableLayoutMask = 0x0100,
#unwarn
ReuseSlot = 0x0000, // The default.
#unwarn
NewSlot = 0x0100, // Method always gets a new slot in the vtable.
// end vtable layout mask
@ -880,6 +904,7 @@ namespace System.Reflection
SpecialName = 0x0800, // Method is special. Name describes how.
StdCall = 0x1000,
FastCall = 0x2000,
ThisCall = 0x3000, // Purposely resuing StdCall|FastCall
Mutating = 0x4000
}
}

View file

@ -4,8 +4,8 @@ namespace System
{
struct Variant
{
internal int mStructType; // 0 = unowned object, 1 = owned object, 2 = null value (mData is type), otherwise is struct type
internal int mData; // This is either an Object reference, struct data, or a pointer to struct data
int mStructType; // 0 = unowned object, 1 = owned object, 2 = null value (mData is type), otherwise is struct type
int mData; // This is either an Object reference, struct data, or a pointer to struct data
public bool OwnsMemory
{
@ -49,7 +49,6 @@ namespace System
}
}
#if BF_ENABLE_REALTIME_LEAK_CHECK
protected override void GCMarkMembers()
{
if ((mStructType == 1) || (mStructType == 0))
@ -58,7 +57,6 @@ namespace System
GC.Mark(obj);
}
}
#endif
public void Dispose() mut
{
@ -137,12 +135,12 @@ namespace System
if (type.Size <= sizeof(int))
{
variant.mData = 0;
Internal.MemCpy(&variant.mData, val, type.mSize);
Internal.MemCpy(&variant.mData, val, type.[Friend]mSize);
}
else
{
void* data = new uint8[type.mSize]*;
Internal.MemCpy(data, val, type.mSize);
void* data = new uint8[type.[Friend]mSize]*;
Internal.MemCpy(data, val, type.[Friend]mSize);
variant.mData = (int)data;
}
return variant;
@ -166,27 +164,21 @@ namespace System
}
else
{
void* data = new uint8[type.mSize]*;
void* data = new uint8[type.[Friend]mSize]*;
variant.mData = (int)data;
return data;
}
}
}
public void Get<T>(ref T val)
{
if (VariantType != typeof(T))
return;
val = Get<T>();
}
public T Get<T>() where T : class
{
Debug.Assert(IsObject);
if (mStructType == 2)
return (T)null;
Type type = typeof(T);
T obj = (T)Internal.UnsafeCastToObject((void*)mData);
Debug.Assert(obj.GetType().IsSubtypeOf(typeof(T)));
Debug.Assert(obj.GetType().IsSubtypeOf(type));
return obj;
}
@ -218,6 +210,13 @@ namespace System
return *(T*)(void*)mData;
}
/*public void Get<T>(ref T val)
{
if (VariantType != typeof(T))
return;
val = Get<T>();
}*/
public void CopyValueData(void* dest)
{
if (IsObject)
@ -269,9 +268,9 @@ namespace System
return false;
let type = v1.VariantType;
if (type.mSize <= sizeof(int))
if (type.[Friend]mSize <= sizeof(int))
return v1.mData == v2.mData;
for (int i < type.mSize)
for (int i < type.[Friend]mSize)
{
if (((uint8*)(void*)v1.mData)[i] != ((uint8*)(void*)v2.mData)[i])
return false;

View file

@ -73,7 +73,7 @@ namespace IDE.Compiler
public bool mFailed;
public int32 mId = sCurId++;
internal String mDbgStr ~ delete _;
public String mDbgStr ~ delete _;
public this(void* nativePassInstance)
{

View file

@ -92,7 +92,7 @@ namespace IDE.Debugger
static extern void* Debugger_GetActiveBreakpoint();
[StdCall, CLink]
internal static extern void* Debugger_CreateMemoryBreakpoint(int addr, int32 byteCount);
static extern void* Debugger_CreateMemoryBreakpoint(int addr, int32 byteCount);
public void* mNativeBreakpoint;
public String mSymbol ~ delete _;
@ -116,7 +116,7 @@ namespace IDE.Debugger
public Event<Action> mOnDelete;
internal ~this()
public ~this()
{
mOnDelete();
mIsDisposed = true;

View file

@ -591,7 +591,7 @@ namespace IDE.Debugger
void* nativeBreakpoint = null;
if (addr != (int)0)
{
nativeBreakpoint = Breakpoint.Debugger_CreateMemoryBreakpoint(addr, (.)byteCount);
nativeBreakpoint = Breakpoint.[Friend]Debugger_CreateMemoryBreakpoint(addr, (.)byteCount);
if (nativeBreakpoint == null)
return null;
}

View file

@ -7356,16 +7356,16 @@ namespace IDE
if (mVerbosity >= .Detailed)
{
String showArgs = startInfo.mArguments;
String showArgs = startInfo.[Friend]mArguments;
if ((mRunningTestScript) && (showArgs.Length > 1024))
{
showArgs = scope:: String(showArgs, 0, 1024);
showArgs.Append("...");
}
if (!startInfo.mFileName.IsEmpty)
if (!startInfo.[Friend]mFileName.IsEmpty)
{
OutputLine("Executing: {0} {1}", startInfo.mFileName, showArgs);
OutputLine("Executing: {0} {1}", startInfo.[Friend]mFileName, showArgs);
if ((mVerbosity >= .Diagnostic) && (useArgsFile != .None))
OutputLine("Arg file contents: {0}", args);
}

Some files were not shown because too many files have changed in this diff Show more