local ffi = require("ffi")
local C = ffi.C
+local tonum = ffi.tonumber or tonumber
+
local iterator = require("eina.iterator")
require("eina.xattr")
if not v then return nil end
local s = ffi.cast("Eina_File_Direct_Info*", v)
local path = ffi.string(s.path, s.path_length)
- local ns = tonumber(s.name_start)
- local nl = tonumber(s.name_length)
+ local ns = tonum(s.name_start)
+ local nl = tonum(s.name_length)
local tp = file_type_map[s.type]
return Direct_Info(path, ns, nl, tp), self:container_get()
end
local v = Iterator.next(self)
if not v then return nil end
v = ffi.cast(v, "Eina_File_Line*")
- return ffi.string(v.start, v.length), tonumber(v.index)
+ return ffi.string(v.start, v.length), tonum(v.index)
end
}
end,
size_get = function(self)
- return tonumber(eina.eina_file_size_get(self))
+ return tonum(eina.eina_file_size_get(self))
end,
mtime_get = function(self)
- return tonumber(eina.eina_file_mtime_get(self))
+ return tonum(eina.eina_file_mtime_get(self))
end,
filename_get = function(self)
local cutil = require("cutil")
local util = require("util")
+local tonum = ffi.tonumber or tonumber
+
local iterator = require("eina.iterator")
local Ptr_Iterator = iterator.Ptr_Iterator
end,
type_get = function(self)
- return tonumber(eolian.eolian_object_type_get(cast_obj(self)))
+ return tonum(eolian.eolian_object_type_get(cast_obj(self)))
end,
unit_get = function(self)
end,
line_get = function(self)
- return tonumber(eolian.eolian_object_line_get(cast_obj(self)))
+ return tonum(eolian.eolian_object_line_get(cast_obj(self)))
end,
column_get = function(self)
- return tonumber(eolian.eolian_object_column_get(cast_obj(self)))
+ return tonum(eolian.eolian_object_column_get(cast_obj(self)))
end,
file_get = function(self)
end,
version_get = function(self)
- return tonumber(eolian.eolian_unit_version_get(cast_unit(self)))
+ return tonum(eolian.eolian_unit_version_get(cast_unit(self)))
end,
object_by_name_get = function(self, name)
local error_cbs = {}
local obj_to_idx = function(obj)
- return tonumber(ffi.cast("size_t", obj))
+ return tonum(ffi.cast("size_t", obj))
end
local panic_cb, err_cb
M.Typedecl = ffi.metatype("Eolian_Typedecl", {
__index = wrap_object {
type_get = function(self)
- return tonumber(eolian.eolian_typedecl_type_get(self))
+ return tonum(eolian.eolian_typedecl_type_get(self))
end,
struct_fields_get = function(self)
M.Type = ffi.metatype("Eolian_Type", {
__index = wrap_object {
type_get = function(self)
- return tonumber(eolian.eolian_type_type_get(self))
+ return tonum(eolian.eolian_type_type_get(self))
end,
builtin_type_get = function(self)
- return tonumber(eolian.eolian_type_builtin_type_get(self))
+ return tonum(eolian.eolian_type_builtin_type_get(self))
end,
base_type_get = function(self)
M.Function = ffi.metatype("Eolian_Function", {
__index = wrap_object {
type_get = function(self)
- return tonumber(eolian.eolian_function_type_get(self))
+ return tonum(eolian.eolian_function_type_get(self))
end,
scope_get = function(self, ftype)
- return tonumber(eolian.eolian_function_scope_get(self, ftype))
+ return tonum(eolian.eolian_function_scope_get(self, ftype))
end,
full_c_name_get = function(self, ftype)
ffi.metatype("Eolian_Function_Parameter", {
__index = wrap_object {
direction_get = function(self)
- return tonumber(eolian.eolian_parameter_direction_get(self))
+ return tonum(eolian.eolian_parameter_direction_get(self))
end,
type_get = function(self)
end,
scope_get = function(self)
- return tonumber(eolian.eolian_event_scope_get(self))
+ return tonum(eolian.eolian_event_scope_get(self))
end,
c_macro_get = function(self)
M.Class = ffi.metatype("Eolian_Class", {
__index = wrap_object {
type_get = function(self)
- return tonumber(eolian.eolian_class_type_get(self))
+ return tonum(eolian.eolian_class_type_get(self))
end,
documentation_get = function(self)
emask.ALL = emask.NUMBER + emask.BOOL + emask.STRING + emask.CHAR + emask.NULL
local value_con = {
- [etype.INT ] = function(v) return tonumber(v.value.i ) end,
- [etype.UINT ] = function(v) return tonumber(v.value.u ) end,
+ [etype.INT ] = function(v) return tonum(v.value.i ) end,
+ [etype.UINT ] = function(v) return tonum(v.value.u ) end,
[etype.LONG ] = function(v) return v.value.l end,
[etype.ULONG ] = function(v) return v.value.ul end,
[etype.LLONG ] = function(v) return v.value.ll end,
[etype.ULLONG] = function(v) return v.value.ull end,
- [etype.FLOAT ] = function(v) return tonumber(v.value.f ) end,
- [etype.DOUBLE] = function(v) return tonumber(v.value.d ) end,
+ [etype.FLOAT ] = function(v) return tonum(v.value.f ) end,
+ [etype.DOUBLE] = function(v) return tonum(v.value.d ) end,
[etype.STRING] = function(v) return ffi.string(v.value.s ) end,
[etype.CHAR ] = function(v) return string.char(v.value.c) end,
[etype.NULL ] = function(v) return nil end,
M.Value = ffi.metatype("Eolian_Value", {
__index = {
get_type = function(self)
- return tonumber(ffi.cast("Eolian_Value_t*", self).type)
+ return tonum(ffi.cast("Eolian_Value_t*", self).type)
end,
get_value = function(self)
local tp = self:get_type()
- local fun = value_con[tonumber(tp)]
+ local fun = value_con[tonum(tp)]
if not fun then return nil end
return fun()
end,
end,
type_get = function(self)
- return tonumber(eolian.eolian_expression_type_get(self))
+ return tonum(eolian.eolian_expression_type_get(self))
end,
binary_operator_get = function(self)
- return tonumber(eolian.eolian_expression_binary_operator_get(self))
+ return tonum(eolian.eolian_expression_binary_operator_get(self))
end,
binary_lhs_get = function(self)
end,
unary_operator_get = function(self)
- return tonumber(eolian.eolian_expression_unary_operator_get(self))
+ return tonum(eolian.eolian_expression_unary_operator_get(self))
end,
unary_expression_get = function(self)
M.Eolian_Doc_Token = ffi.metatype("Eolian_Doc_Token", {
__index = {
type_get = function(self)
- return tonumber(eolian.eolian_doc_token_type_get(self))
+ return tonum(eolian.eolian_doc_token_type_get(self))
end,
text_get = function(self)
ref_resolve = function(self, state)
local stor = ffi.new("const Eolian_Object *[2]")
- local tp = tonumber(eolian.eolian_doc_token_ref_resolve(self, state, stor, stor + 1))
+ local sp = ffi.cast("const Eolian_Object **", stor)
+ local tp = tonum(eolian.eolian_doc_token_ref_resolve(self, state, sp, sp + 1))
local reft = M.object_type
if tp == reft.CLASS then
return tp, ffi.cast("const Eolian_Class *", stor[0])