Ejemplo n.º 1
0
        // 2>r
        private static void ontoR2()
        {
            var top = Stack.Pop();

            ReturnStack.Push(Stack.Pop());
            ReturnStack.Push(top);
        }
Ejemplo n.º 2
0
        void ReturnStackOverflowTest()
        {
            Int16[]     data = { 0, 1, 2, 3, 4 };
            ReturnStack rs   = MakeStack(data.GetLength(0) - 1);

            Assert.Throws <StackOverflowException>(() => data.Any(i => { rs.Push(data[i]); return(false); }));
        }
Ejemplo n.º 3
0
        void ReturnStackPushPopTest()
        {
            Int16[]     data = { 0, 1, 2, 3, 4, 5 };
            ReturnStack rs   = MakeStack(data.GetLength(0));

            data.Any(i => { rs.Push(data[i]); return(false); });
            Assert.True(rs.Position == 0);
            Assert.True(data.All(i => rs.Pop() == data[rs.Size - rs.Position]));
        }
Ejemplo n.º 4
0
        // The return stack being a part of the actual call stack doesn't make a
        // lot of sense in .Net so it's just a second stack, indistinguishable in all
        // but usage from the Data stack.

        // >r
        private static void ontoR()
        {
            ReturnStack.Push(Stack.Pop());
        }