cantools 45.1.2__tar.gz → 45.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cantools-45.1.2 → cantools-45.2.0}/PKG-INFO +1 -1
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/c_source.py +67 -18
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/database.py +66 -20
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/arxml/system_loader.py +12 -2
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/dbc/dbc_attribute.py +6 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/dbc/dbc_attribute_definition.py +12 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/dbc/dbc_loader.py +13 -2
- cantools-45.2.0/src/cantools/database/can/formats/dbc/dbc_specifics.py +142 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/dbc/dbc_writer.py +70 -6
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/sym.py +22 -4
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/utils.py +111 -39
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/logreader.py +17 -3
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/subparsers/__utils__.py +3 -1
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/subparsers/decode.py +1 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/subparsers/plot.py +2 -3
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/tester.py +4 -3
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/typechecking.py +5 -2
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools.egg-info/PKG-INFO +1 -1
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools.egg-info/SOURCES.txt +6 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools.egg-info/scm_file_list.json +6 -0
- cantools-45.2.0/src/cantools.egg-info/scm_version.json +8 -0
- cantools-45.2.0/tests/files/dbc/bus_fd_baudrate.dbc +50 -0
- cantools-45.2.0/tests/files/dbc/bus_fd_baudrate_alias.dbc +47 -0
- cantools-45.2.0/tests/files/dbc/c_keyword_signal_names.dbc +35 -0
- cantools-45.2.0/tests/files/sym/issue_205.sym +25 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/CMakeLists.txt +7 -1
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_command_line.py +64 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_database.py +357 -5
- cantools-45.2.0/tests/test_database_merge.py +447 -0
- cantools-45.2.0/tests/test_dbc_display_text.py +50 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_logreader.py +23 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_plot.py +9 -3
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_tester.py +84 -0
- cantools-45.1.2/src/cantools/database/can/formats/dbc/dbc_specifics.py +0 -82
- cantools-45.1.2/src/cantools.egg-info/scm_version.json +0 -8
- {cantools-45.1.2 → cantools-45.2.0}/.gitattributes +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/.github/FUNDING.yml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/.github/dependabot.yml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/.github/release.yml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/.github/workflows/pythonpackage.yml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/.gitignore +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/.readthedocs.yml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/LICENSE +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/MANIFEST.in +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/README.rst +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/docs/Makefile +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/docs/conf.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/docs/index.rst +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/docs/make.bat +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/docs/monitor.png +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/docs/plot-1.png +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/docs/plot-2-axes.png +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/docs/plot-2-subplots.png +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/docs/plot-seaborn.png +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/docs/requirements.txt +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/examples/dbc_io/dbc_input.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/examples/dbc_io/main.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/examples/diagnostics/did.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/examples/hello_world.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/examples/motor_tester/README.rst +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/examples/motor_tester/main.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/examples/motor_tester/motor.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/examples/motor_tester/system.kcd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/pyproject.toml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/setup.cfg +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/__main__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/autosar/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/autosar/end_to_end.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/autosar/secoc.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/autosar/snakeauth.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/bus.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/arxml/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/arxml/bus_specifics.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/arxml/database_specifics.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/arxml/ecu_extract_loader.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/arxml/end_to_end_properties.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/arxml/message_specifics.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/arxml/node_specifics.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/arxml/secoc_properties.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/arxml/utils.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/dbc/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/dbc/dbc_environment_variable.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/kcd.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/utils.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/internal_database.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/message.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/node.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/signal.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/signal_group.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/conversion.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/diagnostics/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/diagnostics/data.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/diagnostics/database.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/diagnostics/did.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/diagnostics/formats/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/diagnostics/formats/cdd.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/diagnostics/internal_database.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/errors.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/namedsignalvalue.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/errors.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/j1939.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/py.typed +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/subparsers/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/subparsers/convert.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/subparsers/dump/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/subparsers/dump/formatting.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/subparsers/generate_c_source.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/subparsers/list.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools/subparsers/monitor.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools.egg-info/dependency_links.txt +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools.egg-info/entry_points.txt +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools.egg-info/requires.txt +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/src/cantools.egg-info/top_level.txt +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/__init__.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/compu_method_no_category.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/ecu-extract-4.2.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-3.2.3.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-4.2.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-DAI-3.1.2.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-bad-root-tag-4.2.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-dangling-reference-4.2.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-float-limits-missing-compu-scale-4.2.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-float-values.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-illegal-namespace-4.2.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-illegal-root-4.2.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-illegal-version-4.2.2.1.0.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-missing-denominator-4.2.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-missing-factor-4.2.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/arxml/system-missing-rational-4.2.arxml +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/abs.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/abs.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/camel_case_empty.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/camel_case_empty.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/choices.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/choices.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/floating_point.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/floating_point.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/floating_point_bit_fields.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/floating_point_bit_fields.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/floating_point_use_float.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/floating_point_use_float.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/letter_terminated_can_id_6_0.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/letter_terminated_can_id_6_0.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/min_max_only_6_0.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/min_max_only_6_0.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk_bit_fields.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk_bit_fields.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk_no_floating_point_numbers.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk_no_floating_point_numbers.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk_sender_node.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk_sender_node.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk_sender_node_no_floating_point_numbers.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk_sender_node_no_floating_point_numbers.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk_use_round.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/motohawk_use_round.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/multiplex.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/multiplex.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/multiplex_2.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/multiplex_2.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/multiplex_2_fuzzer.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/multiplex_2_fuzzer.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/multiplex_2_fuzzer.mk +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/my_database_name.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/my_database_name.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/no_signals.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/no_signals.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/open_actuator.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/open_actuator.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/open_actuator_no_floating_point_numbers.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/open_actuator_no_floating_point_numbers.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/open_actuator_sender_node.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/open_actuator_sender_node.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/open_actuator_sender_node_no_floating_point_numbers.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/open_actuator_sender_node_no_floating_point_numbers.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/padding_bit_order.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/padding_bit_order.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/signed.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/signed.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/signed_bit_fields.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/signed_bit_fields.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/vehicle.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/c_source/vehicle.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/cdd/example-diddatarefs.cdd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/cdd/example.cdd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/cdd/invalid-bo-example.cdd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/cdd/le-example.cdd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/BU_BO_REL_.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/BU_BO_REL_Message.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/BU_EV_REL_.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/CamelCaseEmpty.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/abs.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/add_two_dbc_files_1.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/add_two_dbc_files_2.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/attribute_Event.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/attributes.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/bad_message_length.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/big_numbers.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/bus_comment.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/bus_comment_bare.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/bus_comment_bare_out.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/choices.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/choices_issue_with_name.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/comments_hex_and_motorola_converted_from_sym.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/cp1252.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/dump_signal_choices.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/emc32.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/empty_choice.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/empty_ns.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/environment_variable_data.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/environment_variable_multiple_access_nodes.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/fd_test.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/fd_test_int.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/floating_point.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/floating_point_use_float.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/foobar.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/is_in_phys_range.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_163_newline.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_168.DBC +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_184_extended_mux_cascaded.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_184_extended_mux_cascaded_dumped.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_184_extended_mux_independent_multiplexors.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_184_extended_mux_independent_multiplexors_dumped.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_184_extended_mux_multiple_values.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_184_extended_mux_multiple_values_dumped.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_199.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_199_extended.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_207_sig_plus.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_228.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_62.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_63.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_636_negative_scaling.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_725.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/issue_784.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/j1939.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/long_names.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/long_names_multiple_relations.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/long_names_multiple_relations_dumped.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/message-dlc-zero.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/mod_name_len_dest.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/mod_name_len_src.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/motohawk.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/motohawk_fd.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/motohawk_use_round.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/motohawk_with_comments.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/msxii_system_can.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/multiple_senders.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/multiplex.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/multiplex_2.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/multiplex_2_dumped.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/multiplex_choices.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/multiplex_choices_dumped.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/multiplex_dumped.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/no_sender.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/no_signals.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/open_actuator.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/padding_bit_order.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/relation_attributes.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/sig_groups.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/sig_groups_del.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/sig_groups_out.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/signed.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/socialledge-written-by-cantools-with-default-sort-signals.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/socialledge-written-by-cantools-with-sort-signals-by-name.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/socialledge-written-by-cantools.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/socialledge.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/string_attribute_escaping.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/test_extended_id_dump.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/test_multiplex_dump.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/timing.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/unquoted_attributes.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/val_table.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/variable_dlc.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/vehicle.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/dbc/vframeformat_int.dbc +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/kcd/auto_message_length.kcd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/kcd/bad_message_length.kcd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/kcd/dump.kcd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/kcd/empty.kcd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/kcd/message_layout.kcd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/kcd/signal_range.kcd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/kcd/tester.kcd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/kcd/the_homer.kcd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/kcd/vehicle.kcd +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/bad_message_length.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/big-endian.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/comments_hex_and_motorola.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/empty-6.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/empty-enum-6.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/issue_138.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/jopp-5.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/jopp-6.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/letter-terminated-can-id-6.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/min-max-only-6.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/multiplexed_variables.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/receive-6.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/send-6.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/sendreceive-6.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/signal-types-6.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/special-chars-6.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/test_extended_id_dump.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/test_multiline_enum.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/test_multiplex_dump.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/type-extended-cycle-dash-p.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/files/sym/variables-color-enum-6.0.sym +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_autosar.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/.gitignore +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_basic.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_basic.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_bit_fields.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_bit_fields.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_framework/CMakeLists.txt +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_framework/LICENSE.txt +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_framework/unity.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_framework/unity.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_framework/unity_internals.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_initial_values.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_initial_values.h +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_c_code/test_runner.c +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_conversion.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_convert.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_database_utils.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_diagnostics_database.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_dump.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_list.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_monitor.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_plot_unittests.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_plot_without_mock.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tests/test_sym_hex_numbers.py +0 -0
- {cantools-45.1.2 → cantools-45.2.0}/tox.ini +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import re
|
|
2
2
|
import time
|
|
3
3
|
import warnings
|
|
4
|
-
from collections.abc import Iterator
|
|
4
|
+
from collections.abc import Collection, Iterator
|
|
5
5
|
from typing import (
|
|
6
6
|
TYPE_CHECKING,
|
|
7
7
|
TypeVar,
|
|
@@ -636,12 +636,54 @@ INIT_SIGNAL_BODY_TEMPLATE_FMT = '''\
|
|
|
636
636
|
'''
|
|
637
637
|
|
|
638
638
|
|
|
639
|
+
# Keywords of C99 and the stdbool.h macros, which the generated header
|
|
640
|
+
# includes. A struct member or variable cannot take one of these names.
|
|
641
|
+
C_KEYWORDS = frozenset([
|
|
642
|
+
'auto', 'bool', 'break', 'case', 'char', 'const', 'continue', 'default',
|
|
643
|
+
'do', 'double', 'else', 'enum', 'extern', 'false', 'float', 'for', 'goto',
|
|
644
|
+
'if', 'inline', 'int', 'long', 'register', 'restrict', 'return', 'short',
|
|
645
|
+
'signed', 'sizeof', 'static', 'struct', 'switch', 'true', 'typedef',
|
|
646
|
+
'union', 'unsigned', 'void', 'volatile', 'while'
|
|
647
|
+
])
|
|
648
|
+
|
|
649
|
+
# Parameters of the pack and unpack functions, which share their scope
|
|
650
|
+
# with the variables declared in those functions.
|
|
651
|
+
PACK_UNPACK_PARAMETERS = frozenset(['dst_p', 'src_p', 'size'])
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
def _escape_name(name: str,
|
|
655
|
+
reserved: Collection[str],
|
|
656
|
+
taken_names: Collection[str]) -> str:
|
|
657
|
+
if name in reserved:
|
|
658
|
+
name += '_'
|
|
659
|
+
|
|
660
|
+
while name in taken_names:
|
|
661
|
+
name += '_'
|
|
662
|
+
|
|
663
|
+
return name
|
|
664
|
+
|
|
665
|
+
|
|
639
666
|
class CodeGenSignal:
|
|
640
667
|
|
|
641
|
-
def __init__(self,
|
|
668
|
+
def __init__(self,
|
|
669
|
+
signal: "Signal",
|
|
670
|
+
taken_names: Collection[str] = frozenset()) -> None:
|
|
642
671
|
self.signal: Signal = signal
|
|
643
672
|
self.snake_name = camel_to_snake_case(signal.name)
|
|
644
673
|
|
|
674
|
+
# Function and macro names have a prefix and keep the snake
|
|
675
|
+
# name. Two names do not, and get trailing underscores where
|
|
676
|
+
# needed, skipping the snake names of the other signals in
|
|
677
|
+
# the message (`taken_names`): `member_name` names the struct
|
|
678
|
+
# member, and `variable_name` the local variable that the pack
|
|
679
|
+
# and unpack functions declare for a signed or float signal.
|
|
680
|
+
self.member_name = _escape_name(self.snake_name,
|
|
681
|
+
C_KEYWORDS,
|
|
682
|
+
taken_names)
|
|
683
|
+
self.variable_name = _escape_name(self.member_name,
|
|
684
|
+
PACK_UNPACK_PARAMETERS,
|
|
685
|
+
taken_names)
|
|
686
|
+
|
|
645
687
|
@property
|
|
646
688
|
def unit(self) -> str:
|
|
647
689
|
return _get(self.signal.unit, '-')
|
|
@@ -840,7 +882,10 @@ class CodeGenMessage:
|
|
|
840
882
|
def __init__(self, message: "Message") -> None:
|
|
841
883
|
self.message = message
|
|
842
884
|
self.snake_name = camel_to_snake_case(message.name)
|
|
843
|
-
|
|
885
|
+
taken_names = {camel_to_snake_case(signal.name)
|
|
886
|
+
for signal in message.signals}
|
|
887
|
+
self.cg_signals = [CodeGenSignal(signal, taken_names)
|
|
888
|
+
for signal in message.signals]
|
|
844
889
|
|
|
845
890
|
def get_signal_by_name(self, name: str) -> "CodeGenSignal":
|
|
846
891
|
for cg_signal in self.cg_signals:
|
|
@@ -939,7 +984,7 @@ def _generate_signal(cg_signal: "CodeGenSignal", bit_fields: bool) -> str:
|
|
|
939
984
|
scale=scale,
|
|
940
985
|
offset=offset,
|
|
941
986
|
type_name=cg_signal.type_name,
|
|
942
|
-
name=cg_signal.
|
|
987
|
+
name=cg_signal.member_name,
|
|
943
988
|
length=length)
|
|
944
989
|
|
|
945
990
|
return member
|
|
@@ -957,11 +1002,11 @@ def _format_pack_code_mux(cg_message: "CodeGenMessage",
|
|
|
957
1002
|
variable_lines,
|
|
958
1003
|
helper_kinds)
|
|
959
1004
|
multiplexed_signals_per_id = sorted(multiplexed_signals.items())
|
|
960
|
-
|
|
1005
|
+
member_name = cg_message.get_signal_by_name(signal_name).member_name
|
|
961
1006
|
|
|
962
1007
|
lines = [
|
|
963
1008
|
'',
|
|
964
|
-
f'switch (src_p->{
|
|
1009
|
+
f'switch (src_p->{member_name}) {{'
|
|
965
1010
|
]
|
|
966
1011
|
|
|
967
1012
|
for multiplexer_id, signals_of_multiplexer_id in multiplexed_signals_per_id:
|
|
@@ -994,12 +1039,12 @@ def _format_pack_code_signal(cg_message: "CodeGenMessage",
|
|
|
994
1039
|
cg_signal = cg_message.get_signal_by_name(signal_name)
|
|
995
1040
|
|
|
996
1041
|
if cg_signal.signal.conversion.is_float or cg_signal.signal.is_signed:
|
|
997
|
-
variable = f' uint{cg_signal.type_length}_t {cg_signal.
|
|
1042
|
+
variable = f' uint{cg_signal.type_length}_t {cg_signal.variable_name};'
|
|
998
1043
|
|
|
999
1044
|
if cg_signal.signal.conversion.is_float:
|
|
1000
|
-
conversion = f' memcpy(&{cg_signal.
|
|
1045
|
+
conversion = f' memcpy(&{cg_signal.variable_name}, &src_p->{cg_signal.member_name}, sizeof({cg_signal.variable_name}));'
|
|
1001
1046
|
else:
|
|
1002
|
-
conversion = f' {cg_signal.
|
|
1047
|
+
conversion = f' {cg_signal.variable_name} = (uint{cg_signal.type_length}_t)src_p->{cg_signal.member_name};'
|
|
1003
1048
|
|
|
1004
1049
|
variable_lines.append(variable)
|
|
1005
1050
|
body_lines.append(conversion)
|
|
@@ -1007,13 +1052,15 @@ def _format_pack_code_signal(cg_message: "CodeGenMessage",
|
|
|
1007
1052
|
for index, shift, shift_direction, mask in cg_signal.segments(invert_shift=False):
|
|
1008
1053
|
if cg_signal.signal.conversion.is_float or cg_signal.signal.is_signed:
|
|
1009
1054
|
fmt = ' dst_p[{}] |= pack_{}_shift_u{}({}, {}u, 0x{:02x}u);'
|
|
1055
|
+
name = cg_signal.variable_name
|
|
1010
1056
|
else:
|
|
1011
1057
|
fmt = ' dst_p[{}] |= pack_{}_shift_u{}(src_p->{}, {}u, 0x{:02x}u);'
|
|
1058
|
+
name = cg_signal.member_name
|
|
1012
1059
|
|
|
1013
1060
|
line = fmt.format(index,
|
|
1014
1061
|
shift_direction,
|
|
1015
1062
|
cg_signal.type_length,
|
|
1016
|
-
|
|
1063
|
+
name,
|
|
1017
1064
|
shift,
|
|
1018
1065
|
mask)
|
|
1019
1066
|
body_lines.append(line)
|
|
@@ -1082,10 +1129,10 @@ def _format_unpack_code_mux(cg_message: "CodeGenMessage",
|
|
|
1082
1129
|
variable_lines,
|
|
1083
1130
|
helper_kinds)
|
|
1084
1131
|
multiplexed_signals_per_id = sorted(multiplexed_signals.items())
|
|
1085
|
-
|
|
1132
|
+
member_name = cg_message.get_signal_by_name(signal_name).member_name
|
|
1086
1133
|
|
|
1087
1134
|
lines = [
|
|
1088
|
-
f'switch (dst_p->{
|
|
1135
|
+
f'switch (dst_p->{member_name}) {{'
|
|
1089
1136
|
]
|
|
1090
1137
|
|
|
1091
1138
|
for multiplexer_id, signals_of_multiplexer_id in multiplexed_signals_per_id:
|
|
@@ -1117,7 +1164,7 @@ def _format_unpack_code_signal(cg_message: "CodeGenMessage",
|
|
|
1117
1164
|
conversion_type_name = f'uint{cg_signal.type_length}_t'
|
|
1118
1165
|
|
|
1119
1166
|
if cg_signal.signal.conversion.is_float or cg_signal.signal.is_signed:
|
|
1120
|
-
variable = f' {conversion_type_name} {cg_signal.
|
|
1167
|
+
variable = f' {conversion_type_name} {cg_signal.variable_name};'
|
|
1121
1168
|
variable_lines.append(variable)
|
|
1122
1169
|
|
|
1123
1170
|
segments = cg_signal.segments(invert_shift=True)
|
|
@@ -1125,10 +1172,12 @@ def _format_unpack_code_signal(cg_message: "CodeGenMessage",
|
|
|
1125
1172
|
for i, (index, shift, shift_direction, mask) in enumerate(segments):
|
|
1126
1173
|
if cg_signal.signal.conversion.is_float or cg_signal.signal.is_signed:
|
|
1127
1174
|
fmt = ' {} {} unpack_{}_shift_u{}(src_p[{}], {}u, 0x{:02x}u);'
|
|
1175
|
+
name = cg_signal.variable_name
|
|
1128
1176
|
else:
|
|
1129
1177
|
fmt = ' dst_p->{} {} unpack_{}_shift_u{}(src_p[{}], {}u, 0x{:02x}u);'
|
|
1178
|
+
name = cg_signal.member_name
|
|
1130
1179
|
|
|
1131
|
-
line = fmt.format(
|
|
1180
|
+
line = fmt.format(name,
|
|
1132
1181
|
'=' if i == 0 else '|=',
|
|
1133
1182
|
shift_direction,
|
|
1134
1183
|
cg_signal.type_length,
|
|
@@ -1139,20 +1188,20 @@ def _format_unpack_code_signal(cg_message: "CodeGenMessage",
|
|
|
1139
1188
|
helper_kinds.add((shift_direction, cg_signal.type_length))
|
|
1140
1189
|
|
|
1141
1190
|
if cg_signal.signal.conversion.is_float:
|
|
1142
|
-
conversion = f' memcpy(&dst_p->{cg_signal.
|
|
1191
|
+
conversion = f' memcpy(&dst_p->{cg_signal.member_name}, &{cg_signal.variable_name}, sizeof(dst_p->{cg_signal.member_name}));'
|
|
1143
1192
|
body_lines.append(conversion)
|
|
1144
1193
|
elif cg_signal.signal.is_signed:
|
|
1145
1194
|
mask = ((1 << (cg_signal.type_length - cg_signal.signal.length)) - 1)
|
|
1146
1195
|
|
|
1147
1196
|
if mask != 0:
|
|
1148
1197
|
mask <<= cg_signal.signal.length
|
|
1149
|
-
formatted = SIGN_EXTENSION_FMT.format(name=cg_signal.
|
|
1198
|
+
formatted = SIGN_EXTENSION_FMT.format(name=cg_signal.variable_name,
|
|
1150
1199
|
shift=cg_signal.signal.length - 1,
|
|
1151
1200
|
mask=mask,
|
|
1152
1201
|
suffix=cg_signal.conversion_type_suffix)
|
|
1153
1202
|
body_lines.extend(formatted.splitlines())
|
|
1154
1203
|
|
|
1155
|
-
conversion = f' dst_p->{cg_signal.
|
|
1204
|
+
conversion = f' dst_p->{cg_signal.member_name} = (int{cg_signal.type_length}_t){cg_signal.variable_name};'
|
|
1156
1205
|
body_lines.append(conversion)
|
|
1157
1206
|
|
|
1158
1207
|
|
|
@@ -1656,7 +1705,7 @@ def _generate_definitions(database_name: str,
|
|
|
1656
1705
|
|
|
1657
1706
|
if cg_signal.signal.initial:
|
|
1658
1707
|
signals_init_body += INIT_SIGNAL_BODY_TEMPLATE_FMT.format(signal_initial=cg_signal.signal.raw_initial,
|
|
1659
|
-
signal_name=cg_signal.
|
|
1708
|
+
signal_name=cg_signal.member_name)
|
|
1660
1709
|
|
|
1661
1710
|
if cg_message.message.length > 0:
|
|
1662
1711
|
pack_variables, pack_body = _format_pack_code(cg_message,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from collections import OrderedDict
|
|
3
|
+
from copy import copy
|
|
3
4
|
from typing import (
|
|
4
5
|
Any,
|
|
5
6
|
TextIO,
|
|
@@ -41,6 +42,16 @@ class Database:
|
|
|
41
42
|
If you don't want them to be sorted pass `sort_signals = None`.
|
|
42
43
|
If you want the signals to be sorted in another way pass something like
|
|
43
44
|
`sort_signals = lambda signals: list(sorted(signals, key=lambda sig: sig.name))`
|
|
45
|
+
|
|
46
|
+
Adding files combines their nodes, buses and format-specific metadata.
|
|
47
|
+
Nodes and buses with the same name retain their position and combine
|
|
48
|
+
comments by language; incoming comments, node attributes and non-``None``
|
|
49
|
+
bus properties take precedence. Incoming global attributes, value tables
|
|
50
|
+
and environment variables replace entries with the same key. DBC attribute
|
|
51
|
+
definitions, including defaults and relation definitions, must agree;
|
|
52
|
+
otherwise ``cantools.database.errors.Error`` is raised.
|
|
53
|
+
Messages are appended and duplicate message lookups use the
|
|
54
|
+
latest message. The version is replaced by the incoming version.
|
|
44
55
|
"""
|
|
45
56
|
|
|
46
57
|
def __init__(self,
|
|
@@ -289,12 +300,7 @@ class Database:
|
|
|
289
300
|
|
|
290
301
|
database = arxml.load_string(string, self._strict, sort_signals=self._sort_signals)
|
|
291
302
|
|
|
292
|
-
self.
|
|
293
|
-
self._nodes = database.nodes
|
|
294
|
-
self._buses = database.buses
|
|
295
|
-
self._version = database.version
|
|
296
|
-
self._dbc = database.dbc
|
|
297
|
-
self._autosar = database.autosar
|
|
303
|
+
self._add_database(database)
|
|
298
304
|
|
|
299
305
|
def add_dbc(self, fp: TextIO) -> None:
|
|
300
306
|
"""Read and parse DBC data from given file-like object and add the
|
|
@@ -336,11 +342,7 @@ class Database:
|
|
|
336
342
|
|
|
337
343
|
database = dbc.load_string(string, self._strict, sort_signals=self._sort_signals)
|
|
338
344
|
|
|
339
|
-
self.
|
|
340
|
-
self._nodes = database.nodes
|
|
341
|
-
self._buses = database.buses
|
|
342
|
-
self._version = database.version
|
|
343
|
-
self._dbc = database.dbc
|
|
345
|
+
self._add_database(database)
|
|
344
346
|
|
|
345
347
|
def add_kcd(self, fp: TextIO) -> None:
|
|
346
348
|
"""Read and parse KCD data from given file-like object and add the
|
|
@@ -371,11 +373,7 @@ class Database:
|
|
|
371
373
|
|
|
372
374
|
database = kcd.load_string(string, self._strict, sort_signals=self._sort_signals)
|
|
373
375
|
|
|
374
|
-
self.
|
|
375
|
-
self._nodes = database.nodes
|
|
376
|
-
self._buses = database.buses
|
|
377
|
-
self._version = database.version
|
|
378
|
-
self._dbc = database.dbc
|
|
376
|
+
self._add_database(database)
|
|
379
377
|
|
|
380
378
|
def add_sym(self, fp: TextIO) -> None:
|
|
381
379
|
"""Read and parse SYM data from given file-like object and add the
|
|
@@ -406,11 +404,59 @@ class Database:
|
|
|
406
404
|
|
|
407
405
|
database = sym.load_string(string, self._strict, sort_signals=self._sort_signals)
|
|
408
406
|
|
|
409
|
-
self.
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
self._add_database(database)
|
|
408
|
+
|
|
409
|
+
def _add_database(self, database: InternalDatabase) -> None:
|
|
410
|
+
# Prepare metadata first so incompatible definitions leave this database
|
|
411
|
+
# untouched, including its message list and lookup dictionaries.
|
|
412
|
+
dbc_specifics = self._dbc
|
|
413
|
+
if database.dbc is not None:
|
|
414
|
+
dbc_specifics = (database.dbc if dbc_specifics is None
|
|
415
|
+
else dbc_specifics._merge(database.dbc))
|
|
416
|
+
|
|
417
|
+
nodes: dict[str, Node] = {}
|
|
418
|
+
for node in [*self._nodes, *database.nodes]:
|
|
419
|
+
if node.name in nodes:
|
|
420
|
+
previous_node = nodes[node.name]
|
|
421
|
+
node = Node(
|
|
422
|
+
node.name,
|
|
423
|
+
comment={**(previous_node.comments or {}), **(node.comments or {})} or None,
|
|
424
|
+
dbc_specifics=previous_node.dbc._merge(node.dbc),
|
|
425
|
+
autosar_specifics=node.autosar)
|
|
426
|
+
nodes[node.name] = node
|
|
427
|
+
|
|
428
|
+
buses: dict[str, Bus] = {}
|
|
429
|
+
for bus in [*self._buses, *database.buses]:
|
|
430
|
+
if bus.name in buses:
|
|
431
|
+
previous_bus = buses[bus.name]
|
|
432
|
+
bus = Bus(
|
|
433
|
+
bus.name,
|
|
434
|
+
comment={**(previous_bus.comments or {}), **(bus.comments or {})} or None,
|
|
435
|
+
baudrate=(bus.baudrate if bus.baudrate is not None
|
|
436
|
+
else previous_bus.baudrate),
|
|
437
|
+
fd_baudrate=(bus.fd_baudrate if bus.fd_baudrate is not None
|
|
438
|
+
else previous_bus.fd_baudrate),
|
|
439
|
+
autosar_specifics=(bus.autosar if bus.autosar is not None
|
|
440
|
+
else previous_bus.autosar))
|
|
441
|
+
buses[bus.name] = bus
|
|
442
|
+
|
|
443
|
+
# Stage messages and lookups too: a late failure must not expose a
|
|
444
|
+
# partial addition while retaining the old metadata.
|
|
445
|
+
candidate = copy(self)
|
|
446
|
+
candidate._messages = self._messages.copy()
|
|
447
|
+
candidate._name_to_message = self._name_to_message.copy()
|
|
448
|
+
candidate._frame_id_to_message = self._frame_id_to_message.copy()
|
|
449
|
+
candidate._add_messages(database.messages)
|
|
450
|
+
|
|
451
|
+
self._messages[:] = candidate._messages
|
|
452
|
+
self._name_to_message = candidate._name_to_message
|
|
453
|
+
self._frame_id_to_message = candidate._frame_id_to_message
|
|
454
|
+
self._nodes = list(nodes.values())
|
|
455
|
+
self._buses = list(buses.values())
|
|
412
456
|
self._version = database.version
|
|
413
|
-
self._dbc =
|
|
457
|
+
self._dbc = dbc_specifics
|
|
458
|
+
if database.autosar is not None:
|
|
459
|
+
self._autosar = database.autosar
|
|
414
460
|
|
|
415
461
|
def _add_messages(self, messages: list[Message]) -> None:
|
|
416
462
|
"""Add given messages to the database.
|
{cantools-45.1.2 → cantools-45.2.0}/src/cantools/database/can/formats/arxml/system_loader.py
RENAMED
|
@@ -1849,13 +1849,23 @@ class SystemLoader:
|
|
|
1849
1849
|
self._get_unique_arxml_child(compu_scale, 'UPPER-LIMIT')
|
|
1850
1850
|
|
|
1851
1851
|
if lower_limit is not None:
|
|
1852
|
-
lower_limit =
|
|
1852
|
+
lower_limit = self._parse_scale_limit(lower_limit.text)
|
|
1853
1853
|
|
|
1854
1854
|
if upper_limit is not None:
|
|
1855
|
-
upper_limit =
|
|
1855
|
+
upper_limit = self._parse_scale_limit(upper_limit.text)
|
|
1856
1856
|
|
|
1857
1857
|
return lower_limit, upper_limit
|
|
1858
1858
|
|
|
1859
|
+
@staticmethod
|
|
1860
|
+
def _parse_scale_limit(text: str) -> int | float:
|
|
1861
|
+
# keep "0.0" an integer: text table limits are raw enum values
|
|
1862
|
+
limit = parse_number_string(text, allow_float=True)
|
|
1863
|
+
|
|
1864
|
+
if isinstance(limit, float) and limit.is_integer():
|
|
1865
|
+
return int(limit)
|
|
1866
|
+
|
|
1867
|
+
return limit
|
|
1868
|
+
|
|
1859
1869
|
def _load_scale_linear_and_texttable(self, compu_method, is_float):
|
|
1860
1870
|
minimum = None
|
|
1861
1871
|
maximum = None
|
|
@@ -60,5 +60,11 @@ class DbcAttribute(Generic[DbcAttributeValueTypeVar]):
|
|
|
60
60
|
def __repr__(self) -> str:
|
|
61
61
|
return f"attribute('{self.name}', {self.value})"
|
|
62
62
|
|
|
63
|
+
def __eq__(self, other: object) -> bool:
|
|
64
|
+
if not isinstance(other, DbcAttribute):
|
|
65
|
+
return NotImplemented
|
|
66
|
+
|
|
67
|
+
return self.definition == other.definition and self.value == other.value
|
|
68
|
+
|
|
63
69
|
|
|
64
70
|
DbcAttributeType = DbcAttribute[str] | DbcAttribute[int] | DbcAttribute[float]
|
|
@@ -117,4 +117,16 @@ class DbcAttributeDefinition(Generic[DbcAttributeValueTypeVar]):
|
|
|
117
117
|
def __repr__(self) -> str:
|
|
118
118
|
return f"attribute_definition('{self._name}', {self._default_value})"
|
|
119
119
|
|
|
120
|
+
def __eq__(self, other: object) -> bool:
|
|
121
|
+
if not isinstance(other, DbcAttributeDefinition):
|
|
122
|
+
return NotImplemented
|
|
123
|
+
|
|
124
|
+
return (self.name == other.name
|
|
125
|
+
and self.default_value == other.default_value
|
|
126
|
+
and self.kind == other.kind
|
|
127
|
+
and self.type_name == other.type_name
|
|
128
|
+
and self.minimum == other.minimum
|
|
129
|
+
and self.maximum == other.maximum
|
|
130
|
+
and self.choices == other.choices)
|
|
131
|
+
|
|
120
132
|
DbcAttributeDefinitionType = DbcAttributeDefinition[str] | DbcAttributeDefinition[int] | DbcAttributeDefinition[float]
|
|
@@ -1239,12 +1239,23 @@ def _load_bus(attributes: DbcAttributes, comments: DbcComments) -> Bus | None:
|
|
|
1239
1239
|
if bus_baudrate_attr is not None:
|
|
1240
1240
|
bus_baudrate = int(float(bus_baudrate_attr.value))
|
|
1241
1241
|
|
|
1242
|
+
# Prefer Vector's BaudrateCANFD; accept BaudrateFD as a compatibility alias.
|
|
1243
|
+
bus_fd_baudrate_attr = attributes.database.get('BaudrateCANFD')
|
|
1244
|
+
if bus_fd_baudrate_attr is None:
|
|
1245
|
+
bus_fd_baudrate_attr = attributes.database.get('BaudrateFD')
|
|
1246
|
+
bus_fd_baudrate = None
|
|
1247
|
+
if bus_fd_baudrate_attr is not None:
|
|
1248
|
+
bus_fd_baudrate = int(float(bus_fd_baudrate_attr.value))
|
|
1249
|
+
|
|
1242
1250
|
bus_comment = comments.bus
|
|
1243
1251
|
|
|
1244
|
-
if not any([bus_name, bus_baudrate, bus_comment]):
|
|
1252
|
+
if not any([bus_name, bus_baudrate, bus_fd_baudrate, bus_comment]):
|
|
1245
1253
|
return None
|
|
1246
1254
|
|
|
1247
|
-
return Bus(bus_name,
|
|
1255
|
+
return Bus(bus_name,
|
|
1256
|
+
baudrate=bus_baudrate,
|
|
1257
|
+
fd_baudrate=bus_fd_baudrate,
|
|
1258
|
+
comment=bus_comment)
|
|
1248
1259
|
|
|
1249
1260
|
|
|
1250
1261
|
def _load_nodes(tokens: DbcTokens, comments: DbcComments, attributes: DbcAttributes, attribute_definitions: OrderedDict[str, DbcAttributeDefinitionType]) -> list[Node] | None:
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Store the specific DBC format properties of objects
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections import OrderedDict
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
from ....errors import Error
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from cantools.typechecking import Choices
|
|
12
|
+
|
|
13
|
+
from .dbc_attribute import DbcAttributeType
|
|
14
|
+
from .dbc_attribute_definition import DbcAttributeDefinitionType
|
|
15
|
+
from .dbc_environment_variable import DbcEnvironmentVariable
|
|
16
|
+
from .dbc_loader import DbcRelationAttributes
|
|
17
|
+
|
|
18
|
+
class DbcSpecifics:
|
|
19
|
+
|
|
20
|
+
def __init__(self,
|
|
21
|
+
*,
|
|
22
|
+
attributes: OrderedDict[str, DbcAttributeType] | None = None,
|
|
23
|
+
attribute_definitions: OrderedDict[str, DbcAttributeDefinitionType] | None = None,
|
|
24
|
+
environment_variables: OrderedDict[str, DbcEnvironmentVariable] | None = None,
|
|
25
|
+
value_tables: OrderedDict[str, Choices] | None = None,
|
|
26
|
+
relation_attributes: DbcRelationAttributes | None = None,
|
|
27
|
+
relation_attribute_definitions: OrderedDict[str, DbcAttributeDefinitionType] | None = None) -> None:
|
|
28
|
+
self._attributes = attributes or OrderedDict()
|
|
29
|
+
self._attribute_definitions = attribute_definitions or OrderedDict()
|
|
30
|
+
self._environment_variables = environment_variables or OrderedDict()
|
|
31
|
+
self._value_tables = value_tables or OrderedDict()
|
|
32
|
+
self._relation_attributes = relation_attributes
|
|
33
|
+
self._relation_attribute_definitions = relation_attribute_definitions or OrderedDict()
|
|
34
|
+
|
|
35
|
+
def _merge(self, other: DbcSpecifics) -> DbcSpecifics:
|
|
36
|
+
"""Combine metadata without modifying either input's mappings.
|
|
37
|
+
|
|
38
|
+
Attribute definitions must agree, including their defaults. Otherwise
|
|
39
|
+
retained assignments or implicit defaults would change meaning.
|
|
40
|
+
Incoming values win for other duplicate keys.
|
|
41
|
+
"""
|
|
42
|
+
from .dbc_loader import DbcRelationAttributes # noqa: PLC0415
|
|
43
|
+
|
|
44
|
+
definitions = _merge_definitions(self.attribute_definitions,
|
|
45
|
+
other.attribute_definitions)
|
|
46
|
+
relation_definitions = _merge_definitions(
|
|
47
|
+
self.relation_attribute_definitions,
|
|
48
|
+
other.relation_attribute_definitions)
|
|
49
|
+
|
|
50
|
+
relations = None
|
|
51
|
+
if self.relation_attributes is not None or other.relation_attributes is not None:
|
|
52
|
+
relations = DbcRelationAttributes()
|
|
53
|
+
for source in (self.relation_attributes, other.relation_attributes):
|
|
54
|
+
if source is None:
|
|
55
|
+
continue
|
|
56
|
+
for frame_id, signals in source.node_signal_relations.items():
|
|
57
|
+
target_signals = relations.node_signal_relations.setdefault(
|
|
58
|
+
frame_id, OrderedDict())
|
|
59
|
+
for signal_name, nodes in signals.items():
|
|
60
|
+
target_nodes = target_signals.setdefault(signal_name, OrderedDict())
|
|
61
|
+
for node_name, attributes in nodes.items():
|
|
62
|
+
target_nodes.setdefault(node_name, OrderedDict()).update(attributes)
|
|
63
|
+
for frame_id, nodes in source.node_message_relations.items():
|
|
64
|
+
target_nodes = relations.node_message_relations.setdefault(
|
|
65
|
+
frame_id, OrderedDict())
|
|
66
|
+
for node_name, attributes in nodes.items():
|
|
67
|
+
target_nodes.setdefault(node_name, OrderedDict()).update(attributes)
|
|
68
|
+
|
|
69
|
+
return DbcSpecifics(
|
|
70
|
+
attributes=OrderedDict([*self.attributes.items(), *other.attributes.items()]),
|
|
71
|
+
attribute_definitions=definitions,
|
|
72
|
+
environment_variables=OrderedDict([
|
|
73
|
+
*self.environment_variables.items(), *other.environment_variables.items()]),
|
|
74
|
+
value_tables=OrderedDict([*self.value_tables.items(), *other.value_tables.items()]),
|
|
75
|
+
relation_attributes=relations,
|
|
76
|
+
relation_attribute_definitions=relation_definitions)
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def attributes(self) -> OrderedDict[str, DbcAttributeType]:
|
|
80
|
+
"""The DBC specific attributes of the parent object (database, node,
|
|
81
|
+
message or signal) as a dictionary.
|
|
82
|
+
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
return self._attributes
|
|
86
|
+
|
|
87
|
+
@property
|
|
88
|
+
def attribute_definitions(self) -> OrderedDict[str, DbcAttributeDefinitionType]:
|
|
89
|
+
"""The DBC specific attribute definitions as dictionary.
|
|
90
|
+
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
return self._attribute_definitions
|
|
94
|
+
|
|
95
|
+
@property
|
|
96
|
+
def value_tables(self) -> OrderedDict[str, Choices]:
|
|
97
|
+
"""An ordered dictionary of all value tables. Only valid for DBC
|
|
98
|
+
specifiers on database level.
|
|
99
|
+
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
return self._value_tables
|
|
103
|
+
|
|
104
|
+
@property
|
|
105
|
+
def environment_variables(self) -> OrderedDict[str, DbcEnvironmentVariable]:
|
|
106
|
+
"""An ordered dictionary of all environment variables. Only valid for
|
|
107
|
+
DBC specifiers on database level.
|
|
108
|
+
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
return self._environment_variables
|
|
112
|
+
|
|
113
|
+
@property
|
|
114
|
+
def relation_attributes(self) -> DbcRelationAttributes | None:
|
|
115
|
+
"""The DBC specific relation attributes.
|
|
116
|
+
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
return self._relation_attributes
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def relation_attribute_definitions(self) -> OrderedDict[str, DbcAttributeDefinitionType]:
|
|
123
|
+
"""The DBC specific attribute definitions rel as dictionary.
|
|
124
|
+
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
return self._relation_attribute_definitions
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def _merge_definitions(
|
|
131
|
+
original: OrderedDict[str, DbcAttributeDefinitionType],
|
|
132
|
+
incoming: OrderedDict[str, DbcAttributeDefinitionType],
|
|
133
|
+
) -> OrderedDict[str, DbcAttributeDefinitionType]:
|
|
134
|
+
definitions = original.copy()
|
|
135
|
+
for name, definition in incoming.items():
|
|
136
|
+
if name in definitions:
|
|
137
|
+
previous = definitions[name]
|
|
138
|
+
if definition != previous:
|
|
139
|
+
raise Error(f'Incompatible DBC attribute definition {name!r}.')
|
|
140
|
+
else:
|
|
141
|
+
definitions[name] = definition
|
|
142
|
+
return definitions
|