From f3ac54ec42f264b8142e68a998833f5596ef6a5e Mon Sep 17 00:00:00 2001 From: Ulf Bjorkengren Date: Wed, 23 Oct 2024 16:22:47 +0200 Subject: [PATCH] Binary exporter support for structs. Signed-off-by: Ulf Bjorkengren --- src/vss_tools/exporters/binary.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/vss_tools/exporters/binary.py b/src/vss_tools/exporters/binary.py index 844984f4..9f8c3a19 100644 --- a/src/vss_tools/exporters/binary.py +++ b/src/vss_tools/exporters/binary.py @@ -115,6 +115,9 @@ def export_node(node: VSSNode, generate_uuid, f: BinaryIO): @clo.overlays_opt @clo.quantities_opt @clo.units_opt +@clo.types_opt +@clo.types_output_opt +@clo.extend_all_attributes_opt def cli( vspec: Path, output: Path, @@ -126,12 +129,15 @@ def cli( overlays: tuple[Path], quantities: tuple[Path], units: tuple[Path], + types: tuple[Path], + types_output: Path, + extend_all_attributes: bool, ): """ Export to Binary. """ - tree, _ = get_trees( + tree, datatype_tree = get_trees( vspec=vspec, include_dirs=include_dirs, aborts=aborts, @@ -140,9 +146,17 @@ def cli( uuid=uuid, 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, uuid, f) + log.info("Binary datatype tree output generated in %s", types_output) + with open(str(output), "wb") as f: export_node(tree, uuid, f) - log.info("Binary output generated in %s", output) + log.info("Binary main tree output generated in %s", output)