headers for OpenGL, OpenAL, and SDL

Don Clugston dac at nospam.com.au
Tue Mar 7 03:27:25 PST 2006


Anders F Björklund wrote:
> Don Clugston wrote:
> 
>> I have a grandiose scheme for a C2D project, where rather than storing 
>> the converted headers (with associated licensing issues), we instead 
>> store the 'script' (actually more of a hint file) that was used for 
>> conversion.
> 
> Arguably, if those "scripts" are verbose enough they could be
> subject to the very same licensing issues as the header files... :-(

I guess that's possible, but they'll have very little information in 
them. Typically, just the names of a couple of the #defines, most of 
which are listed in external documentation, and which are used in 
samples. It's not a problem for the Windows SDK, because the MingW 
header script seems to work with the Microsoft files, too. I'm not sure 
about Carbon, though.
In any case, it will be clear that the source is not being redistributed.

Actually, though, my primary intention is to be able to keep up with 
open-source header changes, rather than avoid the license issues.

> But it would be neat to have for the old Mac OS headers (i.e. Carbon),
> in addition to the full Win32 SDK headers that I gather you're doing.

>> It would be fantastic to accumulate a database of C2D files.
> 
> Or have a better tool ? I guess you've looked at SWIG, by the way ?

Yes, it would be good to leverage off something else. Unfortunately, it 
seems that SWIG requires you to modify the header file. It would 
definitely be the way to go for C++ code, though.

>> Sample C2D script format (excerpt of part of the one that converts the 
>> Win SDK headers). There are a few other sections, apart from those 
>> shown here. The C2D program can't do the full Win SDK yet (I'm 
>> currently working out what to do with bitfields in structs), but it's 
>> OK for fairly simple headers right now.
> 
> Bitfields usually means writing wrapper accessors/mutators...
> But I guess that would be a bit hard to do automated, right ?

It's tricky, but possible. I might just cheat and require them to be 
defined manually for now.

> The Perl hack I used is at http://www.algonet.se/~afb/d/h2d.pl
> It doesn't preprocess and it doesn't parse. It just replaces...

C isn't too difficult to parse, fortunately. And _perfect_ parsing 
doesn't seem to be necessary (there's a huge advantage in knowing that 
the code is valid C).



More information about the Digitalmars-d-announce mailing list