Example #1
0
 public override void ExecuteInternal(RPNStack rpn, Types dataType)
 {
     StackItem[] stk = new StackItem[rpn.Count];
     rpn.CopyTo(stk);
     rpn.Clear();
     for (int i = stk.Length - 2; i >= 0; i--)
     {
         rpn.Push(stk[i]);
     }
     rpn.Push(stk[^ 1]);
Example #2
0
        public override void ExecuteInternal(RPNStack rpn, Types dataType)
        {
            int i1 = int.Parse(rpn.Pop().Token);

            if (i1 > rpn.Count)
            {
                throw new Exception("Too Few Arguments");
            }
            StackItem[] stk = new StackItem[rpn.Count];
            rpn.CopyTo(stk);
            rpn.Push(stk[i1 - 1]);
        }
Example #3
0
        public override void ExecuteInternal(RPNStack rpn, Types dataType)
        {
            int i1 = int.Parse(rpn.Pop().Token);

            if (i1 > rpn.Count)
            {
                throw new Exception("Too Few Arguments");
            }
            StackItem[] stk = new StackItem[rpn.Count];
            rpn.CopyTo(stk);
            rpn.Clear();
            for (int i = stk.Length - 1; i >= 0; i--)
            {
                if ((i1 - 1) != i)
                {
                    rpn.Push(stk[i]);
                }
            }
            rpn.Push(stk[i1 - 1]);
        }