This section is the result of a cut & paste of the comment at
the beginning of
“codegen/py_codegen.py
”. It is *VERY*
incomplete. The ContentHandler
subclass which
drives the code generation is
xml_parse.CodeWriter
.
How the code is generated: every time the end of an object is
reached during the parsing of the xml tree, either the function
“add_object
” or the function
“add_class
” is called: the latter
when the object is a toplevel one, the former when it is not. In the
last case, “add_object
” calls the
appropriate ``writer'' function for the specific object, found in the
“obj_builders
” dictionary. Such function
accepts one argument, the CodeObject
representing
the object for which the code has to be written, and returns 3 lists of
strings, representing the lines to add to the
“__init__
”,
“__set_properties
” and
“__do_layout
” methods of the
parent object.
The lines in the
“__init__
” list will be added in
reverse order.