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