Class: RMasm::StructManager

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

Overview

StructManager keep a reference of all declared struct and union

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStructManager

Returns a new instance of StructManager.



107
108
109
# File 'lib/rmasm/struct.rb', line 107

def initialize()
  @map_owner_to_structures = {}
end

Instance Attribute Details

#map_owner_to_structuresObject (readonly)

Returns the value of attribute map_owner_to_structures.



105
106
107
# File 'lib/rmasm/struct.rb', line 105

def map_owner_to_structures
  @map_owner_to_structures
end

Class Method Details

.instanceObject



130
131
132
# File 'lib/rmasm/struct.rb', line 130

def self.instance
  @@global_struct_manager ||= StructManager.new
end

Instance Method Details

#find(from, sym) ⇒ Object



120
121
122
123
124
125
126
127
128
# File 'lib/rmasm/struct.rb', line 120

def find(from, sym)
  # First try from self
  map_owner = @map_owner_to_structures[from]
  result = nil
  if ( ! map_owner.nil? )
    result = map_owner[sym]
  end
  result
end

#get_owner_holder(owner) ⇒ Object



111
112
113
114
115
116
117
118
# File 'lib/rmasm/struct.rb', line 111

def get_owner_holder(owner)
  result = @map_owner_to_structures[owner]
  if result.nil?
    result = {}
    @map_owner_to_structures[owner] = result
  end
  result
end