Commit 0aea8272 authored by Stefan Behnel's avatar Stefan Behnel

support enabling source annotation via CompilerOptions

parent ef9f1868
...@@ -351,6 +351,7 @@ default_options = dict( ...@@ -351,6 +351,7 @@ default_options = dict(
obj_only = 1, obj_only = 1,
cplus = 0, cplus = 0,
output_file = None, output_file = None,
annotate = False,
generate_pxi = 0, generate_pxi = 0,
transforms = Transform.TransformSet(), transforms = Transform.TransformSet(),
working_path = "") working_path = "")
......
...@@ -209,7 +209,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -209,7 +209,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
def generate_c_code(self, env, options, result): def generate_c_code(self, env, options, result):
modules = self.referenced_modules modules = self.referenced_modules
if Options.annotate: if Options.annotate or options.annotate:
code = Annotate.AnnotationCCodeWriter(StringIO()) code = Annotate.AnnotationCCodeWriter(StringIO())
else: else:
code = Code.CCodeWriter(StringIO()) code = Code.CCodeWriter(StringIO())
...@@ -239,14 +239,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -239,14 +239,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self.generate_declarations_for_modules(env, modules, code.h) self.generate_declarations_for_modules(env, modules, code.h)
f = open_new_file(result.c_file) f = open_new_file(result.c_file)
f.write(code.h.f.getvalue()) f.write(code.h.f.getvalue())
f.write("\n") f.write("\n")
f.write(code.f.getvalue()) f.write(code.f.getvalue())
f.close() f.close()
result.c_file_generated = 1 result.c_file_generated = 1
if Options.annotate: if Options.annotate or options.annotate:
self.annotate(code) self.annotate(code)
code.save_annotation(result.c_file[:-1] + "pyx") # change? code.save_annotation(result.c_file[:-1] + "pyx") # change?
......
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