summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-15 16:08:27 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-15 17:11:11 +0100
commitc8aa30e698fa95cf425c35bb359fbab55cb64110 (patch)
tree3417a7bd3bc6c8e4e089bd59be27df2534482173 /src/lib
parentf05249f30b732fc21a6bbd0a4c290760af340bef (diff)
eolian: make declaration APIs use units
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/eolian/Eolian.h9
-rw-r--r--src/lib/eolian/eolian_database.c8
2 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index bfb8c5387a..d109ea12a2 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -2398,12 +2398,13 @@ EAPI Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var);
2398/* 2398/*
2399 * @brief Get a declaration by name. 2399 * @brief Get a declaration by name.
2400 * 2400 *
2401 * @param[in] unit the unit to look in
2401 * @param[in] name the declaration name. 2402 * @param[in] name the declaration name.
2402 * @return the declaration. 2403 * @return the declaration.
2403 * 2404 *
2404 * @ingroup Eolian 2405 * @ingroup Eolian
2405 */ 2406 */
2406EAPI const Eolian_Declaration *eolian_declaration_get_by_name(const char *name); 2407EAPI const Eolian_Declaration *eolian_declaration_get_by_name(const Eolian_Unit *unit, const char *name);
2407 2408
2408/* 2409/*
2409 * @brief Get a list of declarations in a file. 2410 * @brief Get a list of declarations in a file.
@@ -2413,23 +2414,25 @@ EAPI const Eolian_Declaration *eolian_declaration_get_by_name(const char *name);
2413 * or a variable. This way you can get them all in the original order they 2414 * or a variable. This way you can get them all in the original order they
2414 * were declared in, which is useful during generation. 2415 * were declared in, which is useful during generation.
2415 * 2416 *
2417 * @param[in] state the state to look in
2416 * @param[in] fname the filename. 2418 * @param[in] fname the filename.
2417 * @return the iterator or NULL. 2419 * @return the iterator or NULL.
2418 * 2420 *
2419 * @ingroup Eolian 2421 * @ingroup Eolian
2420 */ 2422 */
2421EAPI Eina_Iterator *eolian_declarations_get_by_file(const char *fname); 2423EAPI Eina_Iterator *eolian_declarations_get_by_file(const Eolian *state, const char *fname);
2422 2424
2423/* 2425/*
2424 * @brief Get an iterator to all declarations in the Eolian database. 2426 * @brief Get an iterator to all declarations in the Eolian database.
2425 * 2427 *
2428 * @param[in] unit the unit to look in
2426 * @return the iterator or NULL. 2429 * @return the iterator or NULL.
2427 * 2430 *
2428 * Thanks to internal caching this is an O(1) operation. 2431 * Thanks to internal caching this is an O(1) operation.
2429 * 2432 *
2430 * @ingroup Eolian 2433 * @ingroup Eolian
2431 */ 2434 */
2432EAPI Eina_Iterator *eolian_all_declarations_get(void); 2435EAPI Eina_Iterator *eolian_all_declarations_get(const Eolian_Unit *unit);
2433 2436
2434/* 2437/*
2435 * @brief Get the type of a declaration 2438 * @brief Get the type of a declaration
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index bf1cd50c10..0c1513ab8f 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -60,7 +60,7 @@ database_decl_add(Eina_Stringshare *name, Eolian_Declaration_Type type,
60} 60}
61 61
62EAPI const Eolian_Declaration * 62EAPI const Eolian_Declaration *
63eolian_declaration_get_by_name(const char *name) 63eolian_declaration_get_by_name(const Eolian_Unit *unit EINA_UNUSED, const char *name)
64{ 64{
65 if (!_decls) return NULL; 65 if (!_decls) return NULL;
66 Eina_Stringshare *shr = eina_stringshare_add(name); 66 Eina_Stringshare *shr = eina_stringshare_add(name);
@@ -70,7 +70,7 @@ eolian_declaration_get_by_name(const char *name)
70} 70}
71 71
72EAPI Eina_Iterator * 72EAPI Eina_Iterator *
73eolian_declarations_get_by_file(const char *fname) 73eolian_declarations_get_by_file(const Eolian *state EINA_UNUSED, const char *fname)
74{ 74{
75 if (!_declsf) return NULL; 75 if (!_declsf) return NULL;
76 Eina_Stringshare *shr = eina_stringshare_add(fname); 76 Eina_Stringshare *shr = eina_stringshare_add(fname);
@@ -81,7 +81,7 @@ eolian_declarations_get_by_file(const char *fname)
81} 81}
82 82
83EAPI Eina_Iterator * 83EAPI Eina_Iterator *
84eolian_all_declarations_get(void) 84eolian_all_declarations_get(const Eolian_Unit *unit EINA_UNUSED)
85{ 85{
86 return (_decls ? eina_hash_iterator_data_new(_decls) : NULL); 86 return (_decls ? eina_hash_iterator_data_new(_decls) : NULL);
87} 87}
@@ -448,7 +448,7 @@ eolian_doc_token_ref_get(const Eolian_Unit *unit, const Eolian_Doc_Token *tok,
448 memcpy(name, tok->text, nlen); 448 memcpy(name, tok->text, nlen);
449 name[nlen] = '\0'; 449 name[nlen] = '\0';
450 450
451 const Eolian_Declaration *decl = eolian_declaration_get_by_name(name); 451 const Eolian_Declaration *decl = eolian_declaration_get_by_name(unit, name);
452 if (decl) switch (eolian_declaration_type_get(decl)) 452 if (decl) switch (eolian_declaration_type_get(decl))
453 { 453 {
454 case EOLIAN_DECL_CLASS: 454 case EOLIAN_DECL_CLASS: