Commit d18a809b authored by Robert Bradshaw's avatar Robert Bradshaw

Cleanup filename listing.

parent 0ca51142
...@@ -407,6 +407,7 @@ class GlobalState(object): ...@@ -407,6 +407,7 @@ class GlobalState(object):
code_layout = [ code_layout = [
'h_code', 'h_code',
'filename_table',
'utility_code_proto_before_types', 'utility_code_proto_before_types',
'numeric_typedefs', # Let these detailed individual parts stay!, 'numeric_typedefs', # Let these detailed individual parts stay!,
'complex_type_declarations', # as the proper solution is to make a full DAG... 'complex_type_declarations', # as the proper solution is to make a full DAG...
...@@ -425,7 +426,6 @@ class GlobalState(object): ...@@ -425,7 +426,6 @@ class GlobalState(object):
'cleanup_globals', 'cleanup_globals',
'cleanup_module', 'cleanup_module',
'main_method', 'main_method',
'filename_table',
'utility_code_def', 'utility_code_def',
'end' 'end'
] ]
...@@ -484,11 +484,6 @@ class GlobalState(object): ...@@ -484,11 +484,6 @@ class GlobalState(object):
code.write('\n#line 1 "cython_utility"\n') code.write('\n#line 1 "cython_utility"\n')
code.putln("") code.putln("")
code.putln("/* Runtime support code */") 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): def finalize_main_c_code(self):
self.close_global_decls() self.close_global_decls()
......
...@@ -279,7 +279,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -279,7 +279,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.mark_pos(None) code.mark_pos(None)
self.generate_typeobj_definitions(env, code) self.generate_typeobj_definitions(env, code)
self.generate_method_table(env, code) self.generate_method_table(env, code)
self.generate_filename_init_prototype(code)
if env.has_import_star: if env.has_import_star:
self.generate_import_star(env, code) self.generate_import_star(env, code)
self.generate_pymoduledef_struct(env, code) self.generate_pymoduledef_struct(env, code)
...@@ -600,7 +599,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -600,7 +599,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln('static int %s = 0;' % Naming.clineno_cname) 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= %s;' % (Naming.cfilenm_cname, Naming.file_c_macro))
code.putln('static const char *%s;' % Naming.filename_cname) code.putln('static const char *%s;' % Naming.filename_cname)
code.putln('static const char **%s;' % Naming.filetable_cname)
# XXX this is a mess # XXX this is a mess
for utility_code in PyrexTypes.c_int_from_py_function.specialize_list: for utility_code in PyrexTypes.c_int_from_py_function.specialize_list:
...@@ -624,13 +622,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -624,13 +622,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
def generate_filename_table(self, code): def generate_filename_table(self, code):
code.putln("") 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: if code.globalstate.filename_list:
for source_desc in code.globalstate.filename_list: for source_desc in code.globalstate.filename_list:
filename = os.path.basename(source_desc.get_filenametable_entry()) filename = os.path.basename(source_desc.get_filenametable_entry())
escaped_filename = filename.replace("\\", "\\\\").replace('"', r'\"') escaped_filename = filename.replace("\\", "\\\\").replace('"', r'\"')
code.putln('"%s",' % code.putln('"%s",' % escaped_filename)
escaped_filename)
else: else:
# Some C compilers don't like an empty array # Some C compilers don't like an empty array
code.putln("0") code.putln("0")
...@@ -1581,10 +1578,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1581,10 +1578,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln( 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): def generate_import_star(self, env, code):
env.use_utility_code(streq_utility_code) env.use_utility_code(streq_utility_code)
code.putln() code.putln()
...@@ -1675,8 +1668,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1675,8 +1668,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("__pyx_refnanny = __Pyx_RefNanny->SetupContext(\"%s\", __LINE__, __FILE__);"% header3) code.putln("__pyx_refnanny = __Pyx_RefNanny->SetupContext(\"%s\", __LINE__, __FILE__);"% header3)
code.putln("#endif") 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("%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("#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))); code.putln("%s = PyString_FromStringAndSize(\"\", 0); %s" % (Naming.empty_bytes, code.error_goto_if_null(Naming.empty_bytes, self.pos)));
...@@ -1816,9 +1807,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1816,9 +1807,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
module_is_main = "%s%s" % (Naming.module_is_main, self.full_module_name.replace('.', '__')) 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)) 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): def generate_pymoduledef_struct(self, env, code):
if env.doc: if env.doc:
doc = "__Pyx_DOCSTR(%s)" % code.get_string_const(env.doc) doc = "__Pyx_DOCSTR(%s)" % code.get_string_const(env.doc)
......
...@@ -59,8 +59,6 @@ dummy_cname = pyrex_prefix + "dummy" ...@@ -59,8 +59,6 @@ dummy_cname = pyrex_prefix + "dummy"
filename_cname = pyrex_prefix + "filename" filename_cname = pyrex_prefix + "filename"
modulename_cname = pyrex_prefix + "modulename" modulename_cname = pyrex_prefix + "modulename"
filetable_cname = pyrex_prefix + "f" filetable_cname = pyrex_prefix + "f"
filenames_cname = pyrex_prefix + "filenames"
fileinit_cname = pyrex_prefix + "init_filenames"
intern_tab_cname = pyrex_prefix + "intern_tab" intern_tab_cname = pyrex_prefix + "intern_tab"
kwds_cname = pyrex_prefix + "kwds" kwds_cname = pyrex_prefix + "kwds"
lineno_cname = pyrex_prefix + "lineno" lineno_cname = pyrex_prefix + "lineno"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment