minor fixes

This commit is contained in:
Torsten Ruger 2015-11-08 23:58:54 +02:00
parent f746218765
commit b2de1c6d79
5 changed files with 9 additions and 8 deletions

View File

@ -67,7 +67,7 @@ module Parfait
def get_layout()
l = get_internal(LAYOUT_INDEX)
#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
end

View File

@ -25,6 +25,7 @@ module Parfait
raise "Must init with int, not #{len.class}" unless len.kind_of? Fixnum
raise "Must init with positive, not #{len}" if len < 0
set_length( len , 32 ) unless len == 0 #32 beeing ascii space
#puts "layout #{self.get_layout} #{self.object_id.to_s(16)}"
end
# return a copy of self
@ -99,7 +100,7 @@ module Parfait
index = at
index = self.length + at if at < 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
end

View File

@ -9,13 +9,13 @@ class Integer < Value
end
Word as_string(Word str)
if_plus( self - 10 )
if_minus( self - 10 )
int num = digit()
str = str.add_digit( num )
return str
end
else
int rest = self / 10
str = rest.as_string( str )
end
return str
end

View File

@ -3,7 +3,7 @@ class Word < Object
get_internal(index)
end
Word add_digit( int i)
int l = self.char_length
int l = self.char_length + 2
set_internal( l , i)
return self
end

View File

@ -5,7 +5,7 @@ class TestPutiRT < MiniTest::Test
def test_puti
@string_input = <<HERE
Word five = 5.to_s()
Word five = 4.to_s()
five.putstring()
HERE
@stdout = "5"