diff options
-rw-r--r-- | lib/efl/ecore.rb | 10 | ||||
-rw-r--r-- | lib/efl/ecore_getopt.rb | 86 | ||||
-rw-r--r-- | lib/efl/eet.rb | 16 | ||||
-rw-r--r-- | lib/efl/elementary.rb | 14 | ||||
-rw-r--r-- | lib/efl/evas.rb | 78 | ||||
-rw-r--r-- | lib/efl/ffi.rb | 12 | ||||
-rw-r--r-- | lib/efl/ffi/ecore.rb | 4 | ||||
-rw-r--r-- | lib/efl/ffi/ecore_evas.rb | 4 | ||||
-rw-r--r-- | lib/efl/ffi/ecore_getopt.rb | 4 | ||||
-rw-r--r-- | lib/efl/ffi/ecore_input.rb | 4 | ||||
-rw-r--r-- | lib/efl/ffi/eet.rb | 4 | ||||
-rw-r--r-- | lib/efl/ffi/eina_types.rb | 4 | ||||
-rw-r--r-- | lib/efl/ffi/elementary.rb | 4 | ||||
-rw-r--r-- | lib/efl/ffi/evas.rb | 4 | ||||
-rw-r--r-- | spec/eet_spec.rb | 14 | ||||
-rw-r--r-- | spec/evas_spec.rb | 32 | ||||
-rwxr-xr-x | tools/genruby.rb | 4 |
17 files changed, 149 insertions, 149 deletions
diff --git a/lib/efl/ecore.rb b/lib/efl/ecore.rb index 4e6a4e9..0e7d88b 100644 --- a/lib/efl/ecore.rb +++ b/lib/efl/ecore.rb @@ -17,13 +17,13 @@ module Efl # class EcorePipe def initialize cb, data - @ptr = Efl::API.ecore_pipe_add cb, data + @ptr = Efl::FFI.ecore_pipe_add cb, data end - def del; Efl::API.ecore_pipe_del @ptr; end - def read_close; Efl::API.ecore_pipe_read_close @ptr; end - def write_close; Efl::API.ecore_pipe_write_close @ptr; end + def del; Efl::FFI.ecore_pipe_del @ptr; end + def read_close; Efl::FFI.ecore_pipe_read_close @ptr; end + def write_close; Efl::FFI.ecore_pipe_write_close @ptr; end def write data - Efl::API.ecore_pipe_write @ptr, FFI::MemoryPointer.from_string(data.to_s), data.to_s.length+1 + Efl::FFI.ecore_pipe_write @ptr, ::FFI::MemoryPointer.from_string(data.to_s), data.to_s.length+1 end # end diff --git a/lib/efl/ecore_getopt.rb b/lib/efl/ecore_getopt.rb index ee8767f..34c4539 100644 --- a/lib/efl/ecore_getopt.rb +++ b/lib/efl/ecore_getopt.rb @@ -4,9 +4,9 @@ require 'efl/ffi/ecore_getopt' # module Efl - module API + module FFI # - class EcoreGetoptValue < FFI::Union + class EcoreGetoptValue < ::FFI::Union layout :strp, :pointer, :boolp, :eina_bool_p, :shortp, :short_p, @@ -20,7 +20,7 @@ module Efl :ptrp, :void_p, end # - class EcoreGetoptDescStoreDef < FFI::Union + class EcoreGetoptDescStoreDef < ::FFI::Union layout :strv, :pointer, :boolv, :uchar, :shortv, :short, @@ -32,7 +32,7 @@ module Efl :doublev, :double, end # - class EcoreGetoptDescStore < FFI::Struct + class EcoreGetoptDescStore < ::FFI::Struct layout :type, :ecore_getopt_type, # enum :arg_req, :ecore_getopt_desc_arg_requirement, # enum :def, EcoreGetoptDescStoreDef, @@ -40,14 +40,14 @@ module Efl # callback :ecore_getopt_desc_cb, [:ecore_getopt_p, :ecore_getopt_desc_p, :string, :pointer, :ecore_getopt_value_p ], :eina_bool # - class EcoreGetoptDescCallback < FFI::Struct + class EcoreGetoptDescCallback < ::FFI::Struct layout :func, :ecore_getopt_desc_cb, :data, :pointer, :arg_req, :ecore_getopt_desc_arg_requirement, # enum :def, :pointer, end # - class EcoreActionParam < FFI::Union + class EcoreActionParam < ::FFI::Union layout :store, EcoreGetoptDescStore, :store_const, :pointer, :choices, :pointer, @@ -56,7 +56,7 @@ module Efl :dummy, :pointer, end # - class EcoreGetoptDesc < FFI::Struct + class EcoreGetoptDesc < ::FFI::Struct layout :shortname, :char, :longname, :pointer, :help, :pointer, @@ -65,7 +65,7 @@ module Efl :action_param, EcoreActionParam, end # - class EcoreGetopt < FFI::Struct + class EcoreGetopt < ::FFI::Struct layout :prog, :pointer, :usage, :pointer, :version, :pointer, @@ -76,7 +76,7 @@ module Efl # :descs, :pointer, # NULL terminated EcoreGetopt_Desc[] def desc_ptr idx - EcoreGetoptDesc.new to_ptr+Efl::API::EcoreGetopt.size+(idx*Efl::API::EcoreGetoptDesc.size) + EcoreGetoptDesc.new to_ptr+Efl::FFI::EcoreGetopt.size+(idx*Efl::FFI::EcoreGetoptDesc.size) end end # @@ -87,16 +87,16 @@ module Efl def initialize desc @desc = desc @options = [ - [ 0, FFI::Pointer::NULL, FFI::Pointer::NULL, FFI::Pointer::NULL, 0, {:dummy=>FFI::Pointer::NULL} ] + [ 0, ::FFI::Pointer::NULL, ::FFI::Pointer::NULL, ::FFI::Pointer::NULL, 0, {:dummy=>::FFI::Pointer::NULL} ] ] @values = [ - [ :ptrp, FFI::Pointer::NULL ] + [ :ptrp, ::FFI::Pointer::NULL ] ] - @refs = [] # to prevent FFI::MemoryPointer.from_string from beeing GC'ed + @refs = [] # to prevent ::FFI::MemoryPointer.from_string from beeing GC'ed end def p_from_string r - return r if r==FFI::Pointer::NULL - p = FFI::MemoryPointer.from_string r + return r if r==::FFI::Pointer::NULL + p = ::FFI::MemoryPointer.from_string r @refs << p p end @@ -110,9 +110,9 @@ module Efl @parser_p.to_ptr end def create - @parser_p = Efl::API::EcoreGetopt.new FFI::MemoryPointer.new (Efl::API::EcoreGetopt.size+Efl::API::EcoreGetoptDesc.size*@options.length), 1 + @parser_p = Efl::FFI::EcoreGetopt.new ::FFI::MemoryPointer.new (Efl::FFI::EcoreGetopt.size+Efl::FFI::EcoreGetoptDesc.size*@options.length), 1 [:prog,:usage,:version,:copyright,:license,:description].each do |sym| - @parser_p[sym] = ( @desc.has_key?(sym) ? FFI::MemoryPointer.from_string(@desc[sym]) : FFI::Pointer::NULL ) + @parser_p[sym] = ( @desc.has_key?(sym) ? ::FFI::MemoryPointer.from_string(@desc[sym]) : ::FFI::Pointer::NULL ) end @parser_p[:strict] = @desc[:strict] if @desc.has_key? :strict @options.each_with_index do |o,i| @@ -150,27 +150,27 @@ module Efl when :append d[:action_param][:append_type] = v else - d[:action_param][:dummy] = FFI::Pointer::NULL + d[:action_param][:dummy] = ::FFI::Pointer::NULL end end - @values_p = FFI::MemoryPointer.new Efl::API::EcoreGetoptValue, @values.length, false + @values_p = ::FFI::MemoryPointer.new Efl::FFI::EcoreGetoptValue, @values.length, false @values.each_with_index do |v,i| - Efl::API::EcoreGetoptValue.new(@values_p+(i*Efl::API::EcoreGetoptValue.size))[v[0]] = v[1] + Efl::FFI::EcoreGetoptValue.new(@values_p+(i*Efl::FFI::EcoreGetoptValue.size))[v[0]] = v[1] end end def parse argv - ptr = FFI::MemoryPointer.new(:pointer, argv.length+1) + ptr = ::FFI::MemoryPointer.new(:pointer, argv.length+1) argv.each_with_index do |s, i| ptr[i].put_pointer 0, p_from_string(s) end - ptr[argv.length].put_pointer 0, FFI::Pointer::NULL + ptr[argv.length].put_pointer 0, ::FFI::Pointer::NULL Efl::EcoreGetopt.parse @parser_p, @values_p, argv.length, ptr end def store_full short, long, help, meta, type, arg_req, def_val self << [ short, long, help, meta, :ecore_getopt_action_store, [:store, [type,arg_req, def_val] ] ] end def store short, long, help, type - store_full short, long, help, FFI::Pointer::NULL, type, :ecore_getopt_desc_arg_requirement_yes, nil + store_full short, long, help, ::FFI::Pointer::NULL, type, :ecore_getopt_desc_arg_requirement_yes, nil end def store_type type, short, long, help store short, long, help, ('ecore_getopt_type_'+type.to_s).to_sym @@ -182,7 +182,7 @@ module Efl store_metavar short, long, help, meta, ('ecore_getopt_type_'+type.to_s).to_sym end def store_def short, long, help, type, def_val - store_full short, long, help, FFI::Pointer::NULL, type, :ecore_getopt_desc_arg_requirement_optional, def_val + store_full short, long, help, ::FFI::Pointer::NULL, type, :ecore_getopt_desc_arg_requirement_optional, def_val end def store_def_type type, short, long, help, def_val store_def short, long, help, ('ecore_getopt_type_'+type.to_s).to_sym, [ (type.to_s+'v').to_sym, def_val ] @@ -191,62 +191,62 @@ module Efl store_full short, long, help, meta, ('ecore_getopt_type_'+type.to_s).to_sym, arg_req, [ (type.to_s+'v').to_sym, def_val ] end def store_const short, long, help, value - self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_store_const, [:store_const, value] ] + self << [ short, long, help, ::FFI::Pointer::NULL, :ecore_getopt_action_store_const, [:store_const, value] ] end def store_true short, long, help - self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_store_true, [:dummy,FFI::MemoryPointer::NULL] ] + self << [ short, long, help, ::FFI::Pointer::NULL, :ecore_getopt_action_store_true, [:dummy,::FFI::MemoryPointer::NULL] ] end def store_false short, long, help - self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_store_false, [:dummy,FFI::MemoryPointer::NULL] ] + self << [ short, long, help, ::FFI::Pointer::NULL, :ecore_getopt_action_store_false, [:dummy,::FFI::MemoryPointer::NULL] ] end def choice short, long, help, choices - ptr = FFI::MemoryPointer.new(:pointer, choices.length+1) + ptr = ::FFI::MemoryPointer.new(:pointer, choices.length+1) choices.each_with_index do |s, i| ptr[i].put_pointer 0, p_from_string(s) end - ptr[choices.length].put_pointer 0, FFI::Pointer::NULL - self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_choice, [:choices,ptr] ] + ptr[choices.length].put_pointer 0, ::FFI::Pointer::NULL + self << [ short, long, help, ::FFI::Pointer::NULL, :ecore_getopt_action_choice, [:choices,ptr] ] end def choice_metavar short, long, help, meta, choices - ptr = FFI::MemoryPointer.new(:pointer, choices.length+1) + ptr = ::FFI::MemoryPointer.new(:pointer, choices.length+1) choices.each_with_index do |s, i| ptr[i].put_pointer 0, p_from_string(s) end - ptr[choices.length].put_pointer 0, FFI::Pointer::NULL + ptr[choices.length].put_pointer 0, ::FFI::Pointer::NULL self << [ short, long, help, meta, :ecore_getopt_action_choice, [:choices,ptr] ] end def append short, long, help, sub_type - self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_append, [:append,sub_type] ] + self << [ short, long, help, ::FFI::Pointer::NULL, :ecore_getopt_action_append, [:append,sub_type] ] end def append_metavar short, long, help, meta, sub_type self << [ short, long, help, meta, :ecore_getopt_action_append, [:append,sub_type] ] end def count short, long, help - self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_count, [:dummy,FFI::Pointer::NULL] ] + self << [ short, long, help, ::FFI::Pointer::NULL, :ecore_getopt_action_count, [:dummy,::FFI::Pointer::NULL] ] end def callback_full short, long, help, meta, cb, data, arg_req, def_val self << [ short, long, help, meta, :ecore_getopt_action_callback, [:callback, [cb, data, arg_req,def_val] ] ] end def callback_noargs short, long, help, cb, data - callback_full short, long, help, FFI::Pointer::NULL, cb, data, :ecore_getopt_desc_arg_requirement_no, FFI::Pointer::NULL + callback_full short, long, help, ::FFI::Pointer::NULL, cb, data, :ecore_getopt_desc_arg_requirement_no, ::FFI::Pointer::NULL end def callback_args short, long, help, meta, cb, data - callback_full short, long, help, meta, cb, data, :ecore_getopt_desc_arg_requirement_yes, FFI::Pointer::NULL + callback_full short, long, help, meta, cb, data, :ecore_getopt_desc_arg_requirement_yes, ::FFI::Pointer::NULL end def help short, long - self << [ short, long, 'show this message.', FFI::Pointer::NULL, :ecore_getopt_action_help, [:dummy,FFI::Pointer::NULL] ] + self << [ short, long, 'show this message.', ::FFI::Pointer::NULL, :ecore_getopt_action_help, [:dummy,::FFI::Pointer::NULL] ] end def version short, long - self << [ short, long, 'show program version.', FFI::Pointer::NULL, :ecore_getopt_action_version, [:dummy,FFI::Pointer::NULL] ] + self << [ short, long, 'show program version.', ::FFI::Pointer::NULL, :ecore_getopt_action_version, [:dummy,::FFI::Pointer::NULL] ] end def copyright short, long - self << [ short, long, 'show copyright.', FFI::Pointer::NULL, :ecore_getopt_action_copyright, [:dummy,FFI::Pointer::NULL] ] + self << [ short, long, 'show copyright.', ::FFI::Pointer::NULL, :ecore_getopt_action_copyright, [:dummy,::FFI::Pointer::NULL] ] end def license short, long - self << [ short, long, 'show license.', FFI::Pointer::NULL, :ecore_getopt_action_license, [:dummy,FFI::Pointer::NULL] ] + self << [ short, long, 'show license.', ::FFI::Pointer::NULL, :ecore_getopt_action_license, [:dummy,::FFI::Pointer::NULL] ] end # def sentinel -# self << [ 0, FFI::Pointer::NULL, FFI::Pointer::NULL, FFI::Pointer::NULL, 0, {:dummy=>FFI::Pointer::NULL} ] +# self << [ 0, ::FFI::Pointer::NULL, ::FFI::Pointer::NULL, ::FFI::Pointer::NULL, 0, {:dummy=>::FFI::Pointer::NULL} ] # end # def debug @@ -259,11 +259,11 @@ module Efl i=0 while true d = @parser_p.desc_ptr i - break if d[:shortname]==0 and d[:longname] == FFI::Pointer::NULL + break if d[:shortname]==0 and d[:longname] == ::FFI::Pointer::NULL r << " desc #{d.to_ptr}\n" r << " short: #{d[:shortname].chr}\n" unless d[:shortname]==0 - r << " long: #{d[:longname].read_string}\n" unless d[:longname]==FFI::Pointer::NULL - r << " help: #{d[:help].read_string}\n" unless d[:help]==FFI::Pointer::NULL + r << " long: #{d[:longname].read_string}\n" unless d[:longname]==::FFI::Pointer::NULL + r << " help: #{d[:help].read_string}\n" unless d[:help]==::FFI::Pointer::NULL i+=1 end r diff --git a/lib/efl/eet.rb b/lib/efl/eet.rb index 4623d24..76a83cf 100644 --- a/lib/efl/eet.rb +++ b/lib/efl/eet.rb @@ -10,12 +10,12 @@ module Efl # def open path, mode=FILE_MODE_READ, &blk if blk - f = Efl::API.eet_open path, mode + f = Efl::FFI.eet_open path, mode raise Exception.new "Unable to open file #{path}" if f.nil? yield EetFile.new f - Efl::API.eet_close f + Efl::FFI.eet_close f else - f = Efl::API.eet_open path, mode + f = Efl::FFI.eet_open path, mode return EetFile.new f unless f.nil? end end @@ -29,21 +29,21 @@ module Efl private :initialize # def close - Efl::API.eet_close @ptr + Efl::FFI.eet_close @ptr @ptr=nil end # def mode_get - Efl::API.eet_mode_get @ptr + Efl::FFI.eet_mode_get @ptr end # def write key, data, compress=false - Efl::API.eet_write @ptr, key, FFI::MemoryPointer.from_string(data), data.bytesize, ( compress ? 1 : 0 ) + Efl::FFI.eet_write @ptr, key, ::FFI::MemoryPointer.from_string(data), data.bytesize, ( compress ? 1 : 0 ) end # def read key - ptr = FFI::MemoryPointer.new(:int) - data = Efl::API.eet_read @ptr, key, ptr + ptr = ::FFI::MemoryPointer.new(:int) + data = Efl::FFI.eet_read @ptr, key, ptr s = ptr.read_int ptr.free return nil if s==0 diff --git a/lib/efl/elementary.rb b/lib/efl/elementary.rb index d142367..6008618 100644 --- a/lib/efl/elementary.rb +++ b/lib/efl/elementary.rb @@ -10,12 +10,12 @@ module Efl class << self def init *args a = args.select { |e| e.is_a? String } - return Efl::API.elm_init 0, FFI::MemoryPointer::NULL if a.length==0 - ptr = FFI::MemoryPointer.new :pointer, a.length + return Efl::FFI.elm_init 0, ::FFI::MemoryPointer::NULL if a.length==0 + ptr = ::FFI::MemoryPointer.new :pointer, a.length a.each_with_index do |s,i| - ptr[i].write_pointer FFI::MemoryPointer.from_string(s) + ptr[i].write_pointer ::FFI::MemoryPointer.from_string(s) end - Efl::API.elm_init a.length, ptr + Efl::FFI.elm_init a.length, ptr end end # @@ -23,17 +23,17 @@ module Efl include Efl::Helper @func_prefixes = [ 'elm_win_', 'elm_' ].freeze def initialize parent, title, type=:elm_win_basic - @evas_object = Evas::EvasObject.new Efl::API.elm_win_add parent, title, type + @evas_object = Evas::EvasObject.new Efl::FFI.elm_win_add parent, title, type @ptr = @evas_object.ptr yield self,@evas_object if block_given? end def add e - eo = Evas::EvasObject.new Efl::API.send "elm_#{e}_add", @ptr + eo = Evas::EvasObject.new Efl::FFI.send "elm_#{e}_add", @ptr yield eo if block_given? eo end def smart_callback_add event_str, cb, data=FFI::MemoryPointer::NULL - Efl::API.evas_object_smart_callback_add @ptr, event_str, cb, data + Efl::FFI.evas_object_smart_callback_add @ptr, event_str, cb, data end end # diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb index 259a1c9..2147dc8 100644 --- a/lib/efl/evas.rb +++ b/lib/efl/evas.rb @@ -4,7 +4,7 @@ require 'efl/ffi/evas' # module Efl - module API + module FFI # EVAS_ENGINE_BUFFER_DEPTH_ARGB32 = 0 EVAS_ENGINE_BUFFER_DEPTH_BGRA32 = 1 @@ -12,16 +12,16 @@ module Efl EVAS_ENGINE_BUFFER_DEPTH_BGR24 = 3 EVAS_ENGINE_BUFFER_DEPTH_RGB32 = 4 # - class EvasEngineInfo < FFI::Struct + class EvasEngineInfo < ::FFI::Struct layout :magic, :int end callback :new_update_region_cb, [:int, :int, :int, :int, :int_p], :pointer callback :free_update_region_cb, [:int, :int, :int, :int, :pointer], :void - class EvasEngineInfoBufferFunc < FFI::Struct + class EvasEngineInfoBufferFunc < ::FFI::Struct layout :new_update_region, :new_update_region_cb, :free_update_region, :free_update_region_cb end - class EvasEngineInfoBufferInfo < FFI::Struct + class EvasEngineInfoBufferInfo < ::FFI::Struct layout :depth_type, :int, :dest_buffer, :pointer, :dest_buffer_row_bytes, :int, @@ -32,7 +32,7 @@ module Efl :color_key_b, :int, :func, EvasEngineInfoBufferFunc, end - class EvasEngineInfoBuffer < FFI::Struct + class EvasEngineInfoBuffer < ::FFI::Struct layout :magic, EvasEngineInfo, :info, EvasEngineInfoBufferInfo, # :func, EvasEngineInfoBufferFunc, @@ -50,13 +50,13 @@ module Efl @ptr = ( case o when NilClass - FFI::AutoPointer.new Efl::API.evas_new, method(:free) + ::FFI::AutoPointer.new Efl::FFI.evas_new, method(:free) when self.class o.ptr - when FFI::AutoPointer + when ::FFI::AutoPointer o - when FFI::Pointer - FFI::AutoPointer.new o, method(:free) + when ::FFI::Pointer + ::FFI::AutoPointer.new o, method(:free) else raise ArgumentError.new "#{ptr.class} valid argument" end @@ -64,36 +64,36 @@ module Efl yield self if block_given? end def free - Efl::API.evas_free @ptr + Efl::FFI.evas_free @ptr @ptr=nil end def === o @ptr === o.ptr end def output_size_get - x = FFI::MemoryPointer.new :int - y = FFI::MemoryPointer.new :int - Efl::API.evas_output_size_get @ptr, x, y + x = ::FFI::MemoryPointer.new :int + y = ::FFI::MemoryPointer.new :int + Efl::FFI.evas_output_size_get @ptr, x, y [ x.read_int, y.read_int ] end def output_viewport_get - x = FFI::MemoryPointer.new :int - y = FFI::MemoryPointer.new :int - w = FFI::MemoryPointer.new :int - h = FFI::MemoryPointer.new :int - Efl::API.evas_output_viewport_get @ptr, x, y, w, h + x = ::FFI::MemoryPointer.new :int + y = ::FFI::MemoryPointer.new :int + w = ::FFI::MemoryPointer.new :int + h = ::FFI::MemoryPointer.new :int + Efl::FFI.evas_output_viewport_get @ptr, x, y, w, h [ x.read_int, y.read_int, w.read_int, h.read_int ] end def pointer_output_xy_get - x = FFI::MemoryPointer.new :int - y = FFI::MemoryPointer.new :int - Efl::API.evas_pointer_output_xy_get @ptr, x, y + x = ::FFI::MemoryPointer.new :int + y = ::FFI::MemoryPointer.new :int + Efl::FFI.evas_pointer_output_xy_get @ptr, x, y [ x.read_int, y.read_int ] end def pointer_canvas_xy_get - x = FFI::MemoryPointer.new :int - y = FFI::MemoryPointer.new :int - Efl::API.evas_pointer_canvas_xy_get @ptr, x, y + x = ::FFI::MemoryPointer.new :int + y = ::FFI::MemoryPointer.new :int + Efl::FFI.evas_pointer_canvas_xy_get @ptr, x, y [ x.read_int, y.read_int ] end end @@ -105,13 +105,13 @@ module Efl @ptr = ( case o when NilClass - FFI::AutoPointer.new Efl::API.evas_new, method(:free) + ::FFI::AutoPointer.new Efl::FFI.evas_new, method(:free) when self.class o.ptr - when FFI::AutoPointer + when ::FFI::AutoPointer o - when FFI::Pointer - FFI::AutoPointer.new o, method(:free) + when ::FFI::Pointer + ::FFI::AutoPointer.new o, method(:free) else raise ArgumentError.new "#{ptr.class} valid argument" end @@ -119,23 +119,23 @@ module Efl yield self if block_given? end def free - Efl::API.evas_object_del @ptr + Efl::FFI.evas_object_del @ptr @ptr=nil end def geometry_get - x = FFI::MemoryPointer.new :int - y = FFI::MemoryPointer.new :int - w = FFI::MemoryPointer.new :int - h = FFI::MemoryPointer.new :int - Efl::API.evas_object_geometry_get @evas, x, y, w, h + x = ::FFI::MemoryPointer.new :int + y = ::FFI::MemoryPointer.new :int + w = ::FFI::MemoryPointer.new :int + h = ::FFI::MemoryPointer.new :int + Efl::FFI.evas_object_geometry_get @evas, x, y, w, h [ x.read_int, y.read_int, w.read_int, h.read_int ] end def color_get - r = FFI::MemoryPointer.new :int - g = FFI::MemoryPointer.new :int - b = FFI::MemoryPointer.new :int - a = FFI::MemoryPointer.new :int - Efl::API.evas_object_color_get @evas, r, g, b, a + r = ::FFI::MemoryPointer.new :int + g = ::FFI::MemoryPointer.new :int + b = ::FFI::MemoryPointer.new :int + a = ::FFI::MemoryPointer.new :int + Efl::FFI.evas_object_color_get @evas, r, g, b, a [ r.read_int, g.read_int, b.read_int, a.read_int ] end end diff --git a/lib/efl/ffi.rb b/lib/efl/ffi.rb index f583f2d..863b1b9 100644 --- a/lib/efl/ffi.rb +++ b/lib/efl/ffi.rb @@ -5,9 +5,9 @@ require 'ffi' # module Efl # - module API + module FFI # - extend FFI::Library + extend ::FFI::Library # def attach_fcts fcts fcts.each do |func| @@ -60,13 +60,13 @@ module Efl end self.class.func_prefixes.each do |p| sym = p+m_s - if Efl::API.respond_to? sym - self.class.class_eval "def #{m} *args, █ r=Efl::API.#{sym}(@ptr,#{args_s}); yield r if block_given?; r; end" + if Efl::FFI.respond_to? sym + self.class.class_eval "def #{m} *args, █ r=Efl::FFI.#{sym}(@ptr,#{args_s}); yield r if block_given?; r; end" return self.send m, *args, &block end end - r = Efl::API.send m, @ptr, *args - self.class.class_eval "def #{m} *args, █ r=Efl::API.#{m}(@ptr,#{args_s}); yield r if block_given?; r; end" + r = Efl::FFI.send m, @ptr, *args + self.class.class_eval "def #{m} *args, █ r=Efl::FFI.#{m}(@ptr,#{args_s}); yield r if block_given?; r; end" r end end diff --git a/lib/efl/ffi/ecore.rb b/lib/efl/ffi/ecore.rb index 394af34..ddd41b5 100644 --- a/lib/efl/ffi/ecore.rb +++ b/lib/efl/ffi/ecore.rb @@ -7,11 +7,11 @@ module Efl # module Ecore def self.method_missing m, *args, &block - return Efl::API.send 'ecore_'+m.to_s, *args, &block + return Efl::FFI.send 'ecore_'+m.to_s, *args, &block end end # - module API + module FFI # # ffi_lib 'ecore' diff --git a/lib/efl/ffi/ecore_evas.rb b/lib/efl/ffi/ecore_evas.rb index 948cae7..5fec9be 100644 --- a/lib/efl/ffi/ecore_evas.rb +++ b/lib/efl/ffi/ecore_evas.rb @@ -7,11 +7,11 @@ module Efl # module Ecore_evas def self.method_missing m, *args, &block - return Efl::API.send 'ecore_'+m.to_s, *args, &block + return Efl::FFI.send 'ecore_'+m.to_s, *args, &block end end # - module API + module FFI # # ffi_lib 'ecore' diff --git a/lib/efl/ffi/ecore_getopt.rb b/lib/efl/ffi/ecore_getopt.rb index c66312d..40cd81d 100644 --- a/lib/efl/ffi/ecore_getopt.rb +++ b/lib/efl/ffi/ecore_getopt.rb @@ -7,11 +7,11 @@ module Efl # module EcoreGetopt def self.method_missing m, *args, &block - return Efl::API.send 'ecore_getopt_'+m.to_s, *args, &block + return Efl::FFI.send 'ecore_getopt_'+m.to_s, *args, &block end end # - module API + module FFI # # ffi_lib 'ecore' diff --git a/lib/efl/ffi/ecore_input.rb b/lib/efl/ffi/ecore_input.rb index a98e927..e88e7fb 100644 --- a/lib/efl/ffi/ecore_input.rb +++ b/lib/efl/ffi/ecore_input.rb @@ -7,11 +7,11 @@ module Efl # module EcoreInput def self.method_missing m, *args, &block - return Efl::API.send 'ecore_'+m.to_s, *args, &block + return Efl::FFI.send 'ecore_'+m.to_s, *args, &block end end # - module API + module FFI # # ffi_lib 'ecore' diff --git a/lib/efl/ffi/eet.rb b/lib/efl/ffi/eet.rb index 37602c9..5e78e09 100644 --- a/lib/efl/ffi/eet.rb +++ b/lib/efl/ffi/eet.rb @@ -7,11 +7,11 @@ module Efl # module Eet def self.method_missing m, *args, &block - return Efl::API.send 'eet_'+m.to_s, *args, &block + return Efl::FFI.send 'eet_'+m.to_s, *args, &block end end # - module API + module FFI # # ffi_lib 'eet' diff --git a/lib/efl/ffi/eina_types.rb b/lib/efl/ffi/eina_types.rb index 2601ee3..5a5dd4d 100644 --- a/lib/efl/ffi/eina_types.rb +++ b/lib/efl/ffi/eina_types.rb @@ -7,11 +7,11 @@ module Efl # module Eina def self.method_missing m, *args, &block - return Efl::API.send 'eina_'+m.to_s, *args, &block + return Efl::FFI.send 'eina_'+m.to_s, *args, &block end end # - module API + module FFI # # ffi_lib 'eina' diff --git a/lib/efl/ffi/elementary.rb b/lib/efl/ffi/elementary.rb index 5d37153..7859ad8 100644 --- a/lib/efl/ffi/elementary.rb +++ b/lib/efl/ffi/elementary.rb @@ -7,11 +7,11 @@ module Efl # module Elm def self.method_missing m, *args, &block - return Efl::API.send 'elm_'+m.to_s, *args, &block + return Efl::FFI.send 'elm_'+m.to_s, *args, &block end end # - module API + module FFI # # ffi_lib 'libelementary-ver-pre-svn-09.so.0' diff --git a/lib/efl/ffi/evas.rb b/lib/efl/ffi/evas.rb index 689daf2..63635b4 100644 --- a/lib/efl/ffi/evas.rb +++ b/lib/efl/ffi/evas.rb @@ -7,11 +7,11 @@ module Efl # module Evas def self.method_missing m, *args, &block - return Efl::API.send 'evas_'+m.to_s, *args, &block + return Efl::FFI.send 'evas_'+m.to_s, *args, &block end end # - module API + module FFI # # ffi_lib 'evas' diff --git a/spec/eet_spec.rb b/spec/eet_spec.rb index 188f976..a4c1997 100644 --- a/spec/eet_spec.rb +++ b/spec/eet_spec.rb @@ -28,15 +28,15 @@ describe Efl::Eet do end # it "should have good enums" do - Efl::API.enum_type(:eet_file_mode)[:eet_file_mode_invalid].should eql -1 - Efl::API.enum_type(:eet_file_mode)[:eet_file_mode_read].should eql 0 - Efl::API.enum_type(:eet_file_mode)[:eet_file_mode_write].should eql 1 - Efl::API.enum_type(:eet_file_mode)[:eet_file_mode_read_write].should eql 2 + Efl::FFI.enum_type(:eet_file_mode)[:eet_file_mode_invalid].should eql -1 + Efl::FFI.enum_type(:eet_file_mode)[:eet_file_mode_read].should eql 0 + Efl::FFI.enum_type(:eet_file_mode)[:eet_file_mode_write].should eql 1 + Efl::FFI.enum_type(:eet_file_mode)[:eet_file_mode_read_write].should eql 2 end # it "should open and close" do Eet.init - f = Eet.open FP, Efl::API.enum_type(:eet_file_mode)[:eet_file_mode_write] + f = Eet.open FP, Efl::FFI.enum_type(:eet_file_mode)[:eet_file_mode_write] f.write 'fake', 'value' f.close Eet.shutdown @@ -44,9 +44,9 @@ describe Efl::Eet do # it "should be able to get file access mode" do Eet.init - Efl::API.enum_type(:eet_file_mode).symbols.each do |m| + Efl::FFI.enum_type(:eet_file_mode).symbols.each do |m| next if m==:eet_file_mode_invalid - Eet.open FP, Efl::API.enum_type(:eet_file_mode)[m] do |f| + Eet.open FP, Efl::FFI.enum_type(:eet_file_mode)[m] do |f| f.mode_get.should eql m end end diff --git a/spec/evas_spec.rb b/spec/evas_spec.rb index 755fb23..4350e86 100644 --- a/spec/evas_spec.rb +++ b/spec/evas_spec.rb @@ -20,15 +20,15 @@ describe Efl::Evas do end # it "evas alloc error enum is ok" do - Efl::API.enum_value(:evas_alloc_error_none).should eql 0 - Efl::API.enum_value(:evas_alloc_error_fatal).should eql 1 - Efl::API.enum_value(:evas_alloc_error_recovered).should eql 2 - Efl::API.enum_type(:evas_alloc_error)[0].should eql :evas_alloc_error_none - Efl::API.enum_type(:evas_alloc_error)[1].should eql :evas_alloc_error_fatal - Efl::API.enum_type(:evas_alloc_error)[2].should eql :evas_alloc_error_recovered - Efl::API.enum_type(:evas_alloc_error)[:evas_alloc_error_none].should eql 0 - Efl::API.enum_type(:evas_alloc_error)[:evas_alloc_error_fatal].should eql 1 - Efl::API.enum_type(:evas_alloc_error)[:evas_alloc_error_recovered].should eql 2 + Efl::FFI.enum_value(:evas_alloc_error_none).should eql 0 + Efl::FFI.enum_value(:evas_alloc_error_fatal).should eql 1 + Efl::FFI.enum_value(:evas_alloc_error_recovered).should eql 2 + Efl::FFI.enum_type(:evas_alloc_error)[0].should eql :evas_alloc_error_none + Efl::FFI.enum_type(:evas_alloc_error)[1].should eql :evas_alloc_error_fatal + Efl::FFI.enum_type(:evas_alloc_error)[2].should eql :evas_alloc_error_recovered + Efl::FFI.enum_type(:evas_alloc_error)[:evas_alloc_error_none].should eql 0 + Efl::FFI.enum_type(:evas_alloc_error)[:evas_alloc_error_fatal].should eql 1 + Efl::FFI.enum_type(:evas_alloc_error)[:evas_alloc_error_recovered].should eql 2 end # it "should have no memory allocation error occured" do @@ -62,8 +62,8 @@ describe Efl::Evas do @e.output_method_set Evas::render_method_lookup("buffer") @e.output_viewport_set 0, 0, @width, @height @e.output_size_set @width, @height - einfo = Efl::API::EvasEngineInfoBuffer.new @e.engine_info_get - einfo[:info][:depth_type] = Efl::API::EVAS_ENGINE_BUFFER_DEPTH_ARGB32 + einfo = Efl::FFI::EvasEngineInfoBuffer.new @e.engine_info_get + einfo[:info][:depth_type] = Efl::FFI::EVAS_ENGINE_BUFFER_DEPTH_ARGB32 einfo[:info][:dest_buffer] = @pixels einfo[:info][:dest_buffer_row_bytes] = @width * FFI::type_size(:int); einfo[:info][:use_color_key] = 0; @@ -93,7 +93,7 @@ describe Efl::Evas do (e1===e3).should be_true e1.free e1.ptr.should be_nil - e4 = Evas::Evas.new Efl::API.evas_new + e4 = Evas::Evas.new Efl::FFI.evas_new e4.ptr.address.should_not eql 0 e5 = e4.dup e4.ptr.address.should eql e5.ptr.address @@ -104,10 +104,10 @@ describe Efl::Evas do end # it "focus should work" do - Efl::API.evas_focus_in @e.ptr - Efl::API.evas_focus_state_get(@e.ptr).should be_true - Efl::API.evas_focus_out @e.ptr - Efl::API.evas_focus_state_get(@e.ptr).should be_false + Efl::FFI.evas_focus_in @e.ptr + Efl::FFI.evas_focus_state_get(@e.ptr).should be_true + Efl::FFI.evas_focus_out @e.ptr + Efl::FFI.evas_focus_state_get(@e.ptr).should be_false Efl::Evas.focus_in @e.ptr Efl::Evas.focus_state_get(@e.ptr).should be_true Efl::Evas.focus_out @e.ptr diff --git a/tools/genruby.rb b/tools/genruby.rb index e327265..c77cc28 100755 --- a/tools/genruby.rb +++ b/tools/genruby.rb @@ -33,11 +33,11 @@ module Efl # module MNAME def self.method_missing m, *args, &block - return Efl::API.send 'MBASE_'+m.to_s, *args, &block + return Efl::FFI.send 'MBASE_'+m.to_s, *args, &block end end # - module API + module FFI # EOF FOOTER =<<-EOF |