james dot milne at mac dot com wrote:
>
> On 30 Sep, 2004, at 22:55, Aaron Ballman wrote:
>
>>> How about a little pseudo-compiler than can take a header file, suck
>>> out all the constants, and write declares for the functions? To get
>>> the right library, it would plow through DLLs in a folder. That way,
>>> these things would be header file oriented rather than library
>>> oriented and we could apply it to other kits that come along. I'd
>>> help.
>>
>> I've thought about this approach, but after having seen the Windows
>> header files, I don't feel like writing a C compiler just to spit out
>> RB declares (which is effectively what we would need to do).
>
> I agree. Aaron and I discussed this a little, since it was kinda
> originally my idea to do this Win32 API library. The problem with your
> suggestion Brad is the use of the word "little" in the same context as
> "compiler". For C/C++, there is no such thing :-)
I'd agree that there is no such thing as a "little C++ compiler", or even a
"little C++ parser", but C is a lot simpler. Do the Win32 API libraries use
any C++ language features? I wrote an app once that did almost exactly what
you've described, but for 68k-era Mac OS Toolbox headers. It wasn't that big
a deal; I think I spent about a month's worth of free time writing the
parser and macro preprocessor.
In addition, there are freely available C grammars suitable for use with
bison or yacc. If you're willing to write the translation app in C, or at
least write the core of the translation algorithm in C as an RB plugin, you
can pretty much skip the parser and just write the data tables and code
generator. I won't claim it would be trivial, but it's nowhere near the
complexity of a real compiler, and it would be a good introductory project
for someone who is interested in compiler techniques.
What's more, a parser-driven approach doesn't have to be platform specific;
a single tool could generate Declare statements for header files from Mac
OS, Windows, or Linux.
Mars Saxman
REAL Software
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|