rename length to mem_length and suffer the consequences
This commit is contained in:
@ -172,15 +172,13 @@ module Virtual
|
||||
end
|
||||
# position of the function is the position of the entry block, is where we call
|
||||
def set_position at
|
||||
super
|
||||
at += 8 #for the 2 header words
|
||||
@blocks.each do |block|
|
||||
block.set_position at
|
||||
at = at + block.mem_length
|
||||
end
|
||||
end
|
||||
def position
|
||||
@blocks.first.position
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -53,6 +53,11 @@ module Virtual
|
||||
def mem_length
|
||||
padded(1 + string.length)
|
||||
end
|
||||
def position
|
||||
return @position if @position
|
||||
return @string.position if @string.position
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -22,7 +22,7 @@ module Virtual
|
||||
end
|
||||
attr_accessor :length , :layout
|
||||
def position
|
||||
raise "position accessed but not set at #{length} for #{self.objekt}" if @position == nil
|
||||
raise "position accessed but not set at #{length} for #{self.inspect}" if @position == nil
|
||||
@position
|
||||
end
|
||||
def set_position pos
|
||||
@ -75,21 +75,12 @@ module Virtual
|
||||
def padded_words words
|
||||
padded(words*4) # 4 == word length, a constant waiting for a home
|
||||
end
|
||||
|
||||
# pad_after is always in bytes and pads (writes 0's) up to the next 8 word boundary
|
||||
def pad_after length
|
||||
pad = padded(length) - length - 8 # for header, type and layout
|
||||
pad.times do
|
||||
@stream.write_uint8(0)
|
||||
end
|
||||
#puts "padded #{length} with #{pad} stream pos #{@stream.length.to_s(16)}"
|
||||
end
|
||||
end
|
||||
end
|
||||
Parfait::Hash.class_eval do
|
||||
@@HASH = { :names => [:keys,:values] , :types => [Virtual::Reference,Virtual::Reference]}
|
||||
HASH = { :names => [:keys,:values] , :types => [Virtual::Reference,Virtual::Reference]}
|
||||
def layout
|
||||
@@HASH
|
||||
HASH
|
||||
end
|
||||
def set_position pos
|
||||
@position = pos
|
||||
|
Reference in New Issue
Block a user