• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cross-platform toolkit with a Cocoa backend
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cross-platform toolkit with a Cocoa backend


  • Subject: Re: Cross-platform toolkit with a Cocoa backend
  • From: Sherm Pendley <email@hidden>
  • Date: Thu, 12 Jul 2007 14:52:16 -0400

On Jul 12, 2007, at 6:42 AM, Uli Kusterer wrote:

On 12.07.2007, at 10:49, Felipe Monteiro de Carvalho wrote:
On 7/11/07, Ofri Wolfus <email@hidden> wrote:
After all, ObjC can be implemented purely in a
preprocessor, and you can do by hand what the preprocessor would do
for you.

Do you know of where one can download such preprocessor? (In the hipotesys that it exists)

I was looking for examples about how to transform objective-c code
into calls to the rtl, and this would be excelent =)

Shouldn't be too hard. In the header that contains objc_msgSend(), there's lots of comments and also other functions that let you create or look up selectors etc., and there's also docs for that in Xcode's documentation viewer. I've used objc_msgSend() in a little compiler thingie I was working on, and it's really just a function call. The only thing I haven't yet tried is subclass a class. But for that, you could probably have a peek at the runtime data structures (also in that header) and the source code for method swizzling that's out on the web (which uses them to add a method, and is linked from the http://cocoadev.com Wiki).

Classes, subclasses, methods (one at a time or as a list) - it's all essentially a matter of filling out a struct that describes them and passing that to a registration function. Note that this happens at run-time; does FP allow for a dylib initialization function? If you're using Apple's ld, you can use its --init option to specify a function that will be called before any symbol is used from the library. You'd want to place the code to register your classes, selectors, and methods in such a function.


FP has existing options concerning Delphi and Object Pascal compatibility, if I recall. I suggest adding a --enable-objc- messaging switch as well. Messages are basically just calls to one of the objc_msgSend*() functions. See the header files & runtime reference for details.

A preprocessor isn't a bad idea - if I remember right, the first Objective-C compiler was implemented that way. You could do all of this by hand, but there's a lot of repetitive boilerplate code that would benefit from automation.

sherm--

Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Cross-platform toolkit with a Cocoa backend (From: "Felipe Monteiro de Carvalho" <email@hidden>)
 >Re: Cross-platform toolkit with a Cocoa backend (From: j o a r <email@hidden>)
 >Re: Cross-platform toolkit with a Cocoa backend (From: "Felipe Monteiro de Carvalho" <email@hidden>)
 >Re: Cross-platform toolkit with a Cocoa backend (From: "Dr. Rolf Jansen" <email@hidden>)
 >Re: Cross-platform toolkit with a Cocoa backend (From: Sherm Pendley <email@hidden>)
 >Re: Cross-platform toolkit with a Cocoa backend (From: Ofri Wolfus <email@hidden>)
 >Re: Cross-platform toolkit with a Cocoa backend (From: "Felipe Monteiro de Carvalho" <email@hidden>)
 >Re: Cross-platform toolkit with a Cocoa backend (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: NSNumberFormattter not working
  • Next by Date: Re: NSNumberFormattter not working
  • Previous by thread: Re: Cross-platform toolkit with a Cocoa backend
  • Next by thread: Re: Cross-platform toolkit with a Cocoa backend
  • Index(es):
    • Date
    • Thread