• 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: convert Java or C Source code into Objective-c
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: convert Java or C Source code into Objective-c


  • Subject: Re: convert Java or C Source code into Objective-c
  • From: Scott Ellsworth <email@hidden>
  • Date: Mon, 10 Jul 2006 11:22:37 -0700


On Jul 10, 2006, at 7:11 AM, Scott Thompson wrote:


On Jul 10, 2006, at 7:24 AM, Raphael wrote:

Hi,
is their a available Tool that can convert Java or C code into objective-c source files?
I have try google, but I can´t found anything.
I have a old application that I like to convert into my objetive- c. I wouldn´t use the JavaBridge in
that app, because it is a complete application and that makes no sense for me.

Well...

Objective-C is a superset of C so all of your C files are, by definition, also Objective-C files.

Unfortunately I'm not aware of any tool that might try to translate Java into Objective-C.

The object models are quite different. Having done this several times, your best bet is to create a wrapper API, then do the changes under the covers.


(I have had several projects where I was converting some Perl, C, Java, C#, or ObjectiveC code to one of the other languages. Java and C# convert easily, ObjectiveC using some C libraries is a no brainer, moving Java or C# to ObjC or the reverse is more complicated.)

For very self contained code, your wrapper can use JNI to get at Java code, or plain old library calls to get at C code. For example, a matrix library with a large suite of tests, or a database kit that already does what you need done, might make sense to leave as one big block until performance testing tells you it is time to change.

Most code is not that well contained. In that case, you are best off rewriting, as the human eye really is one of the better translation tools. There again, a good, minimal interface will tell you what you need to move.

As far as the nuts and bolts, create appropriate class skeletons, use accesorizer to handle instance variables, and then move one routine at a time. I strongly suggest unit tests to make sure you did it right. (One bennie of the JNI/C library approach - you can get it working, then as you port methods based on performance needs or maintenance, you can validate their working against the old, working, code.)

Scott


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >convert Java or C Source code into Objective-c (From: Raphael <email@hidden>)
 >Re: convert Java or C Source code into Objective-c (From: Scott Thompson <email@hidden>)

  • Prev by Date: NSPopupButtonCell in NSTableView
  • Next by Date: NSWindows/NSPanels/NSDrawers are NIL
  • Previous by thread: Re: convert Java or C Source code into Objective-c
  • Next by thread: Re: convert Java or C Source code into Objective-c
  • Index(es):
    • Date
    • Thread