still working on the method dispatch

This commit is contained in:
Torsten Ruger
2014-06-13 23:41:45 +03:00
parent ebf117a63a
commit a7551ea8b6
10 changed files with 79 additions and 39 deletions

View File

@ -5,6 +5,13 @@ module Core
# We use this module syntax to avoid the (ugly) self (also eases searching).
module ClassMethods
def exit context
function = Vm::Function.new(:exit , Vm::Integer , [] )
ret = Vm::RegisterMachine.instance.exit(function)
function.set_return ret
function
end
def putstring context
function = Vm::Function.new(:putstring , Vm::Integer , [] )
ret = Vm::RegisterMachine.instance.write_stdout(function)
@ -18,7 +25,7 @@ module Core
context.object_space.add_object buffer # and save it (function local variable: a no no)
int = putint_function.receiver
moved_int = putint_function.new_local
utoa = context.object_space.get_or_create_class(:Object).get_or_create_function(:utoa)
utoa = context.object_space.get_or_create_class(:Object).resolve_function(:utoa)
putint_function.instance_eval do
mov( moved_int , int ) # move arg up
add( int , buffer ,nil ) # string to write to (add string address to pc)