mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Consolidate UIX.Debug into UIX
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Debug
|
||||
{
|
||||
public class Bridge : IBridge
|
||||
{
|
||||
public event EventHandler<Data.InterpreterEntry> InterpreterStep;
|
||||
public event Action<string> DispatcherStep;
|
||||
|
||||
public void LogInterpreterOpCode(object context, Data.InterpreterEntry entry)
|
||||
{
|
||||
InterpreterStep?.Invoke(context, entry);
|
||||
}
|
||||
|
||||
public void LogDispatcher(string message)
|
||||
{
|
||||
DispatcherStep?.Invoke(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.Iris.Debug.Data
|
||||
{
|
||||
public class InterpreterEntry
|
||||
{
|
||||
public InterpreterEntry(object opCode, params OpCodeArgument[] args)
|
||||
{
|
||||
OpCode = opCode;
|
||||
|
||||
if (args != null && args.Length > 0)
|
||||
Arguments = args;
|
||||
else
|
||||
Arguments = new List<OpCodeArgument>();
|
||||
}
|
||||
|
||||
public object OpCode { get; }
|
||||
public IList<OpCodeArgument> Arguments { get; }
|
||||
public IList<object> ReturnValues { get; } = new List<object>();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
#if OPENZUNE
|
||||
var args = Arguments;
|
||||
var ret = ReturnValues;
|
||||
#else
|
||||
var args = Arguments.Select(a => a.ToString()).ToArray();
|
||||
var ret = ReturnValues.Select(a => a.ToString()).ToArray();
|
||||
#endif
|
||||
return $"{OpCode}({string.Join(", ", args)}) -> [{ReturnValues}]";
|
||||
}
|
||||
}
|
||||
|
||||
public class OpCodeArgument
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public Type Type { get; set; }
|
||||
public object Value { get; set; }
|
||||
|
||||
public OpCodeArgument(string name, Type type, object value)
|
||||
{
|
||||
Name = name;
|
||||
Type = type;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public override string ToString() => $"{Type} {Value}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Microsoft.Iris.Debug
|
||||
{
|
||||
internal interface IBridge
|
||||
{
|
||||
/// <summary>
|
||||
/// Logs the context, opcode, and arguments of an instruction
|
||||
/// executed by <c>Microsoft.Iris.Markup.Interpreter</c>.
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="entry"></param>
|
||||
public void LogInterpreterOpCode(object context, Data.InterpreterEntry entry);
|
||||
|
||||
public void LogDispatcher(string message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user