2014-05-06 11:47:07 +02:00
|
|
|
module Core
|
2014-05-06 11:42:43 +02:00
|
|
|
class Kernel
|
|
|
|
|
|
|
|
#there are no Kernel instances, only class methods.
|
|
|
|
# We use this module syntax to avoid the (ugly) self.
|
|
|
|
module ClassMethods
|
|
|
|
def main_start
|
|
|
|
#TODO extract args into array of strings
|
2014-05-06 11:47:07 +02:00
|
|
|
Vm::Machine.instance.main_start
|
2014-05-06 11:42:43 +02:00
|
|
|
end
|
|
|
|
def main_exit
|
|
|
|
# Machine.exit mov r7 , 0 + swi 0
|
2014-05-06 11:47:07 +02:00
|
|
|
Vm::Machine.instance.main_exit
|
2014-05-06 11:42:43 +02:00
|
|
|
end
|
|
|
|
def function_entry f_name
|
2014-05-06 11:47:07 +02:00
|
|
|
Vm::Machine.instance.function_entry f_name
|
2014-05-06 11:42:43 +02:00
|
|
|
end
|
|
|
|
def function_exit f_name
|
2014-05-06 11:47:07 +02:00
|
|
|
Vm::Machine.instance.function_exit f_name
|
2014-05-06 11:42:43 +02:00
|
|
|
end
|
|
|
|
def self.puts string
|
|
|
|
# should unwrap from string to char*
|
2014-05-06 11:47:07 +02:00
|
|
|
Vm::Machine.instance.puts string
|
2014-05-06 11:42:43 +02:00
|
|
|
end
|
2014-05-02 07:02:25 +02:00
|
|
|
end
|
2014-05-06 11:42:43 +02:00
|
|
|
|
|
|
|
extend ClassMethods
|
2014-05-02 07:02:25 +02:00
|
|
|
end
|
|
|
|
end
|