[Lazarus] Generics diffence between Lazarus and Delphi Berlin
I have found some interesting working Generics construct. I want to translate this code to Lazarus, but there are Generics often used. In Delphi Berlin the following ist working, the inner array of Integer is normally 6 integer long, but once 7 integer and can filled in such way. Is it possible to do something similar in Lazarus ? Or how can i rewrite this to to the same in Lazarus/FPC Andreas var CODE_PATTERNS: TArray>; CODE_PATTERNS := [[2, 1, 2, 2, 2, 2], // 0 [2, 2, 2, 1, 2, 2], [2, 2, 2, 2, 2, 1], [1, 2, 1, 2, 2, 3], [1, 2, 1, 3, 2, 2], [1, 3, 1, 2, 2, 2], // 5 [1, 2, 2, 2, 1, 3], [1, 2, 2, 3, 1, 2], [1, 3, 2, 2, 1, 2], [2, 2, 1, 2, 1, 3], [2, 2, 1, 3, 1, 2], // 10 [2, 3, 1, 2, 1, 2], [1, 1, 2, 2, 3, 2], [1, 2, 2, 1, 3, 2], [1, 2, 2, 2, 3, 1], [1, 1, 3, 2, 2, 2], // 15 [1, 2, 3, 1, 2, 2], [1, 2, 3, 2, 2, 1], [2, 2, 3, 2, 1, 1], [2, 2, 1, 1, 3, 2], [2, 2, 1, 2, 3, 1], // 20 [2, 1, 3, 2, 1, 2], [2, 2, 3, 1, 1, 2], [3, 1, 2, 1, 3, 1], [3, 1, 1, 2, 2, 2], [3, 2, 1, 1, 2, 2], // 25 [3, 2, 1, 2, 2, 1], [3, 1, 2, 2, 1, 2], [3, 2, 2, 1, 1, 2], [3, 2, 2, 2, 1, 1], [2, 1, 2, 1, 2, 3], // 30 [2, 1, 2, 3, 2, 1], [2, 3, 2, 1, 2, 1], [1, 1, 1, 3, 2, 3], [1, 3, 1, 1, 2, 3], [1, 3, 1, 3, 2, 1], // 35 [1, 1, 2, 3, 1, 3], [1, 3, 2, 1, 1, 3], [1, 3, 2, 3, 1, 1], [2, 1, 1, 3, 1, 3], [2, 3, 1, 1, 1, 3], // 40 [2, 3, 1, 3, 1, 1], [1, 1, 2, 1, 3, 3], [1, 1, 2, 3, 3, 1], [1, 3, 2, 1, 3, 1], [1, 1, 3, 1, 2, 3], // 45 [1, 1, 3, 3, 2, 1], [1, 3, 3, 1, 2, 1], [3, 1, 3, 1, 2, 1], [2, 1, 1, 3, 3, 1], [2, 3, 1, 1, 3, 1], // 50 [2, 1, 3, 1, 1, 3], [2, 1, 3, 3, 1, 1], [2, 1, 3, 1, 3, 1], [3, 1, 1, 1, 2, 3], [3, 1, 1, 3, 2, 1], // 55 [3, 3, 1, 1, 2, 1], [3, 1, 2, 1, 1, 3], [3, 1, 2, 3, 1, 1], [3, 3, 2, 1, 1, 1], [3, 1, 4, 1, 1, 1], // 60 [2, 2, 1, 4, 1, 1], [4, 3, 1, 1, 1, 1], [1, 1, 1, 2, 2, 4], [1, 1, 1, 4, 2, 2], [1, 2, 1, 1, 2, 4], // 65 [1, 2, 1, 4, 2, 1], [1, 4, 1, 1, 2, 2], [1, 4, 1, 2, 2, 1], [1, 1, 2, 2, 1, 4], [1, 1, 2, 4, 1, 2], // 70 [1, 2, 2, 1, 1, 4], [1, 2, 2, 4, 1, 1], [1, 4, 2, 1, 1, 2], [1, 4, 2, 2, 1, 1], [2, 4, 1, 2, 1, 1], // 75 [2, 2, 1, 1, 1, 4], [4, 1, 3, 1, 1, 1], [2, 4, 1, 1, 1, 2], [1, 3, 4, 1, 1, 1], [1, 1, 1, 2, 4, 2], // 80 [1, 2, 1, 1, 4, 2], [1, 2, 1, 2, 4, 1], [1, 1, 4, 2, 1, 2], [1, 2, 4, 1, 1, 2], [1, 2, 4, 2, 1, 1], // 85 [4, 1, 1, 2, 1, 2], [4, 2, 1, 1, 1, 2], [4, 2, 1, 2, 1, 1], [2, 1, 2, 1, 4, 1], [2, 1, 4, 1, 2, 1], // 90 [4, 1, 2, 1, 2, 1], [1, 1, 1, 1, 4, 3], [1, 1, 1, 3, 4, 1], [1, 3, 1, 1, 4, 1], [1, 1, 4, 1, 1, 3], // 95 [1, 1, 4, 3, 1, 1], [4, 1, 1, 1, 1, 3], [4, 1, 1, 3, 1, 1], [1, 1, 3, 1, 4, 1], [1, 1, 4, 1, 3, 1], // 100 [3, 1, 1, 1, 4, 1], [4, 1, 1, 1, 3, 1], [2, 1, 1, 4, 1, 2], [2, 1, 1, 2, 1, 4], [2, 1, 1, 2, 3, 2], // 105 [2, 3, 3, 1, 1, 1, 2]]; -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] Jedi Code Formatter (JCF) issues
Hi, Is there an actual JCF (included with Lazarus) maintainer? I've recently been using it quite a bit and noticed a couple of problems. I'll obviously try and fix them myself (free time is very limited, but I'll try my best). The two most important ones for me: * Some code formatting is not applied (ignored) based on configuration settings. * Some configuration changes are not persisted, so user defined options can't actually be applied in the code formatting. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Animation library
El 27/02/2017 a las 22:52, Michael Van Canneyt via Lazarus escribió: published code its value is 1, but it should be 15, but in Windows difference between 15 and 1 is zero, in Linux you can set timers with 1 ms. precision which is terrible overkill). I put it on 30, but as with Graeme, the CPU goes to well over 100% (2 cores are involved in the process, or so it seems) Hello, I'll investigate a bit why in Windows it takes low CPU usage but in Linux it overload CPU, maybe too much FPS or the Linux LCL behavior should be handled in a bit different way. Thank you for your tests. -- -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Animation library
El 27/02/2017 a las 23:49, Mattias Gaertner via Lazarus escribió: Instead of Repaint it should use Invalidate. Hello, Invalidate queues a paint but repaint calls an inmediate repaint do not? In other words, in Windows world Invalidate uses PostMessage and Repaint uses SendMessage, or am I wrong ? And when changing multiple LCL properties, you should enclose it in DisableAutoSizing/EnableAutoSizing. DisableAlign; AnimationQueue.PaintAll; EnableAlign; Yes, I forgot to disable the autoaling, this for sure will reduce CPU when many controls are being moved at a time, thank you. This confirms that the lib is not ready to be used :-) -- -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Animation library
On Tue, 28 Feb 2017 13:16:57 +0100 José Mejuto via Lazarus wrote: > El 27/02/2017 a las 23:49, Mattias Gaertner via Lazarus escribió: > > > Instead of Repaint it should use Invalidate. > > Hello, > > Invalidate queues a paint but repaint calls an inmediate repaint do not? Yes. The widgetset can combine multiple invalidates to one paint, avoiding congestion. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Generics diffence between Lazarus and Delphi Berlin
Am 28.02.2017 09:37 schrieb "Andreas Frieß via Lazarus" < lazarus@lists.lazarus-ide.org>: > > I have found some interesting working Generics construct. I want to translate this code to Lazarus, but there are Generics often used. > In Delphi Berlin the following ist working, the inner array of Integer is normally 6 integer long, but once 7 integer and can filled in such way. Is it possible to do something similar in Lazarus ? Or how can i rewrite this to to the same in Lazarus/FPC That has nothing to do with generics, but with array initializers, which FPC currently doesn't support. You can work around this by explicitly declaring the types and then using .Create(). === code begin === type TInnerArray = TArray; TOuterArray = TArray; var CODE_PATTERNS: TOuterArray; begin CODE_PATTERN := TOuterArray.Create( TInnerArray.Create(2, 1, 2, 2, 2, 2), TInnerArray.Create(2, 2, 2, 1, 2, 2), TInnerArray.Create(2, 2, 2, 2, 2, 1), TInnerArray.Create(1, 2, 1, 2, 2, 3), ... ); end. === code end === While this looks quite verbose it should also work with Delphi. (In theory TArray.Create() and TArray>.Create() directly should work as well, but I think FPC's parser still barfs on that) Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] Lazarus on Raspberry Pi 3
I'm using Lazarus on a Raspberry Pi 3. I have tested a few ways to get it working but the best one seems to be Bo Berglund's script and starting compiler. (Thanks) I had just one problem with it: an error would occur when the new fpc is being installed and I had to change line 150 from make install OPT="$OPTIONS" PREFIX=/home/pi || error_exit "$LINENO: Cannot make install! Aborting" to make install FPC="$FPCDIR/ppcarm" OPT="$OPTIONS" PREFIX=/home/pi || error_exit "$LINENO: Cannot make install! Aborting" Apparently, this line still needs FPC="$FPCDIR/ppcarm" I'm using Raspbian version 8.0 Linux raspberrypi 4.4.38-v7+ Paulo Costa -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] GUI freeze under GTK2
28.02.2017, 12:31, "Juha Manninen" : > I tested it and could not see any problems. Everything works as > before. However I don't know how to reproduce the original bug. > The removed line may be needed for old GTK2 versions or for GTK1. > The LCL-GTK2 binding code was copied from LCL-GTK1 and has many > historical remains. > I applied the change in r54305. > Everybody please test with different GTK2 versions and desktop environments. Thanks. -- Regards, Denis Golovan -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] $IF for Linux and FreeBSD platforms?
On 2017-02-16 05:35, Graeme Geldenhuys via Lazarus wrote: On 2017-02-16 11:18, Ondrej Pokorny via Lazarus wrote: Well, you mixed up DEFINED and DECLARED macros. Sorry newbie question regarding these $IF directives: can someone explain why you would use "$IF defined" instead of $IFDEF... Obviously there are likely reasons for using one over the other. Dope!!! Thanks for spotting that. I need more coffee. ;-) Coffee being used as a crutch is bad. Use it for an extra burst, not as an hourly/daily reliance. IMHO Or IMAO A := 'arrogant'; -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] $IF for Linux and FreeBSD platforms?
On 2017-02-28 19:37, Lars via Lazarus wrote: > can someone explain why you would use "$IF defined" instead of $IFDEF... In that case a piece of code applied to both Linux and FreeBSD platforms. I didn't see the need to duplicate the code with IFDEF statements - thus making code management more work. So use "$IF defined" to accept more that one define for a block of code. >> Dope!!! Thanks for spotting that. I need more coffee. ;-) > > Coffee being used as a crutch is bad. Use it for an extra burst, not as > an hourly/daily reliance. I live on coffee and Red Bull at the moment. Trying to survive lots of sleepless nights due to a little human teething! :-( Or how does the other saying go: Computer Programmer: We convert coffee and pizza into source code. :-) Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] $IF for Linux and FreeBSD platforms?
Am 28.02.2017 20:37 schrieb "Lars via Lazarus" < lazarus@lists.lazarus-ide.org>: > > On 2017-02-16 05:35, Graeme Geldenhuys via Lazarus wrote: >> >> On 2017-02-16 11:18, Ondrej Pokorny via Lazarus wrote: >>> >>> Well, you mixed up DEFINED and DECLARED macros. >> >> > > Sorry newbie question regarding these $IF directives: > > can someone explain why you would use "$IF defined" instead of $IFDEF... > > Obviously there are likely reasons for using one over the other. $IFDEF FOO is an abbreviation for $IF DEFINED(FOO). The latter also allows to combine multiple checks using AND and OR (and also allowing comparisons with constant values) while the former can always only check for a single define. Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Lazarus on Raspberry Pi 3
On Tue, 28 Feb 2017 16:34:45 +, Paulo Costa via Lazarus wrote: >I'm using Lazarus on a Raspberry Pi 3. >I have tested a few ways to get it working but the best one seems to be >Bo Berglund's script and starting compiler. (Thanks) > >I had just one problem with it: >an error would occur when the new fpc is being installed and I had to >change line 150 from > >make install OPT="$OPTIONS" PREFIX=/home/pi || error_exit "$LINENO: >Cannot make install! Aborting" > >to > >make install FPC="$FPCDIR/ppcarm" OPT="$OPTIONS" PREFIX=/home/pi || >error_exit "$LINENO: Cannot make install! Aborting" > >Apparently, this line still needs FPC="$FPCDIR/ppcarm" Hmmm, I thought that the previous lines created the new FPC compiler, which we want to install. The added FPC="$FPCDIR/ppcarm" will use the seed compiler rather than the one created by the previous make as far as I understand and that is not what we want. For others below are the affected lines (with the error exception code removed). Note that the seed compiler is located at "$FPCDIR/ppcarm" and the cd command moves to the top of the checked out FPC code by version number. echo "--- Building fpc and lazarus " echo "Building and installing version $FPCVER of FPC" cd "$FPCDIR/$FPCVER" make clean make all FPC="$FPCDIR/ppcarm" OPT="$OPTIONS" make install OPT="$OPTIONS" PREFIX=/home/pi So what will be the difference when using the above compared to: make install FPC="$FPCDIR/ppcarm" OPT="$OPTIONS" PREFIX=/home/pi I will have to make a test next time I have a blank RPi3 to install on. That could happen with FPC 3.0.2 now being released. > >I'm using Raspbian version 8.0 >Linux raspberrypi 4.4.38-v7+ What command(s) gives you this information? -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Lazarus on Raspberry Pi 3
On 28-Feb-17 22:53, Bo Berglund via Lazarus wrote: ... I'm using Raspbian version 8.0 Linux raspberrypi 4.4.38-v7+ What command(s) gives you this information? cat /etc/debian_version "8.0" uname -a "Linux raspberrypi 4.4.38-v7+ ", plus other things. Paulo Costa -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Lazarus on Raspberry Pi 3
On 28-Feb-17 22:53, Bo Berglund via Lazarus wrote: Hmmm, I thought that the previous lines created the new FPC compiler, which we want to install. The added FPC="$FPCDIR/ppcarm" will use the seed compiler rather than the one created by the previous make as far as I understand and that is not what we want. The error that I've got was something like: make: -iVSPTPSOTO: Command not found Searching for that error, I found that it means that fpc is not yet installed (of course, the make install command meant to do that) I figured that, without any compiler in the path, "make install" needed to know where the starting compiler was like "make all" also needed... It seems to work: fpc -i gives me the date of when I compiled it: 2017/01/27 while the downloaded ppcarm: ./ppcarm -i gives 2016/03/05 Paulo Costa -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Lazarus on Raspberry Pi 3
On Tue, 28 Feb 2017 23:06:33 +, Paulo Costa via Lazarus wrote: >On 28-Feb-17 22:53, Bo Berglund via Lazarus wrote: > >... > >>> I'm using Raspbian version 8.0 >>> Linux raspberrypi 4.4.38-v7+ >> >> What command(s) gives you this information? > >cat /etc/debian_version >"8.0" > >uname -a >"Linux raspberrypi 4.4.38-v7+ ", plus other things. > Thanks, this is what I have: pi@rpi3-jessie:~ $ cat /etc/debian_version 8.0 pi@rpi3-jessie:~ $ uname -a Linux rpi3-jessie 4.4.13-v7+ #894 SMP Mon Jun 13 13:13:27 BST 2016 armv7l GNU/Linux -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus