Commit 2a912f00 authored by Stefan Behnel's avatar Stefan Behnel

support interdependencies between utility code fragments

parent df9b6431
...@@ -419,6 +419,9 @@ class GlobalState(object): ...@@ -419,6 +419,9 @@ class GlobalState(object):
""" """
if name is None: name = id(utility_code) if name is None: name = id(utility_code)
if self.check_utility_code_needed_and_register(name): 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: if utility_code.proto:
self.utilprotowriter.put(utility_code.proto) self.utilprotowriter.put(utility_code.proto)
if utility_code.impl: if utility_code.impl:
......
...@@ -92,11 +92,12 @@ def long_literal(value): ...@@ -92,11 +92,12 @@ def long_literal(value):
# a simple class that simplifies the usage of utility code # a simple class that simplifies the usage of utility code
class UtilityCode(object): 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.proto = proto
self.impl = impl self.impl = impl
self.init = init self.init = init
self.cleanup = cleanup self.cleanup = cleanup
self.requires = requires
def write_init_code(self, writer, pos): def write_init_code(self, writer, pos):
if not self.init: if not self.init:
......
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