loci: move per-class declarations to loci_classes.h

The goal is to free loci.h of dynamically generated code and turn it into a
static template.

Needed to move some declarations out of loci.h and into of_object.h, where they
really belonged anyway.
diff --git a/c_gen/codegen.py b/c_gen/codegen.py
index 158d9ce..3f8aaf4 100644
--- a/c_gen/codegen.py
+++ b/c_gen/codegen.py
@@ -33,6 +33,7 @@
 
 from collections import namedtuple
 from itertools import groupby
+from StringIO import StringIO
 import template_utils
 import loxi_globals
 import loxi_ir.ir as ir
@@ -94,6 +95,19 @@
             c_code_gen.gen_new_function_definitions(out, cls)
             c_code_gen.gen_accessor_definitions(out, cls)
 
+def generate_classes_header(install_dir):
+    # Collect legacy code
+    tmp = StringIO()
+    c_code_gen.gen_struct_typedefs(tmp)
+    c_code_gen.gen_new_function_declarations(tmp)
+    c_code_gen.gen_accessor_declarations(tmp)
+    c_code_gen.gen_generic_union(tmp)
+    c_code_gen.gen_generics(tmp)
+
+    with template_utils.open_output(install_dir, "loci/inc/loci/loci_classes.h") as out:
+        util.render_template(out, "loci_classes.h",
+            legacy_code=tmp.getvalue())
+
 def generate_lists(install_dir):
     for cls in of_g.ordered_list_objects:
         with template_utils.open_output(install_dir, "loci/src/%s.c" % cls) as out: