mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-04 21:27:21 +01:00
determine the length of a multi-byte character. The return values
are defined to be the same as those of POSIX' mblen: -1 =
invalid/incomplete sequence, 0 = #0, > 0 = length of sequence in
bytes.
+ default implementation for widestringmanager.codepointlengthproc
(assumes all code points have length 1) and Unix implementation
(based on mb(r)len); Windows implementation is still required
* replaced default implementation of
widestringmanager.CharLengthPCharProc with strlen() of the input
instead of an error (correct if all code points have length 1,
still needs Windows implementation)
+ implemented fpc_text_read_{wide,unicode}str() and
fpc_text_read_widechar() (mantis #18163); fpc_text_read_widechar()
uses the new widestringmanager.codepointlengthproc()
+ unicodestring support for readstr/writestr
* fixed declaration of fpc_Write_Text_UnicodeStr (unicodestring
instead of widestring parameter)
* extended test/twide*.pp tests to test the new/fixed functionality
git-svn-id: trunk@16533 -
30 lines
342 B
ObjectPascal
30 lines
342 B
ObjectPascal
{$ifdef unix}
|
|
uses
|
|
cwstring;
|
|
{$endif unix}
|
|
|
|
var
|
|
w : widestring;
|
|
u : unicodestring;
|
|
a : ansistring;
|
|
|
|
begin
|
|
a:='A';
|
|
w:=a;
|
|
if w[1]<>#65 then
|
|
halt(1);
|
|
a:=w;
|
|
if a[1]<>'A' then
|
|
halt(2);
|
|
writeln('ok');
|
|
|
|
a:='A';
|
|
u:=a;
|
|
if u[1]<>#65 then
|
|
halt(3);
|
|
a:=u;
|
|
if a[1]<>'A' then
|
|
halt(4);
|
|
writeln('ok');
|
|
end.
|