Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Bo Berglund via fpc-pascal
On Thu, 3 Sep 2020 10:22:17 +0200, Martin Frb via fpc-pascal wrote: >On 03/09/2020 10:09, Bo Berglund via fpc-pascal wrote: >> I would like to create a buffer into which a thread can push incoming >> data and the main thread can extract it for processing. >> Data are coming from the serial port

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 14:54, Bo Berglund via fpc-pascal wrote: Now to my question: Is there some *example* around for using TLazThreadedQueue as a circular buffer? In the examples dir are only examples for LazUnicode and LookUpStringList... And when reading the sources I cannot really say I understand

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Bo Berglund via fpc-pascal
On Thu, 3 Sep 2020 15:47:53 +0200, Martin Frb via fpc-pascal wrote: >On 03/09/2020 14:54, Bo Berglund via fpc-pascal wrote: >> Now to my question: >> Is there some *example* around for using TLazThreadedQueue as a >> circular buffer? >> In the examples dir are only examples for LazUnicode and >>

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 16:36, Bo Berglund via fpc-pascal wrote: A "simplest case" usage example would be nice to have. True. Once you got enough info from this thread, please write one. I still when looking at the sources have no clue as to how it would be used... It seems to me like at the very

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 17:44, Martin Frb via fpc-pascal wrote: type   TMyData = class       FData: array of byte;    end;   TMyThreadedQueue = specialize TLazThreadedQueue; Of course you can do   TMyData = array of byte;  // or record end if you want   TMyThreadedQueue = specialize

Re: [fpc-pascal] String literals and code page of .pas source file

2020-09-03 Thread Sven Barth via fpc-pascal
Am 03.09.2020 um 07:19 schrieb LacaK via fpc-pascal: Hi *, I would like to have source file in Windows-1250 encoding, where are stored literal strings like 'áéíóčž' in Windows-1250 encoding (I share this one file between FPC/Lazarus and Delphi 7). Windows-1250 is also ANSI code page of my

Re: [fpc-pascal] String literals and code page of .pas source file

2020-09-03 Thread LacaK via fpc-pascal
Hi *, I would like to have source file in Windows-1250 encoding, where are stored literal strings like 'áéíóčž' in Windows-1250 encoding (I share this one file between FPC/Lazarus and Delphi 7). Windows-1250 is also ANSI code page of my Windows OS. In source file I have: {$IFDEF FPC}  

Re: [fpc-pascal] Procedural generics question

2020-09-03 Thread Lars via fpc-pascal
On 2020-08-26 05:44, Nico Neumann via fpc-pascal wrote: The TypeInfo function checks the code during run-time thus the generated code is 'bloated'. Better use the compiler intrinsic GetTypeKind. {$mode objfpc} uses typinfo; generic procedure Add; begin if GetTypeKind(T) = tkInteger

[fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Bo Berglund via fpc-pascal
I would like to create a buffer into which a thread can push incoming data and the main thread can extract it for processing. Data are coming from the serial port in a worker thread and should be consumed by the main thread. The data is a byte stream. Are there any good examples available? I have

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 10:09, Bo Berglund via fpc-pascal wrote: I would like to create a buffer into which a thread can push incoming data and the main thread can extract it for processing. Data are coming from the serial port in a worker thread and should be consumed by the main thread. The data is a