View previous topic :: View next topic |
Author |
Message |
revcompgeek
Joined: 24 Nov 2007 Posts: 27
|
Posted: Sat May 17, 2008 11:53 pm Post subject: Derelict automation? |
|
|
How difficult would it be to make a program that would read a shared library or the source code to one to figure out the constants and functions used in the library, and generate a file for them? I don't know too much about this, but it seems reasonable. |
|
Back to top |
|
|
Cyborg16
Joined: 28 Apr 2007 Posts: 39
|
Posted: Sun May 18, 2008 10:38 am Post subject: |
|
|
To do it properly (i.e. so that it works in all cases it should) would require a fair bit of the tokenization and semantic analysis of a compiler so wouldn't be trivial. But maybe for analysing many C headers something rather simpler might suffice? Not very helpful I guess.
I was thinking about something like that when going through the freetype update but never got around to it. But if you want to try I'd suggest starting with something relatively simple like a script/program to convert a list of #defines to an enum (at least in cases where the provided constant isn't produced from macros). |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Sun May 18, 2008 7:18 pm Post subject: |
|
|
There have been several little scripts cobbled together to do something like this, some of them specifically for Derelict (though often not publicly released). One general case program I recall was h2d, or some such. A forum search should turn up some stuff.
The difficulty comes in handling the corner cases, particularly with things like macros and bitfields. I initially thought about creating this sort of script when I first started out with Derelict, but I prefer to do it all by hand. Most of the libraries we bind to have very little to convert. OpenGL and SDL being the exception. I have a copy-paste system that I'm used to now that goes rather quickly when I want to convert something so I really have no interest in anything like this. Most packages can be knocked together inside of 30 minutes. Other people who contribute to Derelict, or make Derelict-like bindings, rarely do more than one or two packages. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
Cyborg16
Joined: 28 Apr 2007 Posts: 39
|
Posted: Wed May 21, 2008 4:26 am Post subject: |
|
|
Hmm, think I spent rather longer than 30 minutes on freetype. Some basic scripts to handle all the common conversions would have helped, but as aldacron says there'd be little point in trying to get a script to handle everything. |
|
Back to top |
|
|
|