Ejemplo n.º 1
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCond2L1.EvalStep");
            #endif
            object ev1;
            Control unev = this.rand1;
            Environment env = environment;
            while (unev.EvalStep (out ev1, ref unev, ref env)) { };
            if (ev1 == Interpreter.UnwindStack) {
                throw new NotImplementedException();
            }

            object ev0;
            if (environment.FastLexicalRef1 (out ev0, this.rand0Name, this.rand0Offset))
                throw new NotImplementedException();

            #if DEBUG
            Primitive.hotPrimitives.Note (this.procedure);
            #endif
            if (this.method (out answer, ev0, ev1)) {
                TailCallInterpreter tci = answer as TailCallInterpreter;
                if (tci != null) {
                    answer = null; // dispose of the evidence
                    // set up the interpreter for a tail call
                    Control cExpression = tci.Expression;
                    Environment cEnvironment = tci.Environment;
                    while (cExpression.EvalStep (out answer, ref cExpression, ref cEnvironment)) { };
                }
            }

            if ((answer is bool) && (bool) answer == false) {
            #if DEBUG
                noteCalls (this.alternative);
            #endif
                expression = this.alternative;
                return true;
            }
            else {
            #if DEBUG
                noteCalls (this.consequent);
            #endif
                expression = this.consequent;
                return true;
            }
        }
Ejemplo n.º 2
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PrimitivePlusFixnumL1A0.EvalStep");
            #endif
            // Eval argument1
            object ev1 = environment.Argument0Value;

            // Eval argument0
            object ev0;
            if (environment.FastLexicalRef1 (out ev0, this.rand0Name, this.rand0Offset))
                throw new NotImplementedException ();

            // Compute answer
            answer = (int) ev0 + (int) ev1;
            return false;
        }
Ejemplo n.º 3
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PrimitivePlusFixnumL1.EvalStep");
            noteCalls (this.rand1);
            #endif
            // Eval argument1
            object ev1;

            Control unev = this.rand1;
            Environment env = environment;
            while (unev.EvalStep (out ev1, ref unev, ref env)) { };
            if (ev1 == Interpreter.UnwindStack) {
                throw new NotImplementedException ();
                //((UnwinderState) env).AddFrame (new PrimitiveCombination2Frame0 (this, environment));
                //answer = Interpreter.UnwindStack;
                //environment = env;
                //return false;
            }

            // Eval argument0
            object ev0;

            if (environment.FastLexicalRef1 (out ev0, this.rand0Name, this.rand0Offset))
                throw new NotImplementedException ();

            // Compute answer
            answer = (int) ev0 + (int) ev1;
            return false;
        }
Ejemplo n.º 4
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ();
            #endif
            // Eval argument1
            object ev1;
            if (environment.FastLexicalRef1 (out ev1, this.rand1Name, this.rand1Offset))
                throw new NotImplementedException ();

            // Eval argument0
            object ev0 = (int) environment.Argument0Value;

            // Compute answer
            throw new NotImplementedException ();
        }
Ejemplo n.º 5
0
 public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
 {
     #if DEBUG
     Warm ("PrimitiveIsCharEqQL1.EvalStep");
     #endif
     object ev1;
     if (environment.FastLexicalRef1 (out ev1, this.rand1Name, this.rand1Offset))
         throw new NotImplementedException ();
     answer = (this.rand0Value == (char) ev1) ? Constant.sharpT : Constant.sharpF;
     return false;
 }
Ejemplo n.º 6
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("-");
            SCode.location = "PCond2L1QQQ.EvalStep";
            Primitive.hotPrimitives.Note (this.procedure);
            SCode.location = this.procedure.Name.ToString();
            #endif
            object predValue;

            object ev0;
            if (environment.FastLexicalRef1 (out ev0, this.rand0Name, this.rand0Offset))
                throw new NotImplementedException();
            if (this.method (out predValue, ev0, this.rand1Value)) {
                TailCallInterpreter tci = predValue as TailCallInterpreter;
                if (tci != null) {
                    answer = null;
                    expression = tci.Expression;
                    environment = tci.Environment;
                    return true;
                }
                else
                    throw new NotImplementedException ();
            }

            if (predValue is bool && (bool) predValue == false) {
                answer = this.alternativeValue;
                return false;
            }
            else {
            #if DEBUG
                noteCalls (this.consequent);
            #endif
                expression = this.consequent;
                answer = null;
                return true;
            }
        }
Ejemplo n.º 7
0
 public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
 {
     #if DEBUG
     Warm ("PCondIsObjectEqQL1");
     #endif
     object ev1;
     if (environment.FastLexicalRef1 (out ev1, this.rand1Name, this.rand1Offset))
         throw new NotImplementedException ();
     if (this.rand0Value == ev1) {
     #if DEBUG
         noteCalls (this.consequent);
         consequentTypeHistogram.Note (this.consequentType);
     #endif
         expression = this.consequent;
         answer = null;
         return true;
     }
     else {
     #if DEBUG
         noteCalls (this.alternative);
         alternativeTypeHistogram.Note (this.alternativeType);
     #endif
         expression = this.alternative;
         answer = null;
         return true;
     }
 }
Ejemplo n.º 8
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCondIsObjectEqLQL1.EvalStep");
            noteCalls (this.rand1);
            SCode.location = "PCondIsObjectEqL1";
            #endif
            object ev0;
            if (environment.FastLexicalRef (out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset))
                throw new NotImplementedException ();

            if (ev0 == this.rand1Value) {
                if (environment.FastLexicalRef1 (out answer, this.consequentName, this.consequentOffset))
                    throw new NotImplementedException ();
                return false;
            }
            else {
            #if DEBUG
                noteCalls (this.alternative);
                alternativeTypeHistogram.Note (this.alternativeType);
            #endif
                expression = this.alternative;
                answer = null;
                return true;
            }
        }
Ejemplo n.º 9
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("-");
            SCode.location = "PCond2A0L1L1L1.EvalStep";
            #endif
            object ev1;
            if (environment.FastLexicalRef1 (out ev1, this.rand1Name, this.rand1Offset))
                throw new NotImplementedException ();

            #if DEBUG
            Primitive.hotPrimitives.Note (this.procedure);
            #endif
            if (this.method (out answer, environment.Argument0Value, ev1)) {
                TailCallInterpreter tci = answer as TailCallInterpreter;
                if (tci != null) {
                    answer = null; // dispose of the evidence
                    // set up the interpreter for a tail call
                    Control cExpression = tci.Expression;
                    Environment cEnvironment = tci.Environment;
                    while (cExpression.EvalStep (out answer, ref cExpression, ref cEnvironment)) { };
                }
            }

            if ((answer is bool) && (bool) answer == false) {
                if (environment.FastLexicalRef1 (out answer, this.alternativeName, this.alternativeOffset))
                    throw new NotImplementedException ();
                return false;
            }
            else {
                if (environment.FastLexicalRef1 (out answer, this.consequentName, this.consequentOffset))
                    throw new NotImplementedException ();
                return false;
            }
        }
Ejemplo n.º 10
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCondIsFixnumEqualA0L1L1.EvalStep");
            #endif
            object ev1;
            if (environment.FastLexicalRef1 (out ev1, this.rand1Name, this.rand1Offset))
                throw new NotImplementedException ();

            if ((int) environment.Argument0Value == (int) ev1) {
                if (environment.FastLexicalRef1 (out answer, this.consequentName, this.consequentOffset))
                    throw new NotImplementedException ();
                return false;
            }
            else {
            #if DEBUG
                noteCalls (this.alternative);
                alternativeTypeHistogram.Note (this.alternativeType);
            #endif
                expression = this.alternative;
                answer = null;
                return true;
            }
        }
Ejemplo n.º 11
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("-");
            SCode.location = "PCond2LL1A1A1.EvalStep";
            #endif
            object ev1;
            if (environment.FastLexicalRef1 (out ev1, this.rand1Name, this.rand1Offset))
                throw new NotImplementedException ();

            #if DEBUG
            Primitive.hotPrimitives.Note (this.procedure);
            #endif
            object ev0;
            if (environment.FastLexicalRef (out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset))
                throw new NotImplementedException();
            if (this.method (out answer, ev0, ev1)) {
                TailCallInterpreter tci = answer as TailCallInterpreter;
                if (tci != null) {
                    answer = null; // dispose of the evidence
                    // set up the interpreter for a tail call
                    Control cExpression = tci.Expression;
                    Environment cEnvironment = tci.Environment;
                    while (cExpression.EvalStep (out answer, ref cExpression, ref cEnvironment)) { };
                }
            }

            answer = environment.Argument1Value;
            return false;
        }
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PrimitiveGeneralCarCdrL1Q.EvalStep");
            #endif
            // Eval argument0
            object ev0;
            if (environment.FastLexicalRef1 (out ev0, this.rand0Name, this.rand0Offset))
                throw new NotImplementedException ();

            // Compute answer
            if (Cons.GeneralCarCdr (out answer, ev0, this.rand1Value))
                throw new NotImplementedException ();
            return false;
        }
Ejemplo n.º 13
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("-");
            procedureHistogram.Note (this.procedure);
            SCode.location = "PCond2L1ASA0.EvalStep";
            Primitive.hotPrimitives.Note (this.procedure);
            #endif
            object ev0;
            if (environment.FastLexicalRef1 (out ev0, this.rand0Name, this.rand0Offset))
                throw new NotImplementedException();
            if (this.method (out answer, ev0, environment.ArgumentValue (this.rand1Offset))) {
                TailCallInterpreter tci = answer as TailCallInterpreter;
                if (tci != null) {
                    answer = null; // dispose of the evidence
                    // set up the interpreter for a tail call
                    Control cExpression = tci.Expression;
                    Environment cEnvironment = tci.Environment;
                    while (cExpression.EvalStep (out answer, ref cExpression, ref cEnvironment)) { };
                }
            }

            if ((answer is bool) && (bool) answer == false) {
                answer = environment.Argument0Value;
                return false;
            }
            else {
            #if DEBUG
                noteCalls (this.consequent);
                consequentTypeHistogram.Note (this.consequentType);
            #endif
                expression = this.consequent;
                return true;
            }
        }
Ejemplo n.º 14
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCondIsObjectEqL1QQx.EvalStep");
            #endif
            object ev0;
            if (environment.FastLexicalRef1 (out ev0, this.rand0Name, this.rand0Offset))
                throw new NotImplementedException ();

            answer = (ev0 == this.rand1Value) ? this.consequentValue : ev0;
            return false;
        }
Ejemplo n.º 15
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #region EvalStepBody
            #if DEBUG
            Warm ("PCondIsFixnumL1.EvalStep");
            #endif
            object ev0;
            if (environment.FastLexicalRef1 (out ev0, this.predicateName, this.predicateOffset))
                throw new NotImplementedException ();

            if (ev0 is Int32) {
            #if DEBUG
                noteCalls (this.consequent);
            #endif
                expression = this.consequent;
                answer = null;
                return true;
            }
            else {
            #if DEBUG
                noteCalls (this.alternative);

            #endif
                expression = this.alternative;
                answer = null;
                return true;
            }
            #endregion
        }
Ejemplo n.º 16
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCondIsObjectEqL1QSx.EvalStep");
            #endif
            object ev0;
            if (environment.FastLexicalRef1 (out ev0, this.rand0Name, this.rand0Offset))
                throw new NotImplementedException ();

            if (ev0 == this.rand1Value) {
            #if DEBUG
                noteCalls (this.consequent);
                consequentTypeHistogram.Note (this.consequentType);
            #endif
                expression = this.consequent;
                answer = null;
                return true;
            }
            else {
                answer = ev0;
                return false;
            }
        }
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ();
            #endif
            // Eval argument1
            object ev1;
            if (environment.FastLexicalRef1 (out ev1, this.rand1Name, this.rand1Offset))
                throw new NotImplementedException ();

            // Eval argument0
            object ev0 = (int) environment.Argument1Value;

            // Greater-than-fixnum?
            answer = (int) ev0 == (int) ev1 ? Constant.sharpT : Constant.sharpF;
            return false; throw new NotImplementedException ();
        }
Ejemplo n.º 18
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            Unimplemented ();
            #if DEBUG
            Warm ("-");
            noteCalls (this.rand1);
            SCode.location = "PCondIsObjectEqL1";
            #endif
            Control unev = this.rand1;
            Environment env = environment;
            object ev1;
            while (unev.EvalStep (out ev1, ref unev, ref env)) { };
            if (ev1 == Interpreter.UnwindStack) {
                throw new NotImplementedException ();
            }

            object ev0;
            if (environment.FastLexicalRef1 (out ev0, this.rand0Name, this.rand0Offset))
                throw new NotImplementedException ();

            if (ev0 == ev1) {
            #if DEBUG
                noteCalls (this.consequent);
            #endif
                expression = this.consequent;
                answer = null;
                return true;
            }
            else {
            #if DEBUG

            #endif
                expression = this.alternative;
                answer = null;
                return true;
            }
        }
Ejemplo n.º 19
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCondIsComplex.EvalStep");
            #endif
            object ev0;
            if (environment.FastLexicalRef1 (out ev0, this.predicateName, this.predicateOffset))
                throw new NotImplementedException ();

            if (!(ev0 is Complex)) {
            #if DEBUG
                noteCalls (this.alternative);
            #endif
                expression = this.alternative;
                answer = null;
                return true;
            }
            else {
                answer = this.consequentValue;
                return false;
            }
        }
Ejemplo n.º 20
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #region EvalStepBody
            #if DEBUG
            Warm ();
            noteCalls (this.arg0);
            #endif
            object ev0;
            if (environment.FastLexicalRef1 (out ev0, this.predicateName, this.predicateOffset))
                throw new NotImplementedException ();

            if (!(ev0 is Symbol)) {
                answer = this.alternativeValue;
                return false;
            }
            else {
            #if DEBUG
                noteCalls (this.consequent);
            #endif
                expression = this.consequent;
                answer = null;
                return true;
            }
            #endregion

            throw new NotImplementedException ();
        }
Ejemplo n.º 21
0
 public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
 {
     #if DEBUG
     Warm ("PCondIsNegativeL1SA0.EvalStep");
     #endif
     object tmp;
     if (environment.FastLexicalRef1 (out tmp, this.predicateName, this.predicateOffset))
         throw new NotImplementedException ();
     if ((int) tmp < 0) {
     #if DEBUG
         noteCalls (this.Consequent);
     #endif
         expression = this.Consequent;
         answer = false;
         return true;
     }
     else {
         answer = environment.Argument0Value;
         return false;
     }
 }