From 3a2eecb5bcf35120fcf3a9dcf1637459c99a6abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 12 Apr 2011 21:23:29 +0200 Subject: rename to ffi-e17 --- README.rdoc | 15 +++--- Rakefile | 7 +-- lib/e17.rb | 14 +++++ lib/e17/ecore.rb | 58 +++++++++++++++++++++ lib/e17/ecore/event.rb | 59 +++++++++++++++++++++ lib/e17/edje.rb | 31 +++++++++++ lib/e17/eet.rb | 131 +++++++++++++++++++++++++++++++++++++++++++++++ lib/e17/eina.rb | 31 +++++++++++ lib/e17/evas.rb | 46 +++++++++++++++++ lib/efl.rb | 13 ----- lib/efl/ecore.rb | 58 --------------------- lib/efl/ecore/event.rb | 59 --------------------- lib/efl/edje.rb | 31 ----------- lib/efl/eet.rb | 131 ----------------------------------------------- lib/efl/eina.rb | 31 ----------- lib/efl/evas.rb | 46 ----------------- spec/ecore_event_spec.rb | 8 +-- spec/ecore_spec.rb | 6 +-- spec/edje_spec.rb | 6 +-- spec/eet_spec.rb | 6 +-- spec/eina_spec.rb | 6 +-- spec/evas_spec.rb | 6 +-- 22 files changed, 401 insertions(+), 398 deletions(-) create mode 100644 lib/e17.rb create mode 100644 lib/e17/ecore.rb create mode 100644 lib/e17/ecore/event.rb create mode 100644 lib/e17/edje.rb create mode 100644 lib/e17/eet.rb create mode 100644 lib/e17/eina.rb create mode 100644 lib/e17/evas.rb delete mode 100644 lib/efl.rb delete mode 100644 lib/efl/ecore.rb delete mode 100644 lib/efl/ecore/event.rb delete mode 100644 lib/efl/edje.rb delete mode 100644 lib/efl/eet.rb delete mode 100644 lib/efl/eina.rb delete mode 100644 lib/efl/evas.rb diff --git a/README.rdoc b/README.rdoc index 29ecf46..05bd9f1 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,10 +1,11 @@ -ruby-efl +ffi-e17 by Jérémy Zurcher http://cgit.asynk.ch == DESCRIPTION: -ruby-efl is a FFI[https://github.com/ffi/ffi/wiki] binding to Enlightenment Foundation Libraries (EFL[http://www.enlightenment.org/p.php?p=docs&l=en]) +ffi-e17 is a FFI[https://github.com/ffi/ffi/wiki] binding to Enlightenment Foundation Libraries (eina,eet,evas,ecore,edje) +and Elementary, part of the Enlightenment project. (E17 API[http://www.enlightenment.org/p.php?p=docs&l=en]) == FEATURES/PROBLEMS: @@ -12,8 +13,8 @@ ruby-efl is a FFI[https://github.com/ffi/ffi/wiki] binding to Enlightenment Foun == SYNOPSIS: - require './lib/efl' - include EFL + require './lib/e17' + include E17 EET.init EET.open('/tmp/_eet.cfg', EET::FILE_MODE_WRITE) do |f| f.write 'config2', 'test--key' @@ -36,12 +37,12 @@ For less minimalistic and more sane examples you may look at: From rubyforge: - [sudo] gem install ruby-efl + [sudo] gem install ffi-e17 or from the git repository on github: - git clone git://github.com/jeremyz/ruby-efl.git - cd ruby-efl + git clone git://github.com/jeremyz/ffi-e17.git + cd ffi-e17 rake gem:install == CREDITS: diff --git a/Rakefile b/Rakefile index 0980801..4abf5e6 100644 --- a/Rakefile +++ b/Rakefile @@ -3,12 +3,13 @@ load './tasks/setup.rb' # # Project general information -PROJ.name = 'ruby-efl' +PROJ.name = 'ffi-e17' PROJ.authors = 'Jérémy Zurcher' PROJ.email = 'jeremy@asynk.ch' -PROJ.url = 'http://cgit.asynk.ch' +#PROJ.url = 'http://cgit.asynk.ch/cgi-bin/cgit/ffi-e17' +PROJ.url = 'https://github.com/jeremyz/ffi-e17' PROJ.version = '0.0.0' -PROJ.rubyforge.name = 'ruby-efl' +PROJ.rubyforge.name = 'ffi-e17' PROJ.readme_file = 'README.rdoc' # # Annoucement diff --git a/lib/e17.rb b/lib/e17.rb new file mode 100644 index 0000000..a1e19cc --- /dev/null +++ b/lib/e17.rb @@ -0,0 +1,14 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +# +module E17 + autoload :EINA, './lib/e17/eina.rb' + autoload :EET, './lib/e17/eet.rb' + autoload :EVAS, './lib/e17/evas.rb' + autoload :ECORE, './lib/e17/ecore.rb' + autoload :EDJE, './lib/e17/edje.rb' + autoload :ELM, './lib/e17/elementary.rb' +end +# +# EOF diff --git a/lib/e17/ecore.rb b/lib/e17/ecore.rb new file mode 100644 index 0000000..12c505c --- /dev/null +++ b/lib/e17/ecore.rb @@ -0,0 +1,58 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'ffi' +# +module E17 + module ECORE + # + extend FFI::Library + # + callback :ecore_pipe_cb, [:pointer, :pointer, :int], :void + callback :ecore_select_function, [:int, :pointer, :pointer, :pointer, :pointer], :int + # + ffi_lib 'ecore' + [ + # http://docs.enlightenment.org/auto/ecore/group__Ecore__Group.html + [ :ecore_init, [ ], :int], + [ :ecore_shutdown, [], :int], + [ :ecore_pipe_add, [:ecore_pipe_cb, :pointer], :pointer], + [ :ecore_pipe_del, [:pointer], :pointer], + [ :ecore_pipe_read_close, [:pointer], :void], + [ :ecore_pipe_write_close, [:pointer], :void], + [ :ecore_pipe_write, [:pointer, :pointer, :int], :bool], + # http://docs.enlightenment.org/auto/ecore/group__Ecore__Main__Loop__Group.html + [ :ecore_main_loop_iterate, [], :void], + [ :ecore_main_loop_begin, [], :void], + [ :ecore_main_loop_quit, [], :void], + [ :ecore_main_loop_select_func_set, [], :void], # TODO spec + [ :ecore_main_loop_select_func_get, [], :void], # TODO spec +# EAPI void ecore_main_fd_handler_prepare_callback_set (Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data) # TODO + ].each do |func| + begin + attach_function *func + rescue Object => e + puts "Could not attach #{func} #{e.message}" + end + end + # + class << self + alias init ecore_init + alias shutdown ecore_shutdown + alias pipe_add ecore_pipe_add + alias pipe_del ecore_pipe_del + alias pipe_read_close ecore_pipe_read_close + alias pipe_write_close ecore_pipe_write_close + alias pipe_write ecore_pipe_write + # + alias main_loop_iterate ecore_main_loop_iterate + alias main_loop_begin ecore_main_loop_begin + alias main_loop_quit ecore_main_loop_quit + alias main_loop_select_func_set ecore_main_loop_select_func_set + alias main_loop_select_func_get ecore_main_loop_select_func_get + end + # + end +end +# +# EOF diff --git a/lib/e17/ecore/event.rb b/lib/e17/ecore/event.rb new file mode 100644 index 0000000..e536875 --- /dev/null +++ b/lib/e17/ecore/event.rb @@ -0,0 +1,59 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'ffi' +# +module E17 + module ECORE + # + extend FFI::Library + # + EVENT_NONE = 0 + EVENT_SIGNAL_USER = 1 # User signal event + EVENT_SIGNAL_HUP = 2 # Hup signal event + EVENT_SIGNAL_EXIT = 3 # Exit signal event + 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 + # + 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 ], + [ :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 + # + end +end +# +# EOF diff --git a/lib/e17/edje.rb b/lib/e17/edje.rb new file mode 100644 index 0000000..4abeb0b --- /dev/null +++ b/lib/e17/edje.rb @@ -0,0 +1,31 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'ffi' +# +module E17 + module EDJE + # + extend FFI::Library + # + ffi_lib 'edje' + [ + [ :edje_init, [], :int], + [ :edje_shutdown, [], :int], + ].each do |func| + begin + attach_function *func + rescue Object => e + puts "Could not attach #{func} #{e.message}" + end + end + # + class << self + alias init edje_init + alias shutdown edje_shutdown + end + # + end +end +# +# EOF diff --git a/lib/e17/eet.rb b/lib/e17/eet.rb new file mode 100644 index 0000000..929a0f8 --- /dev/null +++ b/lib/e17/eet.rb @@ -0,0 +1,131 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'ffi' +# +module E17 + module EET + # + extend FFI::Library + # + ffi_lib 'eet' + [ + [ :eet_init, [], :int], + [ :eet_shutdown, [], :int], + [ :eet_clearcache, [], :void], + [ :eet_open, [:string, :int], :pointer], + [ :eet_mode_get, [:pointer], :int], + [ :eet_close, [:pointer], :int], + [ :eet_write, [:pointer, :string, :pointer, :int, :int], :int], + [ :eet_read, [:pointer, :string, :pointer], :pointer], + ].each do |func| + begin + attach_function *func + rescue Object => e + puts "Could not attach #{func} #{e.message}" + end + end + # + FILE_MODE_INVALID = -1 + FILE_MODE_READ = 0 + FILE_MODE_WRITE = 1 + FILE_MODE_READ_WRITE = 2 + # + class << self + # + alias init eet_init + alias shutdown eet_shutdown + alias clearcache eet_clearcache + # + def open path, mode=FILE_MODE_READ, &blk + if blk + f = eet_open path, mode + raise Exception.new "Unable to open file #{path}" if f.nil? + yield EETFile.new f + eet_close f + else + f = eet_open path, mode + return EETFile.new f unless f.nil? + end + end + end + # + class EETFile + # + def initialize ptr + @ptr=ptr + end + private :initialize + # + def close + EET.eet_close @ptr + @ptr=nil + end + # + def mode_get + EET.eet_mode_get @ptr + end + # + def write key, data, compress=false + EET.eet_write @ptr, key, FFI::MemoryPointer.from_string(data), data.bytesize, ( compress ? 1 : 0 ) + end + # + def read key + ptr = FFI::MemoryPointer.new(:int) + data = EET.eet_read @ptr, key, ptr + s = ptr.read_int + ptr.free + return nil if s==0 + ( data.null? ? nil : data.read_string[0..s-1] ) + end + # + end + # + class Error < Exception + ERROR_NONE=0 + ERROR_BAD_OBJECT=1 + ERROR_EMPTY=2 + ERROR_NOT_WRITABLE=3 + ERROR_OUT_OF_MEMORY=4 + ERROR_WRITE_ERROR=5 + ERROR_WRITE_ERROR_FILE_TOO_BIG=6 + ERROR_WRITE_ERROR_IO_ERROR=7 + ERROR_WRITE_ERROR_OUT_OF_SPACE=8 + ERROR_WRITE_ERROR_FILE_CLOSED=9 + ERROR_MMAP_FAILED=10 + ERROR_X509_ENCODING_FAILED=11 + ERROR_SIGNATURE_FAILED=12 + ERROR_INVALID_SIGNATURE=13 + ERROR_NOT_SIGNED=14 + ERROR_NOT_IMPLEMENTED=15 + ERROR_PRNG_NOT_SEEDED=16 + ERROR_ENCRYPT_FAILED=17 + ERROR_DECRYPT_FAILED=18 + # + MSGS = { + 0=>'No error, it\'s all fine!', + 1=>' Given object or handle is NULL or invalid', + 2=>'There was nothing to do', + 3=>'Could not write to file or fine is #FILE_MODE_READ', + 4=>'Could not allocate memory', + 5=>'Failed to write data to destination', + 6=>'Failed to write file since it is too big', + 7=>'Failed to write since generic Input/Output error', + 8=>'Failed to write due out of space', + 9=>'Failed to write because file was closed', + 10=>'Could not mmap file', + 11=>'Could not encode using X509', + 12=>'Could not validate signature', + 13=>'Signature is invalid', + 14=>'File or contents are not signed', + 15=>'Function is not implemented', + 16=>'Could not introduce random seed', + 17=>'Could not encrypt contents', + 18=>'Could not decrypt contents', + } + # + end + end +end +# +# EOF diff --git a/lib/e17/eina.rb b/lib/e17/eina.rb new file mode 100644 index 0000000..bdb3522 --- /dev/null +++ b/lib/e17/eina.rb @@ -0,0 +1,31 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'ffi' +# +module E17 + module EINA + # + extend FFI::Library + # + ffi_lib 'eina' + [ + [ :eina_init, [], :int], + [ :eina_shutdown, [], :int], + ].each do |func| + begin + attach_function *func + rescue Object => e + puts "Could not attach #{func} #{e.message}" + end + end + # + class << self + alias init eina_init + alias shutdown eina_shutdown + end + # + end +end +# +# EOF diff --git a/lib/e17/evas.rb b/lib/e17/evas.rb new file mode 100644 index 0000000..7a8d488 --- /dev/null +++ b/lib/e17/evas.rb @@ -0,0 +1,46 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'ffi' +# +module E17 + module EVAS + # + extend FFI::Library + # + callback :evas_async_events_put_cb, [:pointer, :int, :pointer], :void + # + ffi_lib 'evas' + [ + # http://docs.enlightenment.org/auto/evas/group__Evas__Group.html + [ :evas_init, [], :int], + [ :evas_shutdown, [], :int], + [ :evas_alloc_error, [], :int], + [ :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 + # + end +end +# +# EOF diff --git a/lib/efl.rb b/lib/efl.rb deleted file mode 100644 index f3ef222..0000000 --- a/lib/efl.rb +++ /dev/null @@ -1,13 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -# -module EFL - autoload :EINA, './lib/efl/eina.rb' - autoload :EET, './lib/efl/eet.rb' - autoload :EVAS, './lib/efl/evas.rb' - autoload :ECORE, './lib/efl/ecore.rb' - autoload :EDJE, './lib/efl/edje.rb' -end -# -# EOF diff --git a/lib/efl/ecore.rb b/lib/efl/ecore.rb deleted file mode 100644 index c1599aa..0000000 --- a/lib/efl/ecore.rb +++ /dev/null @@ -1,58 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'ffi' -# -module EFL - module ECORE - # - extend FFI::Library - # - callback :ecore_pipe_cb, [:pointer, :pointer, :int], :void - callback :ecore_select_function, [:int, :pointer, :pointer, :pointer, :pointer], :int - # - ffi_lib 'ecore' - [ - # http://docs.enlightenment.org/auto/ecore/group__Ecore__Group.html - [ :ecore_init, [ ], :int], - [ :ecore_shutdown, [], :int], - [ :ecore_pipe_add, [:ecore_pipe_cb, :pointer], :pointer], - [ :ecore_pipe_del, [:pointer], :pointer], - [ :ecore_pipe_read_close, [:pointer], :void], - [ :ecore_pipe_write_close, [:pointer], :void], - [ :ecore_pipe_write, [:pointer, :pointer, :int], :bool], - # http://docs.enlightenment.org/auto/ecore/group__Ecore__Main__Loop__Group.html - [ :ecore_main_loop_iterate, [], :void], - [ :ecore_main_loop_begin, [], :void], - [ :ecore_main_loop_quit, [], :void], - [ :ecore_main_loop_select_func_set, [], :void], # TODO spec - [ :ecore_main_loop_select_func_get, [], :void], # TODO spec -# EAPI void ecore_main_fd_handler_prepare_callback_set (Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data) # TODO - ].each do |func| - begin - attach_function *func - rescue Object => e - puts "Could not attach #{func} #{e.message}" - end - end - # - class << self - alias init ecore_init - alias shutdown ecore_shutdown - alias pipe_add ecore_pipe_add - alias pipe_del ecore_pipe_del - alias pipe_read_close ecore_pipe_read_close - alias pipe_write_close ecore_pipe_write_close - alias pipe_write ecore_pipe_write - # - alias main_loop_iterate ecore_main_loop_iterate - alias main_loop_begin ecore_main_loop_begin - alias main_loop_quit ecore_main_loop_quit - alias main_loop_select_func_set ecore_main_loop_select_func_set - alias main_loop_select_func_get ecore_main_loop_select_func_get - end - # - end -end -# -# EOF diff --git a/lib/efl/ecore/event.rb b/lib/efl/ecore/event.rb deleted file mode 100644 index ed85a28..0000000 --- a/lib/efl/ecore/event.rb +++ /dev/null @@ -1,59 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'ffi' -# -module EFL - module ECORE - # - extend FFI::Library - # - EVENT_NONE = 0 - EVENT_SIGNAL_USER = 1 # User signal event - EVENT_SIGNAL_HUP = 2 # Hup signal event - EVENT_SIGNAL_EXIT = 3 # Exit signal event - 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 - # - 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 ], - [ :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 - # - end -end -# -# EOF diff --git a/lib/efl/edje.rb b/lib/efl/edje.rb deleted file mode 100644 index 8977b09..0000000 --- a/lib/efl/edje.rb +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'ffi' -# -module EFL - module EDJE - # - extend FFI::Library - # - ffi_lib 'edje' - [ - [ :edje_init, [], :int], - [ :edje_shutdown, [], :int], - ].each do |func| - begin - attach_function *func - rescue Object => e - puts "Could not attach #{func} #{e.message}" - end - end - # - class << self - alias init edje_init - alias shutdown edje_shutdown - end - # - end -end -# -# EOF diff --git a/lib/efl/eet.rb b/lib/efl/eet.rb deleted file mode 100644 index 1cfba91..0000000 --- a/lib/efl/eet.rb +++ /dev/null @@ -1,131 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'ffi' -# -module EFL - module EET - # - extend FFI::Library - # - ffi_lib 'eet' - [ - [ :eet_init, [], :int], - [ :eet_shutdown, [], :int], - [ :eet_clearcache, [], :void], - [ :eet_open, [:string, :int], :pointer], - [ :eet_mode_get, [:pointer], :int], - [ :eet_close, [:pointer], :int], - [ :eet_write, [:pointer, :string, :pointer, :int, :int], :int], - [ :eet_read, [:pointer, :string, :pointer], :pointer], - ].each do |func| - begin - attach_function *func - rescue Object => e - puts "Could not attach #{func} #{e.message}" - end - end - # - FILE_MODE_INVALID = -1 - FILE_MODE_READ = 0 - FILE_MODE_WRITE = 1 - FILE_MODE_READ_WRITE = 2 - # - class << self - # - alias init eet_init - alias shutdown eet_shutdown - alias clearcache eet_clearcache - # - def open path, mode=FILE_MODE_READ, &blk - if blk - f = eet_open path, mode - raise Exception.new "Unable to open file #{path}" if f.nil? - yield EETFile.new f - eet_close f - else - f = eet_open path, mode - return EETFile.new f unless f.nil? - end - end - end - # - class EETFile - # - def initialize ptr - @ptr=ptr - end - private :initialize - # - def close - EET.eet_close @ptr - @ptr=nil - end - # - def mode_get - EET.eet_mode_get @ptr - end - # - def write key, data, compress=false - EET.eet_write @ptr, key, FFI::MemoryPointer.from_string(data), data.bytesize, ( compress ? 1 : 0 ) - end - # - def read key - ptr = FFI::MemoryPointer.new(:int) - data = EET.eet_read @ptr, key, ptr - s = ptr.read_int - ptr.free - return nil if s==0 - ( data.null? ? nil : data.read_string[0..s-1] ) - end - # - end - # - class Error < Exception - ERROR_NONE=0 - ERROR_BAD_OBJECT=1 - ERROR_EMPTY=2 - ERROR_NOT_WRITABLE=3 - ERROR_OUT_OF_MEMORY=4 - ERROR_WRITE_ERROR=5 - ERROR_WRITE_ERROR_FILE_TOO_BIG=6 - ERROR_WRITE_ERROR_IO_ERROR=7 - ERROR_WRITE_ERROR_OUT_OF_SPACE=8 - ERROR_WRITE_ERROR_FILE_CLOSED=9 - ERROR_MMAP_FAILED=10 - ERROR_X509_ENCODING_FAILED=11 - ERROR_SIGNATURE_FAILED=12 - ERROR_INVALID_SIGNATURE=13 - ERROR_NOT_SIGNED=14 - ERROR_NOT_IMPLEMENTED=15 - ERROR_PRNG_NOT_SEEDED=16 - ERROR_ENCRYPT_FAILED=17 - ERROR_DECRYPT_FAILED=18 - # - MSGS = { - 0=>'No error, it\'s all fine!', - 1=>' Given object or handle is NULL or invalid', - 2=>'There was nothing to do', - 3=>'Could not write to file or fine is #FILE_MODE_READ', - 4=>'Could not allocate memory', - 5=>'Failed to write data to destination', - 6=>'Failed to write file since it is too big', - 7=>'Failed to write since generic Input/Output error', - 8=>'Failed to write due out of space', - 9=>'Failed to write because file was closed', - 10=>'Could not mmap file', - 11=>'Could not encode using X509', - 12=>'Could not validate signature', - 13=>'Signature is invalid', - 14=>'File or contents are not signed', - 15=>'Function is not implemented', - 16=>'Could not introduce random seed', - 17=>'Could not encrypt contents', - 18=>'Could not decrypt contents', - } - # - end - end -end -# -# EOF diff --git a/lib/efl/eina.rb b/lib/efl/eina.rb deleted file mode 100644 index 849a0a0..0000000 --- a/lib/efl/eina.rb +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'ffi' -# -module EFL - module EINA - # - extend FFI::Library - # - ffi_lib 'eina' - [ - [ :eina_init, [], :int], - [ :eina_shutdown, [], :int], - ].each do |func| - begin - attach_function *func - rescue Object => e - puts "Could not attach #{func} #{e.message}" - end - end - # - class << self - alias init eina_init - alias shutdown eina_shutdown - end - # - end -end -# -# EOF diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb deleted file mode 100644 index 7f386b9..0000000 --- a/lib/efl/evas.rb +++ /dev/null @@ -1,46 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'ffi' -# -module EFL - module EVAS - # - extend FFI::Library - # - callback :evas_async_events_put_cb, [:pointer, :int, :pointer], :void - # - ffi_lib 'evas' - [ - # http://docs.enlightenment.org/auto/evas/group__Evas__Group.html - [ :evas_init, [], :int], - [ :evas_shutdown, [], :int], - [ :evas_alloc_error, [], :int], - [ :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 - # - end -end -# -# EOF diff --git a/spec/ecore_event_spec.rb b/spec/ecore_event_spec.rb index a61e4c8..0dba5b9 100644 --- a/spec/ecore_event_spec.rb +++ b/spec/ecore_event_spec.rb @@ -1,12 +1,12 @@ #! /usr/bin/env ruby # -*- coding: UTF-8 -*- # -require 'efl/ecore' -require 'efl/ecore/event' +require 'e17/ecore' +require 'e17/ecore/event' # -describe EFL::ECORE do +describe E17::ECORE do # - include EFL + include E17 # before(:all) do USER_SIGNAL_CB = Proc.new do |data, type, event| diff --git a/spec/ecore_spec.rb b/spec/ecore_spec.rb index 8d7f4bf..d027ab6 100644 --- a/spec/ecore_spec.rb +++ b/spec/ecore_spec.rb @@ -1,11 +1,11 @@ #! /usr/bin/env ruby # -*- coding: UTF-8 -*- # -require 'efl/ecore' +require 'e17/ecore' # -describe EFL::ECORE do +describe E17::ECORE do # - include EFL + include E17 # it "should init" do ECORE.init.should eql 1 diff --git a/spec/edje_spec.rb b/spec/edje_spec.rb index 89fbc62..79bab21 100644 --- a/spec/edje_spec.rb +++ b/spec/edje_spec.rb @@ -1,11 +1,11 @@ #! /usr/bin/env ruby # -*- coding: UTF-8 -*- # -require 'efl/edje' +require 'e17/edje' # -describe EFL::EDJE do +describe E17::EDJE do # - include EFL + include E17 # it "should init" do EDJE.init.should eql 1 diff --git a/spec/eet_spec.rb b/spec/eet_spec.rb index 848dc78..429f548 100644 --- a/spec/eet_spec.rb +++ b/spec/eet_spec.rb @@ -1,11 +1,11 @@ #! /usr/bin/env ruby # -*- coding: UTF-8 -*- # -require 'efl/eet' +require 'e17/eet' # -describe EFL::EET do +describe E17::EET do # - include EFL + include E17 # FP = '/tmp/_eet.cfg' # diff --git a/spec/eina_spec.rb b/spec/eina_spec.rb index 694e2b2..c110d67 100644 --- a/spec/eina_spec.rb +++ b/spec/eina_spec.rb @@ -1,11 +1,11 @@ #! /usr/bin/env ruby # -*- coding: UTF-8 -*- # -require 'efl/eina' +require 'e17/eina' # -describe EFL::EINA do +describe E17::EINA do # - include EFL + include E17 # it "should init" do EINA.init.should eql 1 diff --git a/spec/evas_spec.rb b/spec/evas_spec.rb index c04cd9f..a708833 100644 --- a/spec/evas_spec.rb +++ b/spec/evas_spec.rb @@ -1,11 +1,11 @@ #! /usr/bin/env ruby # -*- coding: UTF-8 -*- # -require 'efl/evas' +require 'e17/evas' # -describe EFL::EVAS do +describe E17::EVAS do # - include EFL + include E17 # it "should init" do EVAS.init.should eql 1 -- cgit v1.1-2-g2b99