[fpc-pascal] fpdoc project file
Hi, The 3.1.1 fpdoc -h help has some confusing items. Can someone explain them please: --project=fileUse file as project file --write-project=file Do not write documentation, create project file instead --write-project=file Write all command-line options to a project file Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Unicode file names
On Sat, 5 Dec 2015 12:55:42 +0100 (CET) Michael Van Canneyt <mich...@freepascal.org> wrote: > > > On Sat, 5 Dec 2015, Mattias Gaertner wrote: > > > Hi, > > > > fpcres fails on Windows with paths containing non ASCII characters. The > > compiler itself happily compiles units. FPC 3.0.0 and 3.1.1. > > > > Is that a regression? > > I don't think so, since that has probably never worked correctly. Is there any FPC tool that supports Unicode file names on Windows? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Unicode file names
On Sat, 5 Dec 2015 13:44:08 +0100 Jonas Maebe <jonas.ma...@elis.ugent.be> wrote: > On 05/12/15 13:36, Mattias Gaertner wrote: > > On Sat, 5 Dec 2015 12:55:42 +0100 (CET) > > Michael Van Canneyt <mich...@freepascal.org> wrote: > > > >> On Sat, 5 Dec 2015, Mattias Gaertner wrote: > >> > >>> fpcres fails on Windows with paths containing non ASCII characters. The > >>> compiler itself happily compiles units. FPC 3.0.0 and 3.1.1. > >>> > >>> Is that a regression? > >> > >> I don't think so, since that has probably never worked correctly. > > > > Is there any FPC tool that supports Unicode file names on Windows? > > The title of the message and your latest questions talks about unicode > "Unicode", but in your original text you talk about "non-ASCII". Did you > mean "non-ANSI"? Sorry for the confusion. The compiler itself seems to support the Windows console codepage (file names and output), which I guess is ANSI, so more than ASCII (#32-#126), but not Unicode. fpcres seems to only support ASCII, which surprises me. Either my tests are wrong or fpcres is more limited than the compiler. > No FPC tools contain any platform-specific file handling, nor do they > change any of the Default.*CodePage settings. They all use either > ansistrings or shortstrings. Thanks, that answers my second question. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Unicode file names
Hi, fpcres fails on Windows with paths containing non ASCII characters. The compiler itself happily compiles units. FPC 3.0.0 and 3.1.1. Is that a regression? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can fpc 3.0 release be installed using apt-get on Linux Mint?
On Mon, 07 Dec 2015 21:52:35 +0100 Bo Berglundwrote: > On Mon, 7 Dec 2015 20:27:12 +0100 (CET), Michael Van Canneyt > wrote: >[...] > 1) Went to http://www.freepascal.org/down/i386/linux-hungary.var > > 2) Downloaded the "everything" file > ftp://ftp.hu.freepascal.org/pub/fpc/dist/3.0.0/i386-linux/fpc-3.0.0.i386-linux.tar > > 3) Extracted its contents to the Download dir > > 4) Then I entered the directory and issued the command: > sudo sh install.sh > > 5) During installation I was asked to select target and entered > /usr/local as I was told in another case some time ago. > > 6) Then I just replied Y to most of the questions and it installed > apparently just fine. > At least it responds to my fpc -h command... That is the right way. As an alternative you can install the FPC 2.6.4 deb (e.g. from the Lazarus site), then download the FPC 3.0.0 sources and 'make install' them. > Now I have to deal with Lazarus, but that is another list/forum... Lazarus needs libgtk2.0-dev, which should automatically install libgtk2.0-common. Lazarus 1.6RC1 will be available soon and it provides deb packages for FPC 3.0.0 and Lazarus. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can fpc 3.0 release be installed using apt-get on Linux Mint?
On Mon, 07 Dec 2015 23:15:50 +0100 Bo Berglund <bo.bergl...@gmail.com> wrote: > On Mon, 7 Dec 2015 22:16:26 +0100, Mattias Gaertner > <nc-gaert...@netcologne.de> wrote: > > >> Now I have to deal with Lazarus, but that is another list/forum... > > > >Lazarus needs libgtk2.0-dev, which should automatically install > >libgtk2.0-common. > > I looked into my Raspberry Pi2 install notes and found these > dependencies for Lazarus: > > Get additional packages: > > apt-get update > apt-get install -y libx11-dev libgdk-pixbuf2.0-dev libcairo2-dev > gir1.2-coglpango-1.0 libpangox-1.0-dev xorg-dev libgtk2.0-dev > libpango1.0-dev > > Are most of these superfluous? Is it enough with libgtk2.0-dev? I have not tried on Linux-Mint. Can you test? If building Lazarus fails with a linker error you will see what lib is missing. > Will there be a tar package like for fpc No. Building Lazarus is easy (make all). The tricky part is helping the user to install the required libraries. If someone provides a script that checks the common distros and maintains the script I would build such a tar. > or should I go for an svn checkout? I recommend that. This makes upgrading easy. > Is there an RC tag for Lazarus? Many. For example: http://svn.freepascal.org/svn/lazarus/tags/lazarus_1_6_RC1 Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can fpc 3.0 release be installed using apt-get on Linux Mint?
On Mon, 07 Dec 2015 23:36:17 +0100 Jonas Maebewrote: > Michael Van Canneyt wrote: > > I believe fpc 3.0 is in debian experimental, but it would be a very bad > > idea to use that in linux mint. > > If you limit yourself to just using FPC from Debian experimental, I > don't think there's much that can go wrong. That's probably true, but you are mixing a Debian repository with Ubuntu/Linux Mint/etc repository, which gives warnings and anyone you are asking for help will tell you that it is a bad idea. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can fpc 3.0 release be installed using apt-get on Linux Mint?
On Mon, 07 Dec 2015 23:47:36 +0100 Bo Berglundwrote: >[...] > >I have not tried on Linux-Mint. > >Can you test? > > I did as follows: > sudo apt-get install libgtk2.0-dev > > It pulled no less than 73 different packages Debian is great at splitting packages into smaller packages. Does Lazarus link with those packages? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can fpc 3.0 release be installed using apt-get on Linux Mint?
On Mon, 07 Dec 2015 23:56:56 +0100 Bo Berglundwrote: >[...] > Target OS: Linux for i386 > Compiling lazres.pp > Linking ./lazres > Warning: "crti.o" not found, this will probably cause a linking > failure > Warning: "crtn.o" not found, this will probably cause a linking > failure > /usr/bin/ld: warning: ./link.res contains output sections; did you > forget -T? > /usr/bin/ld: skipping incompatible > /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o when searching for > /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o > /usr/bin/ld: cannot find /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o Are you sure you installed the right compiler? i386 <> x86_64, 32 vs 64bit. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can fpc 3.0 release be installed using apt-get on Linux Mint?
On Tue, 8 Dec 2015 00:21:28 +0100 Mattias Gaertner <nc-gaert...@netcologne.de> wrote: > On Mon, 07 Dec 2015 23:56:56 +0100 > Bo Berglund <bo.bergl...@gmail.com> wrote: > > >[...] > > Target OS: Linux for i386 > > Compiling lazres.pp > > Linking ./lazres > > Warning: "crti.o" not found, this will probably cause a linking > > failure > > Warning: "crtn.o" not found, this will probably cause a linking > > failure > > /usr/bin/ld: warning: ./link.res contains output sections; did you > > forget -T? > > /usr/bin/ld: skipping incompatible > > /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o when searching for > > /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o > > /usr/bin/ld: cannot find /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o > > Are you sure you installed the right compiler? > i386 <> x86_64, 32 vs 64bit. I tried Linux Mint 17.3 64bit. After installing fpc x86_64 tar and libgtk2.0-dev, Lazarus builds fine. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] set code page
On Thu, 17 Dec 2015 13:36:17 +0100 Dariusz Mazurwrote: > Hi >is there possible to set codepage {$codepage xxx} to cp_none Do you mean CP_ACP? > for example one source file have {$codepage 1250} but rest i need > default (without any setting) Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Linker error
On Fri, 18 Dec 2015 11:30:00 +0100 Jonas Maebe <jonas.ma...@elis.ugent.be> wrote: > > Mattias Gaertner wrote on Fri, 18 Dec 2015: > > > What could be the cause of this linker error: > > > > main.pp(6923,23) Warnung: Symbol "CommandLine" ist veraltet > > /usr/bin/ld.bfd: warning: ../link.res contains output sections; did > > you forget -T? > > /usr/bin/ld.bfd: /usr/lib/fpc/3.0.0/units/x86_64-linux/rtl/cprt0.o: > > unrecognized relocation (0x2a) in section `.text' > > /usr/bin/ld.bfd: final link failed: Bad value > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=807170#19 Does that mean the fpc 3.0.0 (rc-buggy) package only works on debian unstable? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Linker error
Hi, What could be the cause of this linker error: main.pp(6923,23) Warnung: Symbol "CommandLine" ist veraltet /usr/bin/ld.bfd: warning: ../link.res contains output sections; did you forget -T? /usr/bin/ld.bfd: /usr/lib/fpc/3.0.0/units/x86_64-linux/rtl/cprt0.o: unrecognized relocation (0x2a) in section `.text' /usr/bin/ld.bfd: final link failed: Bad value Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Unicode / CodePage aware strings
On Thu, 10 Dec 2015 12:17:28 +0100 Jonas Maebewrote: >[...] > > Try {$codepage utf8}. > > That won't change anything, because {$mode delphiunicode} implies "use > the default system code page to interpret the source code", and that's > UTF-8 on his system. Does that mean a {$mode delphiunicode} resets a -Fc parameter? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Unicode / CodePage aware strings
On Thu, 10 Dec 2015 12:02:31 + Graeme Geldenhuyswrote: > On 2015-12-10 11:16, Jonas Maebe wrote: > > There is no such thing as "official FPC Unicode". We added support for > > codepage-aware ansistrings. We added unicodestring overloads for a > > Does the type UnicodeString always mean UTF-16 encoded text (like it's > Delphi counterpart)? If so, that unfortunate. Yes. > Can the encoding of UnicodeString be changed to say UTF-8? No. > And yes, I > know there is a UTF8String type too, but I'm specifically referring to > UnicodeString (as in the Unicode standard supporting multiple > encodings), as many RTL functions seem to use that specific type. Many RTL functions support UTF8String, AnsiString too, as Jonas already pointed out. > > The test program you posted later does not work completely because it > > uses routines that have not yet been adapted (UpCase and ToUpper are > > OK, so FPC unicode is still far from usable, as some RTL function will > work, and others won't. :-/ With that conclusion, I'll then keep > fpGUI's Unicode support exactly as it currently is. If you have a working Unicode solution there is no reason to abandon it. The FPC team did a great job keeping compatibility (contrary to Delphi). Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] buggy debian package
Hi, Debian has a FPC 3.0.0 package called "rc-buggy". https://packages.debian.org/search?keywords=fpc=names=all=all Is it just me, or does "buggy" sound a bit below awesome? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Implementing Factory Method with Pascal
One solution: var animal: TDog; BEGIN animal := TAnimalFactory.create(atDog) as TDog; try animal.bark; finally animal.free; end; END. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fppkg compiler upgrade
On Sun, 22 Nov 2015 20:55:14 -0700 (MST) leledumbowrote: > > What is the proper way of upgrading fppkg? > > $ rm ~/.fppkg/config/default > > now rerun fppkg, it should create a new config. if it still shows 2.6.4, > that means your 3.1.1 is inaccessible or has lower precedence than your > 2.6.4. Thanks. Should I add this to the wiki? Is this also needed when installing FPC with the other installers like deb, rpm, install.sh? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] fppkg compiler upgrade
Hi, I have fpc 2.6.4 on Linux and "fppkg list" shows the 2.6.4 packages. Then I install fpc 3.1.1 using "make install". fppkg still shows the 2.6.4 packages. What is the proper way of upgrading fppkg? The wiki page does not tell me: http://wiki.lazarus.freepascal.org/fppkg Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC 3.x for Windows and code page conversion
On Mon, 23 Nov 2015 16:43:18 +0100 Lubos Pinteswrote: > Hello, > I am developing a console application which receives an UTF-8 encoded > text through stdin. > The text is, after possible modification, sent to SAPI5. The SAPI5 > generated interface wrappers have parameters of type string. > In FPC 2.6.4, I used UTF8toANSI on various places and that worked well. > Now after reading about FPC 3.x's unicode support, I thought that adding > this line say after begin in the main program could be enough: > SetMultiByteConversionCodePage(CP_UTF8); The above setting makes UTF8ToAnsi to convert the string to UTF-16 and back to UTF-8. > It however doesn't work. > How can I solve this without conversion to ANSI? Do you want to convert an UTF8 string to the system codepage? Are you using any Lazarus units? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Conditional code for FPC modes
On Wed, 15 Jun 2016 11:18:38 +0200 Sven Barthwrote: > Am 15.06.2016 10:15 schrieb "Juha Manninen" : > > > > Are there defines matching the modes in FPC, for example {$mode > delphiunicode} ? > > I want to do something like : > > {$IFDEF delphiunicode} > > ... > > {$ELSE} > > ... > > {$ENDIF} > > There are. They are FPC_, though DelphiUnicode seems to be > missing. You shouldn't directly check for that anyway, but instead for > FPC_UNICODESTRINGS which is set if String = UnicodeString independently of > the mode. Thanks for the hint. Done. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Conditional code for FPC modes
On Wed, 15 Jun 2016 11:43:59 +0200 Mattias Gaertner <nc-gaert...@netcologne.de> wrote: >[...] > Thanks for the hint. Done. Oops. Wrong thread. To my rescue a hint: You can see the actual FPC defines in Lazarus by placing the cursor in the directive and pressing Ctrl+Space: {$IFDEF FPC|} I spotted several hidden gems via the list of FPC* macros. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Questions regarding FPImage's TFPMemoryImage.FData variable
On Thu, 26 May 2016 11:24:44 +0100 Graeme Geldenhuyswrote: >[...] > 3) The FData image buffer (assuming (1) is correct) uses Integer instead >of Byte as it's element size. So I'm assuming a singe Integer hold >all the colour information for a single pixel? No, TFPMemoryImage uses one TFPColor per pixel (48bit). TFPCompactImgGray8Bit uses 8bit. TFPCompactImgGray16Bit uses 16bit. TFPCompactImgRGB8Bit uses 24bit. TFPCompactImgRGBA8Bit uses 32bit. and so forth... >But then again, I have noticed that TFPColor uses Word size data >elements, thus the whole RGBA information per pixel will be 8 bytes >of data, and Integer is only 4 bytes large. The integer is only the palette index. > 4) What is the order in which the colour channel information is stored >in memory? RGB, BGR, RGBA, BGRA, ARGB, ABGR etc? Each memory image uses a packed record. For example TFPMemoryImage uses TFPColor, TFPCompactImgRGBA8Bit uses TFPCompactImgRGBA8BitValue. It is typically RGBA. > 5) Is the Alpha channel actually stored? I assume it is, because the >Integer type is large enough to hold that information. See above. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Single threaded application on multicore CPU
On Wed, 22 Jun 2016 07:41:04 -0400 Stephen Chrzanowskiwrote: > Everything has a cost. But swapping CPU threads isn't as costly as a fried > CPU. Keeping the CPU cool at all costs is better than having a hotspot on > the die which COULD damage the heat sink. On my Linux it does not swap the CPU and I can't find any hard data that Windows is swapping because of hotspot problems, but I do find many pages about pinning processes to cores. Please provide a link for the hotspot claims. > The computing cost of swapping CPUs is probably close to zero. Your CPU > only has so much on-die memory that it has to push things out CONSTANTLY to > on board RAM, so there may be a time when your CPU (Not the Operating > System) has zero knowledge of your application. When your OS takes the > information back to the CPU, the OS will look at the particularities of CPU > (Heat, load, in use, etc) and specify which CPU will get the task. Swapping a process costs about 1000-10ns on an idle system (only one busy thread), mostly depending on caches. So even if Windows would swap a hundred times per second, the overhead would be less than 1%. To make sure, pin your process to a cpu and compare. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Single threaded application on multicore CPU
On Wed, 22 Jun 2016 13:36:08 +0100 Graeme Geldenhuys <mailingli...@geldenhuys.co.uk> wrote: > On 2016-06-22 13:14, Mattias Gaertner wrote: > > On my Linux it does not swap the CPU and I can't find any hard data that > > Windows is swapping because of hotspot problems, > > It’s not just a Windows thing. On my FreeBSD system... I don't doubt that it is swapping. I would like to know why it is swapping. Is it avoiding hotspots, or for longevity, or turbo boost, or system processes, or security, or Related: What is the downside of pinning the process to a cpu? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to find the return type of a for..in ?
On Thu, 16 Jun 2016 14:59:47 +0100 Graeme Geldenhuyswrote: >[...] > Here is another stumbling block of for.in usage. The statement itself > doesn't give you any hint as to what the return type is. What is the > correct way of finding the return type of a for..in statement? Have you seen this page: http://wiki.freepascal.org/for-in_loop Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] location modifier
Hi, I can't find the 'location' modifier in the docs. Is it missing? For example: function bsd_socket(Domain: LongInt location 'd0'; Type_: LongInt location 'd1'; Protocol: LongInt location 'd2'): LongInt; syscall SocketBase 30; See for example packages/rtl-extra/src/amiga/sockets.pp Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] location modifier
On Mon, 18 Jan 2016 16:40:17 +0100 (CET) Michael Van Canneyt <mich...@freepascal.org> wrote: > > > On Mon, 18 Jan 2016, Mattias Gaertner wrote: > > > Hi, > > > > I can't find the 'location' modifier in the docs. Is it missing? > > I didn't even know this modifier existed. > Let alone that I know what it does > (although I can take an educated guess) Yes, me too. But to fix http://bugs.freepascal.org/view.php?id=29350 I need scope and order. Is it Amiga only? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Please someone explain this to me
> Sven Barthhat am 10. Februar 2016 um 15:09 > geschrieben: > [...] > > The {%...} directive is a comment in other contexts and can be used safely. > > What about include files included by other include files? That is no problem for the MainUnit directive. The directive tells the codetools the default start file of the scattered unit. If the IDE has parsed a unit which uses the include file, the MainUnit directive is ignored. If a file is included by multiple units, you can give a common unit. Basically it is just a convenient fallback. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Please someone explain this to me
> Michael Van Canneythat am 11. Februar 2016 um 04:27 > geschrieben: >[...] > Lazarus IDE shows a tooltip when you hover over an identifier with the mouse. > I suspect it will take one on the team less than 10-minutes to add the unit > name to the tooltip, in addition to the package and source file name. Done. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Pascal Lexical Diagrams
On Sat, 30 Jan 2016 04:45:27 -0500 Anthony Walterwrote: > I've been working on writing Javascript to generate lexical language > diagrams for the getlazarus.org learning center portal. > > With my script I'm able to render these diagrams which will be appear under > the Free Pascal language Lexical topic: > > http://cache.getlazarus.org/images/lexical-diagrams.png A finalization section can exist without initialization. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Lazarus Release 1.6
The Lazarus team is glad to announce the release of Lazarus 1.6. This release was built with FPC 3.0.0. The previous release Lazarus 1.4.4 was built with FPC 2.6.4. Here is the list of changes for Lazarus and Free Pascal: http://wiki.lazarus.freepascal.org/Lazarus_1.6.0_release_notes http://wiki.lazarus.freepascal.org/User_Changes_3.0.0 The release is available for download on SourceForge: http://sourceforge.net/projects/lazarus/files/ Choose your CPU, OS, distro and then the "Lazarus 1.6" directory. Checksums for the SourceForge files: http://www.lazarus-ide.org/index.php?page=checksums#1_6 Minimum requirements: Windows: 98, 2000, XP, Vista, 7, 8/8.1, 10, 32 or 64 bit. Win98 and WinNT IDE needs FPC 2.6.4 and building with flag -dWIN9XPLATFORM. FreeBSD/Linux: gtk 2.8 or qt4.5, 32 or 64bit. Mac OS X: 10.5 to 10.11, LCL only 32bit, non LCL apps can be 64bit. The svn tag is http://svn.freepascal.org/svn/lazarus/tags/lazarus_1_6 Here is the list of fixes for Lazarus 1.6: http://wiki.freepascal.org/Lazarus_1.6_fixes_branch For people who are blocked by SF, the Lazarus releases from SourceForge are mirrored at: ftp://freepascal.dfmk.hu/pub/lazarus/releases/ and later at (after some time for synchronization) http://michael-ep3.physik.uni-halle.de/Lazarus/releases/ and http://mirrors.iwi.me/lazarus/ Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Happy tickets benchmark
On Sun, 14 Feb 2016 10:11:54 +0100 Florian Klaempflwrote: >[...] > For the record: with a few changes in the compiler I could reduce the > execution time of the example significantly . But I won't commit it > probably (maybe parts of it): extensive loop unrolling and loop > invariant search has normally little advantages in real world programs > and increases only compilation times. If it is easy to implement could it be optional? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Happy tickets benchmark
On Sun, 14 Feb 2016 10:35:22 +0100 Florian Klaempflwrote: >[...] > Do you think people will bother? Nobody mentioned to the original poster > so far: > - that the used FPC is outdated > - that only -O2 is used instead of -O3 (or -O4 with 3.0.0) > - that even FPC 2.6.4 has a -Ooloopunroll option which is never enabled > by default and which is worth a try > > I do not know if the points above really effect the example, but it > tells me enough not to bother either :) Maybe documentation helps here. Is there already a page "pimp my fpc"? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] buggy debian package
On Mon, 01 Feb 2016 13:30:51 +0100 Jonas Maebewrote: >[...] > FWIW, last weekend FPC 3.0 was promoted from Debian Experimental to > Debian Unstable. Awesome :) Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Default source encoding
On Thu, 31 Mar 2016 13:52:54 +0200 Jonas Maebe <jonas.ma...@elis.ugent.be> wrote: > On 31/03/16 13:46, Mattias Gaertner wrote: > > > According to > > http://wiki.freepascal.org/index.php?title=FPC_Unicode_support#String_constants > > > > "the constant strings are assumed to have code page 28591 (ISO 8859-1 > > Latin 1; Western European)." > > > > Is this true? > > Yes. What happens on a Russian system cp1251 with a cp1251 AnsiString literal? writeln('Привет'); Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC 3: disabling automatic AnsiString codepage conversionx
On Wed, 06 Apr 2016 15:05:02 +0200 tobiasgie...@gmail.com wrote: > Hello, > > Jonas wrote: > > If you get ASCII, it means that one of the LC_ALL, LC_CTYPE and/or LANG > > environment variables is set to > > a setting that corresponds to ASCII (such as "C"), or set to a value that > > is not recognised as or translatable into > > a Windows code page number. > > That was it - only when running under Lazarus via debugger, my project has > LANG=C. > > I wonder where LANG=C comes from? Check Run / Run Parameters / Environment. > Note that it is a very old project. A newly created project file does not > have LANG=C in the > environment. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC 3: disabling automatic AnsiString codepage conversion
On Mon, 4 Apr 2016 10:32:58 +0200 (CEST) Michael Van Canneytwrote: >[...] > You cannot, but you can set DefaultSystemCodePage to CP_UTF8. I think it is important to note how to do this properly: SetMultiByteConversionCodePage(CP_UTF8); SetMultiByteRTLFileSystemCodePage(CP_UTF8); You should add these lines in an early initialization section. The beginning of your program might be too late. > Then no conversions will be done for all ansistrings that contain UTF8. And this really means AnsiString, not AnsiString(something). Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?
On Mon, 4 Apr 2016 13:27:05 +0300 Juha Manninenwrote: >[...] > But yes, it requires Lazarus IDE because LazUtils is a Lazarus > package. At least you must create and compile the project using > Lazarus IDE. Or simply copy the two units FPCAdds, LazUTF-8 or parts of them from here: http://svn.freepascal.org/svn/lazarus/tags/lazarus_1_6/components/lazutils/ Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?
On Mon, 04 Apr 2016 10:18:18 +0200 tobiasgie...@gmail.com wrote: > Hello, > > disallowing "AnsiString" code for UTF-8 is a huge regression. > > I use TStringList for UTF-8 strings. This is no longer possible, because > automatic conversions cause question marks and data loss. Lazarus uses TStringList with UTF-8 all over the place. Please post a complete example demonstrating the problem. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC 3: disabling automatic AnsiString codepage conversionx
On Mon, 4 Apr 2016 11:34:18 +0100 Graeme Geldenhuyswrote: > On 2016-04-04 11:23, tobiasgie...@gmail.com wrote: > > On Mac, not even cwstring does that. It sets the DefaultSystemCodePage > > to 20127. > > I just installed FPC 3.0 on my Macbook Pro (bought in the UK) and did > the same test. Here DefaultSystemCodePage returned 65001. So I guess it > depends on your OSX installation and which default locale settings was > set up during install. All my Macs since 10.4 had UTF-8 as default and I can't remember a setting during install to change it. How did you get a codepage 20127 Mac? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?
On Mon, 4 Apr 2016 10:52:20 +0100 Graeme Geldenhuyswrote: > On 2016-04-04 10:27, Juha Manninen wrote: > > Just use the new UTF-8 mode provided by Lazarus and remove all > > explicit conversion functions. > > This is the FPC mailing list. Not everybody here uses Lazarus or LCL, so > making such a suggestion is wishful thinking. For example, your > suggestion means nothing to me, I don't use LCL. First of all it's part of LazUtils. So you don't have to use the LCL for that. In fact you don't have to use LazUtils: some users simply copied the two units FPCAdds and LazUTF8. It's all open source. Second I find it funny that the statement comes from you - a notorious promoter of software on forums/lists of competing projects. And third setting the DefaultSystemCodePage is a good start, but not enough. Instead of explaining all the gory details, Juha promoted a more complete solution for UTF-8. This is useful for many users. They don't have to reinvent the wheel. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC 3: disabling automatic AnsiString codepage conversion
On Mon, 4 Apr 2016 11:35:53 +0200 (CEST) Michael Van Canneytwrote: >[...] > >> Then no conversions will be done for all ansistrings that contain UTF8. > > > > And this really means AnsiString, not AnsiString(something). > > The latter cannot contain UTF8 unless you do some really nasty tricks... :-) UTF8String is type AnsiString(CP_UTF8) and if you mix that with AnsiString the compiler adds conversions code, because at compile time CP_ACP is not UTF-8. These kind of traps confuse people. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IsValidIdent() with dots
On Wed, 23 Mar 2016 10:28:15 +0200 Juha Manninenwrote: > Hi > > Is there a function like IsValidIdent but accepting also dots (.), > as in name "TForm1.Action1Execute"? FPC 3.1.1 has function IsValidIdent(const Ident: string; AllowDots: Boolean = False; StrictDots: Boolean = False): Boolean; Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Default source encoding
On Thu, 31 Mar 2016 14:14:14 +0200 (CEST) Michael Van Canneytwrote: >[...] > > What happens on a Russian system cp1251 with a cp1251 AnsiString > > literal? > > > > writeln('Привет'); > > Careful, writing may change the codepage. Yes, I know. That's why it is important that the compiler uses the right conversion (CP1251 Win Cyrillic to CP866 DOS Cyrillic). If the compiler assumes CP1252 on a CP1251 system, then the writeln should write garbage. Correct? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Default source encoding
On Thu, 31 Mar 2016 14:38:35 +0200 Jonas Maebewrote: >[...] > There are two separate things: > a) the code page that the compiler uses *if* it has to convert a string > at compile time to a different code page (e.g. because you assign the > string constant to an ansistring(1251), or to a unicodestring) > b) whether or not it will in fact convert a string at compile time to a > different code page >[...] Thanks for the explanation. So maybe the "If the source file codepage is CP_ACP, a default is used instead: ...code page 28591" should be changed to something like this: "If the source file codepage is CP_ACP and the compiler has to convert a string at compile time to a different code page (e.g. because you assign the string constant to an ansistring(1251), or to a unicodestring), a default is used instead: ...code page 28591" Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Inline methods
On Thu, 19 May 2016 08:49:04 +0200 LacaKwrote: > > >> Hm, I have checked in Lazarus on Project Options / Verbosity appropriate > >> -vd option, but in output window I do not see any more info ... > >> How should look such info message ? > > Did you build your project clean? > Yes, I have used "Clean and build" option. > May be that this diagnostic messages are not shown in "Messages" window. > (because when I compile from command line I see also other lines, which > are not shown in Lazarus) Right click on Messages window / Filter... Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Inline methods
On Wed, 18 May 2016 14:43:06 +0200 LacaKwrote: > > > > >> Any other ideas, what leads compiler to not inline ? > > > > If you compile with -vd, the compiler will tell you in most cases why > > it's not inlining. > Hm, I have checked in Lazarus on Project Options / Verbosity appropriate > -vd option, but in output window I do not see any more info ... > How should look such info message ? Did you build your project clean? Changing verbosity flags does not recompile units. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] code example where AnsiString used in FCL (SqlDB) causes data loss
On Wed, 11 May 2016 22:33:13 +0200 Jonas Maebewrote: > Graeme Geldenhuys wrote: > > On 2016-05-11 18:58, Michael Van Canneyt wrote: > >> > For 99,99% of cases, no changes to your code are required. > >> > If it worked in 2.6.4, it will work in 3.0.0 > > > > Just curious, so why was there so many changes required for LCL, and a > > whole wiki page of its own to explain it? > > Those changes were not required, (almost) everything worked still fine > with the old code. They made the changes to take advantage of the new > functionality in FPC 3.0, because the end result is much simpler code > both in the LCL and in user programs. Yes, simpler and more powerful. For example FPC now supports full UTF-8 in many RTL/FCL functions under Windows. > The wiki page is mainly to explain all of the things you no longer have > to do when using this new method. Yes. And the few incompatibilities. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?
On Fri, 15 Apr 2016 10:43:55 +0200 Michael Schnellwrote: >[...] > Do you suggest that the codepage of the sourcecode is preserved by the > compiler when creating the string constant in object code ? It depends. There are two codepages. The real one and the one you tell the compiler. If you tell the compiler that the string literal is 8-bit system codepage, it will copy it without conversion to the binary. Otherwise it converts it to UTF-16. For instance using {$codepage utf8} tells the compiler to convert all your literals to UTF-16. Without the {$codepage} the compiler preserves the real codepage. > Seemingly StringCodePage does not work correctly with string constants > anyway: I found that setting {$codepage UTF8}, for a constant string I > get StringCodePage = 1200 which is UTF16. StringCodePage on a literal is pretty useless. You should use StringCodePage on variables. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?
On Fri, 15 Apr 2016 10:19:06 +0200 Michael Schnellwrote: > On 04/15/2016 08:35 AM, Michael Van Canneyt wrote: > > > > For string constants there are slightly different rules. There the > > result depends on the {$codepage} directive of the source file. > > Hmmm. > > If not setting $codepage Ifor a constant string I get StringCodePage = 0, > > If setting {$codepage UTF8} for a constant string I get StringCodePage = > 1200 which is UTF16. > > The program does work decently, anyway. > > And ASM stepping shows that no conversion is done. That's correct. String literals in a codepage other than system are stored as UTF-16 in the binary and converted on assign. The conversion happens at runtime, so the string codepage is decided at runtime. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Weird string behavior
On Mon, 25 Jul 2016 23:23:23 +0200 Jonas Maebe <jonas.ma...@elis.ugent.be> wrote: > On 25/07/16 23:07, Mattias Gaertner wrote: > > DefaultSystemCodePage = 1252 > > s3 = "abcdef" cp = 65001 > > Thanks. So the rule for concatenation appears to be: > * the dynamic code page of the result of a string concatenation is that > of the left operand (except if it's an empty string, then it's that of > the right operand) > * the declared code page of the final concatenation result is that of > the left operand Here are some more hints: {$APPTYPE CONSOLE} type tcp866 = type ansistring(866); var s1, s2: tcp866; u1: UTF8String; r1: RawByteString; begin s1:='abc'; setcodepage(rawbytestring(s1),65001,false); Writeln('s1 = "', s1, '" cp = ', StringCodePage(s1)); u1:='nop'; Writeln('u1 = "', u1, '" cp = ', StringCodePage(u1)); s2:=s1+u1; Writeln('s2 = "', s2, '" cp = ', StringCodePage(s2)); s2:=u1+s1; Writeln('s2 = "', s2, '" cp = ', StringCodePage(s2)); r1:=s1+u1; Writeln('r1 = "', r1, '" cp = ', StringCodePage(r1)); r1:=u1+s1; Writeln('r1 = "', r1, '" cp = ', StringCodePage(r1)); readln; end. s1 = "abc" cp = 65001 u1 = "nop" cp = 65001 s2 = "abcnop" cp = 866 s2 = "nopabc" cp = 866 r1 = "abcnop" cp = 1252 r1 = "nopabc" cp = 1252 Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Test for valid ip address
On Thu, 28 Jul 2016 10:26:32 +0200 Jonas Maebewrote: > On 28/07/16 10:14, Koenraad Lelong wrote: > > I need a way to test if an string containing an ipv4-address is really > > an ipv4-address. > > I tried > > tmpAddress:=HostAddrToStr(StrToHostAddr(IPAddressStr)); > > writeln(tmpAddress); > > if (tmpAddress='0.0.0.0') then > > begin > >writeln('Error in IP-address'); > >IPAddressStr:=tmpAddress; > > end; > > When I enter 192.168.185.297 (i.e. not a valid ipv4 address) in > > IPAddressStr I get > > 192.168.185.41 > > not the expected error-message. > > You can add a multiple of 256 to any octet of an IPv4 address in most > programs. Try it in your browser, it will probably also work. What browser supports that? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Weird string behavior
On Sat, 23 Jul 2016 00:29:32 +0200 Bartwrote: > On 7/22/16, Jonas Maebe wrote: > > >> ResultA := AnsiToUTF8(AnsiStrA + AnsiStrA); // UTF-8 ResultB := > >> AnsiToUTF8(AnsiStrA) + AnsiToUTF8(AnsiStrA); // Win-1252 > >> > >> > >> And resultA is not equal to ResultB > >> > >> It doesn't look like too intuitive. > > > > It would be good if someone with access to Delphi 2009+ could test this. > > I asked on Dutch Delphi forum if someone could test with D2009 or up. Here is a result of Delphi 10.1: program DTestConcatenate; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; var s1,s2,s3: AnsiString; r1,r2,r3: RawByteString; begin s1:='A'; // 1252 s2:='Aä'; // 1252 writeln('s1="',s1,'" cp=',StringCodePage(s1)); writeln('s2="',s1,'" cp=',StringCodePage(s2)); r1:=AnsiToUTF8(s1); // 65001 r2:=AnsiToUTF8(s2); // 65001 writeln('r1="',r1,'" cp=',StringCodePage(r1)); writeln('r2="',r2,'" cp=',StringCodePage(r2)); r3:=r1+r2; // 65001 writeln('r3="',r3,'" cp=',StringCodePage(r3)); s3:=r1+r2; // 65001 writeln('s3="',s3,'" cp=',StringCodePage(s3)); end. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Weird string behavior
On Tue, 26 Jul 2016 12:03:21 +0200 Jonas Maebe <jonas.ma...@elis.ugent.be> wrote: > Mattias Gaertner wrote on Tue, 26 Jul 2016: > > > It seems the Delphi rules for non rawbytestrings are: > > - Concatenate two same declared strings: append bytes, copy dyn. cp > > from left operand. Declared cp of result is left operand. > > Are you sure it's "append bytes" here and not "append bytes if same > dyn cp, otherwise convert to unicodestring, concatenate, and convert > back to dyn cp of left operand"? Now I'm sure. See attachments. Mattias cp_test2.dpr Description: Binary data a1 = "aä" cp = 1252 a2 = "oö" cp = 65001 a3:=a1+a2 = "aäoA" cp = 1252 a3:=a2+a1 = "oöa?" cp = 65001 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Weird string behavior
On Tue, 26 Jul 2016 11:01:28 +0200 Jonas Maebewrote: >[...] > Could you try the same program with u1 as plain ansistring instead of > utf8string? (with an additional > "setcodepage(rawbytestring(u1),65001,false);" after assigning u1) Sure: {$APPTYPE CONSOLE} type tcp866 = type ansistring(866); var s1, s2: tcp866; u1: UTF8String; r1: RawByteString; a1, a2: AnsiString; begin s1:='cp866'; setcodepage(rawbytestring(s1),65001,false); Writeln('s1 = "', s1, '" cp = ', StringCodePage(s1)); a1:='acp'; setcodepage(rawbytestring(a1),65001,false); Writeln('a1 = "', a1, '" cp = ', StringCodePage(a1)); u1:='utf8'; Writeln('u1 = "', u1, '" cp = ', StringCodePage(u1)); s2:=s1+u1; Writeln('s2:=s1+u1 = "', s2, '" cp = ', StringCodePage(s2)); s2:=u1+s1; Writeln('s2:=u1+s1 = "', s2, '" cp = ', StringCodePage(s2)); r1:=s1+u1; Writeln('r1:=s1+u1 = "', r1, '" cp = ', StringCodePage(r1)); r1:=u1+s1; Writeln('r1:=u1+s1 = "', r1, '" cp = ', StringCodePage(r1)); a2:=s1+u1; Writeln('a2:=s1+u1 = "', a2, '" cp = ', StringCodePage(a2)); a2:=u1+s1; Writeln('a2:=u1+s1 = "', a2, '" cp = ', StringCodePage(a2)); s2:=s1+a1; Writeln('s2:=s1+a1 = "', s2, '" cp = ', StringCodePage(s2)); s2:=a1+s1; Writeln('s2:=a1+s1 = "', s2, '" cp = ', StringCodePage(s2)); r1:=s1+a1; Writeln('r1:=s1+a1 = "', r1, '" cp = ', StringCodePage(r1)); r1:=a1+s1; Writeln('r1:=a1+s1 = "', r1, '" cp = ', StringCodePage(r1)); a2:=s1+a1; Writeln('a2:=s1+a1 = "', a2, '" cp = ', StringCodePage(a2)); a2:=a1+s1; Writeln('a2:=a1+s1 = "', a2, '" cp = ', StringCodePage(a2)); readln; end. s1 = "cp866" cp = 65001 a1 = "acp" cp = 65001 u1 = "utf8" cp = 65001 s2:=s1+u1 = "cp866utf8" cp = 866 s2:=u1+s1 = "utf8cp866" cp = 866 r1:=s1+u1 = "cp866utf8" cp = 1252 r1:=u1+s1 = "utf8cp866" cp = 1252 a2:=s1+u1 = "cp866utf8" cp = 1252 a2:=u1+s1 = "utf8cp866" cp = 1252 s2:=s1+a1 = "cp866acp" cp = 866 s2:=a1+s1 = "acpcp866" cp = 866 r1:=s1+a1 = "cp866acp" cp = 1252 r1:=a1+s1 = "acpcp866" cp = 1252 a2:=s1+a1 = "cp866acp" cp = 1252 a2:=a1+s1 = "acpcp866" cp = 1252 It seems the Delphi rules for non rawbytestrings are: - Concatenate two same declared strings: append bytes, copy dyn. cp from left operand. Declared cp of result is left operand. - Assign same declared: no conversion, only refcount. - Concatenate two different declared strings: convert both to UnicodeString and append. Maybe there is an optimization for same dyn cp. - Assign different declared strings: convert to LHS. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Weird string behavior
On Mon, 25 Jul 2016 22:25:59 +0200 Jonas Maebewrote: > On 23/07/16 13:31, Petr Kohut wrote: > > Hello, > > here are results: > > Thanks a lot. Could you test one more? I think I will have all > information I need then. > > > Jonas > > {$APPTYPE CONSOLE} > > type >tcp866 = type ansistring(866); > var >s1, s2, s3: tcp866; > begin >s1:='abc'; >setcodepage(rawbytestring(s1),65001,false); >s2:='def'; >setcodepage(rawbytestring(s2),437,false); >s3:=s1+s2; >Writeln('DefaultSystemCodePage = ',DefaultSystemCodePage); >Writeln('s3 = "', s3, '" cp = ', StringCodePage(s3)); >Readln; > end. DefaultSystemCodePage = 1252 s3 = "abcdef" cp = 65001 Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] what is the correct way to write {$IFDEF FPC Version > 3.0}
On Fri, 8 Jul 2016 18:47:19 +0800 Denniswrote: > what is the correct way to write {$IFDEF FPC Version > 3.0} {$IF FPC_FULLVERSION>3} Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Initialization of packed record local variables?
On Fri, 22 Jul 2016 11:03:23 +0200 (CEST) Michael Van Canneytwrote: > On Fri, 22 Jul 2016, leledumbo wrote: > > >> OK, I did not know about the default keyword. > >> > >> Is "default" zero? > > > > http://wiki.lazarus.freepascal.org/FPC_New_Features_3.0#New_compiler_intrinsic_Default > > > > Or better yet, the official documentation: > > http://www.freepascal.org/docs-html/current/rtl/system/default.html Can the examples be added to official docs? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] What is the difference between TThread.Queue(aMethod: TThreadMethod) and Application.QueueAsyncCall(AMethod: TDataEvent; Data: PtrInt);
On Fri, 1 Jul 2016 17:47:58 +0200 (CEST) Michael Van Canneytwrote: >[...] > Application.QueueAsyncCall has nothing to do with threads. > This is an LCL method which can be used to insert a callback in the message > loop. > I think it unlikely that this is thread-safe, I suspect it is only for the > main thread. It is thread-safe and the callback is called by the main thread. > TThread.Queue schedules a call for execution in the main thread. > It is meant for use in other threads. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] for loop vs while loop
On Wed, 1 Feb 2017 11:49:34 + Graeme Geldenhuyswrote: > Hi, > > Just curious (been in a discussion with somebody else). Is there a > performance difference between a FOR loop and a WHILE loop? Yes, for-loop calculates the end value only once. > Not sure if it will make a difference, but the usage is with three > nested loops, iterating over some 300,000 plus data points in total. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to use pipes ?
On Wed, 1 Feb 2017 05:02:05 -0700 (MST) fredvswrote: > Hello. > > I have done lot of search on internet about pipes without success. > Even for Delphi. no demo nor explanation. > The same in fpc wki page. > > For example, how to use bytesavailable with pipes ? http://wiki.freepascal.org/Executing_External_Programs#How_to_redirect_output_with_TProcess > In: > CreatePipeHandles(InHandle, OutHandle, APipeBufferSize); > > InPipe.Read(Bufferout[0],BPipeBufferSize); > > What is the the ratio with APipeBufferSize vs BPipeBufferSize ? APipeBufferSize is how much the other process can produce before congestion. BPipeBufferSize is how much you want to process/eat each iteration. Usually APipeBufferSize >= BPipeBufferSize. > And length of Bufferout[0] vs APipeBufferSize vs BPipeBufferSize ? Bufferout[0] is just the first value. The whole Bufferout can be written by InPipe.Read. Therefore Bufferout must be >= BPipeBufferSize. > In short, a demo will be welcome. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] class property accessor static
On Tue, 7 Feb 2017 13:25:16 +0100 Maciej Izak <hnb.c...@gmail.com> wrote: > 2017-02-07 13:11 GMT+01:00 Mattias Gaertner <nc-gaert...@netcologne.de>: >[...] > > Sorry, I don't get it. > > Why is using a static method as accessor an advantage? > > > > You can use Get/Set pair of static methods in "property" form. Might be > more handy. Why is that "more handy"? "static" does not have a Self. That is less handy, isn't it? > > > and second: will work for improper implemented code ;) > > > (which is maybe disadvantage?): > > > > > > TFoo($1).F; > > > TFooClass($1).F; > > > > I don't see why these calls require static instead of normal. > > In other scenario (for normal "property") this call will raise AV. I can't follow you here. Are we still talking about why Delphi choose static instead of normal? > btw. "class property" is probably slightly faster ;) because don't pass > "self" parameter. True. OTOH you loose some possibilities. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] class property accessor static
Hi, The getter/setter of a class-property must be "static" (Delphi compatible). If I understand "static" correctly, then "static" simply omits passing the class as parameter. So a static class procedure is just a dumber version of a normal class procedure. What is the advantage of using "static" for class property accessors? Aka: Why did Delphi choose static here? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] class property accessor static
On Tue, 7 Feb 2017 12:30:26 +0100 Maciej Izak <hnb.c...@gmail.com> wrote: > 2017-02-07 12:10 GMT+01:00 Mattias Gaertner <nc-gaert...@netcologne.de>: >[...] > Generally "static" means no hidden parameter "self". "static" for methods > is used for methods designed for callbacks from external API. That's an advantage of static methods. But how is that related to class properties? How can you use class properties with "methods designed for callbacks from external API"? > We have 3 possibilities: > > ===code begin=== > type > TFooClass = class of TFoo; > TFoo = class > function A: Int32; // self as instance > class function B: Int32; // self as meta class of TFoo > class function C: Int32; static; // no self > > property D: Int32 read A; > property E: Int32 read B; > class property F: Int32 read C; > ===code end=== > > "class property" has two advantages. First: you can use "static" methods > for properties Sorry, I don't get it. Why is using a static method as accessor an advantage? > and second: will work for improper implemented code ;) > (which is maybe disadvantage?): > > TFoo($1).F; > TFooClass($1).F; I don't see why these calls require static instead of normal. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] class property accessor static
On Tue, 7 Feb 2017 13:31:10 + Graeme Geldenhuyswrote: >[...] > Couldn't that simply be > > Writeln(TFoo.F); Yes. > I never understood Object Pascal's class methods/properties either? > Unlike Java, not everything needs to be in a class. We are allowed to > have procedures or functions, and global ones at that. So in Object > Pascal we could simply have a unit called FooStuff where everything > related to Foo is defined, then have a global function F() and then use > it as follows... Class methods can be overridden. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] class property accessor static
On Tue, 7 Feb 2017 19:23:52 +0100 Sven Barthwrote: >[...] > Oh and don't forget that non-static class methods can be virtual (sometimes > I really miss that in C++). In FPC static class methods can be virtual as well. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] class property accessor static
On Tue, 7 Feb 2017 23:20:18 +0100 Sven Barth <pascaldra...@googlemail.com> wrote: > Am 07.02.2017 19:59 schrieb "Maciej Izak" <hnb.c...@gmail.com>: > > > > > > 2017-02-07 19:49 GMT+01:00 Mattias Gaertner <nc-gaert...@netcologne.de>: > >> > >> In FPC static class methods can be virtual as well. > > > > > > So we have bug... > > Indeed... A useful bug. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IsValidIdent() and identifiers escaped with
On Sun, 5 Feb 2017 14:24:46 + Howard Page-Clarkwrote: > Consider this program, which returns False: > > program Project1; > > uses sysutils; > > var >: boolean; > > begin >:=IsValidIdent(''); >WriteLn('IsValidIdent() evaluates to ', ); > end. > > Should sysutils.IsValidIdent() be updated to return True in this case? The identifier is "begin". The & is an operator. For example: type TMyEnum = (); var e: TMyEnum = begin writeln(e); end. gives "begin". Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] destructor
Hi, fpc allows to declare a method with the destructor keyword, that is not a real destructor, because it does not free the memory. For what is this feature good for? For example: Type TClassA = class public destructor Foo; end; destructor TClassA.Foo; begin end; var o: TClass; begin o:=TClass.Create; o.Foo; // does not call FreeInstance o.Destroy; // does call FreeInstance end. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Typecast class-of to class
Hi, FPC allows to type cast a class-of variable to a class instance. Is this a bug or a feature? var c: TClass; begin TObject(c).ClassName; // crash end. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] uses myunit in '../src/myunit.pas' ?
On Sun, 12 Feb 2017 15:33:23 +0800 Tim Veldhuizenwrote: > Indeed, I can confirm Delphi does this. I think since 2009 or XE or so, > but AFAIK it doesn't need to. It does it only for the files that are > explicitly added to the project, but those are also in the dproj file. > And it would compile just fine without explicitly referring to the files > in the dpr file, so I'm not exactly sure why it does it. Perhaps it's a > kind of optimization for the caching system in the IDE.. Delphi uses them just a marker for the IDE, that the units belongs to the project. It does not create different code. It uses that system since at least Delphi 3. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] uses myunit in '../src/myunit.pas' ?
On Mon, 13 Feb 2017 16:47:38 -0700 (MST) fredvswrote: >[...] > This works (Mathias way): That's not my way. In my opinion you should not put paths into Pascal sources and the directive should be disabled in units. >[...] > Congratulation Mathias, you come late, but you win. No, I lost. Even my name is written wrong. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] uses myunit in '../src/myunit.pas' ?
On Sun, 12 Feb 2017 16:17:01 +0100 (CET) mar...@stack.nl (Marco van de Voort) wrote: >[...] > > One example might be when you are writing a quick program and don't want > > to send in a whole bunch of -Fu options and go into dialog boxes in > > lazarus configuring it, so you just quickly write it in your program > > ../someunit instead of configuring -Fu which can be obnoxious and > > tedious.. But that's just one use case. Another use case, AFAIR was a > > build system instead of gnu make. > > IMHO these are all shaky uses cases, and actually doing it right is quite > hard. Why is using -Fu hard? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] uses myunit in '../src/myunit.pas' ?
On Mon, 13 Feb 2017 09:34:09 -0700 (MST) fredvswrote: > > The compiler already does this. > Yes, that I know, for one unit, but try this: I guess you are searching for {$unitpath Documents} The problem with this directive is that it only works correct in the program. FPC allows it in units too, but then some units might not rebuild automatically, so you must rebuild always clean. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] destructor
On Tue, 24 Jan 2017 15:33:30 +0100 Maciej Izak <hnb.c...@gmail.com> wrote: > 2017-01-24 12:48 GMT+01:00 Mattias Gaertner <nc-gaert...@netcologne.de>: > > > fpc allows to declare a method with the destructor keyword, that is > > not a real destructor, because it does not free the memory. For what is > > this feature good for? > > > > with trunk works as expected (Foo does call FreeInstance). True. Sorry, I mixed two destructors. Now I understand the Note: Class should have one destructor only. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC run (run program after compile)
On Mon, 16 Jan 2017 00:06:59 -0700 "Lars"wrote: > Is there a way to compile a program with fpc at the command line and run > it right after? > > Something like > fpc run project1.pas -Fu../ instantfpc -Fu../ project1.pas > The only thing I could find was InstantFpc, which may serve similar > purpose but not really the same as what I was thinking... And what are you thinking? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC run (run program after compile)
On Mon, 16 Jan 2017 05:22:14 -0700 "Lars"wrote: >[...] > That instantfpc has catch22 like you cant compule multiple projects with > the same name, i.e. it caches file name only (caveat) whereas fpcrun would > compile it in current directory, as normal, no special cache dir needed Feel free to add an option like "--inplace" and send the patch. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC run (run program after compile)
On Mon, 16 Jan 2017 13:15:40 -0700 "Lars"wrote: >[...] > Does instantfpc make it mandatory that you put this at the top of every > source file: > > #!/usr/local/bin/fpc.d/3.0.0/instantfpc --set-cache=./ No. That's only needed if you want to run the Pascal file directly: ./project1.pas > fpcrun would not require this as it just compiles normally... > > However making fpcrun.exe (trivial) would duplicate what instantfpc > already kind of sort of does, so I do not want fpc to ship two executables > that do the same thing (or similar)... fpc has a much slower startup time than instantfpc. That's why instantfpc is good for running Pascal scripts. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] with no if assigned() there are bugs
On Wed, 21 Sep 2016 22:43:57 -0600 "Lars"wrote: > On Wed, September 21, 2016 6:27 am, Pierre Free Pascal wrote: > > There is also the -gc option: > > -gcGenerate checks for pointers > > > > > > This is another debugging option, that is not used very often, > > > I could not find this option in the Lazarus options under debugging or any > other tab... maybe it is not used often enough that Lazarus missed putting > it in a compiler option configuration... See Jonas comment, why -gc has limited use. > or I may have missed it. > > I think this is a good check to have So in Lazarus must I make my own > custom option, or is it hidden somewhere where I cannot see it? Many options have no GUI element. That's why there is Custom Options / All Options. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Does FCL Image support transparency?
On Fri, 16 Sep 2016 17:48:33 +0200 (CEST) Michael Van Canneytwrote: > On Fri, 16 Sep 2016, Reimar Grabowski wrote: > > > Hi, > > > > I want to put watermarks on images in a command line application. > > This doesn't do the trick: > > > > ScaledImage:=TFPCompactImgRGBA8Bit.Create(Width, Height); > > Canvas:=TFPImageCanvas.Create(ScaledImage); // TFPImageCanvas > > Canvas.StretchDraw(0,0,Width,Height,Image); // Image is TFPCompactImgRGB8Bit > > Canvas.Draw(0,0,Watermark); // Watermark is an TFPCompactImgRGBA8Bit > > > > Watermark is a transparent PNG loaded from disk but the transparency is not > > respected when drawing it onto ScaledImage. > > > > Can FCL Image do this and if not what are my alternatives? > > It should be able to do this, yes. TFPCustomCanvas.Draw does not handle Alpha by merging. It simply copies the pixel. Is this a bug or by design? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FreeBSD distro with fpc as star.
On Wed, 9 Nov 2016 09:39:40 + Graeme Geldenhuyswrote: > On 2016-11-08 11:04, Michael Schnell wrote: > > Sadly in my compiled "trunk" version 1.7 on Linux the <"LCLWidgetType"> > > drop down menu is not shown any more :-(. > > The redesign of Lazarus's compiler options dialog, is now dependent on > the project type as well. So the LCLWidgetType combobox is only visible > if you are working with a LCL application. If you have a Console or CGI > or Web application open, then the LCLWidgetType combobox is not visible > (as it wouldn't make sense in that project). I updated the wiki page: http://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Changing_the_LCLWidgetType_in_Version_1.1_and_above Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Underscores in numerical literals - grouping
On Tue, 22 Nov 2016 13:32:03 + Graeme Geldenhuyswrote: > On 2016-11-22 13:26, Sven Barth wrote: > > I think the difference a tab versus a couple of spaces makes (even if > > across a whole file or a whole project) will be insignificant > > Well, for every byte in the file, the parser needs to figure out what to > do with it. Less bytes, means less processing cycles - no matter how > small. They do add up in the end when you have to parse some 1 million > lines of code. > > But there was also a reason I put a smiley face at the end of my post. > [technically what I said is sound and true, but I have no metrics to > prove it] You forgot to consider how scanners work, i.e. how they check and skip spaces. Here are some numbers: Compiling Lazarus sources 'make clean all' 1249309 lines 3 times 0m51.682s 0m51.415s 0m51.698s Lazarus uses indentation of 2, so replacing each double space with one tab saves 3.7mb. Compiling 3 times: 0m52.003s 0m51.294s 0m51.452s This is a desktop system, so there is always a bit of noise. As you can see, the time difference is not measurable. To estimate the potential speed up: Replacing all multi spaces with one space saves 6.1mb. Compiling 3 times: 0m51.064s 0m50.733s 0m51.120s It seems scanning the spaces costs about 1%. My conclusion: That tabs costs less cpu time in Pascal code is a myth. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Lazarus Release 1.6.2
The Lazarus team is glad to announce the release of Lazarus 1.6.2. This is a bugfix release. This release was built with FPC 3.0.0. The previous release Lazarus 1.6 was built with FPC 3.0.0 too. Here is the list of fixes for Lazarus 1.6.x: http://wiki.freepascal.org/Lazarus_1.6_fixes_branch Here is the list of changes for Lazarus and Free Pascal: http://wiki.lazarus.freepascal.org/Lazarus_1.6.0_release_notes http://wiki.lazarus.freepascal.org/User_Changes_3.0.0 The release is available for download on SourceForge: http://sourceforge.net/projects/lazarus/files/ Choose your CPU, OS, distro and then the "Lazarus 1.6.2" directory. Checksums for the SourceForge files: http://www.lazarus-ide.org/index.php?page=checksums#1_6_2 Minimum requirements: Windows: MS Windows >= Win98 (32 or 64bit) Win98 and WinNT IDE needs FPC 2.6.4 and building with flag -dWIN9XPLATFORM. FreeBSD/Linux: gtk 2.8 or qt4.5, 32 or 64bit. Mac OS X: 10.5 to 10.11, LCL only 32bit, non LCL apps can be 64bit. The svn tag is http://svn.freepascal.org/svn/lazarus/tags/lazarus_1_6_2 For people who are blocked by SF, the Lazarus releases from SourceForge are mirrored at: ftp://freepascal.dfmk.hu/pub/lazarus/releases/ and later at (after some time for synchronization) http://michael-ep3.physik.uni-halle.de/Lazarus/releases/ and http://mirrors.iwi.me/lazarus/ Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Docs: Type A = Integer?
On Sun, 13 Nov 2016 21:21:16 +0100 Ewaldwrote: > Hello, > > Section 1.2.40 of Programmers guide > (http://www.freepascal.org/docs-html/prog/progsu40.html#x47-460001.2.40) > says, somewhere in the middle: > > Type > A = Integer; > > Is it supposed to be there? If so, what is it supposed to mean? Maybe this helps: http://www.freepascal.org/docs-html/current/ref/refse19.html Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] MySQL 5.7 and FreePascal
On Sun, 20 Nov 2016 00:33:23 +0100 (CET) Michael Van Canneytwrote: >[...] > It depends. MySQL 5.7 is supported in the mysql57dyn.pp unit, but I am not > sure it is included in Lazarus 1.6. It is shipped with fpc 3.0.0, so yes. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Missing messages
>[...]Then there is also the issue of them not conforming > to Unicode standards eg: the Lazarus Forum. What do you mean? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] server down?
Hi, On the bug tracker login page http://mantis.freepascal.org/login_page.php?return=%2Fmy_view_page.php%3F I see this text: Do you already have a login at Free Pascal Community? You can use that login here (use your e-mail address as username). When clicking on the "Free Pascal Community" link it times out: http://community.freepascal.org:1/ BTW, the bugs.freepascal.org site nowhere mentions a webmaster. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPImage and mult-page TIFF support
On Wed, 7 Dec 2016 15:34:13 + Graeme Geldenhuyswrote: >[...] > fs := TFileStream.Create('/tmp/multipage_tiff_example.tif', fmOpenRead); > t := TFPReaderTiff.Create; t.OnCreateImage:=@... > t.LoadFromStream(fs, true); Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPImage and mult-page TIFF support
On Thu, 8 Dec 2016 12:12:27 + Graeme Geldenhuys <mailingli...@geldenhuys.co.uk> wrote: > On 2016-12-07 17:47, Mattias Gaertner wrote: > >> > t := TFPReaderTiff.Create; > > t.OnCreateImage:=@... > > > > Thanks that solved it. > > But why can't TFPReaderTiff do that for us, or at least have a default > implementation (override'able by developers if really needed). The default implementation is for the normal use - reading only the biggest image: http://wiki.freepascal.org/fcl-image#Reading_an_image_file How should the default look like for lists of images? A variable with a default image class, and set as default to TFPMemoryImage? That would be a 64bit per pixel image, wasting a lot of memory. Or using CreateFPCompactImg, which creates a more compact image, but maybe the image will only support grayscale and/or no alpha. Or add some helper procedures, for some common cases. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPImage and mult-page TIFF support
On Thu, 8 Dec 2016 14:09:53 + Graeme Geldenhuys <mailingli...@geldenhuys.co.uk> wrote: > On 2016-12-08 14:01, Mattias Gaertner wrote: > > That would be a 64bit per pixel image, wasting a lot of memory. > > Why FPImage uses 64bit per pixel is beyond me! The original author of > FPImage clearly thought he/she saw something cool in that, but 99.9% > of the time *nobody* needs that. It's causing more grief (and code to do > conversions) than anything else. The 64bit is the maximum limit. I doubt the 99.9%. Image editing require more than 8bit per channel since decades. > > Or add some helper procedures, for some common cases. > > This might be a good solution. Some ready-made event handlers. Any idea how that should look like? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPImage and mult-page TIFF support
On Thu, 8 Dec 2016 15:15:55 + Graeme Geldenhuys <mailingli...@geldenhuys.co.uk> wrote: > On 2016-12-08 14:22, Mattias Gaertner wrote: >[...] > It's not rocket science. ;-) Even rocket scientists can't read minds. Will you create the patch or should I? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPImage and mult-page TIFF support
On Fri, 9 Dec 2016 12:39:54 +0100 (CET) mar...@stack.nl (Marco van de Voort) wrote: >[...] > Are there still no ways around the 64-bit storage format? I thought > TLazintfImage was meant to be a step in that direction? There are various image formats (TLazintfImage, TFPCompactImgRGBA8Bit, TFPCompactImgGrayAlpha8Bit, ..), so memory consumption is as good as you want. Maybe the docs should mention the alternatives of TFPMemoryImage more prominently. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPImage and mult-page TIFF support
On Wed, 7 Dec 2016 09:58:13 + Graeme Geldenhuyswrote: > Hi, > > Does anybody know if FPImage supports multi-page TIFF's? Reading or > Writing. Do you mean multiple IFD? TFPReaderTiff and TFPWriterTiff support multiple IFD using multiple TFPCustomImage. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PascalScript broken by FPC 3.0 ?
On Sun, 15 Jan 2017 13:36:14 +0100 Bartwrote: > On 1/15/17, Kapibara Pas wrote: > > > What has happened? Is it possible to get it to work again without going back > > to Lazarus 1.4 and fpc 2.6.4? > > As a workaround you can switch back to fpc 2.6.4 for the time being. > Lazarus 1.6 branch should work with the 2.6.4 compiler. > > Just install fpc 2.6.4 and 2.6.4 sources. > In Lazarus options set the correct path to the compiler and compiler > sources. Then rebuild Lazarus clean. Note: You can use the Lazarus IDE macro $(FPCVer) in the "FPC source directory". Then you only need to switch the compiler path. > For projects you need the 3.0 compiler, just switch back the paths, do > a clean rebuild and you're back. You can compile normally, because the IDE notices the different compiler and will pass -B automatically. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Using the LCL without Lazarus
On Thu, 1 Dec 2016 15:15:36 -0200 luciano de souzawrote: > Yes, this is a very good feature. As I can't see, the single way to > not extrapass the space is the automatic layout. > To become perfect, it would be fantastic if there is also automatic > positioning like in Wx or GTK. Maybe this page helps: http://wiki.lazarus.freepascal.org/Autosize_/_Layout Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Using the LCL without Lazarus
On Thu, 1 Dec 2016 14:57:42 -0200 luciano de souzawrote: > I am also blind and this topic really interesses me. > In the given example, heith and width were specified in pixels. > Is there a way to write the same example using automatic adjustments, > in other words, setting to the layout incresing or decreasing in the > proporcion of the label writen? Yes. For example: With Form1.Button1 Do begin Left := 10; Top := 10; AutoSize := true; Caption := 'PRESS ME'; Parent := Form1; end; Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Using the LCL without Lazarus
On Tue, 29 Nov 2016 20:42:36 -0500 "BobJ"wrote: >[...] > Begin web-site excerpt > > Using the LCL without Lazarus > > 1How to use the LCL without the Lazarus IDE? > 1.1Requirements > 1.2Introduction > 1.3The installation process > 1.4The settings > 1.5The code > 1.6Lazarus 1.2.6 > 2Alternatives > How to use the LCL without the Lazarus IDE? > > Requirements > Things you'll need: > . Free Pascal 2.4.4 > . Lazarus 0.9.30 That's very old. Current is FPC 3.0.0 and Lazarus 1.6.2. > Tested on Microsoft Windows XP SP3. > > Introduction > > You are not forced to use the Lazarus IDE if you want to develop with the > LCL. You can use it directly from the Free Pascal Compiler. True. >[...] > 1. I have FPC ver 3.0.0 and Lazarus ver 1.6 > Should the instructions given in the excerpt be applicable with these > versions, as well? Pretty much. Although this setup adds source paths so every program will compile the LCL, creating many copies and may result in a mess. Where did you find this? I recommend to simply install using the Lazarus installer. If you don't want to install the IDE you can do alternatively: Download and install FPC. Then download the Lazarus sources (e.g. to C:\lazarus) and build them: Make sure FPC 'bin' is in PATH environment variable, cd C:\lazarus, and execute 'make clean all'. This will build the LCL for win32, lazbuild and the IDE. Whatever you chose, next do: Add to your fpc.cfg: -FuC:\lazarus\component\lazutils\lib\i386-win32 -FuC:\lazarus\lcl\units\i386-win32 -FuC:\lazarus\lcl\units\i386-win32\win32 Do not add source or include paths - it can create a mess and strange errors. Now you can use the LCL in your programs. > 2. Is it safe to assume that when they say > "You are not forced to use the Lazarus IDE if you want to develop with the > LCL. You can use it directly from the Free Pascal Compiler." > that they mean that the source code can be submitted to FPC at the command > line? Yes. Lazarus calls FPC itself. If you use some Lazarus packages, you can build them using lazbuild. Then add the directories containing the ppu files to your fpc.cfg, and *only* those directories. > 3. As I stated somewhere above, the FP IDE is not accessable at a practical > level so, is there some other way that I can satisfy the requirements to do > the following? > > Start the FP IDE (included with FPC). >[...] I leave this open for others. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] For..in enumerator for generic records?
On Wed, 30 Nov 2016 18:24:11 +0700 Ryan Josephwrote: >[...] I can wrap my head around nested types in classes because they’re >necessary for generics I just learned but nested classes feel messy. Is there >at least some namespace protection? Yes. And it follows visibility rules. > That would be a benefit I suppose if the class was only ever used > inside that class but a unit may be a better option in that case. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC clean room project
On Mon, 2 Jan 2017 05:23:06 + (UTC) Mr Beewrote: > Hi all, > There's someone accusing that Free Pascal (and some parts of Lazarus) is just > a reverse engineering of Delphi. FPC runs on 80 platforms. Delphi only runs on MS Windows 32/64 and can cross compile to a few more. FPC supports Delphi syntax and several more, including two of its own. > Even he said some codes of FPC/Laz are taken from Delphi (and Kylix). > This is a serious allegation. Yes, and the FPC and Lazarus team treat them seriously. I don't know of such code, but if you find such code in FPC/Laz please report it, so it can be removed/replaced. > I know that isn't true. Or is it? ;) > Can anybody elaborate on this? I'd like to debunk the allegation but I don't > know where to start and the evidence for it. Ask the accusers what part is taken, then look at the code and the commit history. Just for your interest: FPC/Lazarus is a volunteer project, which get a lot of patches from the community. Sometimes patches look like (altered) Delphi code and they get rejected. But nobody is perfect, and so some years ago some doubtful procedures were found. They had been replaced. Many such allegations were not about FPC/Laz, but about projects using FPC/Laz. Some accusers don't know the difference or don't care. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal