[fpc-devel] Unicodestring branch, please test and help fixing

Anton Kavalenka anton.k at tut.by
Tue Sep 9 11:28:53 CEST 2008


Florian Klaempfl wrote:
> I've continued to work on support of an unicodestring type in fpc. 
> It's currently in an svn branch at:
> http://svn.freepascal.org/svn/fpc/branches/unicodestring
> and will be merged later to trunk. The unicodestring type is a ref. 
> counted utf-16 string. On non-windows, widestring is mapped to this 
> type. If you're interested in unicode support please test, give 
> feedback here and submit fixes.
>
> An existing working copy of trunk can be switched to this branch by
> cd fpc
> svn switch http://svn.freepascal.org/svn/fpc/branches/unicodestring
> and back with
> svn switch http://svn.freepascal.org/svn/fpc/trunk
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
The Pascal huge strings always annoy me.
Since - it is IMPLICIT automatic object with set of overloaded methods, 
length and reference count fields etc hidden from developer.

In near future we geat a Zoo of the strings:
AnsiString, WideString, UnicodeString, ShortString, PWideChar, PChar
Some of them with encoding field.

Why not to make it EXPLICIT object

s:=TCoolFPCString.Create('Test');
s2:=TCoolFPCString.Create('????????'); //UTF8 encoded constant
s.asUtf8+=s2;

SetWindowTextW(WinHandle,s.AsUnicodeString); // i explicitly say - get 
me wide string and DO not any compiler magic

if (s1.length=length(s2))... // generic runtime function length returns 
the property of cool object

s1.AcquireLock // prevent other threads acccess
s1.Clear;
s1.LoadFromResource(n_ReasourceId); // just use GNU gettext
s1.LoadTranslationFromResource(n_resID,'be_BY');
s1.ReleaseLock // allow other thread access

Anyway I just can subclass standard string and get a new functionality 
with reachness of availabel fields and methods.


FPC supports operators - so there is lots of way to represent the 
string, assign the string, load it from resource.
Make it thread-safe at implementation level but not at compiler level.
Standard string, unicode string , ansistring, widestring can be 
implemented as wrappers along this object.
It seems like in mseGUI it is done.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20080909/3b5a7c44/attachment.html>


More information about the fpc-devel mailing list