I've been working on the generator code this week, though I haven't made quite as much progress in the last week as I had hoped. I ended up restarting a few times before I came up with a plan that I liked. The problem was that way the build system is set up, each etg script is run separately, without interacting with one another at all. This means that, for example, the generator handles the wxFrame class, it doesn't have any information about the wxWindow class (from which wxFrame derives.) That's fine for the sip generator since the generators outputs intermediary files which the sip executable processes. It's a problem for the cffi generator because it should output the actual C++ and Python files for the bindings. So the solution I settled on was to pickle the output of the etg scripts, and do the actual generation code in a separate step. By loading the pickles from scripts that are referenced in the one currently being processed, the generator can look up information about classes handled in other scripts or even other modules.
The next couple of weeks are going to be spent working on the generator script, I think. The only real unsolved problem there, I think, is figuring out how to correctly order the definition of classes in the Python code for inheritance and default parameters, among other things. I'll probably write about that in more detail next week when I know what I'll do about it.
No comments:
Post a Comment