public override void Eval(Executor exec) { Function f = exec.TypedPop<Function>(); Executor e2 = new Executor(); f.Eval(e2); CatList list = e2.GetStackAsList(); exec.Push(list); }
public override void Eval(Executor exec) { Type t = exec.TypedPop<Type>(); Type u = exec.TypedPop<Type>(); exec.PushBool(t.Equals(u) || u.Equals(t)); }
public override void Eval(Executor exec) { TimeSpan x = exec.TypedPop<TimeSpan>(); DateTime y = exec.TypedPop<DateTime>(); exec.Push(y + x); }
public override void Eval(Executor exec) { int n = exec.PopInt(); Function f = exec.TypedPop<Function>(); Function g = exec.TypedPeek<Function>(); if (g is JumpTable) { JumpTable jt = g as JumpTable; jt.AddCase(n, f); } else { exec.Pop(); JumpTable jt = new JumpTable(g); exec.Push(jt); } }
public override void Eval(Executor exec) { Function onfalse = exec.TypedPop<Function>(); Function ontrue = exec.TypedPop<Function>(); if ((bool)exec.Pop()) { ontrue.Eval(exec); } else { onfalse.Eval(exec); } }
public override void Eval(Executor exec) { QuotedFunction right = exec.TypedPop<QuotedFunction>(); QuotedFunction left = exec.TypedPop<QuotedFunction>(); QuotedFunction f = new QuotedFunction(left, right); exec.PushFxn(f); }
public override void Eval(Executor exec) { QuotedFunction f = exec.TypedPop<QuotedFunction>(); exec.Push(FxnsToList(f.GetSubFxns())); }
public override void Eval(Executor exec) { string s = exec.TypedPop<string>(); CatList f = exec.TypedPop<CatList>(); Object[] args = f.ToArray(); GraphicCommand c = new GraphicCommand(s, args); WindowGDI.Render(c); }
public override void Eval(Executor exec) { Object self = exec.Pop(); string s = exec.TypedPop<string>(); CatList a = exec.TypedPop<CatList>(); MethodInfo m = self.GetType().GetMethod(s, a.GetTypeArray()); if (m == null) throw new Exception("could not find method " + s + " on object of type " + self.GetType().ToString() + " with matching types"); Object o = m.Invoke(self, a.ToArray()); exec.Push(o); exec.Push(self); }
public override void Eval(Executor exec) { exec.Push(exec.TypedPop<double>()); }
public override void Eval(Executor exec) { WindowGDI.SaveToFile(exec.TypedPop<string>()); }
public override void Eval(Executor exec) { exec.Push(exec.TypedPop<CatList>()); }
public override void Eval(Executor exec) { CatList second = exec.TypedPop<CatList>(); CatList first = exec.TypedPeek<CatList>(); first.AddRange(second); }
public override void Eval(Executor exec) { Function f = exec.TypedPop<Function>(); CatList list = exec.TypedPeek<CatList>(); int n = exec.Count(); for (int i = 0; i < list.Count; ++i) { exec.Push(list[i]); f.Eval(exec); if (exec.Count() != n + 1) throw new Exception("dynamic type-checking error in map function"); list[i] = exec.Pop(); } }
public override void Eval(Executor exec) { Function f = exec.TypedPop<Function>(); f.Eval(exec); }
public override void Eval(Executor exec) { Object self = exec.Pop(); string s = exec.TypedPop<string>(); FieldInfo fi = self.GetType().GetField(s); if (fi == null) throw new Exception("could not find field " + s + " on object of type " + self.GetType().ToString()); exec.Push(fi.GetValue(self)); exec.Push(self); }
public override void Eval(Executor exec) { Function f = exec.TypedPop<Function>(); Object o = exec.Pop(); f.Eval(exec); exec.Push(o); }
public override void Eval(Executor exec) { string s = exec.TypedPop<string>(); CatList a = exec.TypedPop<CatList>(); Type t = Type.GetType(s); if (t == null) throw new Exception("could not find type " + s); ConstructorInfo c = t.GetConstructor(a.GetTypeArray()); if (c == null) throw new Exception("could not find constructor for object of type " + t.ToString() + " with matching types"); Object o = c.Invoke(a.ToArray()); if (o == null) throw new Exception(s + " object could not be constructed"); exec.Push(o); }
public override void Eval(Executor exec) { CatList fs = exec.TypedPop<CatList>(); Object o = exec.Peek(); for (int i = 0; i < fs.Count / 2; ++i) { Type t = fs[i * 2 + 1] as Type; Function f = fs[i * 2] as Function; if (t.IsInstanceOfType(o)) { f.Eval(exec); return; } } throw new Exception("could not dispatch function"); }
public override void Eval(Executor exec) { IEnumerable e = exec.TypedPop<IEnumerable>(); exec.Push(new CatList(e)); }
public override void Eval(Executor exec) { QuotedFunction f = exec.TypedPop<QuotedFunction>(); f.GetSubFxns().Insert(0, new Pop()); JumpTable jt = new JumpTable(f); exec.Push(jt); }
public override void Eval(Executor exec) { exec.Push(new Regex(exec.TypedPop<string>())); }
public override void Eval(Executor exec) { Function cond = exec.TypedPop<Function>(); Function body = exec.TypedPop<Function>(); cond.Eval(exec); while ((bool)exec.Pop()) { body.Eval(exec); cond.Eval(exec); } }
public override void Eval(Executor exec) { Regex re = exec.TypedPop<Regex>(); string s = exec.TypedPop<string>(); List<string> list = new List<string>(); foreach (Match m in re.Matches(s)) list.Add(m.Value); CatList f = new CatList(list); exec.Push(f); }
public override void Eval(Executor exec) { Function c = exec.TypedPop<Function>(); Function t = exec.TypedPop<Function>(); int n = exec.Count(); try { t.Eval(exec); } catch (CatException e) { exec.ClearTo(n); Output.WriteLine("exception caught"); exec.Push(e.GetObject()); c.Eval(exec); } }
public override void Eval(Executor exec) { Regex re = exec.TypedPop<Regex>(); string s = exec.TypedPeek<string>(); Match m = re.Match(s); if (m == null) exec.Push(-1); else exec.Push(m.Index); }
public override void Eval(Executor exec) { DateTime x = exec.TypedPop<DateTime>(); DateTime y = exec.TypedPop<DateTime>(); exec.Push(y - x); }
public override void Eval(Executor exec) { exec.Push(exec.TypedPop<Ref>().GetVal()); }
public override void Eval(Executor exec) { exec.Push(exec.TypedPop<TimeSpan>().TotalMilliseconds); }
public override void Eval(Executor exec) { HashList hash = exec.TypedPop<HashList>(); exec.Push(hash.ToArray()); }