Commit 9f2c7664 authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Removed dead transform prototype code

parent eb3e1da1
...@@ -44,37 +44,12 @@ Options: ...@@ -44,37 +44,12 @@ Options:
# -+, --cplus Use C++ compiler for compiling and linking # -+, --cplus Use C++ compiler for compiling and linking
# Additional .o files to link may be supplied when using -X.""" # 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(): def bad_usage():
sys.stderr.write(usage) sys.stderr.write(usage)
sys.exit(1) sys.exit(1)
def parse_command_line(args): 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 \ from Cython.Compiler.Main import \
CompilationOptions, default_options CompilationOptions, default_options
...@@ -135,9 +110,6 @@ def parse_command_line(args): ...@@ -135,9 +110,6 @@ def parse_command_line(args):
Options.annotate = True Options.annotate = True
elif option == "--convert-range": elif option == "--convert-range":
Options.convert_range = True 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: else:
bad_usage() bad_usage()
else: else:
......
...@@ -721,7 +721,6 @@ default_options = dict( ...@@ -721,7 +721,6 @@ default_options = dict(
generate_pxi = 0, generate_pxi = 0,
working_path = "", working_path = "",
recursive = 0, recursive = 0,
transforms = None, # deprecated
timestamps = None, timestamps = None,
verbose = 0, verbose = 0,
quiet = 0) quiet = 0)
......
...@@ -254,7 +254,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -254,7 +254,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.globalstate.insert_global_var_declarations_into(code) code.globalstate.insert_global_var_declarations_into(code)
self.generate_cached_builtins_decls(env, 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) 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)
......
...@@ -260,10 +260,10 @@ class StatListNode(Node): ...@@ -260,10 +260,10 @@ class StatListNode(Node):
for stat in self.stats: for stat in self.stats:
stat.analyse_expressions(env) stat.analyse_expressions(env)
def generate_function_definitions(self, env, code, transforms): def generate_function_definitions(self, env, code):
#print "StatListNode.generate_function_definitions" ### #print "StatListNode.generate_function_definitions" ###
for stat in self.stats: for stat in self.stats:
stat.generate_function_definitions(env, code, transforms) stat.generate_function_definitions(env, code)
def generate_execution_code(self, code): def generate_execution_code(self, code):
#print "StatListNode.generate_execution_code" ### #print "StatListNode.generate_execution_code" ###
...@@ -289,7 +289,7 @@ class StatNode(Node): ...@@ -289,7 +289,7 @@ class StatNode(Node):
# Emit C code for executable statements. # Emit C code for executable statements.
# #
def generate_function_definitions(self, env, code, transforms): def generate_function_definitions(self, env, code):
pass pass
def generate_execution_code(self, code): def generate_execution_code(self, code):
...@@ -839,7 +839,7 @@ class FuncDefNode(StatNode, BlockNode): ...@@ -839,7 +839,7 @@ class FuncDefNode(StatNode, BlockNode):
self.local_scope = lenv self.local_scope = lenv
return lenv return lenv
def generate_function_definitions(self, env, code, transforms): def generate_function_definitions(self, env, code):
import Buffer import Buffer
lenv = self.local_scope lenv = self.local_scope
...@@ -985,7 +985,7 @@ class FuncDefNode(StatNode, BlockNode): ...@@ -985,7 +985,7 @@ class FuncDefNode(StatNode, BlockNode):
# ----- Python version # ----- Python version
code.exit_cfunc_scope() code.exit_cfunc_scope()
if self.py_func: 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) self.generate_optarg_wrapper_function(env, code)
def put_stararg_decrefs(self, code): def put_stararg_decrefs(self, code):
...@@ -2015,10 +2015,9 @@ class PyClassDefNode(ClassDefNode): ...@@ -2015,10 +2015,9 @@ class PyClassDefNode(ClassDefNode):
#self.classobj.release_temp(env) #self.classobj.release_temp(env)
#self.target.release_target_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.generate_py_string_decls(self.scope, code)
self.body.generate_function_definitions( self.body.generate_function_definitions(self.scope, code)
self.scope, code, transforms)
def generate_execution_code(self, code): def generate_execution_code(self, code):
self.dict.generate_evaluation_code(code) self.dict.generate_evaluation_code(code)
...@@ -2134,11 +2133,11 @@ class CClassDefNode(ClassDefNode): ...@@ -2134,11 +2133,11 @@ class CClassDefNode(ClassDefNode):
scope = self.entry.type.scope scope = self.entry.type.scope
self.body.analyse_expressions(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) self.generate_py_string_decls(self.entry.type.scope, code)
if self.body: if self.body:
self.body.generate_function_definitions( self.body.generate_function_definitions(
self.entry.type.scope, code, transforms) self.entry.type.scope, code)
def generate_execution_code(self, code): def generate_execution_code(self, code):
# This is needed to generate evaluation code for # This is needed to generate evaluation code for
...@@ -2172,8 +2171,8 @@ class PropertyNode(StatNode): ...@@ -2172,8 +2171,8 @@ class PropertyNode(StatNode):
def analyse_expressions(self, env): def analyse_expressions(self, env):
self.body.analyse_expressions(env) self.body.analyse_expressions(env)
def generate_function_definitions(self, env, code, transforms): def generate_function_definitions(self, env, code):
self.body.generate_function_definitions(env, code, transforms) self.body.generate_function_definitions(env, code)
def generate_execution_code(self, code): def generate_execution_code(self, code):
pass pass
......
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