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
flag
is 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.
238 239 240 241 242 243 244 245 246 247 |
# File 'lib/macho/headers.rb', line 238 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.
220 221 222 |
# File 'lib/macho/headers.rb', line 220 def cpusubtype @cpusubtype end |
#cputype ⇒ Fixnum (readonly)
Returns the CPU type of the Mach-O.
217 218 219 |
# File 'lib/macho/headers.rb', line 217 def cputype @cputype end |
#filetype ⇒ Fixnum (readonly)
Returns the file type of the Mach-O.
223 224 225 |
# File 'lib/macho/headers.rb', line 223 def filetype @filetype end |
#flags ⇒ Fixnum (readonly)
Returns the header flags associated with the Mach-O.
232 233 234 |
# File 'lib/macho/headers.rb', line 232 def flags @flags end |
#magic ⇒ Fixnum (readonly)
Returns the magic number.
214 215 216 |
# File 'lib/macho/headers.rb', line 214 def magic @magic end |
#ncmds ⇒ Fixnum (readonly)
Returns the number of load commands in the Mach-O.
226 227 228 |
# File 'lib/macho/headers.rb', line 226 def ncmds @ncmds end |
#sizeofcmds ⇒ Fixnum (readonly)
Returns the size of all load commands, in bytes, in the Mach-O.
229 230 231 |
# File 'lib/macho/headers.rb', line 229 def sizeofcmds @sizeofcmds end |
Instance Method Details
#flag?(flag) ⇒ Boolean
Returns true if flag
is present in the header's flag section.
253 254 255 256 257 |
# File 'lib/macho/headers.rb', line 253 def flag?(flag) flag = MH_FLAGS[flag] return false if flag.nil? flags & flag == flag end |