Class: RMasm::Registers

Inherits:
Object show all
Defined in:
lib/rmasm/register.rb

Overview

Register list

Instance Method Summary collapse

Instance Method Details

#add_reg(sym, type, parent = nil) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/rmasm/register.rb', line 46

def add_reg(sym, type, parent=nil)
  # puts "Add register #{sym}"
  # myreg = instance_variable_set((":@"+sym.to_s).to_sym,Register.new(sym,type,parent))
  myreg = Register.new(sym,type,parent)
  instance_variable_set('@' + sym.to_s, myreg)
  list << myreg
  eval "def #{sym}
        @#{sym}
      end"
  Object.class_eval "
      def #{sym}
        $rmasm.registers.#{sym}
      end"
  return myreg
end

#listObject



42
43
44
# File 'lib/rmasm/register.rb', line 42

def list
  @register_list ||= []
end