20 June 2005

Learning PERL to do Ruby?

I’m looking at whomping up a project called GIRLS, the Gimp Interface to Ruby Language Scripting, and it makes sense to me to auto-generate as much of the actual bindings code as possible.

Ruby returns multiple values, so it looks like it’s a better fit to the various GIMP functions than C or Python.

However, the incestuous PERL code in tools/pdbgen/ which the hard-working, bright and patient JamesH has in part mutated to do some of the heavy lifting for his gimp-python extension is threatening to make my head explode. Stuff like...

# The actual parser (in a string so we can eval it in another namespace)

...for a parser that does what? Why, writes hunks of PERL code out for later execution, of course.

It looks like being easier for me to post-process the .pdb files to cherry-pick the information I want. It might be simpler to post-process the C headers instead, but some information gets filed off on the way to becoming a C header. In many cases it should be easy enough to guess which are inputs and which are outputs (const anything is an input, anything not a pointer is an input, all other simple types are likely outputs, structures can be guessed as usually inputs). Or possibly parse the .pdbs for hints and then parse the .h files with those hints in hand. Urgh.

Surely there’s a simpler method? Somewhere in this convoluted and cross-referential stack of Makefiles, there must be an easier control point. But if JamesH didn’t find one, my hopes are not high.

No comments: