Re: [fpc-pascal] Ethernet Relays

2020-09-08 Thread Michael Van Canneyt via fpc-pascal
Add the ssockets unit to your uses clause. Michael On Mon, 7 Sep 2020, James Richters via fpc-pascal wrote: When I try to compile either of the examples below, I get Error: Identifier not found "ESocketError" Any ideas? James Yes, catch the ESocketError in a try..except: Try

Re: [fpc-pascal] Why can I not build fpc 3.0.4 with ppcarm 3.0.0 or 3.0.4?

2020-09-08 Thread Bo Berglund via fpc-pascal
On Tue, 08 Sep 2020 00:59:51 +0200, Bo Berglund via fpc-pascal wrote: >Today when I was setting up a Raspberry PiZero I was hit with this >message when I was going to build fpc 3.0.4 (sources checked out from >svn): > >Makefile:2790: *** The only supported starting compiler version is >3.0.2.

Re: [fpc-pascal] Ethernet Relays

2020-09-08 Thread James Richters via fpc-pascal
I added ssockets now I can compile it. I have this working with the ssockets unit added: Try S:=TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/3/15'); except On E: ESocketError do Writeln('Could not connect to server'); end; But when I try the version with the timeout, I always get

[fpc-pascal] Help with TList example

2020-09-08 Thread James Richters via fpc-pascal
I'm trying to figure out how TList works. I found the code example below by doing a search, but I can't compile it, I get Error: Illegal qualifier on the line MyRec.Value := tmp; It's indicating the error is on the V of Value I tried commenting that line out, then I get the same error

Re: [fpc-pascal] Help with TList example

2020-09-08 Thread Tony Whyman via fpc-pascal
Two observations: 1. In Pascal you should use "new" and "dispose" to allocate and deallocate record types - not GetMem and FreeMem. 2. MyRec is a pointer type and you should code the line as MyRec^.Value := tmp On 08/09/2020 12:10, James Richters via fpc-pascal wrote: I'm trying to figure

Re: [fpc-pascal] Ethernet Relays

2020-09-08 Thread Michael Van Canneyt via fpc-pascal
On Tue, 8 Sep 2020, James Richters via fpc-pascal wrote: I added ssockets now I can compile it. I have this working with the ssockets unit added: Try S:=TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/3/15'); except On E: ESocketError do Writeln('Could not connect to server'); end;

Re: [fpc-pascal] Help with TList example

2020-09-08 Thread James Richters via fpc-pascal
Can you please give me an example of the correct way to use new and dispose? I'll try the pointer Thanks for the advice James -Original Message- From: fpc-pascal On Behalf Of Tony Whyman via fpc-pascal Sent: Tuesday, September 8, 2020 7:21 AM To: fpc-pascal@lists.freepascal.org Cc:

Re: [fpc-pascal] Help with TList example

2020-09-08 Thread Jean SUZINEAU via fpc-pascal
Another way is to declare TMyRec as class instead of record. In this case, you don't need the  dereference operator ^ . No need of new and dispose, just Create and Free, as for TMyRecList. I don't know if there is a better performance when you use a record, but as far as I know,

Re: [fpc-pascal] Help with TList example

2020-09-08 Thread Tony Whyman via fpc-pascal
See https://www.freepascal.org/docs-html/rtl/system/dispose.html On 08/09/2020 12:51, James Richters wrote: Can you please give me an example of the correct way to use new and dispose? I'll try the pointer Thanks for the advice James -Original Message- From: fpc-pascal On Behalf Of

[fpc-pascal] How to build for arm6 in RaspberryPi on arm7?

2020-09-08 Thread Bo Berglund via fpc-pascal
I am using RPi3 and RPi4 platforms when working on RPi projects with Lazarus 2.0.8 and Fpc 3.0.4. Now I realized that the binaries I create will probably not work on PiZero and RPi2 devices because these are Arm6 and the dev platform is Arm7. Is there some project setting I can activate in order

Re: [fpc-pascal] TFPObjectlist example

2020-09-08 Thread Vojtěch Čihák via fpc-pascal
Hi,   some crippled formatting, so again:   However, in your case (records) I would rather use TFPGList from FGL unit:   1) add {$modeswitch ADVANCEDRECORDS}   2) add FGL to uses 3) define class operator = test = record    Port :String;    Size :Byte;    Status :Word;    class operator = (A,B:

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

2020-09-08 Thread Bo Berglund via fpc-pascal
On Mon, 7 Sep 2020 14:45:31 -0700 (MST), Brian via fpc-pascal wrote: >Bo, > >Most of the users on this forum have never interfaced with hardware , as you >can see from the responses. Those who have interfaced with hardware have >developed circular buffers which they know work , and they reuse

Re: [fpc-pascal] TFPObjectlist example

2020-09-08 Thread Vojtěch Čihák via fpc-pascal
Hi,   I used TFPObjectList only once, for visual component TECAccordion (https://wiki.lazarus.freepascal.org/Eye-Candy_Controls#TECAccordion). Each item of list is derived from TWinControl so it is possible to use it even for visual components (like TCollection).   However, in your case

Re: [fpc-pascal] How to build for arm6 in RaspberryPi on arm7?

2020-09-08 Thread Bo Berglund via fpc-pascal
On Tue, 08 Sep 2020 15:11:07 +0200, Bo Berglund via fpc-pascal wrote: >Is there some project setting I can activate in order to build for >*all* RPi devices by only using ARMv6 instructions? I used Project/ProjectOptions/ConfigAndTarget and: set Target CPU family = arm set Target processor =

Re: [fpc-pascal] Help with TList example

2020-09-08 Thread Ryan Joseph via fpc-pascal
> On Sep 8, 2020, at 6:10 PM, James Richters via fpc-pascal > wrote: > > I'm trying to figure out how TList works. I found the code example below by > doing a search, but I can't compile it, I get Error: Illegal qualifier on > the line Do you want an array of pointers (objects

Re: [fpc-pascal] TFPObjectlist example

2020-09-08 Thread James Richters via fpc-pascal
What’s the difference between TList and TFPGList? Which one is better for this example? James From: fpc-pascal On Behalf Of Vojtech Cihák via fpc-pascal Sent: Tuesday, September 8, 2020 10:29 AM To: FPC-Pascal users discussions Cc: Vojtěch Čihák Subject: Re: [fpc-pascal] TFPObjectlist

Re: [fpc-pascal] How to build for arm6 in RaspberryPi on arm7?

2020-09-08 Thread Jonas Maebe via fpc-pascal
On 08/09/2020 16:13, Bo Berglund via fpc-pascal wrote: > This happened also after I ran a Run/CleanUpAndBuild operation, so > clearly there is something I am missing here. Is your FPC installation itself also built for ARMv6? (rtl and packages) Jonas

Re: [fpc-pascal] Help with TList example

2020-09-08 Thread James Richters via fpc-pascal
Thank you for the help, I'll give it a try! James -Original Message- From: fpc-pascal On Behalf Of Jean SUZINEAU via fpc-pascal Sent: Tuesday, September 8, 2020 8:47 AM To: fpc-pascal@lists.freepascal.org Cc: Jean SUZINEAU Subject: Re: [fpc-pascal] Help with TList example Another way

Re: [fpc-pascal] Ethernet Relays

2020-09-08 Thread Michael Van Canneyt via fpc-pascal
On Tue, 8 Sep 2020, James Richters via fpc-pascal wrote: Yes 10 was too short, I made it larger and larger until it worked. 1000 was the lowest value that worked so I set it to 2000, that's still quite a bit faster than the default. If I make a mistake in the link but the server IP

Re: [fpc-pascal] Ethernet Relays

2020-09-08 Thread James Richters via fpc-pascal
Yes 10 was too short, I made it larger and larger until it worked. 1000 was the lowest value that worked so I set it to 2000, that's still quite a bit faster than the default. If I make a mistake in the link but the server IP address is correct, I get a valid connection but then it fails and

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

2020-09-08 Thread Brian via fpc-pascal
>Bo, > >Most of the users on this forum have never interfaced with hardware , as you >can see from the responses. Those who have interfaced with hardware have >developed circular buffers which they know work , and they reuse them again >and again. I did this about 10 years ago when working on a

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

2020-09-08 Thread Jonas Maebe via fpc-pascal
On 07/09/2020 08:51, LacaK via fpc-pascal wrote: > attached simple Lazarus compilable project (one Form). > > ... > type >   String1250 = type AnsiString(1250); > > const >   c2: AnsiString = 'áéíóčž'; >   c3: WideString = 'áéíóčž'; >   c4: String1250 = 'áéíóčž'; > > { TForm1 } > > procedure

Re: [fpc-pascal] How to build for arm6 in RaspberryPi on arm7?

2020-09-08 Thread Bo Berglund via fpc-pascal
On Tue, 8 Sep 2020 20:09:53 +0200, Jonas Maebe via fpc-pascal wrote: >On 08/09/2020 16:13, Bo Berglund via fpc-pascal wrote: >> This happened also after I ran a Run/CleanUpAndBuild operation, so >> clearly there is something I am missing here. > >Is your FPC installation itself also built for

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

2020-09-08 Thread vmst--- 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

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

2020-09-08 Thread Sven Barth via fpc-pascal
Mattias Gaertner via fpc-pascal schrieb am Di., 8. Sep. 2020, 22:32: > On Tue, 8 Sep 2020 20:27:20 +0200 > Jonas Maebe via fpc-pascal wrote: > > > On 07/09/2020 08:51, LacaK via fpc-pascal wrote: > > > > > attached simple Lazarus compilable project (one Form). > > > > > > ... > > > type > > >

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

2020-09-08 Thread Mattias Gaertner via fpc-pascal
On Tue, 8 Sep 2020 20:27:20 +0200 Jonas Maebe via fpc-pascal wrote: > On 07/09/2020 08:51, LacaK via fpc-pascal wrote: > > > attached simple Lazarus compilable project (one Form). > > > > ... > > type > >   String1250 = type AnsiString(1250); > > > > const > >   c2: AnsiString = 'áéíóčž'; > >

Re: [fpc-pascal] TFPObjectlist example

2020-09-08 Thread Sven Barth via fpc-pascal
James Richters via fpc-pascal schrieb am Di., 8. Sep. 2020, 20:07: > What’s the difference between TList and TFPGList? Which one is better > for this example? > The main difference is that TFPGList ist a generic, thus when you specialize it with your record you'll have a typesafe object where