aboutsummaryrefslogtreecommitdiffstats
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
parenteina_lock: add empty do-while in macro (diff)
downloadefl-e8794253ccb264795e34075b6192ffb9c6863d95.tar.gz
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);
*
* @param[in] unit The unit.
*
+ * @see eolian_unit_file_path_get
+ *
* @ingroup Eolian
*/
EAPI const char *eolian_unit_file_get(const Eolian_Unit *unit);
/*
+ * @brief Get the full file path a unit is associated with.
+ *
+ * This will be `NULL` if not associated with a file (like the master unit
+ * within `Eolian_State`).
+ *
+ * @param[in] unit The unit.
+ *
+ * @see eolian_unit_file_get
+ *
+ * @ingroup Eolian
+ */
+EAPI const char *eolian_unit_file_path_get(const Eolian_Unit *unit);
+
+/*
* @brief Get an object in a unit by name.
*
* 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)
return unit->file;
}
+EAPI const char *
+eolian_unit_file_path_get(const Eolian_Unit *unit)
+{
+ if (!unit || !unit->file) return NULL;
+ Eina_Bool is_eo = eina_str_has_suffix(unit->file, EO_SUFFIX);
+ return eina_hash_find(is_eo
+ ? unit->state->filenames_eo
+ : unit->state->filenames_eot, unit->file);
+}
+
EAPI const Eolian_Object *
eolian_unit_object_by_name_get(const Eolian_Unit *unit, const char *name)
{