externalize boot process
Booting is complicated, make an own file for it
This commit is contained in:
@ -17,8 +17,13 @@ module Parfait
|
||||
|
||||
def initialize name , super_class = nil
|
||||
super( name , super_class)
|
||||
# class methods
|
||||
@object_layout = Layout.new_object
|
||||
# the layout for this class (class = object of type Class) carries the class
|
||||
# as an instance. The relation is from an object through the Layout to it's class
|
||||
@object_layout = Layout.new_object(self)
|
||||
end
|
||||
|
||||
def allocate_object
|
||||
#space, and ruby allocate
|
||||
end
|
||||
|
||||
def add_instance_name name
|
||||
|
@ -23,19 +23,24 @@
|
||||
module Parfait
|
||||
class Layout < List
|
||||
|
||||
# set the names of the instance variables in one go
|
||||
# used while booting the classes. At runtime the list would grow dynamically
|
||||
def set_names list
|
||||
self.set_length list.get_length
|
||||
index = 0
|
||||
while index < list.get_length do
|
||||
list.set(index , array.get(index))
|
||||
end
|
||||
def initialize( object_class )
|
||||
@object_class = object_class
|
||||
end
|
||||
|
||||
# add the name of an instance variable
|
||||
# The index will be returned and can subsequently be searched with index_of
|
||||
# The index of the name is the index of the data in the object
|
||||
#
|
||||
# TODO , later we would need to COPY the layout to keep the old constant
|
||||
# but now we are concerned with booting, ie getting a working structure
|
||||
def add_instance_name name
|
||||
self.push(name)
|
||||
self.get_length
|
||||
end
|
||||
|
||||
# beat the recursion! fixed known offset for class object in the layout
|
||||
def get_object_class()
|
||||
return internal_object_get(CLASS_INDEX)
|
||||
return @object_class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -32,6 +32,7 @@ module Parfait
|
||||
@messages = 100.times.collect{ ::Parfait::Message.new }
|
||||
@next_message = @messages.first
|
||||
@next_frame = @frames.first
|
||||
Parfait::Space.set_object_space self
|
||||
end
|
||||
attr_reader :classes , :objects , :symbols,:messages, :next_message , :next_frame
|
||||
|
||||
@ -41,6 +42,16 @@ module Parfait
|
||||
@@SPACE
|
||||
end
|
||||
|
||||
@@object_space = nil
|
||||
# Make the object space globally available
|
||||
def self.object_space
|
||||
@@object_space
|
||||
end
|
||||
# TODO Must get rid of the setter
|
||||
def self.set_object_space space
|
||||
@@space = space
|
||||
end
|
||||
|
||||
# Objects are data and get assembled after functions
|
||||
def add_object o
|
||||
return if @objects.include?(o)
|
||||
|
Reference in New Issue
Block a user