class TurboRex::CStruct::NativeParser
Attributes
cpu[R]
parser[R]
Public Class Methods
new(str, opts={})
click to toggle source
# File lib/turborex/cstruct.rb, line 481 def initialize(str, opts={}) @cpu = opts[:cpu].new rescue nil || Metasm::Ia32.new @parser = @cpu.new_cparser if opts[:predefined] # TODO: more Predefined macros if opts[:cpu] == Metasm::Ia32 @parser.lexer.define("_WIN32") elsif opts[:cpu] == Metasm::X86_64 @parser.lexer.define("_WIN64") @parser.llp64 end end @parser.send(opts[:data_model].to_s) if opts[:data_model] if opts[:visual_studio] @parser.prepare_visualstudio end if opts[:gcc] @parser.prepare_gcc end @include_path = opts[:include_path] || [] perform_include_path @parser.lexer.warn_redefinition = false @parser.lexer.include_search_path = @include_path if opts[:file] @parser.parse_file opts[:file] elsif str @parser.parse str end end
Public Instance Methods
[](name)
click to toggle source
# File lib/turborex/cstruct.rb, line 523 def [](name) NativeStructProxy.new(@parser, name) end
find_c_struct(name)
click to toggle source
# File lib/turborex/cstruct.rb, line 515 def find_c_struct(name) @parser.find_c_struct(name) end
find_c_type(name)
click to toggle source
# File lib/turborex/cstruct.rb, line 519 def find_c_type(name) @parser.find_c_type(name) end
method_missing(m, *args, &block)
click to toggle source
# File lib/turborex/cstruct.rb, line 527 def method_missing(m, *args, &block) @parser.send(m, *args, &block) end
Private Instance Methods
perform_include_path()
click to toggle source
# File lib/turborex/cstruct.rb, line 533 def perform_include_path @include_path += TurboRex::Windows.tinysdk.include_path @include_path.uniq! end