Skip to content

Commit

Permalink
Binary exporter support for structs.
Browse files Browse the repository at this point in the history
Based on #420

Signed-off-by: Ulf Bjorkengren <[email protected]>
Signed-off-by: Erik Jaegervall <[email protected]>
  • Loading branch information
erikbosch committed Nov 11, 2024
1 parent 4e5aca0 commit 630f724
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/vss_tools/exporters/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def export_node(node: VSSNode, f: BinaryIO):
@clo.overlays_opt
@clo.quantities_opt
@clo.units_opt
@clo.types_opt
@clo.types_output_opt
def cli(
vspec: Path,
output: Path,
Expand All @@ -121,22 +123,32 @@ def cli(
overlays: tuple[Path],
quantities: tuple[Path],
units: tuple[Path],
types: tuple[Path],
types_output: Path | None,
):
"""
Export to Binary.
"""

tree, _ = get_trees(
tree, datatype_tree = get_trees(
vspec=vspec,
include_dirs=include_dirs,
aborts=aborts,
strict=strict,
extended_attributes=extended_attributes,
quantities=quantities,
units=units,
types=types,
overlays=overlays,
)

log.info("Generating binary output...")
if datatype_tree:
if types_output:
with open(str(types_output), "wb") as f:
export_node(datatype_tree, f)
log.info("Binary datatype tree output generated in %s", types_output)
else:
log.warning("Ignoring type tree generation as no file name specified")
with open(str(output), "wb") as f:
export_node(tree, f)
log.info("Binary output generated in %s", output)
log.info("Binary main tree output generated in %s", output)

0 comments on commit 630f724

Please sign in to comment.