summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-04-09 00:05:52 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-04-09 00:05:52 +0200
commit6aa471a79c90ed74541037d337b2ed6bb201beb4 (patch)
treea99a2a2167ec004396d4dbeb066fbcf383e337e2
parent01a38a489eb53363838474a96e60bbe437522d16 (diff)
downloadffi-efl-6aa471a79c90ed74541037d337b2ed6bb201beb4.zip
ffi-efl-6aa471a79c90ed74541037d337b2ed6bb201beb4.tar.gz
add evas
-rw-r--r--lib/efl/evas.rb38
-rw-r--r--spec/evas_spec.rb22
2 files changed, 60 insertions, 0 deletions
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