From c2855a3809a9c76a94e4434efe7caecef27b8a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 29 Apr 2011 14:04:47 +0200 Subject: update efl/ecore* and specs --- lib/efl/ecore.rb | 12 +- lib/efl/ecore/ecore_evas.rb | 13 -- lib/efl/ecore/ecore_getopt.rb | 276 ---------------------------------------- lib/efl/ecore/ecore_input.rb | 13 -- lib/efl/ecore_evas.rb | 14 ++ lib/efl/ecore_getopt.rb | 275 +++++++++++++++++++++++++++++++++++++++ lib/efl/ecore_input.rb | 14 ++ lib/efl/edje.rb | 2 + spec/ecore/ecore_evas_spec.rb | 24 ---- spec/ecore/ecore_getopt_spec.rb | 276 ---------------------------------------- spec/ecore/ecore_input_spec.rb | 24 ---- spec/ecore_evas_spec.rb | 24 ++++ spec/ecore_getopt_spec.rb | 275 +++++++++++++++++++++++++++++++++++++++ spec/ecore_input_spec.rb | 24 ++++ spec/ecore_spec.rb | 2 +- 15 files changed, 635 insertions(+), 633 deletions(-) delete mode 100644 lib/efl/ecore/ecore_evas.rb delete mode 100644 lib/efl/ecore/ecore_getopt.rb delete mode 100644 lib/efl/ecore/ecore_input.rb create mode 100644 lib/efl/ecore_evas.rb create mode 100644 lib/efl/ecore_getopt.rb create mode 100644 lib/efl/ecore_input.rb delete mode 100644 spec/ecore/ecore_evas_spec.rb delete mode 100644 spec/ecore/ecore_getopt_spec.rb delete mode 100644 spec/ecore/ecore_input_spec.rb create mode 100644 spec/ecore_evas_spec.rb create mode 100644 spec/ecore_getopt_spec.rb create mode 100644 spec/ecore_input_spec.rb diff --git a/lib/efl/ecore.rb b/lib/efl/ecore.rb index 0e7d88b..b4d8aaa 100644 --- a/lib/efl/ecore.rb +++ b/lib/efl/ecore.rb @@ -15,15 +15,15 @@ module Efl EVENT_SIGNAL_REALTIME = 5 # Realtime signal event EVENT_COUNT = 6 # - class EcorePipe + class REcorePipe def initialize cb, data - @ptr = Efl::FFI.ecore_pipe_add cb, data + @ptr = Efl::Ecore.ecore_pipe_add cb, data 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 del; Efl::Ecore.ecore_pipe_del @ptr; end + def read_close; Efl::Ecore.ecore_pipe_read_close @ptr; end + def write_close; Efl::Ecore.ecore_pipe_write_close @ptr; end def write data - Efl::FFI.ecore_pipe_write @ptr, ::FFI::MemoryPointer.from_string(data.to_s), data.to_s.length+1 + Efl::Ecore.ecore_pipe_write @ptr, FFI::MemoryPointer.from_string(data.to_s), data.to_s.length+1 end # end diff --git a/lib/efl/ecore/ecore_evas.rb b/lib/efl/ecore/ecore_evas.rb deleted file mode 100644 index 32b4d4e..0000000 --- a/lib/efl/ecore/ecore_evas.rb +++ /dev/null @@ -1,13 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'efl/ffi/ecore/ecore_evas' -# -module Efl - module EcoreEvas - # - # - end -end -# -# EOF diff --git a/lib/efl/ecore/ecore_getopt.rb b/lib/efl/ecore/ecore_getopt.rb deleted file mode 100644 index be4a958..0000000 --- a/lib/efl/ecore/ecore_getopt.rb +++ /dev/null @@ -1,276 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'efl/ffi/ecore/ecore_getopt' -# -module Efl - module FFI - # - class EcoreGetoptValue < ::FFI::Union - layout :strp, :pointer, - :boolp, :eina_bool_p, - :shortp, :short_p, - :intp, :int_p, - :longp, :long_p, - :ushortp, :ushort_p, - :uintp, :uint_p, - :ulongp, :ulong_p, - :doublep, :double_p, - :listp, :eina_list_p, - :ptrp, :void_p, - end - # - class EcoreGetoptDescStoreDef < ::FFI::Union - layout :strv, :pointer, - :boolv, :uchar, - :shortv, :short, - :intv, :int, - :longv, :long, - :ushortv, :ushort, - :uintv, :uint, - :ulongv, :ulong, - :doublev, :double, - end - # - class EcoreGetoptDescStore < ::FFI::Struct - layout :type, :ecore_getopt_type, # enum - :arg_req, :ecore_getopt_desc_arg_requirement, # enum - :def, EcoreGetoptDescStoreDef, - end - # - callback :ecore_getopt_desc_cb, [:ecore_getopt_p, :ecore_getopt_desc_p, :string, :pointer, :ecore_getopt_value_p ], :eina_bool - # - 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 - layout :store, EcoreGetoptDescStore, - :store_const, :pointer, - :choices, :pointer, - :append_type, :ecore_getopt_type, # enum - :callback, EcoreGetoptDescCallback, - :dummy, :pointer, - end - # - class EcoreGetoptDesc < ::FFI::Struct - layout :shortname, :char, - :longname, :pointer, - :help, :pointer, - :metavar, :pointer, - :action, :ecore_getopt_action, # enum - :action_param, EcoreActionParam, - end - # - class EcoreGetopt < ::FFI::Struct - layout :prog, :pointer, - :usage, :pointer, - :version, :pointer, - :copyright, :pointer, - :license, :pointer, - :description, :pointer, - :strict, :char -# :descs, :pointer, # NULL terminated EcoreGetopt_Desc[] - - def desc_ptr idx - EcoreGetoptDesc.new to_ptr+Efl::FFI::EcoreGetopt.size+(idx*Efl::FFI::EcoreGetoptDesc.size) - end - end - # - end - # - module EcoreGetopt - class Parser - def initialize desc - @desc = desc - @options = [ - [ 0, ::FFI::Pointer::NULL, ::FFI::Pointer::NULL, ::FFI::Pointer::NULL, 0, {:dummy=>::FFI::Pointer::NULL} ] - ] - @values = [ - [ :ptrp, ::FFI::Pointer::NULL ] - ] - @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 - @refs << p - p - end - def << o - @options.insert -2, o - end - def value type, ptr - @values.insert -2, [ type, ptr ] - end - def to_ptr - @parser_p.to_ptr - end - def create - @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 ) - end - @parser_p[:strict] = @desc[:strict] if @desc.has_key? :strict - @options.each_with_index do |o,i| - d = @parser_p.desc_ptr i - d[:shortname] = o[0].ord - d[:longname] = p_from_string o[1] - d[:help] = p_from_string o[2] - d[:metavar] = o[3] - d[:action] = o[4] - k, v = o[5] - case k - when :dummy - d[:action_param][:dummy] = v - when :callback - cb = d[:action_param][:callback] - cb[:func] = v[0] - cb[:data] = v[1] - cb[:arg_req] = v[2] - cb[:def] = v[3] - when :store - st = d[:action_param][:store] - st[:type] = v[0] - st[:arg_req] = v[1] - if not v[2].nil? - if v[2][0]==:strv - st[:def][:strv] = p_from_string v[2][1] - else - st[:def][v[2][0]] = v[2][1] - end - end - when :store_const - d[:action_param][:store_const] = v - when :choices - d[:action_param][:choices] = v - when :append - d[:action_param][:append_type] = v - else - d[:action_param][:dummy] = ::FFI::Pointer::NULL - end - end - @values_p = ::FFI::MemoryPointer.new Efl::FFI::EcoreGetoptValue, @values.length, false - @values.each_with_index do |v,i| - 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) - 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 - 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 - end - def store_type type, short, long, help - store short, long, help, ('ecore_getopt_type_'+type.to_s).to_sym - end - def store_metavar short, long, help, meta, type - store_full short, long, help, meta, type, :ecore_getopt_desc_arg_requirement_yes, nil - end - def store_meta_type type, short, long, help, meta - 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 - 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 ] - end - def store_full_type type, short, long, help, meta, arg_req, def_val - 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] ] - end - def store_true short, long, help - 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] ] - end - def choice short, long, help, choices - 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] ] - end - def choice_metavar short, long, help, meta, choices - 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, 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] ] - 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] ] - 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 - 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 - end - def help short, long - 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] ] - end - def copyright short, long - 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] ] - end -# def sentinel -# self << [ 0, ::FFI::Pointer::NULL, ::FFI::Pointer::NULL, ::FFI::Pointer::NULL, 0, {:dummy=>::FFI::Pointer::NULL} ] -# end - # - def debug - r = '' - r << "#{self.class} : #{@parser_p.to_ptr}\n" - [:prog,:usage,:version,:copyright,:license,:description].each do |sym| - r<< " #{sym.to_s} : #{@parser_p[sym]==FFI::Pointer::NULL ? 'NULL' : @parser_p[sym].read_string}\n" - end - r << " strict : #{@parser_p[:strict]}\n" - i=0 - while true - d = @parser_p.desc_ptr i - 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 - i+=1 - end - r - end - end - end - # -end -# -# EOF diff --git a/lib/efl/ecore/ecore_input.rb b/lib/efl/ecore/ecore_input.rb deleted file mode 100644 index b7f579d..0000000 --- a/lib/efl/ecore/ecore_input.rb +++ /dev/null @@ -1,13 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'efl/ffi/ecore/ecore_input' -# -module Efl - module EcoreInput - # - # - end -end -# -# EOF diff --git a/lib/efl/ecore_evas.rb b/lib/efl/ecore_evas.rb new file mode 100644 index 0000000..46aa706 --- /dev/null +++ b/lib/efl/ecore_evas.rb @@ -0,0 +1,14 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/ffi/ecore_evas' +# +module Efl + # + module EcoreEvas + # + end + # +end +# +# EOF diff --git a/lib/efl/ecore_getopt.rb b/lib/efl/ecore_getopt.rb new file mode 100644 index 0000000..3b98eeb --- /dev/null +++ b/lib/efl/ecore_getopt.rb @@ -0,0 +1,275 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/ffi/ecore_getopt' +# +module Efl + # + module EcoreGetopt + # + class Value < FFI::Union + layout :strp, :pointer, + :boolp, :eina_bool_p, + :shortp, :short_p, + :intp, :int_p, + :longp, :long_p, + :ushortp, :ushort_p, + :uintp, :uint_p, + :ulongp, :ulong_p, + :doublep, :double_p, + :listp, :eina_list_p, + :ptrp, :void_p, + end + # + class DescStoreDef < FFI::Union + layout :strv, :pointer, + :boolv, :uchar, + :shortv, :short, + :intv, :int, + :longv, :long, + :ushortv, :ushort, + :uintv, :uint, + :ulongv, :ulong, + :doublev, :double, + end + # + class DescStore < FFI::Struct + layout :type, :ecore_getopt_type, # enum + :arg_req, :ecore_getopt_desc_arg_requirement, # enum + :def, DescStoreDef, + end + # + callback :ecore_getopt_desc_cb, [:ecore_getopt_p, :ecore_getopt_desc_p, :string, :pointer, :ecore_getopt_value_p ], :eina_bool + # + class DescCallback < FFI::Struct + layout :func, :ecore_getopt_desc_cb, + :data, :pointer, + :arg_req, :ecore_getopt_desc_arg_requirement, # enum + :def, :pointer, + end + # + class ActionParam < FFI::Union + layout :store, DescStore, + :store_const, :pointer, + :choices, :pointer, + :append_type, :ecore_getopt_type, # enum + :callback, DescCallback, + :dummy, :pointer, + end + # + class Desc < FFI::Struct + layout :shortname, :char, + :longname, :pointer, + :help, :pointer, + :metavar, :pointer, + :action, :ecore_getopt_action, # enum + :action_param, ActionParam, + end + # + class EcoreGetopt < FFI::Struct + layout :prog, :pointer, + :usage, :pointer, + :version, :pointer, + :copyright, :pointer, + :license, :pointer, + :description, :pointer, + :strict, :char +# :descs, :pointer, # NULL terminated EcoreGetopt_Desc[] + + def desc_ptr idx + Efl::EcoreGetopt::Desc.new to_ptr+Efl::EcoreGetopt::EcoreGetopt.size+(idx*Efl::EcoreGetopt::Desc.size) + end + end + # + class REcoreGetopt + def initialize desc + @ecore_getopt = nil + @desc = desc + @options = [ + [ 0, FFI::Pointer::NULL, FFI::Pointer::NULL, FFI::Pointer::NULL, 0, {:dummy=>FFI::Pointer::NULL} ] + ] + @values = [ + [ :ptrp, FFI::Pointer::NULL ] + ] + @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 + @refs << p + p + end + def << o + @options.insert -2, o + end + def value type, ptr + @values.insert -2, [ type, ptr ] + end + def to_ptr + @ecore_getopt.to_ptr + end + def create + @ecore_getopt = Efl::EcoreGetopt::EcoreGetopt.new FFI::MemoryPointer.new (Efl::EcoreGetopt::EcoreGetopt.size+Efl::EcoreGetopt::Desc.size*@options.length), 1 + [:prog,:usage,:version,:copyright,:license,:description].each do |sym| + @ecore_getopt[sym] = ( @desc.has_key?(sym) ? FFI::MemoryPointer.from_string(@desc[sym]) : FFI::Pointer::NULL ) + end + @ecore_getopt[:strict] = @desc[:strict] if @desc.has_key? :strict + @options.each_with_index do |o,i| + d = @ecore_getopt.desc_ptr i + d[:shortname] = o[0].ord + d[:longname] = p_from_string o[1] + d[:help] = p_from_string o[2] + d[:metavar] = o[3] + d[:action] = o[4] + k, v = o[5] + case k + when :dummy + d[:action_param][:dummy] = v + when :callback + cb = d[:action_param][:callback] + cb[:func] = v[0] + cb[:data] = v[1] + cb[:arg_req] = v[2] + cb[:def] = v[3] + when :store + st = d[:action_param][:store] + st[:type] = v[0] + st[:arg_req] = v[1] + if not v[2].nil? + if v[2][0]==:strv + st[:def][:strv] = p_from_string v[2][1] + else + st[:def][v[2][0]] = v[2][1] + end + end + when :store_const + d[:action_param][:store_const] = v + when :choices + d[:action_param][:choices] = v + when :append + d[:action_param][:append_type] = v + else + d[:action_param][:dummy] = FFI::Pointer::NULL + end + end + @values_p = FFI::MemoryPointer.new Efl::EcoreGetopt::Value, @values.length, false + @values.each_with_index do |v,i| + Efl::EcoreGetopt::Value.new(@values_p+(i*Efl::EcoreGetopt::Value.size))[v[0]] = v[1] + end + end + def parse argv + 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 + Efl::EcoreGetopt.ecore_getopt_parse @ecore_getopt, @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 + end + def store_type type, short, long, help + store short, long, help, ('ecore_getopt_type_'+type.to_s).to_sym + end + def store_metavar short, long, help, meta, type + store_full short, long, help, meta, type, :ecore_getopt_desc_arg_requirement_yes, nil + end + def store_meta_type type, short, long, help, meta + 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 + 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 ] + end + def store_full_type type, short, long, help, meta, arg_req, def_val + 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] ] + end + def store_true short, long, help + 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] ] + end + def choice short, long, help, choices + 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] ] + end + def choice_metavar short, long, help, meta, choices + 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, 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] ] + 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] ] + 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 + 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 + end + def help short, long + 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] ] + end + def copyright short, long + 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] ] + end +# def sentinel +# self << [ 0, FFI::Pointer::NULL, FFI::Pointer::NULL, FFI::Pointer::NULL, 0, {:dummy=>FFI::Pointer::NULL} ] +# end + # + def debug + r = '' + r << "#{self.class} : #{@ecore_getopt.to_ptr}\n" + [:prog,:usage,:version,:copyright,:license,:description].each do |sym| + r<< " #{sym.to_s} : #{@ecore_getopt[sym]==FFI::Pointer::NULL ? 'NULL' : @ecore_getopt[sym].read_string}\n" + end + r << " strict : #{@ecore_getopt[:strict]}\n" + i=0 + while true + d = @ecore_getopt.desc_ptr i + 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 + i+=1 + end + r + end + end + end + # +end +# +# EOF diff --git a/lib/efl/ecore_input.rb b/lib/efl/ecore_input.rb new file mode 100644 index 0000000..48cf8e9 --- /dev/null +++ b/lib/efl/ecore_input.rb @@ -0,0 +1,14 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/ffi/ecore_input' +# +module Efl + # + module EcoreInput + # + end + # +end +# +# EOF diff --git a/lib/efl/edje.rb b/lib/efl/edje.rb index cee5f8e..cd062ff 100644 --- a/lib/efl/edje.rb +++ b/lib/efl/edje.rb @@ -4,9 +4,11 @@ require 'efl/ffi/edje' # module Efl + # module Edje # end + # end # # EOF diff --git a/spec/ecore/ecore_evas_spec.rb b/spec/ecore/ecore_evas_spec.rb deleted file mode 100644 index c380613..0000000 --- a/spec/ecore/ecore_evas_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'efl/ecore/ecore_evas' -# -describe Efl::EcoreEvas do - # - before(:all) do - EcoreEvas = Efl::EcoreEvas - end - # - it "should init" do - EcoreEvas.init.should eql 1 - EcoreEvas.init.should eql 2 - EcoreEvas.init.should eql 3 - end - # - it "should shutdown" do - EcoreEvas.shutdown.should eql 2 - EcoreEvas.shutdown.should eql 1 - EcoreEvas.shutdown.should eql 0 - end - # -end diff --git a/spec/ecore/ecore_getopt_spec.rb b/spec/ecore/ecore_getopt_spec.rb deleted file mode 100644 index 155362e..0000000 --- a/spec/ecore/ecore_getopt_spec.rb +++ /dev/null @@ -1,276 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'efl/ecore' -require 'efl/ecore/ecore_getopt' -# -describe Efl::EcoreGetopt do - # - before(:all) do - Efl::Ecore.init - # - @p = Efl::EcoreGetopt::Parser.new :prog =>"Prog", :usage => "Usage", :version => "0.0.0", :copyright => "less", :license => "MIT", :description => "description", :strict => 1 - @callback = Proc.new do |parser, desc, string, data, value| - parser.address.should eql @p.to_ptr.address - string.should eql "my_data" - data.read_string.should eql "cb_data" - value.read_pointer.read_int.should eql 99 - true - end - # - @values = { - :license => FFI::MemoryPointer.new(:uchar), - :copyright => FFI::MemoryPointer.new(:uchar), - :version => FFI::MemoryPointer.new(:uchar), - :help => FFI::MemoryPointer.new(:uchar), - :int => FFI::MemoryPointer.new(:int), - :double => FFI::MemoryPointer.new(:double), - :short => FFI::MemoryPointer.new(:short), - :long => FFI::MemoryPointer.new(:long), - :const => FFI::MemoryPointer.new(:int), - :true => FFI::MemoryPointer.new(:uchar), - :false => FFI::MemoryPointer.new(:uchar), - :choice => FFI::MemoryPointer.new(:pointer), - :count => FFI::MemoryPointer.new(:int), - :callback => FFI::MemoryPointer.new(:int), - } - @meta1 = FFI::MemoryPointer.from_string "My pretty" - @meta2 = FFI::MemoryPointer.from_string "My precious" - @cb_data = FFI::MemoryPointer.from_string "cb_data" - # - @p.license 'L', 'license' - @p.value :boolp, @values[:license] - @p.copyright 'C', 'copyright' - @p.value :boolp, @values[:copyright] - @p.version 'V', 'version' - @p.value :boolp, @values[:version] - @p.help 'H', 'help' - @p.value :boolp, @values[:help] - @p.store_type :int, 'i', 'int', 'store an integer' - @p.value :intp, @values[:int] - @p.store_meta_type :double, 'd', 'double', 'store an double+meta', @meta1 - @p.value :doublep, @values[:double] - @p.store_def_type :short, 's', 'short', 'store an short+default', 6 - @p.value :shortp, @values[:short] - @p.store_full_type :long, 'l', 'long', 'store a long+full', @meta2, :ecore_getopt_desc_arg_requirement_yes, 666 - @p.value :longp, @values[:long] - @p.store_const 'c', 'const', 'store a constant', 123456 - @p.value :intp, @values[:const] - @p.store_true 't', 'true', 'store true' - @p.value :boolp, @values[:false] - @p.store_false 'f', 'false', 'store false' - @p.value :boolp, @values[:true] - @p.choice 'm', 'many', 'store choice', ['ch1','ch2','ch3'] - @p.value :strp, @values[:choice] -# # FIXME: uses listp with Eina_List -# @p.append 'a', 'append', 'store append', :ecore_getopt_type_int - @p.count 'k', 'count', 'store count' - @p.value :intp, @values[:count] - @p.callback_args 'b', 'callback', 'callback full', @meta, @callback, @cb_data - @p.value :intp, @values[:callback] - @p.create -# puts @p.debug - # - end - before(:each) do - [ :license, :copyright, :version, :help ].each do |sym| - @values[sym].write_char 0 - end - @values[:int].write_int 0 - @values[:double].write_double 3.1415926 - @values[:short].write_short 9 - @values[:long].write_long 666 - @values[:const].write_int -666 - @values[:true].write_uchar 1 - @values[:false].write_uchar 0 - @values[:choice].write_pointer FFI::Pointer::NULL - @values[:count].write_int 664 - @values[:callback].write_int 99 - end - after(:all) do - Efl::Ecore.shutdown - end - # - describe "license copyright version help" do - it "should handle -L" do - [ :license, :copyright, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - args = @p.parse ["My lovely prog name","-L"] - @values[:license].read_char.should eql 1 - [ :copyright, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - end - it "should handle --license" do - [ :license, :copyright, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - args = @p.parse ["My lovely prog name","--license"] - @values[:license].read_char.should eql 1 - [ :copyright, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - end - it "should handle -C" do - [ :license, :copyright, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - args = @p.parse ["progname","-C"] - @values[:copyright].read_char.should eql 1 - [ :license, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - end - it "should handle --copyright" do - [ :license, :copyright, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - args = @p.parse ["My lovely prog name","--copyright"] - @values[:copyright].read_char.should eql 1 - [ :license, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - end - it "should handle -V" do - [ :license, :copyright, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - args = @p.parse ["My lovely prog name","-V"] - @values[:version].read_char.should eql 1 - [ :license, :copyright, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - end - it "should handle --version" do - [ :license, :copyright, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - args = @p.parse ["progname","--version"] - @values[:version].read_char.should eql 1 - [ :license, :copyright, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - end - it "should handle -H" do - [ :license, :copyright, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - args = @p.parse ["My lovely prog name","-H"] - @values[:help].read_char.should eql 1 - [ :license, :copyright, :version ].each do |sym| - @values[sym].read_char.should eql 0 - end - end - it "should handle --help" do - [ :license, :copyright, :version, :help ].each do |sym| - @values[sym].read_char.should eql 0 - end - args = @p.parse ["progname","--help"] - @values[:help].read_char.should eql 1 - [ :license, :copyright, :version ].each do |sym| - @values[sym].read_char.should eql 0 - end - end - end - describe "simple short options" do - it "should handle -i" do - @values[:int].read_int.should eql 0 - args = @p.parse ["progname","-i 666"] - @values[:int].read_int.should eql 666 - end - it "should handle -d" do - @values[:double].read_double.should eql 3.1415926 - args = @p.parse ["progname","-d 6.66"] - @values[:double].read_double.should eql 6.66 - end - it "should handle -s" do - @values[:short].read_short.should eql 9 - args = @p.parse ["progname","-s 125"] - @values[:short].read_short.should eql 125 - end - it "should handle -l" do - @values[:long].read_long.should eql 666 - args = @p.parse ["progname","-l 69"] - @values[:long].read_long.should eql 69 - end - it "should handle -c" do - @values[:const].read_int.should eql -666 - args = @p.parse ["progname","-c"] - @values[:const].read_int.should eql 123456 - end - it "should handle -t" do - @values[:false].read_uchar.should eql 0 - args = @p.parse ["progname","-t"] - @values[:false].read_uchar.should eql 1 - end - it "should handle -f" do - @values[:true].read_uchar.should eql 1 - args = @p.parse ["progname","-f"] - @values[:true].read_uchar.should eql 0 - end - it "should handle -m" do - @values[:choice].read_pointer.should eql FFI::Pointer::NULL - args = @p.parse ["progname","-mch2"] - @values[:choice].read_pointer.read_string.should eql "ch2" - end - it "should handle -k" do - @values[:count].read_int.should eql 664 - args = @p.parse ["progname","-kk"] - @values[:count].read_int.should eql 666 - end - it "should handle -b" do - args = @p.parse ["progname","-bmy_data"] - end - end - describe "simple long options" do - it "should handle --int" do - @values[:int].read_int.should eql 0 - args = @p.parse ["progname","--int=666"] - @values[:int].read_int.should eql 666 - end - it "should handle --double" do - @values[:double].read_double.should eql 3.1415926 - args = @p.parse ["progname","--double=6.66"] - @values[:double].read_double.should eql 6.66 - end - it "should handle --short" do - @values[:short].read_short.should eql 9 - args = @p.parse ["progname","--short=125"] - @values[:short].read_short.should eql 125 - end - it "should handle --long" do - @values[:long].read_long.should eql 666 - args = @p.parse ["progname","--long=69"] - @values[:long].read_long.should eql 69 - end - it "should handle --const" do - @values[:const].read_int.should eql -666 - args = @p.parse ["progname","--const"] - @values[:const].read_int.should eql 123456 - end - it "should handle --true" do - @values[:false].read_uchar.should eql 0 - args = @p.parse ["progname","--true"] - @values[:false].read_uchar.should eql 1 - end - it "should handle --false" do - @values[:true].read_uchar.should eql 1 - args = @p.parse ["progname","--false"] - @values[:true].read_uchar.should eql 0 - end - it "should handle --many" do - @values[:choice].read_pointer.should eql FFI::Pointer::NULL - args = @p.parse ["progname","--many=ch3"] - @values[:choice].read_pointer.read_string.should eql "ch3" - end - it "should handle --count" do - @values[:count].read_int.should eql 664 - args = @p.parse ["progname","--count","--count"] - @values[:count].read_int.should eql 666 - end - it "should handle --callback" do - args = @p.parse ["progname","--callback=my_data"] - end - end -end diff --git a/spec/ecore/ecore_input_spec.rb b/spec/ecore/ecore_input_spec.rb deleted file mode 100644 index 041f422..0000000 --- a/spec/ecore/ecore_input_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env ruby -# -*- coding: UTF-8 -*- -# -require 'efl/ecore/ecore_input' -# -describe Efl::EcoreInput do - # - before(:all) do - EcoreInput = Efl::EcoreInput - end - # - it "should init" do - EcoreInput.init.should eql 1 - EcoreInput.init.should eql 2 - EcoreInput.init.should eql 3 - end - # - it "should shutdown" do - EcoreInput.shutdown.should eql 2 - EcoreInput.shutdown.should eql 1 - EcoreInput.shutdown.should eql 0 - end - # -end diff --git a/spec/ecore_evas_spec.rb b/spec/ecore_evas_spec.rb new file mode 100644 index 0000000..c4d2275 --- /dev/null +++ b/spec/ecore_evas_spec.rb @@ -0,0 +1,24 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/ecore_evas' +# +describe Efl::EcoreEvas do + # + before(:all) do + EcoreEvas = Efl::EcoreEvas + end + # + it "should init" do + EcoreEvas.init.should eql 1 + EcoreEvas.init.should eql 2 + EcoreEvas.init.should eql 3 + end + # + it "should shutdown" do + EcoreEvas.shutdown.should eql 2 + EcoreEvas.shutdown.should eql 1 + EcoreEvas.shutdown.should eql 0 + end + # +end diff --git a/spec/ecore_getopt_spec.rb b/spec/ecore_getopt_spec.rb new file mode 100644 index 0000000..7e6e5d9 --- /dev/null +++ b/spec/ecore_getopt_spec.rb @@ -0,0 +1,275 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/ecore_getopt' +# +describe Efl::EcoreGetopt do + # + before(:all) do + Efl::Ecore.init + # + @p = Efl::EcoreGetopt::REcoreGetopt.new :prog =>"Prog", :usage => "Usage", :version => "0.0.0", :copyright => "less", :license => "MIT", :description => "description", :strict => 1 + @callback = Proc.new do |parser, desc, string, data, value| + parser.address.should eql @p.to_ptr.address + string.should eql "my_data" + data.read_string.should eql "cb_data" + value.read_pointer.read_int.should eql 99 + true + end + # + @values = { + :license => FFI::MemoryPointer.new(:uchar), + :copyright => FFI::MemoryPointer.new(:uchar), + :version => FFI::MemoryPointer.new(:uchar), + :help => FFI::MemoryPointer.new(:uchar), + :int => FFI::MemoryPointer.new(:int), + :double => FFI::MemoryPointer.new(:double), + :short => FFI::MemoryPointer.new(:short), + :long => FFI::MemoryPointer.new(:long), + :const => FFI::MemoryPointer.new(:int), + :true => FFI::MemoryPointer.new(:uchar), + :false => FFI::MemoryPointer.new(:uchar), + :choice => FFI::MemoryPointer.new(:pointer), + :count => FFI::MemoryPointer.new(:int), + :callback => FFI::MemoryPointer.new(:int), + } + @meta1 = FFI::MemoryPointer.from_string "My pretty" + @meta2 = FFI::MemoryPointer.from_string "My precious" + @cb_data = FFI::MemoryPointer.from_string "cb_data" + # + @p.license 'L', 'license' + @p.value :boolp, @values[:license] + @p.copyright 'C', 'copyright' + @p.value :boolp, @values[:copyright] + @p.version 'V', 'version' + @p.value :boolp, @values[:version] + @p.help 'H', 'help' + @p.value :boolp, @values[:help] + @p.store_type :int, 'i', 'int', 'store an integer' + @p.value :intp, @values[:int] + @p.store_meta_type :double, 'd', 'double', 'store an double+meta', @meta1 + @p.value :doublep, @values[:double] + @p.store_def_type :short, 's', 'short', 'store an short+default', 6 + @p.value :shortp, @values[:short] + @p.store_full_type :long, 'l', 'long', 'store a long+full', @meta2, :ecore_getopt_desc_arg_requirement_yes, 666 + @p.value :longp, @values[:long] + @p.store_const 'c', 'const', 'store a constant', 123456 + @p.value :intp, @values[:const] + @p.store_true 't', 'true', 'store true' + @p.value :boolp, @values[:false] + @p.store_false 'f', 'false', 'store false' + @p.value :boolp, @values[:true] + @p.choice 'm', 'many', 'store choice', ['ch1','ch2','ch3'] + @p.value :strp, @values[:choice] +# # FIXME: uses listp with Eina_List +# @p.append 'a', 'append', 'store append', :ecore_getopt_type_int + @p.count 'k', 'count', 'store count' + @p.value :intp, @values[:count] + @p.callback_args 'b', 'callback', 'callback full', @meta, @callback, @cb_data + @p.value :intp, @values[:callback] + @p.create +# puts @p.debug + # + end + before(:each) do + [ :license, :copyright, :version, :help ].each do |sym| + @values[sym].write_char 0 + end + @values[:int].write_int 0 + @values[:double].write_double 3.1415926 + @values[:short].write_short 9 + @values[:long].write_long 666 + @values[:const].write_int -666 + @values[:true].write_uchar 1 + @values[:false].write_uchar 0 + @values[:choice].write_pointer FFI::Pointer::NULL + @values[:count].write_int 664 + @values[:callback].write_int 99 + end + after(:all) do + Efl::Ecore.shutdown + end + # + describe "license copyright version help" do + it "should handle -L" do + [ :license, :copyright, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + args = @p.parse ["My lovely prog name","-L"] + @values[:license].read_char.should eql 1 + [ :copyright, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + end + it "should handle --license" do + [ :license, :copyright, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + args = @p.parse ["My lovely prog name","--license"] + @values[:license].read_char.should eql 1 + [ :copyright, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + end + it "should handle -C" do + [ :license, :copyright, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + args = @p.parse ["progname","-C"] + @values[:copyright].read_char.should eql 1 + [ :license, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + end + it "should handle --copyright" do + [ :license, :copyright, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + args = @p.parse ["My lovely prog name","--copyright"] + @values[:copyright].read_char.should eql 1 + [ :license, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + end + it "should handle -V" do + [ :license, :copyright, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + args = @p.parse ["My lovely prog name","-V"] + @values[:version].read_char.should eql 1 + [ :license, :copyright, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + end + it "should handle --version" do + [ :license, :copyright, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + args = @p.parse ["progname","--version"] + @values[:version].read_char.should eql 1 + [ :license, :copyright, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + end + it "should handle -H" do + [ :license, :copyright, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + args = @p.parse ["My lovely prog name","-H"] + @values[:help].read_char.should eql 1 + [ :license, :copyright, :version ].each do |sym| + @values[sym].read_char.should eql 0 + end + end + it "should handle --help" do + [ :license, :copyright, :version, :help ].each do |sym| + @values[sym].read_char.should eql 0 + end + args = @p.parse ["progname","--help"] + @values[:help].read_char.should eql 1 + [ :license, :copyright, :version ].each do |sym| + @values[sym].read_char.should eql 0 + end + end + end + describe "simple short options" do + it "should handle -i" do + @values[:int].read_int.should eql 0 + args = @p.parse ["progname","-i 666"] + @values[:int].read_int.should eql 666 + end + it "should handle -d" do + @values[:double].read_double.should eql 3.1415926 + args = @p.parse ["progname","-d 6.66"] + @values[:double].read_double.should eql 6.66 + end + it "should handle -s" do + @values[:short].read_short.should eql 9 + args = @p.parse ["progname","-s 125"] + @values[:short].read_short.should eql 125 + end + it "should handle -l" do + @values[:long].read_long.should eql 666 + args = @p.parse ["progname","-l 69"] + @values[:long].read_long.should eql 69 + end + it "should handle -c" do + @values[:const].read_int.should eql -666 + args = @p.parse ["progname","-c"] + @values[:const].read_int.should eql 123456 + end + it "should handle -t" do + @values[:false].read_uchar.should eql 0 + args = @p.parse ["progname","-t"] + @values[:false].read_uchar.should eql 1 + end + it "should handle -f" do + @values[:true].read_uchar.should eql 1 + args = @p.parse ["progname","-f"] + @values[:true].read_uchar.should eql 0 + end + it "should handle -m" do + @values[:choice].read_pointer.should eql FFI::Pointer::NULL + args = @p.parse ["progname","-mch2"] + @values[:choice].read_pointer.read_string.should eql "ch2" + end + it "should handle -k" do + @values[:count].read_int.should eql 664 + args = @p.parse ["progname","-kk"] + @values[:count].read_int.should eql 666 + end + it "should handle -b" do + args = @p.parse ["progname","-bmy_data"] + end + end + describe "simple long options" do + it "should handle --int" do + @values[:int].read_int.should eql 0 + args = @p.parse ["progname","--int=666"] + @values[:int].read_int.should eql 666 + end + it "should handle --double" do + @values[:double].read_double.should eql 3.1415926 + args = @p.parse ["progname","--double=6.66"] + @values[:double].read_double.should eql 6.66 + end + it "should handle --short" do + @values[:short].read_short.should eql 9 + args = @p.parse ["progname","--short=125"] + @values[:short].read_short.should eql 125 + end + it "should handle --long" do + @values[:long].read_long.should eql 666 + args = @p.parse ["progname","--long=69"] + @values[:long].read_long.should eql 69 + end + it "should handle --const" do + @values[:const].read_int.should eql -666 + args = @p.parse ["progname","--const"] + @values[:const].read_int.should eql 123456 + end + it "should handle --true" do + @values[:false].read_uchar.should eql 0 + args = @p.parse ["progname","--true"] + @values[:false].read_uchar.should eql 1 + end + it "should handle --false" do + @values[:true].read_uchar.should eql 1 + args = @p.parse ["progname","--false"] + @values[:true].read_uchar.should eql 0 + end + it "should handle --many" do + @values[:choice].read_pointer.should eql FFI::Pointer::NULL + args = @p.parse ["progname","--many=ch3"] + @values[:choice].read_pointer.read_string.should eql "ch3" + end + it "should handle --count" do + @values[:count].read_int.should eql 664 + args = @p.parse ["progname","--count","--count"] + @values[:count].read_int.should eql 666 + end + it "should handle --callback" do + args = @p.parse ["progname","--callback=my_data"] + end + end +end diff --git a/spec/ecore_input_spec.rb b/spec/ecore_input_spec.rb new file mode 100644 index 0000000..095d11a --- /dev/null +++ b/spec/ecore_input_spec.rb @@ -0,0 +1,24 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/ecore_input' +# +describe Efl::EcoreInput do + # + before(:all) do + EcoreInput = Efl::EcoreInput + end + # + it "should init" do + EcoreInput.init.should eql 1 + EcoreInput.init.should eql 2 + EcoreInput.init.should eql 3 + end + # + it "should shutdown" do + EcoreInput.shutdown.should eql 2 + EcoreInput.shutdown.should eql 1 + EcoreInput.shutdown.should eql 0 + end + # +end diff --git a/spec/ecore_spec.rb b/spec/ecore_spec.rb index 3fcf6fb..fb68c37 100644 --- a/spec/ecore_spec.rb +++ b/spec/ecore_spec.rb @@ -50,7 +50,7 @@ describe Efl::Ecore do bytes.should eql 12 end Ecore.init - pipe = Ecore::EcorePipe.new cb, data + pipe = Ecore::REcorePipe.new cb, data pipe.write("hello world").should be_true Ecore.main_loop_iterate pipe.read_close -- cgit v1.1-2-g2b99