Re: [fpc-pascal] Catalina upgrade changes
On 10/10/2019 8:46 am, C Western wrote: > Actually, thanks for posting this here - it did contain generally useful > information. +1 Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] TThreadedQueue like in Delphi?
Hi I want to make some open source project for Laz, and need the thread-safe queue for it. So this Delphi class is Ok, but FPC 3.3 r42919 misses it in Generics.Collections: http://docwiki.embarcadero.com/Libraries/Rio/en/System.Generics.Collections.TThreadedQueue Can you please add it? Is it hard to do? TIA. -- Regards, Alexey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] fcl-passrc errors
More tests with the parser but it seems like it doesn’t know quite a bit of syntax. Are these not implemented yet? 1) class operators for records EParserError: Expected "procedure" at token "operator" in file /Users/ryanjoseph/Developer/Projects/FPC/GLCanvas/GLCanvas.pas at line 115 column 7 class operator TVertex3.= (constref a, b: TVertex3): boolean; begin result := (@a = @b); end; 2) For..in loops EParserError: Expected := or in at token "(" in file /Users/ryanjoseph/Developer/Projects/FPC/NewEngine/Sources/Examples/EmptyWindow.pas at line 138 column 14 for pointer(entity) in entities do begin entity.Update; entity.Draw(renderer); renderer.PushBox(entity.GetHitBox, TRGBA.RedColor); end; 3) {$i settings} will not find the file “settings.inc”. This is valid in FPC but the parser seems to have other rules. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-passrc errors
On Sat, 12 Oct 2019, Ryan Joseph wrote: More tests with the parser but it seems like it doesn’t know quite a bit of syntax. Are these not implemented yet? 1) class operators for records EParserError: Expected "procedure" at token "operator" in file /Users/ryanjoseph/Developer/Projects/FPC/GLCanvas/GLCanvas.pas at line 115 column 7 class operator TVertex3.= (constref a, b: TVertex3): boolean; begin result := (@a = @b); end; This can be. 2) For..in loops EParserError: Expected := or in at token "(" in file /Users/ryanjoseph/Developer/Projects/FPC/NewEngine/Sources/Examples/EmptyWindow.pas at line 138 column 14 For in loops should be supported, but I've never seen this before: for pointer(entity) in entities do What is for pointer(entity) in entities supposed to do ? It can be that this syntax is not supported (no surprise, since I don't have a clue what this is supposed to do). begin entity.Update; entity.Draw(renderer); renderer.PushBox(entity.GetHitBox, TRGBA.RedColor); end; 3) {$i settings} will not find the file “settings.inc”. This is valid in FPC but the parser seems to have other rules. They should be the same. As said, pas2js uses fcl-passrc, and pas2js handles inifiles just as FPC does. You must provide valid include path and file resolvers, of course. Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-passrc errors
On Oct 12, 2019, at 6:43 PM, Michael Van Canneyt wrote:1) class operators for recordsEParserError: Expected "procedure" at token "operator" in file /Users/ryanjoseph/Developer/Projects/FPC/GLCanvas/GLCanvas.pas at line 115 column 7class operator TVertex3.= (constref a, b: TVertex3): boolean;beginresult := (@a = @b);end;This can be.It’s a bug then? I found another advanced record bug below.2) For..in loopsEParserError: Expected := or in at token "(" in file /Users/ryanjoseph/Developer/Projects/FPC/NewEngine/Sources/Examples/EmptyWindow.pas at line 138 column 14For in loops should be supported, but I've never seen this before:for pointer(entity) in entities doWhat is for pointer(entity) in entities supposed to do ?It can be that this syntax is not supported (no surprise, since I don't havea clue what this is supposed to do).Just type casting because the array is an array of pointers. I get these errors otherwise "Incompatible types: got "Pointer" expected “TEntity"”. I could use a proper type in a generic array but I don’t always do that. I actually just posted to the list about this earlier. begin entity.Update; entity.Draw(renderer); renderer.PushBox(entity.GetHitBox, TRGBA.RedColor); end;3) {$i settings} will not find the file “settings.inc”. This is valid in FPC but the parser seems to have other rules.They should be the same.As said, pas2js uses fcl-passrc, and pas2js handles inifiles just as FPCdoes.Another bug then. Should I make a bug report for these?Here’s another one I found. No section headers in records?Expected "," or ":" at token "Identifier IDSize" in file /Users/ryanjoseph/Developer/Projects/FPC/NewEngine/Sources/Base/UImage.pas at line 94 column 4 TGAHeader = packed record private IDSize: uint8_t; // Size of ID info following header colorMapType: uint8_t; // Whether this is a paletted image imageType: uint8_t; // type of image 0=none, 1=indexed, 2=rgb, 3=grey, +8=rle packedRegards, Ryan Joseph___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-passrc errors
On Sat, 12 Oct 2019, Ryan Joseph wrote: On Oct 12, 2019, at 6:43 PM, Michael Van Canneyt wrote: 1) class operators for records EParserError: Expected "procedure" at token "operator" in file /Users/ryanjoseph/Developer/Projects/FPC/GLCanvas/GLCanvas.pas at line 115 column 7 class operator TVertex3.= (constref a, b: TVertex3): boolean; begin result := (@a = @b); end; This can be. It’s a bug then? I found another advanced record bug below. It's a little early to conclude this. The code supports class operators. But see below. 2) For..in loops EParserError: Expected := or in at token "(" in file /Users/ryanjoseph/Developer/Projects/FPC/NewEngine/Sources/Examples/EmptyWindow.pas at line 138 column 14 For in loops should be supported, but I've never seen this before: for pointer(entity) in entities do What is for pointer(entity) in entities supposed to do ? It can be that this syntax is not supported (no surprise, since I don't have a clue what this is supposed to do). Just type casting because the array is an array of pointers. I get these errors otherwise "Incompatible types: got "Pointer" expected “TEntity"”. I could use a proper type in a generic array but I don’t always do that. I didn't know you could do this in a for in loop. FPC eats this ? begin entity.Update; entity.Draw(renderer); renderer.PushBox(entity.GetHitBox, TRGBA.RedColor); end; 3) {$i settings} will not find the file “settings.inc”. This is valid in FPC but the parser seems to have other rules. They should be the same. As said, pas2js uses fcl-passrc, and pas2js handles inifiles just as FPC does. Another bug then. Should I make a bug report for these? Not yet. I have no idea how you call the parser. Include files most definitely work: the documentation generator uses fcl-passrc, and the RTL/FCL is full of include files. Probably your invocation of the parser is simply wrong or missing some arguments. Here’s another one I found. No section headers in records? Expected "," or ":" at token "Identifier IDSize" in file /Users/ryanjoseph/Developer/Projects/FPC/NewEngine/Sources/Base/UImage.pas at line 94 column 4 Again, that works. These constructs can be found in the RTL/FCL and the documentation generator parses that (and so does pas2js). Disregarding the typecast in the for..in, concluding that there are bugs is very premature. All constructs you mention are supported. So the question is why you are getting errors for constructs that are supported ? Did you specify the advanced record modeswitch in the sources ? Do you specify delphi mode when calling the parser ? But the parser must be invoked correctly. If you don't invoke it correctly, then of course you can expect it to report errors. If you use the default 'ParseSource' function, that definitely does not cover all possible cases as handled by FPC. It will not observe whatever you have in .fpc.cfg or /etc/fpc.cfg etc. Also, are you using trunk or 3.0.4 ? There have been a massive amount of updates to fcl-passrc. Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal