public ElaAsync RunAsync(ElaFunction fun) { var ret = new ElaAsync(this, fun); ret.Run(); return(ret); }
public ElaUnit Sync(ElaFunction fun) { lock (syncRoot) fun.Call(); return(ElaUnit.Instance); }
public string ReadLines(ElaFunction fun, string file) { using (var sr = File.OpenText(file)) { var line = String.Empty; var sb = new StringBuilder(); while ((line = sr.ReadLine()) != null) sb.AppendLine((String)fun.Call(new ElaValue(line)).AsObject()); return sb.ToString(); } }
internal ElaLazy(ElaFunction function) : base(ElaTypeCode.Lazy) { Function = function; _value = default(ElaValue); }
public string FunName(ElaFunction fun) { return(fun.GetFunctionName()); }
public int FunHandle(ElaFunction fun) { return(fun.Handle); }
public void SetDeffered(ElaFunction fun, int args) { Failed = true; Fun = fun; DefferedArgs = args; }
public FormatValue(ElaFunction showf, ElaValue val) { this.showf = showf; this.val = val; }
public int FunArgsCount(ElaFunction fun) { return fun.GetArgumentNumber(); }
public ElaList FunAppliedArgs(ElaFunction fun) { return ElaList.FromEnumerable(fun.GetAppliedArguments()); }
private void Initialize(AsyncModule mod, ElaFunction fun) { Thread = new ST.Thread(() => Return = fun.Call()); mod.Threads.Add(Thread); }
internal ElaAsync(AsyncModule mod, ElaFunction fun) { Initialize(mod, fun); }
private void Initialize(AsyncModule mod, ElaFunction fun) { Thread = new ST.Thread(() => Return = fun.Call()); mod.Threads.Add(Thread); }
internal ElaAsync(AsyncModule mod, ElaFunction fun) { Initialize(mod, fun); }
public int FunHandle(ElaFunction fun) { return fun.Handle; }
private string Format(string format, ElaFunction showf, IEnumerable<ElaValue> values) { var objs = new List<Object>(10); foreach (var v in values) objs.Insert(0, new FormatValue(showf, v)); return String.Format(format, objs.ToArray()); }
public ElaModule FunModule(ElaFunction fun) { return fun.GetFunctionModule(); }
internal void AddFunction(ElaBuiltinKind builtin, ElaFunction fun) { switch (builtin) { case ElaBuiltinKind.BitwiseAnd: and = fun; break; case ElaBuiltinKind.BitwiseOr: or = fun; break; case ElaBuiltinKind.BitwiseXor: xor = fun; break; case ElaBuiltinKind.BitwiseNot: not = fun; break; case ElaBuiltinKind.ShiftLeft: shl = fun; break; case ElaBuiltinKind.ShiftRight: shr = fun; break; case ElaBuiltinKind.Concat: cat = fun; break; case ElaBuiltinKind.Equal: eq = fun; break; case ElaBuiltinKind.NotEqual: neq = fun; break; case ElaBuiltinKind.Length: len = fun; break; case ElaBuiltinKind.GetValue: getval = fun; break; case ElaBuiltinKind.GetField: getfld = fun; break; case ElaBuiltinKind.Add: add = fun; break; case ElaBuiltinKind.Subtract: sub = fun; break; case ElaBuiltinKind.Multiply: mul = fun; break; case ElaBuiltinKind.Divide: div = fun; break; case ElaBuiltinKind.Power: pow = fun; break; case ElaBuiltinKind.Remainder: rem = fun; break; case ElaBuiltinKind.Negate: neg = fun; break; case ElaBuiltinKind.Greater: gt = fun; break; case ElaBuiltinKind.Lesser: lt = fun; break; case ElaBuiltinKind.LesserEqual: lteq = fun; break; case ElaBuiltinKind.GreaterEqual: gteq = fun; break; case ElaBuiltinKind.Head: head = fun; break; case ElaBuiltinKind.Tail: tail = fun; break; case ElaBuiltinKind.IsNil: isnil = fun; break; case ElaBuiltinKind.Show: show = fun; break; case ElaBuiltinKind.Modulus: mod = fun; break; case ElaBuiltinKind.HasField: hasfld = fun; break; } }
public string FunName(ElaFunction fun) { return fun.GetFunctionName(); }
public ElaModule FunModule(ElaFunction fun) { return(fun.GetFunctionModule()); }
public ElaAsync RunAsync(ElaFunction fun) { var ret = new ElaAsync(this, fun); ret.Run(); return ret; }
public int FunAppliedArgsCount(ElaFunction fun) { return(fun.GetAppliedArgumentNumber()); }
public ElaUnit Sync(ElaFunction fun) { lock (syncRoot) fun.Call(); return ElaUnit.Instance; }
public ElaList FunAppliedArgs(ElaFunction fun) { return(ElaList.FromEnumerable(fun.GetAppliedArguments())); }
public void SetDeffered(ElaFunction fun, int args) { Failed = true; Fun = fun; DefferedArgs = args; }