Peter, you can use ctrl-R to append rungs. I know the description says "insert", but it actually appends.
I wonder if that is configurable some where. ctrl-R definitely inserts for me and if ctrl-R appends then how do you insert?
Right now ctrl-R inserts for me. I must click on the word Network and do the cut and paste to get the rung where I want it.
L D[AR2,P#0.0], I ran into another road block when trying to make a generic Load Index using an any pointer and a index as parameters. At first I tried to declare RET_VAL as ANY but that doesn't really make sense as then RET_VAL is a pointer to where? Making RET_VAL and seems to be only useful for building an ANY pointer but not for returning an element that can be of any type. One must pass a destination any pointer to where the result is going to be written and then the function looks a lot like yours only the destination would be just one element long. I could add extra code to let one select N elements out of an array.
The indexing feature would be easier to do in SCL. SCL also seems to support the equivalent of unions or 'views' as SCL puts it whereas STL does not. However, you should see the RNG,random number generator, function block written in SCL. Half the text is converting numbers from DWORDs TO DINTs and back then REALs and no code is generated for that.
I think that your example works for basic elements. But what if it is an array of STRUCTs or UDTs ?
I tinkered myself with a sizeof function in SCL. However, it is not so simple, because you must make checks for that the data is plausible, i.e. if it fits within the given dataset, if it is a multiple of the given dataset etc.
The compiler should make this easy it is in any real language.
I want our compiler writer to add a last(array), length(array) and sizeof(structure or array) functions to our product. The compiler should see sizeof(structure) and replace it with a constant and not all the code that L D [AR2,P#0.0] created.
Next week I will start on the Ethernet interface to our controller using the T blocks. Today we have our open house.