update to use parfait not virtual

more ripples
reverting to integers (not virtual::integer)
This commit is contained in:
Torsten Ruger
2015-05-29 12:33:40 +03:00
parent c28430698c
commit a46b2d5c56
7 changed files with 49 additions and 66 deletions

View File

@@ -8,6 +8,8 @@ module Arm
# - Move
# - Call class Instruction
class Instruction
include Positioned
def initialize options
@attributes = options
end
@@ -15,28 +17,18 @@ module Arm
def opcode
@attributes[:opcode]
end
def position
raise "position accessed but not set at #{length} for #{self.inspect}" if @position == nil
@position
end
def set_position pos
# resetting of position used to be error, but since relink and dynamic instruction size it is ok. in measures
if @position != nil and ((@position - pos).abs > 32)
raise "position set again #{pos}!=#{@position} for #{self}"
end
@position = pos
end
# this is giving read access to the attributes hash via .attibute syntax
# so for an instruction pop you can write pop.opcode to get the :opcode attribute
# TODDO: review (don't remember what the "set_" stuff was for)
def method_missing name , *args , &block
def method_missing name , *args , &block
return super unless (args.length <= 1) or block_given?
set , attribute = name.to_s.split("set_")
if set == ""
@attributes[attribute.to_sym] = args[0] || 1
return self
return self
else
return super
end