summaryrefslogtreecommitdiffstats
path: root/lib/efl/eina_list.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-04 23:42:07 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-04 23:42:07 +0200
commite4baccaefd209a25daa3ff8d5277fe86aca1d379 (patch)
treeeb2744b7a8624a7538cb0224d40879074c819653 /lib/efl/eina_list.rb
parent3974ea1fb3734cbf4150c759eebdf8a93d77dc8b (diff)
downloadffi-efl-e4baccaefd209a25daa3ff8d5277fe86aca1d379.zip
ffi-efl-e4baccaefd209a25daa3ff8d5277fe86aca1d379.tar.gz
FFI are in separate namespaces (Efl::Evas::Native), ruby classes are in upper level (Efl::Evas)seperate-natives
Diffstat (limited to 'lib/efl/eina_list.rb')
-rw-r--r--lib/efl/eina_list.rb29
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/efl/eina_list.rb b/lib/efl/eina_list.rb
index 0d73c29..7d756ad 100644
--- a/lib/efl/eina_list.rb
+++ b/lib/efl/eina_list.rb
@@ -1,23 +1,26 @@
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
-require 'efl/ffi/eina_list'
+require 'efl/native/eina_list'
#
module Efl
module EinaList
#
- class EinaListStruct < FFI::Struct
- layout :data, :pointer,
- :next, :pointer,
- :prev, :pointer,
- :accounting, :pointer,
- :magic, :uint
+ module Native
+ #
+ class EinaListStruct < FFI::Struct
+ layout :data, :pointer,
+ :next, :pointer,
+ :prev, :pointer,
+ :accounting, :pointer,
+ :magic, :uint
+ end
end
#
class REinaList
include Enumerable
include Efl::ClassHelper
- proxy_list [Efl::EinaList,'eina_list_'].freeze
+ proxy_list [Efl::EinaList::Native,'eina_list_'].freeze
def initialize o=nil
@ptr = (
case o
@@ -26,21 +29,21 @@ module Efl
when NilClass
FFI::Pointer::NULL
when Array
- o.inject(FFI::Pointer::NULL) { |p,e| Efl::EinaList.eina_list_append p, e }
+ o.inject(FFI::Pointer::NULL) { |p,e| Native.eina_list_append p, e }
else
raise ArgumentError.new "wrong argument #{o.class.name}"
end
)
end
def free
- Efl::EinaList.eina_list_free @ptr
+ Native.eina_list_free @ptr
@ptr = nil
end
def each
return if not block_given?
p = @ptr
while p!=::FFI::Pointer::NULL
- l = Efl::EinaList::EinaListStruct.new p
+ l = Native::EinaListStruct.new p
yield l[:data]
p = l[:next]
end
@@ -50,11 +53,11 @@ module Efl
end
# for fun and tests
def append p
- @ptr = Efl::EinaList.eina_list_append @ptr, p
+ @ptr = Native.eina_list_append @ptr, p
end
alias :<< :append
def prepend p
- @ptr = Efl::EinaList.eina_list_prepend @ptr, p
+ @ptr = Native.eina_list_prepend @ptr, p
end
alias :unshift :prepend
end