09-18-2020, 09:12 PM
Thanks for your input!
I had been wondering about the transfer of the event function into the thread, but as you point out if I supply the owner as parameter then I could both reach the event function and FComm itself via that parameter.
I will digest and implement your simplifications now.
Regarding the protocol usage I wanted to make this class as general purpose as possible only implementing the event driven receive.
The first use is in fact a program which uses the protocol. But in future applications that might not be the case.
Anyway the application I am porting has a lot of code dealing with the protocol so I don't want to change that.
Re strings, I think FreePascal did not do what Delphi did and throw out the old string and replace with WideString still named string.
Instead FPC adheres to string = AnsiString as far as I know. I will probably change the ported app such that the containers are declared AnsiString instead, but generally I am switching to TBytes (or TIdBytes).
I will not go back to Delphi anyway, especially since I got my new notebook with Windows 10 (ouch!). I installed Delphi7 and Delpi2007 on it and will put Delphi XE7 only if needed.
Been doing Delphi since 1995 or so (Delphi1) until XE5, I only upgraded to XE7 once but never really used it.
But I am doing a lot of stuff on Raspberry Pi boxes these days and then FreePascal and Lazarus are what I use.
I had been wondering about the transfer of the event function into the thread, but as you point out if I supply the owner as parameter then I could both reach the event function and FComm itself via that parameter.
I will digest and implement your simplifications now.
Regarding the protocol usage I wanted to make this class as general purpose as possible only implementing the event driven receive.
The first use is in fact a program which uses the protocol. But in future applications that might not be the case.
Anyway the application I am porting has a lot of code dealing with the protocol so I don't want to change that.
Re strings, I think FreePascal did not do what Delphi did and throw out the old string and replace with WideString still named string.
Instead FPC adheres to string = AnsiString as far as I know. I will probably change the ported app such that the containers are declared AnsiString instead, but generally I am switching to TBytes (or TIdBytes).
I will not go back to Delphi anyway, especially since I got my new notebook with Windows 10 (ouch!). I installed Delphi7 and Delpi2007 on it and will put Delphi XE7 only if needed.
Been doing Delphi since 1995 or so (Delphi1) until XE5, I only upgraded to XE7 once but never really used it.
But I am doing a lot of stuff on Raspberry Pi boxes these days and then FreePascal and Lazarus are what I use.