diff --git a/lib/parfait/binary_code.rb b/lib/parfait/binary_code.rb index 3daa3766..b6089805 100644 --- a/lib/parfait/binary_code.rb +++ b/lib/parfait/binary_code.rb @@ -7,7 +7,7 @@ module Parfait # and as the last code of each link is a jump to the next link. # class BinaryCode < Data32 - attr_reader :type, :next_code + attr_reader :next_code def self.type_length 2 #type + next (could get from space, maybe later) diff --git a/lib/parfait/cache_entry.rb b/lib/parfait/cache_entry.rb index 5e9dee95..2333cd40 100644 --- a/lib/parfait/cache_entry.rb +++ b/lib/parfait/cache_entry.rb @@ -8,9 +8,10 @@ module Parfait class CacheEntry < Object - attr_reader :type, :cached_type, :cached_method + attr_reader :cached_type, :cached_method def initialize(type , method) + super() @cached_type = type @cached_method = method end diff --git a/lib/parfait/callable.rb b/lib/parfait/callable.rb index 30ca51c5..21f9fbe1 100644 --- a/lib/parfait/callable.rb +++ b/lib/parfait/callable.rb @@ -12,13 +12,16 @@ module Parfait # class Callable < Object - attr_reader :type, :self_type , :arguments_type , :frame_type , :binary + attr_reader :self_type , :arguments_type , :frame_type , :binary attr_reader :blocks , :name attr_reader :next_callable def self.type_length 8 end + def self.memory_size + 8 + end def initialize( name , self_type , arguments_type , frame_type) super() diff --git a/lib/parfait/class.rb b/lib/parfait/class.rb index d4bf6e1d..ab82817d 100644 --- a/lib/parfait/class.rb +++ b/lib/parfait/class.rb @@ -18,12 +18,15 @@ module Parfait class Class < Object include Behaviour - attr_reader :type, :instance_type , :name , :instance_methods + attr_reader :instance_type , :name , :instance_methods attr_reader :super_class_name , :meta_class def self.type_length 6 end + def self.memory_size + 8 + end def initialize( name , superclass , instance_type) super() diff --git a/lib/parfait/dictionary.rb b/lib/parfait/dictionary.rb index 79d65b28..e3a96cdb 100644 --- a/lib/parfait/dictionary.rb +++ b/lib/parfait/dictionary.rb @@ -3,11 +3,14 @@ module Parfait class Dictionary < Object - attr_reader :type, :i_keys , :i_values + attr_reader :i_keys , :i_values def self.type_length 3 end + def self.memory_size + 8 + end # only empty initialization for now # diff --git a/lib/parfait/factory.rb b/lib/parfait/factory.rb index 08ccd6d5..e8fc9155 100644 --- a/lib/parfait/factory.rb +++ b/lib/parfait/factory.rb @@ -14,7 +14,13 @@ module Parfait class Factory < Object - attr_reader :type , :for_type , :next_object , :reserve , :attribute_name , :page_size + attr_reader :for_type , :next_object , :reserve , :attribute_name , :page_size + def self.type_length + 6 + end + def self.memory_size + 8 + end # initialize for a given type (for_type). The attribute that is used to create the # list is the first that starts with next_ . "next" itself would have been nice and general diff --git a/lib/parfait/integer.rb b/lib/parfait/integer.rb index 3484f043..b4b5d2f4 100644 --- a/lib/parfait/integer.rb +++ b/lib/parfait/integer.rb @@ -6,17 +6,7 @@ module Parfait class Integer < Data4 - attr_reader :type, :next_integer - - def initialize(value , next_i = nil) - super() - @next_integer = next_i - set_internal_word(Integer.integer_index, value) - end - - def value - get_internal_word(Integer.integer_index) - end + attr_reader :next_integer def self.type_length 2 # 0 type, 1 next_i @@ -30,6 +20,16 @@ module Parfait type_length end + def initialize(value , next_i = nil) + super() + @next_integer = next_i + set_internal_word(Integer.integer_index, value) + end + + def value + get_internal_word(Integer.integer_index) + end + def to_s "Integer " + value.to_s end diff --git a/lib/parfait/list.rb b/lib/parfait/list.rb index 28e03d88..faf57697 100644 --- a/lib/parfait/list.rb +++ b/lib/parfait/list.rb @@ -7,7 +7,7 @@ module Parfait class List < Data16 - attr_reader :type, :indexed_length , :next_list + attr_reader :indexed_length , :next_list def self.type_length 3 # 0 type , 1 length , 2 - next_list diff --git a/lib/parfait/message.rb b/lib/parfait/message.rb index 9620c6db..b7c9def8 100644 --- a/lib/parfait/message.rb +++ b/lib/parfait/message.rb @@ -11,22 +11,15 @@ module Parfait class Message < Object - # :next_message => :Message, :receiver => :Object, :frame => :NamedList , - # :return_address => :Integer, :return_value => :Integer, - # :caller => :Message , :name => :Word , :arguments => :NamedList - - attr_reader :type, :next_message - attr_reader :receiver + attr_reader :next_message, :receiver attr_reader :return_address, :return_value attr_reader :caller , :method - attr_reader :arguments_given - attr_reader :arg1 , :arg2, :arg3, :arg4, :arg5, :arg6 - attr_reader :locals_used - attr_reader :local1 , :local2, :local3, :local4, :local5, :local6 ,:local7,:local8 - attr_reader :local9 ,:local10, :local11 , :local12, :local13, :local14 + attr_reader :arguments_given, :arg1 , :arg2, :arg3, :arg4, :arg5, :arg6 + attr_reader :locals_used, :local1 , :local2, :local3, :local4, :local5, :local6 ,:local7 + attr_reader :local8 , :local9 ,:local10, :local11 , :local12, :local13, :local14 def self.type_length - 31 + 30 end def self.memory_size 32 diff --git a/lib/parfait/meta_class.rb b/lib/parfait/meta_class.rb index 34eb0f7c..a385358a 100644 --- a/lib/parfait/meta_class.rb +++ b/lib/parfait/meta_class.rb @@ -20,11 +20,14 @@ module Parfait class MetaClass < Object include Behaviour - attr_reader :type, :instance_type , :instance_methods , :clazz + attr_reader :instance_type , :instance_methods , :clazz def self.type_length 4 end + def self.memory_size + 8 + end def initialize( clazz ) super() diff --git a/lib/parfait/named_list.rb b/lib/parfait/named_list.rb index 5745d236..8bd4644d 100644 --- a/lib/parfait/named_list.rb +++ b/lib/parfait/named_list.rb @@ -23,8 +23,6 @@ module Parfait class NamedList < Object - attr_reader :type - def self.memory_size 16 end diff --git a/lib/parfait/object.rb b/lib/parfait/object.rb index 02721ef0..40d510c7 100644 --- a/lib/parfait/object.rb +++ b/lib/parfait/object.rb @@ -15,6 +15,14 @@ module Parfait class Object attr_reader :type + def self.type_length + 1 + end + def self.memory_size + 4 + end + + def type=(t) set_type( t ) end diff --git a/lib/parfait/space.rb b/lib/parfait/space.rb index 248ba9a8..243cc83b 100644 --- a/lib/parfait/space.rb +++ b/lib/parfait/space.rb @@ -30,8 +30,14 @@ module Parfait class Space < Object - attr_reader :type, :classes , :types , :factories + attr_reader :classes , :types , :factories attr_reader :true_object , :false_object , :nil_object + def self.type_length + 7 + end + def self.memory_size + 8 + end def initialize( classes , pages) @classes = classes @@ -54,13 +60,6 @@ module Parfait @nil_object = Parfait::NilClass.new end - def self.type_length - 12 - end - def self.memory_size - 16 - end - def init_message_chain( message ) prev = nil while(message) diff --git a/lib/parfait/type.rb b/lib/parfait/type.rb index 82290734..e4c5c073 100644 --- a/lib/parfait/type.rb +++ b/lib/parfait/type.rb @@ -36,7 +36,7 @@ module Parfait class Type < Object - attr_reader :type, :object_class , :names , :types , :methods + attr_reader :object_class , :names , :types , :methods def self.type_length 5 diff --git a/lib/parfait/vool_method.rb b/lib/parfait/vool_method.rb index a24aac96..fb6d851d 100644 --- a/lib/parfait/vool_method.rb +++ b/lib/parfait/vool_method.rb @@ -12,7 +12,7 @@ module Parfait # class VoolMethod < Object - attr_reader :type, :name , :args_type , :frame_type + attr_reader :name , :args_type , :frame_type attr_reader :source def initialize(name , args_type , frame_type , source ) diff --git a/lib/parfait/word.rb b/lib/parfait/word.rb index 75013009..d0c5e670 100644 --- a/lib/parfait/word.rb +++ b/lib/parfait/word.rb @@ -13,7 +13,7 @@ module Parfait # Object length is measured in non-type cells though class Word < Data8 - attr_reader :type, :char_length + attr_reader :char_length def self.type_length 2 # 0 type , 1 char_length