Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2009-03-08 Thread dmitry boyarintsev
> What did you do to get pascocoa to work under osx?

It seems to me that you also need objc runtime headers.
Can be found here:
https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/bindings/objc
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2009-03-08 Thread Travis Siegel

You've gotten farther than I did.
I can't get anything from pascocoa to compile, it complains about  
missing units.
And the missing units are not included in the pascocoa sources, so no  
idea where to get them.

(don't remember which unit is missing, will check later and write again)
What did you do to get pascocoa to work under osx?


On Mar 8, 2009, at 6:25 AM, Jonas Maebe wrote:



On 29 Sep 2008, at 01:48, Felipe Monteiro de Carvalho wrote:


Could someone please upload 1 snapshot of the latest FPC 2.2.3 to
ftp://ftp.freepascal.org/pub/fpc/snapshot/fixes/i386-macosx/ ? I  
would

be imensely grateful.

I am writing an article about PasCocoa and I need a fix for static
methods, and also a publicly available installer with the fix.


FWIW, I just discovered that it does not fully work in 2.2.4 either  
(or 2.3.1, for that matter). This does not compile:


$cat tt.pp
{$mode objfpc}

type
tc = class
  class procedure a; cdecl; static;
  class procedure b; cdecl; static;
end;

class procedure tc.a; cdecl; static;
begin
writeln('a');
end;


class procedure tc.b; cdecl; static;
begin
a;
end;

begin
tc.b;
end.

$ fpc -St tt.pp
Free Pascal Compiler version 2.2.4 [2009/03/07] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Darwin for i386
Compiling tt.pp
tt.pp(17,4) Error: Illegal expression
tt.pp(23) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

I.e., you cannot call one static class method from inside another  
one (removing the "static" makes it compile).



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


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


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2009-03-08 Thread Jonas Maebe


On 08 Mar 2009, at 19:10, dmitry boyarintsev wrote:


yeah, i've seen description of 'static' usage at the mailing list
(subj: crashing _self parameter)

This is a new feature for FPC, right? (catching up with new delphi  
syntax?)


The static keyword been available forever in FPC (probably from before  
Delphi had it, we first used it in TP-style objects). What is new is  
making the behaviour of adding of "static" to class methods Delphi- 
compatible.



a few questions about that:
1) 'static' methods are regular procedures/functions, but bound to a
class rather than a unit?


A class method becomes indeed a regular function/procedure within the  
scope of a class if you add "static;".



2) it's possible to pass 'static'-methods as procedure variables?


Try it. I don't know. It will probably cause compiler errors because  
of type incompatibilities. If Delphi accepts it in some form, please  
file a bug report with a compilable example program. It should  
probably also be tested that class methods are not assignable to a  
"procedure of object"-style procvar (although I don't know whether  
that's normally possible for class methods).



3) only class methods can be 'static'? it's impossible to declare a
method like:
TMyObject = class
 procedure MyMethod; static;
end;


It's possible to declare this, but it doesn't change anything  
currently (a method without self-parameter would be indistinguishable  
from a class method without its hidden vmt-parameter -- which is also  
called self, for that matter). I don't see any use for this.



4) no Self parameter is available inside the 'static' method. (since
it's regular procuder or function)


That's the whole point of using static.


5) 'static' keyword is used only if compiler -St switch specified?


Yes, or {$static on)


6) how are they actually named? because there're two kind of static
methods available:

TMyObject = class
  class function MyClassProc;  // static class method


This is a regular class method.


  class function MyClassVirtualProc; virtual; // virtual class
method. can be overriden.
  class function MyClassVirtualProc; dynamic; // dynamic class
method. can be overriden too
  class function MyClassProc; static; // "static" class method?


And this is a static class method.

7) 'static' keyword is available for both {$mode objfpc} and {$mode  
delphi}


It's available in every mode, as long as you add -St or {$static on}


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


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2009-03-08 Thread dmitry boyarintsev
one more question:

7) 'static' keyword is available for both {$mode objfpc} and {$mode delphi}

Thanks,
Dmitry
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2009-03-08 Thread dmitry boyarintsev
yeah, i've seen description of 'static' usage at the mailing list
(subj: crashing _self parameter)

This is a new feature for FPC, right? (catching up with new delphi syntax?)
a few questions about that:
1) 'static' methods are regular procedures/functions, but bound to a
class rather than a unit?

2) it's possible to pass 'static'-methods as procedure variables?

TMyObject = class
  class procedure MyMethod; static;
end;

TProc = procedure;

procedure MyProc;
begin
  ...
end;

procedure DoSomething(CallBack: TProc);
begin
  Callback(); // call here
end;

begin
  DoSomething(@MyProc); // it's possible
  DoSomething(@TMyObject.MyMethod); //it's possible either, with no
extra type casting.
end.

3) only class methods can be 'static'? it's impossible to declare a
method like:
TMyObject = class
  procedure MyMethod; static;
end;

4) no Self parameter is available inside the 'static' method. (since
it's regular procuder or function)

5) 'static' keyword is used only if compiler -St switch specified?

6) how are they actually named? because there're two kind of static
methods available:

TMyObject = class
   class function MyClassProc;  // static class method
   class function MyClassVirtualProc; virtual; // virtual class
method. can be overriden.
   class function MyClassVirtualProc; dynamic; // dynamic class
method. can be overriden too
   class function MyClassProc; static; // "static" class method?
end;

Thanks,
Dmitry
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2009-03-08 Thread Jonas Maebe


On 08 Mar 2009, at 14:06, dmitry boyarintsev wrote:


Is there any actuall use of cdecl object methods?


The problem is not the cdecl, but the static. And the use of these  
methods (with both static and cdecl) is that they behave exactly the  
same as regular C functions/procedures as far as parameter passing is  
concerned, so you need them currently if you want to declare a method  
as part of a class that can be passed as call back to C/Objective-C  
code (see e.g. pascocoa/examples/texteditor/mytoolbar.pas)



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


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2009-03-08 Thread dmitry boyarintsev
Is there any actuall use of cdecl object methods?
fastcall (register) is faster than cdecl.

Thanks,
Dmitry
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2009-03-08 Thread Jonas Maebe


On 08 Mar 2009, at 12:25, Jonas Maebe wrote:

I.e., you cannot call one static class method from inside another  
one (removing the "static" makes it compile).


This is fixed now in 2.3.1.


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


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2009-03-08 Thread Jonas Maebe


On 29 Sep 2008, at 01:48, Felipe Monteiro de Carvalho wrote:


Could someone please upload 1 snapshot of the latest FPC 2.2.3 to
ftp://ftp.freepascal.org/pub/fpc/snapshot/fixes/i386-macosx/ ? I would
be imensely grateful.

I am writing an article about PasCocoa and I need a fix for static
methods, and also a publicly available installer with the fix.


FWIW, I just discovered that it does not fully work in 2.2.4 either  
(or 2.3.1, for that matter). This does not compile:


$cat tt.pp
{$mode objfpc}

type
 tc = class
   class procedure a; cdecl; static;
   class procedure b; cdecl; static;
 end;

class procedure tc.a; cdecl; static;
begin
 writeln('a');
end;


class procedure tc.b; cdecl; static;
begin
 a;
end;

begin
 tc.b;
end.

$ fpc -St tt.pp
Free Pascal Compiler version 2.2.4 [2009/03/07] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Darwin for i386
Compiling tt.pp
tt.pp(17,4) Error: Illegal expression
tt.pp(23) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

I.e., you cannot call one static class method from inside another one  
(removing the "static" makes it compile).



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


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2008-10-06 Thread Jonas Maebe


On 06 Oct 2008, at 13:16, Felipe Monteiro de Carvalho wrote:


I did not test the merged revision in 2.2.1. Yes, I regret nor having
tested it. I had supposed it would work and it was merged right in the
end of the development process, so I had no time to test.


In such cases you should never ask to merge things. "Supposing that it  
will work" is not good enough for a release.



But it doesn't matter. In 2.2.0 it accepts the code but it produces
wrong parameters, so what is the use for that?


It did not produce "wrong parameters". The behaviour was not Delphi- 
compatible, but as long as you did not depend on not having exactly  
the same kinds of parameters as there (which is probably the case for  
most code), it worked.



Both parts need to work for PasCocoa.


The result is that now PasCocoa nor other apps that use this work with  
2.2.2.



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


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2008-10-06 Thread Felipe Monteiro de Carvalho
I did not test the merged revision in 2.2.1. Yes, I regret nor having
tested it. I had supposed it would work and it was merged right in the
end of the development process, so I had no time to test.

But it doesn't matter. In 2.2.0 it accepts the code but it produces
wrong parameters, so what is the use for that? Both parts need to work
for PasCocoa.

-- 
Felipe Monteiro de Carvalho
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2008-10-06 Thread Jonas Maebe


On 06 Oct 2008, at 02:23, Felipe Monteiro de Carvalho wrote:


How would I procede to create the snapshot myself?

I really need it. I cannot create toolbars in Cocoa without static.


How did this error get into 2.2.2 in the first place? All I remember  
about static is that you explicitly asked for a particular revision to  
be merged a couple of weeks before the release, also because you  
needed it for Cocoa. Did you ask for a merge without testing either  
before or afterwards? If so, I really hope you won't do that again in  
the future, because it completely destroys the value of release  
candidates.



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


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2008-10-05 Thread Felipe Monteiro de Carvalho
Hello,

How would I procede to create the snapshot myself?

I really need it. I cannot create toolbars in Cocoa without static.

-- 
Felipe Monteiro de Carvalho
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2008-09-29 Thread Felipe Monteiro de Carvalho
On Mon, Sep 29, 2008 at 3:40 AM, Florian Klaempfl
<[EMAIL PROTECTED]> wrote:
> Try to repeat the static keyword in the body, this could work with 2.2.0
> too.

That was the first thing I tryed:

controller.pas(85,97) Error: Procedure directive "STATIC" not allowed
in implementation section

with fpc 2.2.2

In 2.2.0 the previous static fix isn't present, so I would hit other
problems. Cocoa really requires overriding methods (with correct
parameters) to do trivial tasks, such as creating a toolbar, so I
can't run from this, unless I give up object-orientation and write
everything as procedures.

thanks,
-- 
Felipe Monteiro de Carvalho
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC 2.2.3 i386-darwin snapshot

2008-09-28 Thread Florian Klaempfl
Felipe Monteiro de Carvalho schrieb:
> Hello,
> 
> Could someone please upload 1 snapshot of the latest FPC 2.2.3 to
> ftp://ftp.freepascal.org/pub/fpc/snapshot/fixes/i386-macosx/ ? I would
> be imensely grateful.

Try to repeat the static keyword in the body, this could work with 2.2.0
too.

> 
> I am writing an article about PasCocoa and I need a fix for static
> methods, and also a publicly available installer with the fix.
> 
> thanks,

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


[fpc-devel] FPC 2.2.3 i386-darwin snapshot

2008-09-28 Thread Felipe Monteiro de Carvalho
Hello,

Could someone please upload 1 snapshot of the latest FPC 2.2.3 to
ftp://ftp.freepascal.org/pub/fpc/snapshot/fixes/i386-macosx/ ? I would
be imensely grateful.

I am writing an article about PasCocoa and I need a fix for static
methods, and also a publicly available installer with the fix.

thanks,
-- 
Felipe Monteiro de Carvalho
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel