Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 2 > Newsgroup comp.lang.objective-c

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 09-20-2005, 10:01 AM
Santa Claus
Guest
 
Posts: n/a
Default converting objective-c to c

Is there a way to convert objective-c to c using mac os-x 10.4.2 and all
the latest compilers? (gcc 4.0, xcode 2) If so, how?
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 09-20-2005, 10:46 PM
Michael Ash
Guest
 
Posts: n/a
Default Re: converting objective-c to c

Santa Claus <santa@northpole.com> wrote:
> Is there a way to convert objective-c to c using mac os-x 10.4.2 and all
> the latest compilers? (gcc 4.0, xcode 2) If so, how?


The short answer: no.

The long answer: the only ObjC-to-C translator that's still in existence
is POC. Gcc's ObjC compiler is a direct compiler, with no intermediate C
code. POC's dialect of ObjC is significantly different from gcc's, and
there is no hope of it compiling anything which uses any of Mac OS X's
Objective-C APIs.

Why do you want to do this?

--
Michael Ash
Rogue Amoeba Software
Reply With Quote
  #3 (permalink)  
Old 09-21-2005, 02:20 AM
Santa Claus
Guest
 
Posts: n/a
Default Re: converting objective-c to c

In article <1127256387.54158@nfs-db1.segnet.com>,
Michael Ash <mike@mikeash.com> wrote:

> Santa Claus <santa@northpole.com> wrote:
> > Is there a way to convert objective-c to c using mac os-x 10.4.2 and all
> > the latest compilers? (gcc 4.0, xcode 2) If so, how?

>
> The short answer: no.
>
> The long answer: the only ObjC-to-C translator that's still in existence
> is POC. Gcc's ObjC compiler is a direct compiler, with no intermediate C
> code. POC's dialect of ObjC is significantly different from gcc's, and
> there is no hope of it compiling anything which uses any of Mac OS X's
> Objective-C APIs.
>
> Why do you want to do this?


I want to compile some programs using cocoa with the fpc pascal
compiler. translating the obj-c into c is the first step in
understanding how to implement this.
Reply With Quote
  #4 (permalink)  
Old 09-21-2005, 07:16 AM
Ulrich Hobelmann
Guest
 
Posts: n/a
Default Re: converting objective-c to c

Santa Claus wrote:
> In article <1127256387.54158@nfs-db1.segnet.com>,
> Michael Ash <mike@mikeash.com> wrote:
>
>> Santa Claus <santa@northpole.com> wrote:
>>> Is there a way to convert objective-c to c using mac os-x 10.4.2 and all
>>> the latest compilers? (gcc 4.0, xcode 2) If so, how?

>> The short answer: no.
>>
>> The long answer: the only ObjC-to-C translator that's still in existence
>> is POC. Gcc's ObjC compiler is a direct compiler, with no intermediate C
>> code. POC's dialect of ObjC is significantly different from gcc's, and
>> there is no hope of it compiling anything which uses any of Mac OS X's
>> Objective-C APIs.
>>
>> Why do you want to do this?

>
> I want to compile some programs using cocoa with the fpc pascal
> compiler. translating the obj-c into c is the first step in
> understanding how to implement this.


You still didn't answer the question

--
My mouth says the words, my brain is thinking monstertrucks.
Joey (Friends)
Reply With Quote
  #5 (permalink)  
Old 09-21-2005, 11:41 AM
stao222@gmail.com
Guest
 
Posts: n/a
Default Re: converting objective-c to c


Santa Claus a écrit :

> Is there a way to convert objective-c to c using mac os-x 10.4.2 and all
> the latest compilers? (gcc 4.0, xcode 2) If so, how?


Did you try the "Preprocess" command of XCode ? (=> action in the menu
bar)

Reply With Quote
  #6 (permalink)  
Old 09-21-2005, 04:13 PM
Sherm Pendley
Guest
 
Posts: n/a
Default Re: converting objective-c to c

Santa Claus <santa@northpole.com> writes:

> I want to compile some programs using cocoa with the fpc pascal
> compiler. translating the obj-c into c is the first step in
> understanding how to implement this.


It's not even a necessary step, much less the first.

Have a look at Apple's guide to the Objective-C language and their runtime:

http://developer.apple.com/documenta...veC/index.html
http://developer.apple.com/documenta...Ref/index.html

In case those links wrap:

http://tinyurl.com/yw3t
http://tinyurl.com/b4u54

There are two sides to it. First, sending a message to an object - that's done
by calling objc_msgSend(), or one of that function's variants.

The other part of it is registering your FPC classes with the runtime. That
means building up a structure that describes the class object, and calling
objc_addClass(). Then you can add methods to the class in a similar manner,
filling out a structure that describes them and calling class_addMethods().

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Reply With Quote
  #7 (permalink)  
Old 09-21-2005, 04:21 PM
Sherm Pendley
Guest
 
Posts: n/a
Default Re: converting objective-c to c

"stao222@gmail.com" <stao222@gmail.com> writes:

> Santa Claus a écrit :
>
>> Is there a way to convert objective-c to c using mac os-x 10.4.2 and all
>> the latest compilers? (gcc 4.0, xcode 2) If so, how?

>
> Did you try the "Preprocess" command of XCode ? (=> action in the menu
> bar)


That won't help. Like someone said earlier, GCC doesn't translate to C as an
intermediate step, it compiles Objective-C directly. The above command will
run the C preprocessor, which expands #import, #define, and other directives
and macros.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Reply With Quote
  #8 (permalink)  
Old 09-24-2005, 08:35 PM
David Stes
Guest
 
Posts: n/a
Default Re: converting objective-c to c

Michael Ash <mike@mikeash.com> wrote:
> Santa Claus <santa@northpole.com> wrote:
>> Is there a way to convert objective-c to c using mac os-x 10.4.2 and all
>> the latest compilers? (gcc 4.0, xcode 2) If so, how?

>
> The long answer: the only ObjC-to-C translator that's still in existence
> is POC.


Portable Object Compiler (POC) compiles Objective-C into C.
See http://users.pandora.be/stes/compiler.html

> POC's dialect of ObjC is significantly different from gcc's,


Yes, POC is better, with features like Blocks (closures) that more
old-fashioned compilers like Apple's Objective-C are still lacking.

The problem may be in the root class NSObject of Apple.

The normal Objective-C compilers do not use NSObject, but rather Object as
root class, so that will indeed be a show-stopper but this "show-stopper"
is more of a library runtime issue (the root class) and not the compiler per se.

Reply With Quote
  #9 (permalink)  
Old 09-24-2005, 09:28 PM
Christian Brunschen
Guest
 
Posts: n/a
Default Re: converting objective-c to c

In article <hMiZe.4145$cm4.157835@phobos.telenet-ops.be>,
David Stes <stes@dD5E02985.access.telenet.be> wrote:
>Michael Ash <mike@mikeash.com> wrote:
>> Santa Claus <santa@northpole.com> wrote:
>>> Is there a way to convert objective-c to c using mac os-x 10.4.2 and all
>>> the latest compilers? (gcc 4.0, xcode 2) If so, how?

>>
>> The long answer: the only ObjC-to-C translator that's still in existence
>> is POC.

>
>Portable Object Compiler (POC) compiles Objective-C into C.
>See http://users.pandora.be/stes/compiler.html
>
>> POC's dialect of ObjC is significantly different from gcc's,

>
>Yes, POC is better, with features like Blocks (closures) that more
>old-fashioned compilers like Apple's Objective-C are still lacking.


Suffice it to say that POC is a niche compiler, whereas Apple's and
GNU's GCC is the mainstream one. There are excellent reasons for this.

It should be noted that POC 'supports' certain features - really,
proprietary extensions - that have never been part of the Objctive-C
language but which David Stes likes, but at the same time fails to include
several features which have been part of Objective-C for about a decade
now (things like Categories and Protocols) as well as of course anything
that has been added over the past couple of years, like exceptions. Even
its own proprietary extensions are often implemented badly and
incorrectly: for instance, POC's attempt at exception handling using
Blocks, which is supposedly modeled after Smalltalk's exception handling,
doesn't actually implement proper exception handling semantics.

In general, one should be somewhat wary of any claims that David Stes
makes about the superiority of his personal hobby compiler - not just
because he is inevitably biased, but also because of the significant
number of flaws that have been exposed in it, including a number which he
appears to not even understand.

>The problem may be in the root class NSObject of Apple.
>
>The normal Objective-C compilers do not use NSObject, but rather Object as
>root class, so that will indeed be a show-stopper but this "show-stopper"
>is more of a library runtime issue (the root class) and not the compiler per se.


Again, David Stes is, perhaps deliberately, confusing things. 'Normmal'
Objective-C has in fact never mandated or included any specific root
class. Quite the contrary, Objective-C allows developers to design and
write their own root classes as necessary.

There have been, through the lifetime of Objective-C, different class
lbirariies available from different sources, and different ones of these
have reached narrower and wider audiences, respectively. Stepstone did
indeed distribute a class library, ICPak101, along with their compiler at
one point, which included a root class named 'Object'; POC includes a
class library called 'ObjPak' which attempts to mimic ICPak101. However,
other developers of Objective-C compilers have shipped other class
libraries. NeXT, for instance, originally shipped a somewhat different set
of classes than Stepstone, even though NeXT licensed Objective-C
technology from Stepstone and initially used a root class named 'Object'
and overall very similar to Stepstone's. The 'Swarm' project has its own
class library. The OpenStep specification, co-developed by NeXT and Sun,
introduced a separate class hierarchy which can be used together with
other classes.

Indeed, there is specifically no 'show-stopper' as David Stes is claiming:
Classes derived from Stepstone's Object class and from NeXT/Sun/Apple's
NSObject class can be used together in the same application - among other
reasons precisely because Objective-C explicitly allows and caters for
the use of multiple different root classes.


The end result is that, regardless all of David Stes claims of POC's
superiority, POC cannot be used to compile modern Objective-C code such as
you would use when developing code using Apple's Cocoa classes on and for
Mac OS X, because POC basically implements an old, obsolete dialect of
Objective-C (coupled with a few proprietary, incompatible extensions of
its own), and its author - David Stes - appears to have no interest in
updating POC to be a modern Objective-C compiler.


Best wishes,

// Christian Brunschen
Reply With Quote
  #10 (permalink)  
Old 09-28-2005, 08:07 PM
lrojas
Guest
 
Posts: n/a
Default Re: converting objective-c to c

going in a tangent here but,

What are the posibilities of using the closest thing as 'standard
Objective-C' in case i wanted to develop for multiple platform like
Linux, Windows and Mac ( commnad line apps ) ?

thanks for iluminating my dark ignorance.

Reply With Quote
  #11 (permalink)  
Old 09-29-2005, 06:38 AM
Christian Brunschen
Guest
 
Posts: n/a
Default Re: converting objective-c to c

In article <1127938075.204282.131050@g43g2000cwa.googlegroups .com>,
lrojas <luis.r.rojas@gmail.com> wrote:
>going in a tangent here but,
>
>What are the posibilities of using the closest thing as 'standard
>Objective-C' in case i wanted to develop for multiple platform like
>Linux, Windows and Mac ( commnad line apps ) ?


The de-facto standard Objective-C class library is Foundation, as offered
in Apple's Cocoa on Mac OS X, and in GNUStep for Linux (and other Unixen)
and Windows.

If you want to write command-line applications in Objective-C, to work on
Mac OS X, Linux and Windows, you should use the latest gcc compiler, and a
suitable Foundation library: Either Cocoa or GNUStep on Mac OS X, and
GNUStep on Linux and Windows.

GNUStep can be doanloaded from <http://www.gnustep.org/> .

>thanks for iluminating my dark ignorance.


You're more than welcome,

// Christian Brunschen
Reply With Quote
  #12 (permalink)  
Old 09-29-2005, 11:37 AM
Michael Ash
Guest
 
Posts: n/a
Default Re: converting objective-c to c

Christian Brunschen <cb@df.lth.se> wrote:
> In article <1127938075.204282.131050@g43g2000cwa.googlegroups .com>,
> lrojas <luis.r.rojas@gmail.com> wrote:
>>going in a tangent here but,
>>
>>What are the posibilities of using the closest thing as 'standard
>>Objective-C' in case i wanted to develop for multiple platform like
>>Linux, Windows and Mac ( commnad line apps ) ?

>
> The de-facto standard Objective-C class library is Foundation, as offered
> in Apple's Cocoa on Mac OS X, and in GNUStep for Linux (and other Unixen)
> and Windows.
>
> If you want to write command-line applications in Objective-C, to work on
> Mac OS X, Linux and Windows, you should use the latest gcc compiler, and a
> suitable Foundation library: Either Cocoa or GNUStep on Mac OS X, and
> GNUStep on Linux and Windows.


Note that if GNUStep doesn't suit your needs, there are also two
libFoundation projects that may work out. The first one hasn't been
updated in a long time but is (as far as I know, I haven't used it) fairly
complete, and can be found here:
<http://sourceforge.net/projects/libfoundation>

The second one is part of OpenDarwin and is not ready for production use,
but it looks promising, and if you have free time and don't know what to
do with it, they could use your help. It can be found here:
<http://libfoundation.opendarwin.org/>

--
Michael Ash
Rogue Amoeba Software
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: converting numeric values to character toby dunn Newsgroup comp.soft-sys.sas 1 12-14-2006 05:30 AM
Re: Converting from SAS 5 to SAS 9 Michael L. Davis Newsgroup comp.soft-sys.sas 0 12-17-2004 10:59 PM



All times are GMT. The time now is 10:27 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.