summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2018-10-11 16:35:41 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2018-10-22 16:37:01 +0200
commite8794253ccb264795e34075b6192ffb9c6863d95 (patch)
treec735ef553737a6bbf3baf6f8488122623848b5e8
parent7f77938fa8f488305384e891ed2b0916c83d696d (diff)
eolian: add API to get full file path of a unit
This is necessary for easy dependency generation, as it is needed to retrieve a full list of paths that each generated file depends on.
-rw-r--r--src/lib/eolian/Eolian.h16
-rw-r--r--src/lib/eolian/eolian_database.c10
2 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index d8a662e541..b5241ead86 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -909,11 +909,27 @@ EAPI Eina_Iterator *eolian_unit_children_get(const Eolian_Unit *unit);
909 * 909 *
910 * @param[in] unit The unit. 910 * @param[in] unit The unit.
911 * 911 *
912 * @see eolian_unit_file_path_get
913 *
912 * @ingroup Eolian 914 * @ingroup Eolian
913 */ 915 */
914EAPI const char *eolian_unit_file_get(const Eolian_Unit *unit); 916EAPI const char *eolian_unit_file_get(const Eolian_Unit *unit);
915 917
916/* 918/*
919 * @brief Get the full file path a unit is associated with.
920 *
921 * This will be `NULL` if not associated with a file (like the master unit
922 * within `Eolian_State`).
923 *
924 * @param[in] unit The unit.
925 *
926 * @see eolian_unit_file_get
927 *
928 * @ingroup Eolian
929 */
930EAPI const char *eolian_unit_file_path_get(const Eolian_Unit *unit);
931
932/*
917 * @brief Get an object in a unit by name. 933 * @brief Get an object in a unit by name.
918 * 934 *
919 * Only objects declared directly within the file can be retrieved, i.e. 935 * Only objects declared directly within the file can be retrieved, i.e.
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index ddb14e3a0f..eb6e896bab 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -1226,6 +1226,16 @@ eolian_unit_file_get(const Eolian_Unit *unit)
1226 return unit->file; 1226 return unit->file;
1227} 1227}
1228 1228
1229EAPI const char *
1230eolian_unit_file_path_get(const Eolian_Unit *unit)
1231{
1232 if (!unit || !unit->file) return NULL;
1233 Eina_Bool is_eo = eina_str_has_suffix(unit->file, EO_SUFFIX);
1234 return eina_hash_find(is_eo
1235 ? unit->state->filenames_eo
1236 : unit->state->filenames_eot, unit->file);
1237}
1238
1229EAPI const Eolian_Object * 1239EAPI const Eolian_Object *
1230eolian_unit_object_by_name_get(const Eolian_Unit *unit, const char *name) 1240eolian_unit_object_by_name_get(const Eolian_Unit *unit, const char *name)
1231{ 1241{