ffi-efl 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog +6 -0
- data/README.rdoc +3 -1
- data/Rakefile +2 -1
- data/lib/efl/ecore/ecore-ffi.rb +2 -2
- data/lib/efl/ecore_getopt.rb +244 -11
- data/lib/efl/elementary/elementary-ffi.rb +34 -0
- data/lib/efl/ffi.rb +10 -3
- data/lib/efl.rb +9 -6
- data/spec/ecore_getopt_spec.rb +262 -29
- metadata +4 -2
data/Changelog
CHANGED
@@ -1,2 +1,8 @@
|
|
1
|
+
2011-04-25 Jérémy Zurcher <jeremy@asynk.ch>
|
2
|
+
* release 0.2.0
|
3
|
+
* ecore getopt seems good
|
4
|
+
* basis of module function mapping and class method_missing usage setup
|
5
|
+
* small elementary elm_Win test app
|
6
|
+
|
1
7
|
2011-04-08 Jérémy Zurcher <jeremy@asynk.ch>
|
2
8
|
* Project creation
|
data/README.rdoc
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
ffi-efl
|
2
2
|
by Jérémy Zurcher
|
3
|
-
http://
|
3
|
+
http://asynk.ch
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
7
|
ffi-efl is a FFI[https://github.com/ffi/ffi/wiki] binding to Enlightenment Foundation Libraries (eina,eet,evas,ecore,edje...)
|
8
8
|
base components of the Enlightenment project. (EFL API[http://www.enlightenment.org/p.php?p=docs&l=en])
|
9
9
|
|
10
|
+
ffi-efl project is developed on asynk[http://cgit.asynk.ch/cgi-bin/cgit/ffi-efl], github[https://github.com/jeremyz] and gitorious[https://gitorious.org/~jeyzu]
|
11
|
+
|
10
12
|
== FEATURES/PROBLEMS:
|
11
13
|
|
12
14
|
* Project just started
|
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- coding: UTF-8 -*-
|
2
2
|
#
|
3
|
+
require './lib/efl.rb'
|
3
4
|
load './tasks/setup.rb'
|
4
5
|
#
|
5
6
|
# Project general information
|
@@ -7,7 +8,7 @@ PROJ.name = 'ffi-efl'
|
|
7
8
|
PROJ.authors = 'Jérémy Zurcher'
|
8
9
|
PROJ.email = 'jeremy@asynk.ch'
|
9
10
|
PROJ.url = 'https://github.com/jeremyz/ffi-efl'
|
10
|
-
PROJ.version =
|
11
|
+
PROJ.version = Efl::VERSION
|
11
12
|
PROJ.rubyforge.name = 'ffi-efl'
|
12
13
|
PROJ.readme_file = 'README.rdoc'
|
13
14
|
#
|
data/lib/efl/ecore/ecore-ffi.rb
CHANGED
@@ -351,8 +351,8 @@ module Efl
|
|
351
351
|
[ :ecore_timer_precision_set, [ :double ], :void ],
|
352
352
|
# EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, const void *data);
|
353
353
|
[ :ecore_animator_add, [ :ecore_task_cb, :void_p ], :ecore_animator_p ],
|
354
|
-
# EAPI Ecore_Animator *
|
355
|
-
[ :
|
354
|
+
# EAPI Ecore_Animator *ecore_animator_timeline_add(double runtime, Ecore_Timeline_Cb func, const void *data);
|
355
|
+
[ :ecore_animator_timeline_add, [ :double, :ecore_timeline_cb, :void_p ], :ecore_animator_p ],
|
356
356
|
# EAPI void *ecore_animator_del(Ecore_Animator *animator);
|
357
357
|
[ :ecore_animator_del, [ :ecore_animator_p ], :void_p ],
|
358
358
|
# EAPI void ecore_animator_freeze(Ecore_Animator *animator);
|
data/lib/efl/ecore_getopt.rb
CHANGED
@@ -6,25 +6,65 @@ require 'efl/ecore/ecore_getopt-ffi'
|
|
6
6
|
module Efl
|
7
7
|
module API
|
8
8
|
#
|
9
|
-
class
|
10
|
-
layout :
|
9
|
+
class EcoreGetoptValue < FFI::Union
|
10
|
+
layout :strp, :pointer,
|
11
|
+
:boolp, :eina_bool_p,
|
12
|
+
:shortp, :short_p,
|
13
|
+
:intp, :int_p,
|
14
|
+
:longp, :long_p,
|
15
|
+
:ushortp, :ushort_p,
|
16
|
+
:uintp, :uint_p,
|
17
|
+
:ulongp, :ulong_p,
|
18
|
+
:doublep, :double_p,
|
19
|
+
:listp, :eina_list_p,
|
20
|
+
:ptrp, :void_p,
|
11
21
|
end
|
12
|
-
|
13
|
-
|
22
|
+
#
|
23
|
+
class EcoreGetoptDescStoreDef < FFI::Union
|
24
|
+
layout :strv, :pointer,
|
25
|
+
:boolv, :uchar,
|
26
|
+
:shortv, :short,
|
27
|
+
:intv, :int,
|
28
|
+
:longv, :long,
|
29
|
+
:ushortv, :ushort,
|
30
|
+
:uintv, :uint,
|
31
|
+
:ulongv, :ulong,
|
32
|
+
:doublev, :double,
|
33
|
+
end
|
34
|
+
#
|
35
|
+
class EcoreGetoptDescStore < FFI::Struct
|
36
|
+
layout :type, :ecore_getopt_type, # enum
|
37
|
+
:arg_req, :ecore_getopt_desc_arg_requirement, # enum
|
38
|
+
:def, EcoreGetoptDescStoreDef,
|
39
|
+
end
|
40
|
+
#
|
41
|
+
callback :ecore_getopt_desc_cb, [:ecore_getopt_p, :ecore_getopt_desc_p, :string, :pointer, :ecore_getopt_value_p ], :eina_bool
|
42
|
+
#
|
43
|
+
class EcoreGetoptDescCallback < FFI::Struct
|
44
|
+
layout :func, :ecore_getopt_desc_cb,
|
45
|
+
:data, :pointer,
|
46
|
+
:arg_req, :ecore_getopt_desc_arg_requirement, # enum
|
47
|
+
:def, :pointer,
|
48
|
+
end
|
49
|
+
#
|
50
|
+
class EcoreActionParam < FFI::Union
|
51
|
+
layout :store, EcoreGetoptDescStore,
|
14
52
|
:store_const, :pointer,
|
15
53
|
:choices, :pointer,
|
16
|
-
:append_type, :ecore_getopt_type,
|
17
|
-
:callback,
|
54
|
+
:append_type, :ecore_getopt_type, # enum
|
55
|
+
:callback, EcoreGetoptDescCallback,
|
18
56
|
:dummy, :pointer,
|
19
57
|
end
|
20
|
-
|
58
|
+
#
|
59
|
+
class EcoreGetoptDesc < FFI::Struct
|
21
60
|
layout :shortname, :char,
|
22
61
|
:longname, :pointer,
|
23
62
|
:help, :pointer,
|
24
63
|
:metavar, :pointer,
|
25
|
-
:action, :ecore_getopt_action,
|
26
|
-
:action_param,
|
64
|
+
:action, :ecore_getopt_action, # enum
|
65
|
+
:action_param, EcoreActionParam,
|
27
66
|
end
|
67
|
+
#
|
28
68
|
class EcoreGetopt < FFI::Struct
|
29
69
|
layout :prog, :pointer,
|
30
70
|
:usage, :pointer,
|
@@ -32,12 +72,205 @@ module Efl
|
|
32
72
|
:copyright, :pointer,
|
33
73
|
:license, :pointer,
|
34
74
|
:description, :pointer,
|
35
|
-
:strict, :char
|
36
|
-
:descs, :pointer
|
75
|
+
:strict, :char
|
76
|
+
# :descs, :pointer, # NULL terminated EcoreGetopt_Desc[]
|
77
|
+
|
78
|
+
def desc_ptr idx
|
79
|
+
EcoreGetoptDesc.new to_ptr+Efl::API::EcoreGetopt.size+(idx*Efl::API::EcoreGetoptDesc.size)
|
80
|
+
end
|
37
81
|
end
|
38
82
|
#
|
39
83
|
end
|
40
84
|
#
|
85
|
+
module EcoreGetopt
|
86
|
+
class Parser
|
87
|
+
def initialize desc
|
88
|
+
@desc = desc
|
89
|
+
@options = [
|
90
|
+
[ 0, FFI::Pointer::NULL, FFI::Pointer::NULL, FFI::Pointer::NULL, 0, {:dummy=>FFI::Pointer::NULL} ]
|
91
|
+
]
|
92
|
+
@values = [
|
93
|
+
[ :ptrp, FFI::Pointer::NULL ]
|
94
|
+
]
|
95
|
+
@refs = [] # to prevent FFI::MemoryPointer.from_string from beeing GC'ed
|
96
|
+
end
|
97
|
+
def p_from_string r
|
98
|
+
return r if r==FFI::Pointer::NULL
|
99
|
+
p = FFI::MemoryPointer.from_string r
|
100
|
+
@refs << p
|
101
|
+
p
|
102
|
+
end
|
103
|
+
def << o
|
104
|
+
@options.insert -2, o
|
105
|
+
end
|
106
|
+
def value type, ptr
|
107
|
+
@values.insert -2, [ type, ptr ]
|
108
|
+
end
|
109
|
+
def to_ptr
|
110
|
+
@parser_p.to_ptr
|
111
|
+
end
|
112
|
+
def create
|
113
|
+
@parser_p = Efl::API::EcoreGetopt.new FFI::MemoryPointer.new (Efl::API::EcoreGetopt.size+Efl::API::EcoreGetoptDesc.size*@options.length), 1
|
114
|
+
[:prog,:usage,:version,:copyright,:license,:description].each do |sym|
|
115
|
+
@parser_p[sym] = ( @desc.has_key?(sym) ? FFI::MemoryPointer.from_string(@desc[sym]) : FFI::Pointer::NULL )
|
116
|
+
end
|
117
|
+
@parser_p[:strict] = @desc[:strict] if @desc.has_key? :strict
|
118
|
+
@options.each_with_index do |o,i|
|
119
|
+
d = @parser_p.desc_ptr i
|
120
|
+
d[:shortname] = o[0].ord
|
121
|
+
d[:longname] = p_from_string o[1]
|
122
|
+
d[:help] = p_from_string o[2]
|
123
|
+
d[:metavar] = o[3]
|
124
|
+
d[:action] = o[4]
|
125
|
+
k, v = o[5]
|
126
|
+
case k
|
127
|
+
when :dummy
|
128
|
+
d[:action_param][:dummy] = v
|
129
|
+
when :callback
|
130
|
+
cb = d[:action_param][:callback]
|
131
|
+
cb[:func] = v[0]
|
132
|
+
cb[:data] = v[1]
|
133
|
+
cb[:arg_req] = v[2]
|
134
|
+
cb[:def] = v[3]
|
135
|
+
when :store
|
136
|
+
st = d[:action_param][:store]
|
137
|
+
st[:type] = v[0]
|
138
|
+
st[:arg_req] = v[1]
|
139
|
+
if not v[2].nil?
|
140
|
+
if v[2][0]==:strv
|
141
|
+
st[:def][:strv] = p_from_string v[2][1]
|
142
|
+
else
|
143
|
+
st[:def][v[2][0]] = v[2][1]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
when :store_const
|
147
|
+
d[:action_param][:store_const] = v
|
148
|
+
when :choices
|
149
|
+
d[:action_param][:choices] = v
|
150
|
+
when :append
|
151
|
+
d[:action_param][:append_type] = v
|
152
|
+
else
|
153
|
+
d[:action_param][:dummy] = FFI::Pointer::NULL
|
154
|
+
end
|
155
|
+
end
|
156
|
+
@values_p = FFI::MemoryPointer.new Efl::API::EcoreGetoptValue, @values.length, false
|
157
|
+
@values.each_with_index do |v,i|
|
158
|
+
Efl::API::EcoreGetoptValue.new(@values_p+(i*Efl::API::EcoreGetoptValue.size))[v[0]] = v[1]
|
159
|
+
end
|
160
|
+
end
|
161
|
+
def parse argv
|
162
|
+
ptr = FFI::MemoryPointer.new(:pointer, argv.length+1)
|
163
|
+
argv.each_with_index do |s, i|
|
164
|
+
ptr[i].put_pointer 0, p_from_string(s)
|
165
|
+
end
|
166
|
+
ptr[argv.length].put_pointer 0, FFI::Pointer::NULL
|
167
|
+
Efl::EcoreGetopt.parse @parser_p, @values_p, argv.length, ptr
|
168
|
+
end
|
169
|
+
def store_full short, long, help, meta, type, arg_req, def_val
|
170
|
+
self << [ short, long, help, meta, :ecore_getopt_action_store, [:store, [type,arg_req, def_val] ] ]
|
171
|
+
end
|
172
|
+
def store short, long, help, type
|
173
|
+
store_full short, long, help, FFI::Pointer::NULL, type, :ecore_getopt_desc_arg_requirement_yes, nil
|
174
|
+
end
|
175
|
+
def store_type type, short, long, help
|
176
|
+
store short, long, help, ('ecore_getopt_type_'+type.to_s).to_sym
|
177
|
+
end
|
178
|
+
def store_metavar short, long, help, meta, type
|
179
|
+
store_full short, long, help, meta, type, :ecore_getopt_desc_arg_requirement_yes, nil
|
180
|
+
end
|
181
|
+
def store_meta_type type, short, long, help, meta
|
182
|
+
store_metavar short, long, help, meta, ('ecore_getopt_type_'+type.to_s).to_sym
|
183
|
+
end
|
184
|
+
def store_def short, long, help, type, def_val
|
185
|
+
store_full short, long, help, FFI::Pointer::NULL, type, :ecore_getopt_desc_arg_requirement_optional, def_val
|
186
|
+
end
|
187
|
+
def store_def_type type, short, long, help, def_val
|
188
|
+
store_def short, long, help, ('ecore_getopt_type_'+type.to_s).to_sym, [ (type.to_s+'v').to_sym, def_val ]
|
189
|
+
end
|
190
|
+
def store_full_type type, short, long, help, meta, arg_req, def_val
|
191
|
+
store_full short, long, help, meta, ('ecore_getopt_type_'+type.to_s).to_sym, arg_req, [ (type.to_s+'v').to_sym, def_val ]
|
192
|
+
end
|
193
|
+
def store_const short, long, help, value
|
194
|
+
self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_store_const, [:store_const, value] ]
|
195
|
+
end
|
196
|
+
def store_true short, long, help
|
197
|
+
self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_store_true, [:dummy,FFI::MemoryPointer::NULL] ]
|
198
|
+
end
|
199
|
+
def store_false short, long, help
|
200
|
+
self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_store_false, [:dummy,FFI::MemoryPointer::NULL] ]
|
201
|
+
end
|
202
|
+
def choice short, long, help, choices
|
203
|
+
ptr = FFI::MemoryPointer.new(:pointer, choices.length+1)
|
204
|
+
choices.each_with_index do |s, i|
|
205
|
+
ptr[i].put_pointer 0, p_from_string(s)
|
206
|
+
end
|
207
|
+
ptr[choices.length].put_pointer 0, FFI::Pointer::NULL
|
208
|
+
self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_choice, [:choices,ptr] ]
|
209
|
+
end
|
210
|
+
def choice_metavar short, long, help, meta, choices
|
211
|
+
ptr = FFI::MemoryPointer.new(:pointer, choices.length+1)
|
212
|
+
choices.each_with_index do |s, i|
|
213
|
+
ptr[i].put_pointer 0, p_from_string(s)
|
214
|
+
end
|
215
|
+
ptr[choices.length].put_pointer 0, FFI::Pointer::NULL
|
216
|
+
self << [ short, long, help, meta, :ecore_getopt_action_choice, [:choices,ptr] ]
|
217
|
+
end
|
218
|
+
def append short, long, help, sub_type
|
219
|
+
self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_append, [:append,sub_type] ]
|
220
|
+
end
|
221
|
+
def append_metavar short, long, help, meta, sub_type
|
222
|
+
self << [ short, long, help, meta, :ecore_getopt_action_append, [:append,sub_type] ]
|
223
|
+
end
|
224
|
+
def count short, long, help
|
225
|
+
self << [ short, long, help, FFI::Pointer::NULL, :ecore_getopt_action_count, [:dummy,FFI::Pointer::NULL] ]
|
226
|
+
end
|
227
|
+
def callback_full short, long, help, meta, cb, data, arg_req, def_val
|
228
|
+
self << [ short, long, help, meta, :ecore_getopt_action_callback, [:callback, [cb, data, arg_req,def_val] ] ]
|
229
|
+
end
|
230
|
+
def callback_noargs short, long, help, cb, data
|
231
|
+
callback_full short, long, help, FFI::Pointer::NULL, cb, data, :ecore_getopt_desc_arg_requirement_no, FFI::Pointer::NULL
|
232
|
+
end
|
233
|
+
def callback_args short, long, help, meta, cb, data
|
234
|
+
callback_full short, long, help, meta, cb, data, :ecore_getopt_desc_arg_requirement_yes, FFI::Pointer::NULL
|
235
|
+
end
|
236
|
+
def help short, long
|
237
|
+
self << [ short, long, 'show this message.', FFI::Pointer::NULL, :ecore_getopt_action_help, [:dummy,FFI::Pointer::NULL] ]
|
238
|
+
end
|
239
|
+
def version short, long
|
240
|
+
self << [ short, long, 'show program version.', FFI::Pointer::NULL, :ecore_getopt_action_version, [:dummy,FFI::Pointer::NULL] ]
|
241
|
+
end
|
242
|
+
def copyright short, long
|
243
|
+
self << [ short, long, 'show copyright.', FFI::Pointer::NULL, :ecore_getopt_action_copyright, [:dummy,FFI::Pointer::NULL] ]
|
244
|
+
end
|
245
|
+
def license short, long
|
246
|
+
self << [ short, long, 'show license.', FFI::Pointer::NULL, :ecore_getopt_action_license, [:dummy,FFI::Pointer::NULL] ]
|
247
|
+
end
|
248
|
+
# def sentinel
|
249
|
+
# self << [ 0, FFI::Pointer::NULL, FFI::Pointer::NULL, FFI::Pointer::NULL, 0, {:dummy=>FFI::Pointer::NULL} ]
|
250
|
+
# end
|
251
|
+
#
|
252
|
+
def debug
|
253
|
+
r = ''
|
254
|
+
r << "#{self.class} : #{@parser_p.to_ptr}\n"
|
255
|
+
[:prog,:usage,:version,:copyright,:license,:description].each do |sym|
|
256
|
+
r<< " #{sym.to_s} : #{@parser_p[sym]==FFI::Pointer::NULL ? 'NULL' : @parser_p[sym].read_string}\n"
|
257
|
+
end
|
258
|
+
r << " strict : #{@parser_p[:strict]}\n"
|
259
|
+
i=0
|
260
|
+
while true
|
261
|
+
d = @parser_p.desc_ptr i
|
262
|
+
break if d[:shortname]==0 and d[:longname] == FFI::Pointer::NULL
|
263
|
+
r << " desc #{d.to_ptr}\n"
|
264
|
+
r << " short: #{d[:shortname].chr}\n" unless d[:shortname]==0
|
265
|
+
r << " long: #{d[:longname].read_string}\n" unless d[:longname]==FFI::Pointer::NULL
|
266
|
+
r << " help: #{d[:help].read_string}\n" unless d[:help]==FFI::Pointer::NULL
|
267
|
+
i+=1
|
268
|
+
end
|
269
|
+
r
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
#
|
41
274
|
end
|
42
275
|
#
|
43
276
|
# EOF
|
@@ -336,6 +336,26 @@ module Efl
|
|
336
336
|
[ :elm_run, [ ], :void ],
|
337
337
|
# EAPI void elm_exit(void);
|
338
338
|
[ :elm_exit, [ ], :void ],
|
339
|
+
# EAPI void elm_app_info_set(void *mainfunc, const char *dom, const char *checkfile);
|
340
|
+
[ :elm_app_info_set, [ :void_p, :string, :string ], :void ],
|
341
|
+
# EAPI void elm_app_compile_bin_dir_set(const char *dir);
|
342
|
+
[ :elm_app_compile_bin_dir_set, [ :string ], :void ],
|
343
|
+
# EAPI void elm_app_compile_lib_dir_set(const char *dir);
|
344
|
+
[ :elm_app_compile_lib_dir_set, [ :string ], :void ],
|
345
|
+
# EAPI void elm_app_compile_data_dir_set(const char *dir);
|
346
|
+
[ :elm_app_compile_data_dir_set, [ :string ], :void ],
|
347
|
+
# EAPI void elm_app_compile_locale_set(const char *dir);
|
348
|
+
[ :elm_app_compile_locale_set, [ :string ], :void ],
|
349
|
+
# EAPI const char *elm_app_prefix_dir_get(void);
|
350
|
+
[ :elm_app_prefix_dir_get, [ ], :string ],
|
351
|
+
# EAPI const char *elm_app_bin_dir_get(void);
|
352
|
+
[ :elm_app_bin_dir_get, [ ], :string ],
|
353
|
+
# EAPI const char *elm_app_lib_dir_get(void);
|
354
|
+
[ :elm_app_lib_dir_get, [ ], :string ],
|
355
|
+
# EAPI const char *elm_app_data_dir_get(void);
|
356
|
+
[ :elm_app_data_dir_get, [ ], :string ],
|
357
|
+
# EAPI const char *elm_app_locale_dir_get(void);
|
358
|
+
[ :elm_app_locale_dir_get, [ ], :string ],
|
339
359
|
# EAPI void elm_quicklaunch_mode_set(Eina_Bool ql_on);
|
340
360
|
[ :elm_quicklaunch_mode_set, [ :eina_bool ], :void ],
|
341
361
|
# EAPI Eina_Bool elm_quicklaunch_mode_get(void);
|
@@ -2207,6 +2227,12 @@ module Efl
|
|
2207
2227
|
[ :elm_genlist_item_cursor_engine_only_get, [ :elm_genlist_item_p ], :eina_bool ],
|
2208
2228
|
# EAPI void elm_genlist_realized_items_update(Evas_Object *obj);
|
2209
2229
|
[ :elm_genlist_realized_items_update, [ :evas_object_p ], :void ],
|
2230
|
+
# EAPI void elm_genlist_item_mode_set(Elm_Genlist_Item *it, const char *mode_type, Eina_Bool mode_set);
|
2231
|
+
[ :elm_genlist_item_mode_set, [ :elm_genlist_item_p, :string, :eina_bool ], :void ],
|
2232
|
+
# EAPI const char *elm_genlist_mode_get(const Evas_Object *obj);
|
2233
|
+
[ :elm_genlist_mode_get, [ :evas_object_p ], :string ],
|
2234
|
+
# EAPI const Elm_Genlist_Item *elm_genlist_mode_item_get(const Evas_Object *obj);
|
2235
|
+
[ :elm_genlist_mode_item_get, [ :evas_object_p ], :elm_genlist_item_p ],
|
2210
2236
|
# EAPI Evas_Object *elm_check_add(Evas_Object *parent);
|
2211
2237
|
[ :elm_check_add, [ :evas_object_p ], :evas_object_p ],
|
2212
2238
|
# EAPI void elm_check_label_set(Evas_Object *obj, const char *label);;
|
@@ -2295,6 +2321,14 @@ module Efl
|
|
2295
2321
|
[ :elm_slideshow_layout_set, [ :evas_object_p, :string ], :void ],
|
2296
2322
|
# EAPI const Eina_List *elm_slideshow_layouts_get(const Evas_Object *obj);
|
2297
2323
|
[ :elm_slideshow_layouts_get, [ :evas_object_p ], :eina_list_p ],
|
2324
|
+
# EAPI void elm_slideshow_cache_before_set(Evas_Object *obj, int count);
|
2325
|
+
[ :elm_slideshow_cache_before_set, [ :evas_object_p, :int ], :void ],
|
2326
|
+
# EAPI int elm_slideshow_cache_before_get(const Evas_Object *obj);
|
2327
|
+
[ :elm_slideshow_cache_before_get, [ :evas_object_p ], :int ],
|
2328
|
+
# EAPI void elm_slideshow_cache_after_set(Evas_Object *obj, int count);
|
2329
|
+
[ :elm_slideshow_cache_after_set, [ :evas_object_p, :int ], :void ],
|
2330
|
+
# EAPI int elm_slideshow_cache_after_get(const Evas_Object *obj);
|
2331
|
+
[ :elm_slideshow_cache_after_get, [ :evas_object_p ], :int ],
|
2298
2332
|
# EAPI Evas_Object *elm_fileselector_add(Evas_Object *parent);
|
2299
2333
|
[ :elm_fileselector_add, [ :evas_object_p ], :evas_object_p ],
|
2300
2334
|
# EAPI void elm_fileselector_is_save_set(Evas_Object *obj, Eina_Bool is_save);
|
data/lib/efl/ffi.rb
CHANGED
@@ -20,12 +20,19 @@ module Efl
|
|
20
20
|
end
|
21
21
|
module_function :attach_fcts
|
22
22
|
#
|
23
|
+
typedef :pointer, :char_p
|
24
|
+
typedef :pointer, :short_p
|
23
25
|
typedef :pointer, :int_p
|
24
|
-
typedef :pointer, :
|
25
|
-
typedef :pointer, :void_p
|
26
|
-
typedef :pointer, :uchar_p
|
26
|
+
typedef :pointer, :long_p
|
27
27
|
typedef :pointer, :float_p
|
28
28
|
typedef :pointer, :double_p
|
29
|
+
typedef :pointer, :uchar_p
|
30
|
+
typedef :pointer, :ushort_p
|
31
|
+
typedef :pointer, :uint_p
|
32
|
+
typedef :pointer, :ulong_p
|
33
|
+
typedef :pointer, :ufloat_p
|
34
|
+
typedef :pointer, :udouble_p
|
35
|
+
typedef :pointer, :void_p
|
29
36
|
typedef :pointer, :string_array
|
30
37
|
typedef :pointer, :string_array_p
|
31
38
|
#
|
data/lib/efl.rb
CHANGED
@@ -3,12 +3,15 @@
|
|
3
3
|
#
|
4
4
|
#
|
5
5
|
module Efl
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
autoload :
|
10
|
-
autoload :
|
11
|
-
autoload :
|
6
|
+
#
|
7
|
+
VERSION = '0.0.2'
|
8
|
+
#
|
9
|
+
autoload :Eet, './lib/efl/eet.rb'
|
10
|
+
autoload :Evas, './lib/efl/evas.rb'
|
11
|
+
autoload :Ecore, './lib/efl/ecore.rb'
|
12
|
+
autoload :EcoreGetopt, './lib/efl/ecore_getopt.rb'
|
13
|
+
autoload :Edje, './lib/efl/edje.rb'
|
14
|
+
autoload :Elm, './lib/efl/elementary.rb'
|
12
15
|
end
|
13
16
|
#
|
14
17
|
# EOF
|
data/spec/ecore_getopt_spec.rb
CHANGED
@@ -1,43 +1,276 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
# -*- coding: UTF-8 -*-
|
3
3
|
#
|
4
|
+
require 'efl/ecore'
|
4
5
|
require 'efl/ecore_getopt'
|
5
6
|
#
|
6
7
|
describe Efl::EcoreGetopt do
|
7
8
|
#
|
8
|
-
|
9
|
+
before(:all) do
|
9
10
|
Efl::Ecore.init
|
10
|
-
# puts Efl::EcoreGetopt::EcoreGetopt.methods.sort
|
11
|
-
# eg = Efl::EcoreGetopt::EcoreGetopt.new
|
12
|
-
# val1 = Efl::API::Ecore_Getopt_Value.new
|
13
|
-
# val1[:val] =
|
14
|
-
# val2 = Efl::API::Ecore_Getopt_Value.new
|
15
11
|
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
descs = FFI::MemoryPointer.new :pointer, 2, false
|
26
|
-
descs[0] = egd
|
27
|
-
descs[1] = FFI::Pointer::NULL
|
12
|
+
@p = Efl::EcoreGetopt::Parser.new :prog =>"Prog", :usage => "Usage", :version => "0.0.0", :copyright => "less", :license => "MIT", :description => "description", :strict => 1
|
13
|
+
@callback = Proc.new do |parser, desc, string, data, value|
|
14
|
+
parser.address.should eql @p.to_ptr.address
|
15
|
+
string.should eql "my_data"
|
16
|
+
data.read_string.should eql "cb_data"
|
17
|
+
value.read_pointer.read_int.should eql 99
|
18
|
+
true
|
19
|
+
end
|
28
20
|
#
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
21
|
+
@values = {
|
22
|
+
:license => FFI::MemoryPointer.new(:uchar),
|
23
|
+
:copyright => FFI::MemoryPointer.new(:uchar),
|
24
|
+
:version => FFI::MemoryPointer.new(:uchar),
|
25
|
+
:help => FFI::MemoryPointer.new(:uchar),
|
26
|
+
:int => FFI::MemoryPointer.new(:int),
|
27
|
+
:double => FFI::MemoryPointer.new(:double),
|
28
|
+
:short => FFI::MemoryPointer.new(:short),
|
29
|
+
:long => FFI::MemoryPointer.new(:long),
|
30
|
+
:const => FFI::MemoryPointer.new(:int),
|
31
|
+
:true => FFI::MemoryPointer.new(:uchar),
|
32
|
+
:false => FFI::MemoryPointer.new(:uchar),
|
33
|
+
:choice => FFI::MemoryPointer.new(:pointer),
|
34
|
+
:count => FFI::MemoryPointer.new(:int),
|
35
|
+
:callback => FFI::MemoryPointer.new(:int),
|
36
|
+
}
|
37
|
+
@meta1 = FFI::MemoryPointer.from_string "My pretty"
|
38
|
+
@meta2 = FFI::MemoryPointer.from_string "My precious"
|
39
|
+
@cb_data = FFI::MemoryPointer.from_string "cb_data"
|
40
|
+
#
|
41
|
+
@p.license 'L', 'license'
|
42
|
+
@p.value :boolp, @values[:license]
|
43
|
+
@p.copyright 'C', 'copyright'
|
44
|
+
@p.value :boolp, @values[:copyright]
|
45
|
+
@p.version 'V', 'version'
|
46
|
+
@p.value :boolp, @values[:version]
|
47
|
+
@p.help 'H', 'help'
|
48
|
+
@p.value :boolp, @values[:help]
|
49
|
+
@p.store_type :int, 'i', 'int', 'store an integer'
|
50
|
+
@p.value :intp, @values[:int]
|
51
|
+
@p.store_meta_type :double, 'd', 'double', 'store an double+meta', @meta1
|
52
|
+
@p.value :doublep, @values[:double]
|
53
|
+
@p.store_def_type :short, 's', 'short', 'store an short+default', 6
|
54
|
+
@p.value :shortp, @values[:short]
|
55
|
+
@p.store_full_type :long, 'l', 'long', 'store a long+full', @meta2, :ecore_getopt_desc_arg_requirement_yes, 666
|
56
|
+
@p.value :longp, @values[:long]
|
57
|
+
@p.store_const 'c', 'const', 'store a constant', 123456
|
58
|
+
@p.value :intp, @values[:const]
|
59
|
+
@p.store_true 't', 'true', 'store true'
|
60
|
+
@p.value :boolp, @values[:false]
|
61
|
+
@p.store_false 'f', 'false', 'store false'
|
62
|
+
@p.value :boolp, @values[:true]
|
63
|
+
@p.choice 'm', 'many', 'store choice', ['ch1','ch2','ch3']
|
64
|
+
@p.value :strp, @values[:choice]
|
65
|
+
# # FIXME: uses listp with Eina_List
|
66
|
+
# @p.append 'a', 'append', 'store append', :ecore_getopt_type_int
|
67
|
+
@p.count 'k', 'count', 'store count'
|
68
|
+
@p.value :intp, @values[:count]
|
69
|
+
@p.callback_args 'b', 'callback', 'callback full', @meta, @callback, @cb_data
|
70
|
+
@p.value :intp, @values[:callback]
|
71
|
+
@p.create
|
72
|
+
# puts @p.debug
|
73
|
+
#
|
74
|
+
end
|
75
|
+
before(:each) do
|
76
|
+
[ :license, :copyright, :version, :help ].each do |sym|
|
77
|
+
@values[sym].write_char 0
|
78
|
+
end
|
79
|
+
@values[:int].write_int 0
|
80
|
+
@values[:double].write_double 3.1415926
|
81
|
+
@values[:short].write_short 9
|
82
|
+
@values[:long].write_long 666
|
83
|
+
@values[:const].write_int -666
|
84
|
+
@values[:true].write_uchar 1
|
85
|
+
@values[:false].write_uchar 0
|
86
|
+
@values[:choice].write_pointer FFI::Pointer::NULL
|
87
|
+
@values[:count].write_int 664
|
88
|
+
@values[:callback].write_int 99
|
89
|
+
end
|
90
|
+
after(:all) do
|
40
91
|
Efl::Ecore.shutdown
|
41
92
|
end
|
42
93
|
#
|
94
|
+
describe "license copyright version help" do
|
95
|
+
it "should handle -L" do
|
96
|
+
[ :license, :copyright, :version, :help ].each do |sym|
|
97
|
+
@values[sym].read_char.should eql 0
|
98
|
+
end
|
99
|
+
args = @p.parse ["My lovely prog name","-L"]
|
100
|
+
@values[:license].read_char.should eql 1
|
101
|
+
[ :copyright, :version, :help ].each do |sym|
|
102
|
+
@values[sym].read_char.should eql 0
|
103
|
+
end
|
104
|
+
end
|
105
|
+
it "should handle --license" do
|
106
|
+
[ :license, :copyright, :version, :help ].each do |sym|
|
107
|
+
@values[sym].read_char.should eql 0
|
108
|
+
end
|
109
|
+
args = @p.parse ["My lovely prog name","--license"]
|
110
|
+
@values[:license].read_char.should eql 1
|
111
|
+
[ :copyright, :version, :help ].each do |sym|
|
112
|
+
@values[sym].read_char.should eql 0
|
113
|
+
end
|
114
|
+
end
|
115
|
+
it "should handle -C" do
|
116
|
+
[ :license, :copyright, :version, :help ].each do |sym|
|
117
|
+
@values[sym].read_char.should eql 0
|
118
|
+
end
|
119
|
+
args = @p.parse ["progname","-C"]
|
120
|
+
@values[:copyright].read_char.should eql 1
|
121
|
+
[ :license, :version, :help ].each do |sym|
|
122
|
+
@values[sym].read_char.should eql 0
|
123
|
+
end
|
124
|
+
end
|
125
|
+
it "should handle --copyright" do
|
126
|
+
[ :license, :copyright, :version, :help ].each do |sym|
|
127
|
+
@values[sym].read_char.should eql 0
|
128
|
+
end
|
129
|
+
args = @p.parse ["My lovely prog name","--copyright"]
|
130
|
+
@values[:copyright].read_char.should eql 1
|
131
|
+
[ :license, :version, :help ].each do |sym|
|
132
|
+
@values[sym].read_char.should eql 0
|
133
|
+
end
|
134
|
+
end
|
135
|
+
it "should handle -V" do
|
136
|
+
[ :license, :copyright, :version, :help ].each do |sym|
|
137
|
+
@values[sym].read_char.should eql 0
|
138
|
+
end
|
139
|
+
args = @p.parse ["My lovely prog name","-V"]
|
140
|
+
@values[:version].read_char.should eql 1
|
141
|
+
[ :license, :copyright, :help ].each do |sym|
|
142
|
+
@values[sym].read_char.should eql 0
|
143
|
+
end
|
144
|
+
end
|
145
|
+
it "should handle --version" do
|
146
|
+
[ :license, :copyright, :version, :help ].each do |sym|
|
147
|
+
@values[sym].read_char.should eql 0
|
148
|
+
end
|
149
|
+
args = @p.parse ["progname","--version"]
|
150
|
+
@values[:version].read_char.should eql 1
|
151
|
+
[ :license, :copyright, :help ].each do |sym|
|
152
|
+
@values[sym].read_char.should eql 0
|
153
|
+
end
|
154
|
+
end
|
155
|
+
it "should handle -H" do
|
156
|
+
[ :license, :copyright, :version, :help ].each do |sym|
|
157
|
+
@values[sym].read_char.should eql 0
|
158
|
+
end
|
159
|
+
args = @p.parse ["My lovely prog name","-H"]
|
160
|
+
@values[:help].read_char.should eql 1
|
161
|
+
[ :license, :copyright, :version ].each do |sym|
|
162
|
+
@values[sym].read_char.should eql 0
|
163
|
+
end
|
164
|
+
end
|
165
|
+
it "should handle --help" do
|
166
|
+
[ :license, :copyright, :version, :help ].each do |sym|
|
167
|
+
@values[sym].read_char.should eql 0
|
168
|
+
end
|
169
|
+
args = @p.parse ["progname","--help"]
|
170
|
+
@values[:help].read_char.should eql 1
|
171
|
+
[ :license, :copyright, :version ].each do |sym|
|
172
|
+
@values[sym].read_char.should eql 0
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
describe "simple short options" do
|
177
|
+
it "should handle -i" do
|
178
|
+
@values[:int].read_int.should eql 0
|
179
|
+
args = @p.parse ["progname","-i 666"]
|
180
|
+
@values[:int].read_int.should eql 666
|
181
|
+
end
|
182
|
+
it "should handle -d" do
|
183
|
+
@values[:double].read_double.should eql 3.1415926
|
184
|
+
args = @p.parse ["progname","-d 6.66"]
|
185
|
+
@values[:double].read_double.should eql 6.66
|
186
|
+
end
|
187
|
+
it "should handle -s" do
|
188
|
+
@values[:short].read_short.should eql 9
|
189
|
+
args = @p.parse ["progname","-s 125"]
|
190
|
+
@values[:short].read_short.should eql 125
|
191
|
+
end
|
192
|
+
it "should handle -l" do
|
193
|
+
@values[:long].read_long.should eql 666
|
194
|
+
args = @p.parse ["progname","-l 69"]
|
195
|
+
@values[:long].read_long.should eql 69
|
196
|
+
end
|
197
|
+
it "should handle -c" do
|
198
|
+
@values[:const].read_int.should eql -666
|
199
|
+
args = @p.parse ["progname","-c"]
|
200
|
+
@values[:const].read_int.should eql 123456
|
201
|
+
end
|
202
|
+
it "should handle -t" do
|
203
|
+
@values[:false].read_uchar.should eql 0
|
204
|
+
args = @p.parse ["progname","-t"]
|
205
|
+
@values[:false].read_uchar.should eql 1
|
206
|
+
end
|
207
|
+
it "should handle -f" do
|
208
|
+
@values[:true].read_uchar.should eql 1
|
209
|
+
args = @p.parse ["progname","-f"]
|
210
|
+
@values[:true].read_uchar.should eql 0
|
211
|
+
end
|
212
|
+
it "should handle -m" do
|
213
|
+
@values[:choice].read_pointer.should eql FFI::Pointer::NULL
|
214
|
+
args = @p.parse ["progname","-mch2"]
|
215
|
+
@values[:choice].read_pointer.read_string.should eql "ch2"
|
216
|
+
end
|
217
|
+
it "should handle -k" do
|
218
|
+
@values[:count].read_int.should eql 664
|
219
|
+
args = @p.parse ["progname","-kk"]
|
220
|
+
@values[:count].read_int.should eql 666
|
221
|
+
end
|
222
|
+
it "should handle -b" do
|
223
|
+
args = @p.parse ["progname","-bmy_data"]
|
224
|
+
end
|
225
|
+
end
|
226
|
+
describe "simple long options" do
|
227
|
+
it "should handle --int" do
|
228
|
+
@values[:int].read_int.should eql 0
|
229
|
+
args = @p.parse ["progname","--int=666"]
|
230
|
+
@values[:int].read_int.should eql 666
|
231
|
+
end
|
232
|
+
it "should handle --double" do
|
233
|
+
@values[:double].read_double.should eql 3.1415926
|
234
|
+
args = @p.parse ["progname","--double=6.66"]
|
235
|
+
@values[:double].read_double.should eql 6.66
|
236
|
+
end
|
237
|
+
it "should handle --short" do
|
238
|
+
@values[:short].read_short.should eql 9
|
239
|
+
args = @p.parse ["progname","--short=125"]
|
240
|
+
@values[:short].read_short.should eql 125
|
241
|
+
end
|
242
|
+
it "should handle --long" do
|
243
|
+
@values[:long].read_long.should eql 666
|
244
|
+
args = @p.parse ["progname","--long=69"]
|
245
|
+
@values[:long].read_long.should eql 69
|
246
|
+
end
|
247
|
+
it "should handle --const" do
|
248
|
+
@values[:const].read_int.should eql -666
|
249
|
+
args = @p.parse ["progname","--const"]
|
250
|
+
@values[:const].read_int.should eql 123456
|
251
|
+
end
|
252
|
+
it "should handle --true" do
|
253
|
+
@values[:false].read_uchar.should eql 0
|
254
|
+
args = @p.parse ["progname","--true"]
|
255
|
+
@values[:false].read_uchar.should eql 1
|
256
|
+
end
|
257
|
+
it "should handle --false" do
|
258
|
+
@values[:true].read_uchar.should eql 1
|
259
|
+
args = @p.parse ["progname","--false"]
|
260
|
+
@values[:true].read_uchar.should eql 0
|
261
|
+
end
|
262
|
+
it "should handle --many" do
|
263
|
+
@values[:choice].read_pointer.should eql FFI::Pointer::NULL
|
264
|
+
args = @p.parse ["progname","--many=ch3"]
|
265
|
+
@values[:choice].read_pointer.read_string.should eql "ch3"
|
266
|
+
end
|
267
|
+
it "should handle --count" do
|
268
|
+
@values[:count].read_int.should eql 664
|
269
|
+
args = @p.parse ["progname","--count","--count"]
|
270
|
+
@values[:count].read_int.should eql 666
|
271
|
+
end
|
272
|
+
it "should handle --callback" do
|
273
|
+
args = @p.parse ["progname","--callback=my_data"]
|
274
|
+
end
|
275
|
+
end
|
43
276
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ffi-efl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- "J\xC3\xA9r\xC3\xA9my Zurcher"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-25 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -38,6 +38,8 @@ dependencies:
|
|
38
38
|
description: |-
|
39
39
|
ffi-efl is a FFI[https://github.com/ffi/ffi/wiki] binding to Enlightenment Foundation Libraries (eina,eet,evas,ecore,edje...)
|
40
40
|
base components of the Enlightenment project. (EFL API[http://www.enlightenment.org/p.php?p=docs&l=en])
|
41
|
+
|
42
|
+
ffi-efl project is developed on asynk[http://cgit.asynk.ch/cgi-bin/cgit/ffi-efl], github[https://github.com/jeremyz] and gitorious[https://gitorious.org/~jeyzu]
|
41
43
|
email: jeremy@asynk.ch
|
42
44
|
executables: []
|
43
45
|
|