1 #!/usr/bin/env python3 2 # ex: set filetype=python: 3 4 """Generate code to handle XDR constants""" 5 6 from generators import SourceGenerator, create_jinja2_environment 7 from xdr_ast import _XdrConstant 8 9 class XdrConstantGenerator(SourceGenerator): 10 """Generate source code for XDR constants""" 11 12 def __init__(self, language: str, peer: str): 13 """Initialize an instance of this class""" 14 self.environment = create_jinja2_environment(language, "constants") 15 self.peer = peer 16 17 def emit_definition(self, node: _XdrConstant) -> None: 18 """Emit one definition for a constant""" 19 template = self.environment.get_template("definition.j2") 20 print(template.render(name=node.name, value=node.value))
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.