diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-08-18 11:25:50 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-08-18 11:25:50 +0200 |
commit | bb14171ebb00d13812c084756ad3bde3bbd21536 (patch) | |
tree | b49d2b14ed600abce811442ee70c1e550075ad36 | |
parent | 7798cb305fe46a554867a4f233c048bea4ac2a7a (diff) | |
download | ffi-efl-bb14171ebb00d13812c084756ad3bde3bbd21536.zip ffi-efl-bb14171ebb00d13812c084756ad3bde3bbd21536.tar.gz |
add Emap
-rw-r--r-- | lib/efl/native/emap.rb | 93 | ||||
-rwxr-xr-x | tools/genruby.rb | 2 |
2 files changed, 94 insertions, 1 deletions
diff --git a/lib/efl/native/emap.rb b/lib/efl/native/emap.rb new file mode 100644 index 0000000..7bad804 --- /dev/null +++ b/lib/efl/native/emap.rb @@ -0,0 +1,93 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/ffi' +# +module Efl + # + module EMap + # + FCT_PREFIX = 'emap_' + # + def self.method_missing m, *args, &block + sym, args_s = ModuleHelper.find_function m, FCT_PREFIX + self.module_eval "def self.#{m} *args, █ r=Efl::Native.#{sym}(#{args_s}); yield r if block_given?; r; end" + self.send m, *args, &block + end + # + end + # + module Native + # + extend Efl::FFIHelper + # + ffi_lib 'emap' + # + # ENUMS + # typedef enum emap_route_type {...} EMap_Route_Type; + enum :emap_route_type, [ :emap_track_type_gpx ] + # + # TYPEDEFS + # typedef struct emap_route EMap_Route; + typedef :pointer, :emap_route + typedef :pointer, :emap_route_p + # typedef struct emap_route_node EMap_Route_Node; + typedef :pointer, :emap_route_node + typedef :pointer, :emap_route_node_p + # + # CALLBACKS + # + # VARIABLES + # + # FUNCTIONS + fcts = [ + # EAPI int emap_init(); + [ :emap_init, [ ], :int ], + # EAPI int emap_shutdown(); + [ :emap_shutdown, [ ], :int ], + # EAPI EMap_Route *emap_route_new(); + [ :emap_route_new, [ ], :emap_route_p ], + # EAPI void emap_route_node_add(EMap_Route *route, EMap_Route_Node *node); + [ :emap_route_node_add, [ :emap_route_p, :emap_route_node_p ], :void ], + # EAPI void emap_route_free(EMap_Route *route); + [ :emap_route_free, [ :emap_route_p ], :void ], + # EAPI void emap_route_name_set(EMap_Route *route, const char *name); + [ :emap_route_name_set, [ :emap_route_p, :string ], :void ], + # EAPI const char *emap_route_name_get(EMap_Route *route); + [ :emap_route_name_get, [ :emap_route_p ], :string ], + # EAPI Eina_List *emap_route_nodes_get(EMap_Route *route); + [ :emap_route_nodes_get, [ :emap_route_p ], :eina_list_p ], + # EAPI double emap_route_distance_get(EMap_Route *route); + [ :emap_route_distance_get, [ :emap_route_p ], :double ], + # EAPI EMap_Route_Node *emap_route_node_new(); + [ :emap_route_node_new, [ ], :emap_route_node_p ], + # EAPI void emap_route_node_lon_set(EMap_Route_Node *node, double lon); + [ :emap_route_node_lon_set, [ :emap_route_node_p, :double ], :void ], + # EAPI void emap_route_node_lat_set(EMap_Route_Node *node, double lat); + [ :emap_route_node_lat_set, [ :emap_route_node_p, :double ], :void ], + # EAPI double emap_route_node_lon_get(EMap_Route_Node *node); + [ :emap_route_node_lon_get, [ :emap_route_node_p ], :double ], + # EAPI double emap_route_node_lat_get(EMap_Route_Node *node); + [ :emap_route_node_lat_get, [ :emap_route_node_p ], :double ], + # EAPI void emap_route_node_elevation_set(EMap_Route_Node *node, double elevation); + [ :emap_route_node_elevation_set, [ :emap_route_node_p, :double ], :void ], + # EAPI double emap_route_node_elevation_get(EMap_Route_Node *node); + [ :emap_route_node_elevation_get, [ :emap_route_node_p ], :double ], + # EAPI void emap_route_node_time_set(EMap_Route_Node *node, time_t time); + [ :emap_route_node_time_set, [ :emap_route_node_p, :ulong ], :void ], + # EAPI time_t emap_route_node_time_get(EMap_Route_Node *node); + [ :emap_route_node_time_get, [ :emap_route_node_p ], :ulong ], + # EAPI double emap_route_nodes_distance_get(EMap_Route_Node *A, EMap_Route_Node *B); + [ :emap_route_nodes_distance_get, [ :emap_route_node_p, :emap_route_node_p ], :double ], + # EAPI void emap_route_node_free(EMap_Route_Node *node); + [ :emap_route_node_free, [ :emap_route_node_p ], :void ], + # EAPI EMap_Route * emap_route_gpx_new(const char *file); + [ :emap_route_gpx_new, [ :string ], :emap_route_p ], + ] + # + attach_fcts fcts + # + end +end +# +# EOF diff --git a/tools/genruby.rb b/tools/genruby.rb index c9ee5f1..4f1396f 100755 --- a/tools/genruby.rb +++ b/tools/genruby.rb @@ -23,7 +23,7 @@ libraries = [ [ 'Ecore_Evas.h', 'EcoreEvas', 'ecore_evas', 'ecore_evas', 'ecore_evas.rb' ], # [ 'Ecore_Fb.h', 'EcoreFb', 'ecore', 'ecore', 'ecore/ecore_fb.rb' ], # [ 'Ecore_File.h', 'EcoreFile', 'ecore', 'ecore', 'ecore/ecore_file.rb' ], - [ 'EMap.h', 'EMap', 'emap', 'emap', 'emap.rb' ], + [ 'EMap.h', 'EMap', 'emap', 'emap', 'emap.rb' ], [ 'Elementary.h', 'Elm', 'elm', 'libelementary-ver-pre-svn-09.so.0', 'elementary.rb' ], ] # |