module FFIGen::Clang
Constants
- CINDEX_VERSION_MAJOR
- CINDEX_VERSION_MINOR
Public Class Methods
attach_function(name, *_)
click to toggle source
Calls superclass method
# File lib/ffi_gen/clang.rb, line 9 def self.attach_function(name, *_) begin; super; rescue FFI::NotFoundError => e (class << self; self; end).class_eval { define_method(name) { |*_| raise e } } end end
get_children(cursor)
click to toggle source
# File lib/ffi_gen.rb, line 7 def get_children(cursor) children = [] visit_children cursor, lambda { |visit_result, child, child_parent, child_client_data| children << child :continue }, nil children end
get_spelling_location_data(location)
click to toggle source
# File lib/ffi_gen.rb, line 16 def get_spelling_location_data(location) file_ptr = FFI::MemoryPointer.new :pointer line_ptr = FFI::MemoryPointer.new :uint column_ptr = FFI::MemoryPointer.new :uint offset_ptr = FFI::MemoryPointer.new :uint get_spelling_location location, file_ptr, line_ptr, column_ptr, offset_ptr { file: file_ptr.read_pointer, line: line_ptr.read_uint, column: column_ptr.read_uint, offset: offset_ptr.read_uint } end
get_tokens(translation_unit, range)
click to toggle source
# File lib/ffi_gen.rb, line 25 def get_tokens(translation_unit, range) tokens_ptr_ptr = FFI::MemoryPointer.new :pointer num_tokens_ptr = FFI::MemoryPointer.new :uint Clang.tokenize translation_unit, range, tokens_ptr_ptr, num_tokens_ptr num_tokens = num_tokens_ptr.read_uint tokens_ptr = FFI::Pointer.new Clang::Token, tokens_ptr_ptr.read_pointer (num_tokens - 1).times.map { |i| Clang::Token.new tokens_ptr[i] } end
Public Instance Methods
cindex_version_stringize(major, minor)
click to toggle source
# File lib/ffi_gen/clang.rb, line 19 def cindex_version_stringize(major, minor) cindex_version_stringize(major, minor) end