# -+, --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
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:
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" ###
# 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):
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
# ----- 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):
#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)
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
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