diff options
author | Jérémy Zurcher <jeremy.zurcher@heraeus.com> | 2011-04-19 16:46:57 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy.zurcher@heraeus.com> | 2011-04-19 16:46:57 +0200 |
commit | 37c2ce0f79c2a797e4765251d5621d60631800cb (patch) | |
tree | 2a96fe9f83803fff44e5e6330400583cf41e82ed | |
parent | 23ed152c8b59db2a7164c9402c3c3762f40625b9 (diff) | |
download | ffi-efl-37c2ce0f79c2a797e4765251d5621d60631800cb.zip ffi-efl-37c2ce0f79c2a797e4765251d5621d60631800cb.tar.gz |
update ecore and specs
-rw-r--r-- | lib/e17/ecore.rb | 51 | ||||
-rw-r--r-- | spec/ecore_spec.rb | 28 |
2 files changed, 23 insertions, 56 deletions
diff --git a/lib/e17/ecore.rb b/lib/e17/ecore.rb index 668c8e4..fe4786f 100644 --- a/lib/e17/ecore.rb +++ b/lib/e17/ecore.rb @@ -1,57 +1,24 @@ #! /usr/bin/env ruby # -*- coding: UTF-8 -*- # -require 'e17/ffi_helper' +require 'e17/ecore/ecore-ffi' # module E17 - module ECORE - # - extend FFIHelper - extend FFI::Library - # - ffi_lib 'ecore' - # - typedef :pointer, :data - typedef :pointer, :ecore_pipe - typedef :pointer, :ecore_fd_handler - # - callback :ecore_pipe_cb, [:data, :pointer, :int], :void - callback :ecore_select_function, [:int, :pointer, :pointer, :pointer, :pointer], :int - callback :ecore_fd_prep_cb, [:data, :pointer], :void - # - fcts = [ - # http://docs.enlightenment.org/auto/ecore/group__Ecore__Group.html - [ :ecore_init, [], :int], - [ :ecore_shutdown, [], :int], - [ :ecore_pipe_add, [:ecore_pipe_cb, :data], :ecore_pipe], - [ :ecore_pipe_del, [:ecore_pipe], :data], - [ :ecore_pipe_read_close, [:ecore_pipe], :void], - [ :ecore_pipe_write_close, [:ecore_pipe], :void], - [ :ecore_pipe_write, [:ecore_pipe, :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, [:ecore_select_function], :void], # TODO spec - [ :ecore_main_loop_select_func_get, [], :ecore_select_function], # TODO spec - [ :ecore_main_fd_handler_prepare_callback_set, [:ecore_fd_handler, :ecore_fd_prep_cb, :data], :void], # TODO spec - ] - # - attach_fcts fcts - # - create_aliases 'ecore_'.length, fcts + module Ecore # class EcorePipe def initialize cb, data - @ptr = ECORE.ecore_pipe_add cb, data + @ptr = E17::API.ecore_pipe_add cb, data end - def del; ECORE.ecore_pipe_del @ptr; end - def read_close; ECORE.ecore_pipe_read_close @ptr; end - def write_close; ECORE.ecore_pipe_write_close @ptr; end + def del; E17::API.ecore_pipe_del @ptr; end + def read_close; E17::API.ecore_pipe_read_close @ptr; end + def write_close; E17::API.ecore_pipe_write_close @ptr; end def write data - ECORE.ecore_pipe_write @ptr, FFI::MemoryPointer.from_string(data.to_s), data.to_s.length+1 + E17::API.ecore_pipe_write @ptr, FFI::MemoryPointer.from_string(data.to_s), data.to_s.length+1 end + # end + # end end # diff --git a/spec/ecore_spec.rb b/spec/ecore_spec.rb index 96ece40..183e64c 100644 --- a/spec/ecore_spec.rb +++ b/spec/ecore_spec.rb @@ -3,26 +3,26 @@ # require 'e17/ecore' # -describe E17::ECORE do +describe E17::Ecore do # include E17 # it "should init" do - ECORE.init.should eql 1 - ECORE.init.should eql 2 - ECORE.init.should eql 3 + Ecore.init.should eql 1 + Ecore.init.should eql 2 + Ecore.init.should eql 3 end # it "should shutdown" do - ECORE.shutdown.should eql 2 - ECORE.shutdown.should eql 1 - ECORE.shutdown.should eql 0 + Ecore.shutdown.should eql 2 + Ecore.shutdown.should eql 1 + Ecore.shutdown.should eql 0 end # it "should run a single iteration of the mainloop" do - ECORE.init - ECORE.main_loop_iterate - ECORE.shutdown + Ecore.init + Ecore.main_loop_iterate + Ecore.shutdown end # it 'should write and read data from pipe' do @@ -32,13 +32,13 @@ describe E17::ECORE do buffer.read_string.should eql 'hello world' bytes.should eql 12 end - ECORE.init - pipe = ECORE::EcorePipe.new cb, data + Ecore.init + pipe = Ecore::EcorePipe.new cb, data pipe.write("hello world").should be_true - ECORE.main_loop_iterate + Ecore.main_loop_iterate pipe.read_close pipe.write_close pipe.del.address.should eql data.address - ECORE.shutdown + Ecore.shutdown end end |