module SWIPL::CFFI
Public Class Methods
PL_retry( ptr )
click to toggle source
# File lib/swipl/cffi.rb, line 47 def self.PL_retry( ptr ); _PL_retry( ptr ).address; end
PL_retry_address( what )
click to toggle source
# File lib/swipl/cffi.rb, line 46 def self.PL_retry_address( what ); _PL_retry_address( what ).address; end
PL_succeed()
click to toggle source
# File lib/swipl/cffi.rb, line 45 def self.PL_succeed; PL_TRUE; end
bootstrap()
click to toggle source
# File lib/swipl/cffi.rb, line 54 def self.bootstrap lib_path = ENV["SWI_LIB"] raise "SWI_LIB not set and loader for your platform." unless lib_path @swipl_lib = lib_path self.load( lib_path ) end
import_symbols()
click to toggle source
# File lib/swipl/cffi.rb, line 10 def self.import_symbols attach_function :PL_open_foreign_frame, [], :ulong attach_function :PL_discard_foreign_frame, [:ulong], :int # Warning: the following method repeatedly failed attach_function :PL_atom_chars, [:ulong], :pointer attach_function :PL_call, [:ulong, :pointer], :int attach_function :PL_chars_to_term, [:pointer, :ulong], :int attach_function :PL_close_query, [:ulong], :void attach_function :PL_foreign_control, [:control_t], :int attach_function :PL_foreign_context_address, [:control_t], :pointer attach_function :long_PL_foreign_context_address, :PL_foreign_context_address, [:control_t], :ulong attach_function :PL_get_atom_chars, [:ulong, :pointer], :int attach_function :PL_initialise, [:int, :pointer], :int attach_function :PL_is_atom, [:term_t], :int attach_function :PL_is_ground, [:term_t], :int attach_function :PL_new_atom, [:pointer], :ulong attach_function :PL_new_term_ref, [], :term_t attach_function :PL_new_term_refs, [:int], :term_t attach_function :PL_next_solution, [:ulong], :int attach_function :PL_open_query, [:pointer, :int, :ulong, :term_t], :ulong attach_function :PL_put_atom_chars, [ :term_t, :string], :int attach_function :PL_put_string_chars, [ :term_t, :string], :void attach_function :PL_predicate, [:pointer, :int, :pointer], :ulong attach_function :PL_register_foreign, [:pointer, :int, :pointer, :int], :foreign_t attach_function :_PL_retry_address, [ :pointer ], :foreign_t attach_function :_PL_retry, [ :pointer ], :foreign_t attach_function :PL_term_type, [:term_t], :int attach_function :PL_thread_self, [], :int attach_function :PL_unify, [ :term_t, :term_t ], :int attach_function :PL_unify_string_chars, [ :ulong, :string], :void attach_function :PL_unify_atom_chars, [ :term_t, :string], :void end
init()
click to toggle source
# File lib/swipl/cffi.rb, line 62 def self.init return if @is_initialized self.bootstrap unless @ffi_libs libptr = ::FFI::MemoryPointer.from_string( @swipl_lib ) plargv = ::FFI::MemoryPointer.new( :pointer, 1 ) plargv.write_pointer( libptr ) value = PL_initialise( 1, plargv ) if value != 1 raise "SWI failed to initialize" end @is_initialized = true end
load( libraries )
click to toggle source
# File lib/swipl/cffi.rb, line 49 def self.load( libraries ) ffi_lib libraries self.import_symbols end
predicate_proc( &handler )
click to toggle source
# File lib/swipl/cffi.rb, line 78 def self.predicate_proc( &handler ) FFI::Function.new( :size_t, [:ulong, :int, :pointer], handler ) end