コード例 #1
0
ファイル: TraceCommand.cs プロジェクト: bhuvanchandra/emul8
 public void Run(ICommandInteraction writer, [Values(TraceEnableCommand)] LiteralToken enable, LiteralToken cpuToken, StringToken functionName, BooleanToken traceReturn, params LiteralToken[] types)
 {
     var cpu = (Arm)monitor.ConvertValueOrThrowRecoverable(cpuToken.Value, typeof(Arm));
     var cpuTracer = EnsureTracer(cpu);
     var handler = new DefaultFunctionHandler(cpu);
     var paramList = new List<FunctionCallParameter>();
     foreach(var parameter in types)
     {
         FunctionCallParameterType paramType;
         if(!Enum.TryParse(parameter.Value, out paramType))
         {
             throw new RecoverableException("{0} is not a proper parameter type.".FormatWith(parameter.Value));
         }
         paramList.Add(new FunctionCallParameter{ Type = paramType });
     }
     handler.CallParameters = paramList.Take(paramList.Count - (traceReturn.Value ? 1 : 0));
     handler.ReturnParameter = traceReturn.Value ? paramList.Last() : (FunctionCallParameter?)null;
     if(traceReturn.Value)
     {
         cpuTracer.TraceFunction(functionName.Value, handler.CallParameters, handler.CallHandler, handler.ReturnParameter, handler.ReturnHandler);
     }
     else
     {
         cpuTracer.TraceFunction(functionName.Value, handler.CallParameters, handler.CallHandler);
     }
     
 }
コード例 #2
0
ファイル: MachCommand.cs プロジェクト: rte-se/emul8
 public void Run(ICommandInteraction writer, [Values("set", "add", "rem")] LiteralToken action, StringToken name)
 {
     switch(action.Value)
     {
     case "add":       
         var machine = new Machine();
         EmulationManager.Instance.CurrentEmulation.AddMachine(machine, name.Value);
         if(GetCurrentMachine() == null)
         {
             SetCurrentMachine(machine);
         }
         break;
     case "set":
         try
         {
             SetCurrentMachine(EmulationManager.Instance.CurrentEmulation[name.Value]);
         }
         catch(KeyNotFoundException)
         {
             writer.WriteError(string.Format("Machine {0} not found.", name.Value));
         }
         break;
     case "rem":
         var machineToRemove = EmulationManager.Instance.CurrentEmulation[name.Value];
         EmulationManager.Instance.CurrentEmulation.RemoveMachine(name.Value);
         if(GetCurrentMachine() == machineToRemove)
         {
             SetCurrentMachine(null);
         }
         break;
     }
 }
コード例 #3
0
ファイル: TraceCommand.cs プロジェクト: bhuvanchandra/emul8
 public void Run(ICommandInteraction writer, [Values(TraceEnableCommand, TraceDisableCommand)] LiteralToken enable, LiteralToken cpuToken, StringToken functionName)
 {
     if(enable.Value == TraceEnableCommand)
     {
         Execute(writer, cpuToken, functionName.Value, false, null);
     }
     else
     {
         var cpu = (Arm)monitor.ConvertValueOrThrowRecoverable(cpuToken.Value, typeof(Arm));
         var cpuTracer = EnsureTracer(cpu);
         cpuTracer.RemoveTracing(functionName.Value);
     }
 }
コード例 #4
0
 public void Run(ICommandInteraction writer, StringToken analyzerName, LiteralToken peripheral, LiteralToken analyzerTypeName)
 {
     try
     {
         var analyzer = GetAnalyzer(peripheral.Value, analyzerTypeName == null ? null : analyzerTypeName.Value);
         if (analyzerName != null)
         {
             EmulationManager.Instance.CurrentEmulation.ExternalsManager.AddExternal((IExternal)analyzer, analyzerName.Value);
         }
         analyzer.Show();
     } 
     catch (Exception e)
     {
         throw new RecoverableException(string.Format("Received '{0}' error while initializng analyzer for: {1}. Are you missing a required plugin?", e.Message, peripheral.Value));
     }
 }
コード例 #5
0
 public void Run(ICommandInteraction writer, StringToken analyzerName, LiteralToken peripheral)
 {
     Run(writer, analyzerName, peripheral, null);
 }
コード例 #6
0
ファイル: PythonExecuteCommand.cs プロジェクト: rte-se/emul8
 public void Run(ICommandInteraction writer, StringToken command)
 {
     Execute(command.Value, writer);
 }
コード例 #7
0
 public void Run(ICommandInteraction writer, LiteralToken peripheral, StringToken viewId)
 {
     Run(writer, null, peripheral, viewId);
 }
コード例 #8
0
ファイル: TraceCommand.cs プロジェクト: bhuvanchandra/emul8
 public void Run(ICommandInteraction writer, [Values(TraceEnableCommand)] LiteralToken enable, LiteralToken cpuToken, StringToken functionName, BooleanToken traceReturn, NumericToken numberOfParameters)
 {
     Execute(writer, cpuToken, functionName.Value, traceReturn.Value, (int)numberOfParameters.Value);
 }
コード例 #9
0
ファイル: TraceCommand.cs プロジェクト: bhuvanchandra/emul8
 public void Run(ICommandInteraction writer, [Values(TraceEnableCommand)] LiteralToken enable, LiteralToken cpuToken, StringToken functionName, BooleanToken traceReturn)
 {
     Execute(writer, cpuToken, functionName.Value, traceReturn.Value, null);
 }
コード例 #10
0
ファイル: LogCommand.cs プロジェクト: bhuvanchandra/emul8
 public void Run(ICommandInteraction writer, StringToken message, [Values( "Noisy", "Debug", "Info", "Warning", "Error")] StringToken level)
 {
     InnerLog(LogLevel.Parse(level.Value), message.Value);
 }
コード例 #11
0
ファイル: LogCommand.cs プロジェクト: bhuvanchandra/emul8
 public void Run(ICommandInteraction writer, StringToken message, [Values( -1L, 0L, 1L, 2L, 3L)] NumericToken level)
 {
     InnerLog((LogLevel)(int)level.Value, message.Value);
 }
コード例 #12
0
ファイル: LogCommand.cs プロジェクト: bhuvanchandra/emul8
 public void Run(ICommandInteraction writer, StringToken message)
 {
     InnerLog(LogLevel.Debug, message.Value);
 }
コード例 #13
0
ファイル: TerminalCommand.cs プロジェクト: rte-se/emul8
 public void Run(ICommandInteraction writer, StringToken name)
 {
     console.SetActiveTerminal(name.Value);
 }
コード例 #14
0
ファイル: HelloCommand.cs プロジェクト: rte-se/emul8
 public void Run(ICommandInteraction writer, StringToken name)
 {
     writer.WriteLine(String.Format("Hello, {0}!", name.Value));
 }
コード例 #15
0
 public void Run(ICommandInteraction writer, LiteralToken type, StringToken name)
 {
     Execute(writer, type.Value, name.Value);
 }