module RLTK::CG::Bindings
This module contains FFI bindings to LLVM
.
Constants
- ARCHS
List of architectures supported by
LLVM
.- ASM_PARSERS
List of assembly parsers.
- ASM_PRINTERS
List of assembly printers.
- DISASSEMBLER_OPTION_ASM_PRINTER_VARIANT
- DISASSEMBLER_OPTION_PRINT_IMM_HEX
- DISASSEMBLER_OPTION_PRINT_LATENCY
- DISASSEMBLER_OPTION_SET_INSTR_COMMENTS
- DISASSEMBLER_OPTION_USE_MARKUP
- DISASSEMBLER_REFERENCE_TYPE_IN_BRANCH
- DISASSEMBLER_REFERENCE_TYPE_IN_OUT_NONE
- DISASSEMBLER_REFERENCE_TYPE_IN_P_CREL_LOAD
- DISASSEMBLER_REFERENCE_TYPE_OUT_LIT_POOL_CSTR_ADDR
- DISASSEMBLER_REFERENCE_TYPE_OUT_LIT_POOL_SYM_ADDR
- DISASSEMBLER_REFERENCE_TYPE_OUT_OBJC_CF_STRING_REF
- DISASSEMBLER_REFERENCE_TYPE_OUT_OBJC_CLASS_REF
- DISASSEMBLER_REFERENCE_TYPE_OUT_OBJC_MESSAGE
- DISASSEMBLER_REFERENCE_TYPE_OUT_OBJC_MESSAGE_REF
- DISASSEMBLER_REFERENCE_TYPE_OUT_OBJC_SELECTOR_REF
- DISASSEMBLER_REFERENCE_TYPE_OUT_SYMBOL_STUB
- DISASSEMBLER_VARIANT_KIND_ARM_HI16
- DISASSEMBLER_VARIANT_KIND_ARM_LO16
- DISASSEMBLER_VARIANT_KIND_NONE
Public Class Methods
add_binding(func, args, returns)
click to toggle source
A wrapper class for FFI::Library.attach_function
@param [Symbol] func Function
name. @param [Array<Object>] args Argument
types for FFI::Library.attach_function. @param [Object] returns Return type for FFI::Library.attach_function.
# File lib/rltk/cg/bindings.rb, line 129 def self.add_binding(func, args, returns) attach_function(get_bname(func.to_s[4..-1]), func, args, returns) end
attach_function(name, *_)
click to toggle source
Calls superclass method
# File lib/rltk/cg/generated_bindings.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_bname(name)
click to toggle source
Converts a CamelCase string into an underscored string.
@param [#to_s] name CamelCase string.
@return [Symbol] Underscored string.
# File lib/rltk/cg/bindings.rb, line 117 def self.get_bname(name) name.to_s. gsub(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). downcase.to_sym end