minor fixes
This commit is contained in:
parent
f746218765
commit
b2de1c6d79
@ -67,7 +67,7 @@ module Parfait
|
|||||||
def get_layout()
|
def get_layout()
|
||||||
l = get_internal(LAYOUT_INDEX)
|
l = get_internal(LAYOUT_INDEX)
|
||||||
#puts "get layout for #{self.class} returns #{l.class}"
|
#puts "get layout for #{self.class} returns #{l.class}"
|
||||||
raise "No layout #{self.object_id}:#{self.class} " unless l
|
raise "No layout #{self.object_id.to_s(16)}:#{self.class} " unless l
|
||||||
return l
|
return l
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ module Parfait
|
|||||||
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? Fixnum
|
||||||
raise "Must init with positive, not #{len}" if len < 0
|
raise "Must init with positive, not #{len}" if len < 0
|
||||||
set_length( len , 32 ) unless len == 0 #32 beeing ascii space
|
set_length( len , 32 ) unless len == 0 #32 beeing ascii space
|
||||||
|
#puts "layout #{self.get_layout} #{self.object_id.to_s(16)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# return a copy of self
|
# return a copy of self
|
||||||
@ -99,7 +100,7 @@ module Parfait
|
|||||||
index = at
|
index = at
|
||||||
index = self.length + at if at < 0
|
index = self.length + at if at < 0
|
||||||
raise "index must be positive , not #{at}" if (index <= 0)
|
raise "index must be positive , not #{at}" if (index <= 0)
|
||||||
raise "index too large #{at} > #{self.length}" if (index > self.length)
|
raise "index too large #{at} > #{self.length}" if (index > self.length )
|
||||||
return index
|
return index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@ class Integer < Value
|
|||||||
end
|
end
|
||||||
|
|
||||||
Word as_string(Word str)
|
Word as_string(Word str)
|
||||||
if_plus( self - 10 )
|
if_minus( self - 10 )
|
||||||
int num = digit()
|
int num = digit()
|
||||||
str = str.add_digit( num )
|
str = str.add_digit( num )
|
||||||
return str
|
else
|
||||||
|
int rest = self / 10
|
||||||
|
str = rest.as_string( str )
|
||||||
end
|
end
|
||||||
int rest = self / 10
|
|
||||||
str = rest.as_string( str )
|
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ class Word < Object
|
|||||||
get_internal(index)
|
get_internal(index)
|
||||||
end
|
end
|
||||||
Word add_digit( int i)
|
Word add_digit( int i)
|
||||||
int l = self.char_length
|
int l = self.char_length + 2
|
||||||
set_internal( l , i)
|
set_internal( l , i)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
@ -5,7 +5,7 @@ class TestPutiRT < MiniTest::Test
|
|||||||
|
|
||||||
def test_puti
|
def test_puti
|
||||||
@string_input = <<HERE
|
@string_input = <<HERE
|
||||||
Word five = 5.to_s()
|
Word five = 4.to_s()
|
||||||
five.putstring()
|
five.putstring()
|
||||||
HERE
|
HERE
|
||||||
@stdout = "5"
|
@stdout = "5"
|
||||||
|
Loading…
Reference in New Issue
Block a user