Пример #1
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCond2L.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.FastLexicalRef (out ev0, this.rand0Name, this.rand0Depth, 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;
            }
        }
 public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
 {
     #if DEBUG
     Warm ("PrimitivePlusFixnumA1L.EvalStep");
     #endif
     object ev1;
     if (environment.FastLexicalRef (out ev1, this.rand1Name, this.rand1Depth, this.rand1Offset))
         throw new NotImplementedException ();
     answer = (int) environment.Argument1Value + (int) ev1;
     return false;
 }
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PrimitivePlusFixnumLQ.EvalStep");
            #endif
            // Eval argument1
            int ev1 = this.rand1Value;

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

            // Compute answer
            answer = (int) ev0 + ev1;
            return false;
        }
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PrimitiveGeneralCarCdrLQ.EvalStep");
            #endif
            // Eval argument0
            object ev0;
            if (environment.FastLexicalRef (out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset))
                throw new NotImplementedException ();

            // Compute answer
            if (Cons.GeneralCarCdr (out answer, ev0, this.rand1Value))
                throw new NotImplementedException ();
            return false;
        }
Пример #5
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ();
            #endif
            object ev0 = environment.Argument1Value;

            if (!(ev0 is Symbol)) {

                answer = this.alternativeValue;
                return false;
            }
            else {
                if (environment.FastLexicalRef (out answer, this.consequentName, this.consequentDepth, this.consequentOffset))
                    throw new NotImplementedException ();
                return false;
            }
        }
Пример #6
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCondIsSymbolLQ.EvalStep");
            #endif
            object ev0;
            if (environment.FastLexicalRef (out ev0, this.predicateName, this.predicateDepth, this.predicateOffset))
                throw new NotImplementedException ();

            if (!(ev0 is Symbol)) {
            #if DEBUG
                noteCalls (this.alternative);
            #endif
                expression = this.alternative;
                answer = null;
                return true;
            }
            else {
                answer = this.consequentValue;
                return true;
            }
        }
Пример #7
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("-");
            SCode.location = "PCondIsObjectEqQL";
            #endif
            object ev1;
            if (environment.FastLexicalRef (out ev1, this.rand1Name, this.rand1Depth, 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;
            }
        }
Пример #8
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCondIsObjectEqLQQ.EvalStep");
            #endif
            object ev0;
            if (environment.FastLexicalRef (out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset))
                throw new NotImplementedException ();

            if (ev0 == this.rand1Value) {
                answer = this.consequentValue;
                return false;
            }
            else {
            #if DEBUG
                noteCalls (this.alternative);
                alternativeTypeHistogram.Note (this.alternativeType);
            #endif
                expression = this.alternative;
                answer = null;
                return true;
            }
        }
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PrimitiveIsFixnumEqualA1L.EvalStep");
            #endif
            // Eval argument1
            object ev1;
            if (environment.FastLexicalRef (out ev1, this.rand1Name, this.rand1Depth, this.rand1Offset))
                throw new NotImplementedException ();

            // Greater-than-fixnum?
            answer = (int) environment.Argument1Value == (int) ev1 ? Constant.sharpT : Constant.sharpF;
            return false;
        }
Пример #10
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("-");
            SCode.location = "PCond2A0L1L1L.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.FastLexicalRef (out answer, this.alternativeName, this.alternativeDepth, this.alternativeOffset))
                    throw new NotImplementedException ();
                return false;
            }
            else {
                if (environment.FastLexicalRef1 (out answer, this.consequentName, this.consequentOffset))
                    throw new NotImplementedException ();
                return false;
            }
        }
Пример #11
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCondIsFixnumEqualAL");
            #endif
            object ev1;
            if (environment.FastLexicalRef (out ev1, this.rand1Name, this.rand1Depth, this.rand1Offset))
                throw new NotImplementedException ();

            object ev0 = environment.ArgumentValue (this.rand0Offset);

            if ((int) ev0 == (int) 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;
            }
        }
Пример #12
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;
        }
Пример #13
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("-");
            procedureHistogram.Note (this.procedure);
            SCode.location = "PCond2LASA0.EvalStep";
            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, 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;
            }
        }
Пример #14
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("-");
            SCode.location = "PCond2LQQQ.EvalStep";
            Primitive.hotPrimitives.Note (this.procedure);
            SCode.location = this.procedure.Name.ToString();
            #endif
            object predValue;

            object ev0;
            if (environment.FastLexicalRef (out ev0, this.rand0Name, this.rand0Depth, 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;
            }
        }
Пример #15
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("-");
            noteCalls (this.rand1);
            SCode.location = "PrimitivePlusFixnumL.EvalStep";
            #endif
            // Eval argument1
            object ev1;

            Control unev = this.rand1;
            Environment env = environment;
            while (unev.EvalStep (out ev1, ref unev, ref env)) { };
            #if DEBUG
            SCode.location = "PrimitivePlusFixnumL.EvalStep.1";
            #endif
            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.FastLexicalRef (out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset))
                throw new NotImplementedException ();

            // Compute answer
            answer = (int) ev0 + (int) ev1;
            return false;
        }
 public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
 {
     #if DEBUG
     Warm ("PrimitiveIsFixnumEqualAL.EvalStep");
     #endif
     object ev1;
     if (environment.FastLexicalRef (out ev1, this.rand1Name, this.rand1Depth, this.rand1Offset))
         throw new NotImplementedException ();
     object ev0 = environment.ArgumentValue (this.rand0Offset);
     answer = ((int) ev0 == (int) ev1) ? Constant.sharpT : Constant.sharpF;
     return false;
 }
Пример #17
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("-");
            noteCalls (this.rand1);
            rand1TypeHistogram.Note (this.rand1Type);
            SCode.location = "PCondIsObjectEqL";
            #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.FastLexicalRef (out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset))
                throw new NotImplementedException ();

            if (ev0 == 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;
            }
        }
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PrimitiveIsFixnumEqualL.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.FastLexicalRef (out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset))
                throw new NotImplementedException ();

            // Greater-than-fixnum?
            answer = (int) ev0 == (int) ev1 ? Constant.sharpT : Constant.sharpF;
            return false;
        }
Пример #19
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCondIsObjectEqLQQL.EvalStep");
            #endif
            object ev0;
            if (environment.FastLexicalRef (out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset))
                throw new NotImplementedException ();

            if (ev0 == this.rand1Value) {
                answer = this.consequentValue;
                return false;
            }
            else {
                if (environment.FastLexicalRef (out answer, this.alternativeName, this.alternativeDepth, this.alternativeOffset))
                    throw new NotImplementedException ();
                return false;
            }
        }
Пример #20
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #region EvalStepBody
            #if DEBUG
            Warm ();
            #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 {
                if (environment.FastLexicalRef (out answer, this.consequentName, this.consequentDepth, this.consequentOffset))
                    throw new NotImplementedException ();
                return false;
            }
            #endregion
        }
Пример #21
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("-");
            SCode.location = "PCondIsObjectEqQLQQ";
            #endif
            object ev1;
            if (environment.FastLexicalRef (out ev1, this.rand1Name, this.rand1Depth, this.rand1Offset))
                throw new NotImplementedException ();

            answer = (this.rand0Value == ev1) ? this.consequentValue : this.alternativeValue;
            return false;
        }
Пример #22
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ("PCondIsComplexA0L.EvalStep");
            #endif
            object ev0 = environment.Argument0Value;

            if (!(ev0 is Complex)) {
            #if DEBUG
                noteCalls (this.alternative);
            #endif
                expression = this.alternative;
                answer = null;

                return true;
            }
            else {
                if (environment.FastLexicalRef (out answer, this.consequentName, this.consequentDepth, this.consequentOffset))
                    throw new NotImplementedException ();
                return false;
            }
        }
Пример #23
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #if DEBUG
            Warm ();
            noteCalls (this.arg0);
            #endif
            Control unev0 = this.arg0;
            Environment env = environment;
            object ev0;
            while (unev0.EvalStep (out ev0, ref unev0, ref env)) { };
            if (ev0 == Interpreter.UnwindStack) {
                throw new NotImplementedException ();
                //((UnwinderState) env).AddFrame (new PrimitiveIsSymbolFrame0 (this, environment));
                //answer = Interpreter.UnwindStack;
                //environment = env;
                //return false;
            }

            if (!(ev0 is Symbol)) {
                if (environment.FastLexicalRef (out answer, this.alternativeName, this.alternativeDepth, this.alternativeOffset))
                    throw new NotImplementedException ();
                return false;
            }
            else {
            #if DEBUG
                noteCalls (this.consequent);
            #endif
                expression = this.consequent;
                answer = null;
                return true;
            }
        }
Пример #24
0
 public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
 {
     #if DEBUG
     Warm ("PrimitiveIsCharEqQL.EvalStep");
     #endif
     object ev1;
     if (environment.FastLexicalRef (out ev1, this.rand1Name, this.rand1Depth, this.rand1Offset))
         throw new NotImplementedException ();
     answer = (ev1 is char && this.rand0Value == (char) ev1) ? Constant.sharpT : Constant.sharpF;
     return false;
 }
Пример #25
0
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
            #region EvalStepBody
            #if DEBUG
            Warm ();
            #endif
            object ev0 = environment.Argument1Value;

            if (!(ev0 is Symbol)) {
                if (environment.FastLexicalRef (out answer, this.alternativeName, this.alternativeDepth, this.alternativeOffset))
                    throw new NotImplementedException ();
                return false;
            }
            else {
            #if DEBUG
                noteCalls (this.consequent);

            #endif
                expression = this.consequent;
                answer = null;
                return true;
            }
            #endregion
        }
Пример #26
0
 public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
 {
     #if DEBUG
     Warm ("PrimitiveIsIntEqLQ.EvalStep");
     #endif
     object ev0;
     if (environment.FastLexicalRef (out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset))
         throw new NotImplementedException ();
     answer = ((int) ev0 == this.rand1Value) ? Constant.sharpT : Constant.sharpF;
     return false;
 }