# HG changeset patch # User Edouard Tisserant <edouard.tisserant@gmail.com> # Date 1584428433 -3600 # Node ID b67af0b8dc72fd9daffcab47493ec48d0b525e6c # Parent 022db76c3bffd6b83e9c372ba7d0bc91b5d01327 SVGHMI: more debug code moved to hmi_tree.ysl2 diff -r 022db76c3bff -r b67af0b8dc72 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Tue Mar 17 07:39:50 2020 +0100 +++ b/svghmi/gen_index_xhtml.xslt Tue Mar 17 08:00:33 2020 +0100 @@ -215,6 +215,36 @@ </xsl:with-param> </xsl:apply-templates> </xsl:template> + <xsl:template mode="testtree" match="*"> + <xsl:param name="indent" select="''"/> + <xsl:value-of select="$indent"/> + <xsl:text> </xsl:text> + <xsl:value-of select="local-name()"/> + <xsl:text> </xsl:text> + <xsl:for-each select="@*"> + <xsl:value-of select="local-name()"/> + <xsl:text>="</xsl:text> + <xsl:value-of select="."/> + <xsl:text>" </xsl:text> + </xsl:for-each> + <xsl:text> +</xsl:text> + <xsl:apply-templates mode="testtree" select="*"> + <xsl:with-param name="indent"> + <xsl:value-of select="concat($indent,'>')"/> + </xsl:with-param> + </xsl:apply-templates> + </xsl:template> + <xsl:template name="debug_hmitree"> + <xsl:text>Raw HMI tree +</xsl:text> + <xsl:apply-templates mode="testtree" select="$hmitree"/> + <xsl:text> +</xsl:text> + <xsl:text>Indexed HMI tree +</xsl:text> + <xsl:apply-templates mode="testtree" select="$indexed_hmitree"/> + </xsl:template> <func:function name="func:is_descendant_path"> <xsl:param name="descend"/> <xsl:param name="ancest"/> @@ -345,10 +375,13 @@ </xsl:text> </xsl:comment> <xsl:comment> - <xsl:apply-templates mode="testtree" select="$hmitree"/> - </xsl:comment> - <xsl:comment> - <xsl:apply-templates mode="testtree" select="$indexed_hmitree"/> + <xsl:text> +</xsl:text> + <xsl:text>debug_hmitree: +</xsl:text> + <xsl:call-template name="debug_hmitree"/> + <xsl:text> +</xsl:text> </xsl:comment> <xsl:comment> <xsl:text>Detachable : @@ -1468,26 +1501,6 @@ <xsl:text>//})(); </xsl:text> </xsl:template> - <xsl:template mode="testtree" match="*"> - <xsl:param name="indent" select="''"/> - <xsl:value-of select="$indent"/> - <xsl:text> </xsl:text> - <xsl:value-of select="local-name()"/> - <xsl:text> </xsl:text> - <xsl:for-each select="@*"> - <xsl:value-of select="local-name()"/> - <xsl:text>="</xsl:text> - <xsl:value-of select="."/> - <xsl:text>" </xsl:text> - </xsl:for-each> - <xsl:text> -</xsl:text> - <xsl:apply-templates mode="testtree" select="*"> - <xsl:with-param name="indent"> - <xsl:value-of select="concat($indent,'>')"/> - </xsl:with-param> - </xsl:apply-templates> - </xsl:template> <xsl:template name="defs_by_labels"> <xsl:param name="labels" select="''"/> <xsl:param name="mandatory" select="'yes'"/> diff -r 022db76c3bff -r b67af0b8dc72 svghmi/gen_index_xhtml.ysl2 --- a/svghmi/gen_index_xhtml.ysl2 Tue Mar 17 07:39:50 2020 +0100 +++ b/svghmi/gen_index_xhtml.ysl2 Tue Mar 17 08:00:33 2020 +0100 @@ -264,16 +264,9 @@ comment > Made with SVGHMI. https://beremiz.org // use python to call all debug output from included definitions - // '&bug' is a workaround for old pyPEG that choke on empty python results - !"&bug "+"\n".join(["comment {|\n| %s:\n call \"%s\";\n| \n}"%(n,n) for n in debug_output_calls])! - - // TODO - comment { - apply "$hmitree", mode="testtree"; - } - comment { - apply "$indexed_hmitree", mode="testtree"; - } + // '&bug' is a workaround for pyPEG that choke on yml2 python results not parsing to a single call + !"&bug {"+"\n".join(["comment {\n| \n| %s:\n call \"%s\";\n| \n}"%(n,n) for n in debug_output_calls]) +"}"! + comment { | Detachable : foreach "$detachable_elements"{ @@ -514,17 +507,6 @@ // } - /**/ - template "*", mode="testtree"{ - param "indent", "''"; - > «$indent» «local-name()» - foreach "@*" > «local-name()»="«.»" - > \n - apply "*", mode="testtree" { - with "indent" value "concat($indent,'>')" - }; - } - /**/ function "defs_by_labels" { param "labels","''"; diff -r 022db76c3bff -r b67af0b8dc72 svghmi/hmi_tree.ysl2 --- a/svghmi/hmi_tree.ysl2 Tue Mar 17 07:39:50 2020 +0100 +++ b/svghmi/hmi_tree.ysl2 Tue Mar 17 08:00:33 2020 +0100 @@ -45,3 +45,22 @@ with "parentpath" > «$parentpath» } } + +// Debug data +template "*", mode="testtree"{ + param "indent", "''"; + > «$indent» «local-name()» + foreach "@*" > «local-name()»="«.»" + > \n + apply "*", mode="testtree" { + with "indent" value "concat($indent,'>')" + }; +} +function "debug_hmitree" { + | Raw HMI tree + apply "$hmitree", mode="testtree"; + | + | Indexed HMI tree + apply "$indexed_hmitree", mode="testtree"; +} +!debug_output_calls.append("debug_hmitree")