本文整理汇总了C#中Executor类的典型用法代码示例。如果您正苦于以下问题:C# Executor类的具体用法?C# Executor怎么用?C# Executor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Executor类属于命名空间,在下文中一共展示了Executor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: If
public static void If(Executor exec)
{
var code = exec.DataStack.Pop<Tokens.CodeBlock>().Value;
var condition = exec.DataStack.Pop<Tokens.Number>().Value != 0;
if (condition)
exec.CodeStack.PushRange(code);
}
示例2: Bury
public static void Bury(Executor exec)
{
var count = exec.DataStack.Pop<Tokens.Number>().Value;
var token = exec.DataStack.Pop<IToken>();
exec.DataStack.Bury(token, (int) count);
}
示例3: Def
public static void Def(Executor exec)
{
var name = exec.DataStack.Pop<Tokens.Symbol>().Value;
var code = exec.DataStack.Pop<Tokens.CodeBlock>().Value;
exec.Methods[name] = new Executor.CodeblockFunction(code.ToList());
}
示例4: Swap
public static void Swap(Executor exec)
{
var a = exec.DataStack.Pop<IToken>();
var b = exec.DataStack.Pop<IToken>();
exec.DataStack.Push(a);
exec.DataStack.Push(b);
}
示例5: CharacterHandler
public CharacterHandler(char toHandle, Executor Execute, bool stop)
{
this.toHandle = toHandle;
this.Condition = SimpleCheck;
this.Execute = Execute;
this.stop = stop;
}
示例6: Dig
public static void Dig(Executor exec)
{
var count = exec.DataStack.Pop<Tokens.Number>().Value;
var token = exec.DataStack.Dig<IToken>((int) count);
exec.DataStack.Push(token);
}
示例7: Create
public IOutputExecutor Create(Settings settings)
{
Executor = Executor.WithForsetiConfigurationFile(settings.ForsetiConfigurationFile, verbose: settings.VerboseOutput);
Executor.ReportWith<Forseti.AppVeyor.Reporter>();
Executor.RegisterWatcher<Forseti.ConsoleReporter.ConsoleHarnessWatcher>();
return this;
}
示例8: Compile
/// <param name="options">Compile options</param>
/// <param name="runInSeparateAppDomain">Should be set to true for production code, but there are issues with NUnit, so tests need to set this to false.</param>
public bool Compile(CompilerOptions options, bool runInSeparateAppDomain)
{
try {
AppDomain ad = null;
var actualOut = Console.Out;
try {
Console.SetOut(new StringWriter()); // I don't trust the third-party libs to not generate spurious random messages, so make sure that any of those messages are suppressed.
var er = new ErrorReporterWrapper(_errorReporter, actualOut);
Executor executor;
if (runInSeparateAppDomain) {
var setup = new AppDomainSetup { ApplicationBase = Path.GetDirectoryName(typeof(Executor).Assembly.Location) };
ad = AppDomain.CreateDomain("SCTask", null, setup);
executor = (Executor)ad.CreateInstanceAndUnwrap(typeof(Executor).Assembly.FullName, typeof(Executor).FullName);
}
else {
executor = new Executor();
}
return executor.Compile(options, er);
}
finally {
if (ad != null) {
AppDomain.Unload(ad);
}
if (actualOut != null) {
Console.SetOut(actualOut);
}
}
}
catch (Exception ex) {
_errorReporter.InternalError(ex, null, TextLocation.Empty);
return false;
}
}
示例9: WillThrowAnExceptionWithOnlyOneRetry
public void WillThrowAnExceptionWithOnlyOneRetry()
{
var executor = new Executor(3, new InvalidOperationException());
var proxy = (Executor)proxyGenerator.CreateClassProxyWithTarget(typeof(Executor), executor, new[] { new RetryInterceptor(1) });
proxy.Execute();
Assert.Fail();
}
示例10: Redef
public static void Redef(Executor exec)
{
var to = exec.DataStack.Pop<Tokens.Symbol>().Value;
var from = exec.DataStack.Pop<Tokens.Symbol>().Value;
exec.Methods[to] = exec.Methods[from];
}
示例11: Eval
public override void Eval(Executor exec)
{
string sHelpFile = Config.gsDataFolder + "\\help.html";
StreamWriter sw = new StreamWriter(sHelpFile);
sw.WriteLine("<html><head><title>Cat Help File</title></head><body>");
/*
sw.WriteLine("<h1><a name='level0prims'></a>Level 0 Primitives</h1>");
OutputTable(sw, "level0", exec);
sw.WriteLine("<h1><a name='level1prims'></a>Level 1 Primitives</h1>");
OutputTable(sw, "level1", exec);
sw.WriteLine("<h1><a name='level2prims'></a>Level 2 Primitives</h1>");
OutputTable(sw, "level2", exec);
sw.WriteLine("<h1><a name='otherprims'></a>Other Functions</h1>");
OutputTable(sw, "", exec);
*/
sw.WriteLine("<h1>Instructions</h1>");
OutputAllTable(sw, exec);
sw.WriteLine("<h1>Definitions</h1>");
sw.WriteLine("<pre>");
foreach (Function f in exec.GetAllFunctions())
{
sw.WriteLine(f.GetImplString(true));
}
sw.WriteLine("</pre>");
sw.WriteLine("</body></html>");
sw.Close();
Output.WriteLine("saved help file to " + sHelpFile);
}
示例12: Eval
public override void Eval(Executor exec)
{
string s = exec.PopString();
Executor aux = new Executor(exec);
aux.Execute(s);
exec.Push(aux.GetStackAsList());
}
示例13: Execute
public override ICommand Execute()
{
using (Executor executor = new Executor(this))
{
executor.Execute();
return this;
}
}
示例14: SetUp
public void SetUp()
{
symbols = A.Fake<Symbols>();
tokenizer = A.Fake<Tokenizer>();
executor = A.Fake<Executor>();
sut = new Interpreter(symbols, tokenizer, executor);
}
示例15: Unpack
public static void Unpack(Executor exec)
{
var block = exec.DataStack.Pop<Tokens.PackedBlock>().Value;
var count = block.Count;
exec.DataStack.PushRange(block);
exec.DataStack.Push(new Tokens.Number(count));
}