Re: [fpc-pascal] How to compile Lazarus program using only FPC?
On 25/09/15 19:42, Mark Morgan Lloyd wrote: Lukasz Sokol wrote: This seems like a nice tutorial on X over SSH: http://elinux.org/RPi_Remote_Access (not tried myself YMMV) I'd have expected all necessary keys etc. to have been set up by default. Certainly with Raspbian I didn't have to create them. I'd also expect the SSH server (on Raspbian or other Debians) to have been configured to accept X11 forwarding/tunneling. I can't remember what the default state of the client is for this, which is where -X or -Y comes into it. Please move this part of the discussion to the fpc-other mailing list if you wish to continue it. Thanks, Jonas FPC mailing lists admin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
Lukasz Sokol wrote: On 25/09/15 16:13, Bo Berglund wrote: On Fri, 25 Sep 2015 08:30:10 +, Mark Morgan Lloyd wrote: Bo Berglund wrote: If absolutely necessary I will have to set up the RPi with a monitor, keyboard and mouse and install Lazarus and compile from there. But RPi is not as powerful a computer as the PC and it will probably be very slow if at all working You /do/ appreciate that you can tunnel the X11 user interface across SSH, and that most distreaux enable this by default, don't you? I have no idea what you are talking about here OTOH I have limited exposure to Linux, just installed a few virtual machines to get an Apache webserver running for debugging website development. And I have used a number of RPi units for specialized tasks (media center, VPN and Print servers). The RPi:s are all headless except the media center one, which is connected by HDMI to my TV. And using a TV as the display does not really appeal to me... My series of questions here are caused by me (while travelling) trying to collect all info needed for creating a controller application on the RPi2 using a half dozen units I earlier programmed in Delphi. Too much to rewrite in another language. I never programmed anything on a Linux system before. This seems like a nice tutorial on X over SSH: http://elinux.org/RPi_Remote_Access (not tried myself YMMV) I'd have expected all necessary keys etc. to have been set up by default. Certainly with Raspbian I didn't have to create them. I'd also expect the SSH server (on Raspbian or other Debians) to have been configured to accept X11 forwarding/tunneling. I can't remember what the default state of the client is for this, which is where -X or -Y comes into it. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
Bo Berglund wrote: On Fri, 25 Sep 2015 08:30:10 +, Mark Morgan Lloyd wrote: Bo Berglund wrote: If absolutely necessary I will have to set up the RPi with a monitor, keyboard and mouse and install Lazarus and compile from there. But RPi is not as powerful a computer as the PC and it will probably be very slow if at all working You /do/ appreciate that you can tunnel the X11 user interface across SSH, and that most distreaux enable this by default, don't you? I have no idea what you are talking about here You could have done with saying that earlier when several people were saying you could use it. Assuming that the machine you're sitting in front of is running Linux, try this: * Use SSH to log into your RPi. * SSH gives you access to a shell. * Enter the name of an application program that uses the X11 user interface, e.g. kinfocenter. * That program will run on the RPi, but the user interface will be tunneled over the SSH connection so the window will appear on your desktop machine. You can run Lazarus in the same way, but there's various improvements you can make to the crude sequence I've described. You can also install VNC or run X11 remotely, but that's not quite as resource-effective. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
On 25/09/15 16:13, Bo Berglund wrote: > On Fri, 25 Sep 2015 08:30:10 +, Mark Morgan Lloyd > wrote: > >> Bo Berglund wrote: >>> If absolutely necessary I will have to set up the RPi with a monitor, >>> keyboard and mouse and install Lazarus and compile from there. But RPi >>> is not as powerful a computer as the PC and it will probably be very >>> slow if at all working >> >> You /do/ appreciate that you can tunnel the X11 user interface across >> SSH, and that most distreaux enable this by default, don't you? > > I have no idea what you are talking about here > OTOH I have limited exposure to Linux, just installed a few virtual > machines to get an Apache webserver running for debugging website > development. And I have used a number of RPi units for specialized > tasks (media center, VPN and Print servers). The RPi:s are all > headless except the media center one, which is connected by HDMI to my > TV. And using a TV as the display does not really appeal to me... > > My series of questions here are caused by me (while travelling) trying > to collect all info needed for creating a controller application on > the RPi2 using a half dozen units I earlier programmed in Delphi. Too > much to rewrite in another language. > I never programmed anything on a Linux system before. > > This seems like a nice tutorial on X over SSH: http://elinux.org/RPi_Remote_Access (not tried myself YMMV) el es ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
On Fri, 25 Sep 2015 08:30:10 +, Mark Morgan Lloyd wrote: >Bo Berglund wrote: >> If absolutely necessary I will have to set up the RPi with a monitor, >> keyboard and mouse and install Lazarus and compile from there. But RPi >> is not as powerful a computer as the PC and it will probably be very >> slow if at all working > >You /do/ appreciate that you can tunnel the X11 user interface across >SSH, and that most distreaux enable this by default, don't you? I have no idea what you are talking about here OTOH I have limited exposure to Linux, just installed a few virtual machines to get an Apache webserver running for debugging website development. And I have used a number of RPi units for specialized tasks (media center, VPN and Print servers). The RPi:s are all headless except the media center one, which is connected by HDMI to my TV. And using a TV as the display does not really appeal to me... My series of questions here are caused by me (while travelling) trying to collect all info needed for creating a controller application on the RPi2 using a half dozen units I earlier programmed in Delphi. Too much to rewrite in another language. I never programmed anything on a Linux system before. -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
Em 24/09/2015 18:02, "Mattias Gaertner" escreveu: > > On Thu, 24 Sep 2015 16:21:31 +0100 > Graeme Geldenhuys wrote: > > > On 2015-09-24 16:14, Michael Van Canneyt wrote: > > Is lazbuild a pure console application? > > Yes. > > > If so, no problem, but my guess > > is that it still uses the LCL somewhere (ie: NoGUI widget type). > > Yes, it (still) needs some LCL units, but no gui libs. > Good to know One issue i found while trying to use lazbuild in a headless server is that there's no standalone lazbuild debian package. To use it i have to install the complete lazarus package that depends on gtk lib which is not needed / undesirable in this setting Btw the enviroment i needed lazbuild is cloud9 IDE. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FileIO in FPC 3.0
In our previous episode, Mattias Gaertner said: > Yes. I see invalid UTF-8 file names on Linux systems often (cannot be > converted to UTF-16). > > Are invalid UTF-16 file names under Windows really a practical > problem? > What program allows to create invalid UTF-16 file names? > With "invalid UTF-16" I mean not-convertable-to-UTF-8. I don't mean invalid > code points. Not likely. I think it is more something for the security side of things than normal operation. (path traversal issues when not guarded by permissions) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FileIO in FPC 3.0
On 2015-09-25 12:47, Marco van de Voort wrote: >> > (Now lets better not start about the encoding of Filenames on non-Windows >> > OS... :-)) > BSD/Linux afaik has the same problem. The filesystem is binary, not textual. > The textual aspect is only interpretation. Under FreeBSD and Solaris, when using ZFS, file and directory names are stored in the locale's character set. With ZFS you can also force UTF-8 and even set the Normalization algorithm that must be used for storing the text. http://docs.oracle.com/cd/E23824_01/html/E26033/glmio.html Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FileIO in FPC 3.0
On Fri, 25 Sep 2015 13:47:22 +0200 (CEST) mar...@stack.nl (Marco van de Voort) wrote: >[...] > BSD/Linux afaik has the same problem. The filesystem is binary, not textual. > The textual aspect is only interpretation. Yes. I see invalid UTF-8 file names on Linux systems often (cannot be converted to UTF-16). Are invalid UTF-16 file names under Windows really a practical problem? What program allows to create invalid UTF-16 file names? With "invalid UTF-16" I mean not-convertable-to-UTF-8. I don't mean invalid code points. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FileIO in FPC 3.0
In our previous episode, Andreas Dorn said: > Is it safe to pass the Filename to procedures from the RTL without risking > corruption? In theory no, but since mostly filenames will be passed to functions that have the same assumptions, I assume the only problem is if you put such a filename in a store that has problems with it. That being said, converting such strings to other codepages is not a good idea. The logical thing is to implement a simple validation function and call that in critical points and throw an error if the input is inconsistent. > For me this is more a general problem when dealing with external data. Always assume external data needs to be validated. > Should I tag raw external data as UTF-16/UTF-8 and be super-careful, > or should I tag it as some kind of "raw" string (which one?) and handle > any conversions manually. I think this is only needed in special cases (like embedded devices that sometimes spout garbage) > For me Filenames are more a type that has some kind of affinity to an > encoding for display, but I'd rather not tag its content as valid UTF-16 > - any magic internal conversion is potentially lossy. Any passing to a subsystem that barfs on wrong surrogates causes trouble too (e.g. msxml or so). The golden rule is to be liberal in what you accept (and correct/reject appropiately) and exact in what you generate, and always validate input. So if you are really worried about this, validate when strings read from the filesystem enter the your program (e.g. result of findfirst), before passing them on. > All in all I think if everything works for filenames, everything else will > follow... Well, at least you can recycle the validation routines you made. A quick look at the wikipedia utf16 article might give some clues. > (Now lets better not start about the encoding of Filenames on non-Windows > OS... :-)) BSD/Linux afaik has the same problem. The filesystem is binary, not textual. The textual aspect is only interpretation. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FileIO in FPC 3.0
Andreas Dorn wrote on Fri, 25 Sep 2015: If I understand that correctly, it stores the filename in a string that has been tagged as valid UTF-16. There are no tags for valid, invalid or unchecked UTF-16. A unicodestring is basically a sequence of widechars. Some operations, such as converting to a different string type, uppercasing/lowercasing, case-insensitive comparison etc may however fail in case it's not valid UTF-16. Do I then have to be careful about any automagic conversions? As long as you don't assign it to another string type besides unicodestring and widestring (this includes passing it as a parameter to a routine expecting a non-unicode/widestring parameter): no. Is it safe to pass the Filename to procedures from the RTL without risking corruption? It depends which RTL procedures. For me this is more a general problem when dealing with external data. Should I tag raw external data as UTF-16/UTF-8 and be super-careful, or should I tag it as some kind of "raw" string (which one?) and handle any conversions manually. There is no "raw string" tag. There are only strings and arrays of bytes/words. There are no RTL file APIs accepting arrays of byte/word parameters. (Now lets better not start about the encoding of Filenames on non-Windows OS... :-)) Everything about that for the supported platforms is explained at http://wiki.freepascal.org/FPC_Unicode_support#DefaultFileSystemCodePage Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FileIO in FPC 3.0
On Fri, 25 Sep 2015, Michael Van Canneyt wrote: > It uses UTF16 on windows, not a codepage aware string. > So if you use widestring for all your filename strings, there will be no > problem. No conversions will happen. If I understand that correctly, it stores the filename in a string that has been tagged as valid UTF-16. Do I then have to be careful about any automagic conversions? Of course anything that assumes that a conversion of an UTF-16 tagged string to an UTF-8 one is lossless has to be avoided. Is it safe to pass the Filename to procedures from the RTL without risking corruption? For me this is more a general problem when dealing with external data. Should I tag raw external data as UTF-16/UTF-8 and be super-careful, or should I tag it as some kind of "raw" string (which one?) and handle any conversions manually. For me Filenames are more a type that has some kind of affinity to an encoding for display, but I'd rather not tag its content as valid UTF-16 - any magic internal conversion is potentially lossy. All in all I think if everything works for filenames, everything else will follow... (Now lets better not start about the encoding of Filenames on non-Windows OS... :-)) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] *SPAM* Re: How to compile Lazarus program using only FPC?
Mattias Gaertner wrote: On Fri, 25 Sep 2015 11:16:55 +0200 Michael Schnell wrote: On 09/25/2015 11:09 AM, Sven Barth wrote: "Lazarus" is the name for two completely different things ... please don't introduce confusion where there is none. I suppose this confusion already is ubiquitous (and miner as the "_first_name_" of the LCL *is* "Lazarus (Component Library)" ). Of course to be absolutely correct I should have written: When installing "Lazarus" you usually install two completely different things at the same time: 1) the IDE 2) the LCL library. I also ask you kindly to stop spreading FUD. Lazarus is the IDE and the project containing a whole bunch of packages. Many of them use Lazarus in their names. LCL is the most prominent. In fairness, even though the Lazarus IDE and the LCL are installed together, you can (a) use the IDE for a non-LCL project, (b) build an LCL project using lazbuild, and (c) use the IDE for an LCL-based project. So functionally, there are distinctions. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] *SPAM* Re: How to compile Lazarus program using only FPC?
On 09/25/2015 11:32 AM, Mattias Gaertner wrote: I also ask you kindly to stop spreading FUD. Sorry for triggering this nonsense-discussion :( -Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
If absolutely necessary I will have to set up the RPi with a monitor, keyboard and mouse and install Lazarus and compile from there. But RPi is not as powerful a computer as the PC and it will probably be very slow if at all working You can VNC to the RPi. The Pi 2 is much faster and with more RAM then the old Pi. It should be ok for using Lazarus. Even it is slow, you only do the compilation once, after you completely finish coding the project on Linux PC. The speed is not an issue. There is also another option: You buy a much more powerful ARM computer to do your interactive development. I bought an Odroid U3 from http://www.hardkernel.com a few years ago to do my Linux-ARM Lazarus development. After the project is compiled into a binary executable, I just moved it to the RPi to run without any modification or change at all. Now they have even more powerful ARM embedded computers already and the speed should be close to a Windows PC. Dennis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] *SPAM* Re: How to compile Lazarus program using only FPC?
On Fri, 25 Sep 2015 11:16:55 +0200 Michael Schnell wrote: > On 09/25/2015 11:09 AM, Sven Barth wrote: > > > > > "Lazarus" is the name for two completely different things > > > > ... please don't introduce confusion where there is none. > > > I suppose this confusion already is ubiquitous (and miner as the > "_first_name_" of the LCL *is* "Lazarus (Component Library)" ). > > Of course to be absolutely correct I should have written: > > When installing "Lazarus" you usually install two completely different > things at the same time: > 1) the IDE >2) the LCL library. I also ask you kindly to stop spreading FUD. Lazarus is the IDE and the project containing a whole bunch of packages. Many of them use Lazarus in their names. LCL is the most prominent. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] *SPAM* Re: How to compile Lazarus program using only FPC?
On 09/25/2015 11:09 AM, Sven Barth wrote: > "Lazarus" is the name for two completely different things ... please don't introduce confusion where there is none. I suppose this confusion already is ubiquitous (and miner as the "_first_name_" of the LCL *is* "Lazarus (Component Library)" ). Of course to be absolutely correct I should have written: When installing "Lazarus" you usually install two completely different things at the same time: 1) the IDE 2) the LCL library. -Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
Am 25.09.2015 11:04 schrieb "Michael Schnell" : > > On 09/25/2015 03:52 AM, Bo Berglund wrote: >> >> If absolutely necessary I will have to set up the RPi with a monitor, keyboard and mouse and install Lazarus and compile from there. But RPi is not as powerful a computer as the PC and it will probably be very slow if at all working > > "Lazarus" is the name for two completely different things > > 1) the IDE > 2) the LCL library. "Lazarus" is not the name of the LCL. "Lazarus" might be part of the name "Lazarus Component Library", but it's not /the/ name. So please don't introduce confusion where there is none. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
On 09/25/2015 03:52 AM, Bo Berglund wrote: If absolutely necessary I will have to set up the RPi with a monitor, keyboard and mouse and install Lazarus and compile from there. But RPi is not as powerful a computer as the PC and it will probably be very slow if at all working "Lazarus" is the name for two completely different things 1) the IDE 2) the LCL library. If you just want to compile a project that needs the LCL, you don't need to start the IDE, but you can compile the project from the command line using just fpc. -Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] detect implementation / interface sections
David Emerson wrote on Thu, 24 Sep 2015: Is there a way to detect what section of a unit the compiler is in, rather than using these user-defined symbols? No. Ditto for initialization, finalization (although I use this much less frequently) No, there aren't any defines for that either. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
Bo Berglund wrote: On Thu, 24 Sep 2015 09:48:32 -0400, Bo Berglund wrote: I want to check my options regarding Lazarus and FPC. If I develop a program on Windows Lazarus, move it to Debian Lazarus (x86) and then finally want to compile on ARM on for example Raspberry Pi but outside of Lazarus, how is that done? Does FPC recognize the Lazarus project file such that paths etc are observed? Or is thare a separate file for FPC I have to prepare in order to set the unit paths? I see from some replies that I was not complete in my formulations... What I wanted to ask was what steps I need to take in order to do the final compilation on a *headless* ARM platform such as RaspBerry Pi2 where FPC has been installed but nothing else. The development itself would be done in Lazarus (on Windows and LinuxMint x86) in order to get the IDE help. The application itself is a completely GUI-less program (the original on Windows is a service application). It only needs the TCP/IP socket functionality apart from the built-in processing of the application. For this I am sure I also need threads. So for clarity: - Present code sits in Delphi on Windows - I will first port it over to Lazarus/FPC on Windows as a console program - Then the next move is to go to Linux on the same platform (x86) - Finally, when all is working I will need to compile on a headless platform that does not have Lazarus installed (RPi2). THe only access is SSH using PuTTY. Does the program use any Lazarus or LCL (Lazarus Class Libraries) facilities? if not then you can simply use FPC from the command line, if necessary getting library paths etc. using Lazarus's "Show Options" button. If absolutely necessary I will have to set up the RPi with a monitor, keyboard and mouse and install Lazarus and compile from there. But RPi is not as powerful a computer as the PC and it will probably be very slow if at all working Absolute rubbish. I've not tried logging into an RPi using VNC or (remote) X11 (i.e. XDMCP etc.) but it's entirely feasible to tunnel the IDE over SSH, or to do a command-line build (lazbuild) over SSH- I do this as routine. The only requirement is that the RPi must have enough RAM+swap set up if the program is of significant size... you'll know if you need it since you'll see messages about being unable to invoke the external assembler or linker. You /do/ appreciate that you can tunnel the X11 user interface across SSH, and that most distreaux enable this by default, don't you? -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] detect implementation / interface sections
David Emerson wrote: I tried sending this message two days ago, but it seems not to have gone through. Trying again. I like using include files, to break up big units into multiple files, and also as macro-based templates. One thing I do frequently is to put both the interface and the implementation into one include file, and include it twice-- once in the interface, and once in the implementation section of the unit. The include file thus looks like this: {$ifdef interface} {$endif} {$ifdef implementation} {$endif} So my question-- right now I have to manually define and undefine the symbols "interface" and "implementation" in each unit. Is there a way to detect what section of a unit the compiler is in, rather than using these user-defined symbols? So in my include file(s), instead of writing {$ifdef interface} I would write something that actually knows if an interface or implementation is being compiled. Ditto for initialization, finalization (although I use this much less frequently) I do something similar, but the problem is that every developer has his own idea of just how much detail is needed and in how many contexts a single file can be imported. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FileIO in FPC 3.0
On Friday 25 September 2015 10:26:44 Michael Van Canneyt wrote: > So if you use widestring for all your filename strings, there will be no For better performance probably UnicodeString not WideString. Martin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FileIO in FPC 3.0
Andreas Dorn wrote on Fri, 25 Sep 2015: In the discussion about resourcestrings I read that the RTL now uses codepage-aware strings for FileIO. So I wonder what kind of codepages do you use for FileIO? On Windows: UTF-16. The Windows-documentation calls Filenames "opaque sequence of WCHARs". https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx So e.g. converting a Filename from the Windows-API to UTF-8 can be lossy. Does the new FPC-FileApi work correctly if a Filename contains invalid UTF-16 sequences? If you use the RTL file APIs with unicodestrings on Windows, then no conversions should occur because a) we use the UTF-16 Windows APIs b) all file name helpers are available both with unicodestring and rawbytestring parameters, so the unicodestring ones should be used. If you use the RTL file APIs with an ansistring variant, then which code page is used is described at http://wiki.freepascal.org/FPC_Unicode_support#Code_page_settings Maybe we should add support for detecting invalid UTF-16 sequences in returned file names from Windows APIs, and if there are any ask for and return the "short/safe name" instead (file~1.txt and the like). For data that you pass in yourself, there is no problem (either you pass in UTF-16 and it will be passed on unmodified, or you use another code page and then it's your responsibility if it contains invalid data -- which pretty much only can happen with UTF-8, and possibly some single byte code pages that have undefined bytes, if there are any). Assigning a codepage to something that basically is just some raw sequence of bytes from an external source sounds dangerous to me. It is. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FileIO in FPC 3.0
On Fri, 25 Sep 2015, Andreas Dorn wrote: Hi there, In the discussion about resourcestrings I read that the RTL now uses codepage-aware strings for FileIO. So I wonder what kind of codepages do you use for FileIO? It uses UTF16 on windows, not a codepage aware string. So if you use widestring for all your filename strings, there will be no problem. No conversions will happen. If you so desire, you can start with a single-page, codepage aware string, but the RTL will convert it to UTF16 on windows anyway. if your codepage aware string contains "invalid" bytes, then the conversion may fail. Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] FileIO in FPC 3.0
Hi there, In the discussion about resourcestrings I read that the RTL now uses codepage-aware strings for FileIO. So I wonder what kind of codepages do you use for FileIO? The Windows-documentation calls Filenames "opaque sequence of WCHARs". https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx So e.g. converting a Filename from the Windows-API to UTF-8 can be lossy. Does the new FPC-FileApi work correctly if a Filename contains invalid UTF-16 sequences? Assigning a codepage to something that basically is just some raw sequence of bytes from an external source sounds dangerous to me. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
On 2015-09-25 02:52, Bo Berglund wrote: > If absolutely necessary I will have to set up the RPi with a monitor, > keyboard and mouse and install Lazarus and compile from there. No need. Simply follow my instructions from my first reply in this thread. Use the "show options" on your Linux system. Save those to a file, tweak some paths to match your RPi, make the file executable on the RPi and run. Threads support under Unix-like systems is enabled by including the cthreads unit as the first unit in your program. uses {$IFDEF UNIX} cthreads, {$ENDIF} Classes, SysUtils, ...snip... Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal