Beispiel #1
0
        public override void Eval(EvaluatorState ev)
        {
            //Console.WriteLine(this.ToString());

            // second operand
            IValue a = ev.GetVal();

            ev.RegR = new BooleanValue(!a.GetBooleanValue());
        }
Beispiel #2
0
        public override void Eval(EvaluatorState ev)
        {
            //Console.WriteLine(this.ToString());

            bool result = false;

            // second operand
            IValue b = ev.GetVal();

            // first operand
            IValue a = ev.GetStackTopVal();

            ev.Stack.Pop(); // pop a

            if (a.TypeOf() == b.TypeOf())
            {
                switch (a.TypeOf())
                {
                case ValueTypeID.TYPE_UNDEFINED:
                    result = true;
                    break;

                case ValueTypeID.TYPE_NULL:
                    result = true;
                    break;

                case ValueTypeID.TYPE_BOOLEAN:
                    result = a.GetBooleanValue() == b.GetBooleanValue();
                    break;

                case ValueTypeID.TYPE_NUMBER:
                    result = a.GetNumericValue() == b.GetNumericValue();
                    break;

                case ValueTypeID.TYPE_STRING:
                    result = String.Compare(a.GetStringValue(), b.GetStringValue()) == 0;
                    break;

                case ValueTypeID.TYPE_TABLEREF:
                    result = a.GetObjectValue() == b.GetObjectValue();
                    break;

                default:
                    throw new SharpNektonException(new SharpNektonError(SharpNektonErrorID.E_BADTYPE));
                }
            }
            else
            {
                result = false;
            }

            ev.RegR = new BooleanValue(result);
        }
Beispiel #3
0
        public override void Eval(EvaluatorState ev)
        {
            //Console.WriteLine(this.ToString());

            // operand
            IValue a = ev.GetVal();

            if (a.TypeOf() != ValueTypeID.TYPE_BOOLEAN)
            {
                ev.RegR = new BooleanValue(a.GetBooleanValue());
            }
        }
        public override void Eval(EvaluatorState ev)
        {
            //Console.WriteLine(this.ToString());

            // value is in R
            IValue a = ev.GetVal();

            if (a.GetBooleanValue() == false)
            {
                ev.RegPC = parameter;
            }
        }
Beispiel #5
0
        public override void Eval(EvaluatorState ev)
        {
            //Console.WriteLine(this.ToString());

            // value is in R
            IValue a = ev.GetVal();

            if (a.GetBooleanValue() == true)
            {
                ev.RegPC = parameter;
                //Console.WriteLine(">> jtrue: {0}", parameter.GetType().ToString());
                //Console.WriteLine(">> jtrue.Data: {0}", parameter.Data.GetType().ToString());
            }
        }
Beispiel #6
0
        public override void Eval(EvaluatorState ev)
        {
            //Console.WriteLine(this.ToString());

            // second operand is in R
            IValue b = ev.GetVal();

            // first operand
            IValue a = ev.GetStackTopVal();

            ev.Stack.Pop(); // pop a

            ev.RegR = new BooleanValue(a.GetBooleanValue() || b.GetBooleanValue());
        }
Beispiel #7
0
        public override void Eval(EvaluatorState ev)
        {
            //Console.WriteLine(this.ToString());

            // second operand is in R
            IValue b = ev.GetVal();

            // first operand
            IValue a = ev.GetStackTopVal();

            ev.Stack.Pop(); // pop a

            if (a.GetBooleanValue() == false)
            {
                // 'a' is false (has a false value), use 'b'
                ;
            }
            else
            {
                // 'a' has a true value (true == (bool) 'a'), move it to r
                // (so the value of the 'a' will be used)
                ev.RegR = a;
            }
        }