Analysis of LUA problems on IDE 3.0.x + Forte develop [message #1872473] |
Fri, 01 November 2024 07:35 |
Guido Piasenza Messages: 17 Registered: October 2024 |
Junior Member |
|
|
Hi Experts,
I did some further investigations with IDE branch 3.0.x and Forte develop branch.
Here the results:
Build errors:
1. In some places mInterfaceSpec is still used as a pointer although it's now a reference.
2. In some other places it's still passed as a parameter although it's now a class member (e.g. constructor of CGenFunctionBlock)
3. The function setupFBInterface no longer exists and seem to be redundant, as the interfaceSpec is a class member
I "fixed" those problems and forte now builds and runs. Not sure if the interface spec is handled properly everywhere, as I'm not familiar with the code.
LUA code generation errors:
1. Code generation for CASE / END_CASE "forgets" to emit the final "end" LUA statement which should close END_CASE
2. Code generation for ELSIF emits "elsif" in LUA code, but this should be "elseif" (at least with LUA 5.4 which is what I am using - not sure with other versions).
I changed my ST code to use cascading IF/ELSIF/END_IF statements to avoid problem 1, and I added a horrendous hack in CLuaBFBTypeEntry::createLuaFBTypeEntry to replace "elsif" with "elseif¨.
With these changes luaL_loadstring returns LUA_OK (previously it returned LUA_ERRSYNTAX).
These problems would need to be fixed into the LUA code generator, but I haven't looked into it yet, and I'm totally unfamiliar with Eclipse plugin development :-(
Now Forte accepts the LUA script but complains about:
ERROR: T#1730445126092751993: Runtime error calling Lua function: [string "local STfunc = require "STfunc"..."]:1: module 'STfunc' not found:
STfunc_buffer: bad binary format (not a binary chunk)
no file '/usr/local/share/lua/5.4/STfunc.lua'
no file '/usr/local/share/lua/5.4/STfunc/init.lua'
no file '/usr/local/lib/lua/5.4/ERROR: T#1730445126092757374: Error loading definitions
I will try to understand what this means. From the name I imagine it would be a LUA library of standard IEC function blocks ? Maybe this is related to several error messages I get in the IDE which are unrelated to my ST code, for example I get some errors in E_TABLE_CTRL, where it complains about this code:
ALGORITHM STEP
CV := CV +1;
DTO := DT[CV];
END_ALGORITHM
Here it says: "extraneous input STEP, expecting RULE_ID¨.
If I change ¨STEP" into "STEP1" the problem disappears. Also, "STEP" is highlighted in orange, maybe it's a reserved word ?
Are these standard function blocks autogenerated, or are they part of a library in source form ?
I hope this information can be useful for the developers.
I don't know what is your development strategy, if it can be useful I can create a merge request for the build problems so you can evaluate if everything is OK.
[Updated on: Fri, 01 November 2024 07:47] Report message to a moderator
|
|
|
Re: Analysis of LUA problems on IDE 3.0.x + Forte develop [message #1872476 is a reply to message #1872473] |
Fri, 01 November 2024 08:18 |
|
Thx for your investigation. we are happy to review any Pull requests that you can provide and discuss details there. Information on the contribution workflow you can find in our contributing files: https://github.com/eclipse-4diac/4diac-forte/blob/develop/CONTRIBUTING.md
Regarding LUA code generation: currently functions and simple functions blocks are not covered by the LUA infrastructure. Standard functions and function blocks are built in 4diac FORTE C++ code. For performance and other reasons.
Yes STEP is a reserved keyword in IEC 61131-3. If you hover the error marker shown on the side you will get more information. Or you can also look into the problems view where also more information on all errors and warnings are printed.
|
|
|
Powered by
FUDForum. Page generated in 0.04682 seconds