forked from CosmosOS/Cosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8e527a
commit 3cf8c80
Showing
8 changed files
with
293 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
Tests/Cosmos.Compiler.Tests.TypeSystem/Cosmos.Compiler.Tests.TypeSystem.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\source\Cosmos.System2\Cosmos.System2.csproj" /> | ||
<ProjectReference Include="..\Cosmos.TestRunner.TestController\Cosmos.TestRunner.TestController.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Cosmos.TestRunner; | ||
using System; | ||
using Sys = Cosmos.System; | ||
|
||
namespace Cosmos.Compiler.Tests.TypeSystem | ||
{ | ||
public class Kernel : Sys.Kernel | ||
{ | ||
protected override void BeforeRun() | ||
{ | ||
Console.WriteLine("Cosmos booted successfully. Starting BCL tests now please wait..."); | ||
} | ||
|
||
protected override void Run() | ||
{ | ||
try | ||
{ | ||
mDebugger.Send("Run"); | ||
|
||
string xString = "a"; | ||
Type xType = xString.GetType(); | ||
if (xType == typeof(string)) | ||
{ | ||
mDebugger.Send("Type is a string."); | ||
} | ||
|
||
TestController.Completed(); | ||
} | ||
catch (Exception e) | ||
{ | ||
mDebugger.Send("Exception occurred: " + e.Message); | ||
mDebugger.Send(e.Message); | ||
Console.WriteLine("Exception occurred"); | ||
Console.WriteLine(e.Message); | ||
TestController.Failed(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Reflection; | ||
|
||
namespace Cosmos.Core | ||
{ | ||
public class CosmosRuntimeType : Type | ||
{ | ||
internal uint mTypeId; | ||
|
||
public CosmosRuntimeType(uint aTypeId) | ||
: this() | ||
{ | ||
mTypeId = aTypeId; | ||
} | ||
|
||
protected CosmosRuntimeType() | ||
{ | ||
Name = ""; | ||
FullName = ""; | ||
Namespace = ""; | ||
AssemblyQualifiedName = ""; | ||
GUID = Guid.Empty; | ||
Module = null; | ||
Assembly = null; | ||
UnderlyingSystemType = null; | ||
BaseType = null; | ||
} | ||
|
||
public override string Name { get; } | ||
public override string FullName { get; } | ||
public override string Namespace { get; } | ||
public override string AssemblyQualifiedName { get; } | ||
public override Guid GUID { get; } | ||
public override Module Module { get; } | ||
public override Assembly Assembly { get; } | ||
public override Type UnderlyingSystemType { get; } | ||
public override Type BaseType { get; } | ||
|
||
protected override bool IsArrayImpl() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override bool IsByRefImpl() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override bool IsCOMObjectImpl() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override bool IsPointerImpl() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override bool IsPrimitiveImpl() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override bool HasElementTypeImpl() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Type GetElementType() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
// Attributes | ||
public override object[] GetCustomAttributes(bool inherit) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override object[] GetCustomAttributes(Type attributeType, bool inherit) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override bool IsDefined(Type attributeType, bool inherit) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override TypeAttributes GetAttributeFlagsImpl() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
// Constructor | ||
protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
// Event | ||
public override EventInfo GetEvent(string name, BindingFlags bindingAttr) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override EventInfo[] GetEvents(BindingFlags bindingAttr) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
// Field | ||
public override FieldInfo GetField(string name, BindingFlags bindingAttr) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override FieldInfo[] GetFields(BindingFlags bindingAttr) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
// Member | ||
public override MemberInfo[] GetMembers(BindingFlags bindingAttr) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
// Method | ||
protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override MethodInfo[] GetMethods(BindingFlags bindingAttr) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
// Property | ||
protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override PropertyInfo[] GetProperties(BindingFlags bindingAttr) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
// Nested Type | ||
public override Type GetNestedType(string name, BindingFlags bindingAttr) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Type[] GetNestedTypes(BindingFlags bindingAttr) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
// Interface | ||
public override Type GetInterface(string name, bool ignoreCase) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Type[] GetInterfaces() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Cosmos.Core; | ||
using Cosmos.Debug.Kernel; | ||
using Cosmos.IL2CPU.API.Attribs; | ||
using System; | ||
|
||
namespace Cosmos.Core_Plugs.System | ||
{ | ||
[Plug(Target = typeof(Type))] | ||
public unsafe class TypeImpl | ||
{ | ||
private static Debugger mDebugger = new Debugger("Core", "Type Plug"); | ||
|
||
public static void CCtor() | ||
{ | ||
} | ||
|
||
[PlugMethod(Signature = "System_Type__System_Type_GetTypeFromHandle_System_RuntimeTypeHandle_")] | ||
public static Type GetTypeFromHandle(ulong aHandle) | ||
{ | ||
uint x = (uint)(aHandle >> 32); | ||
uint* y = (uint*)x; | ||
uint xTypeId = *y; | ||
var xType = new CosmosRuntimeType(xTypeId); | ||
return xType; | ||
} | ||
|
||
public static bool op_Equality(CosmosRuntimeType aLeft, CosmosRuntimeType aRight) | ||
{ | ||
return aLeft.mTypeId == aRight.mTypeId; | ||
} | ||
|
||
public static bool op_Inequality(CosmosRuntimeType aLeft, CosmosRuntimeType aRight) | ||
{ | ||
mDebugger.Send("Type.GetInequality"); | ||
|
||
return aLeft.mTypeId != aRight.mTypeId; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.