Removed dead transform prototype code
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Mon, 4 Aug 2008 08:14:26 +0000 (10:14 +0200)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Mon, 4 Aug 2008 08:14:26 +0000 (10:14 +0200)
Cython/Compiler/CmdLine.py
Cython/Compiler/Main.py
Cython/Compiler/ModuleNode.py
Cython/Compiler/Nodes.py

index 3275a224aeb83a58bb78b7264bac5e2155ac8304..fb63b8af0c059825253df594059666c687a019ad 100644 (file)
@@ -44,37 +44,12 @@ Options:
 #  -+, --cplus      Use C++ compiler for compiling and linking
 #  Additional .o files to link may be supplied when using -X."""
 
-#The following options are very experimental and is used for plugging in code
-#into different transform stages.
-#  -T phase:factory At the phase given, hand off the tree to the transform returned
-#                   when calling factory without arguments. Factory should be fully
-#                   specified (ie Module.SubModule.factory) and the containing module
-#                   will be imported. This option can be repeated to add more transforms,
-#                   transforms for the same phase will be used in the order they are given.
-
 def bad_usage():
     sys.stderr.write(usage)
     sys.exit(1)
 
 def parse_command_line(args):
 
-    def parse_add_transform(transforms, param):
-        from Main import PHASES
-        def import_symbol(fqn):
-            modsplitpt = fqn.rfind(".")
-            if modsplitpt == -1: bad_usage()
-            modulename = fqn[:modsplitpt]
-            symbolname = fqn[modsplitpt+1:]
-            module = __import__(modulename, globals(), locals(), [symbolname])
-            return getattr(module, symbolname)
-    
-        stagename, factoryname = param.split(":")
-        if not stagename in PHASES:
-            bad_usage()
-        factory = import_symbol(factoryname)
-        transform = factory()
-        transforms[stagename].append(transform)
-    
     from Cython.Compiler.Main import \
         CompilationOptions, default_options
 
@@ -135,9 +110,6 @@ def parse_command_line(args):
                 Options.annotate = True
             elif option == "--convert-range":
                 Options.convert_range = True
-            elif option.startswith("-T"):
-                parse_add_transform(options.transforms, get_param(option))
-                # Note: this can occur multiple times, each time appends
             else:
                 bad_usage()
         else:
index 2e994148d0b96a0bec0dc70f6bff6957ce013530..7f05fc25feea71d62a12dddf7d726a4fcc512ee9 100644 (file)
@@ -721,7 +721,6 @@ default_options = dict(
     generate_pxi = 0,
     working_path = "",
     recursive = 0,
-    transforms = None, # deprecated
     timestamps = None,
     verbose = 0,
     quiet = 0)
index e1b638e0801dd6f7de8012de127c008fde2204e8..2cb4d8ff1496b2e3db1207ce1baf11abb9af268c 100644 (file)
@@ -254,7 +254,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         code.globalstate.insert_global_var_declarations_into(code)
         
         self.generate_cached_builtins_decls(env, code)
-        self.body.generate_function_definitions(env, code, options.transforms)
+        self.body.generate_function_definitions(env, code)
         code.mark_pos(None)
         self.generate_typeobj_definitions(env, code)
         self.generate_method_table(env, code)
index e895f0e041e71cdf43261a2c92a6349ff74eebfb..99608afa3528a4278e56ce1a0f5270a2f1c2bb49 100644 (file)
@@ -260,10 +260,10 @@ class StatListNode(Node):
         for stat in self.stats:
             stat.analyse_expressions(env)
     
-    def generate_function_definitions(self, env, code, transforms):
+    def generate_function_definitions(self, env, code):
         #print "StatListNode.generate_function_definitions" ###
         for stat in self.stats:
-            stat.generate_function_definitions(env, code, transforms)
+            stat.generate_function_definitions(env, code)
             
     def generate_execution_code(self, code):
         #print "StatListNode.generate_execution_code" ###
@@ -289,7 +289,7 @@ class StatNode(Node):
     #        Emit C code for executable statements.
     #
     
-    def generate_function_definitions(self, env, code, transforms):
+    def generate_function_definitions(self, env, code):
         pass
     
     def generate_execution_code(self, code):
@@ -839,7 +839,7 @@ class FuncDefNode(StatNode, BlockNode):
         self.local_scope = lenv
         return lenv
                 
-    def generate_function_definitions(self, env, code, transforms):
+    def generate_function_definitions(self, env, code):
         import Buffer
 
         lenv = self.local_scope
@@ -985,7 +985,7 @@ class FuncDefNode(StatNode, BlockNode):
         # ----- Python version
         code.exit_cfunc_scope()
         if self.py_func:
-            self.py_func.generate_function_definitions(env, code, transforms)
+            self.py_func.generate_function_definitions(env, code)
         self.generate_optarg_wrapper_function(env, code)
         
     def put_stararg_decrefs(self, code):
@@ -2015,10 +2015,9 @@ class PyClassDefNode(ClassDefNode):
         #self.classobj.release_temp(env)
         #self.target.release_target_temp(env)
     
-    def generate_function_definitions(self, env, code, transforms):
+    def generate_function_definitions(self, env, code):
         self.generate_py_string_decls(self.scope, code)
-        self.body.generate_function_definitions(
-            self.scope, code, transforms)
+        self.body.generate_function_definitions(self.scope, code)
     
     def generate_execution_code(self, code):
         self.dict.generate_evaluation_code(code)
@@ -2134,11 +2133,11 @@ class CClassDefNode(ClassDefNode):
             scope = self.entry.type.scope
             self.body.analyse_expressions(scope)
     
-    def generate_function_definitions(self, env, code, transforms):
+    def generate_function_definitions(self, env, code):
         self.generate_py_string_decls(self.entry.type.scope, code)
         if self.body:
             self.body.generate_function_definitions(
-                self.entry.type.scope, code, transforms)
+                self.entry.type.scope, code)
     
     def generate_execution_code(self, code):
         # This is needed to generate evaluation code for
@@ -2172,8 +2171,8 @@ class PropertyNode(StatNode):
     def analyse_expressions(self, env):
         self.body.analyse_expressions(env)
     
-    def generate_function_definitions(self, env, code, transforms):
-        self.body.generate_function_definitions(env, code, transforms)
+    def generate_function_definitions(self, env, code):
+        self.body.generate_function_definitions(env, code)
 
     def generate_execution_code(self, code):
         pass