[futurebasic] RE: [FB] Using Apple's "Official" Headers

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2002 : Group Archive : Group : All Groups

From: "Edwards, Waverly" <Waverly.Edwards@...>
Date: Mon, 23 Dec 2002 16:35:34 -0500
<<
     But I have to ask, if a machine is expected to "interpret and 
compile" the original C-Format header file (as a C compiler must in 
order to do its job), can't a machine be made to "interpret and 
convert" that same source file?
>>

From my studies, yes and no.  Yes its doable (in part) but its still 
going to require human massaging.

Painful stuff:

macro expansion
preprocessor directives
conditional compiles
inevitable name space conflict between C & FB

Multiple passes are going to need to be made to accommodate all the
combinations of conditional compiles and other preprocessor directives.
There are so many combination that it hurts my head just thinking
about them. 

Two projects from now I hope to get back to some ideas that I have
regarding C source interpretation.  I've invested some of my time back
into re-learning C only because most examples are in C and C++. Headers 
are done in C and they are unbelievably intricate.  I've spent quite
a bit of time on occasions hand converting examples written in C.  
I'm not up on all the shortcuts, tricky code and minor nuances that 
go into C so in general the conversions should work but sometimes 
they don't.  

An automated way such as Michael Kluskens C2FB3 by is definitely  
what's necessary.


W.


-----Original Message-----
From: RP Phillips [mailto:16x9software@...]
Sent: Monday, December 23, 2002 3:17 PM
To: futurebasic@...
Subject: Re: [FB] Using Apple's "Official" Headers



Peter Bancroft wrote:
> "No. But it may be the reason why almost all "serious"
>  development is done in C."

     I agree.  And while I doubt that FB^3 will ever have a shot at 
rushing past C or C++ in a popularity contest, I do feel that 
FutureBASIC is quite a capable, easy to use, language and set of 
development tools.  And yet it can create code that runs very near the 
top of the speed curve.

     To be honest, every frustration I've ever had with FutureBASIC (and 
there haven't been many) comes about when I try to do something that's 
not, well, basic.  As I mentioned, the latest problem I've run into 
revolves around my need to transfer information across the internet.  I 
fully understand and accept that I have to dig into Apple's 
documentation in order to understand how the process works (actually, I 
rather enjoy it).  I just wish I didn't also have to build the bridge 
between FB^3 and the OS.

Robert Purves wrote:
> "Not at all off the mark. Unfortunately, header files
>  contain not just function prototypes ('Toolbox' functions)
>  but also:
>   structures
>   constants (usually as enum)
>   macro definitions
>   macro invocations
>   conditional compilation based on flags unknown to FB

     A little under two years ago I was well into writing such a tool.  
I didn't know about Waverly Edwards', "Toolbox Helper" at that time.  
But once I realized that someone else was doing the same work that I 
was, and that Waverly's approach seemed at least as comprehensive as 
mine was at that time, I stopped.

     To a large degree, I had addressed all of the issues you listed 
except those related to macros.  I'm afraid that I don't know enough C 
to know how to deal with these chunks of coded reality.

Robert Purves also wrote:
> "Dealing with these can be more difficult than translating
>  function prototypes; human intervention is sometimes
>  required."

     I don't know that I can disagree with you.  And certainly Heather 
agrees (and for good reason).

     But I have to ask, if a machine is expected to "interpret and 
compile" the original C-Format header file (as a C compiler must in 
order to do its job), can't a machine be made to "interpret and 
convert" that same source file?

     As I've mentioned before, it's one thing to jot down a quick 
sentence about how easy something should be, but quite another to 
actually create a working program.  And by the way, I'm not even 
thinking that it'd be easy.  I'm only suggesting that it's doable.

>>     <*> <*> <*> <*> <*> <*> <*> <*> <*> <*>

     As a quick side note, my initial question really centered on this 
question: If it were possible to have access to all of the Universal 
Header files in a form that we FB^3'ers could use, would it then be a 
good idea to start weeding out all of the partial headers that we now 
use?

     Thanks, folks!

     -Rick

     PS  In case anyone cares, the reason I ask these
         questions is not because I don't like FutureBASIC.
         On the contrary, I think that FB^3 is great!  I
         simply feel there is so much more it can be used
         for.

_


--
To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>