Exemple #1
0
        public void Execute(Interpreter inI)
        {
            ObjectStack codeStack = inI.CodeStack();
            FloatStack  fStack    = inI.FloatStack();

            if (fStack.Size() > 0)
            {
                codeStack.Push(fStack.Pop());
            }
        }
Exemple #2
0
        public void Execute(Interpreter inI)
        {
            ObjectStack codeStack = inI.CodeStack();
            IntStack    iStack    = inI.IntStack();

            if (iStack.Size() > 0)
            {
                codeStack.Push(iStack.Pop());
            }
        }
Exemple #3
0
        // End code iteration functions
        //
        // Conversion instructions to code
        //
        public void Execute(Interpreter inI)
        {
            ObjectStack  codeStack = inI.CodeStack();
            BooleanStack bStack    = inI.BoolStack();

            if (bStack.Size() > 0)
            {
                codeStack.Push(bStack.Pop());
            }
        }
Exemple #4
0
        public void Execute(Interpreter inI)
        {
            ObjectStack cstack = inI.CodeStack();
            ObjectStack estack = inI.ExecStack();

            if (estack.Size() > 0)
            {
                cstack.Push(estack.Pop());
            }
        }
Exemple #5
0
        public override void Execute(Interpreter inI)
        {
            BooleanStack bstack = inI.BoolStack();
            ObjectStack  estack = inI.ExecStack();

            if (_stack.Size() > 1 && bstack.Size() > 0)
            {
                bool   istrue  = bstack.Pop();
                object iftrue  = _stack.Pop();
                object iffalse = _stack.Pop();
                if (istrue)
                {
                    estack.Push(iftrue);
                }
                else
                {
                    estack.Push(iffalse);
                }
            }
        }
Exemple #6
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() + ".");
                        }
                    }
                }
            }
        }
Exemple #7
0
        public override void Execute(Interpreter inI)
        {
            IntStack    istack = inI.IntStack();
            ObjectStack estack = inI.ExecStack();

            if (_stack.Size() > 0 && istack.Size() > 0)
            {
                if (istack.Top() > 0)
                {
                    object bodyObj = _stack.Pop();
                    if (bodyObj is Program)
                    {
                        // insert integer.pop in front of program
                        ((Program)bodyObj).Shove("integer.pop", ((Program)bodyObj)._size);
                    }
                    else
                    {
                        // create a new program with integer.pop in front of
                        // the popped object
                        Program newProgram = new Program();
                        newProgram.Push("integer.pop");
                        newProgram.Push(bodyObj);
                        bodyObj = newProgram;
                    }
                    int stop = istack.Pop() - 1;
                    try {
                        Program doRangeMacroProgram = new Program();
                        doRangeMacroProgram.Push(0);
                        doRangeMacroProgram.Push(stop);
                        doRangeMacroProgram.Push("code.quote");
                        doRangeMacroProgram.Push(bodyObj);
                        doRangeMacroProgram.Push("code.do*range");
                        estack.Push(doRangeMacroProgram);
                    } catch (Exception) {
                        Console.Error.WriteLine("Error while initializing a program.");
                    }
                }
            }
        }
Exemple #8
0
        public override void Execute(Interpreter inI)
        {
            IntStack    istack = inI.IntStack();
            ObjectStack estack = inI.ExecStack();

            if (_stack.Size() > 0 && istack.Size() > 0)
            {
                if (istack.Top() > 0)
                {
                    int    stop    = istack.Pop() - 1;
                    object bodyObj = _stack.Pop();
                    try {
                        Program doRangeMacroProgram = new Program();
                        doRangeMacroProgram.Push(0);
                        doRangeMacroProgram.Push(stop);
                        doRangeMacroProgram.Push("exec.do*range");
                        doRangeMacroProgram.Push(bodyObj);
                        estack.Push(doRangeMacroProgram);
                    } catch (Exception) {
                        Console.Error.WriteLine("Error while initializing a program.");
                    }
                }
            }
        }
Exemple #9
0
 protected ObjectStackInstruction(ObjectStack inStack)
 {
     _stack = inStack;
 }
Exemple #10
0
 internal RandomPushCode(ObjectStack inStack)
     : base(inStack)
 {
 }
Exemple #11
0
 internal IF(ObjectStack inStack)
     : base(inStack)
 {
 }
Exemple #12
0
 internal ObjectEquals(ObjectStack inStack)
     : base(inStack)
 {
 }
Exemple #13
0
 internal ExecY(ObjectStack inStack)
     : base(inStack)
 {
 }
Exemple #14
0
 internal InputInRev(ObjectStack inStack)
     : base(inStack)
 {
 }
Exemple #15
0
 public ObjectConstant(ObjectStack inStack, object inValue) : base(inStack)
 {
     _value = inValue;
 }
Exemple #16
0
 internal InputIndex(ObjectStack inStack)
     : base(inStack)
 {
 }
Exemple #17
0
 internal ExecS(ObjectStack inStack, int inMaxPointsInProgram)
     : base(inStack)
 {
     _maxPointsInProgram = inMaxPointsInProgram;
 }
Exemple #18
0
 internal InputInAll(ObjectStack inStack)
     : base(inStack)
 {
 }