summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-22 20:47:39 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-22 21:03:23 +0200
commit5e788e3a5c99a28152d5960fe49bdd3ef4d9707e (patch)
treefacd3289c96228fcba9385d3dae696c390c3e0dc
parentc146d6f877de68d789631c635290e83cfde20747 (diff)
elua: bind new eolian type builtin API
-rw-r--r--src/bindings/luajit/eolian.lua126
-rw-r--r--src/lib/eolian/eo_parser.c1
2 files changed, 127 insertions, 0 deletions
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 1f3c009682..8982ef4817 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -83,6 +83,67 @@ ffi.cdef [[
83 EOLIAN_TYPE_UNDEFINED 83 EOLIAN_TYPE_UNDEFINED
84 } Eolian_Type_Type; 84 } Eolian_Type_Type;
85 85
86 typedef enum
87 {
88 EOLIAN_TYPE_BUILTIN_INVALID = 0,
89
90 EOLIAN_TYPE_BUILTIN_BYTE,
91 EOLIAN_TYPE_BUILTIN_UBYTE,
92 EOLIAN_TYPE_BUILTIN_CHAR,
93 EOLIAN_TYPE_BUILTIN_SHORT,
94 EOLIAN_TYPE_BUILTIN_USHORT,
95 EOLIAN_TYPE_BUILTIN_INT,
96 EOLIAN_TYPE_BUILTIN_UINT,
97 EOLIAN_TYPE_BUILTIN_LONG,
98 EOLIAN_TYPE_BUILTIN_ULONG,
99 EOLIAN_TYPE_BUILTIN_LLONG,
100 EOLIAN_TYPE_BUILTIN_ULLONG,
101
102 EOLIAN_TYPE_BUILTIN_INT8,
103 EOLIAN_TYPE_BUILTIN_UINT8,
104 EOLIAN_TYPE_BUILTIN_INT16,
105 EOLIAN_TYPE_BUILTIN_UINT16,
106 EOLIAN_TYPE_BUILTIN_INT32,
107 EOLIAN_TYPE_BUILTIN_UINT32,
108 EOLIAN_TYPE_BUILTIN_INT64,
109 EOLIAN_TYPE_BUILTIN_UINT64,
110 EOLIAN_TYPE_BUILTIN_INT128,
111 EOLIAN_TYPE_BUILTIN_UINT128,
112
113 EOLIAN_TYPE_BUILTIN_SIZE,
114 EOLIAN_TYPE_BUILTIN_SSIZE,
115 EOLIAN_TYPE_BUILTIN_INTPTR,
116 EOLIAN_TYPE_BUILTIN_UINTPTR,
117 EOLIAN_TYPE_BUILTIN_PTRDIFF,
118
119 EOLIAN_TYPE_BUILTIN_TIME,
120
121 EOLIAN_TYPE_BUILTIN_FLOAT,
122 EOLIAN_TYPE_BUILTIN_DOUBLE,
123
124 EOLIAN_TYPE_BUILTIN_BOOL,
125
126 EOLIAN_TYPE_BUILTIN_VOID,
127
128 EOLIAN_TYPE_BUILTIN_ACCESSOR,
129 EOLIAN_TYPE_BUILTIN_ARRAY,
130 EOLIAN_TYPE_BUILTIN_ITERATOR,
131 EOLIAN_TYPE_BUILTIN_HASH,
132 EOLIAN_TYPE_BUILTIN_LIST,
133
134 EOLIAN_TYPE_BUILTIN_FUTURE,
135
136 EOLIAN_TYPE_BUILTIN_ANY_VALUE,
137 EOLIAN_TYPE_BUILTIN_ANY_VALUE_PTR,
138
139 EOLIAN_TYPE_BUILTIN_MSTRING,
140 EOLIAN_TYPE_BUILTIN_STRING,
141 EOLIAN_TYPE_BUILTIN_STRINGSHARE,
142
143 EOLIAN_TYPE_BUILTIN_VOID_PTR,
144 EOLIAN_TYPE_BUILTIN_FREE_CB
145 } Eolian_Type_Builtin_Type;
146
86 typedef enum { 147 typedef enum {
87 EOLIAN_C_TYPE_DEFAULT = 0, 148 EOLIAN_C_TYPE_DEFAULT = 0,
88 EOLIAN_C_TYPE_PARAM, 149 EOLIAN_C_TYPE_PARAM,
@@ -313,6 +374,7 @@ ffi.cdef [[
313 Eina_Iterator *eolian_typedecl_all_structs_get(const Eolian_Unit *unit); 374 Eina_Iterator *eolian_typedecl_all_structs_get(const Eolian_Unit *unit);
314 Eina_Iterator *eolian_typedecl_all_enums_get(const Eolian_Unit *unit); 375 Eina_Iterator *eolian_typedecl_all_enums_get(const Eolian_Unit *unit);
315 Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp); 376 Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp);
377 Eolian_Type_Builtin_Type eolian_type_builtin_type_get(const Eolian_Type *tp);
316 Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp); 378 Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp);
317 Eina_Iterator *eolian_typedecl_struct_fields_get(const Eolian_Typedecl *tp); 379 Eina_Iterator *eolian_typedecl_struct_fields_get(const Eolian_Typedecl *tp);
318 const Eolian_Struct_Type_Field *eolian_typedecl_struct_field_get(const Eolian_Typedecl *tp, const char *field); 380 const Eolian_Struct_Type_Field *eolian_typedecl_struct_field_get(const Eolian_Typedecl *tp, const char *field);
@@ -504,6 +566,66 @@ M.type_type = {
504 UNDEFINED = 4 566 UNDEFINED = 4
505} 567}
506 568
569M.type_builtin_type = {
570 INVALID = 0,
571
572 BYTE = 1,
573 UBYTE = 2,
574 CHAR = 3,
575 SHORT = 4,
576 USHORT = 5,
577 INT = 6,
578 UINT = 7,
579 LONG = 8,
580 ULONG = 9,
581 LLONG = 10,
582 ULLONG = 11,
583
584 INT8 = 12,
585 UINT8 = 13,
586 INT16 = 14,
587 UINT16 = 15,
588 INT32 = 16,
589 UINT32 = 17,
590 INT64 = 18,
591 UINT64 = 19,
592 INT128 = 20,
593 UINT128 = 21,
594
595 SIZE = 22,
596 SSIZE = 23,
597 INTPTR = 24,
598 UINTPTR = 25,
599 PTRDIFF = 26,
600
601 TIME = 27,
602
603 FLOAT = 28,
604 DOUBLE = 29,
605
606 BOOL = 30,
607
608 VOID = 31,
609
610 ACCESSOR = 32,
611 ARRAY = 33,
612 ITERATOR = 34,
613 HASH = 35,
614 LIST = 36,
615
616 FUTURE = 37,
617
618 ANY_VALUE = 38,
619 ANY_VALUE_PTR = 39,
620
621 MSTRING = 40,
622 STRING = 41,
623 STRINGSHARE = 42,
624
625 VOID_PTR = 43,
626 FREE_CB = 44
627}
628
507M.typedecl_type = { 629M.typedecl_type = {
508 UNKNOWN = 0, 630 UNKNOWN = 0,
509 STRUCT = 1, 631 STRUCT = 1,
@@ -674,6 +796,10 @@ M.Type = ffi.metatype("Eolian_Type", {
674 return tonumber(eolian.eolian_type_type_get(self)) 796 return tonumber(eolian.eolian_type_type_get(self))
675 end, 797 end,
676 798
799 builtin_type_get = function(self)
800 return tonumber(eolian.eolian_type_builtin_type_get(self))
801 end,
802
677 file_get = function(self, name) 803 file_get = function(self, name)
678 local v = eolian.eolian_type_file_get(self) 804 local v = eolian.eolian_type_file_get(self)
679 if v == nil then return nil end 805 if v == nil then return nil end
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index e21a034084..6baeb5d017 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -743,6 +743,7 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref)
743 if (ls->t.kw == KW_void) 743 if (ls->t.kw == KW_void)
744 { 744 {
745 def->type = EOLIAN_TYPE_VOID; 745 def->type = EOLIAN_TYPE_VOID;
746 def->btype = EOLIAN_TYPE_BUILTIN_VOID;
746 eo_lexer_get(ls); 747 eo_lexer_get(ls);
747 } 748 }
748 else if (ls->t.kw == KW___undefined_type) 749 else if (ls->t.kw == KW___undefined_type)