diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/e17/ecore/event.rb | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/lib/e17/ecore/event.rb b/lib/e17/ecore/event.rb index e536875..9465d16 100644 --- a/lib/e17/ecore/event.rb +++ b/lib/e17/ecore/event.rb @@ -1,13 +1,17 @@ #! /usr/bin/env ruby # -*- coding: UTF-8 -*- # -require 'ffi' +require 'e17/ffi_helper' # module E17 module ECORE # + extend FFIHelper extend FFI::Library # + ffi_lib 'ecore' + # +# enum :ecore_signals, [:none,0,:signal_user,:signal_hup,:signal_exit,:signal_power,:signal_realtime] EVENT_NONE = 0 EVENT_SIGNAL_USER = 1 # User signal event EVENT_SIGNAL_HUP = 2 # Hup signal event @@ -15,43 +19,30 @@ module E17 EVENT_SIGNAL_POWER = 4 # Power signal event EVENT_SIGNAL_REALTIME = 5 # Realtime signal event EVENT_COUNT = 6 - callback :ecore_event_handler_cb, [:pointer, :int, :pointer], :bool + # callback :ecore_end_cb, [:pointer, :pointer], :void callback :ecore_data_cb, [:pointer], :pointer callback :ecore_filter_cb, [:pointer, :pointer, :int, :pointer], :bool + callback :ecore_event_handler_cb, [:pointer, :int, :pointer], :bool # - ffi_lib 'ecore' - functions = [ - [ :ecore_event_handler_add, [:int, :ecore_event_handler_cb, :pointer], :pointer ], - [ :ecore_event_handler_del, [:pointer], :void ], - [ :ecore_event_add, [:int, :pointer, :ecore_end_cb, :pointer], :pointer ], - [ :ecore_event_del, [:pointer], :void ], - [ :ecore_event_handler_data_get, [:pointer], :pointer ], - [ :ecore_event_handler_data_set, [:pointer,:pointer], :void ], - [ :ecore_event_type_new, [], :int ], - [ :ecore_event_filter_add, [:ecore_data_cb, :ecore_filter_cb, :ecore_end_cb, :pointer], :pointer ], - [ :ecore_event_filter_del, [:pointer], :void ], - [ :ecore_event_current_type_get, [], :int ], + fcts = [ + # http://docs.enlightenment.org/auto/ecore/group__Ecore__Event__Group.html + [ :ecore_event_handler_add, [:int, :ecore_event_handler_cb, :pointer], :pointer], + [ :ecore_event_handler_del, [:pointer], :pointer], + [ :ecore_event_add, [:int, :pointer, :ecore_end_cb, :pointer], :pointer], + [ :ecore_event_del, [:pointer], :pointer], + [ :ecore_event_handler_data_get, [:pointer], :pointer], + [ :ecore_event_handler_data_set, [:pointer,:pointer], :pointer], + [ :ecore_event_type_new, [], :int], + [ :ecore_event_filter_add, [:ecore_data_cb, :ecore_filter_cb, :ecore_end_cb, :pointer], :pointer], + [ :ecore_event_filter_del, [:pointer], :pointer], + [ :ecore_event_current_type_get, [], :int], [ :ecore_event_current_event_get, [], :pointer], - ].each do |func| - begin - attach_function *func - rescue Object => e - puts "Could not attach #{func} #{e.message}" - end - end - # - class << self - alias event_handler_add ecore_event_handler_add - alias event_handler_del ecore_event_handler_del - alias event_add ecore_event_add - alias event_del ecore_event_del - alias event_handler_data_get ecore_event_handler_data_get - alias event_handler_data_set ecore_event_handler_data_set - alias event_type_new ecore_event_type_new - alias event_current_type_get ecore_event_current_type_get - alias event_current_event_get ecore_event_current_event_get - end + ] + # + attach_fcts fcts + # + create_aliases 'ecore_'.length, fcts # end end |