Class: MachO::MachHeader
- Inherits:
-
MachOStructure
- Object
- MachOStructure
- MachO::MachHeader
- Defined in:
- lib/macho/headers.rb
Overview
32-bit Mach-O file header structure
Direct Known Subclasses
Constant Summary collapse
- FORMAT =
"VVVVVVV"- SIZEOF =
28
Instance Attribute Summary collapse
-
#cpusubtype ⇒ Fixnum
readonly
The CPU subtype of the Mach-O.
-
#cputype ⇒ Fixnum
readonly
The CPU type of the Mach-O.
-
#filetype ⇒ Fixnum
readonly
The file type of the Mach-O.
-
#flags ⇒ Fixnum
readonly
The header flags associated with the Mach-O.
-
#magic ⇒ Fixnum
readonly
The magic number.
-
#ncmds ⇒ Fixnum
readonly
The number of load commands in the Mach-O.
-
#sizeofcmds ⇒ Fixnum
readonly
The size of all load commands, in bytes, in the Mach-O.
Instance Method Summary collapse
-
#flag?(flag) ⇒ Boolean
True if
flagis present in the header's flag section. -
#initialize(magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags) ⇒ MachHeader
constructor
private
A new instance of MachHeader.
Methods inherited from MachOStructure
Constructor Details
#initialize(magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags) ⇒ MachHeader
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MachHeader.
314 315 316 317 318 319 320 321 322 323 |
# File 'lib/macho/headers.rb', line 314 def initialize(magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags) @magic = magic @cputype = cputype @cpusubtype = cpusubtype @filetype = filetype @ncmds = ncmds @sizeofcmds = sizeofcmds @flags = flags end |
Instance Attribute Details
#cpusubtype ⇒ Fixnum (readonly)
Returns the CPU subtype of the Mach-O.
296 297 298 |
# File 'lib/macho/headers.rb', line 296 def cpusubtype @cpusubtype end |
#cputype ⇒ Fixnum (readonly)
Returns the CPU type of the Mach-O.
293 294 295 |
# File 'lib/macho/headers.rb', line 293 def cputype @cputype end |
#filetype ⇒ Fixnum (readonly)
Returns the file type of the Mach-O.
299 300 301 |
# File 'lib/macho/headers.rb', line 299 def filetype @filetype end |
#flags ⇒ Fixnum (readonly)
Returns the header flags associated with the Mach-O.
308 309 310 |
# File 'lib/macho/headers.rb', line 308 def flags @flags end |
#magic ⇒ Fixnum (readonly)
Returns the magic number.
290 291 292 |
# File 'lib/macho/headers.rb', line 290 def magic @magic end |
#ncmds ⇒ Fixnum (readonly)
Returns the number of load commands in the Mach-O.
302 303 304 |
# File 'lib/macho/headers.rb', line 302 def ncmds @ncmds end |
#sizeofcmds ⇒ Fixnum (readonly)
Returns the size of all load commands, in bytes, in the Mach-O.
305 306 307 |
# File 'lib/macho/headers.rb', line 305 def sizeofcmds @sizeofcmds end |
Instance Method Details
#flag?(flag) ⇒ Boolean
Returns true if flag is present in the header's flag section.
329 330 331 |
# File 'lib/macho/headers.rb', line 329 def flag?(flag) flags & flag == flag end |