diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-02-27 15:48:45 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-02-27 15:48:45 +0100 |
commit | ef44077310b4ebf8d3cb31ccb57d15b96a94c9d3 (patch) | |
tree | c2bb690ccc1be37c03f6dcdcf892fbf3e17f5067 /lib/efl/native.rb | |
parent | dbb2c5713e11489dfaeb318a82785017f1794dde (diff) | |
parent | b030c490265bb13ee98a650da419a033495042ed (diff) | |
download | ffi-efl-ef44077310b4ebf8d3cb31ccb57d15b96a94c9d3.zip ffi-efl-ef44077310b4ebf8d3cb31ccb57d15b96a94c9d3.tar.gz |
Merge branch 'wip'
Conflicts:
tools/genruby.rb
Diffstat (limited to 'lib/efl/native.rb')
-rw-r--r-- | lib/efl/native.rb | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/lib/efl/native.rb b/lib/efl/native.rb index 1908595..24b336c 100644 --- a/lib/efl/native.rb +++ b/lib/efl/native.rb @@ -1,16 +1,50 @@ #! /usr/bin/env ruby # -*- coding: UTF-8 -*- # -require 'efl/native/eet' -require 'efl/native/eina' -require 'efl/native/eina_hash' -require 'efl/native/eina_list' -require 'efl/native/evas' -require 'efl/native/ecore' -require 'efl/native/ecore_evas' -require 'efl/native/ecore_getopt' -require 'efl/native/ecore_input' -require 'efl/native/edje' -require 'efl/native/elementary' +require 'ffi' +# +module Efl + # + module Native + # + extend FFI::Library + # + typedef :bool, :eina_bool + # + def self.attach_fcts fcts + fcts.each do |func| + begin + attach_function(*func) + rescue Object => e + puts "Could not attach #{func} #{e.message}" + end + end + end + # + class << self + def find_variable name + ffi_libraries.each do |lib| + address = lib.find_variable name + return address if not address.nil? + end + return nil + end + end + # + class VersionStruct < FFI::Struct + layout :major, :int, + :minor, :int, + :micro, :int, + :revision, :int + + def full + [:major,:minor,:micro,:revision].collect { |e| self[e].to_s }.join '.' + end + end + end + # +end +# +require 'efl/native/eina_types' # # EOF |