diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2017-05-25 15:11:08 +0200 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2017-05-26 15:11:48 +0200 |
commit | 0a0c3e7c6430155e011c46781b54aa8706eb7857 (patch) | |
tree | 803287f5a205c461d43b7a82102b110fba92f434 | |
parent | e7c4c90e24a1b15db20290a76af56dbfe8286288 (diff) | |
download | efl-0a0c3e7c6430155e011c46781b54aa8706eb7857.tar.gz |
eolian: pass unit to struct get by name
-rw-r--r-- | src/bin/eolian/docs.c | 2 | ||||
-rw-r--r-- | src/bindings/luajit/eolian.lua | 6 | ||||
-rw-r--r-- | src/lib/eolian/Eolian.h | 3 | ||||
-rw-r--r-- | src/lib/eolian/database_type_api.c | 3 | ||||
-rw-r--r-- | src/lib/eolian/eolian_database.c | 3 | ||||
-rw-r--r-- | src/tests/eolian/eolian_parsing.c | 24 |
6 files changed, 22 insertions, 19 deletions
diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c index 842376c59f..d200c7f458 100644 --- a/src/bin/eolian/docs.c +++ b/src/bin/eolian/docs.c @@ -39,7 +39,7 @@ _generate_ref(const Eolian_Unit *src, const char *refn, Eina_Strbuf *wbuf, Eina_Stringshare *bname = eina_stringshare_add_length(refn, sfx - refn); - const Eolian_Typedecl *tp = eolian_typedecl_struct_get_by_name(bname); + const Eolian_Typedecl *tp = eolian_typedecl_struct_get_by_name(src, bname); if (tp) { if (!eolian_typedecl_struct_field_get(tp, sfx + 1)) diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index d63210bef4..c1a0fe601d 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua @@ -298,7 +298,7 @@ ffi.cdef [[ Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass); const char *eolian_class_c_get_function_name_get(const Eolian_Class *klass); const Eolian_Typedecl *eolian_typedecl_alias_get_by_name(const Eolian_Unit *unit, const char *name); - const Eolian_Typedecl *eolian_typedecl_struct_get_by_name(const char *name); + const Eolian_Typedecl *eolian_typedecl_struct_get_by_name(const Eolian_Unit *unit, const char *name); const Eolian_Typedecl *eolian_typedecl_enum_get_by_name(const char *name); Eina_Iterator *eolian_typedecl_aliases_get_by_file(const char *fname); Eina_Iterator *eolian_typedecl_structs_get_by_file(const char *fname); @@ -1148,8 +1148,8 @@ M.typedecl_alias_get_by_name = function(unit, name) return v end -M.typedecl_struct_get_by_name = function(name) - local v = eolian.eolian_typedecl_struct_get_by_name(name) +M.typedecl_struct_get_by_name = function(unit, name) + local v = eolian.eolian_typedecl_struct_get_by_name(unit, name) if v == nil then return nil end return v end diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 7be3182de3..2e29dd9bc4 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -1381,12 +1381,13 @@ EAPI const Eolian_Typedecl *eolian_typedecl_alias_get_by_name(const Eolian_Unit /* * @brief Get a struct declaration by name. Supports namespaces. * + * @param[in] unit the unit to look in * @param[in] name the name of the struct * @return the struct or NULL * * @ingroup Eolian */ -EAPI const Eolian_Typedecl *eolian_typedecl_struct_get_by_name(const char *name); +EAPI const Eolian_Typedecl *eolian_typedecl_struct_get_by_name(const Eolian_Unit *unit, const char *name); /* * @brief Get an enum declaration by name. Supports namespaces. diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c index 8d9a5d3612..b589cb40aa 100644 --- a/src/lib/eolian/database_type_api.c +++ b/src/lib/eolian/database_type_api.c @@ -19,7 +19,8 @@ eolian_typedecl_alias_get_by_name(const Eolian_Unit *unit EINA_UNUSED, } EAPI const Eolian_Typedecl * -eolian_typedecl_struct_get_by_name(const char *name) +eolian_typedecl_struct_get_by_name(const Eolian_Unit *unit EINA_UNUSED, + const char *name) { if (!_structs) return NULL; Eina_Stringshare *shr = eina_stringshare_add(name); diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index a1b583560d..5cc260ac86 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c @@ -539,7 +539,8 @@ eolian_doc_token_ref_get(const Eolian_Doc_Token *tok, const void **data, *suffix++ = '\0'; /* try a struct field */ - const Eolian_Typedecl *tpd = eolian_typedecl_struct_get_by_name(name); + /* FIXME: pass unit properly */ + const Eolian_Typedecl *tpd = eolian_typedecl_struct_get_by_name(NULL, name); if (tpd) { const Eolian_Struct_Type_Field *fld = eolian_typedecl_struct_field_get(tpd, suffix); diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index 64a89c2615..3d1de47a7a 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -662,7 +662,7 @@ START_TEST(eolian_struct) fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD)); /* named struct */ - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Named"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Named"))); fail_if(!(type_name = eolian_typedecl_name_get(tdl))); fail_if(!(file = eolian_typedecl_file_get(tdl))); fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_STRUCT); @@ -696,7 +696,7 @@ START_TEST(eolian_struct) eina_stringshare_del(type_name); /* referencing */ - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Another"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Another"))); fail_if(!(type_name = eolian_typedecl_name_get(tdl))); fail_if(!(file = eolian_typedecl_file_get(tdl))); fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_STRUCT); @@ -711,7 +711,7 @@ START_TEST(eolian_struct) != EOLIAN_TYPEDECL_STRUCT); /* opaque struct */ - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Opaque"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Opaque"))); fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_STRUCT_OPAQUE); /* use in function */ @@ -750,11 +750,11 @@ START_TEST(eolian_extern) fail_if(!eolian_typedecl_is_extern(tdl)); /* regular struct */ - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("X"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "X"))); fail_if(eolian_typedecl_is_extern(tdl)); /* extern struct */ - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Y"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Y"))); fail_if(!eolian_typedecl_is_extern(tdl)); eolian_shutdown(); @@ -980,9 +980,9 @@ START_TEST(eolian_free_func) fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD)); /* regular struct */ - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Named1"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Named1"))); fail_if(eolian_typedecl_free_func_get(tdl)); - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Named2"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Named2"))); fail_if(strcmp(eolian_typedecl_free_func_get(tdl), "test_free")); /* typedef */ @@ -992,9 +992,9 @@ START_TEST(eolian_free_func) fail_if(strcmp(eolian_typedecl_free_func_get(tdl), "def_free")); /* opaque struct */ - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Opaque1"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Opaque1"))); fail_if(eolian_typedecl_free_func_get(tdl)); - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Opaque2"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Opaque2"))); fail_if(strcmp(eolian_typedecl_free_func_get(tdl), "opaque_free")); /* pointer */ @@ -1074,7 +1074,7 @@ START_TEST(eolian_import) fail_if(!(tdl = eolian_typedecl_alias_get_by_name(unit, "Imported"))); fail_if(strcmp(eolian_typedecl_file_get(tdl), "import_types.eot")); - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Imported_Struct"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Imported_Struct"))); fail_if(strcmp(eolian_typedecl_file_get(tdl), "import_types.eot")); eolian_shutdown(); @@ -1163,7 +1163,7 @@ START_TEST(eolian_docs) fail_if(!(unit = eolian_file_parse(PACKAGE_DATA_DIR"/data/docs.eo"))); - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Foo"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Foo"))); fail_if(!(doc = eolian_typedecl_documentation_get(tdl))); fail_if(strcmp(eolian_documentation_summary_get(doc), "This is struct Foo. It does stuff.")); @@ -1302,7 +1302,7 @@ START_TEST(eolian_docs) "Docs for var.")); fail_if(eolian_documentation_description_get(doc)); - fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Opaque"))); + fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Opaque"))); fail_if(!(doc = eolian_typedecl_documentation_get(tdl))); fail_if(strcmp(eolian_documentation_summary_get(doc), "Opaque struct docs. See @Foo for another struct.")); |