|
|
Line 1: |
Line 1: |
− | = Irrelevant stuff - looks like a wish list =
| |
− | Removed this from the main page as it will only give cause for confusion.
| |
− | Developers agree it is useless: http://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg30196.html
| |
| | | |
− | IMO this can be deleted from this page as well.
| |
− |
| |
− | Thanks,
| |
− | --[[User:BigChimp|BigChimp]] 16:08, 7 January 2014 (CET)
| |
− |
| |
− | == FPC Unicode support ==
| |
− |
| |
− | FPC must have the following string types with transparent conversion between them (like current AnsiString <-> WideString conversion):
| |
− |
| |
− | * shortstring
| |
− | * ansistring
| |
− | * widestring
| |
− | * utf8string
| |
− | * utf16string
| |
− | * utf32string
| |
− | * ucs2string (?)
| |
− | * ucs4string (?)
| |
− |
| |
− | '''Development and further maintenance of these string types must be as simple as possible.''' New string types must be easily added in future if needed.
| |
− |
| |
− | Compiler uses generic structure and helper routines to handle all refcounted string types.
| |
− |
| |
− | String header:
| |
− |
| |
− | <syntaxhighlight>
| |
− | type
| |
− | TRefStringRec = packed record
| |
− | Encoding: word; // encoding of string
| |
− | ElementSize: byte; // size in bytes of string's element (1-4)
| |
− | Ref: SizeInt; // number of references
| |
− | Len: SizeInt; // number of elements is string
| |
− | end;
| |
− | </syntaxhighlight>
| |
− |
| |
− | Helper routines will know how to handle string from its header.
| |
− |
| |
− | Extra parameter with string type information is passed to some routines (like fpc_RefString_SetLength) to allow properly initialize new strings.
| |
− |
| |
− | widestring type on Windows targets remains non-refcounted and OLE compatible. Minimal number of helper routines is used for it. On non-Windows targets widestring is alias to utf16string.
| |
− |
| |
− | The compiler uses helpers for string type conversions like this:
| |
− | <syntaxhighlight>
| |
− | procedure fpc_ansistring_to_utf16string(out dst: utf16string; const src: ansistring);
| |
− | procedure fpc_utf32string_to_utf16string(out dst: utf16string; const src: utf32string);
| |
− | </syntaxhighlight>
| |
− |
| |
− | The compiler generates helper procedure name from type names. The compiler does not perform any string conversion handling by itself.
| |