[fpc-pascal] Baby steps

2008-05-06 Thread Kristofer Skaug

Hi all,

I've taken a stroll into Lazarus-/FPC-land, trying to port some Delphi units
that have served me well for a long time.
Here are my inevitable newbie problems:

1) Have been reading the FAQs and other things but cannot seem to find the
referenced sections in the FPC manuals that contain Delphi vs FPC language
(in)compatability notes. The RTL manual doesn't appear to load from the FPC
website.

2) How do I convert a Delphi function like this:

function PtrAt(p:pointer; const Offset:LongWord):pointer;
begin
  Result := Ptr(LongWord(p)+Offset);
end;

FPC barked at my use of Ptr(), saying:
"Error: Wrong number of parameters specified for call to "ptr""
And indeed in systemh.inc, "ptr" is defined as:
Function  ptr(sel,off:Longint):farpointer; (...)
which appears to be some kind of TP compatability function.
But the modern Delphi Ptr() function takes only a 32-bit numeric address as
argument. Is there an equivalent for this in FPC?
For the record, I'm *not* primarily interested in trying to make FPC "act
like" Delphi, if this costs me Cross-platform flexibility. I'd rather
understand how to create the equivalent function in 'pure' FPC.

3) Is there an FPC equivalent of DUnit? I have more than 150KLines' worth of
unit tests that would be a great help in the migration exercise, if I could
find a way to re-use them...

4) Probably none of your business, but anyway: I tried registering for the
Lazarus forums (twice, in fact, for 2 different e-mail addresses), but never
received a registration confirmation/password. Is that a known issue? Whom
can I contact to solve this - I do not see any contact addresses on the the
website.

thanks for helping me with the baby steps :-)

Kristofer


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


Re: [fpc-pascal] Baby steps

2008-05-06 Thread Jonas Maebe


On 06 May 2008, at 17:37, Kristofer Skaug wrote:

1) Have been reading the FAQs and other things but cannot seem to  
find the
referenced sections in the FPC manuals that contain Delphi vs FPC  
language
(in)compatability notes. The RTL manual doesn't appear to load from  
the FPC

website.


There's a list available at http://wiki.freepascal.org/Code_Conversion_Guide

It should indeed probably be referenced from the FAQ or so. A number  
of the points raised at http://www.freepascal.org/port.var are also  
valid when coming from Delphi rather than from Turbo Pascal.



2) How do I convert a Delphi function like this:

function PtrAt(p:pointer; const Offset:LongWord):pointer;
begin
 Result := Ptr(LongWord(p)+Offset);
end;

FPC barked at my use of Ptr(), saying:
"Error: Wrong number of parameters specified for call to "ptr""
And indeed in systemh.inc, "ptr" is defined as:
Function  ptr(sel,off:Longint):farpointer; (...)
which appears to be some kind of TP compatability function.
But the modern Delphi Ptr() function takes only a 32-bit numeric  
address as

argument. Is there an equivalent for this in FPC?


Simply use a Pointer-typecast (that will also work in Delphi). In  
Delphi Ptr() is probably internally also simply converted ta Pointer- 
typecast.


I can't help with the other issues, but others probably can.


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


[fpc-pascal] TTimeZoneInformation, GetTimeZoneInformation, SetTimeZoneInformation

2008-05-06 Thread Jilani Khaldi

Hi All,
how are these implemented in Free Pascal?
Thank you!
Jilani
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal