First version of the code generation code.

This is going to change a bunch: currently there is no support for
active binding functions, data members (or apparent data members),
and most importantly for templated classes.