header_bottom.py 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python3
  2. # ex: set filetype=python:
  3. """Generate header bottom boilerplate"""
  4. import os.path
  5. import time
  6. from generators import Boilerplate, header_guard_infix
  7. from generators import create_jinja2_environment, get_jinja2_template
  8. from xdr_ast import Specification
  9. class XdrHeaderBottomGenerator(Boilerplate):
  10. """Generate header boilerplate"""
  11. def __init__(self, language: str, peer: str):
  12. """Initialize an instance of this class"""
  13. self.environment = create_jinja2_environment(language, "header_bottom")
  14. self.peer = peer
  15. def emit_declaration(self, filename: str, root: Specification) -> None:
  16. """Emit the bottom header guard"""
  17. template = get_jinja2_template(self.environment, "declaration", "header")
  18. print(template.render(infix=header_guard_infix(filename)))
  19. def emit_definition(self, filename: str, root: Specification) -> None:
  20. """Emit the bottom header guard"""
  21. template = get_jinja2_template(self.environment, "definition", "header")
  22. print(template.render(infix=header_guard_infix(filename)))
  23. def emit_source(self, filename: str, root: Specification) -> None:
  24. pass