Example #1
0
 public BasData NewNumber(int desc, double value = 0.0)
 {
     BasPoolDataItem item;
     if (pool.TryGetValue(desc, out item))
         return null;
     item = new BasPoolDataItem();
     item.type = BasDataType.Number;
     item.item = value;
     pool[desc] = item;
     BasData bd = new BasData(desc, this);
     return bd;
 }
Example #2
0
 public BasData NewNumber(double value = 0.0)
 {
     st:
     int desc = rnd.Next();
     BasPoolDataItem item;
     if (pool.TryGetValue(desc, out item))
         goto st;
     item = new BasPoolDataItem();
     item.type = BasDataType.Number;
     item.item = value;
     pool[desc] = item;
     BasData bd = new BasData(desc, this);
     return bd;
 }
Example #3
0
 private void _ProcessXor(BasData _arg0, BasData _arg1, BasData _arg2)
 {
     if (_arg0.IsConstant)
         throw new BasRuntimeException("arg0 may not be constant!");
     if (_arg0.Type != BasDataType.Boolean)
         throw new BasRuntimeException("arg0 must be bool!");
     if (_arg1.Type != BasDataType.Boolean)
         throw new BasRuntimeException("arg1 must be bool!");
     if (_arg2.Type != BasDataType.Boolean)
         throw new BasRuntimeException("arg2 must be bool!");
     bool d1 = (bool)_arg1.Data;
     bool d2 = (bool)_arg2.Data;
     _arg0.Data = d1 ^ d2;
 }
Example #4
0
 private void _ProcessSub(BasData _arg0, BasData _arg1, BasData _arg2)
 {
     if (_arg0.IsConstant)
         throw new BasRuntimeException("arg0 may not be constant!");
     if (_arg0.Type != BasDataType.Number)
         throw new BasRuntimeException("arg0 must be number!");
     if (_arg1.Type != BasDataType.Number)
         throw new BasRuntimeException("arg1 must be number!");
     if (_arg2.Type != BasDataType.Number)
         throw new BasRuntimeException("arg2 must be number!");
     double d1 = (double)_arg1.Data;
     double d2 = (double)_arg2.Data;
     _arg0.Data = d1 - d2;
 }
Example #5
0
 private void _ProcessNot(BasData _arg0, BasData _arg1)
 {
     if (_arg0.IsConstant)
         throw new BasRuntimeException("arg0 may not be constant!");
     if (_arg0.Type != BasDataType.Boolean)
         throw new BasRuntimeException("arg0 must be bool!");
     if (_arg1.Type != BasDataType.Boolean)
         throw new BasRuntimeException("arg1 must be bool!");
     bool d1 = (bool)_arg1.Data;
     _arg0.Data = !d1;
 }
Example #6
0
 private void _ProcessMov(BasData _arg0, BasData _arg1)
 {
     if (_arg0.IsConstant)
         throw new BasRuntimeException("arg0 may not be constant!");
     if (_arg0.Type != _arg1.Type)
         throw new BasRuntimeException("operand types must be identefical!");
     object d1 = _arg1.Data;
     _arg0.Data = d1;
 }