Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2018-03

Request for applying patch #33124

13 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jonas Maebe
to Ondrej Pokorny
Ondrej Pokorny wrote 5 lines
Can somebody apply the patch at https://bugs.freepascal.org/view.php?id=33124 it's nothing serious, only a missing Cocoa header definition.

Those headers have been generated automatically. They should never be manually patched. Updated versions are indeed needed, but that will probably take quite a bit of work. I don't even know where the latest version of the header conversion tool is hosted, or which OS headers are the latest version it works with.

Jonas

Ondrej Pokorny
to Jonas Maebe
Jonas Maebe wrote 8 lines
On 22/03/18 16:14, Ondrej Pokorny wrote: > it's nothing serious, only a missing Cocoa header definition. Those headers have been generated automatically. They should never be manually patched. Updated versions are indeed needed, but that will probably take quite a bit of work. I don't even know where the latest version of the header conversion tool is hosted, or which OS headers are the latest version it works with.

Is there a chance you could take a look at it and update the header definitions at some point? We need them for Cocoa updates in the LCL.

For now I solved it with this extension class:

   NSWindow = objcclass external(CocoaAll.NSWindow)
     function backingScaleFactor: CGFloat; message 'backingScaleFactor';
   end;

See
https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/lcl/interfaces/cocoa/cocoaprivate.pp?root=lazarus&r1=57240&r2=57239&pathrev=57240

But it means a lot of code noise in LCL sources (see the same revision) :/

Ondrej

Jonas Maebe
to Ondrej Pokorny
Ondrej Pokorny wrote 12 lines
On 22.03.2018 18:47, Jonas Maebe wrote: > On 22/03/18 16:14, Ondrej Pokorny wrote: >> it's nothing serious, only a missing Cocoa header definition. > > Those headers have been generated automatically. They should never be > manually patched. Updated versions are indeed needed, but that will > probably take quite a bit of work. I don't even know where the latest > version of the header conversion tool is hosted, or which OS headers > are the latest version it works with. Is there a chance you could take a look at it and update the header definitions at some point?

I'm not sure. I've found the latest location of the parser though: https://github.com/genericptr/Framework-Parser

There's also a parsed version of the OS X 10.10 Cocoa headers: https://github.com/genericptr/MacOS_10_10

If they work for you and you can provide a patch, I can replace the current version of the headers in the FPC repository with these ones.

Jonas

Ondrej Pokorny
to Jonas Maebe
Jonas Maebe wrote 22 lines
On 24/03/18 10:15, Ondrej Pokorny wrote: > On 22.03.2018 18:47, Jonas Maebe wrote: >> On 22/03/18 16:14, Ondrej Pokorny wrote: >>> it's nothing serious, only a missing Cocoa header definition. >> >> Those headers have been generated automatically. They should never >> be manually patched. Updated versions are indeed needed, but that >> will probably take quite a bit of work. I don't even know where the >> latest version of the header conversion tool is hosted, or which OS >> headers are the latest version it works with. > > Is there a chance you could take a look at it and update the header > definitions at some point? I'm not sure. I've found the latest location of the parser though: https://github.com/genericptr/Framework-Parser There's also a parsed version of the OS X 10.10 Cocoa headers: https://github.com/genericptr/MacOS_10_10 If they work for you and you can provide a patch, I can replace the current version of the headers in the FPC repository with these ones.

I'm not sure either that I can provide a patch. Does really nobody maintain the headers? Who wrote the parser tool? Who committed the headers to SVN?

Ondrej

Jonas Maebe
to Ondrej Pokorny
Ondrej Pokorny wrote
I'm not sure either that I can provide a patch. Does really nobody maintain the headers? Who wrote the parser tool?

Ryan Joseph.

Who committed the headers to SVN?

I did and gave Ryan svn access, but he never updated them there.

Jonas

Dmitry Boyarintsev
to Ondrej Pokorny: Can somebody apply the patch at https://bugs.freepascal.org/view.php?id=33124 it's…
Ondrej Pokorny wrote 6 lines
Can somebody apply the patch at https://bugs.freepascal.org/view.php?id=33124 it's nothing serious, only a missing Cocoa header definition.

It's better, if you declare those methods as an objccategory in cocoa_extra.pas
In that case there would be no requirements regarding a certain FPC and/or headers version for LCL to compile.

Also, please check if a class supports those methods before calling them. Otherwise 10.7 would be the minimum macOS version required for LCL (afaik, it's still 10.5 as of today)

Earlier versions might experience an error like shown in this thread: http://forum.lazarus.freepascal.org/index.php/topic,40934.0.html

thanks
Dmitry

Ondrej Pokorny
to Dmitry Boyarintsev: It's better, if you declare those methods as an objccategory in cocoa_extra.pas In that…
Dmitry Boyarintsev wrote 15 lines
On Thu, Mar 22, 2018 at 11:14 AM, Ondrej Pokorny < > wrote: Can somebody apply the patch at https://bugs.freepascal.org/view.php?id=33124 <https://bugs.freepascal.org/view.php?id=33124> it's nothing serious, only a missing Cocoa header definition. It's better, if you declare those methods as an objccategory in cocoa_extra.pas In that case there would be no requirements regarding a certain FPC and/or headers version for LCL to compile.

Good. I added the missing header definition to LCL in r57240. Could you please review the revision and eventually fix it, if needed?

Also, please check if a class supports those methods before calling them.

How is it done?

Ondrej

Dmitry Boyarintsev
to Ondrej Pokorny
Ondrej Pokorny wrote
Good. I added the missing header definition to LCL in r57240. Could you please review the revision and eventually fix it, if needed?

r57677
reviewed and fixed. Also added support for the
deprecated userSpaceScaleFactor (which was in todo for that)

How is it done?

respondToSelector instance method
https://developer.apple.com/documentation/objectivec/1418956-nsobject/1418583-respondstoselector?language=objc

or instancesRespondToSelector class method.
https://developer.apple.com/documentation/objectivec/nsobject/1418555-instancesrespondtoselector?language=objc the later is rarely used.

thanks,
Dmitry

Ondrej Pokorny
to Dmitry Boyarintsev
Dmitry Boyarintsev wrote 21 lines
On Thu, Apr 19, 2018 at 2:59 PM, Ondrej Pokorny < > wrote: Good. I added the missing header definition to LCL in r57240. Could you please review the revision and eventually fix it, if needed? r57677 reviewed and fixed. Also added support for the deprecated userSpaceScaleFactor (which was in todo for that) How is it done? respondToSelector instance method https://developer.apple.com/documentation/objectivec/1418956-nsobject/1418583-respondstoselector?language=objc or instancesRespondToSelector class method. https://developer.apple.com/documentation/objectivec/nsobject/1418555-instancesrespondtoselector?language=objc the later is rarely used.

Thank you.

Ondrej

Ondrej Pokorny
to Dmitry Boyarintsev: It's better, if you declare those methods as an objccategory in cocoa_extra.pas In that…
Dmitry Boyarintsev wrote 15 lines
On Thu, Mar 22, 2018 at 11:14 AM, Ondrej Pokorny < > wrote: Can somebody apply the patch at https://bugs.freepascal.org/view.php?id=33124 <https://bugs.freepascal.org/view.php?id=33124> it's nothing serious, only a missing Cocoa header definition. It's better, if you declare those methods as an objccategory in cocoa_extra.pas In that case there would be no requirements regarding a certain FPC and/or headers version for LCL to compile.

I find it interesting that manual patching of FPC header definitions is forbidden, which force us to manually patch the LCL code base :)

Anyway, my email to Ryan Joseph
http://www.pascal-central.com/gladiator.html came back as undelivered.

Ondrej