2015-06-29 20:03:58 +02:00
|
|
|
module Register
|
|
|
|
module Builtin
|
|
|
|
class Object
|
|
|
|
module ClassMethods
|
2015-05-04 22:03:52 +02:00
|
|
|
|
2015-06-29 20:03:58 +02:00
|
|
|
# main entry point, ie __init__ calls this
|
|
|
|
# defined here as empty, to be redefined
|
|
|
|
def main context
|
2015-10-14 15:16:03 +02:00
|
|
|
function = Virtual::MethodSource.create_method(:Object, :Integer , :main , [])
|
2015-06-29 20:03:58 +02:00
|
|
|
return function
|
|
|
|
end
|
2014-06-03 13:49:02 +02:00
|
|
|
|
2015-06-29 20:03:58 +02:00
|
|
|
# in ruby, how this goes is
|
|
|
|
# def _get_instance_variable var
|
|
|
|
# i = self.index_of(var)
|
|
|
|
# return at_index(i)
|
|
|
|
# end
|
|
|
|
# The at_index is just "below" the api, something we need but don't want to expose,
|
|
|
|
# so we can't code the above in ruby
|
2015-10-14 15:16:03 +02:00
|
|
|
def _get_instance_variable context , name = :Integer
|
|
|
|
get_function = Virtual::MethodSource.create_method(:Object,:Integer, :_get_instance_variable , [ ] )
|
2015-06-29 20:03:58 +02:00
|
|
|
return get_function
|
2015-07-21 19:24:31 +02:00
|
|
|
# me = get_function.receiver
|
|
|
|
# var_name = get_function.args.first
|
|
|
|
# return_to = get_function.return_type
|
|
|
|
#
|
|
|
|
# index_function = ::Virtual.machine.space.get_class_by_name(:Object).resolve_method(:index_of)
|
|
|
|
# # get_function.push( [me] )
|
|
|
|
# # index = get_function.call( index_function )
|
|
|
|
#
|
|
|
|
# after_body = get_function.new_block("after_index")
|
|
|
|
# get_function.current after_body
|
|
|
|
#
|
|
|
|
# # get_function.pop([me])
|
|
|
|
# # return_to.at_index( get_function , me , return_to )
|
|
|
|
#
|
|
|
|
# # get_function.set_return return_to
|
|
|
|
# return get_function
|
2015-06-29 20:03:58 +02:00
|
|
|
end
|
2014-06-03 13:49:02 +02:00
|
|
|
|
2015-10-14 15:16:03 +02:00
|
|
|
def _set_instance_variable(context , name = :Integer , value = :Integer )
|
|
|
|
set_function = Virtual::MethodSource.create_method(:Object,:Integer,:_set_instance_variable ,[] )
|
2015-06-29 20:03:58 +02:00
|
|
|
return set_function
|
2015-07-21 19:24:31 +02:00
|
|
|
# receiver set_function
|
|
|
|
# me = set_function.receiver
|
|
|
|
# var_name = set_function.args.first
|
|
|
|
# return_to = set_function.return_type
|
|
|
|
# index_function = context.object_space.get_class_by_name(:Object).resolve_method(:index_of)
|
|
|
|
# set_function.push( [me] )
|
|
|
|
# set_function.call( index_function )
|
|
|
|
# after_body = set_function.new_block("after_index")
|
|
|
|
#
|
|
|
|
# set_function.current after_body
|
|
|
|
# set_function.pop([me])
|
|
|
|
# return_to.at_index( set_function , me , return_to )
|
|
|
|
# set_function.set_return return_to
|
|
|
|
# return set_function
|
2015-06-29 20:03:58 +02:00
|
|
|
end
|
2015-05-04 22:03:52 +02:00
|
|
|
|
2015-06-29 20:03:58 +02:00
|
|
|
def _get_singleton_method(context , name )
|
|
|
|
raise name
|
|
|
|
end
|
|
|
|
def _add_singleton_method(context, method)
|
|
|
|
raise "4"
|
|
|
|
end
|
|
|
|
def initialize(context)
|
|
|
|
raise "4"
|
|
|
|
end
|
2014-06-03 13:49:02 +02:00
|
|
|
end
|
2015-06-29 20:03:58 +02:00
|
|
|
extend ClassMethods
|
2014-06-03 13:49:02 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-06-29 20:03:58 +02:00
|
|
|
|
2014-08-28 15:44:27 +02:00
|
|
|
require_relative "integer"
|
2014-09-10 20:35:52 +02:00
|
|
|
require_relative "kernel"
|
2015-07-01 20:45:41 +02:00
|
|
|
require_relative "word"
|