code_layout = [
'h_code',
+ 'filename_table',
'utility_code_proto_before_types',
'numeric_typedefs', # Let these detailed individual parts stay!,
'complex_type_declarations', # as the proper solution is to make a full DAG...
'cleanup_globals',
'cleanup_module',
'main_method',
- 'filename_table',
'utility_code_def',
'end'
]
code.write('\n#line 1 "cython_utility"\n')
code.putln("")
code.putln("/* Runtime support code */")
- code.putln("")
- code.putln("static void %s(void) {" % Naming.fileinit_cname)
- code.putln("%s = %s;" %
- (Naming.filetable_cname, Naming.filenames_cname))
- code.putln("}")
def finalize_main_c_code(self):
self.close_global_decls()
code.mark_pos(None)
self.generate_typeobj_definitions(env, code)
self.generate_method_table(env, code)
- self.generate_filename_init_prototype(code)
if env.has_import_star:
self.generate_import_star(env, code)
self.generate_pymoduledef_struct(env, code)
code.putln('static int %s = 0;' % Naming.clineno_cname)
code.putln('static const char * %s= %s;' % (Naming.cfilenm_cname, Naming.file_c_macro))
code.putln('static const char *%s;' % Naming.filename_cname)
- code.putln('static const char **%s;' % Naming.filetable_cname)
# XXX this is a mess
for utility_code in PyrexTypes.c_int_from_py_function.specialize_list:
def generate_filename_table(self, code):
code.putln("")
- code.putln("static const char *%s[] = {" % Naming.filenames_cname)
+ code.putln("static const char *%s[] = {" % Naming.filetable_cname)
if code.globalstate.filename_list:
for source_desc in code.globalstate.filename_list:
filename = os.path.basename(source_desc.get_filenametable_entry())
escaped_filename = filename.replace("\\", "\\\\").replace('"', r'\"')
- code.putln('"%s",' %
- escaped_filename)
+ code.putln('"%s",' % escaped_filename)
else:
# Some C compilers don't like an empty array
code.putln("0")
code.putln(
"};")
- def generate_filename_init_prototype(self, code):
- code.putln("");
- code.putln("static void %s(void); /*proto*/" % Naming.fileinit_cname)
-
def generate_import_star(self, env, code):
env.use_utility_code(streq_utility_code)
code.putln()
code.putln("__pyx_refnanny = __Pyx_RefNanny->SetupContext(\"%s\", __LINE__, __FILE__);"% header3)
code.putln("#endif")
- self.generate_filename_init_call(code)
-
code.putln("%s = PyTuple_New(0); %s" % (Naming.empty_tuple, code.error_goto_if_null(Naming.empty_tuple, self.pos)));
code.putln("#if PY_MAJOR_VERSION < 3");
code.putln("%s = PyString_FromStringAndSize(\"\", 0); %s" % (Naming.empty_bytes, code.error_goto_if_null(Naming.empty_bytes, self.pos)));
module_is_main = "%s%s" % (Naming.module_is_main, self.full_module_name.replace('.', '__'))
code.globalstate.use_utility_code(main_method.specialize(module_name=env.module_name, module_is_main=module_is_main))
- def generate_filename_init_call(self, code):
- code.putln("%s();" % Naming.fileinit_cname)
-
def generate_pymoduledef_struct(self, env, code):
if env.doc:
doc = "__Pyx_DOCSTR(%s)" % code.get_string_const(env.doc)