[fpc-pascal] Some StrToTime questions

2010-01-19 Thread Bart
Since the current implementation of StrToTime is somewhat flawed (see: http://bugs.freepascal.org/view.php?id=15505), I tried to improve it. This, however left me with some questions about how to treat blanks in the inputstring. The current implementation treats blanks (#32) as if they were

[fpc-pascal] Delphi mode syntax error

2010-01-19 Thread Roland Turcan
Hello all, I use Delphi style of programing in Lazarus to keep a compatibility with Kylix and therefore I want to get this code which is valid of Freepascal's ObjectPascal, but in {$MODE Delphi} it doesn't accept calling of MyItems[index] and writes Array type required. How to adapt this code to

Re: [fpc-pascal] Delphi mode syntax error

2010-01-19 Thread Jonas Maebe
On 19 Jan 2010, at 11:14, Roland Turcan wrote: I use Delphi style of programing in Lazarus to keep a compatibility with Kylix and therefore I want to get this code which is valid of Freepascal's ObjectPascal, but in {$MODE Delphi} it doesn't accept calling of MyItems[index] and writes Array

Re: [fpc-pascal] Delphi mode syntax error

2010-01-19 Thread Jonas Maebe
On 19 Jan 2010, at 11:27, Jonas Maebe wrote: On 19 Jan 2010, at 11:14, Roland Turcan wrote: ShowMessage (IntToStr (MyItems[0])); I think this should work: ShowMessage (IntToStr (MyItems[0]())); Please also file a bug report with a compilable example (which does not depend on Lazarus)

Re: [fpc-pascal] Delphi mode syntax error

2010-01-19 Thread Roland Turcan
19.01.2010 11:39 - Jonas Maebe jonas.ma...@elis.ugent.be JM On 19 Jan 2010, at 11:27, Jonas Maebe wrote: On 19 Jan 2010, at 11:14, Roland Turcan wrote: ShowMessage (IntToStr (MyItems[0])); I think this should work: ShowMessage (IntToStr (MyItems[0]())); Please also file a bug report

Re: [fpc-pascal] Delphi mode syntax error

2010-01-19 Thread Michael Van Canneyt
On Tue, 19 Jan 2010, Roland Turcan wrote: 19.01.2010 11:39 - Jonas Maebe jonas.ma...@elis.ugent.be JM On 19 Jan 2010, at 11:27, Jonas Maebe wrote: On 19 Jan 2010, at 11:14, Roland Turcan wrote: ShowMessage (IntToStr (MyItems[0])); I think this should work: ShowMessage (IntToStr

Re: [fpc-pascal] Delphi mode syntax error

2010-01-19 Thread Jonas Maebe
On 19 Jan 2010, at 12:57, Michael Van Canneyt wrote: It should not compile in Delphi mode. Array syntax is not supported by Delphi. Oops, only now I see he was trying to index a pointer like an array. And even in FPC I would very strongly recommend against typecasting a dynamic array to

[fpc-pascal] Compiler 240

2010-01-19 Thread Carsten Bager
I have a problem with the new 240 compiler. I get errors when calling functions in the sysutils unit. I have tested the 251 compiler, and it was exactly the same. I am normally using the 224 compiler, and it works fine. Anybody have a hint. Carsten Example: program hw1; uses sysutils;

[fpc-pascal] static linking vs dynamic linking

2010-01-19 Thread Graeme Geldenhuys
Hi, In fpGUI based applications I have always used static link to libraries like Xlib or Xft, using the units xlib.pas and xft.pas I want to add spellchecker support (from a C library) to one of my applications. So what is better, to continue using static linking, or rather use dynamic linking

Re: [fpc-pascal] static linking vs dynamic linking

2010-01-19 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: In fpGUI based applications I have always used static link to libraries like Xlib or Xft, using the units xlib.pas and xft.pas I want to add spellchecker support (from a C library) to one of my applications. So what is better, to continue

[fpc-pascal] Hardware information: Linux and Windows

2010-01-19 Thread Osvaldo Filho
How do I get information about the hardware in Linux and Windows? - Identification of the processor: model, manufacturer, serial number - Identification of Hard Disk: model, manufacturer, physical serial number - Identification of Memory: model, manufacturer, size, type - Identification of

Re: [fpc-pascal] Delphi mode syntax error

2010-01-19 Thread Roland Turcan
19.01.2010 13:10 - Jonas Maebe jonas.ma...@elis.ugent.be JM On 19 Jan 2010, at 12:57, Michael Van Canneyt wrote: It should not compile in Delphi mode. Array syntax is not supported by Delphi. JM Oops, only now I see he was trying to index a pointer like an array. JM And even in FPC I

Re: [fpc-pascal] Delphi mode syntax error

2010-01-19 Thread Jonas Maebe
On 19 Jan 2010, at 14:39, Roland Turcan wrote: 19.01.2010 13:10 - Jonas Maebe jonas.ma...@elis.ugent.be JM Oops, only now I see he was trying to index a pointer like an array. JM And even in FPC I would very strongly recommend against typecasting a JM dynamic array to a pointer and then

Re: [fpc-pascal] Delphi mode syntax error

2010-01-19 Thread Marco van de Voort
In our previous episode, Jonas Maebe said: I also don't see any advantage to using a pointer instead of a dynamic array directly. It will not be faster in any way, since there are no uniqueness checks for dynamic arrays. In fact, it will probably be slower, since you now have two

Re: [fpc-pascal] Hardware information: Linux and Windows

2010-01-19 Thread Frank Peelo
On 19/01/2010 13:09, Osvaldo Filho wrote: How do I get information about the hardware in Linux and Windows? - Identification of the processor: model, manufacturer, serial number Reading /proc/cpuinfo will give you the model and manufacturer. Don't know how to get the serial number. Was that

[fpc-pascal] Pointer to an array of PChar strings

2010-01-19 Thread Graeme Geldenhuys
Hi, I'm working with a C library that returns an array of strings. So that is type PPChar. I C library does the array allocation, but doesn't do the freeing of the array. How am I supposed to free an array of PChar strings? I think I need to improve my iteration too, because I'm moving the

Re: [fpc-pascal] Delphi mode syntax error

2010-01-19 Thread Jonas Maebe
On 19 Jan 2010, at 15:14, Marco van de Voort wrote: Hmm, under delphi at least, it is cheaper to do var pstart,pend : PSomeType; if length(sometypedynarray)0 then begin pstart:=...@sometypedynarray[0]; peind :=...@sometypedynarray[length(sometypedynarray)-1]; while (pstart=peind)

Re: [fpc-pascal] Pointer to an array of PChar strings

2010-01-19 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: I'm working with a C library that returns an array of strings. So that is type PPChar. I C library does the array allocation, but doesn't do the freeing of the array. How am I supposed to free an array of PChar strings? I think I need to

Re: [fpc-pascal] Compiler 240

2010-01-19 Thread Jichao Yang
Strangely,my 240 compiler do compile your sample code. My enviroment:windows xp + fpc v2.4.0 + x86. On Tue, Jan 19, 2010 at 8:08 PM, Carsten Bager cars...@beas.dk wrote: I have a problem with the new 240 compiler. I get errors when calling functions in the sysutils unit. I have tested the

Re: [fpc-pascal] Generics problem/question

2010-01-19 Thread Aleksa Todorovic
On Mon, Jan 18, 2010 at 04:07, Aleksa Todorovic alexi...@gmail.com wrote: The proper solution for this problem is not simple. Somehow, you will have to make operator = (const A, B: TPar) visible inside FGL unit (because of the way generics are currently implemented), or make compiler think

Re: [fpc-pascal] Hardware information: Linux and Windows

2010-01-19 Thread David Emerson
in linux... just google list hardware linux. Below are some results. Probably not all of them will be available, but you should be able to work with whatever is available on your machine. lshal lshw lspci lsusb lsscsi systool fdisk -l dmidecode cat /proc/cpuinfo cat /proc/meminfo dmesg | egrep

Re: [fpc-pascal] Re: creating a standalone executable(eg: applicationinstallation file)

2010-01-19 Thread Paul Nicholls
- Original Message - From: Graeme Geldenhuys graemeg.li...@gmail.com To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org Sent: Tuesday, January 19, 2010 6:36 PM Subject: Re: [fpc-pascal] Re: creating a standalone executable(eg: applicationinstallation file) Paul