void IOperation.Exec(DataStack stack, IDataAccess extdata) { var b = (double)stack.Pop(); var a = (double)stack.Pop(); stack.Push(a - b); }
void IOperation.Exec(DataStack stack, IDataAccess extdata) { object ob = stack.Pop(); object oa = stack.Pop(); bool isTrue = OperationHelpers.EvaluateAsLogicalTrue(oa); stack.Push(isTrue ? ob : oa); }
/// <summary> /// Execute the compiled script /// </summary> /// <param name="xdata"></param> /// <returns></returns> public RunResult Execute(IDataAccess xdata) { var cstream = this.CodeStream; var stack = new DataStack(); while (++stack.InstructionIndex < cstream.InstructList.Count) { cstream.InstructList[stack.InstructionIndex].Exec(stack, xdata); } var result = new RunResult(); switch (stack.DataIndex) { case -1: break; case 0: result.Result = stack.Pop(); result.HasResult = true; break; default: result.Error = new RuntimeException( $"The data stack still contains {stack.DataIndex + 1} items." ); break; } return(result); }
void IOperation.Exec(DataStack stack, IDataAccess extdata) { object oa = stack.Pop(); bool isTrue = OperationHelpers.EvaluateAsLogicalTrue(oa); if (isTrue) { stack.InstructionIndex = this.Position - 1; } }
void IOperation.Exec(DataStack stack, IDataAccess xdata) { xdata.SetData(this.VarName1, stack.Pop()); }
void IOperation.Exec(DataStack stack, IDataAccess xdata) { stack.Registers[this.RegName1] = stack.Pop(); }