You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Christofer Dutz <ch...@c-ware.de> on 2020/06/23 12:46:07 UTC

Reached the next PLC4C milestone

Hi all,

I am proud and happy to announce I just finished the next milestone of my project on porting PLC4X to C.

It was quite a marathon. I guess if you simply think about an API that is quite easy to port to a language like C, even if it does sort of feel strange every now and then.
However with mspec we have this concept of discriminated types which in object-oriented languages is handled by types and subtypes.
C however doesn’t know this concept, so I had to find ways to port all of these concepts (as far as we needed them) to C using only what’s available in C.
This required quite a lot of refactoring. But the good thing is: this refactoring had an impact on the existing Java drivers and I think the changes to the “discriminators” was a huge leap forward.

Next on my plan is to implement the logic needed to build real drivers. Right now the SPI module in PLC4C is pretty empty. It does already have all the means to load drivers and transports, but things like the ReadBuffer and WriteBuffer are empty skeletons also don’t we have any form of base classes like we have in the Java world that allow us to implement drivers as simple as possible. This will be my challenge for the next few weeks. I do hope that I won’t have another 3-4 week delay, as I did with the code-generation.

So much for the update :-)

Chris


Re: Reached the next PLC4C milestone

Posted by Otto Fowler <ot...@gmail.com>.
 Great job Chris!

On June 23, 2020 at 08:46:19, Christofer Dutz (christofer.dutz@c-ware.de)
wrote:

Hi all,

I am proud and happy to announce I just finished the next milestone of my
project on porting PLC4X to C.

It was quite a marathon. I guess if you simply think about an API that is
quite easy to port to a language like C, even if it does sort of feel
strange every now and then.
However with mspec we have this concept of discriminated types which in
object-oriented languages is handled by types and subtypes.
C however doesn’t know this concept, so I had to find ways to port all of
these concepts (as far as we needed them) to C using only what’s available
in C.
This required quite a lot of refactoring. But the good thing is: this
refactoring had an impact on the existing Java drivers and I think the
changes to the “discriminators” was a huge leap forward.

Next on my plan is to implement the logic needed to build real drivers.
Right now the SPI module in PLC4C is pretty empty. It does already have all
the means to load drivers and transports, but things like the ReadBuffer
and WriteBuffer are empty skeletons also don’t we have any form of base
classes like we have in the Java world that allow us to implement drivers
as simple as possible. This will be my challenge for the next few weeks. I
do hope that I won’t have another 3-4 week delay, as I did with the
code-generation.

So much for the update :-)

Chris