Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2023-01

Unicode RTL for FPC

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hello,

I'm currently working for a company (Tixeo.com) that is preparing to use FPC to recompile their flagship product (written in Delphi) for certain targets.

As part of this work, we're striving to make the Free Pascal RTL and Packages more compatible with recent Delphis.

That means:

- String = UnicodeString, Char=WideChar
- Dotted units.

Before you all get a heart attack:

Because backwards compatibility is important, FPC will of course continue to distribute a backwards-compatible RTL and packages, with single-byte string. All FPC modes will continue to function.

To make this possible a feature called 'subtargets' has been implemented. This can be used for other things than the unicode RTL, but will be used for the unicode RTL.

The RTL is compiled 'normally' and with subtarget=unicodertl;
this will result in 2 separate sets of .o/.ppu files:

The normal CPU-OS directory and a CPU-OS-unicodertl directory.

The first part of the work has been pushed to gitlab in a branch called unicodertl (NOT the svn/unicodertl branch):

- subtarget support is there
- The rtl compiles with make SUB_TARGET=unicodertl with the compiler as it is in that branch.

Needless to say, this is a major change that will need thorough testing.

The earlier testing starts, the better.

For those that wish to help in testing:

- Update your git clone

- switch to branch unicodertl.

- in the toplevel FPC directory, do a

make all

- if that went well, next to your fpc.cfg, create a file fpc-unicodertl.cfg with the following contents:

----
-dUNICODERTL
-Municodestrings
----

- to create a Unicode RTL, in the rtl directory do a

make clean all SUB_TARGET=unicodertl PP=path/to/the/new/compiler

- if that worked, you can try then a

make install SUB_TARGET=unicodertl

Note that this is NOT ready for production use:

- The packages have not yet been converted (working on this now) and will certainly fail...
- a private testsuite has been run and gives no failures, but the complete compiler testsuite still needs to be examined.
- Dotted names will be created after the unicode transition is deemed complete.

if you do wish to test and spot errors in the RTL or compiler, please file a bugreport.

You can use a tag 'UnicodeRTL' to report bugs for this.

Michael.

Reply by email

Rolf Wetjen
to Michael Van Canneyt

Hi Michael,

I'm interested in this but I expect that I'm not the expert you are looking for. Some time ago ( Lazarus 1.8 or even earlier) I made a directory sync program for my own use for Windows which is aware of Unicode names in the file system.

I tried to follow your instruction but I failed as git is a pain for me:

?- Update your git clone
??? git pull https://gitlab.com/freepascal.org/lazarus/lazarus.git lazarus. "lazarus" is my target folder.

- switch to branch unicodertl
??? git branch --list gives only one branch: main

Can you please show in detail what to do?

Do you plan a full Unicode (up to four bytes per codepoint as far as I remember) or a DBCS (double byte character set) version? I don't know what Windows uses and what Delphi does.

Thank you,
Rolf

Reply by email

Michael Van Canneyt
to Rolf Wetjen
Rolf Wetjen wrote 6 lines
Hi Michael, I'm interested in this but I expect that I'm not the expert you are looking for. Some time ago ( Lazarus 1.8 or even earlier) I made a directory sync program for my own use for Windows which is aware of Unicode names in the file system.

Free Pascal is already aware of these names ? If you use UnicodeString, all file system routines will use the native Windows unicode APIs.

You don't need the unicode RTL for that, however you will need to convert the names to UTF8 for display in the lazarus GUI, as it uses UTF8.

Show quoted text 11 lines
I tried to follow your instruction but I failed as git is a pain for me: ?- Update your git clone ??? git pull https://gitlab.com/freepascal.org/lazarus/lazarus.git lazarus. "lazarus" is my target folder. - switch to branch unicodertl ??? git branch --list gives only one branch: main Can you please show in detail what to do?

Lazarus itself at this point has not been adapted. The instructions were meant for Free Pascal itself, not lazarus.

If you want nonetheless to try FPC:
- Create .fpc-unicodertl.cfg as per instructions in my first mail.

- update/clone fpc

git clone https://gitlab.com/freepascal.org/fpc/source.git fpc

- Switch to unicode branch:

git switch unicodertl

- Create FPC unicode-rtl-capable compiler

cd fpc
make all

- Optionally, install this compiler:

make install

- Use the compiler to create unicode rtl:

cd rtl

make clean all SUB_TARGET=unicodertl PP=/path/to/newly/compiled/compiler

Do you plan a full Unicode (up to four bytes per codepoint as far as I remember) or a DBCS (double byte character set) version? I don't know what Windows uses and what Delphi does.

I'm just leveraging the existing UnicodeString support of FPC, which mimics the Delphi/Windows support.

I'm not that much of a unicode expert, but as far as I understand it is UTF16, meaning that up to four bytes per codepoint can be used, which means that a full unicode codepoint can take up to 2 pascal characters: the pascal 'Char' can never specify all unicode codepoints.

Michael.

Reply by email

Rolf Wetjen
to Michael Van Canneyt

Hi Michael,

- update/clone fpc:
git clone https://gitlab.com/freepascal.org/fpc/source.git fpc ** ok

- Switch to unicode branch:
cd fpc **missing in the description
git switch unicodertl
** ok

- Create FPC unicode-rtl-capable compiler
cd fpc ** already in fpc
make all
** ok, beside of the fact that there's no make.exe (no bin) folder in the new fpc file tree. I used make.exe from lazarus fpc 3.2.2.

?- Create .fpc-unicodertl.cfg as per instructions in my first mail. ** There's no fpc.cfg in the new fpc file tree. In lazarus/fpc/3.2.2 it's in fpc\3.2.2\bin\x86_64-win64.

Rolf

Reply by email