[Lazarus] GTK3 is out
Hi List, We still have not get rid of GTK1, and now GTK3 is out. There is a guidehttp://library.gnome.org/devel/gtk/unstable/gtk-migrating-2-to-3.htmlof how to move from GTK2 into GTK3. Ido LINESIP - Opening the source for communication http://www.linesip.com http://www.linesip.co.il -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] OpenGL conversion
On Tue, 15 Feb 2011 10:14:33 +0200 Juha Manninen juha.mannine...@gmail.com wrote: [...] I guess TOpenGLControl could work with Delphi, too. Feel free to create a VCL backend. A QT backend is missing too. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK3 is out
2011/2/15 ik ido...@gmail.com: We still have not get rid of GTK1, and now GTK3 is out. That's wrong, we are already free of gtk1 in Lazarus = 0.9.30 -- Felipe Monteiro de Carvalho -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SdpoSerial Tx and Rx buffers?
On Tue, 15 Feb 2011 00:49:56 +, Paulo Costa p...@fe.up.pt wrote: On 14/02/2011 19:32, Bo Berglund wrote: First one thing, your message subject is too broad: Sorry about that, I just meant to ask about the way the Tx and Rx buffers are handled since I did not find any property for them to be set... Are we talking about the RX or thr TX buffer? Both really. Then, are we talking about the component, the library or the OS buffers? And then are we talking about Windows 32, 64 bits or Linux? It is hard to answer for all cases... I have turned to FPC/Lazarus because I need the software to be portable between Windows, Linux and embedded Linux on ARM. I had the impression that I did not have to bother with the distinctions you are making (write once compile everywhere...). Synaser is blocking both for writing and reading. The SdpoSerial component creates a thread to listen and generates an event when bytes are received. So reading can be non-blocking. The write methods are direct calls to the Synaser ones and they are blocking. Does that mean that until all of the bytes have left the serial port the Write does not return to my program? This is exactly why I asked about the buffers... So I need to know in the case of SdpoSerial that it is possible without data loss to write a string of 1 Mbytes size. In a blocking way (the function will only return when most of the bytes are already sent), all bytes will be transmitted. What does most mean? And do you mean when they have actually left the UART on to the RS232 wires? I also need to know how I can examine the progress of the transfer so I can control a progress bar or similar on screen while the transfer is running. For that, you must break your transmission in small block and use the completion of each transfer to signal the progress. Are you really sure that the Write in SdpoSerial is blocking? So there are no internal transmit buffers that receive the data and then the call returns and the work is done by a transmit thread While the transfer runs my program sits and waits for an ACK coming back from the other end after it has checked the checksum. That is a loop with Application.Processmessages, Sleep and a timeout... I don't know if that is an option but I would break such big transmission in smaller packets each one with its own checksum... I can do that for the general memory transfer function because it is defined such that the sender defines what address range is to be sent. But it will add handshaking overhead to the transfer. The instrument protocol for this is as follows: Memory transfer: Tx: command bytedestination addressnumber of bytes Rx: ACK (if the instrument can receive the data, NAK otherwise Tx: length of databinary datachecksum Rx: ACK if all bytes received and checksum is OK, NAK otherwise (Of course if not all bytes according to the length are send the instrument waits forever for the remaining data so there will be no NAK in this case). But file transfers are different, they can only be transferred complete. And I cannot change the protocol... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Old OpenSUSE 10.2 and Laz 29544
Am Montag, 14. Februar 2011 20:00 schrieb Mattias Gaertner: On Mon, 14 Feb 2011 19:27:22 +0100 theo x...@theo.ch wrote: I was wrong. The libs are there, but they are in /opt/gnome/lib on this system. For a reason, the latest version doesn't find them like the versions before. If I add -Fl/opt/gnome/lib, everything is fine. Ah, I thought this was obsolete. I added it to the LCL. Could you please add it for gtk1, too? Thanks, Burkhard -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SizeConstraint in Lazarus Form
It should be there (look at the OI). Bart On 2/14/11, William Oliveira Ferreira bdexterholl...@gmail.com wrote: hi! I'm missing the property Constraints that controls Max Min size of a Form in RunTime. Someone already told something about it? William de Oliveira Ferreira Bacharel em Sistemas de Informação -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Old OpenSUSE 10.2 and Laz 29544
Burkhard Carstens f...@bcsoft.de hat am 15. Februar 2011 um 11:07 geschrieben: Am Montag, 14. Februar 2011 20:00 schrieb Mattias Gaertner: On Mon, 14 Feb 2011 19:27:22 +0100 theo x...@theo.ch wrote: I was wrong. The libs are there, but they are in /opt/gnome/lib on this system. For a reason, the latest version doesn't find them like the versions before. If I add -Fl/opt/gnome/lib, everything is fine. Ah, I thought this was obsolete. I added it to the LCL. Could you please add it for gtk1, too? Yes, done. Although I think it would be better to add the path to the fpc.cfg. Mattias-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SizeConstraint in Lazarus Form
Yes, you're right, i think i was caused by the version i've used, this morning i've updated my lazarus to 28.2 and there it is... William de Oliveira Ferreira Bacharel em Sistemas de Informação 2011/2/15 Bart bartjun...@gmail.com It should be there (look at the OI). Bart On 2/14/11, William Oliveira Ferreira bdexterholl...@gmail.com wrote: hi! I'm missing the property Constraints that controls Max Min size of a Form in RunTime. Someone already told something about it? William de Oliveira Ferreira Bacharel em Sistemas de Informação -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK3 is out
Well, now is the time to port to GTK3, no? William de Oliveira Ferreira Bacharel em Sistemas de Informação 2011/2/15 Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com 2011/2/15 ik ido...@gmail.com: We still have not get rid of GTK1, and now GTK3 is out. That's wrong, we are already free of gtk1 in Lazarus = 0.9.30 -- Felipe Monteiro de Carvalho -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SdpoSerial Tx and Rx buffers?
Sorry in advance for piping in so late in the discussion... Windows and Linux serial implementations are very different in design from a buffering standpoint. In simple terms, the windows serial was a afterthought whereby serialtty in linux is as simple as reading and writing. No controls can be expected to be near flawless to seamlessly work between these platforms. To keep it short... As long as you are not doing visual work (qt,gtk,etc), cross compiling with fpc is very well built. I have a Ubuntu 10.10 virtual machine (vmware) I use for (i386/arm9) linux cross compiling that you can use if you want it. Its out of the box functionality. Just send an email to tgatl...@gatliff.com if you want a copy of it. I am currently having issues getting the qt sdk (4.6.3) interfacing, and would smile greatly for anyone who would want to join efforts to solve the problems. Otherwise, I will just keep working away at it... On Tue, Feb 15, 2011 at 4:45 AM, Bo Berglund bo.bergl...@gmail.com wrote: On Tue, 15 Feb 2011 00:49:56 +, Paulo Costa p...@fe.up.pt wrote: On 14/02/2011 19:32, Bo Berglund wrote: First one thing, your message subject is too broad: Sorry about that, I just meant to ask about the way the Tx and Rx buffers are handled since I did not find any property for them to be set... Are we talking about the RX or thr TX buffer? Both really. Then, are we talking about the component, the library or the OS buffers? And then are we talking about Windows 32, 64 bits or Linux? It is hard to answer for all cases... I have turned to FPC/Lazarus because I need the software to be portable between Windows, Linux and embedded Linux on ARM. I had the impression that I did not have to bother with the distinctions you are making (write once compile everywhere...). Synaser is blocking both for writing and reading. The SdpoSerial component creates a thread to listen and generates an event when bytes are received. So reading can be non-blocking. The write methods are direct calls to the Synaser ones and they are blocking. Does that mean that until all of the bytes have left the serial port the Write does not return to my program? This is exactly why I asked about the buffers... So I need to know in the case of SdpoSerial that it is possible without data loss to write a string of 1 Mbytes size. In a blocking way (the function will only return when most of the bytes are already sent), all bytes will be transmitted. What does most mean? And do you mean when they have actually left the UART on to the RS232 wires? I also need to know how I can examine the progress of the transfer so I can control a progress bar or similar on screen while the transfer is running. For that, you must break your transmission in small block and use the completion of each transfer to signal the progress. Are you really sure that the Write in SdpoSerial is blocking? So there are no internal transmit buffers that receive the data and then the call returns and the work is done by a transmit thread While the transfer runs my program sits and waits for an ACK coming back from the other end after it has checked the checksum. That is a loop with Application.Processmessages, Sleep and a timeout... I don't know if that is an option but I would break such big transmission in smaller packets each one with its own checksum... I can do that for the general memory transfer function because it is defined such that the sender defines what address range is to be sent. But it will add handshaking overhead to the transfer. The instrument protocol for this is as follows: Memory transfer: Tx: command bytedestination addressnumber of bytes Rx: ACK (if the instrument can receive the data, NAK otherwise Tx: length of databinary datachecksum Rx: ACK if all bytes received and checksum is OK, NAK otherwise (Of course if not all bytes according to the length are send the instrument waits forever for the remaining data so there will be no NAK in this case). But file transfers are different, they can only be transferred complete. And I cannot change the protocol... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK3 is out
William Oliveira Ferreira bdexterholl...@gmail.com hat am 15. Februar 2011 um 14:32 geschrieben: Well, now is the time to port to GTK3, no? Do you want to do it? Mattias-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Does Lazarus support a complete Unicode Component Library?
Graeme Geldenhuys schrieb: Op 2011-02-14 20:03, Jürgen Hestermann het geskryf: Do you mean that the compiler should convert the strings as needed in the background (as between different integer types and/or floats) so that you can call ListBox1.Items.Add(x) with x beeing UTF8string or UTF16string or...? Yes, but in reality how often would such conversions happen? TStringList (used inside a TListBox) would use UnicodeString types. The encoding of that type would default to whatever platform you compiled on. ie: under Linux it would default to UTF-8, and under Windows it would default to UTF-16 You realize the problems, that may result from the different char type of such an target-specific string type? IMO such strings should be encapsulated in a (polymorphic) class, that only allows for char-type independent operations. DoDi -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] What happened to TNoteBook?
Maxim Ganetsky schrieb: Then at least the example applications should be updated accordingly. It's not a good idea to ship broken examples with a new release :-( Fixed in r29551. Thanks :-) Hope it will lessen the number of sad smileys from you. ;) Sad smileys from me are not so important, in contrast to those from other users, which may find Lazarus still broken and unusable... DoDi -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Old OpenSUSE 10.2 and Laz 29544
Juha Manninen schrieb: theo kirjoitti maanantai 14 helmikuu 2011 16:15:15: I know I should probably upgrade this Linux Installation, .. FYI: OpenSUSE 10.2 supports zypper dup (= Distro Update). You don't need to download and burn CD images to update your system. It works also in practice, unlike a similar feature in some other distros. Maybe wait till the new version 10.4 before updating. I was happy with 10.3 for a long time, but all newer versions sucked so much that I stopped using OpenSuse at all. After trying Kubuntu (KDE) I finally arrived at Ubuntu and Gnome. At least Ubuntu supports all the KBD and GUI features that have been dropped from OpenSuse 11. And beware, installing OpenSuse 11 in a multi-boot environment damaged my disk system, making all other previously installed systems unusable! This may be a new version Grub issue... DoDi -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Does Lazarus support a complete Unicode Component Library?
On Tue, Feb 15, 2011 at 08:50:49AM +0200, Graeme Geldenhuys wrote: Yes, but in reality how often would such conversions happen? Does that really matter? If I don't now beforehand that I can control such issues with some strategic choices, I won't start using it at all. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Does Lazarus support a complete Unicode Component Library?
Am 14.02.2011 15:23, schrieb Graeme Geldenhuys: Not that I care (because Delphi doesn't do everything perfect), but how does Delphi 2010 handle such alias types - especially when passed as parameters (var and const)? In Delphi such strings with codepage need to be defined with type and thus they are different types (not compatible regarding var). The following example fails to compile at the call of Test. source begin program strvartest; {$APPTYPE CONSOLE} uses SysUtils; type CyrillicString = type AnsiString(1251); LatinString = type AnsiString(1252); procedure Test(var aStr: CyrillicString); begin end; var s: LatinString; begin s := 'Foo'; Test(s); end. source end Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Compile error
On Fri, 2011-02-11 at 14:02 +1300, Paul Parkyn wrote: Hello, I have been trying to compile lazarus from svn, as I have tried a number of times I am using make clean all the process fails when calling the resource compiler for lazarus.or. lazarus.pp(132,1) Error: Can't call the resource compiler /usr/bin/fpcres, switching to external mode The fpcres program is in the /usr/bin directory and is executable by everyone, lazarus.or is in the proper Unit directory and the majority of the files have updated time stamps. You will not only get this error if it can not run fpcres, but also if the execution of fpcres failes. Problem is that it doesn't show fpcres's output. You could try to call it yourself and see what the problem is. If you look carefully at the 'make all' output, you can see what the last exact command was to compile lazarus.pp. Copy-paste that command and add the '-va' parameter. Then check the output for more clues why fpcres doesn't work. Joost. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK3 is out
On Tue, 15 Feb 2011 10:35:28 +0200, ik ido...@gmail.com wrote: Hi List, We still have not get rid of GTK1, and now GTK3 is out. There is a guide [1] of how to move from GTK2 into GTK3. 1.Gtk is not officially supported by laz devels anymore (0.9.28.2 was last stable gtk support) 2.We will try to NOT broken gtk support (it still works in 0.9.31) 3.When time for gtk3 in lcl comes, it will be written from stratch - pure ground zero implementation. zeljko -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Old OpenSUSE 10.2 and Laz 29544
Maybe wait till the new version 10.4 before updating. You probably mean 11.4. Yes, I think I'll install this version when it's out. Thanks Theo -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK3 is out
I was trying to build this version from sources today, but gave up at the requirement of Xinput2. This would probably need a complete X11 and whatnot upgrade. Regards Theo -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Does Lazarus support a complete Unicode Component Library?
Hello Lazarus-List, Tuesday, February 15, 2011, 4:27:40 PM, you wrote: MvdV There is a solution that you can take FPC and Lazarus libraries out of the MvdV equation by splitting each target into an one and two byte encoding MvdV platform. That should fix the bulk of the problem. [...] MvdV Update to what? The point is that neither of both most used encodings (UTF8/16) is MvdV is going away anything soon, and the split is right through platforms. So you are talking about a platform about the encoding, but in any operative system platform, this means you can choose RTL Linux 32 bits WideString or RTL Linux 32 bits UTF8, do not ? Using a different RTL for each encoding is even worst IMHO. But this is just a simple opinion. MvdV Let's here the argumentation for that then. Well, maybe I misunderstood the platform split... -- Best regards, José -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] New Spreadsheet interface component available for Excel and OO Calc
2011/2/13 Thierry Coq t...@free.fr New functions are introduced on the ISheet interface: GetLastColumn and GetLastRow. That should help you. It took me a little time: I coded them in both Excel and OpenOffice. Thanks, GetLastColumn and GetLastRow works ok. Yes, I don't why yet. Certainly a bug in the interface somewhere. It doesn't happen for OpenOffice, though. I'm still looking into it. In the meantime, there should be no remaining compiler warnings or hints, except in the Pas_Uno_Bridge (needs some investigating). I'll try to check, maybe I can find something. best regards faber -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SdpoSerial Tx and Rx buffers?
On Tue, 15 Feb 2011 00:49:56 +, Paulo Costa p...@fe.up.pt wrote: Synaser is blocking both for writing and reading. The SdpoSerial component creates a thread to listen and generates an event when bytes are received. So reading can be non-blocking. The write methods are direct calls to the Synaser ones and they are blocking. I just checked by setting up a transfer of 100.000 bytes at 38400 baud. With a breakpoint at the FComm.WriteData method I could time this function using the step-over command. It returned in 30 s when the packet was 16 bytes long, an effective baudrate of 33300 baud. So it really looks like the WriteData *is* blocking... For that, you must break your transmission in small block and use the completion of each transfer to signal the progress. Sadly this seems to be the case... I would have to send in chunks of 1500 bytes or so to get 2 progress ticks per second. The application will probably be stone dead and nonresponsive too, which is one of the things I really like to *always* avoid. What one would need to do to fix this is to put the SdpoSerial into a thread and let the thread send data out from a buffer that can be loaded by the main application. But then we have the problem of transferring the Tx data into the thread environment in a threadsafe way... My project just grew. :-( Bo Berglund -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Compile error
On Tue, 2011-02-15 at 17:45 +0100, Joost van der Sluis wrote: On Fri, 2011-02-11 at 14:02 +1300, Paul Parkyn wrote: Hello, I have been trying to compile lazarus from svn, as I have tried a number of times I am using make clean all the process fails when calling the resource compiler for lazarus.or. lazarus.pp(132,1) Error: Can't call the resource compiler /usr/bin/fpcres, switching to external mode Thank you Joost, I found the problem, it was a old problem that had been fixed previously, the svn2revisioninc file was not set as executable. Regards Paul. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK3 is out
Quoting theo x...@theo.ch: I was trying to build this version from sources today, but gave up at the requirement of Xinput2. This would probably need a complete X11 and whatnot upgrade. or install fedora rawhide on some virtual machine :) zeljko -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK3 is out
Quoting theo x...@theo.ch: I was trying to build this version from sources today, but gave up at the requirement of Xinput2. This would probably need a complete X11 and whatnot upgrade. or install fedora rawhide on some virtual machine :) zeljko -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SdpoSerial Tx and Rx buffers?
Bo Berglund schrieb: So it really looks like the WriteData *is* blocking... For that, you must break your transmission in small block and use the completion of each transfer to signal the progress. Sadly this seems to be the case... Even if it were non-blocking, a block is required when you try to overflow the output buffer. DoDi -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SdpoSerial Tx and Rx buffers?
may i suggest looking at elecomm for an ideal it's a old pascal serial library but would fit your needs --- On Tue, 2/15/11, Bo Berglund bo.bergl...@gmail.com wrote: From: Bo Berglund bo.bergl...@gmail.com Subject: Re: [Lazarus] SdpoSerial Tx and Rx buffers? To: lazarus@lists.lazarus.freepascal.org Date: Tuesday, February 15, 2011, 2:53 PM On Tue, 15 Feb 2011 00:49:56 +, Paulo Costa p...@fe.up.pt wrote: Synaser is blocking both for writing and reading. The SdpoSerial component creates a thread to listen and generates an event when bytes are received. So reading can be non-blocking. The write methods are direct calls to the Synaser ones and they are blocking. I just checked by setting up a transfer of 100.000 bytes at 38400 baud. With a breakpoint at the FComm.WriteData method I could time this function using the step-over command. It returned in 30 s when the packet was 16 bytes long, an effective baudrate of 33300 baud. So it really looks like the WriteData *is* blocking... For that, you must break your transmission in small block and use the completion of each transfer to signal the progress. Sadly this seems to be the case... I would have to send in chunks of 1500 bytes or so to get 2 progress ticks per second. The application will probably be stone dead and nonresponsive too, which is one of the things I really like to *always* avoid. What one would need to do to fix this is to put the SdpoSerial into a thread and let the thread send data out from a buffer that can be loaded by the main application. But then we have the problem of transferring the Tx data into the thread environment in a threadsafe way... My project just grew. :-( Bo Berglund -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Does Lazarus support a complete Unicode Component Library?
Graeme Geldenhuys schrieb: Op 2011-02-14 20:03, Jürgen Hestermann het geskryf: Do you mean that the compiler should convert the strings as needed in the background (as between different integer types and/or floats) so that you can call ListBox1.Items.Add(x) with x beeing UTF8string or UTF16string or...? Yes, but in reality how often would such conversions happen? TStringList (used inside a TListBox) would use UnicodeString types. The encoding of that type would default to whatever platform you compiled on. ie: under Linux it would default to UTF-8, and under Windows it would default to UTF-16 That's sounds like yet another approach. So up to now I see 3 models how strings could be handled: -- 1.) Full programmer responsibillity (current model): The programmer is fully responsible for (and has full control about) the strings used in his program. Libraries use mostly UTF8 with some exception like API related libraries. The programmer needs to know about the used string types in all used libraries and if conversions are needed he has to initiate them manually. Pros: The programmer knows exactly what happens under the hood so he can judge performance and incompatibilities (at least he should). Cons: Much harder to code because he *needs* to know about all the details of string encodings in different libraries. When strings are saved to files they would be compatible accross OS platforms because the programmer can use the same type in all cases so files can be exchanged accross them. -- 2.) A generic UnicodeString is mapped to different real sting types under the hood. So the used string type in programs (and libraries like LCL) differs from platform to platform. The programmer does not even know what type is used. If a conversion is still needed for special routines it would be done automatically in the background without the programmer having to know about it. Other real string types like UTF8string are available but it's not encouraged to use them. Pros: Easy to code. In general, deeper knowledge about string encodings and their storage is not needed. String conversions are seldom needed. Cons: When non-unicode strings are used on a platform (i.e. ANSI on Windows) but unicode is required by the program it becomes clumsy because then the programmer has to use it's own (unicode) string type and then conversion are needed for all library and other functions. When strings are saved to files they may differ on different platforms so files cannot be exchanged accross them. All libraries have to be rewritten to handle different string types. - 3.) A middle course: UTF8 is chosen to be the main string type which should be used whenever possible (within LCL and other libraries) and also programmers are encouraged to use it so that conversions become (more and more) unlikely. When using interfaces with different string trypes (like OS APIs) there would be an automatic conversion in the background. Pros: Easy to code. No doubt about the used string type and its capabilities for the programmer, it's always UTF8 for him. When strings are saved to disk they are all UTF8 on all platforms so files can be exchanged between Linux and Windows (and others). Cons: Because LCL and other libraries use UTF8 there could be a performace impact when compiling to non-UTF8 OS (where API's use ANSI or other UTF16 or whatever). I would prefer model 3.) -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Does Lazarus support a complete Unicode Component Library?
Op 2011-02-15 16:32, Hans-Peter Diettrich het geskryf: You realize the problems, that may result from the different char type of such an target-specific string type? Please do share your thoughts... I must add, that I would be very surprised if Embarcadero doesn't use native encoded string types for the unicode string support in the upcoming Delphi under Windows (UTF-16), Linux (UTF-8), Mac (UTF-8) etc.. I'm not 100% sure about the default Mac encoding, but seeing that it comes from FreeBSD, I would guess UTF-8 there too. As for saving text to file...It is universally known to use UTF-8 in such cases, because UTF-8 is the perfect encoding for streaming. Hence the W3C also said all HTML, XML etc should be preferably in UTF-8. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Does Lazarus support a complete Unicode Component Library?
Op 2011-02-16 09:12, Jürgen Hestermann het geskryf: That's sounds like yet another approach. So up to now I see 3 models how strings could be handled: UnicodeString should become the default. I would even go as far as recommending that String = UnicodeString in a newer FPC version. UTF8String is not a special type, it is simply a UnicodeString that has it's encoding bit set to UTF-8. UTF8String is still a UnicodeString as far as the compiler is concerned. It's an alias type. Just like we now use String everywhere, in future we could use UnicodeString everywhere and don't need to worry about what encoding we are using. This should even be the case when we talk to OS API's or external libraries. By default libraries under Windows use UTF-16. Your UnicodeString under Windows will already be in UTF-16 - thus no conversion needed. Same for Linux. By default most libraries use UTF-8, and UnicodeString will automatically be in UTF-8 encoding anyway - thus again no conversion needed. All RTL functions which use UnicodeString will obviously be the correct encoding on each platform too. So again by default, simply using UnicodeString will not require any encoding conversions. Will will work for 99% all all applications. Only when the developer wants to do something specific with a specific encoding, that developer can simply define a new string type as follows: eg: type MyCP850StringType = UnicodeString(cp850); That developer can then use that string knowing the encoding is CP850. But this would be very seldom needed. As for the LCL or any libraries. They could simply use UnicodeString everywhere (thus my recommendation that String = UnicodeString in the future so our code wouldn't need much changing), and it will work just fine under all platforms, because UnicodeString will default to each platforms default encoding. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Does Lazarus support a complete Unicode Component Library?
Op 2011-02-15 17:38, Sven Barth het geskryf: In Delphi such strings with codepage need to be defined with type and thus they are different types (not compatible regarding var). Lets hope FPC doesn't take that stupid Delphi idea to implementation. A UnicodeString with a different encoding bit set is still a UnicodeString type. Thanks though for testing and letting us know what Delphi does. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus