Cleanup filename listing.
authorRobert Bradshaw <robertwb@math.washington.edu>
Sun, 31 Jan 2010 06:16:44 +0000 (22:16 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sun, 31 Jan 2010 06:16:44 +0000 (22:16 -0800)
Cython/Compiler/Code.py
Cython/Compiler/ModuleNode.py
Cython/Compiler/Naming.py

index 5d198835151948190edc5394fe244d26b5972d2f..83649323a8bee4199d490aa0e624edd856ae2647 100644 (file)
@@ -407,6 +407,7 @@ class GlobalState(object):
 
     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...
@@ -425,7 +426,6 @@ class GlobalState(object):
         'cleanup_globals',
         'cleanup_module',
         'main_method',
-        'filename_table',
         'utility_code_def',
         'end'
     ]
@@ -484,11 +484,6 @@ class GlobalState(object):
             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()
index d92cfdd18d50a0ba662b10ec10895490e4f90cf3..a716d4311c43e4473bca8cf0fe00c954b1f47c5d 100644 (file)
@@ -279,7 +279,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         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)
@@ -600,7 +599,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         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:
@@ -624,13 +622,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
     
     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")
@@ -1581,10 +1578,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
             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()
@@ -1675,8 +1668,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         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)));
@@ -1816,9 +1807,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         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)
index 7c4e465f4eb4322cce73874cdef4e14720b472f0..f9f710f1c71c96cf8b89d9de568e057543ba99f9 100644 (file)
@@ -59,8 +59,6 @@ dummy_cname      = pyrex_prefix + "dummy"
 filename_cname   = pyrex_prefix + "filename"
 modulename_cname = pyrex_prefix + "modulename"
 filetable_cname  = pyrex_prefix + "f"
-filenames_cname  = pyrex_prefix + "filenames"
-fileinit_cname   = pyrex_prefix + "init_filenames"
 intern_tab_cname = pyrex_prefix + "intern_tab"
 kwds_cname       = pyrex_prefix + "kwds"
 lineno_cname     = pyrex_prefix + "lineno"