--- a/svghmi/hmi_tree.ysl2 Mon Mar 23 15:13:36 2020 +0100
+++ b/svghmi/hmi_tree.ysl2 Mon Mar 23 21:44:28 2020 +0100
@@ -52,36 +52,6 @@
}
}
-def "func:get_hmi_tree_elt" {
- param "path";
- param "root", "$hmitree";
- message > get_hmi_tree_elt «$path»
- if "not(starts-with($path, '/'))" error > Given path "«$path»" should start with a "/"
- const "stripped", "substring($path, 2)";
- const "token" choose {
- when "contains($stripped, '/')" value "substring-before($stripped, '/')";
- otherwise value "$stripped";
- }
-
- choose {
- when "string-length($token) = 0"{
- result "$root";
- }
- otherwise{
- const "rest", "substring-after($stripped, $token)";
- const "match", "$root/*[@name = $token]";
- choose {
- when "string-length($rest) > 0"{
- result "func:get_hmi_tree_el($rest, $match)";
- }
- otherwise{
- result "$match";
- }
- }
- }
- }
-}
-
// Parses:
// "HMI:WidgetType:param1:param2@path1@path2"
//
@@ -139,6 +109,14 @@
}
+def "func:is_descendant_path" {
+ param "descend";
+ param "ancest";
+ // TODO : use HMI tree to answer more accurately
+ result "string-length($ancest) > 0 and starts-with($descend,$ancest)";
+}
+
+
// Debug data
template "*", mode="testtree"{
param "indent", "''";