Re: [fpc-pascal] cross platform version of IsCharAlpha()

2009-01-24 Thread Graeme Geldenhuys
On Fri, Jan 23, 2009 at 7:26 PM, vmars vm...@rgv.rr.com wrote:
 'JcfStringUtils.pas' very strange looking code.
 Please, what format is the file in?

Uh?  I am using Lazarus 0.9.26 under Linux. The file was opened like
any other source file...


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] cross platform version of IsCharAlpha()

2009-01-23 Thread Graeme Geldenhuys
On Mon, Jan 12, 2009 at 3:39 PM, Paul Ishenin webpi...@mail.ru wrote:

 Here in
 http://svn.freepascal.org/svn/lazarus/trunk/components/jcf2/Utils/JcfStringUtils.pas
 I used the same code :)

Thanks Paul, I feel better already!  I'm not alone.  :-)


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] cross platform version of IsCharAlpha()

2009-01-23 Thread vmars

'JcfStringUtils.pas' very strange looking code.
Please, what format is the file in?
Thanks!

ô¿ô
V  e  r  n

WinXp sp2 ,  Delphi5, WebDwarf, Trellian WebPage, 
Lazarus-0.9.26-fpc-2.2.2-win32.exe,

wxPython2.8-win32-unicode-2.8.9.1-py26.exe , Boa 0.6.1
http://www.flickr.com/photos/vmars956/

Wanted: Dwarf Hibiscus (Orange/Rasberry)
- Original Message - 
From: Graeme Geldenhuys graemeg.li...@gmail.com

To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Sent: Friday, January 23, 2009 2:02 AM
Subject: Re: [fpc-pascal] cross platform version of IsCharAlpha()



On Mon, Jan 12, 2009 at 3:39 PM, Paul Ishenin webpi...@mail.ru wrote:


Here in
http://svn.freepascal.org/svn/lazarus/trunk/components/jcf2/Utils/JcfStringUtils.pas
I used the same code :)


Thanks Paul, I feel better already!  I'm not alone.  :-)


Regards,
 - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



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


Re: [fpc-pascal] cross platform version of IsCharAlpha()

2009-01-22 Thread Paul Ishenin

Graeme Geldenhuys wrote:

function IsCharAlpha(AChar: Char): Boolean;
begin
  // This is very primitive and doesn't take special chars or unicode into
  // consideration.
  if AChar in ['a'..'z', 'A'..'Z'] then
Result := True
  else
Result := False;
end;


Anybody got a better Object Pascal version of IsCharAlpha() I can use
and that we can add into Free Pascal?
  
Here in 
http://svn.freepascal.org/svn/lazarus/trunk/components/jcf2/Utils/JcfStringUtils.pas 
I used the same code :)


Best regards,
Paul Ishenin.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] cross platform version of IsCharAlpha()

2009-01-12 Thread ik
The problem with such function is that it requires a lot of data to be
used on a non ANSI table. and you can not use in a unicode
implementation the Char type, because a char can be more then one
byte.

Ido

On Mon, Jan 12, 2009 at 11:09 AM, Graeme Geldenhuys
graemeg.li...@gmail.com wrote:
 Hi,

 IsCharAlpha() is a Win32 API call.  I'm trying to convert code that
 uses that call, to be Windows and Linux compatible. Does FPC have a
 cross-platform version of that API call?  I did a text search through
 the RTL of v2.2.3 and it only seems to have the Windows API version.

 I can add a Linux specific function like this in my code, but as the
 comment says, it is very primitive and clearly not ideal!

 function IsCharAlpha(AChar: Char): Boolean;
 begin
  // This is very primitive and doesn't take special chars or unicode into
  // consideration.
  if AChar in ['a'..'z', 'A'..'Z'] then
Result := True
  else
Result := False;
 end;


 Anybody got a better Object Pascal version of IsCharAlpha() I can use
 and that we can add into Free Pascal?


 Regards,
  - Graeme -


 ___
 fpGUI - a cross-platform Free Pascal GUI toolkit
 http://opensoft.homeip.net/fpgui/
 ___
 fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal

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


Re: [fpc-pascal] cross platform version of IsCharAlpha()

2009-01-12 Thread Graeme Geldenhuys
On Mon, Jan 12, 2009 at 11:13 AM, ik ido...@gmail.com wrote:
 The problem with such function is that it requires a lot of data to be
 used on a non ANSI table. and you can not use in a unicode
 implementation the Char type, because a char can be more then one
 byte.

I know that all to well.  :-)   I made a ugly hack just so I can get
that ported code working (compilable) under Linux. The Delphi code I
am porting is pre-Unicode, so I don't care about Unicode at this
moment, but many non-ANSI chars will still fall through the cracks
with my implementation.  :-(


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] cross platform version of IsCharAlpha()

2009-01-12 Thread ik
Because it depends on the code page of the system you are using at the
moment you parse the char.



On Mon, Jan 12, 2009 at 11:19 AM, Graeme Geldenhuys
graemeg.li...@gmail.com wrote:
 On Mon, Jan 12, 2009 at 11:13 AM, ik ido...@gmail.com wrote:
 The problem with such function is that it requires a lot of data to be
 used on a non ANSI table. and you can not use in a unicode
 implementation the Char type, because a char can be more then one
 byte.

 I know that all to well.  :-)   I made a ugly hack just so I can get
 that ported code working (compilable) under Linux. The Delphi code I
 am porting is pre-Unicode, so I don't care about Unicode at this
 moment, but many non-ANSI chars will still fall through the cracks
 with my implementation.  :-(


 Regards,
  - Graeme -


 ___
 fpGUI - a cross-platform Free Pascal GUI toolkit
 http://opensoft.homeip.net/fpgui/
 ___
 fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal

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


Re: [fpc-pascal] cross platform version of IsCharAlpha()

2009-01-12 Thread Florian Klaempfl
Graeme Geldenhuys schrieb:
 Hi,
 
 IsCharAlpha() is a Win32 API call.  I'm trying to convert code that
 uses that call, to be Windows and Linux compatible. Does FPC have a
 cross-platform version of that API call?  I did a text search through
 the RTL of v2.2.3 and it only seems to have the Windows API version.
 
 I can add a Linux specific function like this in my code, but as the
 comment says, it is very primitive and clearly not ideal!
 
 function IsCharAlpha(AChar: Char): Boolean;
 begin
   // This is very primitive and doesn't take special chars or unicode into
   // consideration.
   if AChar in ['a'..'z', 'A'..'Z'] then
 Result := True
   else
 Result := False;
 end;
 
 
 Anybody got a better Object Pascal version of IsCharAlpha() I can use
 and that we can add into Free Pascal?

Add a new entry to the widestring manager, add a implementation to
sysutils using the widestring manager. Implement it in the cwstrings for
unix and sysutils directly for windows, for unix you can use iswalpha:

http://opengroup.org/onlinepubs/007908775/xsh/iswalpha.html

Create a test and submit a patch :)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal