From: Stefan Behnel Date: Fri, 13 Mar 2009 22:24:36 +0000 (+0100) Subject: support interdependencies between utility code fragments X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2a912f00b623ff0686fc727124379088f1f204ad;p=cython.git support interdependencies between utility code fragments --- diff --git a/Cython/Compiler/Code.py b/Cython/Compiler/Code.py index aad42442..aa77a037 100644 --- a/Cython/Compiler/Code.py +++ b/Cython/Compiler/Code.py @@ -419,6 +419,9 @@ class GlobalState(object): """ if name is None: name = id(utility_code) if self.check_utility_code_needed_and_register(name): + if utility_code.requires: + for dependency in utility_code.requires: + self.use_utility_code(dependency) if utility_code.proto: self.utilprotowriter.put(utility_code.proto) if utility_code.impl: diff --git a/Cython/Utils.py b/Cython/Utils.py index a54070b2..811ad4e9 100644 --- a/Cython/Utils.py +++ b/Cython/Utils.py @@ -92,11 +92,12 @@ def long_literal(value): # a simple class that simplifies the usage of utility code class UtilityCode(object): - def __init__(self, proto=None, impl=None, init=None, cleanup=None): + def __init__(self, proto=None, impl=None, init=None, cleanup=None, requires=None): self.proto = proto self.impl = impl self.init = init self.cleanup = cleanup + self.requires = requires def write_init_code(self, writer, pos): if not self.init: