fixed simple layout offset bug in layout

This commit is contained in:
Torsten Ruger
2015-10-13 14:46:07 +03:00
parent aa20f2ca77
commit 80d58ee03c
9 changed files with 132 additions and 17 deletions

View File

@ -34,7 +34,12 @@ module Parfait
def sof_reference_name
name
end
def inspect
"Class(#{name})"
end
# ruby 2.1 list (just for reference, keep at bottom)
#:allocate, :new, :superclass
end
end

View File

@ -3,7 +3,7 @@
module Parfait
class Dictionary < Object
attribute :keys
attribute :values
attribute :values
# only empty initialization for now
#
# internally we store keys and values in lists, which means this does **not** scale well

View File

@ -40,6 +40,7 @@ module Parfait
# 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_variable name
self.push(1) if self.get_length == 0
self.push(name)
self.get_length
end
@ -51,7 +52,7 @@ module Parfait
def object_instance_names
names = List.new
index = 2 # first is object_class
index = 3
while index <= self.get_length
item = get(index)
names.push item
@ -74,6 +75,19 @@ module Parfait
list_index(name)
end
def inspect
ret = "Layout["
index = 3
while index <= self.get_length
item = get(index)
ret += item.inspect
ret += "," unless index == self.get_length
index = index + 1
end
ret += "]"
ret
end
def sof_reference_name
"#{self.object_class.name}_Layout"
end

View File

@ -69,6 +69,11 @@ module Parfait
get(1)
end
def last
return nil if empty?
get(get_length())
end
# set the value at index.
# Lists start from index 1
def set( index , value)