forked from enlightenment/efl
elua: eina bindings fixes, include support in lualian
This commit is contained in:
parent
7508be9cdb
commit
aae4567b4d
|
@ -26,6 +26,7 @@ local Node = util.Object:clone {
|
||||||
|
|
||||||
gen_children = function(self, s)
|
gen_children = function(self, s)
|
||||||
for i, v in ipairs(self.children) do
|
for i, v in ipairs(self.children) do
|
||||||
|
v.parent_node = self
|
||||||
v:generate(s)
|
v:generate(s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -43,7 +44,18 @@ local Property = Node:clone {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
generate = function(self, s)
|
generate = function(self, s)
|
||||||
|
local prop = self.property
|
||||||
|
local par = self.parent_node
|
||||||
|
local name = prop:name_get()
|
||||||
|
local isget = prop:type_get() == eolian.function_type.PROP_GET
|
||||||
|
local suffix = isget and "_get" or "_set"
|
||||||
|
local ret = isget and "return " or ""
|
||||||
|
s:write(([[
|
||||||
|
%s%s = function(self)
|
||||||
|
%slibname.%s_%s%s()
|
||||||
|
end
|
||||||
|
|
||||||
|
]]):format(name, suffix, ret, par.prefix, name, suffix))
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +68,7 @@ local Destructor = Node:clone {
|
||||||
local Mixin = Node:clone {
|
local Mixin = Node:clone {
|
||||||
__ctor = function(self, cname, ch)
|
__ctor = function(self, cname, ch)
|
||||||
self.cname = cname
|
self.cname = cname
|
||||||
|
self.prefix = eolian.class_eo_prefix_get(cname)
|
||||||
self.children = ch
|
self.children = ch
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -76,6 +89,7 @@ local Class = Node:clone {
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.interfaces = interfaces
|
self.interfaces = interfaces
|
||||||
self.mixins = mixins
|
self.mixins = mixins
|
||||||
|
self.prefix = eolian.class_eo_prefix_get(cname)
|
||||||
self.children = ch
|
self.children = ch
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -91,7 +105,8 @@ M.%s = Parent:clone {
|
||||||
s:write("\n}\n")
|
s:write("\n}\n")
|
||||||
|
|
||||||
for i, v in ipairs(self.mixins) do
|
for i, v in ipairs(self.mixins) do
|
||||||
s:write("\nM.%s:mixin(eo.class_get(\"%s\"))\n", self.cname, v)
|
s:write(("\nM.%s:mixin(eo.class_get(\"%s\"))\n")
|
||||||
|
:format(self.cname, v))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -160,16 +175,25 @@ local gen_class = function(classn)
|
||||||
elseif tp == ct.MIXIN or tp == ct.INTERFACE then
|
elseif tp == ct.MIXIN or tp == ct.INTERFACE then
|
||||||
mixins[#mixins + 1] = v
|
mixins[#mixins + 1] = v
|
||||||
else
|
else
|
||||||
error(classn .. ": unknown inherit")
|
error(classn .. ": unknown inherit " .. v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return Class(classn, parent, mixins, gen_contents(classn))
|
return Class(classn, parent, mixins, gen_contents(classn))
|
||||||
end
|
end
|
||||||
|
|
||||||
M.generate = function(fname, fstream)
|
M.generate = function(files, include_files, fstream)
|
||||||
if not eolian.eo_file_parse(fname) then
|
for i, file in ipairs(include_files) do
|
||||||
error("Failed parsing file: " .. fname)
|
if not eolian.eo_file_parse(file) then
|
||||||
|
error("Failed parsing include file: " .. file)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
for i, file in ipairs(files) do
|
||||||
|
if not eolian.eo_file_parse(file) then
|
||||||
|
error("Failed parsing file: " .. file)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i, file in ipairs(files) do
|
||||||
|
local fname = files[i]
|
||||||
local classn = eolian.class_find_by_file(fname)
|
local classn = eolian.class_find_by_file(fname)
|
||||||
local tp = eolian.class_type_get(classn)
|
local tp = eolian.class_type_get(classn)
|
||||||
local ct = eolian.class_type
|
local ct = eolian.class_type
|
||||||
|
@ -183,5 +207,6 @@ M.generate = function(fname, fstream)
|
||||||
end
|
end
|
||||||
File(fname, classn, { cl }):generate(fstream)
|
File(fname, classn, { cl }):generate(fstream)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
|
@ -9,6 +9,7 @@ require("eina.xattr")
|
||||||
|
|
||||||
ffi.cdef [[
|
ffi.cdef [[
|
||||||
typedef unsigned char Eina_Bool;
|
typedef unsigned char Eina_Bool;
|
||||||
|
typedef long time_t;
|
||||||
|
|
||||||
typedef struct _Eina_File_Direct_Info Eina_File_Direct_Info;
|
typedef struct _Eina_File_Direct_Info Eina_File_Direct_Info;
|
||||||
typedef struct _Eina_Stat Eina_Stat;
|
typedef struct _Eina_Stat Eina_Stat;
|
||||||
|
@ -77,14 +78,14 @@ ffi.cdef [[
|
||||||
unsigned long long length;
|
unsigned long long length;
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI Eina_Bool eina_file_dir_list(const char *dir, Eina_Bool recursive,
|
Eina_Bool eina_file_dir_list(const char *dir, Eina_Bool recursive,
|
||||||
Eina_File_Dir_List_Cb cb, void *data);
|
Eina_File_Dir_List_Cb cb, void *data);
|
||||||
EAPI Eina_Iterator *eina_file_ls(const char *dir);
|
Eina_Iterator *eina_file_ls(const char *dir);
|
||||||
EAPI Eina_Iterator *eina_file_stat_ls(const char *dir);
|
Eina_Iterator *eina_file_stat_ls(const char *dir);
|
||||||
EAPI int eina_file_statat(void *container, Eina_File_Direct_Info *info,
|
int eina_file_statat(void *container, Eina_File_Direct_Info *info,
|
||||||
Eina_Stat *buf);
|
Eina_Stat *buf);
|
||||||
EAPI Eina_Iterator *eina_file_direct_ls(const char *dir);
|
Eina_Iterator *eina_file_direct_ls(const char *dir);
|
||||||
EAPI char *eina_file_path_sanitize(const char *path);
|
char *eina_file_path_sanitize(const char *path);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EINA_FILE_COPY_DATA = 0,
|
EINA_FILE_COPY_DATA = 0,
|
||||||
|
@ -92,29 +93,29 @@ ffi.cdef [[
|
||||||
EINA_FILE_COPY_XATTR = (1 << 1)
|
EINA_FILE_COPY_XATTR = (1 << 1)
|
||||||
} Eina_File_Copy_Flags;
|
} Eina_File_Copy_Flags;
|
||||||
|
|
||||||
EAPI Eina_Bool eina_file_copy(const char *src, const char *dst,
|
Eina_Bool eina_file_copy(const char *src, const char *dst,
|
||||||
Eina_File_Copy_Flags flags, Eina_File_Copy_Progress cb,
|
Eina_File_Copy_Flags flags, Eina_File_Copy_Progress cb,
|
||||||
const void *cb_data);
|
const void *cb_data);
|
||||||
EAPI Eina_File *eina_file_open(const char *name, Eina_Bool shared);
|
Eina_File *eina_file_open(const char *name, Eina_Bool shared);
|
||||||
EAPI Eina_File *eina_file_virtualize(const char *virtual_name,
|
Eina_File *eina_file_virtualize(const char *virtual_name,
|
||||||
const void *data, unsigned long long length, Eina_Bool copy);
|
const void *data, unsigned long long length, Eina_Bool copy);
|
||||||
EAPI Eina_Bool eina_file_virtual(Eina_File *file);
|
Eina_Bool eina_file_virtual(Eina_File *file);
|
||||||
EAPI Eina_Bool eina_file_refresh(Eina_File *file);
|
Eina_Bool eina_file_refresh(Eina_File *file);
|
||||||
EAPI Eina_File *eina_file_dup(const Eina_File *file);
|
Eina_File *eina_file_dup(const Eina_File *file);
|
||||||
EAPI void eina_file_close(Eina_File *file);
|
void eina_file_close(Eina_File *file);
|
||||||
EAPI size_t eina_file_size_get(const Eina_File *file);
|
size_t eina_file_size_get(const Eina_File *file);
|
||||||
EAPI time_t eina_file_mtime_get(const Eina_File *file);
|
time_t eina_file_mtime_get(const Eina_File *file);
|
||||||
EAPI const char *eina_file_filename_get(const Eina_File *file);
|
const char *eina_file_filename_get(const Eina_File *file);
|
||||||
EAPI Eina_Iterator *eina_file_xattr_get(Eina_File *file);
|
Eina_Iterator *eina_file_xattr_get(Eina_File *file);
|
||||||
EAPI Eina_Iterator *eina_file_xattr_value_get(Eina_File *file);
|
Eina_Iterator *eina_file_xattr_value_get(Eina_File *file);
|
||||||
EAPI void *eina_file_map_all(Eina_File *file, Eina_File_Populate rule);
|
void *eina_file_map_all(Eina_File *file, Eina_File_Populate rule);
|
||||||
EAPI void *eina_file_map_new(Eina_File *file, Eina_File_Populate rule,
|
void *eina_file_map_new(Eina_File *file, Eina_File_Populate rule,
|
||||||
unsigned long int offset, unsigned long int length);
|
unsigned long int offset, unsigned long int length);
|
||||||
EAPI void eina_file_map_free(Eina_File *file, void *map);
|
void eina_file_map_free(Eina_File *file, void *map);
|
||||||
EAPI void eina_file_map_populate(Eina_File *file, Eina_File_Populate rule,
|
void eina_file_map_populate(Eina_File *file, Eina_File_Populate rule,
|
||||||
const void *map, unsigned long int offset, unsigned long int length);
|
const void *map, unsigned long int offset, unsigned long int length);
|
||||||
EAPI Eina_Iterator *eina_file_map_lines(Eina_File *file);
|
Eina_Iterator *eina_file_map_lines(Eina_File *file);
|
||||||
EAPI Eina_Bool eina_file_map_faulted(Eina_File *file, void *map);
|
Eina_Bool eina_file_map_faulted(Eina_File *file, void *map);
|
||||||
|
|
||||||
void eina_stringshare_del (const char *str);
|
void eina_stringshare_del (const char *str);
|
||||||
int eina_stringshare_strlen(const char *str);
|
int eina_stringshare_strlen(const char *str);
|
||||||
|
|
|
@ -8,6 +8,7 @@ local iterator = require("eina.iterator")
|
||||||
|
|
||||||
ffi.cdef [[
|
ffi.cdef [[
|
||||||
typedef unsigned char Eina_Bool;
|
typedef unsigned char Eina_Bool;
|
||||||
|
typedef ptrdiff_t ssize_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EINA_XATTR_INSERT,
|
EINA_XATTR_INSERT,
|
||||||
|
@ -22,24 +23,24 @@ ffi.cdef [[
|
||||||
size_t length;
|
size_t length;
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI Eina_Iterator *eina_xattr_ls(const char *file);
|
Eina_Iterator *eina_xattr_ls(const char *file);
|
||||||
EAPI Eina_Iterator *eina_xattr_value_ls(const char *file);
|
Eina_Iterator *eina_xattr_value_ls(const char *file);
|
||||||
EAPI Eina_Iterator *eina_xattr_fd_ls(int fd);
|
Eina_Iterator *eina_xattr_fd_ls(int fd);
|
||||||
EAPI Eina_Iterator *eina_xattr_value_fd_ls(int fd);
|
Eina_Iterator *eina_xattr_value_fd_ls(int fd);
|
||||||
EAPI Eina_Bool eina_xattr_copy(const char *src, const char *dst);
|
Eina_Bool eina_xattr_copy(const char *src, const char *dst);
|
||||||
EAPI Eina_Bool eina_xattr_fd_copy(int src, int dst);
|
Eina_Bool eina_xattr_fd_copy(int src, int dst);
|
||||||
EAPI void *eina_xattr_get(const char *file, const char *attribute, ssize_t *size);
|
void *eina_xattr_get(const char *file, const char *attribute, ssize_t *size);
|
||||||
EAPI void *eina_xattr_fd_get(int fd, const char *attribute, ssize_t *size);
|
void *eina_xattr_fd_get(int fd, const char *attribute, ssize_t *size);
|
||||||
EAPI Eina_Bool eina_xattr_set(const char *file, const char *attribute, const void *data, ssize_t length, Eina_Xattr_Flags flags);
|
Eina_Bool eina_xattr_set(const char *file, const char *attribute, const void *data, ssize_t length, Eina_Xattr_Flags flags);
|
||||||
EAPI Eina_Bool eina_xattr_fd_set(int fd, const char *attribute, const void *data, ssize_t length, Eina_Xattr_Flags flags);
|
Eina_Bool eina_xattr_fd_set(int fd, const char *attribute, const void *data, ssize_t length, Eina_Xattr_Flags flags);
|
||||||
EAPI Eina_Bool eina_xattr_del(const char *file, const char *attribute);
|
Eina_Bool eina_xattr_del(const char *file, const char *attribute);
|
||||||
EAPI Eina_Bool eina_xattr_fd_del(int fd, const char *attribute);
|
Eina_Bool eina_xattr_fd_del(int fd, const char *attribute);
|
||||||
EAPI Eina_Bool eina_xattr_string_set(const char *file, const char *attribute, const char *data, Eina_Xattr_Flags flags);
|
Eina_Bool eina_xattr_string_set(const char *file, const char *attribute, const char *data, Eina_Xattr_Flags flags);
|
||||||
EAPI char *eina_xattr_string_get(const char *file, const char *attribute);
|
char *eina_xattr_string_get(const char *file, const char *attribute);
|
||||||
EAPI Eina_Bool eina_xattr_double_set(const char *file, const char *attribute, double value, Eina_Xattr_Flags flags);
|
Eina_Bool eina_xattr_double_set(const char *file, const char *attribute, double value, Eina_Xattr_Flags flags);
|
||||||
EAPI Eina_Bool eina_xattr_double_get(const char *file, const char *attribute, double *value);
|
Eina_Bool eina_xattr_double_get(const char *file, const char *attribute, double *value);
|
||||||
EAPI Eina_Bool eina_xattr_int_set(const char *file, const char *attribute, int value, Eina_Xattr_Flags flags);
|
Eina_Bool eina_xattr_int_set(const char *file, const char *attribute, int value, Eina_Xattr_Flags flags);
|
||||||
EAPI Eina_Bool eina_xattr_int_get(const char *file, const char *attribute, int *value);
|
Eina_Bool eina_xattr_int_get(const char *file, const char *attribute, int *value);
|
||||||
|
|
||||||
void free(void*);
|
void free(void*);
|
||||||
]]
|
]]
|
||||||
|
|
Loading…
Reference in New Issue