From 6aa471a79c90ed74541037d337b2ed6bb201beb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 9 Apr 2011 00:05:52 +0200 Subject: add evas --- lib/efl/evas.rb | 38 ++++++++++++++++++++++++++++++++++++++ spec/evas_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 lib/efl/evas.rb create mode 100644 spec/evas_spec.rb diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb new file mode 100644 index 0000000..7c5c5b1 --- /dev/null +++ b/lib/efl/evas.rb @@ -0,0 +1,38 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'ffi' +# +module EFL + module EVAS + # + MAJOR = 0 + MINOR = 0 + REVISION = 1 + VERSION = [MAJOR,MINOR,REVISION].join '.' + # + extend FFI::Library + # + ffi_lib 'evas' + functions = [ + [ :evas_init, [ ], :int ], + [ :evas_shutdown, [], :int ], + ].each do |func| + begin + attach_function *func + rescue Object => e + puts "Could not attach #{func} #{e.message}" + end + end + # + def self.init + evas_init + end + # + def self.shutdown + evas_shutdown + end + # + end +end +# diff --git a/spec/evas_spec.rb b/spec/evas_spec.rb new file mode 100644 index 0000000..815c4a1 --- /dev/null +++ b/spec/evas_spec.rb @@ -0,0 +1,22 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/evas' +# +describe EFL::EVAS do + # + include EFL + # + it "should init" do + EVAS.init.should eql 1 + EVAS.init.should eql 2 + EVAS.init.should eql 3 + end + # + it "should shutdown" do + EVAS.shutdown.should eql 2 + EVAS.shutdown.should eql 1 + EVAS.shutdown.should eql 0 + end + # +end -- cgit v1.1-2-g2b99