summaryrefslogtreecommitdiff
path: root/src/bindings
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-06-30 14:04:03 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-06-30 16:59:21 +0100
commitab2e608239d0518241454bd7cb6abe3f680764c1 (patch)
tree950be0f34dffe5e3962c6f850e54bd770459fd21 /src/bindings
parentff7a5e4f1b1286b1226fb0a9a1729759d1f72e18 (diff)
downloadefl-ab2e608239d0518241454bd7cb6abe3f680764c1.tar.gz
eolian: add support for static and terminated arrays
Adds two new type types, STATIC_ARRAY and TERMINATED_ARRAY. Static arrays are only allowed as struct members right now - they translate to regular C static arrays (allowing them elsewhere wouldn't be good, as C isn't very good at working with the size information). Terminated arrays are basically sequences of data terminated at the end. The base type of static arrays can be any type that is not marked ref (explicit ref may get allowed later). The base type of terminated arrays has the same restriction plus that it has to be either implicitly reference type (i.e. translating to pointer in C), integer type or a character. In case of ref types, the terminator is NULL. In case of integer types, the terminator is a zero. In case of character types, the terminator is also a zero (null terminator like C strings). @feature
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/luajit/eolian.lua23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 4f8a1c9012..9cd7050bc5 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -76,6 +76,8 @@ ffi.cdef [[
EOLIAN_TYPE_COMPLEX,
EOLIAN_TYPE_POINTER,
EOLIAN_TYPE_CLASS,
+ EOLIAN_TYPE_STATIC_ARRAY,
+ EOLIAN_TYPE_TERMINATED_ARRAY,
EOLIAN_TYPE_UNDEFINED
} Eolian_Type_Type;
@@ -300,6 +302,7 @@ ffi.cdef [[
const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
+ size_t eolian_type_array_size_get(const Eolian_Type *tp);
Eina_Bool eolian_type_is_own(const Eolian_Type *tp);
Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
Eina_Bool eolian_type_is_ref(const Eolian_Type *tp);
@@ -448,13 +451,15 @@ M.declaration_type = {
}
M.type_type = {
- UNKNOWN = 0,
- VOID = 1,
- REGULAR = 2,
- COMPLEX = 3,
- POINTER = 4,
- CLASS = 5,
- UNDEFINED = 6
+ UNKNOWN = 0,
+ VOID = 1,
+ REGULAR = 2,
+ COMPLEX = 3,
+ POINTER = 4,
+ CLASS = 5,
+ STATIC_ARRAY = 6,
+ TERMINATED_ARRAY = 7,
+ UNDEFINED = 8
}
M.typedecl_type = {
@@ -650,6 +655,10 @@ M.Type = ffi.metatype("Eolian_Type", {
return v
end,
+ array_size_get = function(self)
+ return tonumber(eolian.eolian_type_array_size_get(self))
+ end,
+
is_own = function(self)
return eolian.eolian_type_is_own(self) ~= 0
end,