summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-01-22 17:30:39 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2012-01-22 17:30:39 +0100
commit7c66d97b65d886d6375e7a7477d61cdf112872ab (patch)
treeba91f551a362455c2983cbf3ccbd3053e4c34622
parent1cba7dcfe314e500eeb5566a0b87311d20e34748 (diff)
downloadffi-efl-7c66d97b65d886d6375e7a7477d61cdf112872ab.zip
ffi-efl-7c66d97b65d886d6375e7a7477d61cdf112872ab.tar.gz
lib/efl/native: remove require directives, add ffi helpers to Efl::Native module
-rw-r--r--lib/efl/native.rb54
1 files changed, 43 insertions, 11 deletions
diff --git a/lib/efl/native.rb b/lib/efl/native.rb
index 1908595..3b3dcce 100644
--- a/lib/efl/native.rb
+++ b/lib/efl/native.rb
@@ -1,16 +1,48 @@
#! /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
+ #
+ 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