forked from PLC-lang/rusty
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cfc): Call statements for function blocks (PLC-lang#1006)
Whenever we encountered a CFC block element, we previously created call statements based on it's typeName. While this is correct for function calls, it is incorrect for function block calls where it should have been the instanceName. To better illustrate the issue, here's the culprit <block localId="4" width="137" height="80" typeName="myFb" instanceName="fb0" executionOrderId="0">. This issue has been fixed by using the instanceName before falling back to the typeName.
- Loading branch information
Showing
6 changed files
with
117 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<pou xmlns="http://www.plcopen.org/xml/tc6_0201" name="myFb" pouType="functionBlock"> | ||
<interface> | ||
<localVars/> | ||
<addData> | ||
<data name="www.bachmann.at/plc/plcopenxml" handleUnknown="implementation"> | ||
<textDeclaration> | ||
<content> | ||
FUNCTION_BLOCK myFb | ||
VAR_INPUT | ||
in1 : DINT; | ||
in2 : DINT; | ||
END_VAR | ||
|
||
VAR_OUTPUT | ||
out1 : DINT; | ||
out2 : DINT; | ||
out3 : DINT; | ||
END_VAR | ||
|
||
VAR | ||
|
||
END_VAR | ||
</content> | ||
</textDeclaration> | ||
</data> | ||
</addData> | ||
</interface> | ||
<body> | ||
<FBD/> | ||
</body> | ||
</pou> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<pou xmlns="http://www.plcopen.org/xml/tc6_0201" name="main" pouType="program"> | ||
<interface> | ||
<localVars/> | ||
<addData> | ||
<data name="www.bachmann.at/plc/plcopenxml" handleUnknown="implementation"> | ||
<textDeclaration> | ||
<content> | ||
PROGRAM main | ||
VAR | ||
fb0 : myFb; | ||
END_VAR | ||
</content> | ||
</textDeclaration> | ||
</data> | ||
</addData> | ||
</interface> | ||
<body> | ||
<FBD> | ||
<block localId="4" width="137" height="80" typeName="myFb" instanceName="fb0" executionOrderId="0"> | ||
<position x="200" y="110"/> | ||
<inputVariables> | ||
<variable formalParameter="in1" negated="false"> | ||
<connectionPointIn> | ||
<relPosition x="0" y="30"/> | ||
</connectionPointIn> | ||
</variable> | ||
<variable formalParameter="in2" negated="false"> | ||
<connectionPointIn> | ||
<relPosition x="0" y="50"/> | ||
</connectionPointIn> | ||
</variable> | ||
</inputVariables> | ||
<inOutVariables/> | ||
<outputVariables> | ||
<variable formalParameter="out1" negated="false"> | ||
<connectionPointOut> | ||
<relPosition x="137" y="30"/> | ||
</connectionPointOut> | ||
</variable> | ||
<variable formalParameter="out2" negated="false"> | ||
<connectionPointOut> | ||
<relPosition x="137" y="50"/> | ||
</connectionPointOut> | ||
</variable> | ||
<variable formalParameter="out3" negated="false"> | ||
<connectionPointOut> | ||
<relPosition x="137" y="70"/> | ||
</connectionPointOut> | ||
</variable> | ||
</outputVariables> | ||
</block> | ||
</FBD> | ||
</body> | ||
</pou> |