Class: Pliney::MachO::FatHeaderReader
- Defined in:
- lib/pliney/macho.rb
Instance Attribute Summary collapse
-
#fat_arches ⇒ Object
readonly
Returns the value of attribute fat_arches.
-
#magic ⇒ Object
readonly
Returns the value of attribute magic.
-
#nfat_arch ⇒ Object
readonly
Returns the value of attribute nfat_arch.
Attributes inherited from Reader
Instance Method Summary collapse
Methods inherited from Reader
Constructor Details
This class inherits a constructor from Pliney::MachO::Reader
Instance Attribute Details
#fat_arches ⇒ Object (readonly)
Returns the value of attribute fat_arches.
159 160 161 |
# File 'lib/pliney/macho.rb', line 159 def fat_arches @fat_arches end |
#magic ⇒ Object (readonly)
Returns the value of attribute magic.
159 160 161 |
# File 'lib/pliney/macho.rb', line 159 def magic @magic end |
#nfat_arch ⇒ Object (readonly)
Returns the value of attribute nfat_arch.
159 160 161 |
# File 'lib/pliney/macho.rb', line 159 def nfat_arch @nfat_arch end |
Instance Method Details
#each_macho ⇒ Object
178 179 180 181 182 183 |
# File 'lib/pliney/macho.rb', line 178 def each_macho() @fat_arches.each do |arch| @fh.pos = @startpos + arch.offset yield arch.macho_reader.parse(@fh) end end |
#machos ⇒ Object
172 173 174 175 176 |
# File 'lib/pliney/macho.rb', line 172 def machos() a = [] each_macho {|mh| a << mh} return a end |
#parse ⇒ Object
161 162 163 164 165 166 167 168 169 170 |
# File 'lib/pliney/macho.rb', line 161 def parse() super() @magic = @fh.read_uint32 @nfat_arch = @fh.read_uint32 @fat_arches = Array.new(@nfat_arch) { FatArchReader.parse(@fh) } unless MachO::is_fat_magic(@magic) raise(ReaderError, "Unexpected magic value for FAT header: 0x%0.8x" % @magic) end end |