loci: move init/new function definitions to the class's file
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index 8450a20..7d3e0d7 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -542,7 +542,6 @@
 
 """)
     gen_object_enum_str(out)
-    gen_new_function_definitions(out)
     gen_init_map(out)
     out.write("\n/* This code should be broken out to a different file */\n")
     gen_setup_from_add_fns(out)
@@ -2829,20 +2828,17 @@
         else:
             instantiate_fn_ptrs(cls, 4, out)
 
-def gen_new_function_definitions(out):
+def gen_new_function_definitions(out, cls):
     """
     Generate the new operator for all classes
 
     @param out The file to which to write the functions
     """
 
-    out.write("\n/* New operators for each message class */\n")
-    for cls in of_g.standard_class_order:
-        out.write("\n/* New operators for %s */\n" % cls)
-        gen_new_fn_body(cls, out)
-        gen_init_fn_body(cls, out)
-        if loxi_utils.class_is_message(cls):
-            gen_from_message_fn_body(cls, out)
+    gen_new_fn_body(cls, out)
+    gen_init_fn_body(cls, out)
+    if loxi_utils.class_is_message(cls):
+        gen_from_message_fn_body(cls, out)
 
 def gen_init_map(out):
     """
diff --git a/c_gen/codegen.py b/c_gen/codegen.py
index d607626..9ec54d0 100644
--- a/c_gen/codegen.py
+++ b/c_gen/codegen.py
@@ -85,6 +85,7 @@
         with template_utils.open_output(install_dir, "loci/src/%s.c" % uclass.name) as out:
             util.render_template(out, "class.c")
             # Append legacy generated code
+            c_code_gen.gen_new_function_definitions(out, uclass.name)
             c_code_gen.gen_accessor_definitions(out, uclass.name)
 
 def generate_lists(install_dir):
@@ -92,4 +93,5 @@
         with template_utils.open_output(install_dir, "loci/src/%s.c" % cls) as out:
             util.render_template(out, "class.c")
             # Append legacy generated code
+            c_code_gen.gen_new_function_definitions(out, cls)
             c_code_gen.gen_list_accessors(out, cls)