From 01e968f8f6b3c070db0336b5997c03c36a283e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 5 May 2011 00:38:04 +0200 Subject: proxy_list becomes search_prefixes --- lib/efl/ecore_evas.rb | 2 +- lib/efl/edje.rb | 2 +- lib/efl/eet.rb | 2 +- lib/efl/eina_hash.rb | 2 +- lib/efl/eina_list.rb | 2 +- lib/efl/elementary.rb | 4 ++-- lib/efl/evas.rb | 4 ++-- lib/efl/ffi.rb | 26 +++++++++++++------------- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/efl/ecore_evas.rb b/lib/efl/ecore_evas.rb index 1f209ba..788fac9 100644 --- a/lib/efl/ecore_evas.rb +++ b/lib/efl/ecore_evas.rb @@ -16,7 +16,7 @@ module Efl # class REcoreEvas include Efl::ClassHelper - proxy_list [Efl::Native,'ecore_evas_'].freeze + search_prefixes 'ecore_evas_' def initialize o=nil @ptr = ( case o diff --git a/lib/efl/edje.rb b/lib/efl/edje.rb index 6a71ca7..6808fbc 100644 --- a/lib/efl/edje.rb +++ b/lib/efl/edje.rb @@ -10,7 +10,7 @@ module Efl # class REdje < Efl::Evas::REvasObject # - proxy_list [Efl::Native,'edje_object_'].freeze + search_prefixes 'edje_object_' def part_object_get part # EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part); Evas::RevasObject.new Native.edje_object_part_object_get @ptr, part diff --git a/lib/efl/eet.rb b/lib/efl/eet.rb index 7d0da66..4c000fe 100644 --- a/lib/efl/eet.rb +++ b/lib/efl/eet.rb @@ -10,7 +10,7 @@ module Efl class REetFile # include Efl::ClassHelper - proxy_list [Efl::Native,'eet_'].freeze + search_prefixes 'eet_' # def initialize ptr @ptr=ptr diff --git a/lib/efl/eina_hash.rb b/lib/efl/eina_hash.rb index eb13d4d..d9a782c 100644 --- a/lib/efl/eina_hash.rb +++ b/lib/efl/eina_hash.rb @@ -9,7 +9,7 @@ module Efl class REinaHash include Enumerable include Efl::ClassHelper - proxy_list [Efl::Native,'eina_hash_'].freeze + search_prefixes 'eina_hash_' def initialize o=nil, &block cstr = ( block_given? ? block : Proc.new { Native.eina_hash_string_djb2_new FFI::Pointer::NULL } ) @ptr = ( diff --git a/lib/efl/eina_list.rb b/lib/efl/eina_list.rb index 4a9d459..a2e08f1 100644 --- a/lib/efl/eina_list.rb +++ b/lib/efl/eina_list.rb @@ -21,7 +21,7 @@ module Efl class REinaList include Enumerable include Efl::ClassHelper - proxy_list [Efl::Native,'eina_list_'].freeze + search_prefixes 'eina_list_' def initialize o=nil @ptr = ( case o diff --git a/lib/efl/elementary.rb b/lib/efl/elementary.rb index d11542f..2b0cd22 100644 --- a/lib/efl/elementary.rb +++ b/lib/efl/elementary.rb @@ -4,7 +4,7 @@ require 'efl/evas' require 'efl/native/elementary' # -Efl::Evas::REvasObject.proxy_list << [Efl::Native,'elm_'].freeze # append not prepend ! +Efl::Evas::REvasObject.search_prefixes << 'elm_' # append not prepend ! # module Efl module Elm @@ -23,7 +23,7 @@ module Efl # class ElmWin include Efl::ClassHelper - proxy_list [Efl::Native,'elm_win_'].freeze, [Efl::Native,'elm_'].freeze + search_prefixes 'elm_win_', 'elm_' def initialize parent, title, type=:elm_win_basic @evas_object = Evas::REvasObject.new Native.elm_win_add parent, title, type @ptr = @evas_object.to_ptr diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb index 05ca491..1dcc1a4 100644 --- a/lib/efl/evas.rb +++ b/lib/efl/evas.rb @@ -48,7 +48,7 @@ module Efl class REvas # include Efl::ClassHelper - proxy_list [Efl::Native,'evas_'].freeze + search_prefixes 'evas_' # def initialize o=nil @ptr = ( @@ -108,7 +108,7 @@ module Efl class REvasObject # include Efl::ClassHelper - proxy_list [Efl::Native,'evas_object_'].freeze, [Efl::Native,'evas_'].freeze + search_prefixes 'evas_object_', 'evas_' # def initialize o=nil @ptr = ( diff --git a/lib/efl/ffi.rb b/lib/efl/ffi.rb index 5e36bab..0f8e8e9 100644 --- a/lib/efl/ffi.rb +++ b/lib/efl/ffi.rb @@ -72,15 +72,15 @@ module Efl def === o; @ptr === o.to_ptr; end def address; @ptr.address; end def self.included kls - # create class instance @proxy_list - kls.class_eval "@proxy_list ||=[]" - # access and prepend *args to @proxy_list - kls.class_eval "def self.proxy_list *args; @proxy_list.unshift *args unless args.empty?; @proxy_list; end" - # on inheritance, copy ancestor's @proxy_list + # create class instance @search_prefixes + kls.class_eval "@search_prefixes ||=[]" + # access and prepend *args to @search_prefixes + kls.class_eval "def self.search_prefixes *args; @search_prefixes.unshift *args unless args.empty?; @search_prefixes; end" + # on inheritance, copy ancestor's @search_prefixes kls.class_eval <<-EOF def self.inherited sub - sub.class_eval '@proxy_list = []' - sub.proxy_list *self.proxy_list + sub.class_eval '@search_prefixes = []' + sub.search_prefixes *self.search_prefixes end EOF end @@ -95,18 +95,18 @@ module Efl else args_s = '*args' end - self.class.proxy_list.each do |mod,p| + self.class.search_prefixes.each do |p| sym = p+m_s - if mod.respond_to? sym - self.class.class_eval "def #{m} *args, █ r=#{mod.name}.#{sym}(@ptr,#{args_s}); yield r if block_given?; r; end" + if Efl::Native.respond_to? sym + self.class.class_eval "def #{m} *args, █ r=#{Efl::Native.name}.#{sym}(@ptr,#{args_s}); yield r if block_given?; r; end" return self.send m, *args, &block - elsif mod.respond_to? m - self.class.class_eval "def #{m} *args, █ r=#{mod.name}.#{m}(@ptr,#{args_s}); yield r if block_given?; r; end" + elsif Efl::Native.respond_to? m + self.class.class_eval "def #{m} *args, █ r=#{Efl::Native.name}.#{m}(@ptr,#{args_s}); yield r if block_given?; r; end" return self.send m, *args, &block end end return [self.to_s+' ['+self.to_ptr.to_s+']'] if m_s=~/^to_ary$/ - Kernel.raise NameError.new "#{self.class.name} is unable to resolve #{m} within #{self.class.proxy_list.inspect}" + Kernel.raise NameError.new "#{self.class.name} is unable to resolve #{m} within #{self.class.search_prefixes.inspect}" end end end -- cgit v1.1-2-g2b99