# HG changeset patch # User Edouard Tisserant # Date 1657791559 -7200 # Node ID 5d73bed497de3397e3f88dcc1b63e0a8f8d30fa7 # Parent a8b6d5e1fda31c16f3324510eb9a7f51399daa88 SVGHMI: Warn at build time when SVG refers to non-existing widget types. diff -r a8b6d5e1fda3 -r 5d73bed497de svghmi/widget_list.ysl2 --- a/svghmi/widget_list.ysl2 Thu Jul 14 11:35:22 2022 +0200 +++ b/svghmi/widget_list.ysl2 Thu Jul 14 11:39:19 2022 +0200 @@ -27,3 +27,4 @@ | }, } +widget_class("List"); diff -r a8b6d5e1fda3 -r 5d73bed497de svghmi/widget_textlist.ysl2 --- a/svghmi/widget_textlist.ysl2 Thu Jul 14 11:35:22 2022 +0200 +++ b/svghmi/widget_textlist.ysl2 Thu Jul 14 11:39:19 2022 +0200 @@ -26,3 +26,5 @@ // could find a proper way in xpath to reverse() | ].reverse(), } + +widget_class("TextList"); diff -r a8b6d5e1fda3 -r 5d73bed497de svghmi/widget_textstylelist.ysl2 --- a/svghmi/widget_textstylelist.ysl2 Thu Jul 14 11:35:22 2022 +0200 +++ b/svghmi/widget_textstylelist.ysl2 Thu Jul 14 11:39:19 2022 +0200 @@ -26,3 +26,4 @@ | }, } +widget_class("TextStyleList"); diff -r a8b6d5e1fda3 -r 5d73bed497de svghmi/widgets_common.ysl2 --- a/svghmi/widgets_common.ysl2 Thu Jul 14 11:35:22 2022 +0200 +++ b/svghmi/widgets_common.ysl2 Thu Jul 14 11:39:19 2022 +0200 @@ -477,14 +477,17 @@ generate-id() = generate-id(key('TypesKey', @type)) and not(@type = $excluded_types)]"""; apply "$used_widget_types", mode="widget_class"; -} - -template "widget", mode="widget_class" -|| -class «@type»Widget extends Widget{ - /* empty class, as «@type» widget didn't provide any */ -} -|| + +} + +template "widget", mode="widget_class" { + || + class «@type»Widget extends Widget{ + /* empty class, as «@type» widget didn't provide any */ + } + || + warning > «@type» widget is used in SVG but widget type is not declared +} const "included_ids","$parsed_widgets/widget[not(@type = $excluded_types) and not(@id = $discardable_elements/@id)]/@id"; const "hmi_widgets","$hmi_elements[@id = $included_ids]"; @@ -494,6 +497,7 @@ | var hmi_widgets = { apply "$hmi_widgets", mode="hmi_widgets"; | } + | } function "defs_by_labels" {