From mailinglists at geldenhuys.co.uk Thu Aug 1 00:54:23 2019 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Wed, 31 Jul 2019 23:54:23 +0100 Subject: [Lazarus] A SQL Explorer Program. Suggestions? In-Reply-To: References: Message-ID: <85350127-2772-396b-fae2-54f2b9b42f09@geldenhuys.co.uk> Hi Anthony, On 24/07/2019 12:22 pm, Michael Van Canneyt via lazarus wrote: > The Lazarus data desktop comes standard with lazarus, has all these features and more. > (see lazarus/tools/lazdatadesktop/ 'lazdesktop' is a good choice. To have a more complete list, there are a few others too. ;-) * tiSQLEditor which is a child project of tiOPF https://github.com/graemeg/tiopf https://github.com/graemeg/tiopf_apps * FenixSQL which is a support app included with firebird-lib (previously known as FBLib) https://github.com/graemeg/firebird-lib I'm sure there must be more, but these are the 3 I know about. 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 From bo.berglund at gmail.com Thu Aug 1 08:44:37 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Thu, 01 Aug 2019 08:44:37 +0200 Subject: [Lazarus] How can I see what has changed in my project? Message-ID: <4t15ke19tfhu0gbh24tkpitbmu41gmqc3i@4ax.com> I have Lazarus 2.0.2 from 2019-04-13 x86_64-win64-win32/win64 (from help/about) on a Windows 7 x64 laptop. I have opened a project I worked on a few weeks ago in order to check some implementation detail, then left it sitting untouched for a few days. As far as I can recall there was no changes made in this session. But now Lazarus shows that the FormMain unit (with the main form) has changed (an * before the name onthe tab and the save buttons enabled). How can I find out what Lazarus thinks has changed???? I believe nothing was changed, but still Lazarus signals a change. I have scrolled the source and there is no indication in the left edge of any change. I don't want to save an unknown change but if I just forgot what it was I also do not want to lose a bona-fide edit. All files on disk are dated July 5 or older. -- Bo Berglund Developer in Sweden From nc-gaertnma at netcologne.de Thu Aug 1 09:30:38 2019 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Thu, 1 Aug 2019 09:30:38 +0200 Subject: [Lazarus] How can I see what has changed in my project? In-Reply-To: <4t15ke19tfhu0gbh24tkpitbmu41gmqc3i@4ax.com> References: <4t15ke19tfhu0gbh24tkpitbmu41gmqc3i@4ax.com> Message-ID: <20190801093038.06c5dcde@limapholos.matflo.wg> On Thu, 01 Aug 2019 08:44:37 +0200 Bo Berglund via lazarus wrote: > I have Lazarus 2.0.2 from 2019-04-13 x86_64-win64-win32/win64 (from > help/about) on a Windows 7 x64 laptop. > > I have opened a project I worked on a few weeks ago in order to check > some implementation detail, then left it sitting untouched for a few > days. As far as I can recall there was no changes made in this > session. > > But now Lazarus shows that the FormMain unit (with the main form) has > changed (an * before the name onthe tab and the save buttons enabled). > > How can I find out what Lazarus thinks has changed???? Maybe here: View / IDE Internals / About IDE / Modified Mattias From bo.berglund at gmail.com Thu Aug 1 10:35:01 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Thu, 01 Aug 2019 10:35:01 +0200 Subject: [Lazarus] How can I see what has changed in my project? References: <4t15ke19tfhu0gbh24tkpitbmu41gmqc3i@4ax.com> <20190801093038.06c5dcde@limapholos.matflo.wg> Message-ID: <0p75ke5a4qk67mrt1cqsejkduvmjl1hqlg@4ax.com> On Thu, 1 Aug 2019 09:30:38 +0200, Mattias Gaertner via lazarus wrote: >> How can I find out what Lazarus thinks has changed???? > >Maybe here: >View / IDE Internals / About IDE / Modified > Thanks, I went there and this is what the pane showed: ------------------------ Project.SomethingModified Data Project.SomethingModified Session SourceEditorManager.SomethingModified Project units: formmain.pas Modified SessionModified formpasswd.pas SessionModified Source Editor: D:\Engineering\Projects\Subversion\Bosse\VideoPlayer\formmain.pas Component=False ------------------------ What does this mean? THere is no reference to a source line... I probably will make a svn commit before closing the Lazarus IDE and see what files get changed that are part of the svn project. -- Bo Berglund Developer in Sweden From nc-gaertnma at netcologne.de Thu Aug 1 10:58:28 2019 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Thu, 1 Aug 2019 10:58:28 +0200 Subject: [Lazarus] How can I see what has changed in my project? In-Reply-To: <0p75ke5a4qk67mrt1cqsejkduvmjl1hqlg@4ax.com> References: <4t15ke19tfhu0gbh24tkpitbmu41gmqc3i@4ax.com> <20190801093038.06c5dcde@limapholos.matflo.wg> <0p75ke5a4qk67mrt1cqsejkduvmjl1hqlg@4ax.com> Message-ID: <20190801105828.7b7ad98f@limapholos.matflo.wg> On Thu, 01 Aug 2019 10:35:01 +0200 Bo Berglund via lazarus wrote: > On Thu, 1 Aug 2019 09:30:38 +0200, Mattias Gaertner via lazarus > wrote: > > >> How can I find out what Lazarus thinks has changed???? > > > >Maybe here: > >View / IDE Internals / About IDE / Modified > > > > Thanks, > I went there and this is what the pane showed: > > ------------------------ > Project.SomethingModified Data > Project.SomethingModified Session > SourceEditorManager.SomethingModified > > Project units: > formmain.pas Modified SessionModified > formpasswd.pas SessionModified > > Source Editor: > D:\Engineering\Projects\Subversion\Bosse\VideoPlayer\formmain.pas > Component=False > ------------------------ > > What does this mean? "Session" are things like bookmarks and cursor positions. You can probably ignore that. "Component=false" means there is no designer form loaded "formmain.pas Modified" means something in formmain.pas was modified. Check for any yellow line markers in the source editor indicating an edit. Otherwise you may have changed the encoding, or you use some third party package that stores some data for this unit. > THere is no reference to a source line... > > I probably will make a svn commit before closing the Lazarus IDE and > see what files get changed that are part of the svn project. Good idea. Mattias From aurimenes at gmail.com Thu Aug 1 13:23:05 2019 From: aurimenes at gmail.com (Aurimenes Apolonio) Date: Thu, 1 Aug 2019 08:23:05 -0300 Subject: [Lazarus] How can I see what has changed in my project? In-Reply-To: <4t15ke19tfhu0gbh24tkpitbmu41gmqc3i@4ax.com> References: <4t15ke19tfhu0gbh24tkpitbmu41gmqc3i@4ax.com> Message-ID: You may not have made any changes in your source code. If you just open any saved form and move it (by dragging its title bar and droping elsewhere), the * will be added to the form's name tab, because you changed something: the form position. The same will happen if you move some non-visual components in the form. You could try this: Go to your folder, select both .pas and .lfm files and copy/paste them. Then go back to Lazaurs, save the "changed" file and compare them using some merging tool like Winmerge. *Aurimenes Apolônio Silva* Desenvolvedor de Software Fones: (81) 99935-9066 / 4101-5689 Em qui, 1 de ago de 2019 às 03:44, Bo Berglund via lazarus < lazarus at lists.lazarus-ide.org> escreveu: > I have Lazarus 2.0.2 from 2019-04-13 x86_64-win64-win32/win64 (from > help/about) on a Windows 7 x64 laptop. > > I have opened a project I worked on a few weeks ago in order to check > some implementation detail, then left it sitting untouched for a few > days. As far as I can recall there was no changes made in this > session. > > But now Lazarus shows that the FormMain unit (with the main form) has > changed (an * before the name onthe tab and the save buttons enabled). > > How can I find out what Lazarus thinks has changed???? > > I believe nothing was changed, but still Lazarus signals a change. > I have scrolled the source and there is no indication in the left edge > of any change. > > I don't want to save an unknown change but if I just forgot what it > was I also do not want to lose a bona-fide edit. > All files on disk are dated July 5 or older. > > > -- > Bo Berglund > Developer in Sweden > > -- > _______________________________________________ > lazarus mailing list > lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bo.berglund at gmail.com Thu Aug 1 13:28:11 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Thu, 01 Aug 2019 13:28:11 +0200 Subject: [Lazarus] How can I see what has changed in my project? References: <4t15ke19tfhu0gbh24tkpitbmu41gmqc3i@4ax.com> <20190801093038.06c5dcde@limapholos.matflo.wg> <0p75ke5a4qk67mrt1cqsejkduvmjl1hqlg@4ax.com> <20190801105828.7b7ad98f@limapholos.matflo.wg> Message-ID: <1ti5kel8kdg6oj8q9iv35qg6t8icfd3stu@4ax.com> On Thu, 1 Aug 2019 10:58:28 +0200, Mattias Gaertner via lazarus wrote: >> What does this mean? > >"formmain.pas Modified" means something in formmain.pas was modified. > >Check for any yellow line markers in the source editor indicating an >edit. It turns out that the formmain.lfm file had many changes, but it is not really viewable easily. I made a compare against the previous revision and lots of component size/position values had changed as well as the Lazarus version... In the meantime I had gone from Lazarus 2.0.0 to 2.0.2 and switched from Lazarus 32 bit to 64 bit. That might have changed something invisibly in the background... > >> THere is no reference to a source line... >> >> I probably will make a svn commit before closing the Lazarus IDE and >> see what files get changed that are part of the svn project. > >Good idea. Worked fine, I think I am OK now. -- Bo Berglund Developer in Sweden From md at delfire.net Thu Aug 1 14:32:12 2019 From: md at delfire.net (Marcos Douglas B. Santos) Date: Thu, 1 Aug 2019 09:32:12 -0300 Subject: [Lazarus] A SQL Explorer Program. Suggestions? In-Reply-To: References: Message-ID: On Wed, Jul 24, 2019 at 8:19 AM Anthony Walter via lazarus wrote: > > I am looking for a good SQL Explorer tool that I can build using Lazarus. Does anyone have any options on what's already available? Another one: https://github.com/synopse/mORMot/tree/master/SQLite3/Samples/12%20-%20SynDB%20Explorer regards, Marcos Douglas From strickland.danny at protonmail.com Thu Aug 1 16:32:29 2019 From: strickland.danny at protonmail.com (strickland.danny) Date: Thu, 01 Aug 2019 14:32:29 +0000 Subject: [Lazarus] Trouble creating a Lazarus Forum Account In-Reply-To: <7d1f879c-f212-016d-78e6-7a8d1d84300d@pascalprogramming.org> References: <7d1f879c-f212-016d-78e6-7a8d1d84300d@pascalprogramming.org> Message-ID: It was an issue with signing up for a forum account. This was an equation to solve to make sure i was not a bot. The email domain I was using, protonmail, had been blocked by the admins. It's fixed now. Thanks! Sent with ProtonMail Secure Email. ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Tuesday, July 30, 2019 5:10 PM, Marco van de Voort via lazarus wrote: > Op 2019-07-30 om 19:52 schreef strickland.danny via lazarus: > > > to 1+2=    it errors out and says I was rejected for spamming.  I > > tried spelling 3 with Three and three.  But nothing works.  Is this a > > bug or am I doing something wrong? > > Are you sure it is 1+2 and not '1'+'2' which would be a string > concatenation rather than an addition? > > ------------------------------------------------------------------------------------------------------ > > lazarus mailing list > lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus From aaa5500 at ya.ru Fri Aug 2 21:18:39 2019 From: aaa5500 at ya.ru (AlexeyT) Date: Fri, 2 Aug 2019 22:18:39 +0300 Subject: [Lazarus] Maybe it's TreeView hi-dpi bug on Linux? Message-ID: <16618b10-fcbd-cf84-e56c-36244950d409@ya.ru> Hi https://github.com/Alexey-T/CudaText/files/3438082/cudatext_hidpi.zip This is video with bug of CudaText on Linux on hi-dpi. Details: https://github.com/Alexey-T/CudaText/issues/2099 On video you see some gray "panel entity" on the bottom of TreeView (ie Snippet Panel plugin of CudaText). I cannot test hi-dpi on Linux. I cannot repro this on Win10. Any ideas? Maybe Treeview has some internal panel which is scaled badly? -- Regards, Alexey From werner.pamler at freenet.de Fri Aug 2 23:00:50 2019 From: werner.pamler at freenet.de (Werner Pamler) Date: Fri, 2 Aug 2019 23:00:50 +0200 Subject: [Lazarus] wiki image update error Message-ID: Trying to replace some outdated images in the wiki by newer versions I noticed a crash of the wiki software: My actions: * Click on image in wiki article to be replaced * Click "Upload a new version of this file" * "Source file name" / "Browse" - navigate to new file on HD * Add description to box "File changes" * Click "Upload file" * This results in the following error message [2db5b40f8e03500988820945] /Special:Upload Wikimedia\Rdbms\DBQueryError from line 1457 of /srv/www/lazaruswiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? Query: RELEASE SAVEPOINT `wikimedia_rdbms_atomic1` Function: LocalFile::recordUpload2 Error: 1305 SAVEPOINT wikimedia_rdbms_atomic1 does not exist (localhost) Backtrace: #0 /srv/www/lazaruswiki/includes/libs/rdbms/database/Database.php(1427): Wikimedia\Rdbms\Database->makeQueryException(string, integer, string, string) #1 /srv/www/lazaruswiki/includes/libs/rdbms/database/Database.php(1200): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean) #2 /srv/www/lazaruswiki/includes/libs/rdbms/database/Database.php(3498): Wikimedia\Rdbms\Database->query(string, string) #3 /srv/www/lazaruswiki/includes/libs/rdbms/database/Database.php(3584): Wikimedia\Rdbms\Database->doReleaseSavepoint(string, string) #4 /srv/www/lazaruswiki/includes/libs/rdbms/database/Database.php(2953): Wikimedia\Rdbms\Database->endAtomic(string) #5 /srv/www/lazaruswiki/includes/libs/rdbms/database/Database.php(2880): Wikimedia\Rdbms\Database->nonNativeInsertSelect(string, array, array, array, string, array, array, array) #6 /srv/www/lazaruswiki/includes/filerepo/file/LocalFile.php(1606): Wikimedia\Rdbms\Database->insertSelect(string, array, array, array, string, array, array, array) #7 /srv/www/lazaruswiki/includes/filerepo/file/LocalFile.php(1364): LocalFile->recordUpload2(string, string, boolean, array, string, User, array) #8 /srv/www/lazaruswiki/includes/upload/UploadBase.php(868): LocalFile->upload(string, string, boolean, integer, array, boolean, User, array) #9 /srv/www/lazaruswiki/includes/specials/SpecialUpload.php(567): UploadBase->performUpload(string, boolean, boolean, User, array) #10 /srv/www/lazaruswiki/includes/specials/SpecialUpload.php(207): SpecialUpload->processUpload() #11 /srv/www/lazaruswiki/includes/specialpage/SpecialPage.php(565): SpecialUpload->execute(NULL) #12 /srv/www/lazaruswiki/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(NULL) #13 /srv/www/lazaruswiki/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext) #14 /srv/www/lazaruswiki/includes/MediaWiki.php(861): MediaWiki->performRequest() #15 /srv/www/lazaruswiki/includes/MediaWiki.php(524): MediaWiki->main() #16 /srv/www/lazaruswiki/index.php(42): MediaWiki->run() #17 {main} -------------- next part -------------- An HTML attachment was scrubbed... URL: From werner.pamler at freenet.de Fri Aug 2 23:07:41 2019 From: werner.pamler at freenet.de (Werner Pamler) Date: Fri, 2 Aug 2019 23:07:41 +0200 Subject: [Lazarus] Maybe it's TreeView hi-dpi bug on Linux? In-Reply-To: <16618b10-fcbd-cf84-e56c-36244950d409@ya.ru> References: <16618b10-fcbd-cf84-e56c-36244950d409@ya.ru> Message-ID: <4eb8ad38-ce9a-c99a-3469-8e6e3b20c7a5@freenet.de> Am 02.08.2019 um 21:18 schrieb AlexeyT via lazarus: > I cannot test hi-dpi on Linux. Why not? Just set the DPI of your system to something higher than 96, maybe 120 or at most 144. Beyond 144dpi there will not be much left on the screen to work on... From aaa5500 at ya.ru Sat Aug 3 13:32:11 2019 From: aaa5500 at ya.ru (Alexey Tor.) Date: Sat, 3 Aug 2019 14:32:11 +0300 Subject: [Lazarus] Maybe it's TreeView hi-dpi bug on Linux? In-Reply-To: <4eb8ad38-ce9a-c99a-3469-8e6e3b20c7a5@freenet.de> References: <16618b10-fcbd-cf84-e56c-36244950d409@ya.ru> <4eb8ad38-ce9a-c99a-3469-8e6e3b20c7a5@freenet.de> Message-ID: <5710ceab-c906-134e-0d17-c6196413267b@ya.ru>  >Why not? Just set the DPI of your system to something higher I now changed my Ubuntu to hi-dpi 200%, but cannot see this issue, my monitor is small. https://www.addictivetips.com/ubuntu-linux-tips/enable-hidpi-scaling-on-linux/ -- Regards, Alexey From aaa5500 at ya.ru Sun Aug 4 12:30:12 2019 From: aaa5500 at ya.ru (Alexey Tor.) Date: Sun, 4 Aug 2019 13:30:12 +0300 Subject: [Lazarus] TLabel accelerator "&:" don't work since 2018 Message-ID: Hi User of CudaText says that he sees not working accelerator (TLabel) for ":" char in his addons (Label1.Caption:= "Enter string&:" ). he has found 1sts bad version - from 2018. I ve searched SVN from this date (may 2018) and found such fixes in March. Can you see? r57572 | michl | 2018-03-28 23:47:36 +0300 (Ср, 28 мар 2018) | 1 line LCL: GTK2: TLabel: Accelerating keys will work correct again after revision 57571. -- r57571 | michl | 2018-03-28 23:42:11 +0300 (Ср, 28 мар 2018) | 1 line LCL: TLabel: Fixed TLabel.FocusControl select control without pressing ALT. Issue #33526 -- -- Regards, Alexey From aaa5500 at ya.ru Sun Aug 4 12:31:57 2019 From: aaa5500 at ya.ru (Alexey Tor.) Date: Sun, 4 Aug 2019 13:31:57 +0300 Subject: [Lazarus] TLabel accelerator "&:" don't work since 2018 In-Reply-To: References: Message-ID: >not working accelerator (TLabel) for ":" User has Windows 10. -- Regards, Alexey From nc-gaertnma at netcologne.de Tue Aug 6 14:08:36 2019 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Tue, 6 Aug 2019 14:08:36 +0200 Subject: [Lazarus] Lazarus Release 2.0.4 Message-ID: <20190806140836.561f9f15@limapholos.matflo.wg> The Lazarus team is glad to announce the release of Lazarus 2.0.4. This release was built with FPC 3.0.4. The previous release Lazarus 2.0.2 was built with FPC 3.0.4 as well. Here is the list of changes for Lazarus and Free Pascal: http://wiki.lazarus.freepascal.org/Lazarus_2.0.0_release_notes http://wiki.lazarus.freepascal.org/User_Changes_3.0.4 Here is the list of fixes for Lazarus 2.0.x: http://wiki.freepascal.org/Lazarus_2.0_fixes_branch The release is available for download on SourceForge: http://sourceforge.net/projects/lazarus/files/ Choose your CPU, OS, distro and then the "Lazarus 2.0.4" directory. Checksums for the SourceForge files: http://www.lazarus-ide.org/index.php?page=checksums#2_0_4 Minimum requirements: Windows: 2k, XP, Vista, 7, 8, 8.1 and 10, 32 or 64bit. FreeBSD/Linux: gtk 2.8 for gtk2, qt4.5 for qt, qt5.6 for qt5, 32 or 64bit. Mac OS X: 10.5 to 10.12; Carbon (32bit), Cocoa (64bit, beta), qt and qt5 (32 or 64bit). The svn tag is http://svn.freepascal.org/svn/lazarus/tags/lazarus_2_0_4 For people who are blocked by SF, the Lazarus releases from SourceForge are mirrored at: ftp://ftp.freepascal.org/pub/lazarus/releases/ and later at (after some time for synchronization) http://mirrors.iwi.me/lazarus/ Mattias From sysrpl at gmail.com Tue Aug 6 14:11:47 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Tue, 6 Aug 2019 08:11:47 -0400 Subject: [Lazarus] Lazarus Release 2.0.4 In-Reply-To: <20190806140836.561f9f15@limapholos.matflo.wg> References: <20190806140836.561f9f15@limapholos.matflo.wg> Message-ID: Wow! Thanks for hard work, it's very much appreciated and congratulations! -------------- next part -------------- An HTML attachment was scrubbed... URL: From sysrpl at gmail.com Tue Aug 6 14:11:47 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Tue, 6 Aug 2019 08:11:47 -0400 Subject: [Lazarus] Lazarus Release 2.0.4 In-Reply-To: <20190806140836.561f9f15@limapholos.matflo.wg> References: <20190806140836.561f9f15@limapholos.matflo.wg> Message-ID: Wow! Thanks for hard work, it's very much appreciated and congratulations! -------------- next part -------------- An HTML attachment was scrubbed... URL: From genericptr at gmail.com Thu Aug 8 18:08:20 2019 From: genericptr at gmail.com (Ryan Joseph) Date: Thu, 8 Aug 2019 10:08:20 -0600 Subject: [Lazarus] getlazarus.org search request Message-ID: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> getlazarus.org has a really excellent search feature but I’d like to make a request (I think the owner posts here which is why I’m asking). Could an additional API be added so that we could use 3rd party editors with it? In particular what I’d like to do is being able to send a HTTP request with the currently selected word and have it pull up the best result. I understand this doesn’t work with words like “Create” but it works well for types names. For example if: http://docs.getlazarus.org/search.php?TStringList Regards, Ryan Joseph From sysrpl at gmail.com Fri Aug 9 09:34:01 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 9 Aug 2019 03:34:01 -0400 Subject: [Lazarus] getlazarus.org search request In-Reply-To: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> Message-ID: Ryan, that is a good idea and I can absolutely add a search page that pulls a string from RESTful query string and returns a friendly hyperlinked summary of the most useful results. Also, I don't know if you know this, but you can edit Lazarus settings to open up https://docs.getlazarus.org to the appropriate page when you press F1 on any identifier in the code editor. Tools -> Options -> Help -> Help Options set StartPage / BaseURL = https://docs.getlazarus.org/ set RTLUnits / BaseURL = https://docs.getlazarus.org/rtl/ set FCLUnits / BaseURL = https://docs.getlazarus.org/fcl/ set LCLUnits / BaseURL = https://docs.getlazarus.org/lcl/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From sysrpl at gmail.com Fri Aug 9 09:40:12 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 9 Aug 2019 03:40:12 -0400 Subject: [Lazarus] Nice Lazarus ScrabbleControl, also a Gtk2 Bug Message-ID: While demonstrating objects to kids in my computer programming classes for kids this summer, I wrote a Scrabble board game control. It's on Github right now released under the LGPL. Here is a brief video demonstration: https://cache.getlazarus.org/videos/scrabble.mp4 The Github page for this free control is here: https://github.com/sysrpl/Lazarus.Scrabble Also, I found a bug with the LCL that prevents arrow key processing on Gtk2 (and maybe Gtk3) which I've written up here: https://bugs.freepascal.org/view.php?id=35942 -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Fri Aug 9 10:03:15 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 9 Aug 2019 10:03:15 +0200 (CEST) Subject: [Lazarus] Nice Lazarus ScrabbleControl, also a Gtk2 Bug In-Reply-To: References: Message-ID: On Fri, 9 Aug 2019, Anthony Walter via lazarus wrote: > While demonstrating objects to kids in my computer programming classes for > kids this summer, I wrote a Scrabble board game control. It's on Github > right now released under the LGPL. > > Here is a brief video demonstration: > > https://cache.getlazarus.org/videos/scrabble.mp4 > > The Github page for this free control is here: > > https://github.com/sysrpl/Lazarus.Scrabble > > Also, I found a bug with the LCL that prevents arrow key processing on Gtk2 > (and maybe Gtk3) which I've written up here: > > https://bugs.freepascal.org/view.php?id=35942 Nice job ! As a Scrabble fan, I'll port it to pas2js, another playful demo :-) Michael. From marc at dommelstein.nl Fri Aug 9 14:19:39 2019 From: marc at dommelstein.nl (Marc Weustink) Date: Fri, 9 Aug 2019 14:19:39 +0200 Subject: [Lazarus] Nice Lazarus ScrabbleControl, also a Gtk2 Bug In-Reply-To: References: Message-ID: <4f61d4da-d5cf-7095-2de9-6257b736b25c@dommelstein.nl> Anthony Walter via lazarus wrote: > While demonstrating objects to kids in my computer programming classes > for kids this summer, I wrote a Scrabble board game control. It's on > Github right now released under the LGPL. > > Here is a brief video demonstration: > > https://cache.getlazarus.org/videos/scrabble.mp4 > > The Github page for this free control is here: > > https://github.com/sysrpl/Lazarus.Scrabble > > Also, I found a bug with the LCL that prevents arrow key processing on > Gtk2 (and maybe Gtk3) which I've written up here: > > https://bugs.freepascal.org/view.php?id=35942 Preferred way is to add a patch for those lines. You call your solution a hack, but is the context of gtk2 this is ok. About the mess you were talking about in your presentation.... Note that gtk1 was the first widgetset used by Lazarus. At that time there was no idea how to solve things and having one generic seemed OK at that time. What you see now is alread a reduced splitup handler :) The windows widgetset was modeled after gtk1 and when gtk2 came we had the illusion that we could support gtk1 and gtk2 from one codebase. This became a mess and they were splitted. At that time it became clear that this wasn't the way the get forward and when I started with the Carbon interface I decided to move event handlers to the specific widgets. This design is later used for other widgetsets. The gtk and windows widgetset would require a complete rewrite. Besides that I wasn't really happy with the new design. It never came that far to. Marc From sysrpl at gmail.com Fri Aug 9 14:50:58 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 9 Aug 2019 08:50:58 -0400 Subject: [Lazarus] Nice Lazarus ScrabbleControl, also a Gtk2 Bug In-Reply-To: <4f61d4da-d5cf-7095-2de9-6257b736b25c@dommelstein.nl> References: <4f61d4da-d5cf-7095-2de9-6257b736b25c@dommelstein.nl> Message-ID: Marc, I can completely understand how it evolved, and early on the features of both the Free Pascal language, and the way the LCL library were to be adapted to multiple platforms became more clear. Thanks for your hard work. I've thought about the way the LCL is structured to handle many platforms for quite some time now, and if it were remade I'd strongly prefer it if every platform and native control were implemented through a set of well defined platform agnostic interfaces. Then each platform would adhere to that interface in order to implement it in classes such as TGtk2Canvas, TGtk2Window, and TGtk2WindowManager. Of course this would never happen, as it would mean a complete rewrite of everything, but perhaps someday someone might want to remake a new non Delphi compatible library from scratch for FPC and carry forward with this idea. For example: ICanvas = interface function MoveTo(X, Y: Integer): Boolean; function LineTo(X, Y: Integer): Boolean; ... end; IWindow = interface function Show: Boolean; function Hide: Boolean; function GetBounds(out Rect: TRect): Boolean; function SetBounds(const Rect: TRect): Boolean; function GetText(out S: string): Boolean; function SetText(out S: string): Boolean; ... end; IWindowManager = interface function WindowCreate(const Params: TWindowParams; out W: IWindow): Boolean; function WindowDestroy(W: IWindow): Boolean; function BringToFront(Window: IWindow): Boolean; function SendToBack(Window: IWindow): Boolean; function GetCursorPos(out P: TPoint): Boolean; function SetCursorPos(const P: TPoint): Boolean; ... end; -------------- next part -------------- An HTML attachment was scrubbed... URL: From marc at dommelstein.nl Fri Aug 9 15:57:04 2019 From: marc at dommelstein.nl (Marc Weustink) Date: Fri, 9 Aug 2019 15:57:04 +0200 Subject: [Lazarus] Nice Lazarus ScrabbleControl, also a Gtk2 Bug In-Reply-To: References: <4f61d4da-d5cf-7095-2de9-6257b736b25c@dommelstein.nl> Message-ID: <5ea95174-e788-2cc0-ba6c-778d077f2a10@dommelstein.nl> Anthony Walter via lazarus wrote: > Marc, > > I can completely understand how it evolved, and early on the features of > both the Free Pascal language, and the way the LCL library were to be > adapted to multiple platforms became more clear. Thanks for your hard work. > > I've thought about the way the LCL is structured to handle many > platforms for quite some time now, and if it were remade I'd strongly > prefer it if every platform and native control were implemented through > a set of well defined platform agnostic interfaces. Then each platform > would adhere to that interface in order to implement it in classes such > as TGtk2Canvas, TGtk2Window, and TGtk2WindowManager. Of course this > would never happen, as it would mean a complete rewrite of everything, > but perhaps someday someone might want to remake a new non Delphi > compatible library from scratch for FPC and carry forward with this idea. > > For example: > > ICanvas = interface >   function MoveTo(X, Y: Integer): Boolean; >   function LineTo(X, Y: Integer): Boolean; >   ... > end; > > IWindow = interface >   function Show: Boolean; >   function Hide: Boolean; >   function GetBounds(out Rect: TRect): Boolean; >   function SetBounds(const Rect: TRect): Boolean; >   function GetText(out S: string): Boolean; >   function SetText(out S: string): Boolean; >   ... > end; > > IWindowManager = interface >   function WindowCreate(const Params: TWindowParams; out W: IWindow): > Boolean; >   function WindowDestroy(W: IWindow): Boolean; >   function BringToFront(Window: IWindow): Boolean; >   function SendToBack(Window: IWindow): Boolean; >   function GetCursorPos(out P: TPoint): Boolean; >   function SetCursorPos(const P: TPoint): Boolean; >   ... > end; > > Thats what the WSWidgetClasses more or less tried to do. But even with this approach you may encounter cases that for a given widgetset one interface has to implemented partly in one class and partly in another. Another problem with interfaces I fear is is code size. My feeling says that you need all implementation classes in your exe. I've not experimented with it. Marc From sysrpl at gmail.com Fri Aug 9 17:45:49 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 9 Aug 2019 11:45:49 -0400 Subject: [Lazarus] Nice Lazarus ScrabbleControl, also a Gtk2 Bug In-Reply-To: <5ea95174-e788-2cc0-ba6c-778d077f2a10@dommelstein.nl> References: <4f61d4da-d5cf-7095-2de9-6257b736b25c@dommelstein.nl> <5ea95174-e788-2cc0-ba6c-778d077f2a10@dommelstein.nl> Message-ID: The WS classes are very difficult to work with IMO. I've used them and they are just messy, as in difficult and not exactly straight forward or intuitive. I'd have to look them over again to put my finger on exactly what's hard to use about them, but I distinctly remember having unnecessary trouble with them. With regards to code size I believe the way it works with WS classes and how it could only work with static linking is to make use of defines and conditional uses that is hopefully limited to only one place. The way I image interfaces working is that they serve as contracts. One master library unit file would define the interfaces which represent the entirety of every function of a window manager. That is managing windows, handling the mouse, keyboard, painting, and some common ideas such as image lists, canvas, fonts, printing, then a platform implementor writes concrete implementations of those. Native control interfaces for widgets such as TEdit, TButton, TTreeView, TPageControl would be independent interfaces defined in a cross platform control interface unit, but registered by name with the window management so that their function could be loaded by matching a window class name in the Params of WindowManager.WindowCreate(). Anyhow, to change anything now would mean a complete rewrite and at this point it would be a huge undertaking to say the least. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mailinglists at geldenhuys.co.uk Sat Aug 10 00:15:48 2019 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Fri, 9 Aug 2019 23:15:48 +0100 Subject: [Lazarus] Nice Lazarus ScrabbleControl, also a Gtk2 Bug In-Reply-To: References: <4f61d4da-d5cf-7095-2de9-6257b736b25c@dommelstein.nl> Message-ID: On 09/08/2019 1:50 pm, Anthony Walter via lazarus wrote: > but perhaps someday someone > might want to remake a new non Delphi compatible library from scratch for > FPC and carry forward with this idea. Such libraries already exist. eg: fpGUI Toolkit and MSEide+MSEgui. Feel free to experiment with those. :-) 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 From mailinglists at geldenhuys.co.uk Sat Aug 10 00:16:55 2019 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Fri, 9 Aug 2019 23:16:55 +0100 Subject: [Lazarus] Nice Lazarus ScrabbleControl, also a Gtk2 Bug In-Reply-To: References: Message-ID: On 09/08/2019 8:40 am, Anthony Walter via lazarus wrote: > Here is a brief video demonstration: I know nothing about Scrabble, but as a seasoned visual component developer I can see a lot of effort went into that. Well done! 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 From bartjunk64 at gmail.com Sat Aug 10 19:28:24 2019 From: bartjunk64 at gmail.com (Bart) Date: Sat, 10 Aug 2019 19:28:24 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) Message-ID: Hi, Consider this piece of code. On a form have a TSynEdit (named: Ed) and a TSpeedButton. procedure TForm1.SpeedButton1Click(Sender: TObject); var BB, BE: TPoint; BackwardsSel: Boolean; SelLength: Integer; const Pre = '{'; Post = '}'; begin writeln('==================='); writeln; with Ed do begin BB := BlockBegin; BE := BlockEnd; BackwardsSel := IsBackwardSel; SelLength := SelEnd-SelStart; writeln('BlockBegin =',bb.x,',',bb.y); writeln('BlockEnd =',be.x,',',be.y); writeln('SelLength =',SelLength); writeln('BackwardsSel=',BackwardsSel); //BB is always before BE even if IsBackwardSel=TRUE //move caret to the end of the selection LogicalcaretXY := BlockEnd; //SetLogicalCaret clears the selection, so restore it BlockBegin := BB; BlockEnd := BE; BB := BlockBegin; BE := BlockEnd; writeln('After SetLogicalCaret'); writeln('BlockBegin =',bb.x,',',bb.y); writeln('BlockEnd =',be.x,',',be.y); //Insert Pre at blockbegin, so in front of the selection: block moves to the right, blockbegin.x and blockend.x will increase SetTextBetweenPoints(BB, BB, Pre, [setMoveBlock], scamIgnore, smaMoveUp, smNormal); BB := BlockBegin; BE := BlockEnd; writeln('After SetTextBetweenPoints(BB,BB,...)'); writeln('BlockBegin =',bb.x,',',bb.y); writeln('BlockEnd =',be.x,',',be.y); //Insert Post at blockend, the block does NOT move, so this should NOT affect the value of blockbegin or blockend SetTextBetweenPoints(BE, BE, Post, [setMoveBlock], scamIgnore, smaMoveUp, smNormal); //Now the caret needs to be moved to BlockBegin, but unfortunately this unselects the selection //so we save where it ends, then restore it BB := BlockBegin; BE := BlockEnd; writeln('After SetTextBetweenPoints(BE,BE,...)'); writeln('BlockBegin =',bb.x,',',bb.y); writeln('BlockEnd =',be.x,',',be.y); if not BackwardsSel then LogicalCaretXY := BlockEnd else LogicalCaretXY := BlockBegin; BlockBegin := BB; BlockEnd := BE; writeln('After SetLogicalCaret'); writeln('BlockBegin =',bb.x,',',bb.y); writeln('BlockEnd =',be.x,',',be.y); end; writeln; writeln('==================='); writeln; end; It's intention is to put Pre in front of the current selection and Post after it. The original selected text should still be selected after it, and the caret must be at the end of the selected text. Build and run. Now in an empty synedit type a single character e.g. '1' (at point (1,1)) Run the code. It works as expected. The text is now {1} and the 1 is selected. Now clear the synedit again. Run the code again. This time the text will be {} (as expected), but the entire {} will be selected. Here's the debug output: Case 1 (1 character at (1,1) selected): BlockBegin =1,1 BlockEnd =2,1 SelLength =1 BackwardsSel=FALSE After SetLogicalCaret BlockBegin =1,1 BlockEnd =2,1 After SetTextBetweenPoints(BB,BB,...) BlockBegin =2,1 BlockEnd =3,1 After SetTextBetweenPoints(BE,BE,...) BlockBegin =2,1 BlockEnd =3,1 After SetLogicalCaret BlockBegin =2,1 BlockEnd =3,1 Case 2 (no text selected) BlockBegin =1,1 BlockEnd =1,1 SelLength =0 BackwardsSel=FALSE After SetLogicalCaret BlockBegin =1,1 BlockEnd =1,1 After SetTextBetweenPoints(BB,BB,...) BlockBegin =1,1 BlockEnd =2,1 After SetTextBetweenPoints(BE,BE,...) BlockBegin =1,1 BlockEnd =3,1 After SetLogicalCaret BlockBegin =1,1 BlockEnd =3,1 =================== When text is selected, SetTextBetweenPoints will move the block to the right if we insert text before it and adjust BlockBegin and BlockEnd accordingly. However when no text is selected, BlockBegin. remains unchanged, but BlockEnd is incremented, which IMO is wrong: BlockBegin.X should be incremented by the amount dicated by the contents of Pre (in this case BlockBegin.X should be incremented by 1). Is this a bug (in SetTextBetweenPoints?) or do I need to adjust my code for the case where no text is selected? -- Bart From bartjunk64 at gmail.com Sat Aug 10 19:59:27 2019 From: bartjunk64 at gmail.com (Bart) Date: Sat, 10 Aug 2019 19:59:27 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: References: Message-ID: Additionally, if you run this code on a SynEdit that has never had any text in it (e.i. create it at run time, Lines.Count will be zero), then SetTextBetweenPonits will NOT adjust BlockBegin and BlockEnd at all: they will remain (1,1) at all times. -- Bart From lazarus at mfriebe.de Sat Aug 10 21:09:45 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 10 Aug 2019 21:09:45 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: References: Message-ID: On 10/08/2019 19:28, Bart via lazarus wrote: > Hi, > > Consider this piece of code. > On a form have a TSynEdit (named: Ed) and a TSpeedButton. > I added 2 fixes (one for the other mail / empty edit). Please test. The first fix can be merged, the 2nd should get some more testing as the BlockBegin points to a none existing line (and that should not be allowed). Also do not rely on the current new implementation, that will make sure BB.y is never 0. If there is no selection, then BB and BE should end up after {}, as both inserts are treated as before the selection. From bartjunk64 at gmail.com Sat Aug 10 22:18:08 2019 From: bartjunk64 at gmail.com (Bart) Date: Sat, 10 Aug 2019 22:18:08 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: References: Message-ID: On Sat, Aug 10, 2019 at 9:09 PM Martin Frb via lazarus wrote: > I added 2 fixes (one for the other mail / empty edit). Please test. I think the fix for empty selection is allright. It will not completely solve my issue (the second SetTextBetweenPoints also moves BlockEnd), which makes sense I guess, since in essence I want BlockEnd to "move" with the first call, but remain with the second call, and in each call BlockBegin=BlockEnd. I adjusted my code to deal with that (if no text is selected I restore BB and BE as needed). The situation with Lines.Count=0 even got worse: it now places Post in front of Pre, so you get '}{' instead of "{}'. As a side effect of that, the caret is in between the } and { (which is where I wanted them to be ;) ) Here's the debug output for that situation: BlockBegin =1,1 BlockEnd =1,1 SelLength =0 BackwardsSel=FALSE Lines.Count =0 After SetLogicalCaret (LogicalCaretXY := Blocken, which is 1,1) BlockBegin =1,0 <<====== ??? BlockEnd =1,1 After SetTextBetweenPoints(BB,BB,...) BlockBegin =1,1 BlockEnd =1,1 After SetTextBetweenPoints(BE,BE,...) BlockBegin =2,1 BlockEnd =2,1 After SetLogicalCaret BlockBegin =2,1 BlockEnd =2,1 -- Bart From lazarus at mfriebe.de Sat Aug 10 22:52:45 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 10 Aug 2019 22:52:45 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: References: Message-ID: On 10/08/2019 22:18, Bart via lazarus wrote: > > The situation with Lines.Count=0 even got worse: it now places Post in > front of Pre, so you get '}{' instead of "{}'. > As a side effect of that, the caret is in between the } and { (which > is where I wanted them to be ;) ) > > Here's the debug output for that situation: > > BlockBegin =1,1 > BlockEnd =1,1 > SelLength =0 > BackwardsSel=FALSE > Lines.Count =0 > After SetLogicalCaret (LogicalCaretXY := Blocken, which is 1,1) > BlockBegin =1,0 <<====== ??? > BlockEnd =1,1 > Well, yes. I tested with all the SetCaret and SetBlock.... disabled. I will have to look into that. The block pos is limited to existing lines. And if line 1 does not exist..... argh From bartjunk64 at gmail.com Sat Aug 10 23:35:37 2019 From: bartjunk64 at gmail.com (Bart) Date: Sat, 10 Aug 2019 23:35:37 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: References: Message-ID: On Sat, Aug 10, 2019 at 10:52 PM Martin Frb via lazarus wrote: > The block pos is limited to existing lines. And if line 1 does not > exist..... argh TSynEditSelection.SetStartLineBytePos should not allow values of X/Y < 1? -- Bart From lazarus at mfriebe.de Sat Aug 10 23:56:37 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 10 Aug 2019 23:56:37 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: References: Message-ID: On 10/08/2019 23:35, Bart via lazarus wrote: > On Sat, Aug 10, 2019 at 10:52 PM Martin Frb via lazarus > wrote: > > >> The block pos is limited to existing lines. And if line 1 does not >> exist..... argh > TSynEditSelection.SetStartLineBytePos should not allow values of X/Y < 1? > The problem is that lines.count = 0 should not exist. But I am not opening that can of worms right now. I added a few more workarounds. Please test. From lazarus at mfriebe.de Sun Aug 11 00:46:30 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 11 Aug 2019 00:46:30 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: References: Message-ID: <7885506b-7c5d-a5e2-c3f2-f98346a8b656@mfriebe.de> Ok, looking at your code. This should be all you need. Caret, Selection and IsBackwardSel are all kept   with SynEdit1 do   begin     BB := BlockBegin;     BE := BlockEnd;     writeln('BlockBegin  =',bb.x,',',bb.y);     writeln('BlockEnd    =',be.x,',',be.y);     writeln(SynEdit1.IsBackwardSel);     BB := BlockBegin;     SetTextBetweenPoints(BB, BB, Pre, [setMoveBlock], scamAdjust, smaMoveUp, smNormal);   // scamAdjust => Move the caret with the block.     BE := BlockEnd;     SetTextBetweenPoints(BE, BE, Post, [setMoveBlock], scamIgnore, smaMoveUp, smNormal);   // setMoveBlock for the 2nd call,  is to KEEP the selection as it is. So to keep caret => scamIgnore     BB := BlockBegin;     BE := BlockEnd;     writeln('After SetTextBetweenPoints(BE,BE,...)');     writeln('BlockBegin  =',bb.x,',',bb.y);     writeln('BlockEnd    =',be.x,',',be.y);     writeln(SynEdit1.IsBackwardSel);   end; Also  SelEnd / SelStart are really slow (they have to iterate over all lines up to the selection, each time you call them. SynEdit operates with x/y locations. From lazarus at kluug.net Sun Aug 11 11:56:38 2019 From: lazarus at kluug.net (Ondrej Pokorny) Date: Sun, 11 Aug 2019 11:56:38 +0200 Subject: [Lazarus] It is a beautiful day... In-Reply-To: References: Message-ID: <6de62608-a05c-c1ae-0e4d-ce3f58ac6285@kluug.net> On 11.07.2019 17:46, Michael Van Canneyt via lazarus wrote: > The IDE now has proper support for Project groups. Hello, I started to use Project groups and also added the .lpg file to my repository. I found out that the XML format is unusual (wrong). The nodes are not subnodes to :                                           Is this an intention? I ask because I wanted to update the file format to the new Lazarus XML format (without the indexes and count attributes):                                                       and I have already helper functions for distinguishing between the old and the new file formats but they can handle only the "correct" old format (where item nodes are subnodes of the main node):                                     My question: because Project groups are usable only in trunk, I suggest to fix the old file format without backwards-compatibility:                                     That would mean that the Compile flags for build modes get lost and the user must set them again. Are you fine with it? (Well, I am fine with that.) Best Ondrej From nc-gaertnma at netcologne.de Sun Aug 11 12:23:24 2019 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Sun, 11 Aug 2019 12:23:24 +0200 Subject: [Lazarus] It is a beautiful day... In-Reply-To: <6de62608-a05c-c1ae-0e4d-ce3f58ac6285@kluug.net> References: <6de62608-a05c-c1ae-0e4d-ce3f58ac6285@kluug.net> Message-ID: <20190811122324.316694ba@limapholos.matflo.wg> On Sun, 11 Aug 2019 11:56:38 +0200 Ondrej Pokorny via lazarus wrote: > On 11.07.2019 17:46, Michael Van Canneyt via lazarus wrote: > > The IDE now has proper support for Project groups. > > Hello, > > I started to use Project groups and also added the .lpg file to my > repository. I found out that the XML format is unusual (wrong). The > nodes are not subnodes to : > > > >   >     >       >         >         >         >       > > Is this an intention? No > I ask because I wanted to update the file format to the new Lazarus > XML format (without the indexes and count attributes): > > > >   >     >       >         >           >           >         >       > > and I have already helper functions for distinguishing between the > old and the new file formats but they can handle only the "correct" > old format (where item nodes are subnodes of the main node): >         >           >           >         > > My question: because Project groups are usable only in trunk, Project groups are in 2.0. > I suggest to fix the old file format without backwards-compatibility: >         >           >           >         > > That would mean that the Compile flags for build modes get lost and > the user must set them again. Are you fine with it? (Well, I am fine > with that.) I guess with a few lines of code you can read the old format and set the "Compile" flag. Mattias From mailinglists at geldenhuys.co.uk Sun Aug 11 12:25:26 2019 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Sun, 11 Aug 2019 11:25:26 +0100 Subject: [Lazarus] It is a beautiful day... In-Reply-To: <6de62608-a05c-c1ae-0e4d-ce3f58ac6285@kluug.net> References: <6de62608-a05c-c1ae-0e4d-ce3f58ac6285@kluug.net> Message-ID: <8ad68816-652a-683c-a3aa-053abee3ba4f@geldenhuys.co.uk> On 11/08/2019 10:56 am, Ondrej Pokorny via lazarus wrote: > I found out that the XML format is unusual (wrong). Fully agree. That is so INI-ish, and really not needed in XML or JSON formats. > I ask because I wanted to update the file format to the new Lazarus XML > format (without the indexes and count attributes): > > > >   >     >       >         >           >           >         >       Looks much better! I vote for this. I would also recommend the idea of considering JSON format, which is less verbose, has real data types (boolean, int, float, etc - not everything is a string value), thus making it more expressive. 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 From lazarus at kluug.net Sun Aug 11 12:54:48 2019 From: lazarus at kluug.net (Ondrej Pokorny) Date: Sun, 11 Aug 2019 12:54:48 +0200 Subject: [Lazarus] It is a beautiful day... In-Reply-To: <20190811122324.316694ba@limapholos.matflo.wg> References: <6de62608-a05c-c1ae-0e4d-ce3f58ac6285@kluug.net> <20190811122324.316694ba@limapholos.matflo.wg> Message-ID: <8bdd926a-672d-0faf-8c44-1fdc70aac9bf@kluug.net> On 11.08.2019 12:23, Mattias Gaertner via lazarus wrote: >> I suggest to fix the old file format without backwards-compatibility: >>         >>           >>           >>         >> >> That would mean that the Compile flags for build modes get lost and >> the user must set them again. Are you fine with it? (Well, I am fine >> with that.) > I guess with a few lines of code you can read the old format and set > the "Compile" flag. The issue is that the new format is done with forwards-compatibility so that people can decide if they want to open the new file in an older Lazarus version. (The projects have the "Maximize compatibility of project files" option for this.) Is this important to you? Ondrej From nc-gaertnma at netcologne.de Sun Aug 11 13:12:12 2019 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Sun, 11 Aug 2019 13:12:12 +0200 Subject: [Lazarus] It is a beautiful day... In-Reply-To: <8bdd926a-672d-0faf-8c44-1fdc70aac9bf@kluug.net> References: <6de62608-a05c-c1ae-0e4d-ce3f58ac6285@kluug.net> <20190811122324.316694ba@limapholos.matflo.wg> <8bdd926a-672d-0faf-8c44-1fdc70aac9bf@kluug.net> Message-ID: <20190811131212.0a2400f7@limapholos.matflo.wg> On Sun, 11 Aug 2019 12:54:48 +0200 Ondrej Pokorny via lazarus wrote: > On 11.08.2019 12:23, Mattias Gaertner via lazarus wrote: > >> I suggest to fix the old file format without > >> backwards-compatibility: > >>           > >>           > >>         > >> > >> That would mean that the Compile flags for build modes get lost and > >> the user must set them again. Are you fine with it? (Well, I am > >> fine with that.) > > I guess with a few lines of code you can read the old format and set > > the "Compile" flag. > > The issue is that the new format is done with forwards-compatibility > so that people can decide if they want to open the new file in an > older Lazarus version. (The projects have the "Maximize compatibility > of project files" option for this.) That an old Lazarus cannot read completely the new format is an incompatibility I can live with, if it is documented. Mattias From bartjunk64 at gmail.com Sun Aug 11 13:21:27 2019 From: bartjunk64 at gmail.com (Bart) Date: Sun, 11 Aug 2019 13:21:27 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: <7885506b-7c5d-a5e2-c3f2-f98346a8b656@mfriebe.de> References: <7885506b-7c5d-a5e2-c3f2-f98346a8b656@mfriebe.de> Message-ID: On Sun, Aug 11, 2019 at 12:46 AM Martin Frb via lazarus wrote: > This should be all you need. Caret, Selection and IsBackwardSel are all kept > ... > SetTextBetweenPoints(BB, BB, Pre, [setMoveBlock], scamAdjust, > smaMoveUp, smNormal); > // scamAdjust => Move the caret with the block. > BE := BlockEnd; > SetTextBetweenPoints(BE, BE, Post, [setMoveBlock], scamIgnore, > smaMoveUp, smNormal); > // setMoveBlock for the 2nd call, is to KEEP the selection as it is. > So to keep caret => scamIgnore Yes, this seems to work OK, even when Lines.Count = 0. So, now I need to $ifdef my workaround for Lazarus 2.0. What ifdef to use? > Also SelEnd / SelStart are really slow (they have to iterate over all > lines up to the selection, each time you call them. SynEdit operates > with x/y locations. I know, see the diff in https://sourceforge.net/p/flyingsheep/code/324/tree//trunk/EPlus/editorpagecontrol.pp?diff=4faa6364b9363c207f000850:323 + //Using SetTextBetweenPoints is faster (and according to Martin Friebe) more reliable + //than using SelStart and SelLength (like the old code did) That code was by you, so you got me into this mess in the first place :-) -- Bart From lazarus at mfriebe.de Sun Aug 11 15:00:17 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 11 Aug 2019 15:00:17 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: References: <7885506b-7c5d-a5e2-c3f2-f98346a8b656@mfriebe.de> Message-ID: <015db4ab-35f3-7c25-9459-301c990efa8d@mfriebe.de> On 11/08/2019 13:21, Bart via lazarus wrote: > >> SetTextBetweenPoints(BB, BB, Pre, [setMoveBlock], scamAdjust, >> smaMoveUp, smNormal); >> // scamAdjust => Move the caret with the block. >> BE := BlockEnd; >> SetTextBetweenPoints(BE, BE, Post, [setMoveBlock], scamIgnore, >> smaMoveUp, smNormal); >> // setMoveBlock for the 2nd call, is to KEEP the selection as it is. >> So to keep caret => scamIgnore > Yes, this seems to work OK, even when Lines.Count = 0. > > So, now I need to $ifdef my workaround for Lazarus 2.0. > What ifdef to use? {$IF LCL_FullVersion < 2010000} This does not work for smColumn mode. Even if the column only has a single line. But trying to do a {} around a column selection is of limited use anyway. It would only add on opening on the very first line, and a closing on the very last line. Btw, I have not tested that code for persistent selections. It relies on that the 2nd  SetTextBetweenPoints does not move the caret (that will be the same with persistent selection) and that if the block had been moved (in case of on empty selection), the caret will reset the block. That is because the selection must end (or begin) at the caret. Which is not the case after the empty selection did move. A persistent selection does not need to end at the caret. So I do not know if it will be reset. (Maybe it does, maybe not) If it is not, then it will still at first look ok: selection still empty, and caret at correct location. But this may affect how ctrl-K,B / ctrl-K,k  (IIRC) work. That is, if you set the block-end, the begin (even though empty) may have been moved. Hovewer come to think of it: Unless the selection begin has just been set, the begin of a persistent selection is not at the caret. So using BlockBegin/End for an empty persistent selection will not get you what you want. So if there is no selection (and if persistent selection could be enabled) then (not tested) something like this may help If not SelAvail then begin    p := LogicalCaretPos;    f :=    BlockBegin = p;    SetTextBetweenPoints(p, p, Post, [setMoveBlock], scamIgnore,smaMoveUp, smNormal);    SetTextBetweenPoints(p, p, Pre, [setMoveBlock], scamAdjust,smaMoveUp, smNormal);    if f then BlockBegin := p; end else   // the other code Selection will be moved, if it is not at the caret pos. Otherwise - insert the end "}" first, but do not move caret. - insert begin (will insert before end, because caret did not move),     will move the caret (so it is after "{"), and will reset selection to be empty at caret - reset empty selection to caret. >> Also SelEnd / SelStart are really slow (they have to iterate over all >> lines up to the selection, each time you call them. SynEdit operates >> with x/y locations. > I know, see the diff in > https://sourceforge.net/p/flyingsheep/code/324/tree//trunk/EPlus/editorpagecontrol.pp?diff=4faa6364b9363c207f000850:323 > > + //Using SetTextBetweenPoints is faster (and according to Martin > Friebe) more reliable BlockBegin/BlockEnd are faster than SelStart/SelEnd. BlockBegin/End and SetTextBetweenPoints are comparable. But SetTextBetweenPoints should be less work to use. > That code was by you, so you got me into this mess in the first place :-) > In that case sorry. From friess at gmx.at Sun Aug 11 15:41:12 2019 From: friess at gmx.at (=?UTF-8?Q?Andreas_Frie=c3=9f?=) Date: Sun, 11 Aug 2019 15:41:12 +0200 Subject: [Lazarus] fpreport: Rendering Report to Printer did not work on RasPi (arm-linux) Message-ID: I have created a report with fpreport (in code) and it works on Windows (32-bit app) with Rendering to LCLCanvas, PDF  and Printer without problems. On a RasPi with rasbian (on Jessy, Wheezy the same) rendering to LCLCanvas and PDF works, but on printer it shows not the text. pictures are correct rendered. The text is not rendered or only some points, except the footerband.  It looks in some test like the drawn text is overwritten. I have dived a little into fpreport and found out, it must have to do with Canvas.Textout in TFPReportExportCanvas.RenderMemo. The parameters of Canvas.TextOut are imho correct, but not the rendered result. If i change Canvas.TextOut to Canvas.TextRect (as in designmode) and use the same parameters, the text is written to the printer, it looks like something goes wrong on arm-linux with Canvas.TextOut. I am using fpc fixes32 (42593) and Laz Fixes20 (61645) and tested with Lazarus 2.1.0 r61504:61683M FPC 3.3.1 i386-win32-win32/win64 (42644) too I have post this on the freepascalforum https://forum.lazarus.freepascal.org/index.php/topic,46343.msg329973.html#msg329973 with an adapted sample of the fpreport-excample from Lazarus. Regards Andi From bartjunk64 at gmail.com Sun Aug 11 15:41:58 2019 From: bartjunk64 at gmail.com (Bart) Date: Sun, 11 Aug 2019 15:41:58 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: <015db4ab-35f3-7c25-9459-301c990efa8d@mfriebe.de> References: <7885506b-7c5d-a5e2-c3f2-f98346a8b656@mfriebe.de> <015db4ab-35f3-7c25-9459-301c990efa8d@mfriebe.de> Message-ID: Hi, In my real app I don't have persistent blocks, so that should not be a problem. > BlockBegin/BlockEnd are faster than SelStart/SelEnd. > BlockBegin/End and SetTextBetweenPoints are comparable. Speed is not of concern in my use case. The computer will always be faster than any human typing in my editor ;-) My old code uses SelStart etc (ported form a Delphi 3 app), but then I could not get it to work properly if the selection spanned multiple lines. You then suggested I'lld use SetTextBetweenPoints. This did not have that drawback. > But SetTextBetweenPoints should be less work to use. Apparently not for me IIRC then at some point in time I ran into problems (probably related to new SetTextBetweenPoints API ???) with backwards blocks and empty blocks. Since my app is mostly private for me (I create all my htm pages with it and use it instead of notepad whenever possible), I did not bother too much. However I seem to have a habit of selecting text from right to left, so the bug triggered more often then not. Once I was frustrated enough with it I investigated again and asked for your help (again). ATM I have it working, for which I thank you. In my app, I solve the Lines.Count = 0 situation by simply adding an empty line. This makes sense, in the way that the function will always insert text in the editor, so linecount would have been altered in that case anyway. One more question: The current solution creates 2 "redo" points. I have to press ^Z 2 times to undo the process. Is there a way to make it so that the whole process can be undone in one step (by invoking the default undo-mechanism of TSynEdit)? Again, thanks for your help. Bart From lazarus at mfriebe.de Sun Aug 11 16:33:13 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 11 Aug 2019 16:33:13 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: References: <7885506b-7c5d-a5e2-c3f2-f98346a8b656@mfriebe.de> <015db4ab-35f3-7c25-9459-301c990efa8d@mfriebe.de> Message-ID: <6e764d70-2f10-a681-9cf3-f414cb14775e@mfriebe.de> On 11/08/2019 15:41, Bart via lazarus wrote: > > One more question: > The current solution creates 2 "redo" points. > I have to press ^Z 2 times to undo the process. > Is there a way to make it so that the whole process can be undone in > one step (by invoking the default undo-mechanism of TSynEdit)? > SynEdit1.BeginUpdate(); / EndUpdate or BeginUndoBlock. From bartjunk64 at gmail.com Sun Aug 11 18:41:05 2019 From: bartjunk64 at gmail.com (Bart) Date: Sun, 11 Aug 2019 18:41:05 +0200 Subject: [Lazarus] SynEdit.TextBetweenPoints (Martin?) In-Reply-To: <6e764d70-2f10-a681-9cf3-f414cb14775e@mfriebe.de> References: <7885506b-7c5d-a5e2-c3f2-f98346a8b656@mfriebe.de> <015db4ab-35f3-7c25-9459-301c990efa8d@mfriebe.de> <6e764d70-2f10-a681-9cf3-f414cb14775e@mfriebe.de> Message-ID: On Sun, Aug 11, 2019 at 4:33 PM Martin Frb via lazarus wrote: > SynEdit1.BeginUpdate(); / EndUpdate Thanks. Should have figured that out myself, shouldn't I ;-) -- Bart From juha.manninen62 at gmail.com Sun Aug 11 18:43:59 2019 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Sun, 11 Aug 2019 19:43:59 +0300 Subject: [Lazarus] I found an AnchorDockingDsgn package bug? In-Reply-To: <6be0cce7-f9a8-d4c6-1e35-576aac5ed546@gmx.de> References: <2a413d31-3d34-b6ef-4b1f-19fc82041010@gmail.com> <6be0cce7-f9a8-d4c6-1e35-576aac5ed546@gmx.de> Message-ID: On Mon, Jun 17, 2019 at 12:43 AM Michael W. Vogel via lazarus wrote: > Can you please open a bug report on Mantis?! There is one opened by Andrew Zenin. https://bugs.freepascal.org/view.php?id=35242 Regards, Juha P.S. Sorry for answering an old post. I am reading them now after a pause. From aaa5500 at ya.ru Sun Aug 11 19:41:02 2019 From: aaa5500 at ya.ru (Alexey Tor.) Date: Sun, 11 Aug 2019 20:41:02 +0300 Subject: [Lazarus] TextHint for TCombobox? Message-ID: I see that TextHint works for Edit/Memo - but its not supported for Combobox (in editable style). Can you add? -- Regards, Alexey From juha.manninen62 at gmail.com Sun Aug 11 19:48:12 2019 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Sun, 11 Aug 2019 20:48:12 +0300 Subject: [Lazarus] Running using lazbuild In-Reply-To: References: Message-ID: On Wed, Jul 24, 2019 at 7:33 PM Ryan Joseph via lazarus wrote: > Can the “lazbuild” tool be used to run a project exactly like if I press the run button in Lazarus? > I have project which runs in Lazarus but doing “lazbuild project.lpi” gives me errors suggesting it didn’t do exactly the same thing. LazBuild does not run a project but it should build it the same way that Lazarus IDE does. What kind of errors did you get? Juha From genericptr at gmail.com Sun Aug 11 20:29:57 2019 From: genericptr at gmail.com (Ryan Joseph) Date: Sun, 11 Aug 2019 12:29:57 -0600 Subject: [Lazarus] Running using lazbuild In-Reply-To: References: Message-ID: > On Aug 11, 2019, at 11:48 AM, Juha Manninen via lazarus wrote: > > On Wed, Jul 24, 2019 at 7:33 PM Ryan Joseph via lazarus > wrote: >> Can the “lazbuild” tool be used to run a project exactly like if I press the run button in Lazarus? >> I have project which runs in Lazarus but doing “lazbuild project.lpi” gives me errors suggesting it didn’t do exactly the same thing. > > LazBuild does not run a project but it should build it the same way > that Lazarus IDE does. > What kind of errors did you get? Thanks for replying. Here’s the output I get. Pressing build in Lazarus doesn’t give this error. I think the wrong widget set is being used but I shouldn’t need to setting anything because all the information in the project is already set in the project file I thought. You can test with the git project: https://github.com/neurolabusc/MRIcroGL ======================== Ryans-MacBook-Pro-2:MRIcroGL12 ryanjoseph$ lazbuild MRIcroGL.lpr Hint: (lazarus) Last compile was incomplete for LCL 2.1 State file="/Users/ryanjoseph/Desktop/laz_tests/lazarus/lcl/units/x86_64-darwin/carbon/LCL.compiled" Hint: (lazarus) Missing state file of LazOpenGLContext 0.0.1: /Users/ryanjoseph/Desktop/laz_tests/lazarus/components/opengl/lib/x86_64-darwin/carbon/LazOpenGLContext.compiled Hint: (lazarus) Missing state file of python4lazarus_package 1.0: /Users/ryanjoseph/Desktop/laz_tests/Python-for-Lazarus/python4lazarus/lib/x86_64-darwin/python4lazarus_package.compiled Hint: (11030) Start of reading config file /etc/fpc.cfg Hint: (11031) End of reading config file /etc/fpc.cfg Free Pascal Compiler version 3.0.4 [2018/09/30] for x86_64 Copyright (c) 1993-2017 by Florian Klaempfl and others (1002) Target OS: Darwin for x86_64 (3104) Compiling lcl.pas (3104) Compiling ./carbon/alllclintfunits.pas (3104) Compiling ./carbon/carbonbars.pp /Users/ryanjoseph/Desktop/laz_tests/lazarus/lcl/interfaces/./carbon/carbonbars.pp(16,2) Error: (2023) User defined: only cpu i386 is supported (3104) Compiling ./carbon/carbonprivate.pp (3104) Compiling ./carbon/carbondef.pp /Users/ryanjoseph/Desktop/laz_tests/lazarus/lcl/interfaces/./carbon/carbondef.pp(187,1) Fatal: (10026) There were 1 errors compiling module, stopping Fatal: (1018) Compilation aborted Error: /usr/local/bin/ppcx64 returned an error exitcode Error: (lazarus) Compile package LCL 2.1: stopped with exit code 1 Error: (lazarus) [TLazPackageGraph.CompileRequiredPackages] "Exit code 1" Error: (lazbuild) Project dependencies of /Users/ryanjoseph/Desktop/Work/MRIcroGL12/MRIcroGL.lpi Ryans-MacBook-Pro-2:MRIcroGL12 ryanjoseph$ Regards, Ryan Joseph From sysrpl at gmail.com Sun Aug 11 21:51:35 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Sun, 11 Aug 2019 15:51:35 -0400 Subject: [Lazarus] getlazarus.org search request In-Reply-To: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> Message-ID: Ryan, I was going to modify my project to allow for RESTful queries, when I realized it already does this. The url and format are as follows: https://docs.getlazarus.org/?method=codesearch&phrase=TStringList Alternate request for xml format: https://docs.getlazarus.org/?method=codesearch&format=xml&phrase=TStringList Currently there is no custom formatting applied as this is meant to be an AJAX request to create populate suggestions. As this is an API like RESTful function is this good enough for you or do want a "pretty" result format? Here are the templates, which I could easy swap out based on another request parameter: Page uses this template as an html fragment:
{SearchItems}
Results collection uses this template: {Bolden} {Kind} {Description} -------------- next part -------------- An HTML attachment was scrubbed... URL: From lazarus at mfriebe.de Sun Aug 11 22:09:26 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 11 Aug 2019 22:09:26 +0200 Subject: [Lazarus] Running using lazbuild In-Reply-To: References: Message-ID: <75df381e-d225-ac74-1095-6d8a34abdb62@mfriebe.de> On 11/08/2019 20:29, Ryan Joseph via lazarus wrote: > Hint: (lazarus) Missing state file of python4lazarus_package 1.0: > /Users/ryanjoseph/Desktop/laz_tests/Python-for-Lazarus/python4lazarus/lib/x86_64-darwin/python4lazarus_package.compiled > > Hint: (11030) Start of reading config file /etc/fpc.cfg > Hint: (11031) End of reading config file /etc/fpc.cfg > Free Pascal Compiler version 3.0.4 [2018/09/30] for x86_64 > Copyright (c) 1993-2017 by Florian Klaempfl and others > (1002) Target OS: Darwin for x86_64 > (3104) Compiling lcl.pas > (3104) Compiling ./carbon/alllclintfunits.pas > (3104) Compiling ./carbon/carbonbars.pp > /Users/ryanjoseph/Desktop/laz_tests/lazarus/lcl/interfaces/./carbon/carbonbars.pp(16,2) Error: (2023) User defined: only cpu i386 is supported > Looks like it did not pick up the widgetset. But it did pick up cpu=64bit. So it attempts carbon for 64 bit, which gives the error. From genericptr at gmail.com Sun Aug 11 22:22:35 2019 From: genericptr at gmail.com (Ryan Joseph) Date: Sun, 11 Aug 2019 14:22:35 -0600 Subject: [Lazarus] Running using lazbuild In-Reply-To: <75df381e-d225-ac74-1095-6d8a34abdb62@mfriebe.de> References: <75df381e-d225-ac74-1095-6d8a34abdb62@mfriebe.de> Message-ID: <912FFFE5-E0D9-4B52-8ECA-88E3CEF06EEF@gmail.com> > On Aug 11, 2019, at 2:09 PM, Martin Frb via lazarus wrote: > > Looks like it did not pick up the widgetset. But it did pick up cpu=64bit. > > So it attempts carbon for 64 bit, which gives the error. Is this a lazbuild bug that could be fixed? I wanted to integrate lazbuild into my editor but this is a deal breaker for me. Regards, Ryan Joseph From nc-gaertnma at netcologne.de Sun Aug 11 22:40:34 2019 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Sun, 11 Aug 2019 22:40:34 +0200 Subject: [Lazarus] Running using lazbuild In-Reply-To: <912FFFE5-E0D9-4B52-8ECA-88E3CEF06EEF@gmail.com> References: <75df381e-d225-ac74-1095-6d8a34abdb62@mfriebe.de> <912FFFE5-E0D9-4B52-8ECA-88E3CEF06EEF@gmail.com> Message-ID: <20190811224034.4b9291cf@limapholos.matflo.wg> On Sun, 11 Aug 2019 14:22:35 -0600 Ryan Joseph via lazarus wrote: > > On Aug 11, 2019, at 2:09 PM, Martin Frb via lazarus > > wrote: > > > > Looks like it did not pick up the widgetset. But it did pick up > > cpu=64bit. > > > > So it attempts carbon for 64 bit, which gives the error. > > Is this a lazbuild bug that could be fixed? I wanted to integrate > lazbuild into my editor but this is a deal breaker for me. Try building with lazbuild --widgetset=cocoa Mattias From genericptr at gmail.com Sun Aug 11 22:44:28 2019 From: genericptr at gmail.com (Ryan Joseph) Date: Sun, 11 Aug 2019 14:44:28 -0600 Subject: [Lazarus] Running using lazbuild In-Reply-To: <20190811224034.4b9291cf@limapholos.matflo.wg> References: <75df381e-d225-ac74-1095-6d8a34abdb62@mfriebe.de> <912FFFE5-E0D9-4B52-8ECA-88E3CEF06EEF@gmail.com> <20190811224034.4b9291cf@limapholos.matflo.wg> Message-ID: <46DD6834-5C39-44F9-8B54-7446613B5353@gmail.com> > On Aug 11, 2019, at 2:40 PM, Mattias Gaertner via lazarus wrote: > > Try building with > lazbuild --widgetset=cocoa Great, that worked. Why didn’t lazbuild do this automatically? As I said I wanted to integrate into my editor but if I need to add extra flags that greatly complicates things for me. Regards, Ryan Joseph From genericptr at gmail.com Sun Aug 11 23:35:06 2019 From: genericptr at gmail.com (Ryan Joseph) Date: Sun, 11 Aug 2019 15:35:06 -0600 Subject: [Lazarus] Running using lazbuild In-Reply-To: <46DD6834-5C39-44F9-8B54-7446613B5353@gmail.com> References: <75df381e-d225-ac74-1095-6d8a34abdb62@mfriebe.de> <912FFFE5-E0D9-4B52-8ECA-88E3CEF06EEF@gmail.com> <20190811224034.4b9291cf@limapholos.matflo.wg> <46DD6834-5C39-44F9-8B54-7446613B5353@gmail.com> Message-ID: <327DCC61-E574-40C6-8829-DDDB22EC4FD9@gmail.com> > On Aug 11, 2019, at 2:44 PM, Ryan Joseph wrote: > > Great, that worked. Why didn’t lazbuild do this automatically? As I said I wanted to integrate into my editor but if I need to add extra flags that greatly complicates things for me. Btw, here is the widget set option in the .lpi file. Lazbuild doesn’t seem to respect it for some reason though. I’m happy to file a bug report if need be. Regards, Ryan Joseph From genericptr at gmail.com Mon Aug 12 04:40:07 2019 From: genericptr at gmail.com (Ryan Joseph) Date: Sun, 11 Aug 2019 20:40:07 -0600 Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> Message-ID: <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> > On Aug 11, 2019, at 1:51 PM, Anthony Walter via lazarus wrote: > > Ryan, > > I was going to modify my project to allow for RESTful queries, when I realized it already does this. The url and format are as follows: > > https://docs.getlazarus.org/?method=codesearch&phrase=TStringList Excellent, thanks for your foresight :). Could it be adapted so that there’s an option to show the page of the top result? For example in the query above a list of links is displayed but it would be better if the top result (https://docs.getlazarus.org/#rtl+classes+tstringlist) was loaded automatically. The fact that “TStringList” shows the correct page as the best result means this will work for 99% of the use cases I have in mind. Regards, Ryan Joseph From genericptr at gmail.com Mon Aug 12 04:44:10 2019 From: genericptr at gmail.com (Ryan Joseph) Date: Sun, 11 Aug 2019 20:44:10 -0600 Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> Message-ID: <59C02459-FD95-4905-B079-E346AA832468@gmail.com> > On Aug 11, 2019, at 1:51 PM, Anthony Walter via lazarus wrote: > > Currently there is no custom formatting applied as this is meant to be an AJAX request to create populate suggestions. As this is an API like RESTful function is this good enough for you or do want a "pretty" result format? > Making a pretty formatted option would be nice also actually. It’s already basically there but a few line breaks would make it more useable. :) Regards, Ryan Joseph From sysrpl at gmail.com Mon Aug 12 05:05:03 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Sun, 11 Aug 2019 23:05:03 -0400 Subject: [Lazarus] getlazarus.org search request In-Reply-To: <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: Ryan, My sites are built on my custom web class library that optionally uses templates to generate content. Templates are simple fill in the blank page type text files which use reflection to pull properties of a objects into the template. Here is how a template is formatted: Search Results: {Phrase} {SearchItems} And a template file for the search item: {Bolden} {Kind} {Description} If you want something specific with regards to layout, just send me a custom template and possibly a css file to make it look however you want. Since I have written this web library myself, its very easy to modify and extend. I might add the ability for anyone to send their own templates and browse or select from templates directly on every page, but that extension is not likely to happen in the next few days. If anyone is interested let me know and I'd produce a short instructional video on how the my web library makes developing web pages easy. The only hard part is writing html and css, which for plain stuff isn't hard at all really. But html and css are design work, so you get out of html and css work is whatever kind of design, taste, and effort you put into it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lazarus at kluug.net Mon Aug 12 06:03:00 2019 From: lazarus at kluug.net (Ondrej Pokorny) Date: Mon, 12 Aug 2019 06:03:00 +0200 Subject: [Lazarus] It is a beautiful day... In-Reply-To: <20190811131212.0a2400f7@limapholos.matflo.wg> References: <6de62608-a05c-c1ae-0e4d-ce3f58ac6285@kluug.net> <20190811122324.316694ba@limapholos.matflo.wg> <8bdd926a-672d-0faf-8c44-1fdc70aac9bf@kluug.net> <20190811131212.0a2400f7@limapholos.matflo.wg> Message-ID: On 11.08.2019 13:12, Mattias Gaertner via lazarus wrote: > On Sun, 11 Aug 2019 12:54:48 +0200 > Ondrej Pokorny via lazarus wrote: > >> The issue is that the new format is done with forwards-compatibility >> so that people can decide if they want to open the new file in an >> older Lazarus version. (The projects have the "Maximize compatibility >> of project files" option for this.) > That an old Lazarus cannot read completely the new format is an > incompatibility I can live with, if it is documented. Thanks, I'll come up with a patch. Best Ondrej From michael at freepascal.org Mon Aug 12 09:04:13 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Mon, 12 Aug 2019 09:04:13 +0200 (CEST) Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: On Sun, 11 Aug 2019, Anthony Walter via lazarus wrote: > Ryan, > > My sites are built on my custom web class library that optionally uses > templates to generate content. Templates are simple fill in the blank page > type text files which use reflection to pull properties of a objects into > the template. I'm a bit surprised you still write custom things for this. All this is available by default in the FPC web classes. Templating is as old as the web, after all. Michael. From sysrpl at gmail.com Mon Aug 12 10:33:11 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Mon, 12 Aug 2019 04:33:11 -0400 Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: Michael, Here is an example of how easy it is. public class CodeSearch : TemplateHandler { private static readonly string searchSql = "search.sql".LoadResourceText(); protected override void Run(Templates templates, StringBuilder output) { SearchItems = DataCommand .Prepare(searchSql) .Add("@phrase", Read("phrase")) .Compose(); templates[Read("format") + "SearchItem"].FormatObject(this, output); } public IEnumerable SearchItems { get; set; } } So given the url, https://docs.getlazarus.org/?method=codesearch&format=xml&phrase=TStringList in steps: 1) The library automatically finds the CodeSearch class without any code to write 2) It runs the template handler automatically 3) In run we execute some SQL to search for a phrase and compose the results as a collection of anonymous objects 4) The we select the template we want and format the CodeSearch object and its available properties, in this case our search result "SearchItems". The FormatObject method is a template engine that uses reflection to lookup properties with mustache braces. It has the ability to query subproperties and use all available format specifiers. Collection properties (IEnumerable ) are expanded by a detail template that can read through reflection the properties of the anonymous objects in the collection by name and template them as well. Here are some template examples. Note you can access sub properties using object.suprop.susubprop syntax as well as custom formatting in the template (i.e. Price:C2 or Page.Modified:yyyyy-mm-dd). {Title} or {Page.Title} // Welcome to our website
Price is {Amount:C2}
// Price is $15.75
Page modified on {Page.Modified:yyyyy-mm-dd}
// Page modified on 2019-07-10
{SeachItems}
// Expands our template -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Mon Aug 12 10:59:25 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Mon, 12 Aug 2019 10:59:25 +0200 (CEST) Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: Ah, but this is C# ? I don't think you need more code in FPC to do the same. But if there are proposals to reduce the amount of code in FPC even more, I'm open for suggestions. Michael. On Mon, 12 Aug 2019, Anthony Walter via lazarus wrote: > Michael, > > Here is an example of how easy it is. > > public class CodeSearch : TemplateHandler > { > private static readonly string searchSql = > "search.sql".LoadResourceText(); > > protected override void Run(Templates templates, StringBuilder > output) > { > SearchItems = DataCommand > .Prepare(searchSql) > .Add("@phrase", Read("phrase")) > .Compose(); > templates[Read("format") + "SearchItem"].FormatObject(this, > output); > } > > public IEnumerable SearchItems { get; set; } > } > > So given the url, > https://docs.getlazarus.org/?method=codesearch&format=xml&phrase=TStringList in > steps: > > 1) The library automatically finds the CodeSearch class without any code to > write > 2) It runs the template handler automatically > 3) In run we execute some SQL to search for a phrase and compose the > results as a collection of anonymous objects > 4) The we select the template we want and format the CodeSearch object and > its available properties, in this case our search result "SearchItems". > > The FormatObject method is a template engine that uses reflection to lookup > properties with mustache braces. It has the ability to query subproperties > and use all available format specifiers. Collection properties (IEnumerable > ) are expanded by a detail template that can read through reflection the > properties of the anonymous objects in the collection by name and template > them as well. > > Here are some template examples. Note you can access sub properties using > object.suprop.susubprop syntax as well as custom formatting in the template > (i.e. Price:C2 or Page.Modified:yyyyy-mm-dd). > > {Title} or {Page.Title} // Welcome to our > website >
Price is {Amount:C2}
// Price is $15.75 >
Page modified on {Page.Modified:yyyyy-mm-dd}
// Page modified on > 2019-07-10 >
{SeachItems}
// Expands our template > From sysrpl at gmail.com Mon Aug 12 11:13:32 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Mon, 12 Aug 2019 05:13:32 -0400 Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: Yes, in C#. Personally I find ASP.NET or Core easier to use than a CGI executable. Also the ability to dynamically compose anonymous objects, write linq expressions, and use reflection can be quite powerful. The object formatting system is C#, where everything is an object and custom formatters can be easily added, allow for the same formatting strings in both compiled code and external template files. As is right now, the only time consuming or potentially difficult part is writing html / css. As I mentioned html / css can be a time sink depending on how much design, taste, and effort you want to put into the actual page spit out in the end. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Mon Aug 12 11:21:20 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Mon, 12 Aug 2019 11:21:20 +0200 (CEST) Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: On Mon, 12 Aug 2019, Anthony Walter via lazarus wrote: > Yes, in C#. Personally I find ASP.NET or Core easier to use than a CGI > executable. I assumed you wrote your classes for FPC. If you use the Microsoft stack, then my remarks are of no importance. Michael. From sysrpl at gmail.com Mon Aug 12 11:28:32 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Mon, 12 Aug 2019 05:28:32 -0400 Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: I use FPC for a lot of web stuff, but generally not for servers. In this project I am using an FPC program to create the database and download updates using my TClientSocket class. For long running stuff, which I may typically host on an Amazon cloud server with Linux, I'll generally either use something from a package (apt or docker) or write a custom service in C# hosted in Kestrel or Apache. Don't worry though, I spend most of my time writing desktop apps, and for that nothing beats FPC + Lazarus ;) -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Mon Aug 12 11:35:55 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Mon, 12 Aug 2019 11:35:55 +0200 (CEST) Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: On Mon, 12 Aug 2019, Anthony Walter via lazarus wrote: > I use FPC for a lot of web stuff, but generally not for servers. In this > project I am using an FPC program to create the database and download > updates using my TClientSocket class. > > For long running stuff, which I may typically host on an Amazon cloud > server with Linux, I'll generally either use something from a package (apt > or docker) or write a custom service in C# hosted in Kestrel or Apache. > > Don't worry though, I spend most of my time writing desktop apps, and for > that nothing beats FPC + Lazarus ;) Well, I use FPC mostly for web, so almost exactly the opposite of what you do. If we put our experiences together, it leads me to the conclusion that FPC+Lazarus effectively covers all scenarios :-) That said, there is of course always room for improvement, so as I said before I'm open for suggestions to make things easier. Michael From mailinglists at geldenhuys.co.uk Mon Aug 12 11:56:04 2019 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Mon, 12 Aug 2019 10:56:04 +0100 Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: <1835e334-a441-b1da-cb2b-696555b0c843@geldenhuys.co.uk> On 12/08/2019 9:33 am, Anthony Walter via lazarus wrote: > public IEnumerable SearchItems { get; set; } I don't know C# at all, but am curious regarding this. What does that "get" and "set" do? It that a shorthand syntax for implementing getters and setters of a field variable? 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 From sysrpl at gmail.com Mon Aug 12 14:02:16 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Mon, 12 Aug 2019 08:02:16 -0400 Subject: [Lazarus] getlazarus.org search request In-Reply-To: <1835e334-a441-b1da-cb2b-696555b0c843@geldenhuys.co.uk> References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> <1835e334-a441-b1da-cb2b-696555b0c843@geldenhuys.co.uk> Message-ID: In C# to define a property you write: visibility typename propname { [visibility] get; [visibility] set; } -or- public int Age { get; set; } This means you have a read write property that does nothing special. You could also write ... private int age; public int Age { get { return age; } set { if (value > -1) age = value; } } To use private a backing with code invoked to set or get. And finally you can also write: public int Age { get; private set; } -or- public int Age { get; private set; } -or- public int Age { get; protected set; } To limit access to either a setter or getter of a property. -------------- next part -------------- An HTML attachment was scrubbed... URL: From md at delfire.net Mon Aug 12 14:19:54 2019 From: md at delfire.net (Marcos Douglas B. Santos) Date: Mon, 12 Aug 2019 09:19:54 -0300 Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: On Mon, Aug 12, 2019 at 6:36 AM Michael Van Canneyt via lazarus wrote: > > [...] FPC+Lazarus effectively covers all scenarios :-) No doubt about that for sure. Marcos Douglas From genericptr at gmail.com Mon Aug 12 17:28:34 2019 From: genericptr at gmail.com (Ryan Joseph) Date: Mon, 12 Aug 2019 09:28:34 -0600 Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: <7F147F34-800D-46CA-B70C-992B5F904D85@gmail.com> > On Aug 11, 2019, at 9:05 PM, Anthony Walter via lazarus wrote: > > Ryan, > > My sites are built on my custom web class library that optionally uses templates to generate content. Templates are simple fill in the blank page type text files which use reflection to pull properties of a objects into the template. > Thanks. I had a better idea. Would it be possible to make a split view where the search results are in a side bar and the main view shows the first result automatically? 99% of the time when I search for TStringList I want the class definition page (and clicking to get to it would be an extra step even) but having a side bar with additional results would make it complete. Regards, Ryan Joseph From fpc at pascalprogramming.org Mon Aug 12 21:18:21 2019 From: fpc at pascalprogramming.org (Marco van de Voort) Date: Mon, 12 Aug 2019 21:18:21 +0200 Subject: [Lazarus] getlazarus.org search request In-Reply-To: References: <93B2ED6D-D1AB-4561-A152-0834AA37E0F0@gmail.com> <16BA60F9-5A12-4775-B158-711529E3E437@gmail.com> Message-ID: <0c7b251c-8011-698b-1dfa-a5424837156b@pascalprogramming.org> Op 2019-08-12 om 11:13 schreef Anthony Walter via lazarus: > Yes, in C#. Personally I find ASP.NET or Core easier > to use than a CGI executable Well, something like ISAPI dlls are inbetween those for a long,long time. From friess at gmx.at Tue Aug 13 09:42:42 2019 From: friess at gmx.at (Andreas =?UTF-8?B?RnJpZcOf?=) Date: Tue, 13 Aug 2019 09:42:42 +0200 Subject: [Lazarus] fpreport: Rendering Report to Printer did not work on RasPi (arm-linux) In-Reply-To: References: Message-ID: Who is the renderer for printer (gtk2/linux/arm) used in fpreport ? The printer itself is cupsprinters (found in OSPrinters). But i have not the glue which renderer is used, because the output in cupsprinters is postscript. Have somebody a hint for the used renderer for me? Or should i file a bug ? With qtprinters it is correct rendered. Andi Andreas Frieß via lazarus wrote: > I have created a report with fpreport (in code) and it works on > Windows (32-bit app) with Rendering to LCLCanvas, PDF  and Printer > without problems. > > On a RasPi with rasbian (on Jessy, Wheezy the same) rendering to > LCLCanvas and PDF works, but on printer it shows not the text. > pictures are correct rendered. The text is not rendered or only some > points, except the footerband.  It looks in some test like the drawn > text is overwritten. > > I have dived a little into fpreport and found out, it must have to do > with Canvas.Textout in TFPReportExportCanvas.RenderMemo. The > parameters of Canvas.TextOut are imho correct, but not the rendered > result. If i change Canvas.TextOut to Canvas.TextRect (as in > designmode) and use the same parameters, the text is written to the > printer, it looks like something goes wrong on arm-linux with > Canvas.TextOut. > From lazarus at kluug.net Thu Aug 15 13:43:58 2019 From: lazarus at kluug.net (Ondrej Pokorny) Date: Thu, 15 Aug 2019 13:43:58 +0200 Subject: [Lazarus] Project Groups are saving LPI files Message-ID: Hello (Mattias)! Project groups are saving my LPI files upon loading the project group. This is a problem because they resave LPIs without BOM and then all LPIs are marked as modified in SVN because they were saved with BOM. (Lazarus IDE saves my project files with BOM.) I searched the reason and found out that TXMLConfig is the problem. There are 2 issues: 1.) TXMLConfig should keep the original encoding along with BOM. 2.) Project groups should never save LPIs. About 2.: The problem is: constructor TXMLConfig.CreateClean(const AFilename: String); begin   //DebugLn(['TXMLConfig.CreateClean ',AFilename]);   fDoNotLoadFromFile:=true;   Create(AFilename);   FModified:=FileExistsCached(AFilename); end; FModified gets True here - why? Is there a reason why the config should be set as Modified on create and consequently be resaved on Free when FileExistsCached returns true? Setting the Modified flag to False in TIDECompileTarget.LoadProject before xml.Free is definitely a fix but IMO it should be fixed within TXMLConfig. --- The above code could be a cause for another problem as well - when the currently open LPI project file is modified externally (e.g. SVN update), Lazarus IDE asks to reload the project but sometimes the LPI file is rewritten by the IDE and the new external changes get lost. I experienced this issue before installing Project groups but could not find clear steps-to-reproduce and could not find the reason for it. Ondrej From bo.berglund at gmail.com Fri Aug 16 10:57:11 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 16 Aug 2019 10:57:11 +0200 Subject: [Lazarus] How to get space before auto-inserted assignment? Message-ID: <8orclep6sp7jppfgr6pp5sbvned0u2jibk@4ax.com> I am used to having whitespace between names and operators, but Lazarus insists on putting := directly after a property when it autocompletes. So I get Canvas.Brush:= instead of Canvas.Brush := Which is what I want. It is annoying to get unwanted help which every time has to be corrected.... Presumably this is an IDE setting, but which? The editor settings is quite a maze to navigate so I would appreciate a hint on where to look. I am using Lazarus 2.0.4 on Windows 7. -- Bo Berglund Developer in Sweden From hdpc at talktalk.net Fri Aug 16 11:22:40 2019 From: hdpc at talktalk.net (Howard Page-Clark) Date: Fri, 16 Aug 2019 10:22:40 +0100 Subject: [Lazarus] How to get space before auto-inserted assignment? In-Reply-To: <8orclep6sp7jppfgr6pp5sbvned0u2jibk@4ax.com> References: <8orclep6sp7jppfgr6pp5sbvned0u2jibk@4ax.com> Message-ID: <5994c681-6f8c-4f05-453a-7e7c84b5fde2@talktalk.net> On 16/08/2019 09:57, Bo Berglund via lazarus wrote: > I am used to having whitespace between names and operators, but > Lazarus insists on putting := directly after a property when it > autocompletes. > So I get Canvas.Brush:= > instead of Canvas.Brush := > Which is what I want. > It is annoying to get unwanted help which every time has to be > corrected.... > Presumably this is an IDE setting, but which? > > The editor settings is quite a maze to navigate so I would appreciate > a hint on where to look. > I am using Lazarus 2.0.4 on Windows 7. Tools->Options dialog In the treeview select the Codetools node, and Space page "Insert space in front of" the Symbol checkbox must be checked. From bo.berglund at gmail.com Fri Aug 16 14:53:21 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 16 Aug 2019 14:53:21 +0200 Subject: [Lazarus] How to get space before auto-inserted assignment? References: <8orclep6sp7jppfgr6pp5sbvned0u2jibk@4ax.com> <5994c681-6f8c-4f05-453a-7e7c84b5fde2@talktalk.net> Message-ID: <8p9dle94rf2lkeafcodo5k2iiv58euosnk@4ax.com> On Fri, 16 Aug 2019 10:22:40 +0100, Howard Page-Clark via lazarus wrote: >> Presumably this is an IDE setting, but which? >> >> I am using Lazarus 2.0.4 on Windows 7. > >Tools->Options dialog > >In the treeview select the Codetools node, and Space page > >"Insert space in front of" the Symbol checkbox must be checked. > Thanks! Now much better... -- Bo Berglund Developer in Sweden From bo.berglund at gmail.com Fri Aug 16 17:20:31 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 16 Aug 2019 17:20:31 +0200 Subject: [Lazarus] Canvas.Rectangle question Message-ID: I would like to know if the rectangle drawn by a Canvas.Rectangle(Rect) call will be sized according to Rect inside of the bounding line or the outside of line? Say the rectangle is (10,4, 30,14) and the Pen.Wdth is set to 2, is the resulting shape 20 x 10 or 24 x 14 in size? -- Bo Berglund Developer in Sweden From dhkblaszyk at gmail.com Fri Aug 16 19:07:33 2019 From: dhkblaszyk at gmail.com (Darius Blaszyk) Date: Fri, 16 Aug 2019 19:07:33 +0200 Subject: [Lazarus] Automatic identifier completion Message-ID: Hi, I know about code completion in the IDE and it works perfectly! However, to invoke it I need to press CRTL-space every time which is somewhat cumbersome. Is there a setting in the IDE that would invoke completion automatically on keypress? An example in sublime: https://packagecontrol.io/readmes/img/7817a05605c38e4d70852b0552f2656251ae12cf.gif TIA! Regards, Darius -------------- next part -------------- An HTML attachment was scrubbed... URL: From mailinglists at geldenhuys.co.uk Fri Aug 16 19:27:02 2019 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Fri, 16 Aug 2019 18:27:02 +0100 Subject: [Lazarus] Canvas.Rectangle question In-Reply-To: References: Message-ID: <7ca443f1-58a4-06ba-f532-4cf2324197d2@geldenhuys.co.uk> On 16/08/2019 4:20 pm, Bo Berglund via lazarus wrote: > Say the rectangle is (10,4, 30,14) and the Pen.Wdth is set to 2, is > the resulting shape 20 x 10 or 24 x 14 in size? This is why fpGUI uses (x, y, width, height) instead of (x1, y1, x2, y2), because the latter is just too confusing. Anyway, I think LCL follows the following design... See the Qt4 documentation. https://doc.qt.io/archives/qt-4.8/qrect.html#rendering 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 From bo.berglund at gmail.com Fri Aug 16 21:01:53 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 16 Aug 2019 21:01:53 +0200 Subject: [Lazarus] Canvas.Rectangle question References: <7ca443f1-58a4-06ba-f532-4cf2324197d2@geldenhuys.co.uk> Message-ID: On Fri, 16 Aug 2019 18:27:02 +0100, Graeme Geldenhuys via lazarus wrote: >On 16/08/2019 4:20 pm, Bo Berglund via lazarus wrote: >> Say the rectangle is (10,4, 30,14) and the Pen.Wdth is set to 2, is >> the resulting shape 20 x 10 or 24 x 14 in size? > >This is why fpGUI uses (x, y, width, height) instead of (x1, y1, x2, >y2), because the latter is just too confusing. > >Anyway, I think LCL follows the following design... See the Qt4 >documentation. > > https://doc.qt.io/archives/qt-4.8/qrect.html#rendering > Thanks for the link! It seems like the border line involved by the pen property is interfering with the sizing of the rectangle... I tested by doing this: Cnv.Pen.Width := 0; Then I ran my code and the resulting rectangle looks better. Hard to say for sure since the pixels are so small... My use case is this: I have written a video editor where I can navigate a video in steps of fixed lengths and also by clicking on a progressbar showing the position in the video. It can also just play the video normally. I can set markers on the start and end of a cut and add it to an array of cuts. Then a buttonclick will generate an ffmpeg command to cut and paste the video to create an edited video with only the cuts included. What I wanted to do then was to place a thin panel below the progressbar where I would paint rectangles at the precise positions of the cuts so far entered to show how the edits are placed. It would show what parts of the video will be included inside the final edited video after ffmpeg processing. I want the display to be as accurate as possible, that is why I started wondering about the actual rectangle size, Seems like if one does not draw the border at all (pen.width = 0) the resulting rectangle will be painted within a pixel correctly placed and sized. I love this list/(newsgroup via GMane), here is always someone to give good advice! :) -- Bo Berglund Developer in Sweden From bo.berglund at gmail.com Fri Aug 16 21:07:52 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 16 Aug 2019 21:07:52 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <4jh9ietplm45rk4q27md8lk0jjoka4g2tg@4ax.com> Message-ID: <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> On Tue, 9 Jul 2019 19:39:23 +0200, Martin Frb via lazarus wrote: >On 09/07/2019 19:03, Bo Berglund via lazarus wrote: >> I have just installed fpc 3.0.4 + Lazarus 2.0.2 from svn sources on a >> pristine Raspberry Pi4B with 4GB RAM. >> >> But now (again) on a first ever start of the newly installed Lazarus I >> am greeted by a pop-up dialog: >> >> Error in EditorMacroScript >> >> It was a while now since I last installed on the bare metal from svn >> but still this problem pops up. It has done that every time I can >> remember and I even posted here back in 2016 about it. >> >> Apparently nothing has been done, and I do not know what the >> pascalscript really does in the IDE so I cannot say if I will be hit >> with some unexplainable error down the road. >> >Yep nothing has been done since.... (Except for me hoping, that one day >I have the time prioritized to install Laz on a RP myself....) >Well the underlying PasScript was updated (not sure if in 2.0.x but in >trunk). But that seems to have done little for arm. > >The error happens once only, the result is stored and EMS disabled. >There is an entry in the Tools > Options to enable it again (or check >the xml files in your conf) > >PasScript sometimes needs to call code from the project (i.e. binary code). >For this it needs to pass params, in the correct registers/stack. Since >that can change (calling convention), the IDE performs a selftest. > >It finds that PS does not work on your platform. > >There is an alternative calling mechanism. I did not test that yet. >Compile the IDE with: >   -dPasMacroNoNativeCalls >Then enable the test again. > >--------- >Before you try that define, check if the following patch (currently >applied) is actually needed >https://github.com/User4martin/pascalscript/commit/269faf94db7be08f243aa1b1f55b28624e0692d5 > >It is something that is not in the original. Not sure though if correct >or not. > >You can also test this patch (or its absence) by running the testcase in >the PascalScript package. Back to this issue again after installing the latest Lazarus 2.0.4 just released. It does the same thing... Is there really nothing one can do to stop it from happening? Yes, I know it just happend once on a new install, but still... -- Bo Berglund Developer in Sweden From lazarus at mfriebe.de Fri Aug 16 22:55:45 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Fri, 16 Aug 2019 22:55:45 +0200 Subject: [Lazarus] Automatic identifier completion In-Reply-To: References: Message-ID: On 16/08/2019 19:07, Darius Blaszyk via lazarus wrote: > Hi, > > I know about code completion in the IDE and it works perfectly! > However, to invoke it I need to press CRTL-space every time which is > somewhat cumbersome. Is there a setting in the IDE that would invoke > completion automatically on keypress? > It can auto invoke after you enter a dot "form1." But otherwise not. See https://bugs.freepascal.org/view.php?id=33054 From lazarus at mfriebe.de Fri Aug 16 23:02:57 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Fri, 16 Aug 2019 23:02:57 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> References: <4jh9ietplm45rk4q27md8lk0jjoka4g2tg@4ax.com> <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> Message-ID: <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> On 16/08/2019 21:07, Bo Berglund via lazarus wrote: > Back to this issue again after installing the latest Lazarus 2.0.4 > just released. > It does the same thing... > Is there really nothing one can do to stop it from happening? Yes, I > know it just happend once on a new install, but still... > > That is on a new install. Not on an update, correct? The default is on. SO it will test, and the test result will be shown. It could be generally disabled on arm. Assuming that it really fails for everybody. Otherwise those for whom it does not fail, will not like it disabled. You can copy the test result file into your config. It should have editormacros in the filename, and after the failed test, it should be in your primary conf folder. Or fix PS for arm... Maybe it will work with that alternative compiler define. (I need to look it up, there are some ifdef in that code). If it does then that could be set for arm. Actually at some point I want to set this for all platforms. But that needs changes to the self test (maybe), and testing on all targets.... And I currently have plenty other stuff to deal with. So I am not working on it. From bo.berglund at gmail.com Fri Aug 16 23:34:43 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 16 Aug 2019 23:34:43 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <4jh9ietplm45rk4q27md8lk0jjoka4g2tg@4ax.com> <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> Message-ID: On Fri, 16 Aug 2019 23:02:57 +0200, Martin Frb via lazarus wrote: > >That is on a new install. Not on an update, correct? It is a new x64 install on Windows 7-x64 using the official installer downloaded via the link in the release message. I installed a secondary installation so I can keep the old for a while. Given I used the "official" installer it should contain "everything" needed for all enabled functions and yet it does not. On Arm (Raspberry Pi units 2-3-4) I always use svn to get the sources and install using my established script for Linux. I did so a few days ago on an RPi4 I got a month ago. But the same dialog on first start as always on RPi... -- Bo Berglund Developer in Sweden From lazarus at mfriebe.de Fri Aug 16 23:57:51 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Fri, 16 Aug 2019 23:57:51 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: References: <4jh9ietplm45rk4q27md8lk0jjoka4g2tg@4ax.com> <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> Message-ID: <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> On 16/08/2019 23:34, Bo Berglund via lazarus wrote: > On Fri, 16 Aug 2019 23:02:57 +0200, Martin Frb via lazarus > wrote: > >> That is on a new install. Not on an update, correct? > It is a new x64 install on Windows 7-x64 using the official installer > downloaded via the link in the release message. I installed a > secondary installation so I can keep the old for a while. > > Given I used the "official" installer it should contain "everything" > needed for all enabled functions and yet it does not. It looks I missed something? I got that you get an error on rasbi/arm. I did not get what issue happens on win64? What is missing? > > On Arm (Raspberry Pi units 2-3-4) I always use svn to get the sources > and install using my established script for Linux. I did so a few days > ago on an RPi4 I got a month ago. > > But the same dialog on first start as always on RPi... I understand the frustration. But I currently cannot test myself on rasberry. And I don't know when I will have the time to change that. I thought I had recently answered to a similar mail about rasbi, including some pointers. But I cannot find that mail.... So questions here again: 1) Does editor macro work (self test passed / enabled in global options), if you remove the following changeset: https://github.com/User4martin/pascalscript/commit/269faf94db7be08f243aa1b1f55b28624e0692d5 Ideally also run the testcase in the componet/pascalscript dir. But I leave that optional. 2) Does it work if the IDE (or relevant packages) are compiled with: -dPasMacroNoNativeCalls (That does not affect the test in the pascalscript dir) 3) If both are applied? From dhkblaszyk at gmail.com Sat Aug 17 01:19:18 2019 From: dhkblaszyk at gmail.com (Darius Blaszyk) Date: Sat, 17 Aug 2019 01:19:18 +0200 Subject: [Lazarus] Automatic identifier completion In-Reply-To: References: Message-ID: This patch seems to realize exactly the behavior I described. However, I tried applying it and about one third to half of it failed as it is fairly old. There are really not many visual leads for me in the current code to position the changes, so I guess that I won't be able to create a new updated patch, based on the existing patch. There must be good reasons why this feature is not yet implemented, but for me (Iḿ sure others as well, as all major IDE's support it by default) this will boost productivity when working with Lazarus. On Fri, Aug 16, 2019 at 10:55 PM Martin Frb via lazarus < lazarus at lists.lazarus-ide.org> wrote: > On 16/08/2019 19:07, Darius Blaszyk via lazarus wrote: > > Hi, > > > > I know about code completion in the IDE and it works perfectly! > > However, to invoke it I need to press CRTL-space every time which is > > somewhat cumbersome. Is there a setting in the IDE that would invoke > > completion automatically on keypress? > > > It can auto invoke after you enter a dot "form1." > But otherwise not. > > See https://bugs.freepascal.org/view.php?id=33054 > -- > _______________________________________________ > lazarus mailing list > lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mailinglists at geldenhuys.co.uk Sat Aug 17 01:25:29 2019 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Sat, 17 Aug 2019 00:25:29 +0100 Subject: [Lazarus] Canvas.Rectangle question In-Reply-To: References: <7ca443f1-58a4-06ba-f532-4cf2324197d2@geldenhuys.co.uk> Message-ID: <78d9f6d9-5299-1598-1ff5-1a9c7282c9b5@geldenhuys.co.uk> On 16/08/2019 8:01 pm, Bo Berglund via lazarus wrote: > Seems like if one does not draw the border at all (pen.width = 0) the > resulting rectangle will be painted within a pixel correctly placed > and sized. If I recall correctly, both Win32 and XLib will render a line with the thinnest possible width, when you set Pen.Width = 0. But it's been a while since I read those docs, so don't hold me to it. ;-) I don't know what OSX does. 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 From bo.berglund at gmail.com Sat Aug 17 10:03:43 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Sat, 17 Aug 2019 10:03:43 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <4jh9ietplm45rk4q27md8lk0jjoka4g2tg@4ax.com> <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> Message-ID: On Fri, 16 Aug 2019 23:57:51 +0200, Martin Frb via lazarus wrote: >On 16/08/2019 23:34, Bo Berglund via lazarus wrote: >> On Fri, 16 Aug 2019 23:02:57 +0200, Martin Frb via lazarus >> wrote: >> >>> That is on a new install. Not on an update, correct? >> It is a new x64 install on Windows 7-x64 using the official installer >> downloaded via the link in the release message. I installed a >> secondary installation so I can keep the old for a while. >> >> Given I used the "official" installer it should contain "everything" >> needed for all enabled functions and yet it does not. >It looks I missed something? I got that you get an error on rasbi/arm. > >I did not get what issue happens on win64? What is missing? > > >> >> On Arm (Raspberry Pi units 2-3-4) I always use svn to get the sources >> and install using my established script for Linux. I did so a few days >> ago on an RPi4 I got a month ago. >> >> But the same dialog on first start as always on RPi... >I understand the frustration. But I currently cannot test myself on >rasberry. And I don't know when I will have the time to change that. It is really not a very big issue, since it goes away after first start of Lazarus after the installation. It does not show up after IDE rebuild following a package installation for example. And because of the disabling I have never ever used it, whatever it is. But since I saw the pop-up again when dealing with 2.0.4 on both RPi and Windows I thought I would mention it.... On Windows I used the official installer and on RPi I used svn to get the sources and compiled myself. Same result. >I thought I had recently answered to a similar mail about rasbi, >including some pointers. But I cannot find that mail.... Here is where the GMane news mirror of this mail list is so very useful. I have a complete archive starting Sept 2003 of the Lazarus and freepascal lists in my newsreader's cached data, so I can search and find anything without even being on-line.... Your reply a month ago below. >So questions here again: > >1) >Does editor macro work (self test passed / enabled in global options), >if you remove the following changeset: >https://github.com/User4martin/pascalscript/commit/269faf94db7be08f243aa1b1f55b28624e0692d5 > >Ideally also run the testcase in the componet/pascalscript dir. But I >leave that optional. > >2) Does it work if the IDE (or relevant packages) are compiled with: >-dPasMacroNoNativeCalls > >(That does not affect the test in the pascalscript dir) > >3) If both are applied? I don't even know what the macro system is used for or how to invoke it since on *every* Lazarus install I have done I have encountered the dialog that disables it... So I cannot test. But it seems I can program OK in the IDE without it. Here is your first reply in this thread taken from my news archive: ------------------ 2019-07-09 ------------------------------------- On 09/07/2019 19:03, Bo Berglund via lazarus wrote: > I have just installed fpc 3.0.4 + Lazarus 2.0.2 from svn sources on a > pristine Raspberry Pi4B with 4GB RAM. > > But now (again) on a first ever start of the newly installed Lazarus I > am greeted by a pop-up dialog: > > Error in EditorMacroScript > > It was a while now since I last installed on the bare metal from svn > but still this problem pops up. It has done that every time I can > remember and I even posted here back in 2016 about it. > > Apparently nothing has been done, and I do not know what the > pascalscript really does in the IDE so I cannot say if I will be hit > with some unexplainable error down the road. > Yep nothing has been done since.... (Except for me hoping, that one day I have the time prioritized to install Laz on a RP myself....) Well the underlying PasScript was updated (not sure if in 2.0.x but in trunk). But that seems to have done little for arm. The error happens once only, the result is stored and EMS disabled. There is an entry in the Tools > Options to enable it again (or check the xml files in your conf) PasScript sometimes needs to call code from the project (i.e. binary code). For this it needs to pass params, in the correct registers/stack. Since that can change (calling convention), the IDE performs a selftest. It finds that PS does not work on your platform. There is an alternative calling mechanism. I did not test that yet. Compile the IDE with:   -dPasMacroNoNativeCalls Then enable the test again. --------- Before you try that define, check if the following patch (currently applied) is actually needed https://github.com/User4martin/pascalscript/commit/269faf94db7be08f243aa1b1f55b28624e0692d5 It is something that is not in the original. Not sure though if correct or not. You can also test this patch (or its absence) by running the testcase in the PascalScript package. ------------------------------------------------------------------ -- Bo Berglund Developer in Sweden From bo.berglund at gmail.com Sat Aug 17 10:09:05 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Sat, 17 Aug 2019 10:09:05 +0200 Subject: [Lazarus] Automatic identifier completion References: Message-ID: On Fri, 16 Aug 2019 22:55:45 +0200, Martin Frb via lazarus wrote: >On 16/08/2019 19:07, Darius Blaszyk via lazarus wrote: >> Hi, >> >> I know about code completion in the IDE and it works perfectly! >> However, to invoke it I need to press CRTL-space every time which is >> somewhat cumbersome. Is there a setting in the IDE that would invoke >> completion automatically on keypress? >> >It can auto invoke after you enter a dot "form1." >But otherwise not. I have found that in order to get a list of available methods and properties of an identifier to select from you have to stop for a second or two after typing in its name until the IDE sort of "selects" the identifier (it will get a grayish background). Then when you hit the period the list appears. But if you type the period immediately after the object name nothing happens.... -- Bo Berglund Developer in Sweden From lazarus at mfriebe.de Sat Aug 17 11:41:01 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 17 Aug 2019 11:41:01 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: References: <4jh9ietplm45rk4q27md8lk0jjoka4g2tg@4ax.com> <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> Message-ID: On 17/08/2019 10:03, Bo Berglund via lazarus wrote: > On Fri, 16 Aug 2019 23:57:51 +0200, Martin Frb via lazarus > wrote: >> On 16/08/2019 23:34, Bo Berglund via lazarus wrote: >>> Given I used the "official" installer it should contain "everything" >>> needed for all enabled functions and yet it does not. >> It looks I missed something? I got that you get an error on rasbi/arm. >> >> I did not get what issue happens on win64? What is missing? I still do not know what error you get on win7/64 bit.... >> So questions here again: >> >> 1) >> Does editor macro work (self test passed / enabled in global options), >> if you remove the following changeset: >> https://github.com/User4martin/pascalscript/commit/269faf94db7be08f243aa1b1f55b28624e0692d5 >> >> Ideally also run the testcase in the componet/pascalscript dir. But I >> leave that optional. >> >> 2) Does it work if the IDE (or relevant packages) are compiled with: >> -dPasMacroNoNativeCalls >> >> (That does not affect the test in the pascalscript dir) >> >> 3) If both are applied? > > I don't even know what the macro system is used for or how to invoke > it since on *every* Lazarus install I have done I have encountered the > dialog that disables it... > So I cannot test. But it seems I can program OK in the IDE without it. You can record "EditorMacros" in the IDE. That is a series of commands to the Editor. And then replay it as often as needed. The basic macro work without PascalScript. So the basic will work for you: https://wiki.lazarus.freepascal.org/IDE_Window:_Editor_Macros With PascalScript you can do more complex Macros. https://wiki.lazarus.freepascal.org/Editor_Macros_PascalScript As for "it works". It should work if it passes the self-test at IDE startup. Tools > Options > Editor Macro Script > Status If it says "Scripting active" then it passed the self test. > Here is your first reply in this thread taken from my news archive: > So that was the same/similar reply From bo.berglund at gmail.com Sat Aug 17 13:31:58 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Sat, 17 Aug 2019 13:31:58 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <4jh9ietplm45rk4q27md8lk0jjoka4g2tg@4ax.com> <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> Message-ID: On Sat, 17 Aug 2019 11:41:01 +0200, Martin Frb via lazarus wrote: >>> I did not get what issue happens on win64? What is missing? >I still do not know what error you get on win7/64 bit.... Exactly the same as on RPi as I described on my first post in this thread back in July 9: Error in EditorMacroScript The package EditorMacroScript (pascalscript macros) has detected a problem and was deactivated. The package failed its selftest with the message: "Replace All [Exp: True / Got: False]" [OK] Upon starting the Lazarus IDE the first time this dialog box pops up saying the macro stuff will be deactivated. It works the same on Raspbian and Windows. If I remember correctly at first there is the dialog informing about the various parts of fpc it has found (sources etc), then the error dialog pops up. Both will only show on the very first start after installation. -- Bo Berglund Developer in Sweden From lazarus at mfriebe.de Sat Aug 17 14:00:26 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 17 Aug 2019 14:00:26 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: References: <4jh9ietplm45rk4q27md8lk0jjoka4g2tg@4ax.com> <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> Message-ID: <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> On 17/08/2019 13:31, Bo Berglund via lazarus wrote: > On Sat, 17 Aug 2019 11:41:01 +0200, Martin Frb via lazarus > wrote: > >>>> I did not get what issue happens on win64? What is missing? >> I still do not know what error you get on win7/64 bit.... > Exactly the same as on RPi as I described on my first post in this > thread back in July 9: > > Error in EditorMacroScript > The package EditorMacroScript (pascalscript macros) > has detected a problem and was deactivated. > The package failed its selftest with the message: > "Replace All [Exp: True / Got: False]" > [OK] > > Strange. I would expect it to be the same on win7/64 and win10/64. Especially since you get it on first start, with the pre-build lazarus.exe, which is the same exe that I tested with (and it works for me/ win10) Could you apply the following patch please: https://github.com/User4martin/lazarus/commit/5fa7fac42bb55d23b9654984be1e2e1c08049709 (this can be applied to any 2.0.x) Recompile the IDE, under Tools > Option > Editor Macro... >> "Test again", and restart the IDE. You should get a more verbose error. Thanks From lazarus at mfriebe.de Sat Aug 17 14:12:02 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 17 Aug 2019 14:12:02 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> References: <4jh9ietplm45rk4q27md8lk0jjoka4g2tg@4ax.com> <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> Message-ID: On 17/08/2019 14:00, Martin Frb via lazarus wrote: > > Could you apply the following patch please: > https://github.com/User4martin/lazarus/commit/5fa7fac42bb55d23b9654984be1e2e1c08049709 Or the patch/commit from latest trunk. Added the verbose to all tests From bo.berglund at gmail.com Sat Aug 17 15:31:50 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Sat, 17 Aug 2019 15:31:50 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> Message-ID: On Sat, 17 Aug 2019 14:12:02 +0200, Martin Frb via lazarus wrote: >On 17/08/2019 14:00, Martin Frb via lazarus wrote: >> >> Could you apply the following patch please: >> https://github.com/User4martin/lazarus/commit/5fa7fac42bb55d23b9654984be1e2e1c08049709 > >Or the patch/commit from latest trunk. Added the verbose to all tests This is somehing I have never done... Could you please explain what you mean I should do in order to "apply the patch"? Step by step please. -- Bo Berglund Developer in Sweden From lazarus at mfriebe.de Sat Aug 17 16:43:38 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 17 Aug 2019 16:43:38 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: References: <9kvdlepnbktulf43haqe687lgjcd650kio@4ax.com> <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> Message-ID: On 17/08/2019 15:31, Bo Berglund via lazarus wrote: > On Sat, 17 Aug 2019 14:12:02 +0200, Martin Frb via lazarus > wrote: > >> On 17/08/2019 14:00, Martin Frb via lazarus wrote: >>> Could you apply the following patch please: >>> https://github.com/User4martin/lazarus/commit/5fa7fac42bb55d23b9654984be1e2e1c08049709 >> Or the patch/commit from latest trunk. Added the verbose to all tests > This is somehing I have never done... > Could you please explain what you mean I should do in order to "apply > the patch"? > Step by step please. > I attached a ready to go replacement file. Make a copy of your original   components/macroscript/emsselftest.pas and then put the attached file into it. Tools > Option > editor macro script : "Test again"    (this deletes/reset editormacroscript.xml from your primary conf, which is the file that stores the error) Tools > Rebuild Lazarus IDE Restart The new error should be shown on IDE start. -------- Applying patches (not needed for the above) 1) If it is just a few lines, locate them in your source and edit them. githup shows the line number and changes 2) Download as a patch. Now here is the thing: GitHUB (not git) is actually not as good as in is often praised. There seems to be no intuitive way to get an actual patch. I assumed there would be a button. Sorry about that, but github is not normally my turf. From what I found one has to append .diff to the url https://github.com/User4martin/lazarus/commit/5fa7fac42bb55d23b9654984be1e2e1c08049709.diff That can be saved, and then   cd lazarus   patch -p1 < the_file.patch The -p1 strips one leading folder from --- a/components/macroscript/emsselftest.pas +++ b/components/macroscript/emsselftest.pas In this case the "a/" If you did cd lazarus/components and therefore you file was macroscript/emsselftest.pas then you would need -p2 and so on you can do --dry-run -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- unit EMSSelfTest; {$mode objfpc}{$H+} interface {$IFDEF darwin} {$DEFINE NeedTPointFix } {$ENDIF} uses Classes, SysUtils, SynEdit, LazLoggerBase, IDECommands, EMScriptClasses, EMScriptMacro, Clipbrd, Dialogs, Controls, uPSCompiler, uPSRuntime, uPSUtils; type TEMScriptSelfTestException = Exception; { TEMSTPSTestExec } TEMSTPSTestExec = class(TEMSTPSExec) protected procedure AddFuncToExec; override; public end; { TEMSPSTestPascalCompiler } TEMSPSTestPascalCompiler = class(TEMSPSPascalCompiler) private FNextOnUses: TPSOnUses; public constructor Create; end; { TEMSelfTestEditorMacro } TEMSelfTestEditorMacro = class(TEMSEditorMacro) public constructor Create(aOwner: TComponent); override; end; function DoSelfTest: Boolean; var SelfTestErrorMsg: String; implementation {$IFDEF NeedTPointFix} type TPoint2 = record x,y,a,b,c: Longint; end; {$ENDIF} {%region RegisterSelfTests} var {%H-}TestResultA: integer; TestResultInt1, TestResultInt2: integer; TestInputInt1, TestInputInt2: integer; TestResultBool1, TestResultBool2: boolean; TestInputBool1, TestInputBool2: boolean; TestResultStr1, TestResultStr2: String; TestInputStr1, TestInputStr2: String; function test_ord_mt(AType: TMsgDlgType): Integer; begin Result := ord(AType); TestResultA := Result; end; function test_ord_mb(ABtn: TMsgDlgBtn): Integer; begin Result := ord(ABtn); TestResultA := Result; end; procedure test_int1(AValue: Integer); begin TestResultInt1 := AValue; end; procedure test_int2(AValue: Integer); begin TestResultInt2 := AValue; end; function test_getint1: Integer; begin Result := TestInputInt1; end; function test_getint2: Integer; begin Result := TestInputInt2; end; procedure test_varint1(var AValue: Integer); begin TestResultInt1 := AValue; AValue := TestInputInt1; end; procedure test_bool1(AValue: boolean); begin TestResultBool1 := AValue; end; procedure test_bool2(AValue: boolean); begin TestResultBool2 := AValue; end; function test_getbool1: Boolean; begin Result := TestInputBool1; end; function test_getbool2: Boolean; begin Result := TestInputBool2; end; procedure test_point(AValue: TPoint); begin TestResultInt1 := AValue.X; TestResultInt2 := AValue.Y; end; function test_getpoint: {$IFDEF NeedTPointFix}TPoint2{$ELSE}TPoint{$ENDIF}; begin Result.X := TestInputInt1; Result.Y := TestInputInt2; end; procedure test_varpoint(var AValue: TPoint); begin TestResultInt1 := AValue.X; TestResultInt2 := AValue.Y; AValue.X := TestInputInt1; AValue.Y := TestInputInt2; end; procedure test_str1(AValue: String); begin TestResultStr1 := AValue; end; procedure test_str2(AValue: String); begin TestResultStr2 := AValue; end; function test_getstr1: String; begin Result := TestInputStr1; end; function test_getstr2: String; begin Result := TestInputStr2; end; procedure test_varstr1(var AValue: String); begin TestResultStr1 := AValue; AValue := TestInputStr1; end; const Decltest_ord_mt = 'function test_ord_mt(AType: TMsgDlgType): Integer;'; Decltest_ord_mb = 'function test_ord_mb(ABtn: TMsgDlgBtn): Integer;'; Decltest_int1 = 'procedure test_int1(AValue: Integer);'; Decltest_int2 = 'procedure test_int2(AValue: Integer);'; Decltest_getint1 = 'function test_getint1: Integer;'; Decltest_getint2 = 'function test_getint2: Integer;'; Decltest_varint1 = 'procedure test_varint1(var AValue: Integer);'; Decltest_bool1 = 'procedure test_bool1(AValue: Boolean);'; Decltest_bool2 = 'procedure test_bool2(AValue: Boolean);'; Decltest_getbool1 = 'function test_getbool1: Boolean;'; Decltest_getbool2 = 'function test_getbool2: Boolean;'; Decltest_point = 'procedure test_point(AValue: TPoint);'; Decltest_getpoint = 'function test_getpoint: TPoint;'; Decltest_varpoint = 'procedure test_varpoint(var AValue: TPoint);'; Decltest_str1 = 'procedure test_str1(AValue: String);'; Decltest_str2 = 'procedure test_str2(AValue: String);'; Decltest_getstr1 = 'function test_getstr1: String;'; Decltest_getstr2 = 'function test_getstr2: String;'; Decltest_varstr1 = 'procedure test_varstr1(var AValue: String);'; Functest_ord_mt: function(AType: TMsgDlgType): Integer = @test_ord_mt; Functest_ord_mb: function(ABtn: TMsgDlgBtn): Integer = @test_ord_mb; Proctest_int1: procedure (AValue: Integer) = @test_int1; Proctest_int2: procedure (AValue: Integer) = @test_int2; Proctest_getint1: function: Integer = @test_getint1; Proctest_getint2: function: Integer = @test_getint2; Proctest_varint1: procedure (var AValue: Integer) = @test_varint1; Proctest_bool1: procedure (AValue: Boolean) = @test_bool1; Proctest_bool2: procedure (AValue: Boolean) = @test_bool2; Proctest_getbool1: function: Boolean = @test_getbool1; Proctest_getbool2: function: Boolean = @test_getbool2; Proctest_point: procedure (AValue: TPoint) = @test_point; Proctest_getpoint: function: {$IFDEF NeedTPointFix}TPoint2{$ELSE}TPoint{$ENDIF} = @test_getpoint; Proctest_varpoint: procedure (var AValue: TPoint) = @test_varpoint; Proctest_str1: procedure (AValue: String) = @test_str1; Proctest_str2: procedure (AValue: String) = @test_str2; Proctest_getstr1: function: String = @test_getstr1; Proctest_getstr2: function: String = @test_getstr2; Proctest_varstr1: procedure (var AValue: String) = @test_varstr1; {$IFDEF PasMacroNoNativeCalls} const Id_test_ord_mb = 901; Id_test_ord_mt = 902; Id_test_int1 = 910; Id_test_int2 = 911; Id_test_getint1 = 912; Id_test_getint2 = 913; Id_test_varint1 = 914; Id_test_bool1 = 920; Id_test_bool2 = 921; Id_test_getbool1 = 922; Id_test_getbool2 = 923; Id_test_point = 930; Id_test_getpoint = 931; Id_test_varpoint = 932; Id_test_str1 = 940; Id_test_str2 = 941; Id_test_getstr1 = 942; Id_test_getstr2 = 943; Id_test_varstr1 = 944; function ExecTestHandler({%H-}Caller: TPSExec; p: TPSExternalProcRec; {%H-}Global, Stack: TPSStack): Boolean; var data: PPoint; i: integer; s: TbtString; begin Result := True; case Longint(p.Ext1) of Id_test_ord_mb: begin // test_ord_mb(ABtn: TMsgDlgBtn): Integer; if Stack.Count < 2 then raise TEMScriptBadParamException.Create('Invalid param count for "test_ord_mb"'); Stack.SetInt(-1, test_ord_mb(TMsgDlgBtn(Stack.GetUInt(-2))) ); end; Id_test_ord_mt: begin // test_ord_mt(AType: TMsgDlgType): Integer; if Stack.Count < 2 then raise TEMScriptBadParamException.Create('Invalid param count for "test_ord_mt"'); // Stack[Stack.Count-2]^.FType.ExportName = 'TMSGDLGTYPE' Stack.SetInt(-1, test_ord_mt(TMsgDlgType(Stack.GetUInt(-2))) ); end; Id_test_int1: begin // test_int1(AValue: Integer); if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_int1"'); test_int1(Stack.GetUInt(-1)); end; Id_test_int2: begin // test_int2(AValue: Integer); if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_int2"'); test_int2(Stack.GetUInt(-1)); end; Id_test_getint1: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_getint1"'); Stack.SetInt(-1, test_getint1()); end; Id_test_getint2: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_getint2"'); Stack.SetInt(-1, test_getint2()); end; Id_test_varint1: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_int1"'); i := Stack.GetInt(-1); test_varint1(i); Stack.SetInt(-1, i); end; Id_test_bool1: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_bool1()"'); test_bool1(Stack.GetBool(-1)); end; Id_test_bool2: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_bool2()"'); test_bool2(Stack.GetBool(-1)); end; Id_test_getbool1: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_getbool1"'); Stack.SetBool(-1, test_getbool1()); end; Id_test_getbool2: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_getbool2"'); Stack.SetBool(-1, test_getbool2()); end; Id_test_point: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_point()"'); test_point(GetPointFromStack(Stack, -1)); end; Id_test_getpoint: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_getpoint"'); data := GetVarPointFromStack(Stack, -1); TPoint(data^) := test_getpoint; end; Id_test_varpoint: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_getpoint"'); data := GetVarPointFromStack(Stack, -1); test_varpoint(TPoint(data^)); end; Id_test_str1: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_str1()"'); test_str1(Stack.GetAnsiString(-1)); end; Id_test_str2: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_str2()"'); test_str2(Stack.GetAnsiString(-1)); end; Id_test_getstr1: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_getstr1"'); Stack.SetAnsiString(-1, test_getstr1()); end; Id_test_getstr2: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_getstr2"'); Stack.SetAnsiString(-1, test_getstr2()); end; Id_test_varstr1: begin if Stack.Count < 1 then raise TEMScriptBadParamException.Create('Invalid param count for "test_str1()"'); s := Stack.GetAnsiString(-1); test_varstr1(s); Stack.SetAnsiString(-1, s); end; else Result := False; end; end; {$ENDIF} procedure CompRegisterSelfTests(AComp: TPSPascalCompiler); begin // for tests AComp.AddDelphiFunction(Decltest_ord_mb); AComp.AddDelphiFunction(Decltest_ord_mt); AComp.AddDelphiFunction(Decltest_int1); AComp.AddDelphiFunction(Decltest_int2); AComp.AddDelphiFunction(Decltest_getint1); AComp.AddDelphiFunction(Decltest_getint2); AComp.AddDelphiFunction(Decltest_varint1); AComp.AddDelphiFunction(Decltest_bool1); AComp.AddDelphiFunction(Decltest_bool2); AComp.AddDelphiFunction(Decltest_getbool1); AComp.AddDelphiFunction(Decltest_getbool2); AComp.AddDelphiFunction(Decltest_point); AComp.AddDelphiFunction(Decltest_getpoint); AComp.AddDelphiFunction(Decltest_varpoint); AComp.AddDelphiFunction(Decltest_str1); AComp.AddDelphiFunction(Decltest_str2); AComp.AddDelphiFunction(Decltest_getstr1); AComp.AddDelphiFunction(Decltest_getstr2); AComp.AddDelphiFunction(Decltest_varstr1); end; procedure ExecRegisterSelfTests(AExec: TEMSTPSExec); begin // for tests {$IFnDEF PasMacroNoNativeCalls} AExec.RegisterDelphiFunction(Functest_ord_mb, 'test_ord_mb', cdRegister); AExec.RegisterDelphiFunction(Functest_ord_mt, 'test_ord_mt', cdRegister); AExec.RegisterDelphiFunction(Proctest_int1, 'test_int1', cdRegister); AExec.RegisterDelphiFunction(Proctest_int2, 'test_int2', cdRegister); AExec.RegisterDelphiFunction(Proctest_getint1, 'test_getint1', cdRegister); AExec.RegisterDelphiFunction(Proctest_getint2, 'test_getint2', cdRegister); AExec.RegisterDelphiFunction(Proctest_varint1, 'test_varint1', cdRegister); AExec.RegisterDelphiFunction(Proctest_bool1, 'test_bool1', cdRegister); AExec.RegisterDelphiFunction(Proctest_bool2, 'test_bool2', cdRegister); AExec.RegisterDelphiFunction(Proctest_getbool1, 'test_getbool1', cdRegister); AExec.RegisterDelphiFunction(Proctest_getbool2, 'test_getbool2', cdRegister); AExec.RegisterDelphiFunction(Proctest_point, 'test_point', cdRegister); AExec.RegisterDelphiFunction(Proctest_getpoint, 'test_getpoint', cdRegister); AExec.RegisterDelphiFunction(Proctest_varpoint, 'test_varpoint', cdRegister); AExec.RegisterDelphiFunction(Proctest_str1, 'test_str1', cdRegister); AExec.RegisterDelphiFunction(Proctest_str2, 'test_str2', cdRegister); AExec.RegisterDelphiFunction(Proctest_getstr1, 'test_getstr1', cdRegister); AExec.RegisterDelphiFunction(Proctest_getstr2, 'test_getstr2', cdRegister); AExec.RegisterDelphiFunction(Proctest_varstr1, 'test_varstr1', cdRegister); {$ELSE} AExec.RegisterFunctionName('test_ord_mb', @ExecTestHandler, Pointer(Id_test_ord_mb), nil); AExec.RegisterFunctionName('test_ord_mt', @ExecTestHandler, Pointer(Id_test_ord_mt), nil); AExec.RegisterFunctionName('test_int1', @ExecTestHandler, Pointer(Id_test_int1), nil); AExec.RegisterFunctionName('test_int2', @ExecTestHandler, Pointer(Id_test_int2), nil); AExec.RegisterFunctionName('test_getint1', @ExecTestHandler, Pointer(Id_test_getint1), nil); AExec.RegisterFunctionName('test_getint2', @ExecTestHandler, Pointer(Id_test_getint2), nil); AExec.RegisterFunctionName('test_varint1', @ExecTestHandler, Pointer(Id_test_varint1), nil); AExec.RegisterFunctionName('test_bool1', @ExecTestHandler, Pointer(Id_test_bool1), nil); AExec.RegisterFunctionName('test_bool2', @ExecTestHandler, Pointer(Id_test_bool2), nil); AExec.RegisterFunctionName('test_getbool1', @ExecTestHandler, Pointer(Id_test_getbool1), nil); AExec.RegisterFunctionName('test_getbool2', @ExecTestHandler, Pointer(Id_test_getbool2), nil); AExec.RegisterFunctionName('test_point', @ExecTestHandler, Pointer(Id_test_point), nil); AExec.RegisterFunctionName('test_getpoint', @ExecTestHandler, Pointer(Id_test_getpoint), nil); AExec.RegisterFunctionName('test_varpoint', @ExecTestHandler, Pointer(Id_test_varpoint), nil); AExec.RegisterFunctionName('test_str1', @ExecTestHandler, Pointer(Id_test_str1), nil); AExec.RegisterFunctionName('test_str2', @ExecTestHandler, Pointer(Id_test_str2), nil); AExec.RegisterFunctionName('test_getstr1', @ExecTestHandler, Pointer(Id_test_getstr1), nil); AExec.RegisterFunctionName('test_getstr2', @ExecTestHandler, Pointer(Id_test_getstr2), nil); AExec.RegisterFunctionName('test_varstr1', @ExecTestHandler, Pointer(Id_test_varstr1), nil); {$ENDIF} end; {%endregion RegisterSelfTests} { TEMSPSTestPascalCompiler } function CompilerOnUses(Sender: TPSPascalCompiler; const Name: TbtString): Boolean; var S: TEMSPSTestPascalCompiler; begin S := (Sender as TEMSPSTestPascalCompiler); Result := assigned(S.FNextOnUses) and S.FNextOnUses(Sender, Name); if Result and (Name = 'SYSTEM') then begin CompRegisterSelfTests(S); Result := True; end; end; constructor TEMSPSTestPascalCompiler.Create; begin inherited Create; FNextOnUses := OnUses; OnUses := @CompilerOnUses; end; { TEMSTPSTestExec } procedure TEMSTPSTestExec.AddFuncToExec; begin inherited AddFuncToExec; ExecRegisterSelfTests(Self); end; { TEMSelfTestEditorMacro } constructor TEMSelfTestEditorMacro.Create(aOwner: TComponent); begin inherited Create(aOwner); Compiler := TEMSPSTestPascalCompiler.Create; Exec := TEMSTPSTestExec.Create; end; type THackTEMSEditorMacro = class(TEMSEditorMacro) end; function DoSelfTest: Boolean; var m: TEMSEditorMacro; syn: TSynEdit; procedure RunMacro(AText: String); begin m.SetFromSource(AText); m.PlaybackMacro(syn); end; procedure AssertEQ(Msg: String; Exp, Got: String); overload; begin if not(Got = Exp) then raise TEMScriptSelfTestException.Create(Format('%s [Exp: "%s" / Got: "%s" / Info: %s / SynTxt: %s]', [Msg, Exp, Got, dbgs(m.IsInvalid) + ' ' + THackTEMSEditorMacro(m).GetErrorMsg, syn.Text])); end; procedure AssertEQ(Msg: String; Exp, Got: Integer); overload; begin if not(Got = Exp) then raise TEMScriptSelfTestException.Create(Format('%s [Exp: %d / Got: %d / Info: %s / SynTxt: %s]', [Msg, Exp, Got, dbgs(m.IsInvalid) + ' ' + THackTEMSEditorMacro(m).GetErrorMsg, syn.Text])); end; procedure AssertEQ(Msg: String; Exp, Got: Boolean); overload; begin if not(Got = Exp) then raise TEMScriptSelfTestException.Create(Format('%s [Exp: %s / Got: %s / Info: %s / SynTxt: %s]', [Msg, dbgs(Exp), dbgs(Got), dbgs(m.IsInvalid) + ' ' + THackTEMSEditorMacro(m).GetErrorMsg, syn.Text])); end; procedure TestInt(Msg, AText: String; Exp: Integer); begin TestResultInt1 := 0; RunMacro(AText); AssertEQ(Msg + '(init: 0)', Exp, TestResultInt1); TestResultInt1 := -1; RunMacro(AText); AssertEQ(Msg + '(init: -1)', Exp, TestResultInt1); TestResultInt1 := 99919; RunMacro(AText); AssertEQ(Msg + '(init: 99919)', Exp, TestResultInt1); end; procedure TestBool(Msg, AText: String; Exp: Boolean); begin TestResultBool1 := False; RunMacro(AText); AssertEQ(Msg + '(init: F)', Exp, TestResultBool1); TestResultBool1 := True; RunMacro(AText); AssertEQ(Msg + '(init: T)', Exp, TestResultBool1); end; procedure TestBool(Msg, AText: String; Exp, Exp2: Boolean); begin TestResultBool1 := False; TestResultBool2 := False; RunMacro(AText); AssertEQ(Msg + '(init: F,F)', Exp, TestResultBool1); AssertEQ(Msg + '(init: F,F)', Exp2, TestResultBool2); TestResultBool1 := True; TestResultBool2 := True; RunMacro(AText); AssertEQ(Msg + '(init: T,T)', Exp, TestResultBool1); AssertEQ(Msg + '(init: T,T)', Exp2, TestResultBool2); TestResultBool1 := True; TestResultBool2 := False; RunMacro(AText); AssertEQ(Msg + '(init: T,F)', Exp, TestResultBool1); AssertEQ(Msg + '(init: T,F)', Exp2, TestResultBool2); TestResultBool1 := False; TestResultBool2 := True; RunMacro(AText); AssertEQ(Msg + '(init: F,T)', Exp, TestResultBool1); AssertEQ(Msg + '(init: F,T)', Exp2, TestResultBool2); end; procedure TestSyn(Msg, AText: String; Exp: String); begin syn.ClearAll; RunMacro(AText); AssertEQ(Msg , True, pos(Exp, syn.Text) > 0); end; procedure TestSyn(Msg, AInit, AText: String; Exp: String); begin syn.ClearAll; syn.Text := AInit; RunMacro(AText); AssertEQ(Msg , True, pos(Exp, syn.Text) > 0); end; begin Result := False; SelfTestErrorMsg := ''; try try m := TEMSelfTestEditorMacro.Create(nil); syn := TSynEdit.Create(nil); {%region calling convention} // test_int1 TestResultInt1 := 99; TestInt('test_int1(42)', 'begin' + ' test_int1(42);' + 'end.', 42); TestInt('test_int1(-3)', 'begin' + ' test_int1(-3);' + 'end.', -3); TestInputInt1 := 1001; TestInputInt2 := 2002; RunMacro('var i: Integer;' + 'begin' + ' i := test_getint1' + ' test_int1(i);' + ' test_int2(test_getint2);' + 'end.'); AssertEQ('Failed getint1', 1001, TestResultInt1); AssertEQ('Failed getint2', 2002, TestResultInt2); TestInputInt1 := 2001; TestResultInt1 := -1; TestResultInt2 := -1; RunMacro('var i: Integer;' + 'begin' + ' i := 1002' + ' test_varint1(i);' + ' test_int2(i);' + 'end.'); AssertEQ('Failed varint a', 1002, TestResultInt1); AssertEQ('Failed varint b', 2001, TestResultInt2); // test_bool TestBool('test_bool(F,F)', 'begin' + ' test_bool1(False);' + ' test_bool2(False);' + 'end.', False, False); TestBool('test_bool(T,T)', 'begin' + ' test_bool1(True);' + ' test_bool2(True);' + 'end.', True, True); TestBool('test_bool(T,F)', 'begin' + ' test_bool1(True);' + ' test_bool2(False);' + 'end.', True, False); TestInputBool1 := True; TestInputBool2 := False; RunMacro('var i: Boolean;' + 'begin' + ' i := test_getbool1' + ' test_bool1(i);' + ' test_bool2(test_getbool2);' + 'end.'); AssertEQ('Failed getbool1', True, TestResultBool1); AssertEQ('Failed getbool2', False, TestResultBool2); // size_of(point) TestResultInt1 := -1; RunMacro('var p: TPoint;' + 'begin' + ' test_int1(SizeOf(p));' + 'end.'); AssertEQ('Failed int param (SizeOf(TPoint))', SizeOf(TPoint), TestResultInt1); // TPoint TestResultInt1 := -1; TestResultInt2 := -1; RunMacro('var p: TPoint;' + 'begin' + ' p := point(1001, 2002);' + ' test_point(p);' + 'end.'); AssertEQ('Failed point param X', 1001, TestResultInt1); AssertEQ('Failed point param Y', 2002, TestResultInt2); TestInputInt1 := 3001; TestInputInt2 := 4002; RunMacro('var p: TPoint;' + 'begin' + ' p := test_getpoint' + ' test_point(p);' + 'end.'); AssertEQ('Failed getpoint param X', 3001, TestResultInt1); AssertEQ('Failed getpoint param Y', 4002, TestResultInt2); TestInputInt1 := 5001; TestInputInt2 := 6002; RunMacro('begin' + ' test_point(test_getpoint);' + 'end.'); AssertEQ('Failed getpoint(2) param X', 5001, TestResultInt1); AssertEQ('Failed getpoint(2) param Y', 6002, TestResultInt2); TestResultInt1 := -1; TestResultInt2 := -1; TestResultBool1 := False; TestInputInt1 := 1005; TestInputInt2 := 1006; RunMacro('var p: TPoint;' + 'begin' + ' p := point(990, 991);' + ' test_varpoint(p);' + ' test_bool1((p.x = 1005) and (p.y = 1006));' + 'end.'); AssertEQ('Failed varpoint x', 990, TestResultInt1); AssertEQ('Failed varpoint y', 991, TestResultInt2); AssertEQ('Failed varpoint new', True, TestResultBool1); // string TestResultStr1 := 'no no'; TestResultStr2 := TestResultStr1; RunMacro('var s: String;' + 'begin' + ' s := ''abc'';' + ' test_str1(''123'');' + ' test_str2(s);' + 'end.'); AssertEQ('Failed str1 param', '123', TestResultStr1); AssertEQ('Failed str1 param', 'abc', TestResultStr2); TestInputStr1 := '123'; TestInputStr2 := '456'; RunMacro('var s: String;' + 'begin' + ' s := test_getstr1' + ' test_str1(s);' + ' test_str2(test_getstr2);' + 'end.'); AssertEQ('Failed getstr1', '123', TestResultStr1); AssertEQ('Failed getstr2', '456', TestResultStr2); TestInputStr1 := '123'; TestResultStr1 := ''; TestResultStr2 := ''; TestResultBool1 := False; RunMacro('var s: String;' + 'begin' + ' s := ''aaa''' + ' test_varstr1(s);' + ' test_bool1(s = ''123'');' + ' test_str2(s);' + 'end.'); AssertEQ('Failed varstr1', 'aaa', TestResultStr1); AssertEQ('Failed varstr2', '123', TestResultStr2); AssertEQ('Failed varstr3',True, TestResultBool1); {%endregion calling convention} {%region } TestBool('mrNone', 'begin' + ' test_bool1(mrNone = ' +IntToStr(mrNone) + ');' + 'end.', True ); TestBool('mrOk', 'begin' + ' test_bool1(mrOk = ' +IntToStr(mrOk) + ');' + 'end.', True ); TestBool('mtWarning', 'begin' + ' test_bool1(test_ord_mt(mtWarning) = ' +IntToStr(ord(mtWarning)) + ');' + 'end.', True ); TestBool('mtConfirmation', 'begin' + ' test_bool1(test_ord_mt(mtConfirmation) = ' +IntToStr(ord(mtConfirmation)) + ');' + 'end.', True ); TestBool('mbYes', 'begin' + ' test_bool1(test_ord_mb(mbYes) = ' +IntToStr(ord(mbYes)) + ');' + 'end.', True ); TestBool('mbCancel', 'begin' + ' test_bool1(test_ord_mb(mbCancel) = ' +IntToStr(ord(mbCancel)) + ');' + 'end.', True ); {%endregion } TestSyn('ecChar', 'begin ecChar(''C''); end.', 'C' ); TestSyn('InsertTextAtCaret', 'begin Caller.InsertTextAtCaret(''Foo'', scamEnd); end.', 'Foo'); TestSyn('TextBetweenPoints', '123456', 'begin Caller.TextBetweenPoints[Point(3,1), point(5,1)] := ''ng''; end.', '12ng56'); TestSyn('Replace All', 'Test abc abcde 123', 'begin Caller.SearchReplace(''abc'', ''XYZ'', [ssoReplaceAll]); end.', 'Test XYZ XYZde 123' ); Result := True; finally FreeAndNil(m); FreeAndNil(syn); end; except on E: Exception do begin SelfTestErrorMsg := E.Message; Result := False; end; end; end; end. From nc-gaertnma at netcologne.de Sat Aug 17 16:53:50 2019 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Sat, 17 Aug 2019 16:53:50 +0200 Subject: [Lazarus] Project Groups are saving LPI files In-Reply-To: References: Message-ID: <20190817165350.4961505e@limapholos.matflo.wg> On Thu, 15 Aug 2019 13:43:58 +0200 Ondrej Pokorny via lazarus wrote: >[...] > Project groups are saving my LPI files upon loading the project > group. Huh? Do you really mean, merely opening a lpg touches some lpi files? > This is a problem because they resave LPIs without BOM and > then all LPIs are marked as modified in SVN because they were saved > with BOM. (Lazarus IDE saves my project files with BOM.) > > I searched the reason and found out that TXMLConfig is the problem. > There are 2 issues: > > 1.) TXMLConfig should keep the original encoding along with BOM. > 2.) Project groups should never save LPIs. > > About 2.: > The problem is: > constructor TXMLConfig.CreateClean(const AFilename: String); > begin >   //DebugLn(['TXMLConfig.CreateClean ',AFilename]); >   fDoNotLoadFromFile:=true; >   Create(AFilename); >   FModified:=FileExistsCached(AFilename); > end; > > FModified gets True here - why? Is there a reason why the config > should be set as Modified on create and consequently be resaved on > Free when FileExistsCached returns true? TXMLConfig.CreateClean; TXMLConfig.Flush; -> should write, so needs Modified=true Maybe it is a bad idea to auto flush on Destroy. Mattias From bo.berglund at gmail.com Sat Aug 17 18:23:08 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Sat, 17 Aug 2019 18:23:08 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> Message-ID: On Sat, 17 Aug 2019 16:43:38 +0200, Martin Frb via lazarus wrote: >I attached a ready to go replacement file. >Make a copy of your original >   components/macroscript/emsselftest.pas >and then put the attached file into it. Done! >Tools > Option > editor macro script : "Test again" This button is disabled, cannot click it. Do I need to replace the file as above with Lazarus closed? I did it while it was running. So could not complete past this step. >    (this deletes/reset editormacroscript.xml from your primary conf, >which is the file that stores the error) >Tools > Rebuild Lazarus IDE >Restart Will Lazarus not automatically Restart following a rebuild? > >The new error should be shown on IDE start. > -- Bo Berglund Developer in Sweden From lazarus at mfriebe.de Sat Aug 17 18:43:01 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 17 Aug 2019 18:43:01 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: References: <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> Message-ID: <769398f1-d369-71c9-c95b-846d3b200eb9@mfriebe.de> On 17/08/2019 18:23, Bo Berglund via lazarus wrote: > On Sat, 17 Aug 2019 16:43:38 +0200, Martin Frb via lazarus > wrote: > >> I attached a ready to go replacement file. >> Make a copy of your original >>   components/macroscript/emsselftest.pas >> and then put the attached file into it. > Done! > >> Tools > Option > editor macro script : "Test again" > This button is disabled, cannot click it. Then it should say "scripting active"? That means, that this install of Lazarus has either not yet encountered the error, or that the "editormacroscript.xml" was deleted/reset (i.e. error removed from content). ( editormacroscript.xml is in your primary config path. You can find where that is from the menu: View > IDE Internals > About IDE ) If you get the error again (with or without the changed unit), then check for 1) the "test again" button 2) the editormacroscript.xml file Anyway if scripting is active, then the self test runs at every start of your IDE. And that leaves the question why it does not report the error anymore. (and when the editormacroscript.xml was deleted/reset) > Do I need to replace the file as above with Lazarus closed? I did it > while it was running. Lazarus usually detects changed files while running. Though I do not know if a package will be marked for rebuild in that case.... But save is to do so when closed. Or to choose "clean all" as then the file will be rebuild no matter what But the changes in the file do not affect the button. > So could not complete past this step. > >>    (this deletes/reset editormacroscript.xml from your primary conf, >> which is the file that stores the error) >> Tools > Rebuild Lazarus IDE >> Restart > Will Lazarus not automatically Restart following a rebuild? That is the default setting, it can be changed though From bo.berglund at gmail.com Sat Aug 17 21:52:32 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Sat, 17 Aug 2019 21:52:32 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> <769398f1-d369-71c9-c95b-846d3b200eb9@mfriebe.de> Message-ID: On Sat, 17 Aug 2019 18:43:01 +0200, Martin Frb via lazarus wrote: >On 17/08/2019 18:23, Bo Berglund via lazarus wrote: >> On Sat, 17 Aug 2019 16:43:38 +0200, Martin Frb via lazarus >> wrote: >> >>> I attached a ready to go replacement file. >>> Make a copy of your original >>>   components/macroscript/emsselftest.pas >>> and then put the attached file into it. >> Done! >> >>> Tools > Option > editor macro script : "Test again" >> This button is disabled, cannot click it. >Then it should say "scripting active"? Yes it does... > >That means, that this install of Lazarus has either not yet encountered >the error, or that the "editormacroscript.xml" was deleted/reset (i.e. >error removed from content). Could not the actions reported on first start do just that and this is what causes the message not to reappear? >( editormacroscript.xml is in your primary config path. You can find >where that is from the menu: View > IDE Internals > About IDE ) I found it and it contains basically nothing: >If you get the error again (with or without the changed unit), then >check for >1) the "test again" button >2) the editormacroscript.xml file It will probably only happen wenever I get Lazarus 2.0.6 on board then... >Anyway if scripting is active, then the self test runs at every start of >your IDE. And that leaves the question why it does not report the error >anymore. (and when the editormacroscript.xml was deleted/reset) Yes, why? -- Bo Berglund Developer in Sweden From lazarus at mfriebe.de Sat Aug 17 22:32:10 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 17 Aug 2019 22:32:10 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: References: <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> <769398f1-d369-71c9-c95b-846d3b200eb9@mfriebe.de> Message-ID: <0f1a6c9e-0ea2-8fdf-e81e-f17dd8f933f8@mfriebe.de> On 17/08/2019 21:52, Bo Berglund via lazarus wrote: > On Sat, 17 Aug 2019 18:43:01 +0200, Martin Frb via lazarus > wrote: > >> That means, that this install of Lazarus has either not yet encountered >> the error, or that the "editormacroscript.xml" was deleted/reset (i.e. >> error removed from content). > Could not the actions reported on first start do just that and this is > what causes the message not to reappear? If it displays an error, it should create the xml file, and put the error into it. That will then stop it from testing again, and therefore the error does not happen again. When you start a newly installed IDE, do you rebuild it (to get your packages back?) Then maybe the rebuild on works. But that would still leave me wonder, what removed the error from the file. >> ( editormacroscript.xml is in your primary config path. You can find >> where that is from the menu: View > IDE Internals > About IDE ) > I found it and it contains basically nothing: > > > Which means no error... > >> Anyway if scripting is active, then the self test runs at every start of >> your IDE. And that leaves the question why it does not report the error >> anymore. (and when the editormacroscript.xml was deleted/reset) > Yes, why? PascalScript can (and needs to) interact with compiled code. For example the instance of a SourceEDitor SynEdit (with limited access) is passed to any macro. The macro can call functions on this SynEdit and interact with it. Because PascalScript is compiled without knowing of all the method signatures it may have to deal with, it actually has no code to call them. Methods are registered at runtime. If they need to be called, PS manually builds the stack (and cpu registers) that the called method would expect. This must match exactly what fpc would have done at compiletime. (there is a 2nd callling method / awaits more testing) If that goes wrong (maybe fpc changed....), then the behaviour will be undefined. the code is called with trashed data.... To avoid happening that while working in the IDE, there is a selftest at startup. Before the selftest starts, it will write that to the xml file. So if the test crashes, never finishes, then the file says "I am in testing". If at start the xml is found to be "in testing", then this is reported as "last test failed" and disables PS. So your IDE did not crash, as the file is not "in testing" and you said you did not use the reset button. If the test fails, it is reported and written to the XML. If it succeeds the xml is updated to have nothing in it. So the self test runs on each start up (since the IDE could have been recompiled). The only way for it not to run, is if it failed or crashed. From lazarus at mfriebe.de Sat Aug 17 22:46:16 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 17 Aug 2019 22:46:16 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: <0f1a6c9e-0ea2-8fdf-e81e-f17dd8f933f8@mfriebe.de> References: <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> <769398f1-d369-71c9-c95b-846d3b200eb9@mfriebe.de> <0f1a6c9e-0ea2-8fdf-e81e-f17dd8f933f8@mfriebe.de> Message-ID: <806d2f9f-5a80-a644-8582-f42eaff37490@mfriebe.de> On 17/08/2019 22:32, Martin Frb via lazarus wrote: > >>> ( editormacroscript.xml is in your primary config path. You can find >>> where that is from the menu: View > IDE Internals > About IDE ) >> I found it and it contains basically nothing: >> >> >> > Which means no error... Just to be sure: editormacroscript.xml NOT: editormacros.xml The latter contains your macros, if you have any. From lazarus at mfriebe.de Sun Aug 18 01:27:12 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 18 Aug 2019 01:27:12 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: References: <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> <769398f1-d369-71c9-c95b-846d3b200eb9@mfriebe.de> Message-ID: <00752be0-2e43-b9b5-c1d3-e81ce4258041@mfriebe.de> On 17/08/2019 21:52, Bo Berglund via lazarus wrote: > It will probably only happen wenever I get Lazarus 2.0.6 on board > then... I build an installer for 2.0.5 (which does include the extra verbosity) / 64 bit only https://sourceforge.net/projects/lazarus-snapshots/files/test/ lazarus-2.0.5-61719-fpc-3.0.4-20190817-win64.exe https://sourceforge.net/projects/lazarus-snapshots/files/test/lazarus-2.0.5-61719-fpc-3.0.4-20190817-win64.exe/download It contains the following fixes over 2.0.4 https://wiki.lazarus.freepascal.org/index.php?title=Lazarus_2.0_fixes_branch&oldid=126476#Merged_revisions_for_2.0.6 So if you want to, you can try this. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bo.berglund at gmail.com Sun Aug 18 10:37:42 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Sun, 18 Aug 2019 10:37:42 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> <769398f1-d369-71c9-c95b-846d3b200eb9@mfriebe.de> <00752be0-2e43-b9b5-c1d3-e81ce4258041@mfriebe.de> Message-ID: <023ilepk7vf5e805iu8j2aier03de7m9as@4ax.com> On Sun, 18 Aug 2019 01:27:12 +0200, Martin Frb via lazarus wrote: >I build an installer for 2.0.5 (which does include the extra verbosity) >/ 64 bit only > >https://sourceforge.net/projects/lazarus-snapshots/files/test/ >lazarus-2.0.5-61719-fpc-3.0.4-20190817-win64.exe > Downloaded and installed this 2.0.5 test version as a separate installation (like I always do) on my Windows 7 x64 workstation. Then: - Start Lazarus from installed shortcut - Configure Lazarus IDE - [Start IDE] - Now NO pop-up complaint about missing script - config/editormacroscript.xml is empty (no data) - "Tools/Options/Editor Macro Script/Test again" button is disabled and above there is a "Scripting active" message. So this Lazarus installer successfully deposits a working Lazarus *without* the initial message about disabling the pascal scripting. And Lazarus options seems to be exactly like the 2.0.4 I installed previously. So the message I previously saw about deactivating scripting seems to be an *installer* bug when in fact the installation has succeeded all the time... Now gone in any case! Thanks! -- Bo Berglund Developer in Sweden From bo.berglund at gmail.com Sun Aug 18 11:17:59 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Sun, 18 Aug 2019 11:17:59 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> Message-ID: On Sat, 17 Aug 2019 16:43:38 +0200, Martin Frb via lazarus wrote: >I attached a ready to go replacement file. >Make a copy of your original >   components/macroscript/emsselftest.pas >and then put the attached file into it. > >Tools > Option > editor macro script : "Test again" >    (this deletes/reset editormacroscript.xml from your primary conf, >which is the file that stores the error) >Tools > Rebuild Lazarus IDE >Restart > >The new error should be shown on IDE start. > Now after getting 2.0.5 working in Win7 I returned to the RPi4 uinstallation of 2.0.4 and replaced the emsselftest.pas file as described above, then rebuilt the IDE and opened Lazarus and clicked the "test again" button. Closed and started Lazarus and received the message again. The editormacroscript.xml now contains this: Does this explain what is wrong on the RPi4 installation? -- Bo Berglund Developer in Sweden From tobiasgiesen at gmail.com Sun Aug 18 11:41:36 2019 From: tobiasgiesen at gmail.com (tobiasgiesen at gmail.com) Date: Sun, 18 Aug 2019 11:41:36 +0200 Subject: [Lazarus] Lazarus on POWER9 Little Endian Message-ID: <20190818114135.8265.B7062D51@tgtools.de> Hello, I am trying to use Lazarus on a ppc64el processor under Ubuntu. Unfortunately startlazarus and lazarus crash with a segmentation fault in a call to XGetWindowProperty in gtk2widgetset.inc in function TGtk2WidgetSet.GetWindowManager. Unable to fix this, I added an "Exit" command early in this function. I then get "The program 'startlazarus' received an X Window System error. The error was "BadValue (integer parameter out of range for operation) (Details: serial 866 error_code 2 request_code 130 minor_code 3)" and it does not run. Any ideas what might be needed to enable Lazarus to run on a ppc64el CPU? The system is a Blackbird mainboard from Raptor Computing Systems. Thanks. Tobias Giesen From lazarus at mfriebe.de Sun Aug 18 14:21:30 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 18 Aug 2019 14:21:30 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: References: <85f0c2ec-eee4-8e75-ed76-3dd6650b7faa@mfriebe.de> <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> Message-ID: On 18/08/2019 11:17, Bo Berglund via lazarus wrote: > So this Lazarus installer successfully deposits a working Lazarus > *without* the initial message about disabling the pascal scripting. > > And Lazarus options seems to be exactly like the 2.0.4 I installed > previously. > So the message I previously saw about deactivating scripting seems to > be an *installer* bug when in fact the installation has succeeded all > the time... I doubt it. Nothing was fixed that could have triggered this. Most likely some condition changed. Maybe simple because of the code grew a few bytes.... Something like this normally points to incorrect mem access. But running in valgrind revealed nothing. Of course PascalScript has different code for each target CPU and OS. (linux vs win // but not diff version of win afaik). > Now after getting 2.0.5 working in Win7 I returned to the RPi4 > > The editormacroscript.xml now contains this: > > > > > > > > > Does this explain what is wrong on the RPi4 installation? Unfortunately not. This will require deeper debugging. Potentially quite a lot. I do not have access to an RP at the moment.  I planed to set one up (or get QEMU to work) for more than 2 years now... But didn't find the time. So that may still be a long time before I get to it. If you want to go on trying to see if we can find anything, then please open   components\macroscript\emscriptclasses.pas around line 555 replace TEmsSynWrapper.EMS_SearchReplace with: function TEmsSynWrapper.EMS_SearchReplace(ASearch, AReplace: string;   AOptions: TSynSearchOptions): integer; begin debugln(['*** EMS_SearchReplace ASearch ', ord(ssoReplaceAll), ' / ', integer([ssoReplaceAll])]); debugln(['*** EMS_SearchReplace ', Pointer(ASearch), ' / ', Pointer(AReplace), ' / ', integer(AOptions), ' / ', Pointer(self)]); debugln(['*** EMS_SearchReplace ASearch ', ASearch, ' / ', AReplace]); debugln(['*** EMS_SearchReplace ASearch ', length(ASearch), ' / ', length(AReplace)]); debugln(['*** EMS_SearchReplace ASearch ', RawByteString(ASearch), ' / ', RawByteString(AReplace)]); debugln(['*** EMS_SearchReplace ASearch ', StringCodePage((ASearch)), ' / ', StringCodePage((AReplace))]); debugln(['*** EMS_SearchReplace ASearch ', StringCodePage(RawByteString(ASearch)), ' / ', StringCodePage(RawByteString(AReplace))]); debugln(['*** EMS_SearchReplace ASearch ', self.Text, ' / ', dbgs(CaretXY)]);   Result := SearchReplace(ASearch, AReplace, AOptions); debugln(['*** EMS_SearchReplace ASearch ', Result]); debugln(['*** EMS_SearchReplace ASearch ', self.Text, ' / ', dbgs(CaretXY)]); end; Start lazarus from console, so you can get the output. Copy the output. The output only matters, if the error occurs. So self-testing must be re-enabled. From bo.berglund at gmail.com Sun Aug 18 21:19:34 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Sun, 18 Aug 2019 21:19:34 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> Message-ID: On Sun, 18 Aug 2019 14:21:30 +0200, Martin Frb via lazarus wrote: >If you want to go on trying to see if we can find anything, then please >open >   components\macroscript\emscriptclasses.pas >around line 555 >replace TEmsSynWrapper.EMS_SearchReplace >with: > >function TEmsSynWrapper.EMS_SearchReplace(ASearch, AReplace: string; >   AOptions: TSynSearchOptions): integer; >begin >debugln(['*** EMS_SearchReplace ASearch ', ord(ssoReplaceAll), ' / ', >integer([ssoReplaceAll])]); >debugln(['*** EMS_SearchReplace ', Pointer(ASearch), ' / ', >Pointer(AReplace), ' / ', integer(AOptions), ' / ', Pointer(self)]); >debugln(['*** EMS_SearchReplace ASearch ', ASearch, ' / ', AReplace]); >debugln(['*** EMS_SearchReplace ASearch ', length(ASearch), ' / ', >length(AReplace)]); >debugln(['*** EMS_SearchReplace ASearch ', RawByteString(ASearch), ' / >', RawByteString(AReplace)]); >debugln(['*** EMS_SearchReplace ASearch ', StringCodePage((ASearch)), ' >/ ', StringCodePage((AReplace))]); >debugln(['*** EMS_SearchReplace ASearch ', >StringCodePage(RawByteString(ASearch)), ' / ', >StringCodePage(RawByteString(AReplace))]); >debugln(['*** EMS_SearchReplace ASearch ', self.Text, ' / ', >dbgs(CaretXY)]); >   Result := SearchReplace(ASearch, AReplace, AOptions); >debugln(['*** EMS_SearchReplace ASearch ', Result]); >debugln(['*** EMS_SearchReplace ASearch ', self.Text, ' / ', >dbgs(CaretXY)]); >end; > >Start lazarus from console, so you can get the output. Copy the output. >The output only matters, if the error occurs. So self-testing must be >re-enabled. I have done this on my RPi4 with Lazarus 2.0.4. The result after enabling the test and starting again from the console is this sequence (line breaks added by news reader): pi at rpi4-test:~ $ /home/pi/dev/lazarus/2.0.4/startlazarus --pcp=/home/pi/.lazarus_2.0.4 Adding "--pcp=/home/pi/.lazarus_2.0.4" as a parameter is a file SetPrimaryConfigPath NewValue="/home/pi/.lazarus_2.0.4" -> "/home/pi/.lazarus_2.0.4" TLazarusManager.Run starting /home/pi/dev/lazarus/2.0.4/lazarus ... SetPrimaryConfigPath NewValue="/home/pi/.lazarus_2.0.4" -> "/home/pi/.lazarus_2.0.4" Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] PrimaryConfigPath="/home/pi/.lazarus_2.0.4" Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] SecondaryConfigPath="/etc/lazarus" Hint: (lazarus) [TBuildManager.SetBuildTarget] Old=arm-linux-gtk2 New=arm-linux-gtk2 Changed: OS/CPU=True LCL=False Parameter type not implemented! ---Here the error message is shown and it waits for the Start IDE button to be clicked. ----- [WARNING] SetImageList called without handle for lbMacroView(TListView) [WARNING] SetImageList called without handle for lbMacroView(TListView) [WARNING] SetImageList called without handle for lbMacroView(TListView) --- Here is where the IDE has started and can be used --- --- Now close the Lazarus IDE --- LAZARUS END - cleaning up ... Hint: (lazarus) [TMainIDE.Destroy] B -> inherited Destroy... TMainIDE Hint: (lazarus) [TMainIDE.Destroy] END --- Lazarus IDE closed --- I just copied the command line found in the GUI menu and ran it inside the terminal, except I removed the trailing %f since I had no file to pass in. -- Bo Berglund Developer in Sweden From lazarus at mfriebe.de Sun Aug 18 22:51:31 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 18 Aug 2019 22:51:31 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: References: <2d48547e-ba85-2fd3-fbb1-f33fe60310ac@mfriebe.de> <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> Message-ID: <6ef11cc4-dbc7-84a6-a2b4-0a04470c36a8@mfriebe.de> On 18/08/2019 21:19, Bo Berglund via lazarus wrote: > > Parameter type not implemented! > So on arm that explains the error. It does not implement passing a set as param (must be set, since string worked in other tests). I have to see, if there are any options. Otherwise I will disable it for arm (since it does not currently work for anyone, it would not be a regression) As for what happened on windows, no idea. From bo.berglund at gmail.com Sun Aug 18 23:58:46 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Sun, 18 Aug 2019 23:58:46 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> <6ef11cc4-dbc7-84a6-a2b4-0a04470c36a8@mfriebe.de> Message-ID: On Sun, 18 Aug 2019 22:51:31 +0200, Martin Frb via lazarus wrote: >On 18/08/2019 21:19, Bo Berglund via lazarus wrote: >> >> Parameter type not implemented! >> >So on arm that explains the error. >It does not implement passing a set as param (must be set, since string >worked in other tests). Does this mean that FPC on Arm is not generating the expected code like it does on Windows? So the cross-platform operation is somewhat broken? >I have to see, if there are any options. >Otherwise I will disable it for arm (since it does not currently work >for anyone, it would not be a regression) > >As for what happened on windows, no idea. I know that on RPi Arm I had to figure out what build essentials to install every time I needed to put FPC + Lazarus on a new system. I had to retrieve sources via svn and build on the system so I had to figure out all that was needed to succeed. I put all of this into an installation script I use every time nowadays (I have been doing this for 6-7 years now). It assumes nothing but a pristine out-of-the-box Raspbian installation which needs some more packages in order to work with s/w development. So the script installs that for me. And it has worked every time except once when the RPi went from arm6 to arm7 and a flag had to be added into the fpc build commands in the script. I think I have seen the same first start error for a long time on the RPi. It is quite possible that I don't have the complete set of required packages listed for installation in my script and this is what breaks it. But that is provided that it is not an fpc deviation for arm of course. On Windows I have yet to build a dev system myself, I always use the "official" installers there. -- Bo Berglund Developer in Sweden From lazarus at mfriebe.de Mon Aug 19 00:46:18 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Mon, 19 Aug 2019 00:46:18 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B In-Reply-To: References: <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> <6ef11cc4-dbc7-84a6-a2b4-0a04470c36a8@mfriebe.de> Message-ID: <2bc39306-bd66-be25-2df4-a5433f559087@mfriebe.de> On 18/08/2019 23:58, Bo Berglund via lazarus wrote: > On Sun, 18 Aug 2019 22:51:31 +0200, Martin Frb via lazarus > wrote: > >> On 18/08/2019 21:19, Bo Berglund via lazarus wrote: >>> Parameter type not implemented! >>> >> So on arm that explains the error. >> It does not implement passing a set as param (must be set, since string >> worked in other tests). > Does this mean that FPC on Arm is not generating the expected code > like it does on Windows? So the cross-platform operation is somewhat > broken? No, it means PascalScript is not fully implemented >> I have to see, if there are any options. >> Otherwise I will disable it for arm (since it does not currently work >> for anyone, it would not be a regression) >> >> As for what happened on windows, no idea. > I think I have seen the same first start error for a long time on the > RPi. It is quite possible that I don't have the complete set of > required packages listed for installation in my script and this is > what breaks it. But that is provided that it is not an fpc deviation > for arm of course. > > On Windows I have yet to build a dev system myself, I always use the > "official" installers there. It is not a missing package. All the code is compiled into the IDE. PascalScript is a 3rd party package. It includes some asm code that differs for each platform (cpu and general type of OS). The OS type only matters because the calling convention differs. That is fpc (following the rules for each platform) uses different registers to store function param. But there is no diff between win7 (64bit) and win10 (64bit). So if it works on w10 for me, I have no idea why it fails for you (win 7). Arm/linux (raspi) has different code in PS. And apparently that is incomplete. But that only affects RPI. Also on either system. After the error happens once, that is stored in the config. Unless you remove your config each time that you install, you should never see the error again. To verify that, you can (after the error) check the XML file. That xml file should stay there forever. As I said, I will decide (soon / hopefully sometime before the next release) what to do on arm. Maybe disable it for arm. Then there wont be an error. Maybe I find a work around. Then I would have to ask you to test (since I cant currently). From bo.berglund at gmail.com Mon Aug 19 07:08:40 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Mon, 19 Aug 2019 07:08:40 +0200 Subject: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B References: <60daec04-75c3-12fe-f08b-515bddf120a4@mfriebe.de> <6ef11cc4-dbc7-84a6-a2b4-0a04470c36a8@mfriebe.de> <2bc39306-bd66-be25-2df4-a5433f559087@mfriebe.de> Message-ID: On Mon, 19 Aug 2019 00:46:18 +0200, Martin Frb via lazarus wrote: >Also on either system. After the error happens once, that is stored in >the config. Unless you remove your config each time that you install, >you should never see the error again. >To verify that, you can (after the error) check the XML file. That xml >file should stay there forever. I always make a separate config dir for each installation so a new install starts out with an empty config. I use the --pcp= flag in the start command on Linux to specify this dir. On Windows the installer fixes this during install when I check the "separate installation" flag. -- Bo Berglund Developer in Sweden From bo.berglund at gmail.com Mon Aug 19 18:21:06 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Mon, 19 Aug 2019 18:21:06 +0200 Subject: [Lazarus] TListView - how to make selected line stay selected? Message-ID: I have a dialog which is used to enable changing the order of certain items. The items are displayed in a TListView component in report mode, each item occupies one line and shows several properties in the columns. Now I want to be able to select the row (list.Rowselect = true) when clicking on it. This works OK. Then I have a button which moves the item up and another button to move it down the list. In my code I do the following for moving up (lvCutList is the listview showing the data, FVideoCuts ia a dynamic array of TVideoCut records): procedure TfrmEditCuts.btnUpClick(Sender: TObject); var i, l: integer; V1: TVideoCut; begin i := lvCutList.ItemIndex; if i < 1 then exit; //Not selected or already at top V1 := FVideoCuts[i-1]; FVideoCuts[i-1] := FVideoCuts[i]; FVideoCuts[i] := V1; ShowCuts(FVideoCuts); // <= Repopulate the listview from data lvCutList.ItemIndex := i-1; //<= This is no longer visible end; So the end result is that the line is moved up one position in the list and I set the itemindex property such that the moved line is still selected. But it does not show on screen... The selection of the line disappeares immediately when the button is clicked and only returns if I forcibly click in the listview in some place that will not move the selection, for example in the unpopulated area at the bottom. What I would like to see is that the selection color *stays visible* even if focus is moved away from the listview component. How can this be accomplished? I am pretty sure I could do this when I used Delphi a few years back at work (now retired)... -- Bo Berglund Developer in Sweden From florian at freepascal.org Mon Aug 19 21:24:22 2019 From: florian at freepascal.org (Florian Klaempfl) Date: Mon, 19 Aug 2019 21:24:22 +0200 Subject: [Lazarus] Lazarus on POWER9 Little Endian In-Reply-To: <20190818114135.8265.B7062D51@tgtools.de> References: <20190818114135.8265.B7062D51@tgtools.de> Message-ID: <8b1658ef-5293-e759-18f7-92c4f08f3fcc@freepascal.org> Am 18.08.2019 um 11:41 schrieb Tobias Giesen via lazarus: > Hello, > I am trying to use Lazarus on a ppc64el processor under Ubuntu. > > Unfortunately startlazarus and lazarus crash with a segmentation fault in > a call to XGetWindowProperty in gtk2widgetset.inc in function > TGtk2WidgetSet.GetWindowManager. A stack trace and assembler dump at the crash location might be helpful ... From bo.berglund at gmail.com Mon Aug 19 23:34:45 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Mon, 19 Aug 2019 23:34:45 +0200 Subject: [Lazarus] TListView - how to make selected line stay selected? References: Message-ID: <125mlepr2jdrrhuq5e37aad3kg470i7o13@4ax.com> On Mon, 19 Aug 2019 18:21:06 +0200, Bo Berglund via lazarus wrote: >How can this be accomplished? I ended up adding the code below after reading this: http://delphidabbler.com/articles?article=16 procedure TfrmEditCuts.lvCutListCustomDrawItem(Sender: TCustomListView; Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean); const cStripe = $FF9933; // colour of selected list items begin if Item.Index = lvCutList.ItemIndex then begin lvCutList.Canvas.Brush.Color := cStripe; lvCutList.Canvas.Font.Color := clWhite; end else lvCutList.Canvas.Brush.Color := clWindow; end; This made the selected row stay colored even though the listview lost focus when I clicked the buttons. I had to probe the selection color in my paint program to set the cStripe value to the same because when clicking on an item the CustomDrawItem event seems not to be called. So on initial click the row was colored blue and when I used my buttons to move the row it was colored in the cStripe value that I originally used (light green). Changing the cStripe value to the color of initial selection made the row move without visible color change.... -- Bo Berglund Developer in Sweden From werner.pamler at freenet.de Tue Aug 20 00:01:38 2019 From: werner.pamler at freenet.de (Werner Pamler) Date: Tue, 20 Aug 2019 00:01:38 +0200 Subject: [Lazarus] TListView - how to make selected line stay selected? In-Reply-To: <125mlepr2jdrrhuq5e37aad3kg470i7o13@4ax.com> References: <125mlepr2jdrrhuq5e37aad3kg470i7o13@4ax.com> Message-ID: <014c18a2-8f94-248b-2b3d-51845109b103@freenet.de> Did you set HideSelection to false? From samps at unplugd.com Tue Aug 20 03:26:40 2019 From: samps at unplugd.com (Samps) Date: Tue, 20 Aug 2019 01:26:40 +0000 Subject: [Lazarus] Installed Lazarus 2.0.4 on my Chromebook... Message-ID: <20190820012640.Horde.E8KWJe-yqe8GGfUBUPrD4oy@cloud.unplugd.info> Just thought I'd let the makers of this wonderful software know that it installs almost flawlessly on a newish Chromebook. Screen shot to prove it: https://cloud.unplugd.info/index.php/s/2yRXGBRowEgbkGq Packages chosen were the .deb ones from Sourceforge and below is a dump of the history of commands used on my Chromebooks Crouton terminal to install FPC and Lazarus. It might look disjointed at first glance but it becomes obvious as you hit the stumbleblocks.... 31 dpkg -i fpc-laz_3.0.4-1_amd64.deb 32 sudo dpkg -i fpc-laz_3.0.4-1_amd64.deb 33 sudo apt install binutils 34 sudo dpkg -i fpc-laz_3.0.4-1_amd64.deb 35 sudo apt install gcc 36 sudo apt install libgcc 37 sudo apt install gcc 38 sudo dpkg -i fpc-laz_3.0.4-1_amd64.deb 39 ls 40 sudo dpkg -i fpc-src_3.0.4-2_amd64.deb 41 ls 42 sudo dpkg -i lazarus-project_2.0.4-0_amd64.deb 43 sudo apt install libgtk2.0-dev 44 sudo apt --fix-broken install 45 sudo apt install libgtk2.0-dev 46 sudo apt autoremove 47 sudo dpkg -i lazarus-project_2.0.4-0_amd64.deb 48 startlazarus 49 sudo apt install libgl1 50 startlazarus 51 history Now I just need one thing... a debugger! Any and all suggestions welcome. cheers Samps From bo.berglund at gmail.com Tue Aug 20 08:12:22 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Tue, 20 Aug 2019 08:12:22 +0200 Subject: [Lazarus] TListView - how to make selected line stay selected? References: <125mlepr2jdrrhuq5e37aad3kg470i7o13@4ax.com> <014c18a2-8f94-248b-2b3d-51845109b103@freenet.de> Message-ID: On Tue, 20 Aug 2019 00:01:38 +0200, Werner Pamler via lazarus wrote: >Did you set HideSelection to false? Did not know it existed... Set to true by default. But when I unchecked it and tried to skip the code I showed it did not work. When I returned to the listview the selected item was unselected immediately... So I have to keep my changes. -- Bo Berglund Developer in Sweden From tobiasgiesen at gmail.com Tue Aug 20 12:51:15 2019 From: tobiasgiesen at gmail.com (Tobias Giesen) Date: Tue, 20 Aug 2019 12:51:15 +0200 Subject: [Lazarus] Lazarus on POWER9 Little Endian In-Reply-To: <8b1658ef-5293-e759-18f7-92c4f08f3fcc@freepascal.org> References: <20190818114135.8265.B7062D51@tgtools.de> <8b1658ef-5293-e759-18f7-92c4f08f3fcc@freepascal.org> Message-ID: Hello, I compiled lazarus trunk with Free Pascal Compiler version 3.3.1 [2019/07/12] for powerpc64. I also tried an older FPC snapshot but the result is the same (Free Pascal Compiler version 3.1.1 [2017/10/19] for powerpc64) (gdb) run Starting program: /home/tobias/lazarus/startlazarus [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/powerpc64le-linux-gnu/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7c3aa64 in XGetWindowProperty () from /lib/powerpc64le-linux-gnu/libX11.so.6 (gdb) info stack #0 0x00007ffff7c3aa64 in XGetWindowProperty () at /lib/powerpc64le-linux-gnu/libX11.so.6 #1 0x0000000010155b30 in XLIB_$$_XGETWINDOWPROPERTY$crcF838B835 () #2 0x00000000100e6310 in GETWINDOWMANAGER (this=0x7ffff5700f30) at gtk2widgetset.inc:4424 (gdb) info registers r0 0x10155b30 269835056 r1 0x7fffffffdf40 140737488346944 r2 0x7ffff7dc7c00 140737351810048 r3 0x10a0d1e0 278974944 r4 0x2a1 673 r5 0x188 392 r6 0x0 0 r7 0x400 1024 r8 0x0 0 r9 0x7fffffffdfb0 140737488347056 r10 0x0 0 r11 0xffffffffffffffd8 18446744073709551576 r12 0x7ffff7c3a9c0 140737350183360 r13 0x7ffff60fd540 140737321620800 r14 0x0 0 r15 0x0 0 r16 0x0 0 r17 0x0 0 r18 0x0 0 r19 0x0 0 r20 0x2a1 673 r21 0x188 392 r22 0x21 33 r23 0x0 0 r24 0x0 0 r25 0x400 1024 r26 0x7fffffffe1d0 140737488347600 r27 0x7fffffffe1c0 140737488347584 r28 0x7fffffffe0e0 140737488347360 r29 0x100d93d0 269325264 r30 0x7fffffffe1c8 140737488347592 r31 0x10a0d1e0 278974944 pc 0x7ffff7c3aa64 0x7ffff7c3aa64 msr 0x900000000000d933 10376293541461678387 cr 0x28000244 671089220 lr 0x10155b30 0x10155b30 ctr 0x7ffff7c3a9c0 140737350183360 xer 0x0 0 fpscr 0x82020090 2181169296 vscr 0x0 0 vrsave 0xffffffff -1 ppr 0xc000000000000 3377699720527872 --Type for more, q to quit, c to continue without paging--c dscr 0x10 16 tar 0x0 0 bescr ebbhr ebbrr mmcr0 0x0 0 mmcr2 0x0 0 siar 0x0 0 sdar 0x0 0 sier 0x0 0 orig_r3 0x7ffff7fc9bd0 140737353915344 trap 0x300 768 layout asm: >│0x7ffff7c3aa64 std r10,0(r29) │ │0x7ffff7c3aa68 stxvd2x vs0,r9,r11 │ │0x7ffff7c3aa6c std r10,0(r26) │ │0x7ffff7c3aa70 std r10,88(r1) │ │0x7ffff7c3aa74 std r10,96(r1) │ │0x7ffff7c3aa78 ld r9,2408(r3) │ │0x7ffff7c3aa7c cmpdi cr7,r9,0 │ │0x7ffff7c3aa80 beq cr7,0x7ffff7c3aa98 │ │0x7ffff7c3aa84 ld r9,0(r9) │ │0x7ffff7c3aa88 mtctr r9 │ │0x7ffff7c3aa8c mr r12,r9 │ │0x7ffff7c3aa90 bctrl │ │0x7ffff7c3aa94 ld r2,24(r1) │ │0x7ffff7c3aa98 li r5,24 │ │0x7ffff7c3aa9c li r4,20 │ │0x7ffff7c3aaa0 mr r3,r31 │ │0x7ffff7c3aaa4 bl 0x7ffff7c6a168 <_XGetRequest+8> │ │0x7ffff7c3aaa8 nop │ │0x7ffff7c3aaac li r6,0 │ │0x7ffff7c3aab0 li r5,0 │ │0x7ffff7c3aab4 addi r4,r1,40 │ │0x7ffff7c3aab8 mr r9,r3 │ │0x7ffff7c3aabc stw r20,4(r3) │ │0x7ffff7c3aac0 stw r21,8(r3) │ │0x7ffff7c3aac4 mr r3,r31 │ │0x7ffff7c3aac8 stb r23,1(r9) On Mon, Aug 19, 2019 at 9:24 PM Florian Klaempfl via lazarus < lazarus at lists.lazarus-ide.org> wrote: > Am 18.08.2019 um 11:41 schrieb Tobias Giesen via lazarus: > > Hello, > > I am trying to use Lazarus on a ppc64el processor under Ubuntu. > > > > Unfortunately startlazarus and lazarus crash with a segmentation fault in > > a call to XGetWindowProperty in gtk2widgetset.inc in function > > TGtk2WidgetSet.GetWindowManager. > > A stack trace and assembler dump at the crash location might be helpful ... > -- > _______________________________________________ > lazarus mailing list > lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobiasgiesen at gmail.com Tue Aug 20 13:06:35 2019 From: tobiasgiesen at gmail.com (Tobias Giesen) Date: Tue, 20 Aug 2019 13:06:35 +0200 Subject: [Lazarus] Lazarus on POWER9 Little Endian In-Reply-To: <8b1658ef-5293-e759-18f7-92c4f08f3fcc@freepascal.org> References: <20190818114135.8265.B7062D51@tgtools.de> <8b1658ef-5293-e759-18f7-92c4f08f3fcc@freepascal.org> Message-ID: It seems to work slightly better on Fedora. It doesn't cause a signal and very briefly, an empty small window appears. The console output is like this: [tobias at blackbird lazarus]$ ./startlazarus is a file (startlazarus:3893): Gdk-ERROR **: 13:02:08.997: The program 'startlazarus' received an X Window System error. This probably reflects a bug in the program. The error was 'BadValue (integer parameter out of range for operation)'. (Details: serial 334 error_code 2 request_code 130 minor_code 3) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.) Trace/breakpoint trap (core dumped) On Mon, Aug 19, 2019 at 9:24 PM Florian Klaempfl via lazarus < lazarus at lists.lazarus-ide.org> wrote: > Am 18.08.2019 um 11:41 schrieb Tobias Giesen via lazarus: > > Hello, > > I am trying to use Lazarus on a ppc64el processor under Ubuntu. > > > > Unfortunately startlazarus and lazarus crash with a segmentation fault in > > a call to XGetWindowProperty in gtk2widgetset.inc in function > > TGtk2WidgetSet.GetWindowManager. > > A stack trace and assembler dump at the crash location might be helpful ... > -- > _______________________________________________ > lazarus mailing list > lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dhkblaszyk at gmail.com Tue Aug 20 18:48:10 2019 From: dhkblaszyk at gmail.com (Darius Blaszyk) Date: Tue, 20 Aug 2019 18:48:10 +0200 Subject: [Lazarus] Automatic identifier completion In-Reply-To: References: Message-ID: Hi! Attached a (still) naive patch that implements automatic completion upon keypress. It's already giving me a big boost in productivity so I thought I might share it here. It would be good to make the identifier invocation a bit smarter. For instance I would like to prevent invocation in case the word is part of a string or comment. Also it should auto hide after the first character gets deleted by backspace. Any tips or hints how to use the codetools to get the required information is appreciated! Rgds, Darius Blaszyk On Fri, Aug 16, 2019 at 10:55 PM Martin Frb via lazarus < lazarus at lists.lazarus-ide.org> wrote: > On 16/08/2019 19:07, Darius Blaszyk via lazarus wrote: > > Hi, > > > > I know about code completion in the IDE and it works perfectly! > > However, to invoke it I need to press CRTL-space every time which is > > somewhat cumbersome. Is there a setting in the IDE that would invoke > > completion automatically on keypress? > > > It can auto invoke after you enter a dot "form1." > But otherwise not. > > See https://bugs.freepascal.org/view.php?id=33054 > -- > _______________________________________________ > lazarus mailing list > lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dhkblaszyk at gmail.com Tue Aug 20 18:54:15 2019 From: dhkblaszyk at gmail.com (Darius Blaszyk) Date: Tue, 20 Aug 2019 18:54:15 +0200 Subject: [Lazarus] Automatic identifier completion In-Reply-To: References: Message-ID: Now with attachment! 😀 On Tue, Aug 20, 2019 at 6:48 PM Darius Blaszyk wrote: > Hi! > > Attached a (still) naive patch that implements automatic completion upon > keypress. It's already giving me a big boost in productivity so I thought I > might share it here. It would be good to make the identifier invocation a > bit smarter. For instance I would like to prevent invocation in case the > word is part of a string or comment. Also it should auto hide after the > first character gets deleted by backspace. Any tips or hints how to use the > codetools to get the required information is appreciated! > > Rgds, Darius Blaszyk > > On Fri, Aug 16, 2019 at 10:55 PM Martin Frb via lazarus < > lazarus at lists.lazarus-ide.org> wrote: > >> On 16/08/2019 19:07, Darius Blaszyk via lazarus wrote: >> > Hi, >> > >> > I know about code completion in the IDE and it works perfectly! >> > However, to invoke it I need to press CRTL-space every time which is >> > somewhat cumbersome. Is there a setting in the IDE that would invoke >> > completion automatically on keypress? >> > >> It can auto invoke after you enter a dot "form1." >> But otherwise not. >> >> See https://bugs.freepascal.org/view.php?id=33054 >> -- >> _______________________________________________ >> lazarus mailing list >> lazarus at lists.lazarus-ide.org >> https://lists.lazarus-ide.org/listinfo/lazarus >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: autocompletion.patch Type: text/x-patch Size: 11131 bytes Desc: not available URL: From dhkblaszyk at gmail.com Tue Aug 20 21:51:11 2019 From: dhkblaszyk at gmail.com (Darius Blaszyk) Date: Tue, 20 Aug 2019 21:51:11 +0200 Subject: [Lazarus] Automatic identifier completion In-Reply-To: References: Message-ID: Index: ide/editoroptions.pp =================================================================== --- ide/editoroptions.pp (revision 61726) +++ ide/editoroptions.pp (working copy) @@ -1406,6 +1406,7 @@ TEditorOptions = class(TIDEEditorOptions) private FBlockTabIndent: Integer; + fAutoShowCompletion: Boolean; FCompletionLongLineHintInMSec: Integer; FCompletionLongLineHintType: TSynCompletionLongHintType; FMiddleTabClickClosesOthersModifier: TShiftState; @@ -1702,6 +1703,8 @@ write FAutoRemoveEmptyMethods default False; property CompletionLongLineHintInMSec: Integer read FCompletionLongLineHintInMSec write FCompletionLongLineHintInMSec; + property AutoShowCompletion: Boolean + read fAutoShowCompletion write fAutoShowCompletion; published property CompletionLongLineHintType: TSynCompletionLongHintType read FCompletionLongLineHintType write FCompletionLongLineHintType @@ -5006,6 +5009,11 @@ XMLConfig.GetValue('EditorOptions/CodeTools/AutoRemoveEmptyMethods', False); FCompletionLongLineHintInMSec := XMLConfig.GetValue('EditorOptions/CodeTools/CompletionLongLineHintInMSec', 0); + + fAutoShowCompletion := + XMLConfig.GetValue('EditorOptions/CodeTools/AutoShowCompletion', False); + DebugLn('TEditorOptions: Load Editor option AutoShowCompletion %s', [BoolToStr(fAutoShowCompletion, True)]); + FCompletionLongLineHintType := DefaultCompletionLongLineHintType; XMLConfig.ReadObject('EditorOptions/CodeTools/CompletionLongLineHintType', Self, Self, 'CompletionLongLineHintType'); @@ -5207,6 +5215,13 @@ XMLConfig.SetDeleteValue( 'EditorOptions/CodeTools/CompletionLongLineHintInMSec', FCompletionLongLineHintInMSec, 0); + + DebugLn('TEditorOptions: Write Editor option AutoShowCompletion %s', [BoolToStr(fAutoShowCompletion, True)]); + XMLConfig.SetDeleteValue( + 'EditorOptions/CodeTools/AutoShowCompletion', + fAutoShowCompletion, False); + + XMLConfig.WriteObject('EditorOptions/CodeTools/CompletionLongLineHintType', Self, nil, 'CompletionLongLineHintType'); Index: ide/frames/editor_codetools_options.lfm =================================================================== --- ide/frames/editor_codetools_options.lfm (revision 61726) +++ ide/frames/editor_codetools_options.lfm (working copy) @@ -16,10 +16,10 @@ AnchorSideLeft.Control = AutoCompletionDelayLabel AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = AutoCompletionDelayLabel - Left = 172 - Height = 15 - Top = 156 - Width = 83 + Left = 212 + Height = 17 + Top = 168 + Width = 107 BorderSpacing.Left = 20 Caption = 'AutoDelayLabel' ParentColor = False @@ -32,7 +32,7 @@ AnchorSideRight.Side = asrBottom Left = 0 Height = 3 - Top = 56 + Top = 60 Width = 634 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 6 @@ -42,9 +42,9 @@ AnchorSideLeft.Control = Owner AnchorSideTop.Control = Owner Left = 6 - Height = 19 + Height = 21 Top = 6 - Width = 210 + Width = 263 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoRemoveEmptyMethodsOnSave' @@ -55,9 +55,9 @@ AnchorSideTop.Control = AutoDisplayFuncProtoCheckBox AnchorSideTop.Side = asrBottom Left = 6 - Height = 19 - Top = 87 - Width = 198 + Height = 21 + Top = 93 + Width = 245 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoToolTipSymbToolsCheckBox' @@ -68,9 +68,9 @@ AnchorSideTop.Control = AutoRemoveEmptyMethodsOnSave AnchorSideTop.Side = asrBottom Left = 6 - Height = 19 - Top = 31 - Width = 179 + Height = 21 + Top = 33 + Width = 225 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoCompleteBlockCheckBox' @@ -81,9 +81,9 @@ AnchorSideTop.Control = AutoToolTipSymbToolsCheckBox AnchorSideTop.Side = asrBottom Left = 6 - Height = 19 - Top = 112 - Width = 182 + Height = 21 + Top = 120 + Width = 230 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoToolTipExprEvalCheckBox' @@ -96,8 +96,8 @@ AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 6 - Height = 30 - Top = 172 + Height = 39 + Top = 186 Width = 622 Frequency = 250 Max = 4000 @@ -116,9 +116,9 @@ AnchorSideTop.Control = DbgToolTipAutoCastClass AnchorSideTop.Side = asrBottom Left = 6 - Height = 15 - Top = 156 - Width = 146 + Height = 17 + Top = 168 + Width = 186 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoCompletionDelayLabel' @@ -131,8 +131,8 @@ AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 6 - Height = 30 - Top = 276 + Height = 39 + Top = 312 Width = 622 Frequency = 250 Max = 4000 @@ -150,9 +150,9 @@ AnchorSideTop.Control = AutoHintDelayTrackBar AnchorSideTop.Side = asrBottom Left = 6 - Height = 15 - Top = 260 - Width = 148 + Height = 17 + Top = 294 + Width = 188 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'CompletionDropDownLabel' @@ -162,10 +162,10 @@ AnchorSideLeft.Control = CompletionDropDownLabel AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CompletionDropDownLabel - Left = 174 - Height = 15 - Top = 260 - Width = 177 + Left = 214 + Height = 17 + Top = 294 + Width = 225 BorderSpacing.Left = 20 Caption = 'CompletionDropDownDelayLabel' ParentColor = False @@ -177,12 +177,12 @@ AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom Left = 6 - Height = 23 - Top = 308 + Height = 29 + Top = 353 Width = 220 BorderSpacing.Left = 6 BorderSpacing.Top = 2 - ItemHeight = 15 + ItemHeight = 0 Style = csDropDownList TabOrder = 7 end @@ -192,9 +192,9 @@ AnchorSideTop.Control = CompletionDropDownHint AnchorSideTop.Side = asrCenter Left = 232 - Height = 15 - Top = 312 - Width = 171 + Height = 17 + Top = 359 + Width = 216 BorderSpacing.Around = 6 Caption = 'CompletionDropDownHintLabel' ParentColor = False @@ -204,9 +204,9 @@ AnchorSideTop.Control = AutoToolTipExprEvalCheckBox AnchorSideTop.Side = asrBottom Left = 26 - Height = 19 - Top = 131 - Width = 159 + Height = 21 + Top = 141 + Width = 198 BorderSpacing.Left = 20 Caption = 'DbgToolTipAutoCastClass' TabOrder = 8 @@ -215,9 +215,9 @@ AnchorSideLeft.Control = Owner AnchorSideTop.Control = ToolTipBevel Left = 6 - Height = 19 - Top = 62 - Width = 191 + Height = 21 + Top = 66 + Width = 241 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoDisplayFuncProtoCheckBox' @@ -228,9 +228,9 @@ AnchorSideTop.Control = AutoCompletionDelayTrackBar AnchorSideTop.Side = asrBottom Left = 6 - Height = 15 - Top = 208 - Width = 106 + Height = 17 + Top = 231 + Width = 135 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoHintDelayLabel' @@ -243,8 +243,8 @@ AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 6 - Height = 30 - Top = 224 + Height = 39 + Top = 249 Width = 622 Frequency = 250 Max = 4000 @@ -262,12 +262,25 @@ AnchorSideLeft.Control = AutoHintDelayLabel AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = AutoHintDelayLabel - Left = 132 - Height = 15 - Top = 208 - Width = 92 + Left = 161 + Height = 17 + Top = 231 + Width = 117 BorderSpacing.Left = 20 Caption = 'AutoHDelayLabel' ParentColor = False end + object AutoShowCompletionDropDown: TCheckBox + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = CompletionDropDownHint + AnchorSideTop.Side = asrBottom + Left = 6 + Height = 21 + Top = 388 + Width = 243 + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 + Caption = 'AutoShowCompletionDropDown' + TabOrder = 10 + end end Index: ide/frames/editor_codetools_options.pas =================================================================== --- ide/frames/editor_codetools_options.pas (revision 61726) +++ ide/frames/editor_codetools_options.pas (working copy) @@ -45,6 +45,8 @@ AutoHintDelayTrackBar: TTrackBar; AutoDisplayFuncProtoCheckBox: TCheckBox; AutoHintDelayLabel: TLabel; + AutoRemoveEmptyMethodsOnSave1: TCheckBox; + AutoShowCompletionDropDown: TCheckBox; DbgToolTipAutoCastClass: TCheckBox; CompletionDropDownHintLabel: TLabel; CompletionDropDownHint: TComboBox; @@ -105,6 +107,8 @@ CompletionDropDownHint.Items.Add(lisCompletionLongLineHintTypeRightOnly); CompletionDropDownHint.Items.Add(lisCompletionLongLineHintTypeLittleLeft); CompletionDropDownHint.Items.Add(lisCompletionLongLineHintTypeFullLeft); + + AutoShowCompletionDropDown.Caption := lisAutoShowCompletion; end; procedure TEditorCodetoolsOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); @@ -123,6 +127,7 @@ CompletionDropDownHintTrackBar.Position := CompletionLongLineHintInMSec; CompletionDropDownHint.ItemIndex := ord(CompletionLongLineHintType); + AutoShowCompletionDropDown.Checked := AutoShowCompletion; end; AutoCompletionDelayTrackBarChange(nil); end; @@ -142,7 +147,7 @@ CompletionLongLineHintInMSec := CompletionDropDownHintTrackBar.Position; CompletionLongLineHintType := TSynCompletionLongHintType(CompletionDropDownHint.ItemIndex); - + AutoShowCompletion := AutoShowCompletionDropDown.Checked; end; end; Index: ide/lazarusidestrconsts.pas =================================================================== --- ide/lazarusidestrconsts.pas (revision 61726) +++ ide/lazarusidestrconsts.pas (working copy) @@ -2040,6 +2040,7 @@ lisDelayForCompletionBox = 'Delay for completion box'; lisDelayForHints = 'Delay for hints'; lisDelayForCompletionLongLineHint = 'Delay for long line hints in completion box'; + lisAutoShowCompletion = 'Automatic code completion'; lisCompletionLongLineHintType = 'Show long line hints'; lisCompletionLongLineHintTypeNone = 'Never'; lisCompletionLongLineHintTypeRightOnly = 'Extend right only'; Index: ide/sourceeditor.pp =================================================================== --- ide/sourceeditor.pp (revision 61726) +++ ide/sourceeditor.pp (working copy) @@ -5743,6 +5743,11 @@ OnKeyDown(Sender, Key, Shift); IDECommandList.PostponeUpdateEvents; + + // very crude invokaion of identifier completion + if EditorOpts.AutoShowCompletion then + if (chr(Key) in ['a'..'z', 'A'..'Z']) and (Shift <> [ssCtrl]) and (Shift <> [ssAlt]) and (Shift <> [ssAltGr]) then + StartIdentCompletionBox(false,false); end; procedure TSourceEditor.EditorKeyUp(Sender: TObject; var Key: Word; On Tue, Aug 20, 2019 at 6:54 PM Darius Blaszyk wrote: > Now with attachment! 😀 > > On Tue, Aug 20, 2019 at 6:48 PM Darius Blaszyk > wrote: > >> Hi! >> >> Attached a (still) naive patch that implements automatic completion upon >> keypress. It's already giving me a big boost in productivity so I thought I >> might share it here. It would be good to make the identifier invocation a >> bit smarter. For instance I would like to prevent invocation in case the >> word is part of a string or comment. Also it should auto hide after the >> first character gets deleted by backspace. Any tips or hints how to use the >> codetools to get the required information is appreciated! >> >> Rgds, Darius Blaszyk >> >> On Fri, Aug 16, 2019 at 10:55 PM Martin Frb via lazarus < >> lazarus at lists.lazarus-ide.org> wrote: >> >>> On 16/08/2019 19:07, Darius Blaszyk via lazarus wrote: >>> > Hi, >>> > >>> > I know about code completion in the IDE and it works perfectly! >>> > However, to invoke it I need to press CRTL-space every time which is >>> > somewhat cumbersome. Is there a setting in the IDE that would invoke >>> > completion automatically on keypress? >>> > >>> It can auto invoke after you enter a dot "form1." >>> But otherwise not. >>> >>> See https://bugs.freepascal.org/view.php?id=33054 >>> -- >>> _______________________________________________ >>> lazarus mailing list >>> lazarus at lists.lazarus-ide.org >>> https://lists.lazarus-ide.org/listinfo/lazarus >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From lazarus at mfriebe.de Tue Aug 20 23:20:53 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Tue, 20 Aug 2019 23:20:53 +0200 Subject: [Lazarus] Automatic identifier completion In-Reply-To: References: Message-ID: Not 100% sure, have to go through the code again. (Also you can add to https://bugs.freepascal.org/view.php?id=33054 ) Just throwing in a few quick notes. For string and comments procedure TSourceEditorManager.OnSourceCompletionTimer(Sender: TObject);   function CheckStartIdentCompletion: boolean; ...     if SrcEdit.EditorComponent.GetHighlighterAttriAtRowCol(LogCaret,Token,Attri)     and (Attri<>nil) and (Attri.StoredName=SYNS_XML_AttrComment) then > auto hide after the first character gets deleted by backspace. You mean the word becomes empty. Or the first char typed after the completion did open? (i.e. if the I type Sou and completion only opens then, the hide when I attempt to del part of the Sou?) In either case, there are various ways I can think of for investigation, and we need to established which one is good. SourceEditor sees the typed chars in UserCommands (or the other callback). SO it could interfere there. It could also be added as a callback to (I think that is the one):   TSourceEditCompletion=class(TSynCompletion) Also what should happen, if during completion, other commands are invoked ctrl-e for search as you type even ctrl-f  (those already are an issue....) ---------------------------- If I am not mistaken (only had a very brief look at the patch) You currently have a global bool option: on/off? Would it be sensible to have a (separate) time delay.   So if the user types fast, it will not interfere? I seem to have thought of that as a necessity on the bug report. But since I am not actually using this feature (even if avail), I might be wrong. (Or maybe it was using a timeout, but the existing one...) Equally there might be the (unnecessary) idea, to only trigger if at least n chars of the current word have been typed? Testing with syncro-edit and multi-caret? The latter should probably disable it. On 20/08/2019 18:54, Darius Blaszyk via lazarus wrote: > Now with attachment! 😀 > > On Tue, Aug 20, 2019 at 6:48 PM Darius Blaszyk > wrote: > > Hi! > > Attached a (still) naive patch that implements automatic > completion upon keypress. It's already giving me a big boost in > productivity so I thought I might share it here. It would be good > to make the identifier invocation a bit smarter. For instance I > would like to prevent invocation in case the word is part of a > string or comment. Also it should auto hide after the first > character gets deleted by backspace. Any tips or hints how to use > the codetools to get the required information is appreciated! > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bo.berglund at gmail.com Tue Aug 20 23:47:39 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Tue, 20 Aug 2019 23:47:39 +0200 Subject: [Lazarus] Cross-platform project. Font sizes not the same.... Message-ID: <9opole53vth2s7iidcb3jel06erh2iul01@4ax.com> I have just transfered a simple 3-form project from Windows7 to Linux (Raspbian on RPi4). I am using the same versions of Fpc and Lazarus on both (3.0.4 and 2.0.4). The project compiled fine after the transfer to Raspbian as it did on Windows. But the form is very much in need of control changes since text no longer fits in the controls. Edit boxes grow a lot in height and so on. I can go into the font property of affected controls and change the font size to make it look better, but there are so many... If this is the normal case I don't see how I can maintain two versions from the same sources, I cannot ifdef UNIX vs Windows every place a font is mentioned in the code, in fact it is not even in the code but inside the form file (lfm)... There must be something I have done wrong here, but what? Any porting advice somewhere? I did not set font sizes at all in Lazarus on Windows. it used the defaults and when I check they are set to be 9. But in Lazarus on Linux the font size on the form is 10. It makes quite a difference. Is there some global project setting for the fonts that I can use to make the project cross-platform withut code changes? -- Bo Berglund Developer in Sweden From werner.pamler at freenet.de Wed Aug 21 17:33:17 2019 From: werner.pamler at freenet.de (Werner Pamler) Date: Wed, 21 Aug 2019 17:33:17 +0200 Subject: [Lazarus] Cross-platform project. Font sizes not the same.... In-Reply-To: <9opole53vth2s7iidcb3jel06erh2iul01@4ax.com> References: <9opole53vth2s7iidcb3jel06erh2iul01@4ax.com> Message-ID: <82268f6d-5654-e1c5-d87b-939e305bfd74@freenet.de> AFIK there is no simple way to force fonts to use the same size (unless you specify a given font size - which however may not be the size of some theme of one of the target systems which will make your program look "strange"). The only way I know to make forms cross-platform is to use auto-sizing as much as possible. And don't position controls absolutely, but attach them to their neighbors by means of the AnchorEditor. Avoid frozen form sizes -- the user must be able to readjust the size if something is awfully wrong. From sysrpl at gmail.com Thu Aug 22 04:20:50 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Wed, 21 Aug 2019 22:20:50 -0400 Subject: [Lazarus] Best examples of cross platform visual file or folder search application? Message-ID: I am sure someone has to have written a program to do this, yet I don't know of any off hand or through a cursory google search. Can anyone tell me if there are any popular minimal programs which allow users to search for files or folders on their computer using wildcard matching for file names, optionally containing some text, optionally with a range of file sizes or file modified dates? All this in a simple stand alone application with a nice search results grid and available on Windows, Mac, and Linux. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bo.berglund at gmail.com Thu Aug 22 10:50:29 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Thu, 22 Aug 2019 10:50:29 +0200 Subject: [Lazarus] Cross-platform project. Font sizes not the same.... References: <9opole53vth2s7iidcb3jel06erh2iul01@4ax.com> Message-ID: On Tue, 20 Aug 2019 23:47:39 +0200, Bo Berglund via lazarus wrote: >I can go into the font property of affected controls and change the >font size to make it look better, but there are so many... In fact there are not that many controls so I tried to do the following on Windows: procedure TfrmMain.SetFontSize(S: integer); begin // Set font size on load. btnDec60.Font.Size := S; btnDec30.Font.Size := S; btnDec10.Font.Size := S; btnDec1.Font.Size := S; btnInc1.Font.Size := S; btnInc10.Font.Size := S; btnInc30.Font.Size := S; btnInc60.Font.Size := S; btnCutStart.Font.Size := S; btnCutEnd.Font.Size := S; btnAddCut.Font.Size := S; btnJump.Font.Size := S; btnShiftAudio.Font.Size := S; speDelay.Font.Size := S; stxCutStart.Font.Size := S; stxCutEnd.Font.Size := S; stxCutTime.Font.Size := S; stxClipCnt.Font.Size := S; gbxCut.Font.Size := S; ckbLogin.Font.Size := S; end; procedure TfrmMain.FormShow(Sender: TObject); begin SetFontSize(9); end; This works just fine on Windows so I went to my RPi4 and opened the project there and added these two procedures also to that instance of the project, thinking it would at laset fix the font size temporarily. But when I run this I get an exception! --------------------------------------------------------------------- Debugger Exception Notification Project VideoPlayer raised exception class 'EReadError' with message: Invalid value for property At address C4920 [] Ignore this exception type [Break] [Continue] --------------------------------------------------------------------- If I check the Ignore checkbox and contine I get another error: --------------------------------------------------------- Error reading frmMain.OnShow: Invalid value for property Press OK to ignore and risk data corruption Press Abort to kill the program [Abort] [OK] --------------------------------------------------------- Strangely it did not manage to handle the integer value for font size so I redefined the SetFontSize procedure to be declared as follows: procedure TfrmMain.SetFontSize(S: shortint); With this in place the form in Linux became the same as on Windows size-wise regarding texts. Maybe a difference between the operating systems, I think Raspbian is still a 32 bit system whereas Lazarus on Window 7 x64 is a 64 bit program on a 64 bit OS. -- Bo Berglund Developer in Sweden From juha.manninen62 at gmail.com Thu Aug 22 17:29:21 2019 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Thu, 22 Aug 2019 18:29:21 +0300 Subject: [Lazarus] TLabel accelerator "&:" don't work since 2018 In-Reply-To: References: Message-ID: On Sun, Aug 4, 2019 at 1:30 PM Alexey Tor. via lazarus wrote: > User of CudaText says that he sees not working accelerator (TLabel) for > ":" char in his addons (Label1.Caption:= "Enter string&:" ). That is an unusual accelerator, ':' requires Shift and that apparently does not work. It is not related to Windows, I tested on Linux with LCL-GTK2. Why would somebody use such an accelerator? Normal characters and numbers work OK. Juha From michael at freepascal.org Sun Aug 25 13:23:47 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 25 Aug 2019 13:23:47 +0200 (CEST) Subject: [Lazarus] Lazarus help Message-ID: Hello, The following help page seems completely out of date: https://wiki.lazarus.freepascal.org/IDE_Window:_Editor_Options_Completion_Hints The only header that can be recognized is 'Auto remove empty methods'. I would correct it, but I have *really* no idea what the items in that dialog actually do. at this point, I just randomly set some options and hope to see some effect in the editor. Quite sobering, after 15 years of working in the IDE :) Michael. From lazarus at mfriebe.de Sun Aug 25 17:42:44 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 25 Aug 2019 17:42:44 +0200 Subject: [Lazarus] Lazarus help In-Reply-To: References: Message-ID: <2a3aa50f-db50-794d-9796-5fa993cbc48d@mfriebe.de> On 25/08/2019 13:23, Michael Van Canneyt via lazarus wrote: > > Hello, > > The following help page seems completely out of date: > > https://wiki.lazarus.freepascal.org/IDE_Window:_Editor_Options_Completion_Hints > > > The only header that can be recognized is  'Auto remove empty methods'. > > I would correct it, but I have *really* no idea what the items in that > dialog actually do. I filled in quick descriptions of each feature. Feel free to ask, if any is unclear From lazarus at mfriebe.de Sun Aug 25 17:44:57 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 25 Aug 2019 17:44:57 +0200 Subject: [Lazarus] Lazarus help In-Reply-To: <2a3aa50f-db50-794d-9796-5fa993cbc48d@mfriebe.de> References: <2a3aa50f-db50-794d-9796-5fa993cbc48d@mfriebe.de> Message-ID: <24d34901-6a92-c4d8-485b-6253cdeffbad@mfriebe.de> On 25/08/2019 17:42, Martin Frb via lazarus wrote: > > I filled in quick descriptions of each feature. > > Feel free to ask, if any is unclear The only one I am myself totally unfamiliar with is: Add close statement for Pascal blocks This really belongs in the codetool config, but nobody ever took the time to move it. From michael at freepascal.org Sun Aug 25 19:59:46 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 25 Aug 2019 19:59:46 +0200 (CEST) Subject: [Lazarus] Lazarus help In-Reply-To: <24d34901-6a92-c4d8-485b-6253cdeffbad@mfriebe.de> References: <2a3aa50f-db50-794d-9796-5fa993cbc48d@mfriebe.de> <24d34901-6a92-c4d8-485b-6253cdeffbad@mfriebe.de> Message-ID: On Sun, 25 Aug 2019, Martin Frb via lazarus wrote: > On 25/08/2019 17:42, Martin Frb via lazarus wrote: >> >> I filled in quick descriptions of each feature. >> >> Feel free to ask, if any is unclear > The only one I am myself totally unfamiliar with is: Add close statement > for Pascal blocks I think this means adding the 'end' after you typed a 'begin'. Maybe it also adds a finally after a try. > This really belongs in the codetool config, but nobody ever took the > time to move it. Well, meanwhile there is such a staggering amount of options that it probably scares the bejeezus out of any beginner. Maybe we can add more options to remedy this: 'User level:' 'Beginner' 'Untermediate' 'Expert' Which shows ever more options, where "beginner" shows only the color scheme ;-) Michael. From marc at dommelstein.nl Mon Aug 26 20:52:36 2019 From: marc at dommelstein.nl (Marc Weustink) Date: Mon, 26 Aug 2019 20:52:36 +0200 Subject: [Lazarus] Lazarus on POWER9 Little Endian In-Reply-To: References: <20190818114135.8265.B7062D51@tgtools.de> <8b1658ef-5293-e759-18f7-92c4f08f3fcc@freepascal.org> Message-ID: When debugging these kinds of X related errors, start your application with the (gtk) X option in synchronized mode. I can't remember which option it was, but Google will tell Marc On August 20, 2019 1:06:35 PM GMT+02:00, Tobias Giesen via lazarus wrote: >It seems to work slightly better on Fedora. It doesn't cause a signal >and >very briefly, an empty small window appears. The console output is like >this: >[tobias at blackbird lazarus]$ ./startlazarus > is a file > >(startlazarus:3893): Gdk-ERROR **: 13:02:08.997: The program >'startlazarus' >received an X Window System error. >This probably reflects a bug in the program. >The error was 'BadValue (integer parameter out of range for >operation)'. > (Details: serial 334 error_code 2 request_code 130 minor_code 3) > (Note to programmers: normally, X errors are reported asynchronously; > that is, you will receive the error a while after causing it. > To debug your program, run it with the --sync command line > option to change this behavior. You can then get a meaningful >backtrace from your debugger if you break on the gdk_x_error() >function.) >Trace/breakpoint trap (core dumped) > >On Mon, Aug 19, 2019 at 9:24 PM Florian Klaempfl via lazarus < >lazarus at lists.lazarus-ide.org> wrote: > >> Am 18.08.2019 um 11:41 schrieb Tobias Giesen via lazarus: >> > Hello, >> > I am trying to use Lazarus on a ppc64el processor under Ubuntu. >> > >> > Unfortunately startlazarus and lazarus crash with a segmentation >fault in >> > a call to XGetWindowProperty in gtk2widgetset.inc in function >> > TGtk2WidgetSet.GetWindowManager. >> >> A stack trace and assembler dump at the crash location might be >helpful ... >> -- >> _______________________________________________ >> lazarus mailing list >> lazarus at lists.lazarus-ide.org >> https://lists.lazarus-ide.org/listinfo/lazarus >> From bo.berglund at gmail.com Mon Aug 26 21:53:38 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Mon, 26 Aug 2019 21:53:38 +0200 Subject: [Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus? Message-ID: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> I am going to write a small application to access a mySql database from our website. The database has been exported to an SQL file and imported into a local MariaDB running on a Raspberry Pi4 on our network. Now I want to access it from my Windows 7 environment via Lazarus (not inside the editor but from a program written using Lazarus). I am confused about the SQLDB component tab in the IDE since it lists many connection components for MySql (7 in fact). Which one do I use? I have used Lazarus and SQLDB for MsSQLServer with TMSSQLConnection, but that is a single component... What version of the TMySqlxxConnection shall I use towards a MariaDB? The displayed version is: $ mysql --version mysql Ver 15.1 Distrib 10.3.15-MariaDB, for debian-linux-gnueabihf (armv8l) using readline 5.2 Does this by any chance indicate one should use a TMySql52Connection? But then again that component does not exist on the palette... A working fpc example towards a MariaDB database server would be valuable! I run Lazarus 2.0.4 with Fpc 3.0.4 on Windows 7 and on Raspberry Pi4, -- Bo Berglund Developer in Sweden From bo.berglund at gmail.com Mon Aug 26 23:33:07 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Mon, 26 Aug 2019 23:33:07 +0200 Subject: [Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus? References: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> Message-ID: On Mon, 26 Aug 2019 21:53:38 +0200, Bo Berglund via lazarus wrote: Do you need to install mySql on the client machine in order to connect with the MariaDB database on the server machine? I have not installed any database engine except for MSSQLServer on my Windows7 computer. >A working fpc example towards a MariaDB database server would be >valuable! > >I run Lazarus 2.0.4 with Fpc 3.0.4 on Windows 7 and on Raspberry Pi4, > What I google up does not end in a working way. Bad googling... Or people only post problems and not success. -- Bo Berglund Developer in Sweden From michael at freepascal.org Mon Aug 26 23:39:47 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Mon, 26 Aug 2019 23:39:47 +0200 (CEST) Subject: [Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus? In-Reply-To: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> References: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> Message-ID: On Mon, 26 Aug 2019, Bo Berglund via lazarus wrote: > I am going to write a small application to access a mySql database > from our website. The database has been exported to an SQL file and > imported into a local MariaDB running on a Raspberry Pi4 on our > network. > > Now I want to access it from my Windows 7 environment via Lazarus (not > inside the editor but from a program written using Lazarus). > > I am confused about the SQLDB component tab in the IDE since it lists > many connection components for MySql (7 in fact). Which one do I use? TMySQL57Connection. > > I have used Lazarus and SQLDB for MsSQLServer with TMSSQLConnection, > but that is a single component... > What version of the TMySqlxxConnection shall I use towards a MariaDB? See above. > > The displayed version is: > > $ mysql --version > mysql Ver 15.1 Distrib 10.3.15-MariaDB, for debian-linux-gnueabihf > (armv8l) using readline 5.2 > > Does this by any chance indicate one should use a TMySql52Connection? > But then again that component does not exist on the palette... No, see above. If I may suggest: If you have a choice of database, choose something else. MariaDB/MySQLDB are the probably the worst choices you can make. Postgres, Firebird, SQLIte: all better choices, depending on your use case. Michael. From michael at freepascal.org Mon Aug 26 23:39:47 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Mon, 26 Aug 2019 23:39:47 +0200 (CEST) Subject: [Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus? In-Reply-To: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> References: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> Message-ID: On Mon, 26 Aug 2019, Bo Berglund via lazarus wrote: > I am going to write a small application to access a mySql database > from our website. The database has been exported to an SQL file and > imported into a local MariaDB running on a Raspberry Pi4 on our > network. > > Now I want to access it from my Windows 7 environment via Lazarus (not > inside the editor but from a program written using Lazarus). > > I am confused about the SQLDB component tab in the IDE since it lists > many connection components for MySql (7 in fact). Which one do I use? TMySQL57Connection. > > I have used Lazarus and SQLDB for MsSQLServer with TMSSQLConnection, > but that is a single component... > What version of the TMySqlxxConnection shall I use towards a MariaDB? See above. > > The displayed version is: > > $ mysql --version > mysql Ver 15.1 Distrib 10.3.15-MariaDB, for debian-linux-gnueabihf > (armv8l) using readline 5.2 > > Does this by any chance indicate one should use a TMySql52Connection? > But then again that component does not exist on the palette... No, see above. If I may suggest: If you have a choice of database, choose something else. MariaDB/MySQLDB are the probably the worst choices you can make. Postgres, Firebird, SQLIte: all better choices, depending on your use case. Michael. From bo.berglund at gmail.com Tue Aug 27 00:22:02 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Tue, 27 Aug 2019 00:22:02 +0200 Subject: [Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus? References: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> Message-ID: On Mon, 26 Aug 2019 23:39:47 +0200 (CEST), Michael Van Canneyt via lazarus wrote: >If you have a choice of database, choose something else. >MariaDB/MySQLDB are the probably the worst choices you can make. >Postgres, Firebird, SQLIte: all better choices, depending on your use case. > Well it so happens that the database I need to access is a MySql one on our website. So I have created an export of it using phpmyadmin on the webserver and loaded this into a MariaDB server I have inbstalled on a RaspberryPi4 box. Gonna use this while I am making the program to finally be deployed against the website database. So the database server is not really a choice I can make. In my past I worked with Delphi against MSSQLServer for many years using the ADODB connection in Delphi. Now no longer using Delphi and no longer at that company either. So Fpc/Lazarus it is.... -- Bo Berglund Developer in Sweden From tobiasgiesen at gmail.com Tue Aug 27 01:39:46 2019 From: tobiasgiesen at gmail.com (tobiasgiesen at gmail.com) Date: Tue, 27 Aug 2019 01:39:46 +0200 Subject: [Lazarus] Lazarus on POWER9 Little Endian In-Reply-To: References: Message-ID: <20190827013945.0BE5.B7062D51@tgtools.de> Hi, this problem has now been solved with a new FPC 3.3.1 fix that's available on SVN (trunk) now. Lazarus runs and I'm happy :=) Cheers, Tobias ---- On Mon, 26 Aug 2019 20:52:36 +0200 Marc Weustink via lazarus wrote: > When debugging these kinds of X related errors, start your application with the (gtk) X option in synchronized mode. > I can't remember which option it was, but Google will tell > > Marc > > On August 20, 2019 1:06:35 PM GMT+02:00, Tobias Giesen via lazarus wrote: > >It seems to work slightly better on Fedora. It doesn't cause a signal > >and > >very briefly, an empty small window appears. The console output is like > >this: > >[tobias at blackbird lazarus]$ ./startlazarus > > is a file > > > >(startlazarus:3893): Gdk-ERROR **: 13:02:08.997: The program > >'startlazarus' > >received an X Window System error. > >This probably reflects a bug in the program. > >The error was 'BadValue (integer parameter out of range for > >operation)'. > > (Details: serial 334 error_code 2 request_code 130 minor_code 3) > > (Note to programmers: normally, X errors are reported asynchronously; > > that is, you will receive the error a while after causing it. > > To debug your program, run it with the --sync command line > > option to change this behavior. You can then get a meaningful > >backtrace from your debugger if you break on the gdk_x_error() > >function.) > >Trace/breakpoint trap (core dumped) > > > >On Mon, Aug 19, 2019 at 9:24 PM Florian Klaempfl via lazarus < > >lazarus at lists.lazarus-ide.org> wrote: > > > >> Am 18.08.2019 um 11:41 schrieb Tobias Giesen via lazarus: > >> > Hello, > >> > I am trying to use Lazarus on a ppc64el processor under Ubuntu. > >> > > >> > Unfortunately startlazarus and lazarus crash with a segmentation > >fault in > >> > a call to XGetWindowProperty in gtk2widgetset.inc in function > >> > TGtk2WidgetSet.GetWindowManager. > >> > >> A stack trace and assembler dump at the crash location might be > >helpful ... > >> -- > >> _______________________________________________ > >> lazarus mailing list > >> lazarus at lists.lazarus-ide.org > >> https://lists.lazarus-ide.org/listinfo/lazarus > >> > -- > _______________________________________________ > lazarus mailing list > lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus Kind Regards, Tobias Giesen Super Flexible Software GmbH & Co. KG Buddenstr. 29-31 48143 Münster, Germany www.superflexible.com www.tgtools.com ----------------------------------------------------------- Registered at register court Münster as HRA 9716 Liability / general partner: TGTools GmbH Registered at register court Münster as HRB 17763 Directors: Tobias Giesen and Claudia Giesen From michael at freepascal.org Tue Aug 27 07:51:16 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Tue, 27 Aug 2019 07:51:16 +0200 (CEST) Subject: [Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus? In-Reply-To: References: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> Message-ID: On Tue, 27 Aug 2019, Bo Berglund via lazarus wrote: > On Mon, 26 Aug 2019 23:39:47 +0200 (CEST), Michael Van Canneyt via > lazarus wrote: > >> If you have a choice of database, choose something else. >> MariaDB/MySQLDB are the probably the worst choices you can make. >> Postgres, Firebird, SQLIte: all better choices, depending on your use case. >> > > Well it so happens that the database I need to access is a MySql one > on our website. So I have created an export of it using phpmyadmin on > the webserver and loaded this into a MariaDB server I have inbstalled > on a RaspberryPi4 box. > Gonna use this while I am making the program to finally be deployed > against the website database. > So the database server is not really a choice I can make. That's why I started with 'if you have a choice'. MySQL by itself is not a very good database, but connecting to it from FPC/Lazarus is even worse. Unfortunately, the ease of use of the LAMP stack made it very popular, and many are in your situation. I would not recommend it for new projects. Michael. From michael at freepascal.org Tue Aug 27 07:51:16 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Tue, 27 Aug 2019 07:51:16 +0200 (CEST) Subject: [Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus? In-Reply-To: References: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> Message-ID: On Tue, 27 Aug 2019, Bo Berglund via lazarus wrote: > On Mon, 26 Aug 2019 23:39:47 +0200 (CEST), Michael Van Canneyt via > lazarus wrote: > >> If you have a choice of database, choose something else. >> MariaDB/MySQLDB are the probably the worst choices you can make. >> Postgres, Firebird, SQLIte: all better choices, depending on your use case. >> > > Well it so happens that the database I need to access is a MySql one > on our website. So I have created an export of it using phpmyadmin on > the webserver and loaded this into a MariaDB server I have inbstalled > on a RaspberryPi4 box. > Gonna use this while I am making the program to finally be deployed > against the website database. > So the database server is not really a choice I can make. That's why I started with 'if you have a choice'. MySQL by itself is not a very good database, but connecting to it from FPC/Lazarus is even worse. Unfortunately, the ease of use of the LAMP stack made it very popular, and many are in your situation. I would not recommend it for new projects. Michael. From bo.berglund at gmail.com Tue Aug 27 09:36:02 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Tue, 27 Aug 2019 09:36:02 +0200 Subject: [Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus? References: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> Message-ID: On Tue, 27 Aug 2019 07:51:16 +0200 (CEST), Michael Van Canneyt via lazarus wrote: >> So the database server is not really a choice I can make. > >That's why I started with 'if you have a choice'. > >MySQL by itself is not a very good database, but connecting to it from >FPC/Lazarus is even worse. > >Unfortunately, the ease of use of the LAMP stack made it very popular, >and many are in your situation. I would not recommend it for new projects. > Thanks, I should maybe drop the idea of keeping a mirrored database in MySql format and instead use an MSSQLServer db as the mirror. I know for a fact that accessing that from Lazarus is pretty simple. I will look into the possibility of importing the MySql dump into MSSQLServer, after all it is in SQL format and our tables are not really very complex either. If that works I could add to the website php some kind handling of an operations log file where I save the SQL statements that are adding the data to the website db. Then I could retrieve these regularly and run against the backup database using a Lazarus/Fpc program on Windows (where the main database is hosted). -- Bo Berglund Developer in Sweden From fpc-devel at aborka.com Tue Aug 27 16:22:49 2019 From: fpc-devel at aborka.com (AB) Date: Tue, 27 Aug 2019 07:22:49 -0700 Subject: [Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus? In-Reply-To: References: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> Message-ID: You can use the open source zeoslib ( http://zeoslib.sourceforge.net/ ). It can access many databases, including mysql and mariadb since many many years. There is nothing wrong with using mysql or mariadb for websites, it is not an accident that they are popular. AB On 8/27/19 12:36 AM, Bo Berglund via lazarus wrote: > On Tue, 27 Aug 2019 07:51:16 +0200 (CEST), Michael Van Canneyt via > lazarus wrote: > >>> So the database server is not really a choice I can make. >> >> That's why I started with 'if you have a choice'. >> >> MySQL by itself is not a very good database, but connecting to it from >> FPC/Lazarus is even worse. >> >> Unfortunately, the ease of use of the LAMP stack made it very popular, >> and many are in your situation. I would not recommend it for new projects. >> > > Thanks, > I should maybe drop the idea of keeping a mirrored database in MySql > format and instead use an MSSQLServer db as the mirror. > I know for a fact that accessing that from Lazarus is pretty simple. > > I will look into the possibility of importing the MySql dump into > MSSQLServer, after all it is in SQL format and our tables are not > really very complex either. > > If that works I could add to the website php some kind handling of an > operations log file where I save the SQL statements that are adding > the data to the website db. Then I could retrieve these regularly and > run against the backup database using a Lazarus/Fpc program on Windows > (where the main database is hosted). > > From michael at freepascal.org Tue Aug 27 16:32:56 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Tue, 27 Aug 2019 16:32:56 +0200 (CEST) Subject: [Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus? In-Reply-To: References: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> Message-ID: On Tue, 27 Aug 2019, AB via lazarus wrote: > You can use the open source zeoslib ( http://zeoslib.sourceforge.net/ ). > > It can access many databases, including mysql and mariadb since many > many years. So can SQLDB. The point is that it's a bad idea to use it. > > There is nothing wrong with using mysql or mariadb for websites, it is > not an accident that they are popular. Depends on what you expect from a database. MySQL is not really ACID. It is also not really typesafe (you can store 0 in a date field), has no referential integrity by default and does not use transactions by default. You can add these but at the cost of performance. So by default you can store any junk in it that you want: It just manages more or less structured files with an SQL syntax. But if that is enough for you (and it is for most PHP programmers) then go right ahead, but my demands are a little higher... Michael. From bo.berglund at gmail.com Tue Aug 27 23:34:39 2019 From: bo.berglund at gmail.com (Bo Berglund) Date: Tue, 27 Aug 2019 23:34:39 +0200 Subject: [Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus? References: <1fd8met7tsefaitilprcv2h2tfi6l2nk2e@4ax.com> Message-ID: On Tue, 27 Aug 2019 09:36:02 +0200, Bo Berglund via lazarus wrote: >I will look into the possibility of importing the MySql dump into >MSSQLServer, after all it is in SQL format and our tables are not >really very complex either. I went over the SQL produced by a PhpMyAdmin export and changed quite a lot of formal things in it. But in the end I managed to execute the script in the 2104 SQL Management Studio and put the data into a mirror of the website database on MSSQLServer. So now I can work with that concerning the website backup of the data. And the SQLDb connection will be so much easier to implement. -- Bo Berglund Developer in Sweden From lazarus at kluug.net Wed Aug 28 09:23:16 2019 From: lazarus at kluug.net (Ondrej Pokorny) Date: Wed, 28 Aug 2019 09:23:16 +0200 Subject: [Lazarus] Project Groups are saving LPI files In-Reply-To: <20190817165350.4961505e@limapholos.matflo.wg> References: <20190817165350.4961505e@limapholos.matflo.wg> Message-ID: <8c361409-fdc3-d0e4-36dc-8f9b857afc1f@kluug.net> On 17.08.2019 16:53, Mattias Gaertner via lazarus wrote: > On Thu, 15 Aug 2019 13:43:58 +0200 > Ondrej Pokorny via lazarus wrote: > >> [...] >> Project groups are saving my LPI files upon loading the project >> group. > Huh? Do you really mean, merely opening a lpg touches some lpi files? Yes, this is exactly what happens. The project group rewrites all lpi files within the project group itself. > TXMLConfig.CreateClean; > TXMLConfig.Flush; -> should write, so needs Modified=true > > Maybe it is a bad idea to auto flush on Destroy. So what is the reason to have the modified flag when it is set to true on loading - when the file is definitely not modified? Another idea would be to have a "Force: Boolean" parameter in Flush that would ignore the modified flag and write anyway. Ondrej From sysrpl at gmail.com Fri Aug 30 10:18:30 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 30 Aug 2019 04:18:30 -0400 Subject: [Lazarus] Tests results of several pascal based JSON parsers Message-ID: I've posted a new page that tests the speed and correctness of several pascal based JSON parsers. https://www.getlazarus.org/json/tests/ In full disclosure I am the author of the new open source JsonTools library, and even though my parser seems to a big improvement over the other alternatives, my tests were not biased. If anyone would like help in replication the tests, let me know and I'll see what I can do. Also, to be thorough, you should read through both the article I posted at the top this message, and my original page which has been updated with more information. Both pages took some time to write, and I promise if you read through them some of your questions will be answered without having to ask others for help or insight. Thanks, Anthony -------------- next part -------------- An HTML attachment was scrubbed... URL: From aaa5500 at ya.ru Fri Aug 30 10:57:08 2019 From: aaa5500 at ya.ru (Alexey Tor.) Date: Fri, 30 Aug 2019 11:57:08 +0300 Subject: [Lazarus] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: This is very good news, that we have JsonTools parser now. I may think of using it in CudaText - ie replacing fpJSON to JsonTools. About lib. 1) Pls add an option to handle //.... comments in json. yes, json don't allow this but CudaText and SublimeText and many programs have json configs with comments. They use libs which allow comments. fpJSON allows comments by option. 2) Pls add an option which allows "," after final dict node: { "a":1, "b":2, } so my app can read json file with final (bad) comma after "b":2. 3) Lib must support "true", "false", "none" or "nil"(?), values like list [], with empty list, values like dict {}, with empty dict. And list inside dict etc. Alexey Torgashin From sysrpl at gmail.com Fri Aug 30 11:13:09 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 30 Aug 2019 05:13:09 -0400 Subject: [Lazarus] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: Alexey, Currently JsonTools anything that is valid JSON as described on this page: https://www.json.org/ The only valid constants are: null, true, false Arrays can contain other arrays and object to any reasonable level [[[]]] // is a valid array [{}{}[{}{}]] // is a valid array Objects can contain other objects and arrays to any reasonable level {"a":{"a":{"a":[[]]}}} // is a valid object I will look into you request for comment support, even though comments are not allowed in the official specification. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Fri Aug 30 11:15:55 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 30 Aug 2019 11:15:55 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: On Fri, 30 Aug 2019, Anthony Walter wrote: > I've posted a new page that tests the speed and correctness of several > pascal based JSON parsers. > > https://www.getlazarus.org/json/tests/ > > In full disclosure I am the author of the new open source JsonTools > library, and even though my parser seems to a big improvement over the > other alternatives, my tests were not biased. Test are always biased in the sense that they depend on the proficiency of the coder. you must ask someone with sufficient knowledge to write the code. The shootout benchmarks for example are dismally coded for FPC with as a result that they perform badly. So it could well be that the fpJSON results for example can be improved a lot by changing the method used to a more efficient one. Also, not every library is designed with the same goals. fpjson could probably be made smaller if the goal was more focused. it has a factory pattern, added on behalf of users who asked for this. jsontools does not have this. You can format the output. JSONTools does not have this. fpJSON was designed to be pluggable wrt. parsing. JSONTools is not. In short fpjson can do a lot more than JSONtools. Some things come at a price, others not. In that sense, tests like this compare apples with pears. > If anyone would like help in replication the tests, let me know and I'll > see what I can do. > > Also, to be thorough, you should read through both the article I posted at > the top this message, and my original page > which has been updated with more information. Both pages took some time to > write, and I promise if you read through them some of your questions will > be answered without having to ask others for help or insight. Can you please send me the testcode you used for your speed & correctness tests ? I'm a bit surprised to see fpJSON fail in unicode correctness. It's been tested extensively, maybe your code contains errors (or maybe fpjson does, I'll need to check). Also please explain what 'Handling duplicate key names correctly' means to you. Saying that a library fails a test without specifying what the test is, is strange. Michael. From michael at freepascal.org Fri Aug 30 11:16:42 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 30 Aug 2019 11:16:42 +0200 (CEST) Subject: [Lazarus] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: On Fri, 30 Aug 2019, Anthony Walter via lazarus wrote: > Alexey, > > Currently JsonTools anything that is valid JSON as described on this page: > > https://www.json.org/ > > The only valid constants are: null, true, false > Arrays can contain other arrays and object to any reasonable level > [[[]]] // is a valid array > [{}{}[{}{}]] // is a valid array > Objects can contain other objects and arrays to any reasonable level > {"a":{"a":{"a":[[]]}}} // is a valid object > > I will look into you request for comment support, even though comments are > not allowed in the official specification. And so your tool will also become more bulky and slower :) Michael. From aaa5500 at ya.ru Fri Aug 30 11:25:25 2019 From: aaa5500 at ya.ru (Alexey Tor.) Date: Fri, 30 Aug 2019 12:25:25 +0300 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Yes, JsonTools needs a method SaveToFile if it has not. It must save formatted json with indent, set by a property or global variable (default is 2 usually). SaveToFile must handle Unicode strings, ie output them with \uNNNN or like it. Use Unicode escape for all codes >=128, because utf8 codes all after 127. Alexey From sysrpl at gmail.com Fri Aug 30 11:44:45 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 30 Aug 2019 05:44:45 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: With regards to duplicate key names, some libraries allow for the same key to be parsed resulting in multiple child nodes of the same name. Others throw an exception when parsing an object with a duplicate key name. The correct way to handle duplicate keys is to overwrite the existing key when a duplicate is encountered. My library does have Save/Load To/From /File/Stream. Please see the articles I posted. They are listed there. Unicode support exists in both allowing unicode to be in the JSON, and escape inotpced e.g. \u00ae becomes ® a two byte utf8 encoding char when parsed by my parser. It also saves/load that utf8 encoding to steams or files. Regarding indentation and formatted, I support two options as noted in my original article. The AsJson property create spaceless compact JSON suitable for network traffic, while the Vale property allows for friendly human readable formatting and indentation. Currently the friendly indentation is fixed and I doesn't see a reason use case reason to allow for custom indentation beyond what I already provide. And finally regarding the unicode failure of FPJson, I am parsing a small bit of JSON ... { "name": "Joe\u00aeSchmoe"} And compare it to the value of 'name' to the string constant 'Joe®Schmoe' in pascal code. If fails the first iteration, but if I run it a second time it works, so there is something amiss. And finally with regards to plugins and extensiblity, that's great to have, but I am just trying to write something that handles the JSON spec and only that. If I want something to stream a form layout or settings to JSON it would be a separate wholly independent library that depends ona parser, but isn't part of the parser library. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sysrpl at gmail.com Fri Aug 30 11:52:17 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 30 Aug 2019 05:52:17 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: Michael, I have a hurricane headed my way, but when I'm done evacuating I'll send you a copy of my test. If you want to make improvements to the test program to be sure the manner in which I am using the FPJson functions and classes is correct and send me a revised test program, then that would be awesome. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Fri Aug 30 11:56:14 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 30 Aug 2019 11:56:14 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Fri, 30 Aug 2019, Anthony Walter via lazarus wrote: > With regards to duplicate key names, some libraries allow for the same key > to be parsed resulting in multiple child nodes of the same name. Others > throw an exception when parsing an object with a duplicate key name. > > The correct way to handle duplicate keys is to overwrite the existing key > when a duplicate is encountered. There you go. I think the "correct way" is to raise an error; not to override and thus inadvertently lose previous data. I won't argue on who is correct, since it is a matter of opinion. But this is a prime example of 'biased' tests. You're testing an opinion, not actual functionality. so IMHO it would be only fair to remove it from your comparison. For speed & correctness, I repeat my request: please provide your test code. Michael. From michael at freepascal.org Fri Aug 30 11:57:18 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 30 Aug 2019 11:57:18 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Fri, 30 Aug 2019, Anthony Walter via lazarus wrote: > Michael, > > I have a hurricane headed my way, but when I'm done evacuating I'll send > you a copy of my test. If you want to make improvements to the test program > to be sure the manner in which I am using the FPJson functions and classes > is correct and send me a revised test program, then that would be awesome. Just make sure you don't get caught in the hurricane. I wish you a quickk hiding place ! :-) Michael. From sysrpl at gmail.com Fri Aug 30 12:23:14 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 30 Aug 2019 06:23:14 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: Michael, Can you tell me why the second half (N.Items[1].AsUnicodeString) this test fails? This is the part that decodes "bank teller \u00Ae ". function VerifyUnicodeChars: Boolean; const UnicodeChars = '{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae " }'; var N: TJSONData; begin N := GetJSON(UnicodeChars); Result := (N.Items[0].AsUnicodeString = 'Joe®Schmoe') and (N.Items[1].AsUnicodeString = 'bank teller ® '); N.Free; end; begin WriteLn('Handles unicode chars correctly: ', VerifyUnicodeChars); end. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Fri Aug 30 12:48:23 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 30 Aug 2019 12:48:23 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Fri, 30 Aug 2019, Anthony Walter via lazarus wrote: > Michael, > > Can you tell me why the second half (N.Items[1].AsUnicodeString) this test > fails? This is the part that decodes "bank teller \u00Ae ". The test fails on "Joe®Schmoe", not on "bank teller \u00Ae ". If you WriteLn the UnicodeChars string to console, it shows: { "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae " } (notice the  in front of ®) This is because your string is encoded wrong in the binary. Adding {$codepage UTF8} Before the uses clause makes your test print 'TRUE'. Because I work on Linux, I also had to add the "cwstring" unit to the uses clause. Michael. From sysrpl at gmail.com Fri Aug 30 15:36:45 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 30 Aug 2019 09:36:45 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On my system with FPJson the test is failing it failing on "bank teller \u00Ae ", but on when using approximately the same code with JSONTools it passes on both "name" and "occupation" always. What do you think is going on? -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Fri Aug 30 16:04:47 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 30 Aug 2019 16:04:47 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Fri, 30 Aug 2019, Anthony Walter via lazarus wrote: > On my system with FPJson the test is failing it failing on "bank teller > \u00Ae ", but on when using approximately the same code with JSONTools it > passes on both "name" and "occupation" always. What do you think is going > on? No idea. I tested with both 3.0.4 and trunk. Both give the same result. Here are the sources I used: home:~/fpc/packages/fcl-json/tests> cat twalter.pas program twalter; {$codepage UTF8} uses cwstring, fpjson, jsonparser; function VerifyUnicodeChars: Boolean; const UnicodeChars = '{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae " }'; var N: TJSONData; begin N := GetJSON(UnicodeChars); Writeln('>',UnicodeChars,'<'); Result := (N.Items[0].AsUnicodeString = 'Joe®Schmoe') and (N.Items[1].AsUnicodeString = 'bank teller ® '); N.Free; end; begin WriteLn('Handles unicode chars correctly: ', VerifyUnicodeChars); end. I test on linux, but could try windows. Michael. From aaa5500 at ya.ru Fri Aug 30 16:05:56 2019 From: aaa5500 at ya.ru (Alexey) Date: Fri, 30 Aug 2019 17:05:56 +0300 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: <73806283-2FDD-4BDB-A2E4-B064E8DBDE84@ya.ru> It is maybe bug which was fixed in FPC trunk, there was some Unicode issue in 3.0.4. > > On my system with FPJson the test is failing it failing on "bank teller \u00Ae ", but on when using approximately the same code with JSONTools it passes on both "name" and "occupation" always. What do you think is going on? > -- > From sysrpl at gmail.com Fri Aug 30 16:21:49 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 30 Aug 2019 10:21:49 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: Alan, oh that's a good idea. I will do that as well as add a few more parser libraries as requested by a few people in other non mailing lists threads. I will also try to find out what's going on the unicode strings as it might be a problem with the compiler. Michael, I am on Linux as well, but I will test under Windows and Mac too. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Fri Aug 30 17:47:29 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 30 Aug 2019 17:47:29 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: On Fri, 30 Aug 2019, Anthony Walter via lazarus wrote: > Alan, oh that's a good idea. I will do that as well as add a few more > parser libraries as requested by a few people in other non mailing lists > threads. I will also try to find out what's going on the unicode strings as > it might be a problem with the compiler. > > Michael, > > I am on Linux as well, but I will test under Windows and Mac too. To show that my argument of 'coding proficiency' influence on algorithm speed is not complete nonsense, I quickly cooked up the following test: {$mode objfpc} {$h+} uses DateUtils, Sysutils,Classes, fpjson, jsonparser; var FN : String; i,aCount : Integer; S : TJSONStringType; T : TMemoryStream; N : TDateTime; procedure ReadJSON; begin T:=TMemoryStream.Create; T.LoadFromFile(FN); SetLength(S,T.Size); T.ReadBuffer(S[1],T.Size); T.Position:=0; end; begin if ParamCount<>2 then Halt(1); aCount:=StrToInt(Paramstr(1)); FN:=ParamStr(2); ReadJSON; try Writeln('Reading string ',aCount,' times'); N:=Now; for I:=1 to aCount do GetJSON(S).Free; Writeln('Msecs : ',MillisecondsBetween(Now,N)); Writeln('Reading stream ',aCount,' times'); N:=Now; for I:=1 to aCount do begin GetJSON(T).Free; T.Position:=0; end; Writeln('Msecs : ',MillisecondsBetween(Now,N)); finally T.Free; end; end. When you run this: home:~/fpc/packages/fcl-json/tests> ./testjsonspeedread 100 ./testdata.json Reading string 100 times Msecs : 2972 Reading stream 100 times Msecs : 1203 (file of 260Kb, 500 lines) Not using a string (as you do) but a stream already gives a factor of 2.x faster. The speed gain is there both for trunk as for 3.0.4. So, I'm fairly confident that I can probably speed up your test results as well, when you send me the sources. That said, this is not to say that there is no room for speed improvements in fpjson. I've already identified 2 places where speed gains can be made in the fpJSON codebase, I'll improve the codebase this weekend and post results. Michael. From zoe at scootersoftware.com Fri Aug 30 18:58:21 2019 From: zoe at scootersoftware.com (=?UTF-8?Q?Zo=c3=ab_Peterson?=) Date: Fri, 30 Aug 2019 11:58:21 -0500 Subject: [Lazarus] Debugger backends configuration Message-ID: <79474e4d-44bc-6fd1-a6a7-e011bdd8ce4a@scootersoftware.com> What controls what appears in the "Debugger type and path" dropdown in the Debugger backend preferences? I have two macOS systems, one running 10.13 and one 10.14 that have different items listed. The 10.13 one lists fpdebug, GDB, and LLDB based ones (6 total) and I've been successfully using "LLDB debugger (with fpdebug) (Beta)". The 10.14 one only lists the GDB based ones in the dropdown though. We have some custom commands in our build scripts, and both FPC and Laz are slightly out of date from trunk, (FPC more so right now). I'm building on both systems using identical scripts though, and even tried wiping FPC, Lazarus, and their configurations off the system and starting from a fresh FPC 3.04a install. Currently building Lazarus as 64-bit with the Cocoa widgetset, using Xcode 10. Where should I look for whatever is going wrong or being excluded? Thanks! -- Zoë Peterson Scooter Software From lazarus at mfriebe.de Fri Aug 30 19:34:11 2019 From: lazarus at mfriebe.de (Martin Frb) Date: Fri, 30 Aug 2019 19:34:11 +0200 Subject: [Lazarus] Debugger backends configuration In-Reply-To: <79474e4d-44bc-6fd1-a6a7-e011bdd8ce4a@scootersoftware.com> References: <79474e4d-44bc-6fd1-a6a7-e011bdd8ce4a@scootersoftware.com> Message-ID: On 30/08/2019 18:58, Zoë Peterson via lazarus wrote: > What controls what appears in the "Debugger type and path" dropdown in > the Debugger backend preferences? > > I have two macOS systems, one running 10.13 and one 10.14 that have > different items listed.  The 10.13 one lists fpdebug, GDB, and LLDB > based ones (6 total) and I've been successfully using "LLDB debugger > (with fpdebug) (Beta)".  The 10.14 one only lists the GDB based ones > in the dropdown though. > > We have some custom commands in our build scripts, and both FPC and > Laz are slightly out of date from trunk, (FPC more so right now).  I'm > building on both systems using identical scripts though, and even > tried wiping FPC, Lazarus, and their configurations off the system and > starting from a fresh FPC 3.04a install.  Currently building Lazarus > as 64-bit with the Cocoa widgetset, using Xcode 10. > > Where should I look for whatever is going wrong or being excluded? The pre-defined list drop down? "GNU debugger (gdb)" Or the editable file-name dropdown "/usr/bin/gdb"? For 1) Depends on installed packages. The lldb package was added to default installed with Lazarus 2.0. If you svn up'ed from an earlier version you need to install it yourself. The package for "lldb with fpdebug" is LazDebuggerFpLldb There is a package without the "fp" in the name. It is pure Lldb - no support for any Pascal syntax, very basic, ... More details (see the strike through bit) https://forum.lazarus.freepascal.org/index.php/topic,42869.0.html For 2) This is a bit complex. Originally there was only ONE backend, and you could set that one backend to either gdb or lldb or others (and only the properties where stored separately. Now you can have multiply lldb backend with different config. But they still share ONE history for all of them (all = all backends of all classes: gdb, lldb,... mixed). That history at some point may have to be split, so each class gets its own (though some may be better of sharing...). It is stored in your EnvironmentOptions.xml (primary config path which likely is ~/.lazarus) Each class has a hardcoded list of proposals. IIRC they are used if there are no other pathes avail. But if you already have them due to the overlap with other classes, I am not sure what happens. Also if you upgraded, and you had diff classes, then all of them only had ONE active path (the rest is path history, in old lazarus you always had to change the path, after you change class). So the upgrade could only use that one path. (and would use it). If you had a new install, then each class may have imported their defaults.... ---------- Anyway something like that. Also no-one has yet upgraded the initial setup dialog. So that dialog still proposes gdb, even on Mac. From sysrpl at gmail.com Fri Aug 30 19:57:36 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 30 Aug 2019 13:57:36 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: I am not sure how under any situation parsing a JSON from a stream source would be any faster than parsing a string. Also with regards to timing I am not sure how accurate Now is. For this purpose I've written: { Return a time based on system performance counters } function TimeQuery: Double; Implemented as: const {$ifdef linux} libc = 'libc.so'; {$endif} {$ifdef darwin} libc = 'libSystem.dylib'; {$endif} function gettimeofday(out TimeVal: TTimeVal; TimeZone: PTimeVal): Integer; apicall; external libc; var TimeSec: SysInt; function TimeQuery: Double; var TimeVal: TTimeVal; begin gettimeofday(TimeVal, nil); if TimeSec = 0 then TimeSec := TimeVal.Sec; TimeVal.Sec := TimeVal.Sec - TimeSec; Result := TimeVal.Sec + TimeVal.MSec / 1000000; end; {$endif} {$ifdef windows} const kernel32 = 'kernel32.dll'; function QueryPerformanceCounter(var Counter: Int64): LongBool; apicall; external kernel32; function QueryPerformanceFrequency(var Frequency: Int64): LongBool; apicall; external kernel32; function TimeQuery: Double; var C, F: Int64; begin F := 0; C := 0; if QueryPerformanceFrequency(F) and QueryPerformanceCounter(C) then Result := C / F else Result := 0; end; {$endif} -------------- next part -------------- An HTML attachment was scrubbed... URL: From bartjunk64 at gmail.com Fri Aug 30 21:09:29 2019 From: bartjunk64 at gmail.com (Bart) Date: Fri, 30 Aug 2019 21:09:29 +0200 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Fri, Aug 30, 2019 at 4:04 PM Michael Van Canneyt via lazarus wrote: > No idea. I tested with both 3.0.4 and trunk. Both give the same result. > > Here are the sources I used: ... > I test on linux, but could try windows. On Windows it prints FALSE, both with 3.0.4 and trunk r42348 -- Bart From bartjunk64 at gmail.com Fri Aug 30 21:41:10 2019 From: bartjunk64 at gmail.com (Bart) Date: Fri, 30 Aug 2019 21:41:10 +0200 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Fri, Aug 30, 2019 at 9:09 PM Bart wrote: > On Windows it prints FALSE, both with 3.0.4 and trunk r42348 It fails on both comparisons (hexadecimal representation of the returned unicodestrings): Name : 004A 006F 0065 003F 0053 0063 0068 006D 006F 0065 Expected: 004A 006F 0065 00AE 0053 0063 0068 006D 006F 0065 00AE is replaced by 003F (a questionmark IIRC) Occupation: 0062 0061 006E 006B 0020 0074 0065 006C 006C 0065 0072 0020 003F 0020 Expected: 0062 0061 006E 006B 0020 0074 0065 006C 006C 0065 0072 0020 00AE 0020 Same replacement there. fpc trunk r42348. -- Bart From sysrpl at gmail.com Fri Aug 30 22:42:24 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 30 Aug 2019 16:42:24 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: For those tracking the unicode issue, could you please verify the problem does not present in my JsonTools library on compiler revisions and platforms? I always get true (passed) with my library, but not with any other library. Here is the relevant test: function VerifyUnicodeChars: Boolean; const UnicodeChars = '{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae " }'; var N: TJsonNode; begin N := TJsonNode.Create; N.Parse(UnicodeChars); Result := (N.Child(0).AsString = 'Joe®Schmoe') and (N.Child(1).AsString = 'bank teller ® '); N.Free; end; begin WriteLn('Handles unicode characters correctly: ', VerifyUnicodeChars); end. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Fri Aug 30 23:01:15 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 30 Aug 2019 23:01:15 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: On Fri, 30 Aug 2019, Anthony Walter via lazarus wrote: > I am not sure how under any situation parsing a JSON from a stream source > would be any faster than parsing a string. If you would check the fpjson code, you'd see why. You'd also see why there is plenty of room for improvement. > Also with regards to timing I am > not sure how accurate Now is. For this purpose I've written: I agree that for time measurements of 10ms or less, you should not use Now for measurements. But over a total timespan of 2.9 seconds, now is plenty accurate. Michael. From michael at freepascal.org Fri Aug 30 23:02:03 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 30 Aug 2019 23:02:03 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Fri, 30 Aug 2019, Bart via lazarus wrote: > On Fri, Aug 30, 2019 at 9:09 PM Bart wrote: > >> On Windows it prints FALSE, both with 3.0.4 and trunk r42348 > > It fails on both comparisons (hexadecimal representation of the > returned unicodestrings): > > Name : 004A 006F 0065 003F 0053 0063 0068 006D 006F 0065 > Expected: 004A 006F 0065 00AE 0053 0063 0068 006D 006F 0065 > 00AE is replaced by 003F (a questionmark IIRC) > > Occupation: 0062 0061 006E 006B 0020 0074 0065 006C 006C 0065 0072 > 0020 003F 0020 > Expected: 0062 0061 006E 006B 0020 0074 0065 006C 006C 0065 0072 0020 00AE 0020 > > Same replacement there. Can you try setting defaultsystemcodepage to UTF8 ? Michael. From sysrpl at gmail.com Fri Aug 30 19:26:53 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 30 Aug 2019 13:26:53 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: Okay, so I turned on my Windows VM with a different version of FPC and ran VerifyUnicodeChars with both FPJson and JsonTools. The resutls are the same. JsonTools sees the unicode correctly, and something is wrong when using FPJson. I don't know what the problem is, but other people are noticing similar issues, so it would seem there is definitely a problem resulting in a failure for FPJson. Michael, you have all the information needed to find out what's wrong and I'd be curious to learn why it's not working. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Sat Aug 31 08:27:35 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 31 Aug 2019 08:27:35 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Fri, 30 Aug 2019, Anthony Walter via lazarus wrote: > Okay, so I turned on my Windows VM with a different version of FPC and ran > VerifyUnicodeChars with both FPJson and JsonTools. The resutls are the > same. JsonTools sees the unicode correctly, and something is wrong when > using FPJson. I don't know what the problem is, but other people are > noticing similar issues, so it would seem there is definitely a problem > resulting in a failure for FPJson. > > Michael, you have all the information needed to find out what's wrong and > I'd be curious to learn why it's not working. Allow me to correct you, I don't have all information: 1. Did you run my provided test program on linux ? (the first one I sent, not the one for the speed test) If my test program also shows different results on your machine, indeed something strange is going on. The reason I insist on the us of my test program and not yours, is that the result can be influenced by some unknown units or whatnot in yours, and my program is "bare bones". On the assumption my private computer can be somehow 'compromised' by years of FPC development I even copied my program to 2 other linux machines, used for production work, and the result is 'True' on both. (see log below for one of them, this is with standard ubuntu installed compiler) I can believe the program would output something different on Windows, but not on another linux box. 2. Where is the source code of your test program(s) ? At least the ones for fpjson and jsontools. Without your actual source code, I cannot give advice or investigate properly. I'd like to see this cleared up. fpjson has been in use in many REST services in large production sites for at least 8 years, these services definitely use UTF8 content outside the basic ASCII or even ANSI codepages. So the failures you see are highly surprising to me, to say the least. Michael. Copy&paste from a quick sompile session. ---- Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-34-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage * Keen to learn Istio? It's included in the single-package MicroK8s. https://snapcraft.io/microk8s * Canonical Livepatch is available for installation. - Reduce system reboots and improve kernel security. Activate at: https://ubuntu.com/livepatch _____ / ___/___ _ _ _____ _ ___ ___ | | / _ \| \| |_ _/ \ | _ )/ _ \ | |__| (_) | .` | | |/ _ \| _ \ (_) | \____\___/|_|\_| |_/_/ \_|___/\___/ Welcome! This server is hosted by Contabo. If you have any questions or need help, please don't hesitate to contact us at support at contabo.com. Last login: Tue Aug 20 14:23:39 2019 from 81.82.199.218 root at vmi203569:~# fpc twalter.pas -S2 Free Pascal Compiler version 3.0.4+dfsg-18ubuntu1 [2018/07/02] for x86_64 Copyright (c) 1993-2017 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling twalter.pas Linking twalter /usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T? 26 lines compiled, 0.4 sec root at vmi203569:~# ./twalter Handles unicode chars correctly: >{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae " }< TRUE From sysrpl at gmail.com Sat Aug 31 09:13:31 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Sat, 31 Aug 2019 03:13:31 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: Michael, regarding this unicode problem, all the code has already been posted in this thread. program Test; uses FPJson, JsonParser, JsonTools; const UnicodeChars = '{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae " }'; function VerifyUnicodeCharsFPJson: Boolean; var N: TJSONData; begin N := GetJSON(UnicodeChars); Result := (N.Items[0].AsUnicodeString = 'Joe®Schmoe') and (N.Items[1].AsUnicodeString = 'bank teller ® '); N.Free; end; function VerifyUnicodeCharsJsonTools: Boolean; const UnicodeChars = '{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae " }'; var N: TJsonNode; begin N := TJsonNode.Create; N.Parse(UnicodeChars); Result := (N.Child(0).AsString = 'Joe®Schmoe') and (N.Child(1).AsString = 'bank teller ® '); N.Free; end; begin WriteLn('FPJson Handles unicode chars correctly: ', VerifyUnicodeCharsFPJson); WriteLn('JsonTools Handles unicode chars correctly: ', VerifyUnicodeCharsJsonTools); end. Output: FPJson Handles unicode chars correctly: FALSE JsonTools Handles unicode chars correctly: TRUE Tested on both Linux and Windows with the same results. Differing versions of FPC on differing platforms and other people have verified the same result. Try the tests yourself. Maybe you can figure out what's going wrong. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sysrpl at gmail.com Sat Aug 31 09:19:42 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Sat, 31 Aug 2019 03:19:42 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: If there is any chance the char codes are being altered through whatever browser / mail client you are using, here is a direct link to the program source: https://cache.getlazarus.org/projects/test.lpr -------------- next part -------------- An HTML attachment was scrubbed... URL: From sysrpl at gmail.com Sat Aug 31 09:28:17 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Sat, 31 Aug 2019 03:28:17 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: Michael, I hadn't tried your example code yet as I thought the discussion was on the topic of the unicode failure, and your example was about parsing speed. I'll be happy to take a look at speed improvements, but like you I am interested to find our what's failing with VerifyUnicodeCharsFPJson. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Sat Aug 31 09:45:47 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 31 Aug 2019 09:45:47 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Sat, 31 Aug 2019, Anthony Walter via lazarus wrote: > Michael, regarding this unicode problem, all the code has already been > posted in this thread. > > program Test; > > uses > FPJson, JsonParser, JsonTools; There you are. You're missing the cwstring unit and the codepage directive. Change the above code to {$mode objfpc} {$h+} {$codepage utf8} uses {$IFDEF UNIX}cwstring, {$ENDIF} FPJson, JsonParser, JsonTools; and it will work correctly. (The objpas and $h+ are probably in your fpc.cfg or lazarus setup) Your program will only work correctly in a utf8-only environment. (see also below) But fpJSON relies on the fpc infrastructure to handle all codepages, as a consequence this infrastructure also must be set up properly. Now you can see why I insisted on using my program, it was known to work correctly: it sets up things properly. If you look at my initial mail, you'll also see that I explicitly mentioned including cwstring. You probably failed to pick up on that important piece of info. So, mystery solved. That said : Unfortunately JSONTools is also not without problems. I copied the program to a windows VM. Attached screenshot of the output. As you can see, jsontools also does not work correctly. It's no mystery why not. I had to add DefaultSystemCodePage:=CP_UTF8; as the first line in the program, then it does show TRUE for both tests. Now, if you work in lazarus, it does this for you, so you don't notice/know it. Codepages & strings require careful setup. Contrary to popular belief, it does not 'just work'. All this is documented: https://www.freepascal.org/docs-html/current/ref/refsu9.html#x32-390003.2.4 Many people tend to ignore this, because Lazarus does a lot behind the scenes (which is a good thing). But if people use your JSONTools in a 'mixed' environment, you might get strange results, if you ignore the correct and careful setup. You control your environment, and jsontools will function correctly in your environment. But it's a big world out there, where things might be happening that you didn't foresee but which do influence jsontools. I hope with my explanations, you are now well equipped/informed to strengthen jsontools and help people should problems nevertheless pop up. Now that we've hopefully established that fpjson does work correctly, I would appreciate it if you could correct the JSON test comparison page you created. Michael. -------------- next part -------------- A non-text attachment was scrubbed... Name: jsontools.png Type: image/png Size: 8535 bytes Desc: URL: From sysrpl at gmail.com Sat Aug 31 09:46:12 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Sat, 31 Aug 2019 03:46:12 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: Okay, going back and looking through the messages I see you did post a test with: {$codepage UTF8} and uses cwstring Here are the results with that added: On Linux using {$codepage UTF8} by itself causes both tests to fail. Adding cwstring causes both tests to work. On Windows trying to use cwstring causes the compilation to fail, but with {$codepage UTF8} added the tests work. I will try a few more tests, but there should be an "out of the box" option to get FPJson working without the need to add ifdefs along with extra directives added outside of the FPJson units themselves. I will write a few more unicode tests, perhaps with 4 byte character strings, and some other potential unicode problems to be sure both are working before we come to a final resolution. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Sat Aug 31 09:49:08 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 31 Aug 2019 09:49:08 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Sat, 31 Aug 2019, Anthony Walter via lazarus wrote: > Okay, going back and looking through the messages I see you did post a test > with: > > {$codepage UTF8} and uses cwstring > > Here are the results with that added: > > On Linux using {$codepage UTF8} by itself causes both tests to fail. Adding > cwstring causes both tests to work. On Windows trying to use cwstring > causes the compilation to fail, but with {$codepage UTF8} added the tests > work. I will try a few more tests, but there should be an "out of the box" > option to get FPJson working without the need to add ifdefs along with > extra directives added outside of the FPJson units themselves. Glad you picked it up. See my other mail for more details. Bottom line: You simply cannot ignore this. Doing so is asking for problems. It may work for you, but fail for someone else, and then you'll be scratching your head as to "why on earth doesn't it work?" Michael. From michael at freepascal.org Sat Aug 31 09:57:46 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 31 Aug 2019 09:57:46 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Sat, 31 Aug 2019, Michael Van Canneyt via lazarus wrote: > > > On Sat, 31 Aug 2019, Anthony Walter via lazarus wrote: > >> Okay, going back and looking through the messages I see you did post a test >> with: >> >> {$codepage UTF8} and uses cwstring >> >> Here are the results with that added: >> >> On Linux using {$codepage UTF8} by itself causes both tests to fail. Adding >> cwstring causes both tests to work. On Windows trying to use cwstring >> causes the compilation to fail, but with {$codepage UTF8} added the tests >> work. I will try a few more tests, but there should be an "out of the box" >> option to get FPJson working without the need to add ifdefs along with >> extra directives added outside of the FPJson units themselves. > > Glad you picked it up. > > See my other mail for more details. > > Bottom line: > You simply cannot ignore this. Doing so is asking for problems. > > It may work for you, but fail for someone else, and then you'll be > scratching your head as to "why on earth doesn't it work?" One last thing. Lazarus includes cwstring by default: interfaces/carbon/interfaces.pas: {$IFNDEF DisableCWString}cwstring,{$ENDIF} interfaces/cocoa/interfaces.pas: {$IFNDEF DisableCWString}cwstring,{$ENDIF} interfaces/gtk2/interfaces.pas:{$IFDEF UNIX}{$IFNDEF DisableCWString}uses cwstring;{$ENDIF}{$ENDIF} interfaces/gtk3/interfaces.pp: {$IFDEF UNIX}{$IFNDEF DisableCWString}cwstring,{$ENDIF}{$ENDIF} interfaces/qt5/interfaces.pp: {$IFDEF UNIX}{$IFNDEF DisableCWString}cwstring,{$ENDIF}{$ENDIF} interfaces/qt/interfaces.pp: {$IFDEF UNIX}{$IFNDEF DisableCWString}cwstring,{$ENDIF}{$ENDIF} If you look in the code, you'll see that it handles codepages explicitly in many places. Just to corroborate that ignoring this is not an option, and that lazarus goes to great lengths to make it easier on people. Michael. From lazarus at kluug.net Sat Aug 31 10:55:47 2019 From: lazarus at kluug.net (Ondrej Pokorny) Date: Sat, 31 Aug 2019 10:55:47 +0200 Subject: [Lazarus] Project Groups are saving LPI files In-Reply-To: <8c361409-fdc3-d0e4-36dc-8f9b857afc1f@kluug.net> References: <20190817165350.4961505e@limapholos.matflo.wg> <8c361409-fdc3-d0e4-36dc-8f9b857afc1f@kluug.net> Message-ID: <6b1f426a-a5f0-27cb-fbd9-14be225ba6ba@kluug.net> On 28.08.2019 09:23, Ondrej Pokorny via lazarus wrote: > On 17.08.2019 16:53, Mattias Gaertner via lazarus wrote: >> On Thu, 15 Aug 2019 13:43:58 +0200 >> Ondrej Pokorny via lazarus wrote: >> >>> [...] >>> Project groups are saving my LPI files upon loading the project >>> group. >> Huh? Do you really mean, merely opening a lpg touches some lpi files? > > Yes, this is exactly what happens. The project group rewrites all lpi > files within the project group itself. I reported it: https://bugs.freepascal.org/view.php?id=36030 Ondrej From pascaldragon at googlemail.com Sat Aug 31 11:08:12 2019 From: pascaldragon at googlemail.com (Sven Barth) Date: Sat, 31 Aug 2019 11:08:12 +0200 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: Am 31.08.2019 um 09:45 schrieb Michael Van Canneyt via lazarus: > Codepages & strings require careful setup. Contrary to popular belief, > it does not 'just work'. > > All this is documented: > > https://www.freepascal.org/docs-html/current/ref/refsu9.html#x32-390003.2.4 > > > Many people tend to ignore this, because Lazarus does a lot behind the > scenes (which is a good thing). Looking at the text of the "Code page conversions" section: what do these mean: (CODE_CP ¡¿ CP_ACP) ? Or should it have been (CODE_CP <> CP_ACP)? Regards, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascaldragon at googlemail.com Sat Aug 31 11:11:17 2019 From: pascaldragon at googlemail.com (Sven Barth) Date: Sat, 31 Aug 2019 11:11:17 +0200 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: Am 31.08.2019 um 11:08 schrieb Sven Barth: > Am 31.08.2019 um 09:45 schrieb Michael Van Canneyt via lazarus: >> Codepages & strings require careful setup. Contrary to popular >> belief, it does not 'just work'. >> >> All this is documented: >> >> https://www.freepascal.org/docs-html/current/ref/refsu9.html#x32-390003.2.4 >> >> >> Many people tend to ignore this, because Lazarus does a lot behind >> the scenes (which is a good thing). > Looking at the text of the "Code page conversions" section: what do > these mean: (CODE_CP ¡¿ CP_ACP) ? Or should it have been (CODE_CP <> > CP_ACP)? And there's another one in the section "UTF8String" at the bottom: (ordinal value ¡128) Should this have been (ordinal value < 128)? Regards, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Sat Aug 31 11:17:00 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 31 Aug 2019 11:17:00 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Sat, 31 Aug 2019, Sven Barth via lazarus wrote: > Am 31.08.2019 um 09:45 schrieb Michael Van Canneyt via lazarus: >> Codepages & strings require careful setup. Contrary to popular belief, it >> does not 'just work'. >> >> All this is documented: >> >> https://www.freepascal.org/docs-html/current/ref/refsu9.html#x32-390003.2.4 >> >> Many people tend to ignore this, because Lazarus does a lot behind the >> scenes (which is a good thing). > Looking at the text of the "Code page conversions" section: what do these > mean: (CODE_CP ¡¿ CP_ACP) ? Or should it have been (CODE_CP <> CP_ACP)? Latex->html conversion errors, I suppose. Using $\lt$ or so should fix it. Michael. From benjamin at rosseaux.de Sat Aug 31 11:58:35 2019 From: benjamin at rosseaux.de (Benjamin Rosseaux) Date: Sat, 31 Aug 2019 11:58:35 +0200 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: Could you include https://github.com/BeRo1985/pasjson in the comparison? On Fri, Aug 30, 2019 at 4:22 PM Anthony Walter via lazarus < lazarus at lists.lazarus-ide.org> wrote: > Alan, oh that's a good idea. I will do that as well as add a few more > parser libraries as requested by a few people in other non mailing lists > threads. I will also try to find out what's going on the unicode strings as > it might be a problem with the compiler. > > Michael, > > I am on Linux as well, but I will test under Windows and Mac too. > -- > _______________________________________________ > lazarus mailing list > lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bartjunk64 at gmail.com Sat Aug 31 13:25:33 2019 From: bartjunk64 at gmail.com (Bart) Date: Sat, 31 Aug 2019 13:25:33 +0200 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: <44fc76dd-ed47-cbce-6078-b124115932f9@ya.ru> Message-ID: On Fri, Aug 30, 2019 at 11:02 PM Michael Van Canneyt via lazarus wrote: > Can you try setting defaultsystemcodepage to UTF8 ? Feeling a little bit embarrassed now (I'm used to Lazarus which defaults to that). With DefaultSystemCodePage := CP_UTF8 it works: Handles unicode chars correctly: >{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae " }< Name : 004A 006F 0065 00AE 0053 0063 0068 006D 006F 0065 [Joe®Schmoe] Expected: 004A 006F 0065 00AE 0053 0063 0068 006D 006F 0065 [Joe®Schmoe] Occupation: 0062 0061 006E 006B 0020 0074 0065 006C 006C 0065 0072 0020 00AE 0020 [bank teller ® ] Expected: 0062 0061 006E 006B 0020 0074 0065 006C 006C 0065 0072 0020 00AE 0020 [bank teller ® ] TRUE -- Bart From sysrpl at gmail.com Sat Aug 31 15:39:11 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Sat, 31 Aug 2019 09:39:11 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: > Could you include https://github.com/BeRo1985/pasjson in the comparison? Sure. I also have a few other people have requested. I will also list the license of each in the first table. Regarding a huge gigabytes of JSON in a file, I know a small portion of programmers of people might be inclined use it as an offline database format much like CSV. Even though by far most JSON is used with XMLHttpRequest, REST APIS, or storing settings and configurations, there are bound to be endless requests for use cases with JSON. For example to accommodate the reading a huge files as indoividual records a helper class operating outside the definition of a JSON parser could accomplish this goal. For example, it would be relatively easy to write in a separate file: type TJsonStreamReader = class public constructor Create(Stream: TStream; OwnsStream: Boolean = False); constructor CreateFromFile(const FileName: string); destructor Destroy; function Read(out Parser: TSomeJsonParser): Boolean; end; Then use as ... var R: TJsonStreamReader; P: TSomeJsonParser; begin R := TJsonStreamReader.Create(InputStreamOrFileName); try while R.Read(P) do // Read JSON record here finally R.Free; end; end; And in this way a large file could be read in small blocks and given back to the user as a parser to allow for processing of individual records. The benefit of breaking this into its own class is that you do not need to mix in every possible use case into the parser. You can simply write separate use cases into their own independent units, rather than trying to make a super class which handles every possible concern. For example if wanted to store object state using RTTI in a JSON file, create a separate TJsonObjectState class to handle this for you. Or if you wanted to create a database table from a JSON file, or create a JSON file from a database table, then again write this into its own class. The point is, saying this JSON class does lots of these things is the wrong approach (IMO), as these use case scenarios as likely endless and would add unnecessary cruft to a parser. Even designing a plug in or other extensible seems unnecessary, when simple separate classes to add functionality works as well without all the complexity. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Sat Aug 31 16:22:58 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 31 Aug 2019 16:22:58 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: On Sat, 31 Aug 2019, Anthony Walter wrote: >> Could you include https://github.com/BeRo1985/pasjson in the comparison? > > Sure. I also have a few other people have requested. I will also list the > license of each in the first table. > [snip] > For example if wanted to store object state using RTTI in a JSON file, > create a separate TJsonObjectState class to handle this for you. Or if you > wanted to create a database table from a JSON file, or create a JSON file > from a database table, then again write this into its own class. Not sure I understand what you mean. It seems to me that in that case you will repeat your scanner/parser code all over the place. in case of an error, you need to fix it in as many places. I can of course be wrong. The current fpjson scanner/parser can be used anywhere. You don't need to use fpjson data structures to be able to use the scanner or reader: It's perfectly possible to use the scanner/parser to create TJSONNode from JSONTools. But general usability comes indeed at the price of some speed loss. That said, your classes are markedly slower when it comes to data manipulation. The following is 100 (!) times slower than fpjson code: {$mode objfpc} {$h+} uses dateutils,sysutils, jsontools; Var I,N : Integer; D,E : TJSONNode; B : double; NT : TDateTime; begin N:=10000000; D:=TJSONNode.Create; D.Parse('{ "d": 12345678.3 }'); E:=D.Child(0); NT:=Now; B:=1; for i:=0 to N do B:=E.AsNumber * 2; Writeln('Time ',MillisecondsBetween(Now,NT)); D.Free; end. home:~> ./tb Time 3888 Same program in fpJSON: home:~> ./tb2 Time 32 This is because when accessing the value, you must do the conversion to float. Every time. This is true for JSON string values as well: you must re-decode the JSON on every access. And you do it over and over again, each time the data is accessed. No doubt you can easily fix this by storing the value in the proper type, but this will slow down your parser. So: if you use the resulting JSON a lot, code will run faster in fpJSON. It thus boils down to a choice: do you need fast processing or fast parsing ? In the end it will probably not matter: most likely all the nodes will be traversed in a typical use case, and the overall time for your and my approach will be similar. This is the danger of benchmarks. They focus on 1 aspect. In real life, all aspects are usually present. Anyway. While coding this small test, I noticed that this also does not work in jsontools: D : TJSONNode; begin D.Parse('true'); // or D.Parse('12345678.3'); end. An unhandled exception occurred at $00000000004730B0: EJsonException: Root node must be an array or object if you look at browser specs, this is supposed to work as well: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse Also frequently encountered is omitting "" around property names. JSON is a subset of Javascript: D.Parse('{ d: 12345678.3 }'); Results in: An unhandled exception occurred at $0000000000473075: EJsonException: Error while parsing text Both are things which are supported in fpJSON. No doubt you can fix this easily. So you see, with some extra study, the picture of what is "better", jsontool or fpjson is not so clear as it may seem. In the end it all boils down to some choices. Michael. PS. With 2 relatively simple changes, I took 40% off the parsing time of fpJSON. No doubt more gain can be achieved, for example I didn't do the suggestion by Benito yet. From luca at wetron.es Sat Aug 31 16:38:00 2019 From: luca at wetron.es (Luca Olivetti) Date: Sat, 31 Aug 2019 16:38:00 +0200 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: <1c7489d8-d959-a39c-6193-79eba44b94e0@wetron.es> El 31/8/19 a les 16:22, Michael Van Canneyt via lazarus ha escrit: > > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse > > > Also frequently encountered is omitting "" around property names. JSON is a > subset of Javascript: > > D.Parse('{ d: 12345678.3 }'); The parser at mozilla says: "Error: JSON.parse: expected property name or '}' at line 1 column 3 of the JSON data" Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 From michael at freepascal.org Sat Aug 31 16:57:07 2019 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 31 Aug 2019 16:57:07 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: <1c7489d8-d959-a39c-6193-79eba44b94e0@wetron.es> References: <1c7489d8-d959-a39c-6193-79eba44b94e0@wetron.es> Message-ID: On Sat, 31 Aug 2019, Luca Olivetti via lazarus wrote: > El 31/8/19 a les 16:22, Michael Van Canneyt via lazarus ha escrit: >> >> > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse >> >> >> Also frequently encountered is omitting "" around property names. JSON is a >> subset of Javascript: >> >> D.Parse('{ d: 12345678.3 }'); > > > The parser at mozilla says: "Error: JSON.parse: expected property name > or '}' at line 1 column 3 of the JSON data" I know. But if you treat it as Javascript e.g. b = eval('{ d: 12345678.3 }'); it does work. JSON is a subset of Javascript. That is why I said "frequently encountered". Not all parsers handle & allow it. But ExtJS for instance handles&produces it. (I used ExtJS and had to add it for that) On large JSON files this shaves off quite some bytes off the result, I guess that is why they did it. (not that it helped, an ExtJS JSON Store is dead slow.) Michael. From sysrpl at gmail.com Sat Aug 31 17:34:28 2019 From: sysrpl at gmail.com (Anthony Walter) Date: Sat, 31 Aug 2019 11:34:28 -0400 Subject: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers In-Reply-To: References: Message-ID: Michael, Internally JsonTools just stores the document as JSON fragments or text, in the case of object, array, or null, the text is empty, but in the case of number or bool, it converts the text to a number or bool when you ask AsNumber or AsBoolean. Now normally this wont be a problem because as you read a document you'll read a particular node possibly once as you hand it off to some other system, be it a database insert, a subroutine, or other use. In practice what's happening is I am delaying the conversion until it's needed, which makes my parser faster when just parsing a document. If you need to use the node value as a number or a bool, then the cost of the conversion happens at that time, but if you don't need to use a particular field there is no conversion cost. This is one of the reasons my parser is faster. I still validate the number, bool, and other fields but I don't convert until needed. The downside, as you've seen is that converting the same value over and over again results in longer execution time. That said, if a user request every field as a number or bool once when processing an incoming request (say you are writing a REST service) then the performance would equal out and the speed difference would favor the faster parser. A side benefit of storing JSON fragments is that the node kind can be changed easily without the need to remove an item from an internal list, destroy the class, create a new one of a different class, apply a copy of the original name, and reinsert. Of course this lazy evaluation of numbers and boolean scould be improved by caching the conversion once calculated (e.g. StrToFloat) and reusing the conversion in any subsequent calls. For now I will keep it simple as is as I feel for most cases the user will either not need the conversion, or need it once, and the performance lost in invoking it many times wills be made up for in all the times the conversion is never used. Real world examples of never used JSON fields: Calling most web REST methods which return JSON as a web result where the caller is only interested in success or failure with a message. Acting as a RESTful service where many JSON request bodies use optional values that are meant to be skipped. Retrieving settings where and option is never used, yet stored, such as a dockable or floating pallet position that is always left closed. And so on... -------------- next part -------------- An HTML attachment was scrubbed... URL: