stdout word too
This commit is contained in:
parent
6b9c472bec
commit
c8fa5238ee
@ -76,7 +76,7 @@ module Interpreter
|
|||||||
return unless @instruction
|
return unless @instruction
|
||||||
@clock += 1
|
@clock += 1
|
||||||
name = @instruction.class.name.split("::").last
|
name = @instruction.class.name.split("::").last
|
||||||
log.debug @instruction
|
log.debug "#{@clock}: #{@instruction}"
|
||||||
fetch = send "execute_#{name}"
|
fetch = send "execute_#{name}"
|
||||||
return unless fetch
|
return unless fetch
|
||||||
set_instruction @instruction.next
|
set_instruction @instruction.next
|
||||||
@ -164,9 +164,16 @@ module Interpreter
|
|||||||
case name
|
case name
|
||||||
when :putstring
|
when :putstring
|
||||||
str = get_register( :r1 ) # should test length, ie r2
|
str = get_register( :r1 ) # should test length, ie r2
|
||||||
raise "NO string for putstring #{str.class}:#{str.object_id}" unless str.is_a? Symbol
|
case str
|
||||||
@stdout += str.to_s
|
when Symbol
|
||||||
ret_value = str.to_s.length
|
@stdout += str.to_s
|
||||||
|
ret_value = str.to_s.length
|
||||||
|
when Parfait::Word
|
||||||
|
@stdout += str.to_string
|
||||||
|
ret_value = str.char_length
|
||||||
|
else
|
||||||
|
raise "NO string for putstring #{str.class}:#{str.object_id}" unless str.is_a?(Symbol)
|
||||||
|
end
|
||||||
when :exit
|
when :exit
|
||||||
set_instruction(nil)
|
set_instruction(nil)
|
||||||
return false
|
return false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user