--- a/plcopen/instances_path.xslt Sun Jul 14 08:43:12 2019 +0200
+++ b/plcopen/instances_path.xslt Tue Sep 24 11:55:59 2019 +0200
@@ -62,9 +62,9 @@
</xsl:apply-templates>
</xsl:template>
<xsl:template match="ppx:dataType">
- <xsl:param name="instance_path"/>
+ <xsl:param name="instance_path" select="concat('#',@name)"/>
<xsl:apply-templates select="ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]">
- <xsl:with-param name="parent_path">
+ <xsl:with-param name="variable_path">
<xsl:value-of select="$instance_path"/>
</xsl:with-param>
</xsl:apply-templates>
@@ -108,12 +108,12 @@
<xsl:text>.</xsl:text>
<xsl:value-of select="@name"/>
</xsl:variable>
+ <xsl:apply-templates select="ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]">
+ <xsl:with-param name="variable_path">
+ <xsl:value-of select="$element_path"/>
+ </xsl:with-param>
+ </xsl:apply-templates>
</xsl:for-each>
- <xsl:apply-templates select="ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]">
- <xsl:with-param name="variable_path">
- <xsl:value-of select="$element_path"/>
- </xsl:with-param>
- </xsl:apply-templates>
</xsl:template>
<xsl:template match="ppx:array">
<xsl:param name="variable_path"/>
--- a/plcopen/instances_path.ysl2 Sun Jul 14 08:43:12 2019 +0200
+++ b/plcopen/instances_path.ysl2 Tue Sep 24 11:55:59 2019 +0200
@@ -60,9 +60,9 @@
}
template "ppx:dataType" {
- param "instance_path";
+ param "instance_path","concat('#',@name)";
apply "ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
- with "parent_path" > «$instance_path»
+ with "variable_path" > «$instance_path»
}
}
@@ -94,9 +94,9 @@
param "variable_path";
foreach "ppx:variable[ppx:type/ppx:derived or ppx:type/ppx:struct or ppx:type/ppx:array]" {
variable "element_path" > «$variable_path».«@name»
- }
- apply "ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
- with "variable_path" > «$element_path»
+ apply "ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
+ with "variable_path" > «$element_path»
+ }
}
}
--- a/tests/python/plc.xml Sun Jul 14 08:43:12 2019 +0200
+++ b/tests/python/plc.xml Tue Sep 24 11:55:59 2019 +0200
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<project xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="" productName="Beremiz" productVersion="0.0" creationDateTime="2008-12-14T16:21:19" contentDescription="This example shows many features in Beremiz: 1. How to implement python extensions. 2. How to implement basic C extension. 3. How to use C code in IEC POUs. 4. How to call C functions from python code. 5. How to avoid race conditions between IEC, C and python code. 6. How to convert betweet different IEC types. "/>
- <contentHeader name="Beremiz Python Support Tests" modificationDateTime="2018-09-26T13:15:28">
+ <contentHeader name="Beremiz Python Support Tests" modificationDateTime="2019-09-24T11:49:14">
<coordinateInfo>
<pageSize x="1024" y="1024"/>
<fbd>
@@ -49,6 +49,16 @@
<BOOL/>
</baseType>
</dataType>
+ <dataType name="blups">
+ <baseType>
+ <array>
+ <dimension lower="0" upper="31"/>
+ <baseType>
+ <derived name="CPLX_TYPE"/>
+ </baseType>
+ </array>
+ </baseType>
+ </dataType>
</dataTypes>
<pous>
<pou name="main_pytest" pouType="program">
@@ -61,6 +71,9 @@
<initialValue>
<simpleValue value="3"/>
</initialValue>
+ <documentation>
+ <xhtml:p><![CDATA[blah]]></xhtml:p>
+ </documentation>
</variable>
<variable name="mux2_sel">
<type>
@@ -1351,6 +1364,11 @@
<derived name="RS"/>
</type>
</variable>
+ <variable name="Dudiduda">
+ <type>
+ <derived name="blups"/>
+ </type>
+ </variable>
</externalVars>
</interface>
<body>
@@ -1372,6 +1390,9 @@
}}
(* If you do not use GetFbVar and SetFbVar macros, expect unexpected behaviour*)
Global_RS();
+
+(* testing access to global struct array *)
+Dudiduda[2].FIRSTBYTE := 0;
]]></xhtml:p>
</ST>
</body>
@@ -1442,6 +1463,11 @@
<derived name="RS"/>
</type>
</variable>
+ <variable name="Dudiduda">
+ <type>
+ <derived name="blups"/>
+ </type>
+ </variable>
<variable name="TUTU">
<type>
<INT/>