Mostly replaced Fixnum with integer
also in the rx-file dependency
all travis and testing with 2.4+
This commit is contained in:
Torsten Ruger 2019-02-07 18:24:35 +02:00
parent 51eff62931
commit 8d3a1954fa
25 changed files with 30 additions and 27 deletions

View File

@ -1 +1 @@
2.3.8
2.6.1

View File

@ -4,4 +4,7 @@ script:
- ruby test/test_all.rb
- bundle exec codeclimate-test-reporter
rvm:
- 2.3.7
- 2.4.5
- 2.5.3
- 2.6.1

View File

@ -1,6 +1,6 @@
GIT
remote: https://github.com/ruby-x/rx-file
revision: c1de10352d8af105fe532008ceafcdd30b5fbdab
revision: 7c4a5546136d1bad065803da91778b209c18cb4d
specs:
rx-file (0.3.0)

View File

@ -19,7 +19,7 @@ module Arm
# for the shift handling that makes the arm so unique
def shift val , by
raise "Not integer #{val}:#{val.class} #{inspect}" unless val.is_a? Fixnum
raise "Not integer #{val}:#{val.class} #{inspect}" unless val.is_a? ::Integer
val << by
end

View File

@ -63,7 +63,7 @@ module Arm
if r_name.is_a? ::Risc::RegisterValue
r_name = r_name.symbol
end
if r_name.is_a? Fixnum
if r_name.is_a? ::Integer
r_name = "r#{r_name}"
end
r = REGISTERS[r_name.to_s]

View File

@ -5,7 +5,7 @@ module Arm
super(nil)
@attributes = attributes
@left = left
@right = right.is_a?(Fixnum) ? IntegerConstant.new(right) : right
@right = right.is_a?(::Integer) ? IntegerConstant.new(right) : right
@attributes[:condition_code] = :al if @attributes[:condition_code] == nil
@operand = 0
@attributes[:update_status] = 1

View File

@ -85,7 +85,7 @@ module Parfait
# add a type, meaning the instance given must be a valid type
def add_type( type )
hash = type.hash
raise "upps #{hash} #{hash.class}" unless hash.is_a?(Fixnum)
raise "upps #{hash} #{hash.class}" unless hash.is_a?(::Integer)
was = types[hash]
return was if was
types[hash] = type

View File

@ -27,7 +27,7 @@ module Parfait
def initialize( len )
super()
self.char_length = 0
raise "Must init with int, not #{len.class}" unless len.kind_of? Fixnum
raise "Must init with int, not #{len.class}" unless len.kind_of? ::Integer
raise "Must init with positive, not #{len}" if len < 0
set_length( len , 32 ) unless len == 0 #32 being ascii space
#puts "type #{self.get_type} #{self.object_id.to_s(16)}"
@ -87,7 +87,7 @@ module Parfait
# the index starts at one, but may be negative to count from the end
# indexes out of range will raise an error
def set_char( at , char )
raise "char not fixnum #{char.class}" unless char.kind_of? Fixnum
raise "char not fixnum #{char.class}" unless char.kind_of? ::Integer
index = range_correct_index(at)
set_internal_byte( index , char)
end
@ -137,7 +137,7 @@ module Parfait
def range_correct_index( at )
index = at
# index = self.length + at if at < 0
raise "index not integer #{at.class}" unless at.is_a?(Fixnum)
raise "index not integer #{at.class}" unless at.is_a?(::Integer)
raise "index must be positive , not #{at}" if (index < 0)
raise "index too large #{at} > #{self.length}" if (index >= self.length )
return index + 11

View File

@ -36,7 +36,7 @@ require_relative "risc/method_compiler"
require_relative "risc/block_compiler"
require_relative "risc/assembler"
class Fixnum
class Integer
def fits_u8?
self >= 0 and self <= 255
end

View File

@ -34,7 +34,7 @@ module Risc
# Objects are data and get assembled after functions
def self.add_object( objekt , depth)
return false if Position.set?(objekt)
return true if objekt.is_a? Fixnum
return true if objekt.is_a? ::Integer
return true if objekt.is_a?( Risc::Label)
#puts message(objekt , depth)
#puts "ADD #{objekt.inspect}, #{objekt.name}" if objekt.is_a? Parfait::CallableMethod

View File

@ -73,7 +73,7 @@ module Risc
def set_register( reg , val )
old = get_register( reg ) # also ensures format
if val.is_a? Fixnum
if val.is_a? ::Integer
@flags[:zero] = (val == 0)
@flags[:plus] = (val >= 0)
@flags[:minus] = (val < 0)
@ -190,7 +190,7 @@ module Risc
end
raise "Unsupported action, must convert symbol to word:#{object}" if object.is_a?(Symbol)
value = object.get_char( index )
#value = value.object_id unless value.is_a? Fixnum
#value = value.object_id unless value.is_a? ::Integer
set_register( @instruction.register , value )
true
end

View File

@ -142,7 +142,7 @@ module Risc
when Label
ins = Risc.load_constant("#{right.class} to #{self.type}" , right , self)
builder.compiler.add_constant(right.address) if builder
when Fixnum
when ::Integer
ins = Risc.load_data("#{right.class} to #{self.type}" , right , self)
when RegisterValue
ins = Risc.transfer("#{right.type} to #{self.type}" , right , self)

View File

@ -206,7 +206,7 @@ module Risc
case object
when nil
@stream.write_signed_int_32(0)
when Fixnum
when ::Integer
@stream.write_signed_int_32(object)
else
@stream.write_signed_int_32(Position.get(object) + @linker.platform.loaded_at)

View File

View File

@ -12,7 +12,7 @@ module Arm
assert_equal Arm::Translator , @arm.translator.class
end
def test_platform_loaded_class
assert_equal Fixnum , @arm.loaded_at.class
assert_equal ::Integer , @arm.loaded_at.class
end
end
end

View File

@ -10,7 +10,7 @@ module Mains
end
def test_chain # max 1011 iterations on 1014 integers (1024 - 10 reserve)
run_all
assert_equal Fixnum , get_return.class , " "
assert_equal ::Integer , get_return.class , " "
assert_equal 0 , get_return , " "
end

View File

@ -53,7 +53,7 @@ module Parfait
def test_types_hashes
types = @space.instance_variable_ged("@types")
types.each do |has , type|
assert has.is_a?(Fixnum) , has.inspect
assert has.is_a?(::Integer) , has.inspect
end
end
def test_classes_types_in_space_types

View File

@ -34,7 +34,7 @@ module Risc
ret = main_ticks(19)
assert_equal FunctionReturn , ret.class
link = @interpreter.get_register( ret.register )
assert_equal Fixnum , link.class
assert_equal ::Integer , link.class
end
def test_transfer
transfer = main_ticks(20)

View File

@ -51,7 +51,7 @@ module Risc
assert_equal :- , op.operator
assert_equal :r3 , op.left.symbol
assert_equal :r1 , op.right.symbol
assert_equal Fixnum , @interpreter.get_register(:r3).class
assert_equal ::Integer , @interpreter.get_register(:r3).class
assert 0 != @interpreter.get_register(:r3)
end
def test_branch

View File

@ -47,7 +47,7 @@ module Risc
ret = main_ticks(93)
assert_equal FunctionReturn , ret.class
link = @interpreter.get_register( ret.register )
assert_equal Fixnum , link.class
assert_equal ::Integer , link.class
end
end
end

View File

@ -40,7 +40,7 @@ module Risc
RegToSlot, LoadConstant, SlotToReg, RegToSlot, RegToSlot,
SlotToReg, SlotToReg, SlotToReg, FunctionReturn, Transfer, # 140
SlotToReg, SlotToReg, Syscall, NilClass, ]
assert_equal Fixnum , get_return.class
assert_equal ::Integer , get_return.class
assert_equal 1 , get_return
end
@ -63,7 +63,7 @@ module Risc
ret = main_ticks(139)
assert_equal FunctionReturn , ret.class
link = @interpreter.get_register( ret.register )
assert_equal Fixnum , link.class
assert_equal ::Integer , link.class
end
def test_sys
sys = main_ticks(143)

View File

@ -47,7 +47,7 @@ module Risc
RegToSlot, LoadConstant, SlotToReg, RegToSlot, RegToSlot, # 30
SlotToReg, SlotToReg, SlotToReg, Branch, FunctionReturn,
Transfer, SlotToReg, SlotToReg, Syscall, NilClass, ]
assert_equal Fixnum , get_return.class
assert_equal ::Integer , get_return.class
assert_equal 5 , get_return
end
def test_length

View File

@ -32,7 +32,7 @@ module Risc
ret = main_ticks(15)
assert_equal FunctionReturn , ret.class
link = @interpreter.get_register( ret.register )
assert_equal Fixnum , link.class
assert_equal ::Integer , link.class
end
def test_transfer
transfer = main_ticks(16)

View File

@ -12,7 +12,7 @@ module Risc
assert_equal Risc::IdentityTranslator , @inter.translator.class
end
def test_platform_loaded_class
assert_equal Fixnum , @inter.loaded_at.class
assert_equal ::Integer , @inter.loaded_at.class
end
def test_translator
assert IdentityTranslator.new

View File