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() 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

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 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

View File

@ -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
end
int rest = self / 10 int rest = self / 10
str = rest.as_string( str ) str = rest.as_string( str )
end
return str return str
end end

View File

@ -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

View File

@ -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"