Official Pascal-Header (SDK 2.0)

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Wed May 26, 2010 4:40 am

Updated. Thanks for reporting.
User avatar
Stucuk
 
Posts: 800
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby Carli » Wed May 26, 2010 3:28 pm

An other issue:

Each declaration of a callback is defined as
Code: Select all
type CallBack = function(bla: integer): single
PCallBack = ^Callback

But that's wrong. it's double pointered but FPC needs the funktion itself, not the pointer to the function pointer. Delphi dosent care, in Delphi, all procedure variables are simple pointers without typecheck.

thanks for future fixing.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Thu May 27, 2010 2:38 am

Id assume its the flags your using since that type of coding style came from the 1.53 delphi header and noone complained about it back then. In any case i don't use FPC so i don't know how to fix FPC problems unless someone gives me the fixed code.
User avatar
Stucuk
 
Posts: 800
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby Carli » Fri May 28, 2010 4:41 am

You just need to remove each "^" from a function call definition.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Sat May 29, 2010 12:08 pm

Btw have you tried Delphi Compatibility mode on FPC?
User avatar
Stucuk
 
Posts: 800
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby Carli » Sun May 30, 2010 6:57 am

Stucuk wrote:Btw have you tried Delphi Compatibility mode on FPC?


In the header: yes
In the rest of the code: no
I don't want to use a compatibility mode because i'm trying to keep a clean coding style (--> typed function pointers)

I don't think if you change this in the header, delphi code would work anymore.
In delphi, each pointer to a function is treatet as a "pointer" in assignment.

I myself changed the header a lot, but would be nice, to use official headers again ;)
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Sun May 30, 2010 8:46 am

Well if its not necessary to change then i won't for the simple reason that it would then require other people who say use delphi to maybe change there code. If things like PWhatever were removed then people who used the PWhatever would have to change there code so it worked with the TWhatever. While it wouldn't be hard for people to update there code, they may not realise what they would need to do.
User avatar
Stucuk
 
Posts: 800
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby Carli » Sun May 30, 2010 10:42 am

Stucuk wrote: If things like PWhatever were removed [...]


why does it need to be removed?
the only thing you have to remove is a single "^" after the "=".
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Sun May 30, 2010 4:38 pm

Because it would be completely pointless to have something like:

Code: Select all
TBla = Whatever;
PBla = TBla;
User avatar
Stucuk
 
Posts: 800
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby Carli » Tue Jun 01, 2010 2:27 am

Stucuk wrote:Because it would be completely pointless to have something like:

Code: Select all
TBla = Whatever;
PBla = TBla;


Nothing is pointless when it's good for compatibility.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Wed Jun 02, 2010 12:40 pm

Backwards compatibility > Having it compile without Delphi Compatibility Flags.

Flags are there for a reason.
User avatar
Stucuk
 
Posts: 800
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby JernejL » Wed Jun 02, 2010 1:26 pm

Ridiclous argument.. is it then a delphi header or a pascal header?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1492
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Wed Jun 02, 2010 4:19 pm

2.0's Header is based on 1.53 which started off life as a Delphi only header and had support for Free Pascal added in. 2.0 kept the 1.53 "Style". As such its been coded in a Delphi way but has the ability to compile on Free Pascal. All he needs to do is compile it with Free Pascal's Delphi Compatibility mode flag, which is why i don't see the need to modify the header. As long as Free Pascal is setup correctly there should be no problems.

Delfi wrote:Ridiclous argument..

I couldn't agree more.
User avatar
Stucuk
 
Posts: 800
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby Carli » Thu Jun 03, 2010 4:36 pm

Stucuk wrote:As long as Free Pascal is setup correctly there should be no problems.


The header would not need the compatibility flag.

For my problem:
Either i add delphi mode to each newton-using unit or I use a Poiner Cast from "PNewtonCallback" to "NewtonCallback".
I myself decided to modify the header and I don't see any reason to use any "official" header any more.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Fri Jun 04, 2010 5:41 am

Since most languages have the ability to globally set a flag, id bet that Free Pascal has the ability to set global flags, which would mean you wouldn't need to add a flag to every unit.
User avatar
Stucuk
 
Posts: 800
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 1 guest