ffi-efl 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +5 -0
- data/MIT-LICENSE +2 -2
- data/README.rdoc +35 -10
- data/lib/efl/ecore_evas.rb +1 -1
- data/lib/efl/ecore_getopt.rb +183 -102
- data/lib/efl/edje.rb +7 -7
- data/lib/efl/eina_list.rb +10 -2
- data/lib/efl/elementary.rb +163 -28
- data/lib/efl/evas.rb +130 -123
- data/lib/efl/ffi.rb +33 -2
- data/lib/efl/native/ecore.rb +202 -157
- data/lib/efl/native/ecore_evas.rb +74 -71
- data/lib/efl/native/ecore_getopt.rb +4 -3
- data/lib/efl/native/ecore_input.rb +4 -3
- data/lib/efl/native/edje.rb +12 -4
- data/lib/efl/native/eet.rb +16 -3
- data/lib/efl/native/eina.rb +8 -3
- data/lib/efl/native/eina_hash.rb +6 -3
- data/lib/efl/native/eina_list.rb +4 -3
- data/lib/efl/native/eina_log.rb +4 -3
- data/lib/efl/native/eina_types.rb +4 -3
- data/lib/efl/native/elementary.rb +547 -407
- data/lib/efl/native/emap.rb +93 -0
- data/lib/efl/native/evas.rb +101 -63
- data/lib/efl.rb +1 -1
- data/spec/ecore_evas_spec.rb +2 -2
- data/spec/ecore_getopt_spec.rb +132 -145
- data/spec/ecore_input_spec.rb +10 -6
- data/spec/ecore_spec.rb +19 -13
- data/spec/edje_spec.rb +13 -11
- data/spec/eet_spec.rb +12 -10
- data/spec/eina_hash_spec.rb +6 -6
- data/spec/eina_list_spec.rb +36 -9
- data/spec/eina_log_spec.rb +12 -24
- data/spec/eina_spec.rb +22 -11
- data/spec/elm_spec.rb +17 -50
- data/spec/evas_spec.rb +14 -12
- data/tasks/gem.rake +1 -1
- data/tasks/helpers.rb +1 -1
- data/tasks/rdoc.rake +4 -4
- data/tasks/svn.rake +1 -1
- data/test/test_elm_win.rb +9 -8
- metadata +7 -6
data/Changelog
CHANGED
data/MIT-LICENSE
CHANGED
@@ -6,10 +6,10 @@ deal in the Software without restriction, including without limitation the
|
|
6
6
|
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
7
|
sell copies of the Software, and to permit persons to whom the Software is
|
8
8
|
furnished to do so, subject to the following conditions:
|
9
|
-
|
9
|
+
|
10
10
|
The above copyright notice and this permission notice shall be included in
|
11
11
|
all copies or substantial portions of the Software.
|
12
|
-
|
12
|
+
|
13
13
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
14
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
15
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
data/README.rdoc
CHANGED
@@ -8,23 +8,48 @@ A ruby-ffi binding to efl libraries (Enlightenment Foundation Libraries).
|
|
8
8
|
|
9
9
|
== FEATURES/PROBLEMS:
|
10
10
|
|
11
|
-
*
|
11
|
+
* pretty young project ...
|
12
12
|
|
13
13
|
== SYNOPSIS:
|
14
14
|
|
15
|
-
require 'efl'
|
16
|
-
|
17
|
-
Efl::
|
18
|
-
|
15
|
+
require 'efl/elementary'
|
16
|
+
|
17
|
+
Efl::Elm.init
|
18
|
+
|
19
|
+
on_exit = Proc.new do |data, evas_object, event_info|
|
20
|
+
puts "EXIT #{data.read_string}"
|
21
|
+
Efl::Elm.exit
|
19
22
|
end
|
20
|
-
|
21
|
-
|
23
|
+
|
24
|
+
win = Efl::Elm::ElmWin.new nil, "Window name" do |w|
|
25
|
+
w.title = "My title"
|
26
|
+
w.alpha = true
|
27
|
+
w.move 300, 300
|
28
|
+
w.resize 200, 100
|
29
|
+
bg = Efl::Elm::ElmBg.new w do |bg|
|
30
|
+
bg.size_hint_weight_expand
|
31
|
+
bg.size_hint_align_fill
|
32
|
+
bg.evas_object_color_set 200,255,100,150
|
33
|
+
bg.show
|
34
|
+
end
|
35
|
+
w.resize_object_add bg
|
36
|
+
lb = Efl::Elm::ElmLabel.new w do |lb|
|
37
|
+
lb.label_set "Hello World!"
|
38
|
+
lb.size_hint_weight_set 1.0, 1.0
|
39
|
+
end
|
40
|
+
lb.show
|
41
|
+
w.resize_object_add lb
|
42
|
+
w.smart_callback_add "delete,request", on_exit, FFI::MemoryPointer.from_string("my data")
|
22
43
|
end
|
23
|
-
Efl::Eet.shutdown
|
24
44
|
|
25
|
-
|
45
|
+
win.show
|
46
|
+
|
47
|
+
Efl::Elm.run
|
48
|
+
Efl::Elm.shutdown
|
49
|
+
|
50
|
+
For more examples you may look at:
|
26
51
|
|
27
|
-
* the spec/ and test/ folders
|
52
|
+
* the spec/[https://github.com/jeremyz/ffi-efl/tree/master/spec] and test/[https://github.com/jeremyz/ffi-efl/tree/master/test] folders
|
28
53
|
|
29
54
|
== REQUIREMENTS:
|
30
55
|
|
data/lib/efl/ecore_evas.rb
CHANGED
data/lib/efl/ecore_getopt.rb
CHANGED
@@ -19,6 +19,10 @@ module Efl
|
|
19
19
|
:doublep, :double_p,
|
20
20
|
:listp, :eina_list_p,
|
21
21
|
:ptrp, :void_p
|
22
|
+
|
23
|
+
def value_ptr idx
|
24
|
+
Native::EcoreGetoptValue.new to_ptr+(idx*Native::EcoreGetoptValue.size)
|
25
|
+
end
|
22
26
|
end
|
23
27
|
#
|
24
28
|
class EcoreGetoptDescStoreDef < FFI::Union
|
@@ -85,49 +89,112 @@ module Efl
|
|
85
89
|
module EcoreGetopt
|
86
90
|
#
|
87
91
|
class REcoreGetopt
|
92
|
+
#
|
88
93
|
def initialize desc
|
89
|
-
@
|
94
|
+
@pts = []
|
95
|
+
@ecore_getopt_st = nil
|
96
|
+
@ecore_values_st = nil
|
90
97
|
@desc = desc
|
91
98
|
@options = [
|
92
99
|
[ 0 ],
|
93
100
|
]
|
94
|
-
@values =
|
95
|
-
[ :
|
96
|
-
|
97
|
-
@
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
+
@values = {
|
102
|
+
:sentinel0 => [ :pointer, FFI::Pointer::NULL ]
|
103
|
+
}
|
104
|
+
@values_order = [ :sentinel0 ]
|
105
|
+
@types = {
|
106
|
+
:string => [ :ecore_getopt_type_str, :strv, :strp ],
|
107
|
+
:uchar => [ :ecore_getopt_type_bool, :boolv, :boolp ],
|
108
|
+
:short => [ :ecore_getopt_type_short, :shortv, :shortp ],
|
109
|
+
:int => [ :ecore_getopt_type_int, :intv, :intp ],
|
110
|
+
:long => [ :ecore_getopt_type_long, :longv, :longp ],
|
111
|
+
:ushort => [ :ecore_getopt_type_ushort, :ushortv, :ushortp ],
|
112
|
+
:uint => [ :ecore_getopt_type_uint, :uintv, :uintp ],
|
113
|
+
:ulong => [ :ecore_getopt_type_ulong, :ulongv, :ulongp ],
|
114
|
+
:double => [ :ecore_getopt_type_double, :doublev, :doublep ],
|
115
|
+
:list => [ :list, nil, :listp ],
|
116
|
+
:pointer=> [ :pointer, nil, :ptrp ],
|
117
|
+
:choice => [ :pointer, nil, :ptrp ]
|
118
|
+
}
|
119
|
+
end
|
120
|
+
def want_p r
|
121
|
+
return r if r.is_a? FFI::Pointer
|
122
|
+
return FFI::Pointer::NULL if r.nil?
|
101
123
|
p = FFI::MemoryPointer.from_string r
|
102
|
-
@
|
124
|
+
@pts << p
|
103
125
|
p
|
104
126
|
end
|
105
|
-
private :
|
106
|
-
def
|
127
|
+
private :want_p
|
128
|
+
def set_option o
|
107
129
|
@options.insert -2, o
|
108
130
|
end
|
109
|
-
def
|
110
|
-
|
131
|
+
def set_value key, ptype, val=nil
|
132
|
+
skey = key.to_s
|
133
|
+
r = @values[skey]
|
134
|
+
if r.nil?
|
135
|
+
case ptype
|
136
|
+
when :list
|
137
|
+
p = FFI::MemoryPointer.new :pointer
|
138
|
+
p.write_pointer val[0]
|
139
|
+
r = @values[skey] = [ ptype, p, val[1] ] # add sub_type info
|
140
|
+
when :choice
|
141
|
+
p = FFI::MemoryPointer.new :pointer
|
142
|
+
p.write_pointer FFI::Pointer::NULL
|
143
|
+
r = @values[skey] = [ ptype, p ]
|
144
|
+
when :string
|
145
|
+
p = FFI::MemoryPointer.new :pointer
|
146
|
+
p.write_pointer FFI::Pointer::NULL
|
147
|
+
r = @values[skey] = [ ptype, p ]
|
148
|
+
when :pointer
|
149
|
+
r = @values[skey] = [ ptype, val ]
|
150
|
+
else
|
151
|
+
p = FFI::MemoryPointer.new ptype
|
152
|
+
p.send 'write_'+ptype.to_s, val unless val.nil?
|
153
|
+
r = @values[skey] = [ ptype, p ]
|
154
|
+
end
|
155
|
+
@pts << p
|
156
|
+
end
|
157
|
+
@values_order.insert -2, skey
|
158
|
+
r
|
159
|
+
end
|
160
|
+
def [] k
|
161
|
+
ptype, ptr, sub_type = @values[k.to_s]
|
162
|
+
return nil if ptype.nil?
|
163
|
+
case ptype
|
164
|
+
when:list
|
165
|
+
require 'efl/eina_list'
|
166
|
+
Efl::EinaList::REinaList.new(ptr.read_pointer).to_a sub_type
|
167
|
+
when :choice
|
168
|
+
p = ptr.read_pointer
|
169
|
+
( p==FFI::Pointer::NULL ? nil : p.read_string )
|
170
|
+
when :string
|
171
|
+
p = ptr.read_pointer
|
172
|
+
(p==FFI::Pointer::NULL ? nil : p.read_string )
|
173
|
+
when :pointer
|
174
|
+
ptr.to_ptr
|
175
|
+
else
|
176
|
+
ptr.send 'read_'+ptype.to_s
|
177
|
+
end
|
111
178
|
end
|
112
179
|
def to_ptr
|
113
|
-
@
|
180
|
+
( @ecore_getopt_st.nil? ? nil : @ecore_getopt_st.to_ptr )
|
114
181
|
end
|
115
182
|
def create
|
116
|
-
@
|
183
|
+
@ecore_getopt_st = Native::EcoreGetopt.new( FFI::MemoryPointer.new( :uchar, Native::EcoreGetopt.size+Native::EcoreGetoptDesc.size*@options.length) )
|
117
184
|
[:prog,:usage,:version,:copyright,:license,:description].each do |sym|
|
118
|
-
@
|
185
|
+
@ecore_getopt_st[sym] = ( @desc.has_key?(sym) ? FFI::MemoryPointer.from_string(@desc[sym]) : FFI::Pointer::NULL )
|
119
186
|
end
|
120
|
-
@
|
187
|
+
@ecore_getopt_st[:strict] = @desc[:strict] if @desc.has_key? :strict
|
121
188
|
@options.each_with_index do |o,i|
|
122
|
-
d = @
|
189
|
+
d = @ecore_getopt_st.desc_ptr i
|
123
190
|
if o[0]==0
|
124
191
|
d[:shortname] = d[:longname] = d[:help] = d[:metavar] = d[:action] = d[:action_param][:dummy] = 0
|
125
192
|
break
|
126
193
|
end
|
127
194
|
d[:shortname] = o[0].to_s.bytes.first
|
128
|
-
d[:longname] =
|
129
|
-
d[:help] =
|
130
|
-
d[:metavar] = o[3]
|
195
|
+
d[:longname] = want_p o[1]
|
196
|
+
d[:help] = want_p o[2]
|
197
|
+
d[:metavar] = want_p o[3]
|
131
198
|
d[:action] = o[4]
|
132
199
|
k, v = o[5]
|
133
200
|
case k
|
@@ -143,13 +210,7 @@ module Efl
|
|
143
210
|
st = d[:action_param][:store]
|
144
211
|
st[:type] = v[0]
|
145
212
|
st[:arg_req] = v[1]
|
146
|
-
|
147
|
-
if v[2][0]==:strv
|
148
|
-
st[:def][:strv] = p_from_string v[2][1]
|
149
|
-
else
|
150
|
-
st[:def][v[2][0]] = v[2][1]
|
151
|
-
end
|
152
|
-
end
|
213
|
+
st[:def][v[2]] = (v[2]==:strv ? want_p(v[3]) : v[3] ) unless v[3].nil?
|
153
214
|
when :store_const
|
154
215
|
d[:action_param][:store_const] = v
|
155
216
|
when :choices
|
@@ -160,119 +221,139 @@ module Efl
|
|
160
221
|
d[:action_param][:dummy] = FFI::Pointer::NULL
|
161
222
|
end
|
162
223
|
end
|
163
|
-
@
|
164
|
-
@
|
165
|
-
|
224
|
+
@ecore_values_st = Native::EcoreGetoptValue.new FFI::MemoryPointer.new Native::EcoreGetoptValue, @values_order.length, false
|
225
|
+
@values_order.each_with_index do |k,i|
|
226
|
+
vtype, vpointer, *sub_type = @values[k]
|
227
|
+
vpointer.write_pointer @ecore_getopt_st.desc_ptr(i)[:action_param][:store][:def][:strv] if vtype==:string
|
228
|
+
etype, vfield, pfield = @types[vtype]
|
229
|
+
@ecore_values_st.value_ptr(i)[pfield] = vpointer
|
166
230
|
end
|
231
|
+
self
|
167
232
|
end
|
168
233
|
def parse argv
|
169
234
|
ptr = FFI::MemoryPointer.new(:pointer, argv.length+1)
|
170
235
|
argv.each_with_index do |s, i|
|
171
|
-
ptr[i].put_pointer 0,
|
236
|
+
ptr[i].put_pointer 0, want_p(s)
|
172
237
|
end
|
173
238
|
ptr[argv.length].put_pointer 0, FFI::Pointer::NULL
|
174
|
-
Native.ecore_getopt_parse @
|
239
|
+
Native.ecore_getopt_parse @ecore_getopt_st, @ecore_values_st, argv.length, ptr
|
175
240
|
end
|
176
|
-
def
|
177
|
-
|
241
|
+
def help short, long, key=nil
|
242
|
+
set_value key||short, :uchar, 0
|
243
|
+
set_option [ short, long, 'show this message.', FFI::Pointer::NULL, :ecore_getopt_action_help, [:dummy,FFI::Pointer::NULL] ]
|
178
244
|
end
|
179
|
-
def
|
180
|
-
|
245
|
+
def version short, long, key=nil
|
246
|
+
set_value key||short, :uchar, 0
|
247
|
+
set_option [ short, long, 'show program version.', FFI::Pointer::NULL, :ecore_getopt_action_version, [:dummy,FFI::Pointer::NULL] ]
|
181
248
|
end
|
182
|
-
def
|
183
|
-
|
249
|
+
def copyright short, long, key=nil
|
250
|
+
set_value key||short, :uchar, 0
|
251
|
+
set_option [ short, long, 'show copyright.', FFI::Pointer::NULL, :ecore_getopt_action_copyright, [:dummy,FFI::Pointer::NULL] ]
|
184
252
|
end
|
185
|
-
def
|
186
|
-
|
253
|
+
def license short, long, key=nil
|
254
|
+
set_value key||short, :uchar, 0
|
255
|
+
set_option [ short, long, 'show license.', FFI::Pointer::NULL, :ecore_getopt_action_license, [:dummy,FFI::Pointer::NULL] ]
|
187
256
|
end
|
188
|
-
def
|
189
|
-
|
257
|
+
def store_full short, long, help, meta, arg_req, type, def_val
|
258
|
+
vtype, vpointer = set_value short, type, def_val
|
259
|
+
etype, vfield, pfield = @types[vtype]
|
260
|
+
set_option [ short, long, help, meta, :ecore_getopt_action_store, [:store, [etype, arg_req, vfield, def_val] ] ]
|
190
261
|
end
|
191
|
-
def
|
192
|
-
store_full short, long, help, FFI::Pointer::NULL,
|
262
|
+
def store short, long, help, type, def_val=nil
|
263
|
+
store_full short, long, help, FFI::Pointer::NULL, :ecore_getopt_desc_arg_requirement_yes, type, def_val
|
193
264
|
end
|
194
|
-
def
|
195
|
-
|
265
|
+
def store_meta short, long, help, meta, type, def_val=nil
|
266
|
+
store_full short, long, help, meta, :ecore_getopt_desc_arg_requirement_yes, type, def_val
|
196
267
|
end
|
197
|
-
def
|
198
|
-
store_full short, long, help,
|
268
|
+
def store_def short, long, help, type, def_val
|
269
|
+
store_full short, long, help, FFI::Pointer::NULL, :ecore_getopt_desc_arg_requirement_optional, type, def_val
|
199
270
|
end
|
200
|
-
def store_const short, long, help, value
|
201
|
-
|
271
|
+
def store_const short, long, help, def_val, value
|
272
|
+
set_value short, :int, def_val
|
273
|
+
set_option [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_store_const, [:store_const, value] ]
|
202
274
|
end
|
203
275
|
def store_true short, long, help
|
204
|
-
|
276
|
+
set_value short, :uchar, 0
|
277
|
+
set_option [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_store_true, [:dummy,FFI::MemoryPointer::NULL] ]
|
205
278
|
end
|
206
279
|
def store_false short, long, help
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
280
|
+
set_value short, :uchar, 1
|
281
|
+
set_option [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_store_false, [:dummy,FFI::MemoryPointer::NULL] ]
|
282
|
+
end
|
283
|
+
def count short, long, help, def_val
|
284
|
+
set_value short, :int, def_val
|
285
|
+
set_option [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_count, [:dummy,FFI::Pointer::NULL] ]
|
286
|
+
end
|
287
|
+
def append_meta short, long, help, meta, sub_type, def_val=nil
|
288
|
+
if def_val.nil?
|
289
|
+
p = FFI::Pointer::NULL
|
290
|
+
else
|
291
|
+
p = def_val.inject(FFI::Pointer::NULL) { |list,e|
|
292
|
+
ptr = FFI::MemoryPointer.new sub_type
|
293
|
+
@pts << ptr
|
294
|
+
ptr.send 'write_'+sub_type.to_s, e
|
295
|
+
Native.eina_list_append list, ptr
|
296
|
+
}
|
213
297
|
end
|
214
|
-
|
215
|
-
|
298
|
+
set_value short, :list, [want_p(p),sub_type]
|
299
|
+
set_option [ short, long, help, meta, :ecore_getopt_action_append, [:append,@types[sub_type][0]] ]
|
216
300
|
end
|
217
|
-
def
|
218
|
-
|
301
|
+
def append short, long, help, sub_type, def_val=nil
|
302
|
+
append_meta short, long, help, FFI::Pointer::NULL, sub_type, def_val
|
303
|
+
end
|
304
|
+
def choice_meta short, long, help, meta, choices
|
305
|
+
p = FFI::MemoryPointer.new(:pointer, choices.length+1)
|
306
|
+
@pts << p
|
219
307
|
choices.each_with_index do |s, i|
|
220
|
-
|
308
|
+
p[i].put_pointer 0, want_p(s)
|
221
309
|
end
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
def append short, long, help, sub_type
|
226
|
-
self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_append, [:append,sub_type] ]
|
227
|
-
end
|
228
|
-
def append_metavar short, long, help, meta, sub_type
|
229
|
-
self << [ short, long, help, meta, :ecore_getopt_action_append, [:append,sub_type] ]
|
310
|
+
p[choices.length].put_pointer 0, FFI::Pointer::NULL
|
311
|
+
set_value short, :choice
|
312
|
+
set_option [ short, long, help, meta, :ecore_getopt_action_choice, [:choices,p] ]
|
230
313
|
end
|
231
|
-
def
|
232
|
-
|
314
|
+
def choice short, long, help, choices
|
315
|
+
choice_meta short, long, help, FFI::Pointer::NULL, choices
|
233
316
|
end
|
234
|
-
def callback_full short, long, help, meta, cb, data, arg_req, def_val
|
235
|
-
|
317
|
+
def callback_full short, long, help, meta, cb, data, arg_req, type, def_val
|
318
|
+
pt, ptr = set_value short, type, def_val
|
319
|
+
arg_req = ( arg_req ? :ecore_getopt_desc_arg_requirement_yes : :ecore_getopt_desc_arg_requirement_no )
|
320
|
+
set_option [ short, long, help, meta, :ecore_getopt_action_callback, [:callback, [cb, want_p(data), arg_req, ptr ] ] ]
|
236
321
|
end
|
237
322
|
def callback_noargs short, long, help, cb, data=nil
|
238
|
-
callback_full short, long, help, FFI::Pointer::NULL, cb, data, :
|
239
|
-
end
|
240
|
-
def callback_args short, long, help, meta, cb, data=nil
|
241
|
-
callback_full short, long, help, meta, cb, data, :ecore_getopt_desc_arg_requirement_yes, FFI::Pointer::NULL
|
242
|
-
end
|
243
|
-
def help short, long
|
244
|
-
self << [ short, long, 'show this message.', FFI::Pointer::NULL, :ecore_getopt_action_help, [:dummy,FFI::Pointer::NULL] ]
|
323
|
+
callback_full short, long, help, FFI::Pointer::NULL, cb, data, false, :uchar, 0
|
245
324
|
end
|
246
|
-
def
|
247
|
-
|
325
|
+
def callback_args short, long, help, meta, cb, data, type, def_val
|
326
|
+
callback_full short, long, help, meta, cb, data, true, type, def_val
|
248
327
|
end
|
249
|
-
def copyright short, long
|
250
|
-
self << [ short, long, 'show copyright.', FFI::Pointer::NULL, :ecore_getopt_action_copyright, [:dummy,FFI::Pointer::NULL] ]
|
251
|
-
end
|
252
|
-
def license short, long
|
253
|
-
self << [ short, long, 'show license.', FFI::Pointer::NULL, :ecore_getopt_action_license, [:dummy,FFI::Pointer::NULL] ]
|
254
|
-
end
|
255
|
-
# def sentinel
|
256
|
-
# self << [ 0, FFI::Pointer::NULL, FFI::Pointer::NULL, FFI::Pointer::NULL, 0, {:dummy=>FFI::Pointer::NULL} ]
|
257
|
-
# end
|
258
328
|
#
|
259
329
|
def debug
|
260
330
|
r = ''
|
261
|
-
r << "#{self.class} : #{@
|
331
|
+
r << "#{self.class} : #{@ecore_getopt_st.to_ptr}\n"
|
262
332
|
[:prog,:usage,:version,:copyright,:license,:description].each do |sym|
|
263
|
-
r<< " #{sym.to_s} : #{@
|
333
|
+
r<< " #{sym.to_s} : #{@ecore_getopt_st[sym]==FFI::Pointer::NULL ? 'NULL' : @ecore_getopt_st[sym].read_string}\n"
|
264
334
|
end
|
265
|
-
r << " strict : #{@
|
335
|
+
r << " strict : #{@ecore_getopt_st[:strict]}\n"
|
266
336
|
i=0
|
337
|
+
r << " Descriptions\n"
|
267
338
|
while true
|
268
|
-
|
269
|
-
break if
|
270
|
-
r << " desc #{
|
271
|
-
r << " short: #{
|
272
|
-
r << " long: #{
|
273
|
-
r << " help: #{
|
339
|
+
st = @ecore_getopt_st.desc_ptr i
|
340
|
+
break if st[:shortname]==0 and st[:longname] == FFI::Pointer::NULL
|
341
|
+
r << " desc #{st.to_ptr}\n"
|
342
|
+
r << " short: #{st[:shortname].chr}\n" unless st[:shortname]==0
|
343
|
+
r << " long: #{st[:longname].read_string}\n" unless st[:longname]==FFI::Pointer::NULL
|
344
|
+
r << " help: #{st[:help].read_string}\n" unless st[:help]==FFI::Pointer::NULL
|
274
345
|
i+=1
|
275
346
|
end
|
347
|
+
r << " Values\n"
|
348
|
+
@values_order.each_with_index do |k,i|
|
349
|
+
st = @ecore_values_st.value_ptr i
|
350
|
+
vtype, vpointer = @values[k]
|
351
|
+
etype, vfield, pfield = @types[vtype]
|
352
|
+
r << " value #{st.to_ptr}\n"
|
353
|
+
r << " key: #{k}\n"
|
354
|
+
r << " type: #{vtype}\n"
|
355
|
+
r << " value: #{self[k]}\n"
|
356
|
+
end
|
276
357
|
r
|
277
358
|
end
|
278
359
|
end
|
data/lib/efl/edje.rb
CHANGED
@@ -18,31 +18,31 @@ module Efl
|
|
18
18
|
#
|
19
19
|
def part_object_get part
|
20
20
|
# EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part);
|
21
|
-
Evas::
|
21
|
+
Evas::REvasObject.new Native.edje_object_part_object_get @ptr, part
|
22
22
|
end
|
23
23
|
def part_swallow_get part
|
24
24
|
# EAPI Evas_Object *edje_object_part_swallow_get (const Evas_Object *obj, const char *part);
|
25
|
-
Evas::
|
25
|
+
Evas::REvasObject.new Native.edje_object_part_swallow_get @ptr, part
|
26
26
|
end
|
27
27
|
def external_object_get part
|
28
28
|
# EAPI Evas_Object *edje_object_part_external_object_get (const Evas_Object *obj, const char *part);
|
29
|
-
Evas::
|
29
|
+
Evas::REvasObject.new Native.edje_object_part_external_object_get @ptr, part
|
30
30
|
end
|
31
31
|
def external_content_get part, content
|
32
32
|
# EAPI Evas_Object *edje_object_part_external_content_get (const Evas_Object *obj, const char *part, const char *content);
|
33
|
-
Evas::
|
33
|
+
Evas::REvasObject.new Native.edje_object_part_external_content_get @ptr, part, content
|
34
34
|
end
|
35
35
|
def part_box_remove part, child
|
36
36
|
# EAPI Evas_Object *edje_object_part_box_remove (Evas_Object *obj, const char *part, Evas_Object *child);
|
37
|
-
Evas::
|
37
|
+
Evas::REvasObject.new Native.edje_object_part_box_remove @ptr, part, child
|
38
38
|
end
|
39
39
|
def part_box_remove_at part, pos
|
40
40
|
# EAPI Evas_Object *edje_object_part_box_remove_at (Evas_Object *obj, const char *part, unsigned int pos);
|
41
|
-
Evas::
|
41
|
+
Evas::REvasObject.new Native.edje_object_part_box_remove_at @ptr, part, pos
|
42
42
|
end
|
43
43
|
def part_table_child_get part, col, row
|
44
44
|
# EAPI Evas_Object *edje_object_part_table_child_get (Evas_Object *obj, const char *part, unsigned int col, unsigned int row);
|
45
|
-
Evas::
|
45
|
+
Evas::REvasObject.new Native.edje_object_part_table_child_get @ptr, part, col, row
|
46
46
|
end
|
47
47
|
def file_get
|
48
48
|
f = FFI::MemoryPointer.new :pointer
|
data/lib/efl/eina_list.rb
CHANGED
@@ -40,6 +40,13 @@ module Efl
|
|
40
40
|
Native.eina_list_free @ptr
|
41
41
|
@ptr = nil
|
42
42
|
end
|
43
|
+
def self.from_a ary, ptrt
|
44
|
+
REinaList.new ary.inject(FFI::Pointer::NULL) { |p,e|
|
45
|
+
ptr = FFI::MemoryPointer.new ptrt
|
46
|
+
ptr.send 'write_'+ptrt.to_s, e
|
47
|
+
Native.eina_list_append p, ptr
|
48
|
+
}
|
49
|
+
end
|
43
50
|
def each
|
44
51
|
return if not block_given?
|
45
52
|
p = @ptr
|
@@ -49,8 +56,9 @@ module Efl
|
|
49
56
|
p = l[:next]
|
50
57
|
end
|
51
58
|
end
|
52
|
-
def to_a
|
53
|
-
inject([]) { |s,e| s<<e }
|
59
|
+
def to_a ptrt=nil
|
60
|
+
return inject([]) { |s,e| s<<e } if ptrt.nil?
|
61
|
+
inject([]) { |s,e| s<< e.send('read_'+ptrt.to_s) }
|
54
62
|
end
|
55
63
|
alias :to_ary :to_a
|
56
64
|
# for fun and tests
|