From e42ef336cc3c02f13807dc472947425a60268858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 21 Dec 2012 00:58:42 +0100 Subject: generate eina_file native mapping --- lib/efl/native/eina_file.rb | 91 +++++++++++++++++++++++++++++++++++++++++++++ tools/extract-api.sh | 1 + tools/genruby.rb | 6 +++ 3 files changed, 98 insertions(+) create mode 100644 lib/efl/native/eina_file.rb diff --git a/lib/efl/native/eina_file.rb b/lib/efl/native/eina_file.rb new file mode 100644 index 0000000..8d528fe --- /dev/null +++ b/lib/efl/native/eina_file.rb @@ -0,0 +1,91 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/native' +# +module Efl + # + module EinaFile + # + FCT_PREFIX = 'eina_file_' unless const_defined? :FCT_PREFIX + # + def self.method_missing meth, *args, &block + sym = Efl::MethodResolver.resolve self, meth, FCT_PREFIX + self.send sym, *args, &block + end + # + end + # + module Native + # + ffi_lib 'eina' + # + # ENUMS + # typedef enum {...} Eina_File_Type; + enum :eina_file_type, [ :eina_file_unknown, :eina_file_fifo, :eina_file_chr, :eina_file_dir, :eina_file_blk, :eina_file_reg, :eina_file_lnk, + :eina_file_sock, :eina_file_wht ] + # typedef enum {...} Eina_File_Populate; + enum :eina_file_populate, [ :eina_file_random, :eina_file_sequential, :eina_file_willneed, :eina_file_populate ] + # + # TYPEDEFS + # typedef struct _Eina_File_Direct_Info Eina_File_Direct_Info; + typedef :pointer, :eina_file_direct_info + # typedef struct _Eina_Stat Eina_Stat; + typedef :pointer, :eina_stat + # typedef struct _Eina_File_Line Eina_File_Line; + typedef :pointer, :eina_file_line + # typedef struct _Eina_File Eina_File; + typedef :pointer, :eina_file + # + # CALLBACKS + # typedef void (*Eina_File_Dir_List_Cb) (const char *name, const char *path, void *data); + callback :eina_file_dir_list_cb, [ :string, :string, :pointer ], :void + # + # FUNCTIONS + fcts = [ + # EAPI Eina_Bool eina_file_dir_list(const char *dir, Eina_Bool recursive, Eina_File_Dir_List_Cb cb, void *data); + [ :eina_file_dir_list, [ :string, :bool, :eina_file_dir_list_cb, :pointer ], :bool ], + # EAPI Eina_Array *eina_file_split(char *path); + [ :eina_file_split, [ :string ], :pointer ], + # EAPI Eina_Iterator *eina_file_ls(const char *dir); + [ :eina_file_ls, [ :string ], :pointer ], + # EAPI Eina_Iterator *eina_file_stat_ls(const char *dir); + [ :eina_file_stat_ls, [ :string ], :pointer ], + # EAPI int eina_file_statat(void *container, Eina_File_Direct_Info *info, Eina_Stat *buf); + [ :eina_file_statat, [ :pointer, :eina_file_direct_info, :eina_stat ], :int ], + # EAPI Eina_Iterator *eina_file_direct_ls(const char *dir); + [ :eina_file_direct_ls, [ :string ], :pointer ], + # EAPI char *eina_file_path_sanitize(const char *path); + [ :eina_file_path_sanitize, [ :string ], :string ], + # EAPI Eina_File *eina_file_open(const char *name, Eina_Bool shared); + [ :eina_file_open, [ :string, :bool ], :eina_file ], + # EAPI void eina_file_close(Eina_File *file); + [ :eina_file_close, [ :eina_file ], :void ], + # EAPI size_t eina_file_size_get(Eina_File *file); + [ :eina_file_size_get, [ :eina_file ], :ulong ], + # EAPI time_t eina_file_mtime_get(Eina_File *file); + [ :eina_file_mtime_get, [ :eina_file ], :ulong ], + # EAPI const char *eina_file_filename_get(Eina_File *file); + [ :eina_file_filename_get, [ :eina_file ], :string ], + # EAPI Eina_Iterator *eina_file_xattr_get(Eina_File *file); + [ :eina_file_xattr_get, [ :eina_file ], :pointer ], + # EAPI Eina_Iterator *eina_file_xattr_value_get(Eina_File *file); + [ :eina_file_xattr_value_get, [ :eina_file ], :pointer ], + # EAPI void *eina_file_map_all(Eina_File *file, Eina_File_Populate rule); + [ :eina_file_map_all, [ :eina_file, :eina_file_populate ], :pointer ], + # EAPI void *eina_file_map_new(Eina_File *file, Eina_File_Populate rule, unsigned long int offset, unsigned long int length); + [ :eina_file_map_new, [ :eina_file, :eina_file_populate, :ulong, :ulong ], :pointer ], + # EAPI void eina_file_map_free(Eina_File *file, void *map); + [ :eina_file_map_free, [ :eina_file, :pointer ], :void ], + # EAPI Eina_Iterator *eina_file_map_lines(Eina_File *file); + [ :eina_file_map_lines, [ :eina_file ], :pointer ], + # EAPI Eina_Bool eina_file_map_faulted(Eina_File *file, void *map); + [ :eina_file_map_faulted, [ :eina_file, :pointer ], :bool ], + ] + # + attach_fcts fcts + # + end +end +# +# EOF diff --git a/tools/extract-api.sh b/tools/extract-api.sh index ff0b6ff..f9ef6fa 100755 --- a/tools/extract-api.sh +++ b/tools/extract-api.sh @@ -32,6 +32,7 @@ for header in \ "${INCLUDE}/eina-1/eina/eina_log.h" \ "${INCLUDE}/eina-1/eina/eina_list.h" \ "${INCLUDE}/eina-1/eina/eina_hash.h" \ + "${INCLUDE}/eina-1/eina/eina_file.h" \ "${INCLUDE}/eet-1/Eet.h" \ "${INCLUDE}/edje-1/Edje.h" \ "${INCLUDE}/evas-1/Evas.h" \ diff --git a/tools/genruby.rb b/tools/genruby.rb index 92bc5b0..d5649f1 100755 --- a/tools/genruby.rb +++ b/tools/genruby.rb @@ -243,6 +243,7 @@ TYPES = { 'unsigned int' => ':uint', 'unsigned char' => ':uchar', 'unsigned short' => ':ushort', + 'unsigned long int' => ':ulong', 'unsigned long long' => ':ulong_long', 'char *' => ':string', # FIXME ?!?! 'fd_set *' => ':pointer', @@ -294,6 +295,11 @@ libs << { :requires=>[], :constants=>[] } libs << { + :lib=>'eina', :header=>'eina_file.h', + :modname=>'EinaFile', :prefix=>'eina_file', :outfile=>'eina_file.rb', + :requires=>[], :constants=>[] +} +libs << { :lib=>'eet', :header=>'Eet.h', :modname=>'Eet', :prefix=>'eet', :outfile=>'eet.rb', :requires=>["#{NATIVE}/eina_xattr","#{NATIVE}/eina_list"], :constants=>[] -- cgit v1.1-2-g2b99