diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-11 09:24:45 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-11 09:24:45 +0200 |
commit | 0c30e8a8efcc32de3216a8f49b84793e51ff31cc (patch) | |
tree | 86e1f7ed44472730364a586bca82a884c8d376f0 | |
parent | 2c794ec852823d6601f6f360962691b56d8c7fbb (diff) | |
download | ffi-efl-0c30e8a8efcc32de3216a8f49b84793e51ff31cc.zip ffi-efl-0c30e8a8efcc32de3216a8f49b84793e51ff31cc.tar.gz |
take care of EAPI extern with FFI#attach_variable
-rw-r--r-- | lib/efl/native/ecore.rb | 19 | ||||
-rw-r--r-- | lib/efl/native/ecore_evas.rb | 1 | ||||
-rw-r--r-- | lib/efl/native/ecore_getopt.rb | 2 | ||||
-rw-r--r-- | lib/efl/native/ecore_input.rb | 22 | ||||
-rw-r--r-- | lib/efl/native/edje.rb | 7 | ||||
-rw-r--r-- | lib/efl/native/eet.rb | 7 | ||||
-rw-r--r-- | lib/efl/native/eina.rb | 7 | ||||
-rw-r--r-- | lib/efl/native/eina_hash.rb | 2 | ||||
-rw-r--r-- | lib/efl/native/eina_list.rb | 2 | ||||
-rw-r--r-- | lib/efl/native/eina_log.rb | 6 | ||||
-rw-r--r-- | lib/efl/native/eina_types.rb | 4 | ||||
-rw-r--r-- | lib/efl/native/elementary.rb | 13 | ||||
-rw-r--r-- | lib/efl/native/evas.rb | 7 | ||||
-rwxr-xr-x | tools/extract-api.sh | 2 | ||||
-rwxr-xr-x | tools/genruby.rb | 23 | ||||
-rw-r--r-- | tools/sed-functions | 2 |
16 files changed, 90 insertions, 36 deletions
diff --git a/lib/efl/native/ecore.rb b/lib/efl/native/ecore.rb index e6c8b8f..d0fe205 100644 --- a/lib/efl/native/ecore.rb +++ b/lib/efl/native/ecore.rb @@ -27,6 +27,7 @@ module Efl # TYPEDEFS # typedef struct _Ecore_Version Ecore_Version; typedef :pointer, :ecore_version + typedef :pointer, :ecore_version_p # typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags; typedef :pointer, :ecore_fd_handler_flags # typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags; @@ -134,14 +135,20 @@ module Efl # typedef Eina_Bool (*Ecore_Win32_Handle_Cb) (void *data, Ecore_Win32_Handler *wh); callback :ecore_win32_handle_cb, [ :void_p, :ecore_win32_handler_p ], :eina_bool # + # VARIABLES + # EAPI extern Ecore_Version *ecore_version; + attach_variable :ecore_version, :ecore_version_p + # EAPI extern int ECORE_EXE_EVENT_ADD; + attach_variable :ECORE_EXE_EVENT_ADD, :int + # EAPI extern int ECORE_EXE_EVENT_DEL; + attach_variable :ECORE_EXE_EVENT_DEL, :int + # EAPI extern int ECORE_EXE_EVENT_DATA; + attach_variable :ECORE_EXE_EVENT_DATA, :int + # EAPI extern int ECORE_EXE_EVENT_ERROR; + attach_variable :ECORE_EXE_EVENT_ERROR, :int + # # FUNCTIONS fcts = [ - # EAPI extern Ecore_Version *ecore_version; - # FIXME - # EAPI extern int ECORE_EXE_EVENT_ADD; /**< A child process has been added */ EAPI extern int ECORE_EXE_EVENT_DEL; /**< A child process has been deleted (it exited, naming consistent with the rest of ecore). */ - # FIXME - # EAPI extern int ECORE_EXE_EVENT_DATA; /**< Data from a child process. */ EAPI extern int ECORE_EXE_EVENT_ERROR; /**< Errors from a child process. */ - # FIXME # EAPI int ecore_init(void); [ :ecore_init, [ ], :int ], # EAPI int ecore_shutdown(void); diff --git a/lib/efl/native/ecore_evas.rb b/lib/efl/native/ecore_evas.rb index 2139864..32035c1 100644 --- a/lib/efl/native/ecore_evas.rb +++ b/lib/efl/native/ecore_evas.rb @@ -55,6 +55,7 @@ module Efl # void (*func) (Ecore_Evas *ee) callback :ecore_evas_event_cb, [:ecore_evas_p], :void # + # VARIABLES # # FUNCTIONS fcts = [ diff --git a/lib/efl/native/ecore_getopt.rb b/lib/efl/native/ecore_getopt.rb index a631a36..e92b4da 100644 --- a/lib/efl/native/ecore_getopt.rb +++ b/lib/efl/native/ecore_getopt.rb @@ -51,6 +51,8 @@ module Efl # # CALLBACKS # + # VARIABLES + # # FUNCTIONS fcts = [ # EAPI void ecore_getopt_help(FILE *fp, const Ecore_Getopt *info); diff --git a/lib/efl/native/ecore_input.rb b/lib/efl/native/ecore_input.rb index e06ed2f..6123b19 100644 --- a/lib/efl/native/ecore_input.rb +++ b/lib/efl/native/ecore_input.rb @@ -49,24 +49,26 @@ module Efl # # CALLBACKS # - # FUNCTIONS - fcts = [ + # VARIABLES # EAPI extern int ECORE_EVENT_KEY_DOWN; - # FIXME + attach_variable :ECORE_EVENT_KEY_DOWN, :int # EAPI extern int ECORE_EVENT_KEY_UP; - # FIXME + attach_variable :ECORE_EVENT_KEY_UP, :int # EAPI extern int ECORE_EVENT_MOUSE_BUTTON_DOWN; - # FIXME + attach_variable :ECORE_EVENT_MOUSE_BUTTON_DOWN, :int # EAPI extern int ECORE_EVENT_MOUSE_BUTTON_UP; - # FIXME + attach_variable :ECORE_EVENT_MOUSE_BUTTON_UP, :int # EAPI extern int ECORE_EVENT_MOUSE_MOVE; - # FIXME + attach_variable :ECORE_EVENT_MOUSE_MOVE, :int # EAPI extern int ECORE_EVENT_MOUSE_WHEEL; - # FIXME + attach_variable :ECORE_EVENT_MOUSE_WHEEL, :int # EAPI extern int ECORE_EVENT_MOUSE_IN; - # FIXME + attach_variable :ECORE_EVENT_MOUSE_IN, :int # EAPI extern int ECORE_EVENT_MOUSE_OUT; - # FIXME + attach_variable :ECORE_EVENT_MOUSE_OUT, :int + # + # FUNCTIONS + fcts = [ # EAPI int ecore_event_init(void); [ :ecore_event_init, [ ], :int ], # EAPI int ecore_event_shutdown(void); diff --git a/lib/efl/native/edje.rb b/lib/efl/native/edje.rb index b44e922..d2f315e 100644 --- a/lib/efl/native/edje.rb +++ b/lib/efl/native/edje.rb @@ -73,6 +73,7 @@ module Efl # TYPEDEFS # typedef struct _Edje_Version Edje_Version; typedef :pointer, :edje_version + typedef :pointer, :edje_version_p # typedef struct _Edje_Message_String Edje_Message_String; typedef :pointer, :edje_message_string # typedef struct _Edje_Message_Int Edje_Message_Int; @@ -121,10 +122,12 @@ module Efl # typedef Evas_Object *(*Edje_Item_Provider_Cb) (void *data, Evas_Object *obj, const char *part, const char *item); callback :edje_item_provider_cb, [ :void_p, :evas_object_p, :string, :string ], :evas_object_p # + # VARIABLES + # EAPI extern Edje_Version *edje_version; + attach_variable :edje_version, :edje_version_p + # # FUNCTIONS fcts = [ - # EAPI extern Edje_Version *edje_version; - # FIXME # EAPI const char *edje_external_param_type_str(Edje_External_Param_Type type); [ :edje_external_param_type_str, [ :edje_external_param_type ], :string ], # EAPI int edje_init (void); diff --git a/lib/efl/native/eet.rb b/lib/efl/native/eet.rb index 1609962..11a5e29 100644 --- a/lib/efl/native/eet.rb +++ b/lib/efl/native/eet.rb @@ -34,6 +34,7 @@ module Efl # TYPEDEFS # typedef struct _Eet_Version Eet_Version; typedef :pointer, :eet_version + typedef :pointer, :eet_version_p # typedef struct _Eet_File Eet_File; typedef :pointer, :eet_file typedef :pointer, :eet_file_p @@ -124,10 +125,12 @@ module Efl # typedef Eina_Bool Eet_Write_Cb (const void *data, size_t size, void *user_data); callback :eet_write_cb, [ :void_p, :ulong, :void_p ], :eina_bool # + # VARIABLES + # EAPI extern Eet_Version *eet_version; + attach_variable :eet_version, :eet_version_p + # # FUNCTIONS fcts = [ - # EAPI extern Eet_Version *eet_version; - # FIXME # EAPI int eet_init(void); [ :eet_init, [ ], :int ], # EAPI int eet_shutdown(void); diff --git a/lib/efl/native/eina.rb b/lib/efl/native/eina.rb index 6303c70..6f7ea11 100644 --- a/lib/efl/native/eina.rb +++ b/lib/efl/native/eina.rb @@ -27,13 +27,16 @@ module Efl # TYPEDEFS # typedef struct _Eina_Version Eina_Version; typedef :pointer, :eina_version + typedef :pointer, :eina_version_p # # CALLBACKS # + # VARIABLES + # EAPI extern Eina_Version *eina_version; + attach_variable :eina_version, :eina_version_p + # # FUNCTIONS fcts = [ - # EAPI extern Eina_Version *eina_version; - # FIXME # EAPI int eina_init(void); [ :eina_init, [ ], :int ], # EAPI int eina_shutdown(void); diff --git a/lib/efl/native/eina_hash.rb b/lib/efl/native/eina_hash.rb index a58159e..d3700c2 100644 --- a/lib/efl/native/eina_hash.rb +++ b/lib/efl/native/eina_hash.rb @@ -41,6 +41,8 @@ module Efl # typedef Eina_Bool (*Eina_Hash_Foreach) (const Eina_Hash *hash, const void *key, void *data, void *fdata); callback :eina_hash_foreach, [ :eina_hash_p, :void_p, :void_p, :void_p ], :eina_bool # + # VARIABLES + # # FUNCTIONS fcts = [ # EAPI Eina_Hash *eina_hash_new(Eina_Key_Length key_length_cb, Eina_Key_Cmp key_cmp_cb, Eina_Key_Hash key_hash_cb, Eina_Free_Cb data_free_cb, int buckets_power_size); diff --git a/lib/efl/native/eina_list.rb b/lib/efl/native/eina_list.rb index e164bc6..fe184fd 100644 --- a/lib/efl/native/eina_list.rb +++ b/lib/efl/native/eina_list.rb @@ -34,6 +34,8 @@ module Efl # # CALLBACKS # + # VARIABLES + # # FUNCTIONS fcts = [ # EAPI Eina_List *eina_list_append(Eina_List *list, const void *data); diff --git a/lib/efl/native/eina_log.rb b/lib/efl/native/eina_log.rb index e1b8e54..66c86de 100644 --- a/lib/efl/native/eina_log.rb +++ b/lib/efl/native/eina_log.rb @@ -36,10 +36,12 @@ module Efl # typedef void (*Eina_Log_Print_Cb) (const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args); callback :eina_log_print_cb, [ :eina_log_domain_p, :eina_log_level, :string, :string, :int, :string, :void_p, :pointer ], :void # + # VARIABLES + # EAPI extern int EINA_LOG_DOMAIN_GLOBAL; + attach_variable :EINA_LOG_DOMAIN_GLOBAL, :int + # # FUNCTIONS fcts = [ - # EAPI extern int; - # FIXME # EAPI void eina_log_threads_enable(void); [ :eina_log_threads_enable, [ ], :void ], # EAPI void eina_log_print_cb_set(Eina_Log_Print_Cb cb, void *data); diff --git a/lib/efl/native/eina_types.rb b/lib/efl/native/eina_types.rb index b95093d..9103946 100644 --- a/lib/efl/native/eina_types.rb +++ b/lib/efl/native/eina_types.rb @@ -37,10 +37,10 @@ module Efl # typedef void (*Eina_Free_Cb) (void *data); callback :eina_free_cb, [ :void_p ], :void # + # VARIABLES + # # FUNCTIONS fcts = [ - # EAPI extern const unsigned int eina_prime_table[]; - # FIXME ] # attach_fcts fcts diff --git a/lib/efl/native/elementary.rb b/lib/efl/native/elementary.rb index 61fd829..a02616d 100644 --- a/lib/efl/native/elementary.rb +++ b/lib/efl/native/elementary.rb @@ -124,6 +124,7 @@ module Efl # TYPEDEFS # typedef struct _Elm_Version Elm_Version; typedef :pointer, :elm_version + typedef :pointer, :elm_version_p # typedef struct _Elm_Event_Policy_Changed Elm_Event_Policy_Changed; typedef :pointer, :elm_event_policy_changed # typedef struct _Elm_Text_Class Elm_Text_Class; @@ -325,14 +326,16 @@ module Efl # typedef void *(*Elm_Store_Item_Mapping_Cb) (void *data, Elm_Store_Item *sti, const char *part); callback :elm_store_item_mapping_cb, [ :void_p, :elm_store_item_p, :string ], :void_p # - # FUNCTIONS - fcts = [ + # VARIABLES # EAPI extern Elm_Version *elm_version; - # FIXME + attach_variable :elm_version, :elm_version_p # EAPI extern int ELM_ECORE_EVENT_ETHUMB_CONNECT; - # FIXME + attach_variable :ELM_ECORE_EVENT_ETHUMB_CONNECT, :int # EAPI extern int ELM_EVENT_POLICY_CHANGED; - # FIXME + attach_variable :ELM_EVENT_POLICY_CHANGED, :int + # + # FUNCTIONS + fcts = [ # EAPI int elm_init(int argc, char **argv); [ :elm_init, [ :int, :string_array ], :int ], # EAPI int elm_shutdown(void); diff --git a/lib/efl/native/evas.rb b/lib/efl/native/evas.rb index 46088d0..20103b7 100644 --- a/lib/efl/native/evas.rb +++ b/lib/efl/native/evas.rb @@ -93,6 +93,7 @@ module Efl # TYPEDEFS # typedef struct _Evas_Version Evas_Version; typedef :pointer, :evas_version + typedef :pointer, :evas_version_p # typedef struct _Evas_Coord_Rectangle Evas_Coord_Rectangle; typedef :pointer, :evas_coord_rectangle # typedef struct _Evas_Point Evas_Point; @@ -253,10 +254,12 @@ module Efl # typedef void (*Evas_Object_Box_Layout) (Evas_Object *o, Evas_Object_Box_Data *priv, void *user_data); callback :evas_object_box_layout, [ :evas_object_p, :evas_object_box_data_p, :void_p ], :void # + # VARIABLES + # EAPI extern Evas_Version *evas_version; + attach_variable :evas_version, :evas_version_p + # # FUNCTIONS fcts = [ - # EAPI extern Evas_Version *evas_version; - # FIXME # EAPI int evas_init (void); [ :evas_init, [ ], :int ], # EAPI int evas_shutdown (void); diff --git a/tools/extract-api.sh b/tools/extract-api.sh index a681465..27a32bc 100755 --- a/tools/extract-api.sh +++ b/tools/extract-api.sh @@ -46,7 +46,7 @@ for header in \ DIR=$(dirname $header) FILE=$(basename $header) # - for what in functions enums types callbacks; do + for what in functions enums types callbacks variables; do F=$FILE-$what cat $header | sed -r -n -f $P/sed-$what > $CURRENT/$F if [ -f $PREV/$F ]; then diff --git a/tools/genruby.rb b/tools/genruby.rb index c7d1115..5065a7d 100755 --- a/tools/genruby.rb +++ b/tools/genruby.rb @@ -225,6 +225,22 @@ def gen_callbacks path, indent r end # +def gen_variables path, indent + r = [] + open(path+'-variables','r').readlines.each do |l| + l.strip! + if not l=~ /EAPI\s+extern\s+(\w+\s+\*?)(\w+)/ + r << indent+"# #{l}\n#{indent}# FIXME" + next + end + var = $2 + t = $1 + r << indent+"# #{l}" + r << wrap_text(indent+"attach_variable :#{var}, #{get_type t}", indent+' '*4) + end + r +end +# def gen_functions path, indent r = [] r << indent+"fcts = [" @@ -258,10 +274,12 @@ libraries.collect do |header,module_name,fct_prefix,lib, output| r << gen_typedefs(base, INDENT) print "callbacks, " r << gen_callbacks(base, INDENT) + print "variables, " + r << gen_variables(base, INDENT) puts "functions." r << gen_functions(base, INDENT) r -end.each do |lib, output, module_name, fct_prefix, enums, typedefs, callbacks, functions| +end.each do |lib, output, module_name, fct_prefix, enums, typedefs, callbacks, variables, functions| printf "%-60s", "generate #{output}" open(output,'w:utf-8') do |f| f << HEADER.gsub(/MNAME/,module_name).sub(/FCT_PREFIX/,fct_prefix) @@ -275,6 +293,9 @@ end.each do |lib, output, module_name, fct_prefix, enums, typedefs, callbacks, f f << "\n#{INDENT}#\n#{INDENT}# CALLBACKS" print "callbacks, " f << "\n"+callbacks.join("\n") unless callbacks.empty? + f << "\n#{INDENT}#\n#{INDENT}# VARIABLES" + print "variables, " + f << "\n"+variables.join("\n") unless variables.empty? f << "\n#{INDENT}#\n#{INDENT}# FUNCTIONS" puts "functions." f << "\n"+functions.join("\n") unless functions.empty? diff --git a/tools/sed-functions b/tools/sed-functions index faf8bc7..296cab1 100644 --- a/tools/sed-functions +++ b/tools/sed-functions @@ -1,4 +1,4 @@ - +/EAPI extern/ b # if return type on single line, append next line /EAPI.*[^;]\s*$/ { N; s/\n/ / } # while unfinished argument list, append next line |