summaryrefslogtreecommitdiff
path: root/src/bindings
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-06-10 17:30:17 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-06-10 17:30:42 +0100
commit944e9eb5b019e60789ebc63608f774a8086e5e47 (patch)
tree6e4ed0b38f5cd10726006e164a99a1f4b1ae49cf /src/bindings
parenta023a04b53c52aa3fd65b5ac9054d5fd706c31d5 (diff)
elua: bind recent eolian APIs to eolian lua api
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/luajit/eolian.lua157
1 files changed, 154 insertions, 3 deletions
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 02aae3fc2e..2abd3b2b57 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -23,6 +23,8 @@ ffi.cdef [[
23 typedef struct _Eolian_Variable Eolian_Variable; 23 typedef struct _Eolian_Variable Eolian_Variable;
24 typedef struct _Eolian_Struct_Type_Field Eolian_Struct_Type_Field; 24 typedef struct _Eolian_Struct_Type_Field Eolian_Struct_Type_Field;
25 typedef struct _Eolian_Enum_Type_Field Eolian_Enum_Type_Field; 25 typedef struct _Eolian_Enum_Type_Field Eolian_Enum_Type_Field;
26 typedef struct _Eolian_Declaration Eolian_Declaration;
27 typedef struct _Eolian_Documentation Eolian_Documentation;
26 typedef struct _Eolian_Value Eolian_Value; 28 typedef struct _Eolian_Value Eolian_Value;
27 29
28 typedef enum 30 typedef enum
@@ -166,6 +168,15 @@ ffi.cdef [[
166 EOLIAN_UNOP_BNOT, /* ~ int */ 168 EOLIAN_UNOP_BNOT, /* ~ int */
167 } Eolian_Unary_Operator; 169 } Eolian_Unary_Operator;
168 170
171 typedef enum {
172 EOLIAN_DECL_UNKNOWN = -1,
173 EOLIAN_DECL_CLASS,
174 EOLIAN_DECL_ALIAS,
175 EOLIAN_DECL_STRUCT,
176 EOLIAN_DECL_ENUM,
177 EOLIAN_DECL_VAR
178 } Eolian_Declaration_Type;
179
169 Eina_Bool eolian_file_parse(const char *filepath); 180 Eina_Bool eolian_file_parse(const char *filepath);
170 Eina_Iterator *eolian_all_eo_file_paths_get(void); 181 Eina_Iterator *eolian_all_eo_file_paths_get(void);
171 Eina_Iterator *eolian_all_eot_file_paths_get(void); 182 Eina_Iterator *eolian_all_eot_file_paths_get(void);
@@ -194,6 +205,7 @@ ffi.cdef [[
194 Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass); 205 Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass);
195 Eina_Iterator *eolian_all_classes_get(void); 206 Eina_Iterator *eolian_all_classes_get(void);
196 const char *eolian_class_description_get(const Eolian_Class *klass); 207 const char *eolian_class_description_get(const Eolian_Class *klass);
208 const Eolian_Documentation *eolian_class_documentation_get(const Eolian_Class *klass);
197 const char *eolian_class_legacy_prefix_get(const Eolian_Class *klass); 209 const char *eolian_class_legacy_prefix_get(const Eolian_Class *klass);
198 const char *eolian_class_eo_prefix_get(const Eolian_Class *klass); 210 const char *eolian_class_eo_prefix_get(const Eolian_Class *klass);
199 const char *eolian_class_data_type_get(const Eolian_Class *klass); 211 const char *eolian_class_data_type_get(const Eolian_Class *klass);
@@ -206,6 +218,7 @@ ffi.cdef [[
206 const Eolian_Function *eolian_class_function_get_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type); 218 const Eolian_Function *eolian_class_function_get_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
207 const char *eolian_function_legacy_get(const Eolian_Function *function_id, Eolian_Function_Type f_type); 219 const char *eolian_function_legacy_get(const Eolian_Function *function_id, Eolian_Function_Type f_type);
208 const char *eolian_function_description_get(const Eolian_Function *function_id, Eolian_Function_Type f_type); 220 const char *eolian_function_description_get(const Eolian_Function *function_id, Eolian_Function_Type f_type);
221 const Eolian_Documentation *eolian_function_documentation_get(const Eolian_Function *function_id, Eolian_Function_Type f_type);
209 Eina_Bool eolian_function_is_virtual_pure(const Eolian_Function *function_id, Eolian_Function_Type f_type); 222 Eina_Bool eolian_function_is_virtual_pure(const Eolian_Function *function_id, Eolian_Function_Type f_type);
210 Eina_Bool eolian_function_is_auto(const Eolian_Function *function_id, Eolian_Function_Type f_type); 223 Eina_Bool eolian_function_is_auto(const Eolian_Function *function_id, Eolian_Function_Type f_type);
211 Eina_Bool eolian_function_is_empty(const Eolian_Function *function_id, Eolian_Function_Type f_type); 224 Eina_Bool eolian_function_is_empty(const Eolian_Function *function_id, Eolian_Function_Type f_type);
@@ -220,12 +233,14 @@ ffi.cdef [[
220 const Eolian_Expression *eolian_parameter_default_value_get(const Eolian_Function_Parameter *param); 233 const Eolian_Expression *eolian_parameter_default_value_get(const Eolian_Function_Parameter *param);
221 const char *eolian_parameter_name_get(const Eolian_Function_Parameter *param); 234 const char *eolian_parameter_name_get(const Eolian_Function_Parameter *param);
222 const char *eolian_parameter_description_get(const Eolian_Function_Parameter *param); 235 const char *eolian_parameter_description_get(const Eolian_Function_Parameter *param);
236 const Eolian_Documentation *eolian_parameter_documentation_get(const Eolian_Function_Parameter *param);
223 Eina_Bool eolian_parameter_is_nonull(const Eolian_Function_Parameter *param_desc); 237 Eina_Bool eolian_parameter_is_nonull(const Eolian_Function_Parameter *param_desc);
224 Eina_Bool eolian_parameter_is_nullable(const Eolian_Function_Parameter *param_desc); 238 Eina_Bool eolian_parameter_is_nullable(const Eolian_Function_Parameter *param_desc);
225 Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc); 239 Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc);
226 const Eolian_Type *eolian_function_return_type_get(const Eolian_Function *function_id, Eolian_Function_Type ftype); 240 const Eolian_Type *eolian_function_return_type_get(const Eolian_Function *function_id, Eolian_Function_Type ftype);
227 const Eolian_Expression *eolian_function_return_default_value_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype); 241 const Eolian_Expression *eolian_function_return_default_value_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
228 const char *eolian_function_return_comment_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype); 242 const char *eolian_function_return_comment_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
243 const Eolian_Documentation *eolian_function_return_documentation_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
229 Eina_Bool eolian_function_return_is_warn_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype); 244 Eina_Bool eolian_function_return_is_warn_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
230 Eina_Bool eolian_function_object_is_const(const Eolian_Function *function_id); 245 Eina_Bool eolian_function_object_is_const(const Eolian_Function *function_id);
231 Eina_Bool eolian_type_is_extern(const Eolian_Type *tp); 246 Eina_Bool eolian_type_is_extern(const Eolian_Type *tp);
@@ -247,6 +262,7 @@ ffi.cdef [[
247 const char *eolian_event_name_get(const Eolian_Event *event); 262 const char *eolian_event_name_get(const Eolian_Event *event);
248 const Eolian_Type *eolian_event_type_get(const Eolian_Event *event); 263 const Eolian_Type *eolian_event_type_get(const Eolian_Event *event);
249 const char *eolian_event_description_get(const Eolian_Event *event); 264 const char *eolian_event_description_get(const Eolian_Event *event);
265 const Eolian_Documentation *eolian_event_documentation_get(const Eolian_Event *event);
250 Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event); 266 Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event);
251 const char *eolian_event_c_name_get(const Eolian_Event *event); 267 const char *eolian_event_c_name_get(const Eolian_Event *event);
252 Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass); 268 Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass);
@@ -265,14 +281,17 @@ ffi.cdef [[
265 const Eolian_Struct_Type_Field *eolian_type_struct_field_get(const Eolian_Type *tp, const char *field); 281 const Eolian_Struct_Type_Field *eolian_type_struct_field_get(const Eolian_Type *tp, const char *field);
266 const char *eolian_type_struct_field_name_get(const Eolian_Struct_Type_Field *fl); 282 const char *eolian_type_struct_field_name_get(const Eolian_Struct_Type_Field *fl);
267 const char *eolian_type_struct_field_description_get(const Eolian_Struct_Type_Field *fl); 283 const char *eolian_type_struct_field_description_get(const Eolian_Struct_Type_Field *fl);
284 const Eolian_Documentation *eolian_type_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl);
268 const Eolian_Type *eolian_type_struct_field_type_get(const Eolian_Struct_Type_Field *fl); 285 const Eolian_Type *eolian_type_struct_field_type_get(const Eolian_Struct_Type_Field *fl);
269 Eina_Iterator *eolian_type_enum_fields_get(const Eolian_Type *tp); 286 Eina_Iterator *eolian_type_enum_fields_get(const Eolian_Type *tp);
270 const Eolian_Enum_Type_Field *eolian_type_enum_field_get(const Eolian_Type *tp, const char *field); 287 const Eolian_Enum_Type_Field *eolian_type_enum_field_get(const Eolian_Type *tp, const char *field);
271 const char *eolian_type_enum_field_name_get(const Eolian_Enum_Type_Field *fl); 288 const char *eolian_type_enum_field_name_get(const Eolian_Enum_Type_Field *fl);
272 const char *eolian_type_enum_field_description_get(const Eolian_Enum_Type_Field *fl); 289 const char *eolian_type_enum_field_description_get(const Eolian_Enum_Type_Field *fl);
290 const Eolian_Documentation *eolian_type_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl);
273 const Eolian_Expression *eolian_type_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force); 291 const Eolian_Expression *eolian_type_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force);
274 const char *eolian_type_enum_legacy_prefix_get(const Eolian_Type *tp); 292 const char *eolian_type_enum_legacy_prefix_get(const Eolian_Type *tp);
275 const char *eolian_type_description_get(const Eolian_Type *tp); 293 const char *eolian_type_description_get(const Eolian_Type *tp);
294 const Eolian_Documentation *eolian_type_documentation_get(const Eolian_Type *tp);
276 const char *eolian_type_file_get(const Eolian_Type *tp); 295 const char *eolian_type_file_get(const Eolian_Type *tp);
277 const Eolian_Type *eolian_type_return_type_get(const Eolian_Type *tp); 296 const Eolian_Type *eolian_type_return_type_get(const Eolian_Type *tp);
278 const Eolian_Type *eolian_type_base_type_get(const Eolian_Type *tp); 297 const Eolian_Type *eolian_type_base_type_get(const Eolian_Type *tp);
@@ -302,6 +321,7 @@ ffi.cdef [[
302 Eina_Iterator *eolian_variable_constants_get_by_file(const char *fname); 321 Eina_Iterator *eolian_variable_constants_get_by_file(const char *fname);
303 Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var); 322 Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var);
304 const char *eolian_variable_description_get(const Eolian_Variable *var); 323 const char *eolian_variable_description_get(const Eolian_Variable *var);
324 const Eolian_Documentation *eolian_variable_documentation_get(const Eolian_Variable *var);
305 const char *eolian_variable_file_get(const Eolian_Variable *var); 325 const char *eolian_variable_file_get(const Eolian_Variable *var);
306 const Eolian_Type *eolian_variable_base_type_get(const Eolian_Variable *var); 326 const Eolian_Type *eolian_variable_base_type_get(const Eolian_Variable *var);
307 const Eolian_Expression *eolian_variable_value_get(const Eolian_Variable *var); 327 const Eolian_Expression *eolian_variable_value_get(const Eolian_Variable *var);
@@ -309,6 +329,15 @@ ffi.cdef [[
309 const char *eolian_variable_full_name_get(const Eolian_Variable *var); 329 const char *eolian_variable_full_name_get(const Eolian_Variable *var);
310 Eina_Iterator *eolian_variable_namespaces_get(const Eolian_Variable *var); 330 Eina_Iterator *eolian_variable_namespaces_get(const Eolian_Variable *var);
311 Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var); 331 Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var);
332 Eina_Iterator *eolian_declarations_get_by_file(const char *fname);
333 Eolian_Declaration_Type eolian_declaration_type_get(const Eolian_Declaration *decl);
334 const char *eolian_declaration_name_get(const Eolian_Declaration *decl);
335 const Eolian_Class *eolian_declaration_class_get(const Eolian_Declaration *decl);
336 const Eolian_Type *eolian_declaration_data_type_get(const Eolian_Declaration *decl);
337 const Eolian_Variable *eolian_declaration_variable_get(const Eolian_Declaration *decl);
338 const char *eolian_documentation_summary_get(const Eolian_Documentation *doc);
339 const char *eolian_documentation_description_get(const Eolian_Documentation *doc);
340 const char *eolian_documentation_since_get(const Eolian_Documentation *doc);
312]] 341]]
313 342
314local cutil = require("cutil") 343local cutil = require("cutil")
@@ -409,7 +438,7 @@ M.show_global = function(name)
409 return eolian.eolian_show_global(name) ~= 0 438 return eolian.eolian_show_global(name) ~= 0
410end 439end
411 440
412M.show_consatnt = function(name) 441M.show_constant = function(name)
413 return eolian.eolian_show_constant(name) ~= 0 442 return eolian.eolian_show_constant(name) ~= 0
414end 443end
415 444
@@ -417,6 +446,15 @@ M.show_all = function()
417 eolian.eolian_show_all() 446 eolian.eolian_show_all()
418end 447end
419 448
449M.declaration_type = {
450 UNKNOWN = -1,
451 CLASS = 0,
452 ALIAS = 1,
453 STRUCT = 2,
454 ENUM = 3,
455 VAR = 4
456}
457
420M.type_type = { 458M.type_type = {
421 UNKNOWN = 0, 459 UNKNOWN = 0,
422 VOID = 1, 460 VOID = 1,
@@ -445,6 +483,12 @@ ffi.metatype("Eolian_Struct_Type_Field", {
445 return ffi.string(v) 483 return ffi.string(v)
446 end, 484 end,
447 485
486 documentation_get = function(self)
487 local v = eolian.eolian_type_struct_field_documentation_get(self)
488 if v == nil then return nil end
489 return v
490 end,
491
448 type_get = function(self) 492 type_get = function(self)
449 local v = eolian.eolian_type_struct_field_type_get(self) 493 local v = eolian.eolian_type_struct_field_type_get(self)
450 if v == nil then return nil end 494 if v == nil then return nil end
@@ -467,6 +511,12 @@ ffi.metatype("Eolian_Enum_Type_Field", {
467 return ffi.string(v) 511 return ffi.string(v)
468 end, 512 end,
469 513
514 documentation_get = function(self)
515 local v = eolian.eolian_type_enum_field_documentation_get(self)
516 if v == nil then return nil end
517 return v
518 end,
519
470 value_get = function(self, force) 520 value_get = function(self, force)
471 local v = eolian.eolian_type_enum_field_value_get(self, force and 1 or 0) 521 local v = eolian.eolian_type_enum_field_value_get(self, force and 1 or 0)
472 if v == nil then return nil end 522 if v == nil then return nil end
@@ -525,6 +575,12 @@ M.Type = ffi.metatype("Eolian_Type", {
525 return ffi.string(v) 575 return ffi.string(v)
526 end, 576 end,
527 577
578 documentation_get = function(self, name)
579 local v = eolian.eolian_type_documentation_get(self)
580 if v == nil then return nil end
581 return v
582 end,
583
528 file_get = function(self, name) 584 file_get = function(self, name)
529 local v = eolian.eolian_type_file_get(self) 585 local v = eolian.eolian_type_file_get(self)
530 if v == nil then return nil end 586 if v == nil then return nil end
@@ -640,6 +696,12 @@ M.Function = ffi.metatype("Eolian_Function", {
640 return ffi.string(v) 696 return ffi.string(v)
641 end, 697 end,
642 698
699 documentation_get = function(self, ftype)
700 local v = eolian.eolian_function_documentation_get(self, ftype)
701 if v == nil then return nil end
702 return v
703 end,
704
643 is_virtual_pure = function(self, ftype) 705 is_virtual_pure = function(self, ftype)
644 return eolian.eolian_function_is_virtual_pure(self, ftype) ~= 0 706 return eolian.eolian_function_is_virtual_pure(self, ftype) ~= 0
645 end, 707 end,
@@ -697,6 +759,12 @@ M.Function = ffi.metatype("Eolian_Function", {
697 return ffi.string(v) 759 return ffi.string(v)
698 end, 760 end,
699 761
762 return_documentation_get = function(self, ftype)
763 local v = eolian.eolian_function_return_documentation_get(self, ftype)
764 if v == nil then return nil end
765 return v
766 end,
767
700 return_is_warn_unused = function(self, ftype) 768 return_is_warn_unused = function(self, ftype)
701 return eolian.eolian_function_return_is_warn_unused(self, 769 return eolian.eolian_function_return_is_warn_unused(self,
702 ftype) ~= 0 770 ftype) ~= 0
@@ -744,6 +812,12 @@ ffi.metatype("Eolian_Function_Parameter", {
744 return ffi.string(v) 812 return ffi.string(v)
745 end, 813 end,
746 814
815 documentation_get = function(self)
816 local v = eolian.eolian_parameter_documentation_get(self)
817 if v == nil then return nil end
818 return v
819 end,
820
747 is_nonull = function(self) 821 is_nonull = function(self)
748 return eolian.eolian_parameter_is_nonull(self) ~= 0 822 return eolian.eolian_parameter_is_nonull(self) ~= 0
749 end, 823 end,
@@ -847,6 +921,12 @@ ffi.metatype("Eolian_Event", {
847 return ffi.string(v) 921 return ffi.string(v)
848 end, 922 end,
849 923
924 documentation_get = function(self)
925 local v = eolian.eolian_event_documentation_get(self)
926 if v == nil then return nil end
927 return v
928 end,
929
850 scope_get = function(self) 930 scope_get = function(self)
851 return tonumber(eolian.eolian_event_scope_get(self)) 931 return tonumber(eolian.eolian_event_scope_get(self))
852 end, 932 end,
@@ -919,6 +999,12 @@ M.Class = ffi.metatype("Eolian_Class", {
919 return ffi.string(v) 999 return ffi.string(v)
920 end, 1000 end,
921 1001
1002 documentation_get = function(self)
1003 local v = eolian.eolian_class_documentation_get(self)
1004 if v == nil then return nil end
1005 return v
1006 end,
1007
922 legacy_prefix_get = function(self) 1008 legacy_prefix_get = function(self)
923 local v = eolian.eolian_class_legacy_prefix_get(self) 1009 local v = eolian.eolian_class_legacy_prefix_get(self)
924 if v == nil then return nil end 1010 if v == nil then return nil end
@@ -1211,12 +1297,12 @@ end
1211 1297
1212M.variable_globals_get_by_file = function(fname) 1298M.variable_globals_get_by_file = function(fname)
1213 return Ptr_Iterator("const Eolian_Variable*", 1299 return Ptr_Iterator("const Eolian_Variable*",
1214 eolian.eolian_variable_globals_get_by_file(self)) 1300 eolian.eolian_variable_globals_get_by_file(fname))
1215end 1301end
1216 1302
1217M.variable_constants_get_by_file = function(fname) 1303M.variable_constants_get_by_file = function(fname)
1218 return Ptr_Iterator("const Eolian_Variable*", 1304 return Ptr_Iterator("const Eolian_Variable*",
1219 eolian.eolian_variable_constants_get_by_file(self)) 1305 eolian.eolian_variable_constants_get_by_file(fname))
1220end 1306end
1221 1307
1222M.Variable = ffi.metatype("Eolian_Variable", { 1308M.Variable = ffi.metatype("Eolian_Variable", {
@@ -1231,6 +1317,12 @@ M.Variable = ffi.metatype("Eolian_Variable", {
1231 return ffi.string(v) 1317 return ffi.string(v)
1232 end, 1318 end,
1233 1319
1320 documentation_get = function(self)
1321 local v = eolian.eolian_variable_documentation_get(self)
1322 if v == nil then return nil end
1323 return v
1324 end,
1325
1234 file_get = function(self) 1326 file_get = function(self)
1235 local v = eolian.eolian_variable_file_get(self) 1327 local v = eolian.eolian_variable_file_get(self)
1236 if v == nil then return nil end 1328 if v == nil then return nil end
@@ -1272,4 +1364,63 @@ M.Variable = ffi.metatype("Eolian_Variable", {
1272 } 1364 }
1273}) 1365})
1274 1366
1367M.declarations_get_by_file = function(fname)
1368 return Ptr_ITerator("const Eolian_Declaration*",
1369 eolian.eolian_declarations_get_by_file(fname))
1370end
1371
1372M.Declaration = ffi.metatype("Eolian_Declaration", {
1373 __index = {
1374 type_get = function(self)
1375 return tonumber(eolian.eolian_declaration_type_get(self))
1376 end,
1377
1378 name_get = function(self)
1379 local v = eolian.eolian_declaration_name_get(self)
1380 if v == nil then return nil end
1381 return ffi.string(v)
1382 end,
1383
1384 class_get = function(self)
1385 local v = eolian.eolian_declaration_class_get(self)
1386 if v == nil then return nil end
1387 return v
1388 end,
1389
1390 data_type_get = function(self)
1391 local v = eolian.eolian_declaration_data_type_get(self)
1392 if v == nil then return nil end
1393 return v
1394 end,
1395
1396 variable_get = function(self)
1397 local v = eolian.eolian_declaration_variable_get(self)
1398 if v == nil then return nil end
1399 return v
1400 end
1401 }
1402})
1403
1404M.Documentation = ffi.metatype("Eolian_Documentation", {
1405 __index = {
1406 summary_get = function(self)
1407 local v = eolian.eolian_declaration_summary_get(self)
1408 if v == nil then return nil end
1409 return ffi.string(v)
1410 end,
1411
1412 description_get = function(self)
1413 local v = eolian.eolian_declaration_description_get(self)
1414 if v == nil then return nil end
1415 return ffi.string(v)
1416 end,
1417
1418 since_get = function(self)
1419 local v = eolian.eolian_declaration_since_get(self)
1420 if v == nil then return nil end
1421 return ffi.string(v)
1422 end
1423 }
1424})
1425
1275return M 1426return M