rename method

This commit is contained in:
Torsten Ruger
2014-07-16 19:24:41 +03:00
parent 55cb6bd2d6
commit 1ff7ae2b0a
13 changed files with 45 additions and 45 deletions

View File

@@ -5,13 +5,13 @@ require "boot/object"
require "boot/string"
module Boot
# The BootSpace is contains all objects for a program. In functional terms it is a program, but on oo
# The BootSpace contains all objects for a program. In functional terms it is a program, but in oo
# it is a collection of objects, some of which are data, some classes, some functions
# The main entry is a function called (of all things) "main", This _must be supplied by the compling
# There is a start and exit block that call main, which receives an array of strings
# While data "ususally" would live in a .data section, we may also "inline" it into the code
# While data ususally would live in a .data section, we may also "inline" it into the code
# in an oo system all data is represented as objects
class BootSpace
@@ -21,7 +21,7 @@ module Boot
def initialize machine = nil
super()
@classes = {}
@main = Virtual::Method.new("main" , [] )
@main = Virtual::MethodDefinition.new("main" , [] )
#global objects (data)
@objects = []
boot_classes
@@ -43,24 +43,24 @@ module Boot
# boot the classes, ie create a minimal set of classes with a minimal set of functions
# minimal means only that which can not be coded in ruby
# Functions are grabbed from respective modules by sending the sunction name. This should return the
# implementation of the function (ie a function object), not actually try to implement it (as that's impossible in ruby)
# MethodDefinitions are grabbed from respective modules by sending the method name. This should return the
# implementation of the method (ie a method object), not actually try to implement it (as that's impossible in ruby)
def boot_classes
# very fiddly chicken 'n egg problem. Functions need to be in the right order, and in fact we have to define some
# dummies, just for the other to compile
obj = get_or_create_class :Object
[:index_of , :_get_instance_variable , :_set_instance_variable].each do |f|
#puts "Boot Object::#{f}"
obj.add_method Boot::Object.send(f , @context)
obj.add_method_definition Boot::Object.send(f , @context)
end
[:putstring,:putint,:fibo,:exit].each do |f|
#puts "Boot Kernel::#{f}"
obj.add_method Crystal::Kernel.send(f , @context)
obj.add_method_definition Crystal::Kernel.send(f , @context)
end
obj = get_or_create_class :String
[:get , :set].each do |f|
#puts "Boot String::#{f}"
obj.add_method Boot::String.send(f , @context)
obj.add_method_definition Boot::String.send(f , @context)
end
end