Beispiel #1
0
        // ( items n -- items[n] )
        public override void Execute(Interpreter interp)
        {
            IntItem   n     = (IntItem)interp.StackPop();
            ArrayItem items = (ArrayItem)interp.StackPop();

            interp.StackPush(items.ArrayValue[n.IntValue]);
        }
Beispiel #2
0
        // ( array forthic -- ? )
        public override void Execute(Interpreter interp)
        {
            StringItem forthic = (StringItem)interp.StackPop();
            ArrayItem  indices = (ArrayItem)interp.StackPop();

            if (indices.ArrayValue.Count == 2)
            {
                IntItem i_max = (IntItem)indices.ArrayValue[0];
                IntItem j_max = (IntItem)indices.ArrayValue[1];
                for (var i = 0; i < i_max.IntValue; i++)
                {
                    for (var j = 0; j < j_max.IntValue; j++)
                    {
                        interp.StackPush(new IntItem(i));
                        interp.StackPush(new IntItem(j));
                        interp.Run(forthic.StringValue);
                    }
                }
            }
        }
Beispiel #3
0
 public bool IsEqual(IntItem rhs)
 {
     double delta = this.DoubleValue - rhs.DoubleValue;
     return Math.Abs(delta) < tolerance;
 }
Beispiel #4
0
 public bool IsEqual(IntItem rhs)
 {
     return(this.IntValue == rhs.IntValue);
 }