if dtype.is_error: return
complex_possible = dtype.is_struct_or_union and dtype.can_be_complex()
+ code = proto.globalstate['typeinfo']
+
if maxdepth <= 0:
assert False
assert len(fields) > 0
types = [get_type_information_cname(proto, f.type, maxdepth - 1)
for f in fields]
- impl.putln("static __Pyx_StructField %s[] = {" % structinfo_name, safe=True)
+ code.putln("static __Pyx_StructField %s[] = {" % structinfo_name, safe=True)
for f, typeinfo in zip(fields, types):
- impl.putln(' {&%s, "%s", offsetof(%s, %s)},' %
+ code.putln(' {&%s, "%s", offsetof(%s, %s)},' %
(typeinfo, f.name, dtype.declaration_code(""), f.cname), safe=True)
- impl.putln(' {NULL, NULL, 0}', safe=True)
- impl.putln("};", safe=True)
+ code.putln(' {NULL, NULL, 0}', safe=True)
+ code.putln("};", safe=True)
else:
assert False
print dtype
assert False
- proto.putln('static __Pyx_TypeInfo %s;' % name)
- impl.putln(('static __Pyx_TypeInfo %s = { "%s", %s, sizeof(%s), \'%s\' };'
+ code.putln(('static __Pyx_TypeInfo %s = { "%s", %s, sizeof(%s), \'%s\' };'
) % (name,
rep,
structinfo_name,
self.generate_interned_string_decls(env, code)
self.generate_py_string_decls(env, code)
- code = globalstate['after_global_var']
+ code = globalstate['all_the_rest']
self.generate_cached_builtins_decls(env, code)
self.body.generate_function_definitions(env, code)
self.generate_filename_table(code)
self.generate_utility_functions(env, code, h_code)
- self.generate_declarations_for_modules(env, modules, h_code)
+ self.generate_declarations_for_modules(env, modules, globalstate)
h_code.write('\n')
globalstate.close_global_decls()
self.generate_exttype_vtable_struct(entry, code)
self.generate_exttype_vtabptr_declaration(entry, code)
- def generate_declarations_for_modules(self, env, modules, code):
- code.putln("")
- code.putln("/* Type declarations */")
+ def generate_declarations_for_modules(self, env, modules, globalstate):
+ typecode = globalstate['type_declarations']
+ typecode.putln("")
+ typecode.putln("/* Type declarations */")
vtab_list, vtabslot_list = self.sort_type_hierarchy(modules, env)
self.generate_type_definitions(
- env, modules, vtab_list, vtabslot_list, code)
+ env, modules, vtab_list, vtabslot_list, typecode)
+ modulecode = globalstate['module_declarations']
for module in modules:
defined_here = module is env
- code.putln("/* Module declarations from %s */" %
+ modulecode.putln("/* Module declarations from %s */" %
module.qualified_name.encode("ASCII", "ignore"))
- self.generate_global_declarations(module, code, defined_here)
- self.generate_cfunction_predeclarations(module, code, defined_here)
+ self.generate_global_declarations(module, modulecode, defined_here)
+ self.generate_cfunction_predeclarations(module, modulecode, defined_here)
def generate_module_preamble(self, env, cimported_modules, code):
code.putln('/* Generated by Cython %s on %s */' % (