From 2806b37dc8f9721ac5e84755654b6b6d4ebad5a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 27 Apr 2011 16:02:06 +0200 Subject: add eina_main and specs --- lib/efl/eina.rb | 6 ++++++ lib/efl/ffi/eina_main.rb | 45 +++++++++++++++++++++++++++++++++++++++++++++ spec/eina_spec.rb | 20 ++++++++++++++++++++ tools/extract-api.sh | 1 + tools/genruby.rb | 3 ++- 5 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 lib/efl/eina.rb create mode 100644 lib/efl/ffi/eina_main.rb create mode 100644 spec/eina_spec.rb diff --git a/lib/efl/eina.rb b/lib/efl/eina.rb new file mode 100644 index 0000000..5141853 --- /dev/null +++ b/lib/efl/eina.rb @@ -0,0 +1,6 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/ffi/eina_main' +# +# EOF diff --git a/lib/efl/ffi/eina_main.rb b/lib/efl/ffi/eina_main.rb new file mode 100644 index 0000000..6d09164 --- /dev/null +++ b/lib/efl/ffi/eina_main.rb @@ -0,0 +1,45 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/ffi' +# +module Efl + # + module Eina + def self.method_missing m, *args, &block + return Efl::FFI.send 'eina_'+m.to_s, *args, &block + end + end + # + module FFI + # + # + ffi_lib 'eina' + # + # ENUMS + # + # TYPEDEFS + # typedef struct _Eina_Version Eina_Version; + typedef :pointer, :eina_version + # + # CALLBACKS + # + # FUNCTIONS + fcts = [ + # EAPI extern Eina_Version *eina_version; + # FIXME + # EAPI int eina_init(void); + [ :eina_init, [ ], :int ], + # EAPI int eina_shutdown(void); + [ :eina_shutdown, [ ], :int ], + # EAPI int eina_threads_init(void); + [ :eina_threads_init, [ ], :int ], + # EAPI int eina_threads_shutdown(void); + [ :eina_threads_shutdown, [ ], :int ], + ] + # + attach_fcts fcts + end +end +# +# EOF diff --git a/spec/eina_spec.rb b/spec/eina_spec.rb new file mode 100644 index 0000000..e76129a --- /dev/null +++ b/spec/eina_spec.rb @@ -0,0 +1,20 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/eina' +# +describe Efl::Eina do + # + it "should init" do + Efl::Eina.init.should eql 1 + Efl::Eina.init.should eql 2 + Efl::Eina.init.should eql 3 + end + # + it "should shutdown" do + Efl::Eina.shutdown.should eql 2 + Efl::Eina.shutdown.should eql 1 + Efl::Eina.shutdown.should eql 0 + end + # +end diff --git a/tools/extract-api.sh b/tools/extract-api.sh index 2fecec0..b5a4bc1 100755 --- a/tools/extract-api.sh +++ b/tools/extract-api.sh @@ -20,6 +20,7 @@ fi # for header in \ "${INCLUDE}/eina-1/eina/eina_types.h" \ + "${INCLUDE}/eina-1/eina/eina_main.h" \ "${INCLUDE}/eet-1/Eet.h" \ "${INCLUDE}/edje-1/Edje.h" \ "${INCLUDE}/evas-1/Evas.h" \ diff --git a/tools/genruby.rb b/tools/genruby.rb index c77cc28..c64ee59 100755 --- a/tools/genruby.rb +++ b/tools/genruby.rb @@ -4,9 +4,10 @@ path = File.dirname __FILE__ lib_path = File.join path, '..', 'lib', 'efl', 'ffi' # -# header, module name, lfct prefix, lib +# header, module name, fct prefix, lib libraries = [ [ 'eina_types.h', 'Eina', 'eina', 'eina'], + [ 'eina_main.h', 'Eina', 'eina', 'eina'], [ 'Eet.h', 'Eet', 'eet', 'eet'], [ 'Evas.h', 'Evas', 'evas', 'evas'], # [ 'Evas_GL.h', 'EvasGl', 'evas_gl', 'evas'], -- cgit v1.1-2-g2b99