[fpc-pascal] UnicodeString and surrogate pairs

2016-04-27 Thread Graeme Geldenhuys
Hi,

Does FPC's RTL (or FCL) include a function to check for UTF-16 surrogate
pairs? I'd be very surprised if there isn't, but I have yet to find it
in the documentation or source code I searched.

I need to process one "character" (loosely based on what you see on the
screen) at a time while calculating text width up to a maximum width. I
need to make sure I handle all Unicode text correctly, thus NOT just the
BMP of the Unicode standard, but all supplementary planes too. My
alternative is to convert the text from UTF-16 to UTF-8 and then process
it, but in this instance I'm hoping to stay with UTF-16 [never thought I
would ever say that out loudly! ;-)]

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Iterator for Unicode encoded strings

2016-04-27 Thread Graeme Geldenhuys
Hi,

This question really applies for all Unicode encodings (UTF-8, UTF-16
and UTF-32). In the modern world you simply can't use indexed access
into Object Pascal strings to retrieve a "character" (loosely what you
see on the screen - ignoring combining diacritics). In my own projects I
have custom written Iterators for various data types like StringList,
ObjectLists etc, and that includes strings.

I know FPC RTL supports the Iterator concept (not as advanced as what I
have implemented), but still useful. As far as I know there are some
standard iterator classes already implemented. Does FPC include such
iterators for the various string types?

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Iterator for Unicode encoded strings

2016-04-27 Thread Michael Van Canneyt



On Wed, 27 Apr 2016, Graeme Geldenhuys wrote:


Hi,

This question really applies for all Unicode encodings (UTF-8, UTF-16
and UTF-32). In the modern world you simply can't use indexed access
into Object Pascal strings to retrieve a "character" (loosely what you
see on the screen - ignoring combining diacritics). In my own projects I
have custom written Iterators for various data types like StringList,
ObjectLists etc, and that includes strings.

I know FPC RTL supports the Iterator concept (not as advanced as what I
have implemented), but still useful. As far as I know there are some
standard iterator classes already implemented. Does FPC include such
iterators for the various string types?


Simply said: No. The character iterator

var
 C : Char;
 S : String; // or unicode string

begin
  for c in S do

end.

Will iterate bytes or words, not characters.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Iterator for Unicode encoded strings

2016-04-27 Thread Graeme Geldenhuys
On 2016-04-27 15:59, Michael Van Canneyt wrote:
> Simply said: No. The character iterator
> 
> Will iterate bytes or words, not characters.

OK thanks. So I definitely need the IsSurrogatePair() like function then
- in the case of UTF-16 encoded (UnicodeString) text. Do you know if
such a function exists in the RTL?  If not, I'll browse unicode.org to
see what is required for such an implementation.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] UnicodeString and surrogate pairs

2016-04-27 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> Does FPC's RTL (or FCL) include a function to check for UTF-16 surrogate
> pairs? I'd be very surprised if there isn't, but I have yet to find it
> in the documentation or source code I searched.

Same as Delphi, character.tcharacter.issurrogate() or
character.issurrogate()

(modern delphi units group everything as class methods in classes for some vague
reason)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] UnicodeString and surrogate pairs

2016-04-27 Thread Graeme Geldenhuys
On 2016-04-27 16:24, Marco van de Voort wrote:
> Same as Delphi, character.tcharacter.issurrogate() or
> character.issurrogate()

Ah, thank you very much.


Regards,
  Graeme

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] FPC create unit path

2016-04-27 Thread Darius Blaszyk
Hi,

When I try to compile a test app, I get an error saying the output
folder (defined by FU) cannot be created by FPC. I suppose this
behaviour is ok? Is there a way to have FPC to create the requested
folder? 

fpc -FU.\test mytest.pp
Error: Can't create object file: .\test\mytest.o (error code: 3)
Fatal: Can't create object .\test\mytest.o

Regards, Darius 
  ___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC create unit path

2016-04-27 Thread Graeme Geldenhuys
On 2016-04-27 20:39, Darius Blaszyk wrote:
> Is there a way to have FPC to create the requested
> folder? 

I asked the same thing years back, and I was told that no, it's not the
job of the compiler, but rather the job of the build script or your IDE.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC create unit path

2016-04-27 Thread Sven Barth
On 27.04.2016 21:57, Graeme Geldenhuys wrote:
> On 2016-04-27 20:39, Darius Blaszyk wrote:
>> Is there a way to have FPC to create the requested
>> folder? 
> 
> I asked the same thing years back, and I was told that no, it's not the
> job of the compiler, but rather the job of the build script or your IDE.

Indeed. That's by design

Regards,
Sven

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FastCGI on Windows IIS

2016-04-27 Thread Marcos Douglas
Michael,

Here is the patch to fix that on Windows:
http://bugs.freepascal.org/view.php?id=30073

Regards,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal