Esempio n. 1
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
#if DEBUG
            Warm("-");
            NoteCalls(this.rand0Inner);
            NoteCalls(this.rand1);
            rand0TypeHistogram.Note(this.rand0InnerType);
            rand1TypeHistogram.Note(this.rand1Type);
            SCode.location = "PCondIsEqCar";
#endif
            Control     unev = this.rand1;
            Environment env  = environment;
            object      ev1;
            while (unev.EvalStep(out ev1, ref unev, ref env))
            {
            }
            ;
#if DEBUG
            SCode.location = "PCondIsEqCar";
#endif
            if (ev1 == Interpreter.UnwindStack)
            {
                throw new NotImplementedException();
            }

            unev = this.rand0Inner;
            env  = environment;
            object ev0;
            while (unev.EvalStep(out ev0, ref unev, ref env))
            {
            }
            ;
#if DEBUG
            SCode.location = "PCondIsEqCar";
#endif
            if (ev0 == Interpreter.UnwindStack)
            {
                throw new NotImplementedException();
                //((UnwinderState) env).AddFrame (new PrimitiveCombination1Frame0 (this, environment));
                //answer = Interpreter.UnwindStack;
                //environment = env;
                //return false;
            }

#if DEBUG
            SCode.location = "PCondIsEqCar";
#endif
            if (!ObjectModel.SchemeEq(((Cons)ev0).Car, ev1))
            {
#if DEBUG
                SCode.location = "-";
                NoteCalls(this.consequent);
                consequentTypeHistogram.Note(this.consequentType);
                SCode.location = "PCondIsEqCar";
#endif
                expression = this.consequent;
            }
            else
            {
#if DEBUG
                SCode.location = "-";
                NoteCalls(this.alternative);
                alternativeTypeHistogram.Note(this.alternativeType);
                SCode.location = "PCondIsEqCar";
#endif
                expression = this.alternative;
            }
            answer = null; // happy compiler
            return(true);
        }
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
#if DEBUG
            Warm("-");
            NoteCalls(this.arg0);
            NoteCalls(this.arg1);
            NoteCalls(this.arg2);
            rand0TypeHistogram.Note(this.rand0Type);
            rand1TypeHistogram.Note(this.rand1Type);
            rand2TypeHistogram.Note(this.rand2Type);
            SCode.location = "PrimitiveHunk3Cons";
#endif
            object      ev2;
            Environment env  = environment;
            Control     unev = this.arg2;
            while (unev.EvalStep(out ev2, ref unev, ref env))
            {
            }
            ;
#if DEBUG
            SCode.location = "PrimitiveHunk3Cons";
#endif
            if (ev2 == Interpreter.UnwindStack)
            {
                ((UnwinderState)env).AddFrame(new PrimitiveCombination3Frame0(this, environment));
                answer      = Interpreter.UnwindStack;
                environment = env;
                return(false);
            }

            object ev1;
            env  = environment;
            unev = this.arg1;
            while (unev.EvalStep(out ev1, ref unev, ref env))
            {
            }
            ;
#if DEBUG
            SCode.location = "PrimitiveHunk3Cons";
#endif
            if (ev1 == Interpreter.UnwindStack)
            {
                ((UnwinderState)env).AddFrame(new PrimitiveCombination3Frame1(this, environment, ev2));
                answer      = Interpreter.UnwindStack;
                environment = env;
                return(false);
            }

            object ev0;
            env  = environment;
            unev = this.arg0;
            while (unev.EvalStep(out ev0, ref unev, ref env))
            {
            }
            ;

#if DEBUG
            SCode.location = "PrimitiveHunk3Cons";
#endif
            if (ev0 == Interpreter.UnwindStack)
            {
                throw new NotImplementedException();
            }

            if (ObjectModel.Hunk3Cons(out answer, ev0, ev1, ev2))
            {
                throw new NotImplementedException();
            }
            return(false);
        }