mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +00:00
Add comparers for byte and char.
This commit is contained in:
parent
04e45a7d00
commit
2ca4b2adb8
4 changed files with 60 additions and 29 deletions
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeIdentifier>cosmos</RuntimeIdentifier>
|
||||
<Profile>Bochs</Profile>
|
||||
<Profile>VMware</Profile>
|
||||
<BinFormat>ELF</BinFormat>
|
||||
<StackCorruptionDetectionEnabled>True</StackCorruptionDetectionEnabled>
|
||||
<StackCorruptionDetectionLevel>MethodFooters</StackCorruptionDetectionLevel>
|
||||
|
|
@ -19,11 +19,11 @@
|
|||
<_DebugMode>Source</_DebugMode>
|
||||
<_IgnoreDebugStubAttribute>False</_IgnoreDebugStubAttribute>
|
||||
<_PxeInterface>192.168.211.1</_PxeInterface>
|
||||
<Description>Use Bochs emulator to deploy and debug.</Description>
|
||||
<Launch>Bochs</Launch>
|
||||
<Description>Use VMware Player or Workstation to deploy and debug.</Description>
|
||||
<Launch>VMware</Launch>
|
||||
<VisualStudioDebugPort>Pipe: Cosmos\Serial</VisualStudioDebugPort>
|
||||
<EnableGDB>True</EnableGDB>
|
||||
<StartCosmosGDB>True</StartCosmosGDB>
|
||||
<EnableGDB>False</EnableGDB>
|
||||
<StartCosmosGDB>False</StartCosmosGDB>
|
||||
<VMware_StackCorruptionDetectionEnabled>True</VMware_StackCorruptionDetectionEnabled>
|
||||
<VMware_StackCorruptionDetectionLevel>MethodFooters</VMware_StackCorruptionDetectionLevel>
|
||||
<VMware_Description>Use VMware Player or Workstation to deploy and debug.</VMware_Description>
|
||||
|
|
@ -36,6 +36,18 @@
|
|||
<VMware_PxeInterface>192.168.211.1</VMware_PxeInterface>
|
||||
<VMware_EnableGDB>True</VMware_EnableGDB>
|
||||
<VMware_StartCosmosGDB>True</VMware_StartCosmosGDB>
|
||||
<Bochs_StackCorruptionDetectionEnabled>True</Bochs_StackCorruptionDetectionEnabled>
|
||||
<Bochs_StackCorruptionDetectionLevel>MethodFooters</Bochs_StackCorruptionDetectionLevel>
|
||||
<Bochs_Description>Use Bochs emulator to deploy and debug.</Bochs_Description>
|
||||
<Bochs_Deployment>ISO</Bochs_Deployment>
|
||||
<Bochs_Launch>Bochs</Bochs_Launch>
|
||||
<Bochs_DebugEnabled>True</Bochs_DebugEnabled>
|
||||
<Bochs_DebugMode>Source</Bochs_DebugMode>
|
||||
<Bochs_IgnoreDebugStubAttribute>False</Bochs_IgnoreDebugStubAttribute>
|
||||
<Bochs_VisualStudioDebugPort>Pipe: Cosmos\Serial</Bochs_VisualStudioDebugPort>
|
||||
<Bochs_PxeInterface>192.168.211.1</Bochs_PxeInterface>
|
||||
<Bochs_EnableGDB>True</Bochs_EnableGDB>
|
||||
<Bochs_StartCosmosGDB>True</Bochs_StartCosmosGDB>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ namespace ZLibrary.Machine
|
|||
public ZConsoleScreen(ZMachine aMachine)
|
||||
{
|
||||
_machine = aMachine;
|
||||
_consoles.Add(new VirtualConsole(19, 60, 1, 0));
|
||||
_consoles.Add(new VirtualConsole(1, 60, 0,0));
|
||||
_consoles.Add(new VirtualConsole(19, 70, 1, 0));
|
||||
_consoles.Add(new VirtualConsole(1, 70, 0,0));
|
||||
}
|
||||
|
||||
public string ReadLine(string aInitialValue, int aTimeout, ushort timeoutRoutine, byte[] terminatingKeys, out byte terminator)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
using System.Diagnostics;
|
||||
#define COSMOSDEBUG
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ZLibrary
|
||||
{
|
||||
public static class ZDebug
|
||||
{
|
||||
public static bool Enable = true;
|
||||
public static bool Enable = false;
|
||||
|
||||
#if COSMOS
|
||||
#if COSMOSDEBUG
|
||||
private static Cosmos.Debug.Kernel.Debugger Debugger = new Cosmos.Debug.Kernel.Debugger("", "");
|
||||
#else
|
||||
//private static StreamWriter writer = new StreamWriter("log.txt");
|
||||
|
|
@ -20,7 +21,7 @@ namespace ZLibrary
|
|||
Debugger.Send(s);
|
||||
#else
|
||||
//writer.WriteLine(s);
|
||||
Debug.WriteLine(s);
|
||||
//Debug.WriteLine(s);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,19 +31,25 @@ namespace Cosmos.Core_Plugs.System.Collections.Generic
|
|||
return new StringEqualityComparer();
|
||||
}
|
||||
|
||||
if (aType == typeof(char))
|
||||
{
|
||||
return new CharEqualityComparer();
|
||||
}
|
||||
|
||||
if (aType == typeof(int))
|
||||
{
|
||||
return new Int32EqualityComparer();
|
||||
}
|
||||
|
||||
if (aType == typeof(byte))
|
||||
{
|
||||
return new ByteEqualityComparer();
|
||||
}
|
||||
|
||||
// TODO: Nullable<>
|
||||
|
||||
// TODO: Enum (Comparer is special to avoid boxing)
|
||||
|
||||
//else
|
||||
//{
|
||||
// xResult = new ObjectComparer<object>();
|
||||
//}
|
||||
mDebugger.Send($"No EqualityComparer for type {aType}");
|
||||
return null;
|
||||
}
|
||||
|
|
@ -51,48 +57,60 @@ namespace Cosmos.Core_Plugs.System.Collections.Generic
|
|||
|
||||
public class StringComparer : Comparer<string>
|
||||
{
|
||||
private readonly Debugger mDebugger = new Debugger("Core", "String Comparer");
|
||||
|
||||
public override int Compare(string x, string y)
|
||||
{
|
||||
mDebugger.Send("StringComparer.Compare");
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class StringEqualityComparer : EqualityComparer<string>
|
||||
{
|
||||
private readonly Debugger mDebugger = new Debugger("Core", "String Equality Comparer");
|
||||
|
||||
public override bool Equals(string x, string y)
|
||||
{
|
||||
mDebugger.Send("StringEqualityComparer.Equals");
|
||||
return String.Equals(x, y);
|
||||
}
|
||||
|
||||
public override int GetHashCode(string obj)
|
||||
{
|
||||
mDebugger.Send("StringEqualityComparer.GetHashCode");
|
||||
|
||||
return obj.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public class CharEqualityComparer : EqualityComparer<char>
|
||||
{
|
||||
public override bool Equals(char x, char y)
|
||||
{
|
||||
return x == y;
|
||||
}
|
||||
|
||||
public override int GetHashCode(char val)
|
||||
{
|
||||
return val.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public class ByteEqualityComparer : EqualityComparer<byte>
|
||||
{
|
||||
public override bool Equals(byte x, byte y)
|
||||
{
|
||||
return x == y;
|
||||
}
|
||||
|
||||
public override int GetHashCode(byte val)
|
||||
{
|
||||
return val.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public class Int32EqualityComparer : EqualityComparer<int>
|
||||
{
|
||||
private readonly Debugger mDebugger = new Debugger("Core", "Int32 Equality Comparer");
|
||||
|
||||
public override bool Equals(int x, int y)
|
||||
{
|
||||
mDebugger.Send("Int32EqualityComparer.Equals");
|
||||
return x == y;
|
||||
}
|
||||
|
||||
public override int GetHashCode(int val)
|
||||
{
|
||||
mDebugger.Send("Int32EqualityComparer.GetHashCode");
|
||||
|
||||
return val.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue