work on Integer.to_s , not a simple task as it turns out

This commit is contained in:
Torsten Ruger
2014-05-15 16:54:23 +03:00
parent 918ede1c02
commit b4c79d218f
12 changed files with 80 additions and 11 deletions

View File

@ -23,7 +23,7 @@ module Core
#TODO this is in the wrong place. It is a function that returns a function object
# while all other methods add their code into some block. --> kernel
def putstring
def putstring context
function = Vm::Function.new(:putstring , [Vm::Integer , Vm::Integer ] )
block = function.body
# should be another level of indirection, ie write(io,str)
@ -31,6 +31,17 @@ module Core
function.return_type = ret
function
end
def putint context
function = Vm::Function.new(:putint , [Vm::Integer , Vm::Integer ] )
block = function.body
buffer = Vm::StringConstant.new(" ")
context.program.add_object buffer
# should be another level of indirection, ie write(io,str)
ret = Vm::CMachine.instance.integer_to_s(block , buffer)
function.return_type = ret
function
end
end
extend ClassMethods