Re: [fpc-devel] Unit for handling UTF-8 strings

2013-04-09 Thread Michael Schnell

On 04/08/2013 07:02 PM, Mattias Gaertner wrote:

I guess, you mean encoded string types.


AFAIK, you can just create string variables of the appropriate coding 
type and an assignment will do auto-conversion.


-Michael
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unit for handling UTF-8 strings

2013-04-09 Thread Mattias Gaertner
On Tue, 09 Apr 2013 08:24:11 +0200
Michael Schnell mschn...@lumino.de wrote:

 On 04/08/2013 07:02 PM, Mattias Gaertner wrote:
  I guess, you mean encoded string types.
 
 AFAIK, you can just create string variables of the appropriate coding 
 type and an assignment will do auto-conversion.

Yes.
But how do you examine the characters?
If I understand Michael right, there will be some implicit functions
for that. I wonder how they work.


Mattias
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unit for handling UTF-8 strings

2013-04-09 Thread Michael Van Canneyt



On Tue, 9 Apr 2013, Mattias Gaertner wrote:


On Tue, 09 Apr 2013 08:24:11 +0200
Michael Schnell mschn...@lumino.de wrote:


On 04/08/2013 07:02 PM, Mattias Gaertner wrote:

I guess, you mean encoded string types.


AFAIK, you can just create string variables of the appropriate coding
type and an assignment will do auto-conversion.


Yes.
But how do you examine the characters?
If I understand Michael right, there will be some implicit functions
for that. I wonder how they work.


See the character unit:

 // flat functions
  function ConvertFromUtf32(AChar : UCS4Char) : UnicodeString;
  function ConvertToUtf32(const AString : UnicodeString; AIndex : Integer) : 
UCS4Char; overload;
  function ConvertToUtf32(const AString : UnicodeString; AIndex : Integer; out 
ACharLength : Integer) : UCS4Char; overload;
  function ConvertToUtf32(const AHighSurrogate, ALowSurrogate : UnicodeChar) : 
UCS4Char; overload;
  function GetNumericValue(AChar : UnicodeChar) : Double; overload;
  function GetNumericValue(const AString : UnicodeString; AIndex : Integer) : 
Double; overload;
  function GetUnicodeCategory(AChar : UnicodeChar) : TUnicodeCategory; overload;
  function GetUnicodeCategory(const AString : UnicodeString; AIndex : Integer) 
: TUnicodeCategory; overload;
  function IsControl(AChar : UnicodeChar) : Boolean; overload;
  function IsControl(const AString : UnicodeString; AIndex : Integer) : 
Boolean; overload;
  function IsDigit(AChar : UnicodeChar) : Boolean; overload;
  function IsDigit(const AString : UnicodeString; AIndex : Integer) : Boolean; 
overload;
  function IsSurrogate(AChar : UnicodeChar) : Boolean; overload;
  function IsSurrogate(const AString : UnicodeString; AIndex : Integer) : 
Boolean; overload;
  function IsHighSurrogate(AChar : UnicodeChar) : Boolean; overload;
  function IsHighSurrogate(const AString : UnicodeString; AIndex : Integer) : 
Boolean; overload;
  function IsLowSurrogate(AChar : UnicodeChar) : Boolean; overload;
  function IsLowSurrogate(const AString : UnicodeString; AIndex : Integer) : 
Boolean; overload;
  function IsSurrogatePair(const AHighSurrogate, ALowSurrogate : UnicodeChar) : 
Boolean; overload;
  function IsSurrogatePair(const AString : UnicodeString; AIndex : Integer) : 
Boolean; overload;
  function IsLetter(AChar : UnicodeChar) : Boolean; overload;
  function IsLetter(const AString : UnicodeString; AIndex : Integer) : Boolean; 
overload;
  function IsLetterOrDigit(AChar : UnicodeChar) : Boolean; overload;
  function IsLetterOrDigit(const AString : UnicodeString; AIndex : Integer) : 
Boolean; overload;
  function IsLower(AChar : UnicodeChar) : Boolean; overload;
  function IsLower(const AString : UnicodeString; AIndex : Integer) : Boolean; 
overload;
  function IsNumber(AChar : UnicodeChar) : Boolean; overload;
  function IsNumber(const AString : UnicodeString; AIndex : Integer) : Boolean; 
overload;
  function IsPunctuation(AChar : UnicodeChar) : Boolean; overload;
  function IsPunctuation(const AString : UnicodeString; AIndex : Integer) : 
Boolean; overload;
  function IsSeparator(AChar : UnicodeChar) : Boolean; overload;
  function IsSeparator(const AString : UnicodeString; AIndex : Integer) : 
Boolean; overload;
  function IsSymbol(AChar : UnicodeChar) : Boolean; overload;
  function IsSymbol(const AString : UnicodeString; AIndex : Integer) : Boolean; 
overload;
  function IsUpper(AChar : UnicodeChar) : Boolean; overload;
  function IsUpper(const AString : UnicodeString; AIndex : Integer) : Boolean; 
overload;
  function IsWhiteSpace(AChar : UnicodeChar) : Boolean; overload;
  function IsWhiteSpace(const AString : UnicodeString; AIndex : Integer) : 
Boolean; overload;
  function ToLower(AChar : UnicodeChar) : UnicodeChar; overload;
  function ToLower(const AString : UnicodeString) : UnicodeString; overload;
  function ToUpper(AChar : UnicodeChar) : UnicodeChar; overload;
  function ToUpper(const AString : UnicodeString) : UnicodeString; overload;
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] cairo.ppu

2013-04-09 Thread Mattias Gaertner
Hi,

According to this bug report cairo.ppu is not installed on win64 fpc
2.6.3:

http://bugs.freepascal.org/view.php?id=24215#c66862

I don't have Windows to test. Was there some revision that didn't
install cairo.ppu?

Mattias
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unit for handling UTF-8 strings

2013-04-09 Thread Mattias Gaertner
On Tue, 9 Apr 2013 08:55:15 +0200 (CEST)
Michael Van Canneyt mich...@freepascal.org wrote:

 
 
 On Tue, 9 Apr 2013, Mattias Gaertner wrote:
 
  On Tue, 09 Apr 2013 08:24:11 +0200
  Michael Schnell mschn...@lumino.de wrote:
 
  On 04/08/2013 07:02 PM, Mattias Gaertner wrote:
  I guess, you mean encoded string types.
 
  AFAIK, you can just create string variables of the appropriate coding
  type and an assignment will do auto-conversion.
 
  Yes.
  But how do you examine the characters?
  If I understand Michael right, there will be some implicit functions
  for that. I wonder how they work.
 
 See the character unit:

Nice!

Why do you call them implicit calls?

Will there be UTF-8 functions too or do you have to convert
to UnicodeString?

Will there be PUnicodeChar functions too?
 
   // flat functions
function ConvertFromUtf32(AChar : UCS4Char) : UnicodeString;
function ConvertToUtf32(const AString : UnicodeString; AIndex : Integer) : 
 UCS4Char; overload;
function ConvertToUtf32(const AString : UnicodeString; AIndex : Integer; 
 out ACharLength : Integer) : UCS4Char; overload;
function ConvertToUtf32(const AHighSurrogate, ALowSurrogate : UnicodeChar) 
 : UCS4Char; overload;
[...]

Mattias
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unit for handling UTF-8 strings

2013-04-09 Thread Paul Ishenin

09.04.2013 15:13, Mattias Gaertner wrote:


Will there be UTF-8 functions too or do you have to convert
to UnicodeString?


At the moment TCharacter contains methods which delphi TCharacter has. 
If there is demand we will add UTF8 overloads.



Will there be PUnicodeChar functions too?


   // flat functions
function ConvertFromUtf32(AChar : UCS4Char) : UnicodeString;
function ConvertToUtf32(const AString : UnicodeString; AIndex : Integer) : 
UCS4Char; overload;
function ConvertToUtf32(const AString : UnicodeString; AIndex : Integer; 
out ACharLength : Integer) : UCS4Char; overload;
function ConvertToUtf32(const AHighSurrogate, ALowSurrogate : UnicodeChar) 
: UCS4Char; overload;


Best regards,
Paul Ishenin


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] cairo.ppu

2013-04-09 Thread Florian Klämpfl
Am 09.04.2013 08:57, schrieb Mattias Gaertner:
 Hi,
 
 According to this bug report cairo.ppu is not installed on win64 fpc
 2.6.3:
 
 http://bugs.freepascal.org/view.php?id=24215#c66862
 
 I don't have Windows to test. Was there some revision that didn't
 install cairo.ppu?

As far as I can see cairo for win64 was never packed with an fpc
release. Even if it was, it is unlikely that it worked before r24211.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unit for handling UTF-8 strings

2013-04-09 Thread Michael Schnell

On 04/09/2013 08:49 AM, Mattias Gaertner wrote:
But how do you examine the characters? 


Even defining what a character is, is extremely problematic with any use 
of Unicode. Regarding that a printable character can be assembled by 
multiple of the (nearly 2^32) Unicode codes, and a single Unicode 
codes is represented by 1, 2, 3, or 4 Bytes when using UTF-8 or UTF-16 
encoding, and now the order of those bytes depends on the CPU-arch 
and/or the file the string is imported from and the way it is imported.
This of course is not a problem introduced by fpc, but the perfectly 
normal complexity of Unicode.


If I understand Michael right, there will be some implicit functions 
for that. I wonder how they work. 


This is what Delphi compatibility dictated. (You might read the Delphi 
XE Docs on how to code Unicode enabled Delphi source.)


I do hope, fpc avoids some of the quirks Delphi introduces and offers 
some useful additional features (e.g. dedicated string types such as 
unencoded (raw, never auto-converted) Byte, Word and DWord Strings, and 
a flexible encoded String type, that inherit the encoding scheme from 
the source string when doing an assignment or using them as a function 
parameter, doing auto-conversion whenever dynamically necessary.


-Michael
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unit for handling UTF-8 strings

2013-04-09 Thread Mattias Gaertner

 Paul Ishenin i...@kmiac.ru hat am 9. April 2013 um 09:20 geschrieben:


 09.04.2013 15:13, Mattias Gaertner wrote:

  Will there be UTF-8 functions too or do you have to convert
  to UnicodeString?

 At the moment TCharacter contains methods which delphi TCharacter has.
 If there is demand we will add UTF8 overloads.

Demand+=1


  Will there be PUnicodeChar functions too?

Well?

Mattias
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] cairo.ppu

2013-04-09 Thread Mattias Gaertner

 Florian Klämpfl flor...@freepascal.org hat am 9. April 2013 um 09:35
 geschrieben:
[...]
 As far as I can see cairo for win64 was never packed with an fpc
 release. Even if it was, it is unlikely that it worked before r24211.

Thanks. Then we will change Lazarus to not use it there.

Mattias
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unit for handling UTF-8 strings

2013-04-09 Thread Sven Barth

Am 09.04.2013 10:30, schrieb Mattias Gaertner:

Paul Ishenin i...@kmiac.ru hat am 9. April 2013 um 09:20 geschrieben:


09.04.2013 15:13, Mattias Gaertner wrote:


Will there be UTF-8 functions too or do you have to convert
to UnicodeString?

At the moment TCharacter contains methods which delphi TCharacter has.
If there is demand we will add UTF8 overloads.

Demand+=1

(1,8) Error: Illegal expression
(1,9) Error: Illegal expression
(1,9) Fatal: Syntax error, ; expected but ordinal const found

(Sorry, had to be said :P )

Regards,
Sven
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unit for handling UTF-8 strings

2013-04-09 Thread Paul Ishenin

09.04.2013 17:10, Sven Barth пишет:


Demand+=1

(1,8) Error: Illegal expression
(1,9) Error: Illegal expression
(1,9) Fatal: Syntax error, ; expected but ordinal const found

(Sorry, had to be said :P )


Also, Patches variable seems to be equal to zero. And assigning Demand 
without assigning Patches has almost no effect :)


Best regards,
Paul Ishenin

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unit for handling UTF-8 strings

2013-04-09 Thread Mattias Gaertner

 Paul Ishenin i...@kmiac.ru hat am 9. April 2013 um 11:23 geschrieben:


 09.04.2013 17:10, Sven Barth пишет:

  Demand+=1
  (1,8) Error: Illegal expression
  (1,9) Error: Illegal expression
  (1,9) Fatal: Syntax error, ; expected but ordinal const found
 
  (Sorry, had to be said :P )

 Also, Patches variable seems to be equal to zero. And assigning Demand
 without assigning Patches has almost no effect :)

Creating a patch is not hard. The lazutf8 already contains the code. But I have
no idea how the the interface should look like. TCharacter is a Delphi class and
Delphi does not have UTF-8 functions. Michael wrote that these functions are
implicit, so maybe these functions need to fit some form?
In other words:
Are there any suggestions, recommendations how the UTF-8 functions should look
like?

Mattias
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Lazarus issues on ARM Linux

2013-04-09 Thread Thaddy

On 8-4-2013 14:49, peter green wrote:

Michel Catudal wrote:
I am also having some issues with Lazarus, I am not sure if it is the 
right forum to talk about it. I had a previous version working fine 
on Rasphberry Pi.
For some reason I can't get it to work on Mele A2000G. I have 
compiled it on gentoo on the Mele, using distcc and locally, same 
results. I didn't get any error during compile so I was expecting it 
to work. fpc seems to work, I haven't written any code with it yet, I 
was expecting to use lazarus to do that.


My system on Mele A2000G is gentoo with mate desktop. I have 
everything compiled with hard float as I did on the Raphsberry Pi. 
Upstream 2.6.x does not support the hard float ABI so unless you have 
a patched version (such as the one shipped in debian) it won't 
correctly link against C libraries on a system that uses hard float 
ABIS. Also even when the hard float ABI support is present in the 
compiler source code you need to either bootstrap with a starting 
compiler that uses the hard float ABI or explictly specify -d 
FPC_ARMHF during the build.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
At the moment the current lazarus doesn't compile here for trunk, not 
even on raspberry. A couple of days ago it did.
But this is today. I will put in a bug report if I checked my build 
stup, can reproduce it and if so  isn't fixed within two days or so. 
Most of the time it will.
You probably definitely must use trunk to get proper results for arm. 
Lot's of changes/improvements.



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unit for handling UTF-8 strings

2013-04-09 Thread Paul Ishenin

09.04.2013 18:09, Mattias Gaertner пишет:


Creating a patch is not hard. The lazutf8 already contains the code. But I have
no idea how the the interface should look like. TCharacter is a Delphi class and
Delphi does not have UTF-8 functions. Michael wrote that these functions are
implicit, so maybe these functions need to fit some form?
In other words:
Are there any suggestions, recommendations how the UTF-8 functions should look
like?


Let's see.

The next function should stay as is. Compiler will add required implicit 
conversion when you assign result to UTF8String variable.


function ConvertFromUtf32(AChar : UCS4Char) : UnicodeString;


Here you can add UTF8String overloads if needed:

function ConvertToUtf32(const AString : UnicodeString; AIndex : Integer) 
: UCS4Char; overload;
function ConvertToUtf32(const AString : UnicodeString; AIndex : Integer; 
out ACharLength : Integer) : UCS4Char; overload;


At the same time even without UTF8 overloads compiler will insert 
implicit conversion from UTF8String to UnicodeString when you pass it to 
that functions. So UTF8 overloads can only increase spead by removing 1 
implicit conversion.


Best regards,
Paul Ishenin

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel