public void EvalIsolate(RCRunner runner, RCClosure closure, RCBlock right) { DoIsolate(runner, closure, new string[] { }, right); }
public void EvalPop(RCRunner runner, RCClosure closure, RCByte right) { runner.Yield(closure, new RCByte(DoPop <byte> (right.Data))); }
public void EvalGet(RCRunner runner, RCClosure closure, RCSymbol left, RCBlock right) { EvalGet(runner, closure, right, left); }
public void EvalPop(RCRunner runner, RCClosure closure, RCString right) { runner.Yield(closure, new RCString(DoPop <string> (right.Data))); }
public void EvalPop(RCRunner runner, RCClosure closure, RCSymbol right) { runner.Yield(closure, new RCSymbol(DoPop <RCSymbolScalar> (right.Data))); }
public void EvalLast(RCRunner runner, RCClosure closure, RCByte right) { runner.Yield(closure, new RCByte(right[right.Count - 1])); }
public void EvalPop(RCRunner runner, RCClosure closure, RCDouble right) { runner.Yield(closure, new RCDouble(DoPop <double> (right.Data))); }
public void EvalRepeat(RCRunner runner, RCClosure closure, RCLong left, RCDecimal right) { runner.Yield(closure, new RCDecimal(DoRepeat <decimal> (left, right))); }
public void EvalRepeat(RCRunner runner, RCClosure closure, RCLong left, RCBoolean right) { runner.Yield(closure, new RCBoolean(DoRepeat <bool> (left, right))); }
public void EvalCount(RCRunner runner, RCClosure closure, RCOperator right) { runner.Yield(closure, new RCLong(right.Count)); }
public void EvalRepeat(RCRunner runner, RCClosure closure, RCLong left, RCDouble right) { runner.Yield(closure, new RCDouble(DoRepeat <double> (left, right))); }
public void EvalCount(RCRunner runner, RCClosure closure, RCTemplate right) { runner.Yield(closure, new RCLong(right.Count)); }
protected void DoIsolate(RCRunner runner, RCClosure closure, string[] argv, RCValue code) { Thread thread = new Thread(delegate() { Queue <string> argQueue = new Queue <string> (argv); string result = null; AppDomain appDomain = null; Program program; Exception isolateEx = null; try { AppDomainSetup setupInfo = new AppDomainSetup(); string build = "dev"; if (argQueue.Count > 0) { string first = argv[0]; string rclHome = Environment.GetEnvironmentVariable("RCL_HOME"); if (rclHome == null) { throw new Exception( "RCL_HOME was not set. It is needed in order to locate the specified binary: " + first); } if (first == "dev") { build = first; // It should use the dev build in this case. The current build is not the // dev build. setupInfo = AppDomain.CurrentDomain.SetupInformation; setupInfo.ApplicationBase = rclHome + "/dev/rcl/dbg"; argQueue.Dequeue(); } else if (first == "last") { argQueue.Dequeue(); throw new NotImplementedException( "last option is not yet implemented. Please specify a build number"); } else { int number; if (int.TryParse(first, out number)) { build = number.ToString(); setupInfo.ApplicationBase = rclHome + "/bin/rcl_bin/" + number + "/lib"; argQueue.Dequeue(); } else { setupInfo = AppDomain.CurrentDomain.SetupInformation; } } } string appDomainName = "Isolated build:" + build + " id:" + Guid.NewGuid(); appDomain = AppDomain.CreateDomain(appDomainName, null, setupInfo); Type type = typeof(Program); program = (Program)appDomain.CreateInstanceAndUnwrap(type.Assembly.FullName, type.FullName); string appDomainVersionString = setupInfo.ApplicationBase; // RCSystem.CrossDomainTraceHelper.StartListening (appDomain); program.IsolateCode = code.ToString(); program.InstanceMain(argQueue.ToArray(), appDomainVersionString); result = (string)appDomain.GetData("IsolateResult"); isolateEx = (Exception)appDomain.GetData("IsolateException"); } catch (Exception ex) { runner.Finish(closure, ex, 1); } finally { if (appDomain != null) { AppDomain.Unload(appDomain); appDomain = null; } } if (result == null) { if (isolateEx == null) { isolateEx = new Exception("Missing IsolateResult for program"); } runner.Finish(closure, isolateEx, 1); } else { runner.Yield(closure, RCSystem.Parse(result)); } }); thread.IsBackground = true; thread.Start(); }
public void EvalIsolate(RCRunner runner, RCClosure closure, RCString left, RCBlock right) { DoIsolate(runner, closure, left.ToArray(), right); }
public void EvalRest(RCRunner runner, RCClosure closure, RCIncr right) { runner.Yield(closure, new RCIncr(DoRest <RCIncrScalar> (right.Data))); }
public void EvalRepeat(RCRunner runner, RCClosure closure, RCLong left, RCString right) { runner.Yield(closure, new RCString(DoRepeat <string> (left, right))); }
public void EvalFirst(RCRunner runner, RCClosure closure, RCBlock right) { runner.Yield(closure, right.Get(0)); }
public void EvalRepeat(RCRunner runner, RCClosure closure, RCLong left, RCIncr right) { runner.Yield(closure, new RCIncr(DoRepeat <RCIncrScalar> (left, right))); }
public void EvalPop(RCRunner runner, RCClosure closure, RCBlock right) { runner.Yield(closure, right.Previous); }
public void EvalOperator(RCRunner runner, RCClosure closure, RCBoolean left, RCBoolean right) { runner.Yield(closure, DoFind <bool> (left, right)); }
public void EvalPop(RCRunner runner, RCClosure closure, RCDecimal right) { runner.Yield(closure, new RCDecimal(DoPop <decimal> (right.Data))); }
public void EvalOperator(RCRunner runner, RCClosure closure, RCDouble left, RCDouble right) { runner.Yield(closure, DoFind <double> (left, right)); }
public void EvalPop(RCRunner runner, RCClosure closure, RCBoolean right) { runner.Yield(closure, new RCBoolean(DoPop <bool> (right.Data))); }
public void EvalOperator(RCRunner runner, RCClosure closure, RCDecimal left, RCDecimal right) { runner.Yield(closure, DoFind <decimal> (left, right)); }
public void EvalPop(RCRunner runner, RCClosure closure, RCTime right) { runner.Yield(closure, new RCTime(DoPop <RCTimeScalar> (right.Data))); }
public void EvalOperator(RCRunner runner, RCClosure closure, RCString left, RCString right) { runner.Yield(closure, DoFind <string> (left, right)); }
public void EvalFirst(RCRunner runner, RCClosure closure, RCDecimal right) { runner.Yield(closure, new RCDecimal(right[0])); }
public void EvalOperator(RCRunner runner, RCClosure closure, RCTime left, RCTime right) { runner.Yield(closure, DoFind <RCTimeScalar> (left, right)); }
public void EvalFirst(RCRunner runner, RCClosure closure, RCString right) { runner.Yield(closure, new RCString(right[0])); }
public override void Close(RCRunner runner, RCClosure closure) { _client.Dispose(); runner.Yield(closure, new RCLong(_handle)); }