summaryrefslogtreecommitdiffstats
path: root/lib/e17
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-04-14 06:24:37 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-04-14 06:24:37 +0200
commitb960e00f5d165c659c7dc827b65ff8b563e84f10 (patch)
treed1d4131e635a1b2f5389586c0ac34701bcecc651 /lib/e17
parent38a8992822c638ded9db7e3b1ae5aa28dee38fab (diff)
downloadffi-efl-b960e00f5d165c659c7dc827b65ff8b563e84f10.zip
ffi-efl-b960e00f5d165c659c7dc827b65ff8b563e84f10.tar.gz
update evas, use ffi_helper and FFI::Enum
Diffstat (limited to 'lib/e17')
-rw-r--r--lib/e17/evas.rb37
1 files changed, 13 insertions, 24 deletions
diff --git a/lib/e17/evas.rb b/lib/e17/evas.rb
index 7a8d488..07c5924 100644
--- a/lib/e17/evas.rb
+++ b/lib/e17/evas.rb
@@ -1,44 +1,33 @@
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
-require 'ffi'
+require 'e17/ffi_helper'
#
module E17
module EVAS
#
+ extend FFIHelper
extend FFI::Library
#
+ ffi_lib 'evas'
+ #
+ enum :evas_alloc_error, [:none,0,:fatal,:recovered]
+ #
callback :evas_async_events_put_cb, [:pointer, :int, :pointer], :void
#
- ffi_lib 'evas'
- [
+ @fcts = [
# http://docs.enlightenment.org/auto/evas/group__Evas__Group.html
[ :evas_init, [], :int],
[ :evas_shutdown, [], :int],
- [ :evas_alloc_error, [], :int],
+ [ :evas_alloc_error, [], :evas_alloc_error],
[ :evas_async_events_fd_get, [], :int],
[ :evas_async_events_process, [], :int],
[ :evas_async_events_put, [:pointer, :int, :pointer, :evas_async_events_put_cb], :bool],
- ].each do |func|
- begin
- attach_function *func
- rescue Object => e
- puts "Could not attach #{func} #{e.message}"
- end
- end
- #
- ALLOC_ERROR_NONE = 0
- ALLOC_ERROR_FATAL = 1
- ALLOC_ERROR_RECOVERED = 2
- #
- class << self
- alias init evas_init
- alias shutdown evas_shutdown
- alias alloc_error evas_alloc_error
- alias async_events_fd_get evas_async_events_fd_get
- alias async_events_process evas_async_events_process
- alias async_events_put evas_async_events_put
- end
+ ]
+ #
+ attach_fcts
+ #
+ create_aliases 'evas_'.length
#
end
end