예제 #1
0
        public override void Execute(Interpreter inI)
        {
            ObjectStack cstack = inI.CodeStack();
            ObjectStack estack = inI.ExecStack();

            if (estack.Size() > 0)
            {
                cstack.Push(estack.Pop());
            }
        }
예제 #2
0
        public void PushInput(Interpreter inI, int n)
        {
            ObjectStack _stack = inI.InputStack();

            if (_stack.Size() > n)
            {
                object inObject = _stack.DeepPeek(n);
                if (inObject is int)
                {
                    IntStack istack = inI.IntStack();
                    istack.Push((int)inObject);
                }
                else
                {
                    // if (inObject is Number)
                    // {
                    //   FloatStack fstack = inI.FloatStack();
                    //   fstack.Push(((Number)inObject).FloatValue());
                    // }
                    //else
                    if (inObject is float)
                    {
                        FloatStack fstack = inI.FloatStack();
                        fstack.Push((float)inObject);
                    }
                    else
                    {
                        if (inObject is bool)
                        {
                            BooleanStack bstack = inI.BoolStack();
                            bstack.Push((bool)inObject);
                        }
                        else
                        {
                            Console.Error.WriteLine("Error during input.index - object " + inObject.GetType() +
                                                    " is not a legal object according to " + this.GetType() + ".");
                        }
                    }
                }
            }
        }