From 54df6737548e340662a31b21b11ba566c1b815af Mon Sep 17 00:00:00 2001 From: yoogx Date: Mon, 30 Jun 2014 21:40:47 +0200 Subject: [PATCH] * Minor reformatting for GNAT GPL 2014 & GCC 4.9.x --- projects/Makefile.am | 61 +- .../ocarina-backends-aadl_xml-main.adb | 139 +- .../ocarina-backends-aadl_xml-mapping.adb | 30 +- .../ocarina-backends-ada_tree-debug.adb | 26 +- .../ocarina-backends-ada_tree-debug.ads | 18 +- ...rina-backends-ada_tree-generator-spark.adb | 31 +- .../ocarina-backends-ada_tree-generator.adb | 74 +- .../ocarina-backends-ada_tree-generator.ads | 4 +- .../ocarina-backends-ada_tree-nutils.adb | 717 ++-- .../ocarina-backends-ada_tree-nutils.ads | 263 +- src/backends/ocarina-backends-ada_values.adb | 86 +- src/backends/ocarina-backends-ada_values.ads | 77 +- ...ina-backends-arinc653_conf-connections.adb | 57 +- ...ocarina-backends-arinc653_conf-mapping.adb | 478 +-- ...ocarina-backends-arinc653_conf-mapping.ads | 16 +- .../ocarina-backends-arinc653_conf-memory.adb | 39 +- ...arina-backends-arinc653_conf-module_hm.adb | 25 +- ...na-backends-arinc653_conf-partition_hm.adb | 27 +- ...rina-backends-arinc653_conf-partitions.adb | 57 +- ...rina-backends-arinc653_conf-scheduling.adb | 43 +- ...arina-backends-arinc653_conf-system_hm.adb | 55 +- .../ocarina-backends-arinc653_conf.adb | 8 +- .../ocarina-backends-asn1-deployment.adb | 170 +- .../ocarina-backends-asn1_tree-debug.adb | 26 +- .../ocarina-backends-asn1_tree-debug.ads | 16 +- .../ocarina-backends-asn1_tree-generator.adb | 13 +- .../ocarina-backends-asn1_tree-generator.ads | 4 +- .../ocarina-backends-asn1_tree-nutils.adb | 111 +- .../ocarina-backends-asn1_tree-nutils.ads | 67 +- src/backends/ocarina-backends-asn1_values.adb | 82 +- src/backends/ocarina-backends-asn1_values.ads | 77 +- src/backends/ocarina-backends-boundt.adb | 118 +- src/backends/ocarina-backends-build_utils.adb | 588 ++- src/backends/ocarina-backends-build_utils.ads | 30 +- .../ocarina-backends-c_common-mapping.adb | 2294 +++++------ .../ocarina-backends-c_common-mapping.ads | 205 +- .../ocarina-backends-c_common-subprograms.adb | 301 +- .../ocarina-backends-c_common-types.adb | 803 ++-- .../ocarina-backends-c_tree-debug.adb | 18 +- .../ocarina-backends-c_tree-debug.ads | 16 +- .../ocarina-backends-c_tree-generator.adb | 33 +- .../ocarina-backends-c_tree-generator.ads | 4 +- .../ocarina-backends-c_tree-nutils.adb | 797 ++-- .../ocarina-backends-c_tree-nutils.ads | 240 +- src/backends/ocarina-backends-c_values.adb | 83 +- src/backends/ocarina-backends-c_values.ads | 74 +- src/backends/ocarina-backends-carts-main.adb | 42 +- .../ocarina-backends-carts-mapping.adb | 143 +- src/backends/ocarina-backends-carts.adb | 5 +- .../ocarina-backends-cheddar-main.adb | 33 +- .../ocarina-backends-cheddar-mapping.adb | 305 +- src/backends/ocarina-backends-cheddar.adb | 10 +- ...carina-backends-connection_matrix-main.adb | 279 +- .../ocarina-backends-connection_matrix.adb | 4 +- .../ocarina-backends-execution_tests.adb | 480 ++- .../ocarina-backends-execution_tests.ads | 55 +- .../ocarina-backends-execution_utils.adb | 31 +- .../ocarina-backends-execution_utils.ads | 19 +- src/backends/ocarina-backends-expander.adb | 211 +- ...ocarina-backends-functions_matrix-main.adb | 163 +- .../ocarina-backends-functions_matrix.adb | 8 +- src/backends/ocarina-backends-mast-main.adb | 582 ++- src/backends/ocarina-backends-mast.adb | 13 +- src/backends/ocarina-backends-mast.ads | 4 +- .../ocarina-backends-mast_tree-debug.adb | 28 +- .../ocarina-backends-mast_tree-debug.ads | 16 +- .../ocarina-backends-mast_tree-generator.adb | 22 +- .../ocarina-backends-mast_tree-nutils.adb | 152 +- .../ocarina-backends-mast_tree-nutils.ads | 140 +- src/backends/ocarina-backends-mast_values.adb | 74 +- src/backends/ocarina-backends-mast_values.ads | 65 +- src/backends/ocarina-backends-messages.adb | 8 +- .../ocarina-backends-pn-components.adb | 2519 ++++++------ .../ocarina-backends-pn-components.ads | 37 +- src/backends/ocarina-backends-pn-debug.adb | 18 +- src/backends/ocarina-backends-pn-debug.ads | 20 +- .../ocarina-backends-pn-format-cami.adb | 496 ++- .../ocarina-backends-pn-format-cami.ads | 11 +- .../ocarina-backends-pn-format-tina.adb | 112 +- .../ocarina-backends-pn-format-tina.ads | 11 +- src/backends/ocarina-backends-pn-iutils.adb | 518 ++- src/backends/ocarina-backends-pn-iutils.ads | 137 +- src/backends/ocarina-backends-pn-nutils.adb | 15 +- src/backends/ocarina-backends-pn-nutils.ads | 6 +- src/backends/ocarina-backends-pn-printer.adb | 21 +- src/backends/ocarina-backends-pn-printer.ads | 36 +- src/backends/ocarina-backends-pn-utils.adb | 6 +- src/backends/ocarina-backends-pn-utils.ads | 5 +- src/backends/ocarina-backends-pn.adb | 20 +- .../ocarina-backends-po_hi_ada-activity.adb | 2645 ++++++------ .../ocarina-backends-po_hi_ada-deployment.adb | 811 ++-- .../ocarina-backends-po_hi_ada-main.adb | 150 +- .../ocarina-backends-po_hi_ada-mapping.adb | 403 +- .../ocarina-backends-po_hi_ada-mapping.ads | 8 +- ...ocarina-backends-po_hi_ada-marshallers.adb | 567 +-- .../ocarina-backends-po_hi_ada-naming.adb | 194 +- .../ocarina-backends-po_hi_ada-runtime.adb | 41 +- .../ocarina-backends-po_hi_ada-runtime.ads | 202 +- ...ocarina-backends-po_hi_ada-subprograms.adb | 384 +- .../ocarina-backends-po_hi_ada-transport.adb | 817 ++-- .../ocarina-backends-po_hi_ada-types.adb | 723 ++-- src/backends/ocarina-backends-po_hi_ada.adb | 188 +- .../ocarina-backends-po_hi_c-activity.adb | 1434 +++---- .../ocarina-backends-po_hi_c-deployment.adb | 2230 +++++----- .../ocarina-backends-po_hi_c-main.adb | 411 +- .../ocarina-backends-po_hi_c-marshallers.adb | 1121 +++-- .../ocarina-backends-po_hi_c-naming.adb | 238 +- .../ocarina-backends-po_hi_c-request.adb | 262 +- .../ocarina-backends-po_hi_c-runtime.adb | 46 +- .../ocarina-backends-po_hi_c-runtime.ads | 400 +- src/backends/ocarina-backends-po_hi_c.adb | 133 +- .../ocarina-backends-po_hi_rtsj-activity.adb | 845 ++-- ...ocarina-backends-po_hi_rtsj-deployment.adb | 472 +-- ...na-backends-po_hi_rtsj-generated_types.adb | 304 +- .../ocarina-backends-po_hi_rtsj-main.adb | 360 +- .../ocarina-backends-po_hi_rtsj-mapping.adb | 222 +- .../ocarina-backends-po_hi_rtsj-mapping.ads | 66 +- .../ocarina-backends-po_hi_rtsj-naming.adb | 292 +- .../ocarina-backends-po_hi_rtsj-runtime.adb | 56 +- .../ocarina-backends-po_hi_rtsj-runtime.ads | 153 +- ...carina-backends-po_hi_rtsj-subprograms.adb | 54 +- ...ckends-po_hi_rtsj-transport_high_level.adb | 599 +-- src/backends/ocarina-backends-po_hi_rtsj.adb | 10 +- .../ocarina-backends-pok_c-activity.adb | 1297 +++--- .../ocarina-backends-pok_c-deployment.adb | 2743 +++++++------ src/backends/ocarina-backends-pok_c-main.adb | 1789 ++++---- .../ocarina-backends-pok_c-makefile.adb | 221 +- .../ocarina-backends-pok_c-naming.adb | 53 +- .../ocarina-backends-pok_c-runtime.adb | 87 +- .../ocarina-backends-pok_c-runtime.ads | 902 ++-- src/backends/ocarina-backends-pok_c.adb | 28 +- src/backends/ocarina-backends-pok_cheddar.adb | 131 +- src/backends/ocarina-backends-properties.adb | 1992 +++++---- src/backends/ocarina-backends-properties.ads | 166 +- src/backends/ocarina-backends-real.adb | 1475 +++---- src/backends/ocarina-backends-real.ads | 11 +- .../ocarina-backends-rtsj_tree-debug.adb | 28 +- .../ocarina-backends-rtsj_tree-debug.ads | 18 +- .../ocarina-backends-rtsj_tree-generator.adb | 75 +- .../ocarina-backends-rtsj_tree-generator.ads | 4 +- .../ocarina-backends-rtsj_tree-nutils.adb | 231 +- .../ocarina-backends-rtsj_tree-nutils.ads | 194 +- src/backends/ocarina-backends-rtsj_values.adb | 25 +- src/backends/ocarina-backends-rtsj_values.ads | 22 +- src/backends/ocarina-backends-stats-main.adb | 184 +- .../ocarina-backends-stats-mapping.adb | 295 +- .../ocarina-backends-stats-mapping.ads | 7 +- src/backends/ocarina-backends-subprograms.adb | 190 +- src/backends/ocarina-backends-utils.adb | 1337 +++--- src/backends/ocarina-backends-utils.ads | 92 +- .../ocarina-backends-xml_common-mapping.adb | 22 +- .../ocarina-backends-xml_common-mapping.ads | 14 +- .../ocarina-backends-xml_tree-debug.adb | 28 +- .../ocarina-backends-xml_tree-debug.ads | 16 +- .../ocarina-backends-xml_tree-generator.adb | 14 +- .../ocarina-backends-xml_tree-nutils.adb | 92 +- .../ocarina-backends-xml_tree-nutils.ads | 82 +- src/backends/ocarina-backends-xml_values.adb | 74 +- src/backends/ocarina-backends-xml_values.ads | 65 +- ...ocarina-backends-xtratum_conf-channels.adb | 192 +- ...ends-xtratum_conf-hardware_description.adb | 146 +- .../ocarina-backends-xtratum_conf-mapping.adb | 394 +- .../ocarina-backends-xtratum_conf-mapping.ads | 12 +- ...-backends-xtratum_conf-partition_table.adb | 159 +- ...rina-backends-xtratum_conf-resident_sw.adb | 54 +- ...ckends-xtratum_conf-system_description.adb | 45 +- ...na-backends-xtratum_conf-xm_hypervisor.adb | 59 +- .../ocarina-backends-xtratum_conf.adb | 15 +- src/backends/ocarina-backends.adb | 27 +- src/backends/ocarina-backends.ads | 6 +- src/backends/ocarina-be_aadl-annexes.adb | 16 +- src/backends/ocarina-be_aadl-annexes.ads | 7 +- ...ocarina-be_aadl-components-connections.adb | 14 +- .../ocarina-be_aadl-components-features.adb | 4 +- .../ocarina-be_aadl-components-flows.adb | 33 +- .../ocarina-be_aadl-components-modes.adb | 19 +- .../ocarina-be_aadl-components-prototypes.adb | 6 +- .../ocarina-be_aadl-components-prototypes.ads | 4 +- ...arina-be_aadl-components-subcomponents.adb | 4 +- ...na-be_aadl-components-subprogram_calls.adb | 8 +- src/backends/ocarina-be_aadl-components.adb | 59 +- src/backends/ocarina-be_aadl-namespaces.adb | 107 +- src/backends/ocarina-be_aadl-namespaces.ads | 17 +- .../ocarina-be_aadl-properties-values.adb | 128 +- src/backends/ocarina-be_aadl-properties.adb | 7 +- src/backends/ocarina-be_aadl-properties.ads | 4 +- src/backends/ocarina-be_aadl.adb | 145 +- src/backends/ocarina-be_aadl.ads | 12 +- src/backends/ocarina-be_aadl_ba-actions.adb | 110 +- src/backends/ocarina-be_aadl_ba-actions.ads | 6 +- .../ocarina-be_aadl_ba-expressions.adb | 171 +- .../ocarina-be_aadl_ba-expressions.ads | 14 +- .../ocarina-be_aadl_ba-identifiers.adb | 22 +- .../ocarina-be_aadl_ba-specifications.adb | 59 +- .../ocarina-be_aadl_ba-thread_dispatch.adb | 20 +- src/backends/ocarina-be_aadl_ba.adb | 15 +- src/backends/ocarina-be_aadl_ba.ads | 6 +- src/backends/ocarina-be_real.adb | 44 +- src/core/common_files/charset.adb | 470 ++- src/core/common_files/errors.adb | 24 +- src/core/common_files/errors.ads | 4 +- src/core/common_files/locations.adb | 41 +- src/core/common_files/locations.ads | 16 +- src/core/common_files/namet.adb | 343 +- src/core/common_files/namet.ads | 28 +- src/core/common_files/output.adb | 16 +- src/core/common_files/types.ads | 50 +- src/core/common_files/utils.adb | 41 +- src/core/common_files/utils.ads | 29 +- ...arina-instances-components-connections.adb | 163 +- ...arina-instances-components-connections.ads | 5 +- .../ocarina-instances-components-features.adb | 292 +- .../ocarina-instances-components-features.ads | 5 +- .../ocarina-instances-components-modes.adb | 176 +- .../ocarina-instances-components-modes.ads | 8 +- ...ina-instances-components-subcomponents.adb | 36 +- ...ina-instances-components-subcomponents.ads | 5 +- ...-instances-components-subprogram_calls.adb | 146 +- ...-instances-components-subprogram_calls.ads | 11 +- .../instance/ocarina-instances-components.adb | 232 +- .../instance/ocarina-instances-components.ads | 5 +- .../instance/ocarina-instances-finder.adb | 175 +- .../instance/ocarina-instances-finder.ads | 16 +- .../instance/ocarina-instances-messages.adb | 20 +- .../instance/ocarina-instances-messages.ads | 8 +- .../instance/ocarina-instances-namespaces.adb | 54 +- .../instance/ocarina-instances-namespaces.ads | 5 +- ...ocarina-instances-processor-properties.adb | 317 +- .../instance/ocarina-instances-properties.adb | 553 +-- .../instance/ocarina-instances-properties.ads | 17 +- .../instance/ocarina-instances-queries.adb | 338 +- .../instance/ocarina-instances-queries.ads | 96 +- ...real_checker-queries-access_predicates.adb | 16 +- ...real_checker-queries-access_predicates.ads | 9 +- ...-real_checker-queries-bound_predicates.adb | 25 +- ...-real_checker-queries-bound_predicates.ads | 9 +- ...s-real_checker-queries-call_predicates.adb | 49 +- ...s-real_checker-queries-call_predicates.ads | 9 +- ...l_checker-queries-connected_predicates.adb | 10 +- ...l_checker-queries-connected_predicates.ads | 9 +- ...eal_checker-queries-passing_predicates.adb | 19 +- ...eal_checker-queries-passing_predicates.ads | 9 +- ...checker-queries-predecessor_predicates.adb | 52 +- ...checker-queries-predecessor_predicates.ads | 9 +- ...tances-real_checker-queries-predicates.adb | 16 +- ...tances-real_checker-queries-predicates.ads | 5 +- ...cker-queries-provided_class_predicates.adb | 16 +- ...cker-queries-provided_class_predicates.ads | 9 +- ..._checker-queries-relational_predicates.adb | 30 +- ..._checker-queries-relational_predicates.ads | 18 +- ...hecker-queries-subcomponent_predicates.adb | 10 +- ...hecker-queries-subcomponent_predicates.ads | 9 +- ...ocarina-instances-real_checker-queries.adb | 134 +- ...ocarina-instances-real_checker-queries.ads | 70 +- .../ocarina-instances-real_checker.ads | 28 +- .../ocarina-instances-real_finder.adb | 134 +- .../ocarina-instances-real_finder.ads | 7 +- src/core/instance/ocarina-instances.adb | 99 +- src/core/instance/ocarina-instances.ads | 28 +- .../ocarina-real_expander-flow_analysis.adb | 203 +- src/core/instance/ocarina-real_expander.adb | 26 +- src/core/instance/ocarina-real_expander.ads | 5 +- src/core/mgmt/ocarina-files.adb | 23 +- src/core/mgmt/ocarina-files.ads | 9 +- src/core/mgmt/ocarina-options.adb | 24 +- src/core/mgmt/ocarina-options.ads | 24 +- src/core/mgmt/ocarina-parser.adb | 20 +- src/core/mgmt/ocarina-parser.ads | 12 +- src/core/mgmt/ocarina.adb | 10 +- .../model/ocarina-analyzer-aadl-finder.adb | 810 ++-- .../model/ocarina-analyzer-aadl-finder.ads | 67 +- .../ocarina-analyzer-aadl-legality_rules.adb | 1132 ++--- .../ocarina-analyzer-aadl-legality_rules.ads | 24 +- .../model/ocarina-analyzer-aadl-links.adb | 2381 +++++------ .../model/ocarina-analyzer-aadl-links.ads | 84 +- .../model/ocarina-analyzer-aadl-names.adb | 262 +- .../model/ocarina-analyzer-aadl-names.ads | 5 +- .../ocarina-analyzer-aadl-naming_rules.adb | 338 +- .../ocarina-analyzer-aadl-naming_rules.ads | 27 +- .../model/ocarina-analyzer-aadl-queries.adb | 500 +-- .../model/ocarina-analyzer-aadl-queries.ads | 77 +- .../model/ocarina-analyzer-aadl-semantics.adb | 1152 +++--- .../model/ocarina-analyzer-aadl-semantics.ads | 5 +- src/core/model/ocarina-analyzer-aadl.adb | 24 +- src/core/model/ocarina-analyzer-aadl.ads | 5 +- src/core/model/ocarina-analyzer-messages.adb | 202 +- src/core/model/ocarina-analyzer-messages.ads | 77 +- .../model/ocarina-analyzer-real-finder.adb | 56 +- .../model/ocarina-analyzer-real-finder.ads | 4 +- src/core/model/ocarina-analyzer-real.adb | 960 +++-- src/core/model/ocarina-analyzer-real.ads | 6 +- src/core/model/ocarina-analyzer.adb | 6 +- src/core/model/ocarina-analyzer.ads | 5 +- .../model/ocarina-builder-aadl-annexes.adb | 72 +- .../model/ocarina-builder-aadl-annexes.ads | 14 +- ...ocarina-builder-aadl-components-arrays.adb | 27 +- ...ocarina-builder-aadl-components-arrays.ads | 17 +- ...na-builder-aadl-components-connections.adb | 40 +- ...na-builder-aadl-components-connections.ads | 15 +- ...arina-builder-aadl-components-features.adb | 180 +- ...arina-builder-aadl-components-features.ads | 28 +- .../ocarina-builder-aadl-components-flows.adb | 47 +- .../ocarina-builder-aadl-components-flows.ads | 14 +- .../ocarina-builder-aadl-components-modes.adb | 66 +- .../ocarina-builder-aadl-components-modes.ads | 26 +- ...ina-builder-aadl-components-prototypes.adb | 25 +- ...ina-builder-aadl-components-prototypes.ads | 8 +- ...-builder-aadl-components-subcomponents.adb | 34 +- ...-builder-aadl-components-subcomponents.ads | 8 +- ...ilder-aadl-components-subprogram_calls.adb | 58 +- ...ilder-aadl-components-subprogram_calls.ads | 14 +- .../model/ocarina-builder-aadl-components.adb | 154 +- .../model/ocarina-builder-aadl-components.ads | 53 +- .../model/ocarina-builder-aadl-namespaces.adb | 151 +- .../model/ocarina-builder-aadl-namespaces.ads | 44 +- .../model/ocarina-builder-aadl-properties.adb | 232 +- .../model/ocarina-builder-aadl-properties.ads | 20 +- .../model/ocarina-builder-aadl_ba-actions.adb | 175 +- .../model/ocarina-builder-aadl_ba-actions.ads | 56 +- .../ocarina-builder-aadl_ba-expressions.adb | 167 +- .../ocarina-builder-aadl_ba-expressions.ads | 45 +- ...ocarina-builder-aadl_ba-specifications.adb | 114 +- ...ocarina-builder-aadl_ba-specifications.ads | 40 +- ...carina-builder-aadl_ba-thread_dispatch.adb | 70 +- ...carina-builder-aadl_ba-thread_dispatch.ads | 21 +- src/core/model/ocarina-builder-real.adb | 20 +- .../model/ocarina-processor-properties.adb | 845 ++-- src/core/tree/ocarina-aadl_values.adb | 131 +- src/core/tree/ocarina-aadl_values.ads | 36 +- src/core/tree/ocarina-annotations.adb | 12 +- src/core/tree/ocarina-annotations.ads | 4 +- .../ocarina-me_aadl-aadl_instances-debug.adb | 20 +- .../ocarina-me_aadl-aadl_instances-debug.ads | 22 +- ...adl-aadl_instances-entities-properties.adb | 51 +- ...adl-aadl_instances-entities-properties.ads | 15 +- ...carina-me_aadl-aadl_instances-entities.adb | 111 +- ...carina-me_aadl-aadl_instances-entities.ads | 39 +- .../ocarina-me_aadl-aadl_instances-nutils.adb | 163 +- .../ocarina-me_aadl-aadl_instances-nutils.ads | 38 +- .../tree/ocarina-me_aadl-aadl_tree-debug.adb | 18 +- .../tree/ocarina-me_aadl-aadl_tree-debug.ads | 26 +- ...-me_aadl-aadl_tree-entities-properties.adb | 272 +- ...-me_aadl-aadl_tree-entities-properties.ads | 57 +- .../ocarina-me_aadl-aadl_tree-entities.adb | 204 +- .../ocarina-me_aadl-aadl_tree-entities.ads | 61 +- .../tree/ocarina-me_aadl-aadl_tree-nutils.adb | 37 +- .../tree/ocarina-me_aadl-aadl_tree-nutils.ads | 14 +- src/core/tree/ocarina-me_aadl-printers.adb | 10 +- src/core/tree/ocarina-me_aadl-tokens.adb | 18 +- src/core/tree/ocarina-me_aadl-tokens.ads | 60 +- src/core/tree/ocarina-me_aadl.ads | 17 +- .../tree/ocarina-me_aadl_ba-ba_tree-debug.adb | 16 +- .../tree/ocarina-me_aadl_ba-ba_tree-debug.ads | 20 +- .../ocarina-me_aadl_ba-ba_tree-nutils.adb | 21 +- .../ocarina-me_aadl_ba-ba_tree-nutils.ads | 8 +- src/core/tree/ocarina-me_aadl_ba-tokens.adb | 8 +- src/core/tree/ocarina-me_aadl_ba-tokens.ads | 81 +- src/core/tree/ocarina-me_aadl_ba.ads | 46 +- .../tree/ocarina-me_real-real_tree-debug.adb | 36 +- .../tree/ocarina-me_real-real_tree-debug.ads | 22 +- .../tree/ocarina-me_real-real_tree-nutils.adb | 42 +- .../tree/ocarina-me_real-real_tree-nutils.ads | 6 +- .../tree/ocarina-me_real-real_tree-utils.adb | 17 +- .../tree/ocarina-me_real-real_tree-utils.ads | 127 +- src/core/tree/ocarina-me_real-tokens.adb | 34 +- src/core/tree/ocarina-me_real-tokens.ads | 58 +- src/core/tree/ocarina-property_sets.adb | 67 +- src/core/tree/ocarina-property_sets.ads | 8 +- src/core/tree/ocarina-real_values.adb | 346 +- src/core/tree/ocarina-real_values.ads | 50 +- src/frontends/aadl/ocarina-fe_aadl-lexer.adb | 217 +- src/frontends/aadl/ocarina-fe_aadl-lexer.ads | 33 +- .../aadl/ocarina-fe_aadl-parser-annexes.adb | 49 +- .../aadl/ocarina-fe_aadl-parser-annexes.ads | 7 +- ...arina-fe_aadl-parser-components-arrays.adb | 56 +- ...arina-fe_aadl-parser-components-arrays.ads | 10 +- ...-fe_aadl-parser-components-connections.adb | 115 +- ...-fe_aadl-parser-components-connections.ads | 5 +- ...ina-fe_aadl-parser-components-features.adb | 402 +- ...ina-fe_aadl-parser-components-features.ads | 8 +- ...carina-fe_aadl-parser-components-flows.adb | 148 +- ...carina-fe_aadl-parser-components-flows.ads | 8 +- ...carina-fe_aadl-parser-components-modes.adb | 176 +- ...carina-fe_aadl-parser-components-modes.ads | 5 +- ...a-fe_aadl-parser-components-prototypes.adb | 58 +- ...a-fe_aadl-parser-components-prototypes.ads | 13 +- ...e_aadl-parser-components-subcomponents.adb | 52 +- ...e_aadl-parser-components-subcomponents.ads | 5 +- ...adl-parser-components-subprogram_calls.adb | 63 +- ...adl-parser-components-subprogram_calls.ads | 5 +- .../ocarina-fe_aadl-parser-components.adb | 362 +- .../ocarina-fe_aadl-parser-components.ads | 14 +- .../ocarina-fe_aadl-parser-identifiers.adb | 114 +- .../ocarina-fe_aadl-parser-identifiers.ads | 17 +- .../ocarina-fe_aadl-parser-namespaces.adb | 296 +- .../ocarina-fe_aadl-parser-namespaces.ads | 19 +- ...arina-fe_aadl-parser-properties-values.adb | 753 ++-- ...arina-fe_aadl-parser-properties-values.ads | 11 +- .../ocarina-fe_aadl-parser-properties.adb | 235 +- .../ocarina-fe_aadl-parser-properties.ads | 22 +- src/frontends/aadl/ocarina-fe_aadl-parser.adb | 83 +- src/frontends/aadl/ocarina-fe_aadl-parser.ads | 44 +- .../aadl/ocarina-fe_aadl-parser_errors.adb | 12 +- .../aadl/ocarina-fe_aadl-parser_errors.ads | 57 +- src/frontends/aadl/ocarina-fe_aadl.adb | 6 +- .../aadl_ba/ocarina-fe_aadl_ba-lexer.adb | 206 +- .../aadl_ba/ocarina-fe_aadl_ba-lexer.ads | 28 +- .../ocarina-fe_aadl_ba-parser-actions.adb | 278 +- .../ocarina-fe_aadl_ba-parser-actions.ads | 6 +- .../ocarina-fe_aadl_ba-parser-expressions.adb | 206 +- .../ocarina-fe_aadl_ba-parser-identifiers.adb | 103 +- .../ocarina-fe_aadl_ba-parser-identifiers.ads | 9 +- ...arina-fe_aadl_ba-parser-specifications.adb | 235 +- ...arina-fe_aadl_ba-parser-specifications.ads | 5 +- ...rina-fe_aadl_ba-parser-thread_dispatch.adb | 208 +- .../aadl_ba/ocarina-fe_aadl_ba-parser.adb | 52 +- .../aadl_ba/ocarina-fe_aadl_ba-parser.ads | 32 +- .../ocarina-fe_aadl_ba-parser_errors.adb | 20 +- .../ocarina-fe_aadl_ba-parser_errors.ads | 47 +- src/frontends/real/ocarina-fe_real-lexer.adb | 116 +- src/frontends/real/ocarina-fe_real-lexer.ads | 12 +- src/frontends/real/ocarina-fe_real-parser.adb | 244 +- .../real/ocarina-fe_real-parser_errors.adb | 20 +- .../real/ocarina-fe_real-parser_errors.ads | 19 +- src/frontends/real/ocarina-fe_real.adb | 7 +- src/main/ocarina_cmd.adb | 415 +- .../ocarina-transfo-fusions-scheduler.adb | 149 +- .../ocarina-transfo-fusions-scheduler.ads | 5 +- src/transfo/ocarina-transfo-fusions.adb | 3629 +++++++++-------- src/transfo/ocarina-transfo-fusions.ads | 60 +- src/transfo/ocarina-transfo-move.adb | 2069 ++++++---- src/transfo/ocarina-transfo-move.ads | 5 +- src/transfo/ocarina-transfo-optim-eval.adb | 223 +- src/transfo/ocarina-transfo-optim-eval.ads | 33 +- src/transfo/ocarina-transfo-optim.adb | 462 ++- src/transfo/ocarina-transfo-optim.ads | 6 +- src/transfo/ocarina-transfo.adb | 86 +- src/transfo/ocarina-transfo.ads | 36 +- tools/mknodes/lexer.adb | 63 +- tools/mknodes/lexer.ads | 19 +- tools/mknodes/parser.adb | 364 +- tools/mknodes/parser.ads | 65 +- 442 files changed, 40650 insertions(+), 39265 deletions(-) diff --git a/projects/Makefile.am b/projects/Makefile.am index a1bcd463..f9e9b1be 100644 --- a/projects/Makefile.am +++ b/projects/Makefile.am @@ -2,25 +2,16 @@ include $(top_srcdir)/Makefile.common # The order of the project files is important for saving compile time -BUILD_PROJECTS=\ - ocarina-core.gpr \ - ocarina-frontends.gpr \ - ocarina-backends.gpr \ - ocarina-config.gpr \ - ocarina-transfo.gpr \ +BUILD_PROJECTS= ocarina-core.gpr ocarina-frontends.gpr \ + ocarina-backends.gpr ocarina-config.gpr ocarina-transfo.gpr \ ocarina-main.gpr # All project files have to be packaged with "make dist" -EXTRA_DIST=\ - $(srcdir)/ocarina.gpr.in \ - $(srcdir)/ocarina-frontends.gpr \ - $(srcdir)/ocarina-backends.gpr \ - $(srcdir)/ocarina-core.gpr \ - $(srcdir)/ocarina-main.gpr \ - $(srcdir)/ocarina-transfo.gpr \ - $(srcdir)/ocarina-config.gpr \ - $(srcdir)/restrictions.adc +EXTRA_DIST= $(srcdir)/ocarina.gpr.in $(srcdir)/ocarina-frontends.gpr \ + $(srcdir)/ocarina-backends.gpr $(srcdir)/ocarina-core.gpr \ + $(srcdir)/ocarina-main.gpr $(srcdir)/ocarina-transfo.gpr \ + $(srcdir)/ocarina-config.gpr $(srcdir)/restrictions.adc BUILD_STAMPS = $(BUILD_PROJECTS:.gpr=.gpr-build) @@ -30,20 +21,19 @@ CLEAN_STAMPS = $(CLEAN_PROJECTS:.gpr=.gpr-clean) # Object directories (*.o, *.ali) -OBJECT_DIRS = $(top_builddir)/src/core/objects \ - $(top_builddir)/src/frontends/objects \ - $(top_builddir)/src/backends/objects \ - $(top_builddir)/src/transfo/objects \ +OBJECT_DIRS = $(top_builddir)/src/core/objects \ + $(top_builddir)/src/frontends/objects \ + $(top_builddir)/src/backends/objects \ + $(top_builddir)/src/transfo/objects \ $(top_builddir)/src/main/objects # Library directories (*.ali, *.a) -LIB_DIRS = $(top_builddir)/src/core/libs \ - $(top_builddir)/src/frontends/libs \ - $(top_builddir)/src/backends/libs \ - $(top_builddir)/src/transfo/libs \ - $(top_builddir)/src/config/libs \ - $(top_builddir)/src/main/libs +LIB_DIRS = $(top_builddir)/src/core/libs \ + $(top_builddir)/src/frontends/libs \ + $(top_builddir)/src/backends/libs \ + $(top_builddir)/src/transfo/libs \ + $(top_builddir)/src/config/libs $(top_builddir)/src/main/libs # All directories used for the build process. If the configure is # performed from a directory different from the top source directory, @@ -60,17 +50,16 @@ BUILD_DIRS_STAMPS = $(BUILD_DIRS:=-stamp) # Pseudo-IDL files that are used to generate the tree manipulators. -TREE_PIDL_SPECS = \ - src/core/tree/ocarina-me_aadl-aadl_tree-nodes.idl \ - src/core/tree/ocarina-me_aadl-aadl_instances-nodes.idl \ - src/core/tree/ocarina-me_aadl_ba-ba_tree-nodes.idl \ - src/core/tree/ocarina-me_real-real_tree-nodes.idl \ - src/backends/ocarina-backends-ada_tree-nodes.idl \ - src/backends/ocarina-backends-c_tree-nodes.idl \ - src/backends/ocarina-backends-asn1_tree-nodes.idl \ - src/backends/ocarina-backends-xml_tree-nodes.idl \ - src/backends/ocarina-backends-pn-nodes.idl \ - src/backends/ocarina-backends-mast_tree-nodes.idl \ +TREE_PIDL_SPECS = src/core/tree/ocarina-me_aadl-aadl_tree-nodes.idl \ + src/core/tree/ocarina-me_aadl-aadl_instances-nodes.idl \ + src/core/tree/ocarina-me_aadl_ba-ba_tree-nodes.idl \ + src/core/tree/ocarina-me_real-real_tree-nodes.idl \ + src/backends/ocarina-backends-ada_tree-nodes.idl \ + src/backends/ocarina-backends-c_tree-nodes.idl \ + src/backends/ocarina-backends-asn1_tree-nodes.idl \ + src/backends/ocarina-backends-xml_tree-nodes.idl \ + src/backends/ocarina-backends-pn-nodes.idl \ + src/backends/ocarina-backends-mast_tree-nodes.idl \ src/backends/ocarina-backends-rtsj_tree-nodes.idl TREE_ADA_SPECS = ${addprefix $(top_builddir)/, $(TREE_PIDL_SPECS:.idl=.ads)} diff --git a/src/backends/ocarina-backends-aadl_xml-main.adb b/src/backends/ocarina-backends-aadl_xml-main.adb index f36ef740..c0d02a24 100644 --- a/src/backends/ocarina-backends-aadl_xml-main.adb +++ b/src/backends/ocarina-backends-aadl_xml-main.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2011-2012 ESA & ISAE. -- +-- Copyright (C) 2011-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -31,7 +31,7 @@ -- -- ------------------------------------------------------------------------------ -with Namet; use Namet; +with Namet; use Namet; with Ocarina.Instances.Queries; use Ocarina.Instances.Queries; with Ocarina.AADL_Values; @@ -52,7 +52,7 @@ package body Ocarina.Backends.AADL_XML.Main is use Ocarina.Backends.XML_Tree.Nutils; use Ocarina.Backends.AADL_XML.Mapping; - package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes; + package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes; package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils; package XTN renames Ocarina.Backends.XML_Tree.Nodes; use type ATN.Node_Kind; @@ -67,8 +67,8 @@ package body Ocarina.Backends.AADL_XML.Main is ------------------- function Map_Component (E : Node_Id) return Node_Id is - Category_Name_String : constant array (Component_Category'Range) - of Name_Id := + Category_Name_String : constant array + (Component_Category'Range) of Name_Id := (CC_Abstract => Get_String_Name ("abstract"), CC_Bus => Get_String_Name ("bus"), CC_Data => Get_String_Name ("data"), @@ -85,8 +85,8 @@ package body Ocarina.Backends.AADL_XML.Main is CC_Virtual_Bus => Get_String_Name ("virtual bus"), CC_Virtual_Processor => Get_String_Name ("virtual processor")); - N : Node_Id; - Classifier_Node : Node_Id; + N : Node_Id; + Classifier_Node : Node_Id; begin N := Make_XML_Node ("component"); @@ -113,8 +113,7 @@ package body Ocarina.Backends.AADL_XML.Main is Append_Node_To_List (Make_Assignement (Make_Defining_Identifier (Get_String_Name ("identifier")), - Make_Defining_Identifier - (Display_Name (Identifier (E)))), + Make_Defining_Identifier (Display_Name (Identifier (E)))), XTN.Items (N)); end if; @@ -122,8 +121,7 @@ package body Ocarina.Backends.AADL_XML.Main is Classifier_Node := Make_XML_Node ("classifier"); Append_Node_To_List - (Make_Defining_Identifier - (Display_Name (Identifier (E))), + (Make_Defining_Identifier (Display_Name (Identifier (E))), XTN.Subitems (Classifier_Node)); Append_Node_To_List (Classifier_Node, XTN.Subitems (N)); @@ -148,9 +146,9 @@ package body Ocarina.Backends.AADL_XML.Main is end if; end Visit_Subcomponents_Of; - Root_System_Node : Node_Id := No_Node; - AADL_XML_Node : Node_Id := No_Node; - Current_XML_Node : Node_Id := No_Node; + Root_System_Node : Node_Id := No_Node; + AADL_XML_Node : Node_Id := No_Node; + Current_XML_Node : Node_Id := No_Node; ----------- -- Visit -- @@ -176,20 +174,19 @@ package body Ocarina.Backends.AADL_XML.Main is --------------------- procedure Visit_Component (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); - N : Node_Id; - - Old_XML_Node : Node_Id; - Subcomponents_Node : Node_Id; - Features_Node : Node_Id; - Properties_Node : Node_Id; - Feature_Node : Node_Id; - F : Node_Id; - P : Node_Id; - U : Node_Id; - Property_Node : Node_Id; - Components_Node : Node_Id; + Category : constant Component_Category := Get_Category_Of_Component (E); + N : Node_Id; + + Old_XML_Node : Node_Id; + Subcomponents_Node : Node_Id; + Features_Node : Node_Id; + Properties_Node : Node_Id; + Feature_Node : Node_Id; + F : Node_Id; + P : Node_Id; + U : Node_Id; + Property_Node : Node_Id; + Components_Node : Node_Id; Property_Value_Node : Node_Id; AADL_Property_Value : Node_Id; @@ -212,10 +209,12 @@ package body Ocarina.Backends.AADL_XML.Main is XTN.Items (AADL_XML_Node)); Append_Node_To_List - (AADL_XML_Node, XTN.Subitems (XTN.Root_Node (XTN.XML_File (U)))); + (AADL_XML_Node, + XTN.Subitems (XTN.Root_Node (XTN.XML_File (U)))); Components_Node := Make_XML_Node ("components"); Append_Node_To_List - (Components_Node, XTN.Subitems (AADL_XML_Node)); + (Components_Node, + XTN.Subitems (AADL_XML_Node)); end if; Current_XML_Node := Components_Node; end if; @@ -240,8 +239,7 @@ package body Ocarina.Backends.AADL_XML.Main is Append_Node_To_List (Make_Assignement (Make_Defining_Identifier (Get_String_Name ("identifier")), - Make_Defining_Identifier - (Display_Name (Identifier (F)))), + Make_Defining_Identifier (Display_Name (Identifier (F)))), XTN.Items (Feature_Node)); -- Direction: in/out/inout @@ -270,7 +268,8 @@ package body Ocarina.Backends.AADL_XML.Main is XTN.Items (Direction_Node)); Append_Node_To_List - (Direction_Node, XTN.Subitems (Feature_Node)); + (Direction_Node, + XTN.Subitems (Feature_Node)); end; -- Type: event/data/event data @@ -300,8 +299,7 @@ package body Ocarina.Backends.AADL_XML.Main is Make_Defining_Identifier (Type_Kind)), XTN.Items (Type_Node)); - Append_Node_To_List - (Type_Node, XTN.Subitems (Feature_Node)); + Append_Node_To_List (Type_Node, XTN.Subitems (Feature_Node)); end; -- Classifier @@ -315,7 +313,8 @@ package body Ocarina.Backends.AADL_XML.Main is (Display_Name (Identifier (Corresponding_Instance (F)))), XTN.Subitems (Classifier_Node)); Append_Node_To_List - (Classifier_Node, XTN.Subitems (Feature_Node)); + (Classifier_Node, + XTN.Subitems (Feature_Node)); end; Append_Node_To_List (Feature_Node, XTN.Subitems (Features_Node)); @@ -328,7 +327,7 @@ package body Ocarina.Backends.AADL_XML.Main is Subcomponents_Node := Make_XML_Node ("subcomponents"); Append_Node_To_List (Subcomponents_Node, XTN.Subitems (N)); - Old_XML_Node := Current_XML_Node; + Old_XML_Node := Current_XML_Node; Current_XML_Node := Subcomponents_Node; Visit_Subcomponents_Of (E); Current_XML_Node := Old_XML_Node; @@ -350,19 +349,19 @@ package body Ocarina.Backends.AADL_XML.Main is Append_Node_To_List (Make_Assignement (Make_Defining_Identifier (Get_String_Name ("name")), - Make_Defining_Identifier - (Display_Name (Identifier (F)))), + Make_Defining_Identifier (Display_Name (Identifier (F)))), XTN.Items (Property_Node)); Property_Value_Node := Make_XML_Node ("property_value"); Append_Node_To_List - (Property_Value_Node, XTN.Subitems (Property_Node)); + (Property_Value_Node, + XTN.Subitems (Property_Node)); - AADL_Property_Value := Get_Value_Of_Property_Association - (E, Name (Identifier (F))); + AADL_Property_Value := + Get_Value_Of_Property_Association (E, Name (Identifier (F))); if Present (AADL_Property_Value) - and then ATN.Kind (AADL_Property_Value) = ATN.K_SIGNED_AADLNUMBER + and then ATN.Kind (AADL_Property_Value) = ATN.K_Signed_AADLNumber and then Present (ATN.Unit_Identifier (AADL_Property_Value)) then -- This property value denotes a property with a unit @@ -373,7 +372,8 @@ package body Ocarina.Backends.AADL_XML.Main is begin Unit_Node := Make_XML_Node ("unit"); Append_Node_To_List - (Unit_Node, XTN.Subitems (Property_Value_Node)); + (Unit_Node, + XTN.Subitems (Property_Value_Node)); Append_Node_To_List (Make_Assignement @@ -391,13 +391,12 @@ package body Ocarina.Backends.AADL_XML.Main is (Make_Defining_Identifier (Get_String_Name ("unit")), Make_Defining_Identifier (ATN.Display_Name - (ATN.Unit_Identifier - (AADL_Property_Value)))), + (ATN.Unit_Identifier (AADL_Property_Value)))), XTN.Items (Unit_Node)); end; elsif Present (AADL_Property_Value) - and then ATN.Kind (AADL_Property_Value) = ATN.K_SIGNED_AADLNUMBER + and then ATN.Kind (AADL_Property_Value) = ATN.K_Signed_AADLNumber and then (not Present (ATN.Unit_Identifier (AADL_Property_Value))) then @@ -408,7 +407,8 @@ package body Ocarina.Backends.AADL_XML.Main is begin Unit_Node := Make_XML_Node ("value"); Append_Node_To_List - (Unit_Node, XTN.Subitems (Property_Value_Node)); + (Unit_Node, + XTN.Subitems (Property_Value_Node)); Append_Node_To_List (Make_Assignement @@ -423,7 +423,7 @@ package body Ocarina.Backends.AADL_XML.Main is end; elsif Present (AADL_Property_Value) - and then ATN.Kind (AADL_Property_Value) = ATN.K_LITERAL + and then ATN.Kind (AADL_Property_Value) = ATN.K_Literal then -- This property value denotes a literal @@ -432,7 +432,8 @@ package body Ocarina.Backends.AADL_XML.Main is begin Unit_Node := Make_XML_Node ("value"); Append_Node_To_List - (Unit_Node, XTN.Subitems (Property_Value_Node)); + (Unit_Node, + XTN.Subitems (Property_Value_Node)); Append_Node_To_List (Make_Assignement @@ -446,7 +447,7 @@ package body Ocarina.Backends.AADL_XML.Main is end; elsif Present (AADL_Property_Value) - and then ATN.Kind (AADL_Property_Value) = ATN.K_REFERENCE_TERM + and then ATN.Kind (AADL_Property_Value) = ATN.K_Reference_Term then -- This property value denotes a reference term @@ -455,7 +456,8 @@ package body Ocarina.Backends.AADL_XML.Main is begin Unit_Node := Make_XML_Node ("reference"); Append_Node_To_List - (Unit_Node, XTN.Subitems (Property_Value_Node)); + (Unit_Node, + XTN.Subitems (Property_Value_Node)); Append_Node_To_List (Make_Assignement @@ -470,7 +472,7 @@ package body Ocarina.Backends.AADL_XML.Main is end; elsif Present (AADL_Property_Value) - and then ATN.Kind (AADL_Property_Value) = ATN.K_ENUMERATION_TERM + and then ATN.Kind (AADL_Property_Value) = ATN.K_Enumeration_Term then -- This property value denotes an enumeration term @@ -479,19 +481,20 @@ package body Ocarina.Backends.AADL_XML.Main is begin Unit_Node := Make_XML_Node ("value"); Append_Node_To_List - (Unit_Node, XTN.Subitems (Property_Value_Node)); + (Unit_Node, + XTN.Subitems (Property_Value_Node)); Append_Node_To_List (Make_Assignement (Make_Defining_Identifier (Get_String_Name ("value")), Make_Defining_Identifier - (ATN.Display_Name (ATN.Identifier - (AADL_Property_Value)))), + (ATN.Display_Name + (ATN.Identifier (AADL_Property_Value)))), XTN.Items (Unit_Node)); end; elsif Present (AADL_Property_Value) - and then ATN.Kind (AADL_Property_Value) = ATN.K_NUMBER_RANGE_TERM + and then ATN.Kind (AADL_Property_Value) = ATN.K_Number_Range_Term then -- This property value denotes a number range term @@ -500,7 +503,8 @@ package body Ocarina.Backends.AADL_XML.Main is begin Unit_Node := Make_XML_Node ("range"); Append_Node_To_List - (Unit_Node, XTN.Subitems (Property_Value_Node)); + (Unit_Node, + XTN.Subitems (Property_Value_Node)); Append_Node_To_List (Make_Assignement @@ -528,9 +532,9 @@ package body Ocarina.Backends.AADL_XML.Main is (AADL_Property_Value))))))), XTN.Items (Unit_Node)); - if Present (ATN.Unit_Identifier - (ATN.Lower_Bound - (AADL_Property_Value))) + if Present + (ATN.Unit_Identifier + (ATN.Lower_Bound (AADL_Property_Value))) then Append_Node_To_List (Make_Assignement @@ -538,8 +542,7 @@ package body Ocarina.Backends.AADL_XML.Main is Make_Defining_Identifier (ATN.Display_Name (ATN.Unit_Identifier - (ATN.Lower_Bound - (AADL_Property_Value))))), + (ATN.Lower_Bound (AADL_Property_Value))))), XTN.Items (Unit_Node)); end if; end; @@ -550,15 +553,17 @@ package body Ocarina.Backends.AADL_XML.Main is declare Unit_Node : Node_Id; begin - Unit_Node := Make_XML_Node - (ATN.Kind (AADL_Property_Value)'Img); + Unit_Node := + Make_XML_Node (ATN.Kind (AADL_Property_Value)'Img); Append_Node_To_List - (Unit_Node, XTN.Subitems (Property_Value_Node)); + (Unit_Node, + XTN.Subitems (Property_Value_Node)); end; end if; Append_Node_To_List - (Property_Node, XTN.Subitems (Properties_Node)); + (Property_Node, + XTN.Subitems (Properties_Node)); F := Next_Node (F); end loop; end if; diff --git a/src/backends/ocarina-backends-aadl_xml-mapping.adb b/src/backends/ocarina-backends-aadl_xml-mapping.adb index 42384ca9..a5a8ebbd 100644 --- a/src/backends/ocarina-backends-aadl_xml-mapping.adb +++ b/src/backends/ocarina-backends-aadl_xml-mapping.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2011-2012 ESA & ISAE. -- +-- Copyright (C) 2011-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -58,9 +58,10 @@ package body Ocarina.Backends.AADL_XML.Mapping is function Map_HI_Node (E : Node_Id) return Node_Id is N : constant Node_Id := New_Node (XTN.K_HI_Node); begin - pragma Assert (AINU.Is_Process (E) - or else AINU.Is_System (E) - or else AINU.Is_Processor (E)); + pragma Assert + (AINU.Is_Process (E) + or else AINU.Is_System (E) + or else AINU.Is_Processor (E)); if AINU.Is_System (E) then Set_Str_To_Name_Buffer ("general"); @@ -85,16 +86,16 @@ package body Ocarina.Backends.AADL_XML.Mapping is -- Map_HI_Unit -- ----------------- - function Map_HI_Unit (E : Node_Id) - return Node_Id is - U : Node_Id; - N : Node_Id; - P : Node_Id; - Root : Node_Id; + function Map_HI_Unit (E : Node_Id) return Node_Id is + U : Node_Id; + N : Node_Id; + P : Node_Id; + Root : Node_Id; begin - pragma Assert (AINU.Is_System (E) - or else AINU.Is_Process (E) - or else AINU.Is_Processor (E)); + pragma Assert + (AINU.Is_System (E) + or else AINU.Is_Process (E) + or else AINU.Is_Processor (E)); U := New_Node (XTN.K_HI_Unit, Identifier (E)); @@ -105,8 +106,7 @@ package body Ocarina.Backends.AADL_XML.Mapping is else Get_Name_String - (To_XML_Name - (Display_Name (Identifier (Parent_Subcomponent (E))))); + (To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E))))); end if; Add_Str_To_Name_Buffer ("_aadl_xml"); diff --git a/src/backends/ocarina-backends-ada_tree-debug.adb b/src/backends/ocarina-backends-ada_tree-debug.adb index ee0b3d84..7bc71688 100644 --- a/src/backends/ocarina-backends-ada_tree-debug.adb +++ b/src/backends/ocarina-backends-ada_tree-debug.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -31,10 +31,10 @@ -- -- ------------------------------------------------------------------------------ -with Charset; use Charset; -with Locations; use Locations; -with Namet; use Namet; -with Utils; use Utils; +with Charset; use Charset; +with Locations; use Locations; +with Namet; use Namet; +with Utils; use Utils; with Ocarina.Backends.Ada_Values; use Ocarina.Backends.Ada_Values; with Ocarina.Backends.Ada_Tree.Nutils; @@ -175,25 +175,21 @@ package body Ocarina.Backends.Ada_Tree.Debug is is C : Node_Id; begin - if A = "Next_Node" - or else A = "Package_Declaration" - then + if A = "Next_Node" or else A = "Package_Declaration" then return; end if; N_Indents := N_Indents + 1; W_Indents; - Write_Str (A); + Write_Str (A); Write_Char (' '); - Write_Str (K); + Write_Str (K); Write_Char (' '); C := Node_Id (N); if K = "Name_Id" then Write_Line (Quoted (V)); - elsif K = "Node_Id" - and then Present (C) - then + elsif K = "Node_Id" and then Present (C) then case Kind (C) is when K_Boolean .. K_String => Write_Line ('(' & Image (Kind (Node_Id (N))) & ')'); @@ -228,9 +224,9 @@ package body Ocarina.Backends.Ada_Tree.Debug is procedure W_Node_Header (N : Node_Id) is begin W_Indents; - Write_Int (Int (N)); + Write_Int (Int (N)); Write_Char (' '); - Write_Str (Image (Kind (N))); + Write_Str (Image (Kind (N))); Write_Char (' '); Write_Line (Image (Loc (N))); end W_Node_Header; diff --git a/src/backends/ocarina-backends-ada_tree-debug.ads b/src/backends/ocarina-backends-ada_tree-debug.ads index 5c3af0d3..9104b14d 100644 --- a/src/backends/ocarina-backends-ada_tree-debug.ads +++ b/src/backends/ocarina-backends-ada_tree-debug.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -39,16 +39,16 @@ package Ocarina.Backends.Ada_Tree.Debug is N_Indents : Natural := 0; - procedure W_Eol (N : Natural := 1) renames Output.Write_Eol; - procedure W_Int (N : Int) renames Output.Write_Int; - procedure W_Line (N : String) renames Output.Write_Line; - procedure W_Str (N : String) renames Output.Write_Str; + procedure W_Eol (N : Natural := 1) renames Output.Write_Eol; + procedure W_Int (N : Int) renames Output.Write_Int; + procedure W_Line (N : String) renames Output.Write_Line; + procedure W_Str (N : String) renames Output.Write_Str; procedure W_Indents; - procedure W_Boolean (N : Boolean); - procedure W_Byte (N : Byte); - procedure W_List_Id (L : List_Id); - procedure W_Node_Id (N : Node_Id); + procedure W_Boolean (N : Boolean); + procedure W_Byte (N : Byte); + procedure W_List_Id (L : List_Id); + procedure W_Node_Id (N : Node_Id); procedure W_Node_Header (N : Node_Id); procedure W_Node_Attribute diff --git a/src/backends/ocarina-backends-ada_tree-generator-spark.adb b/src/backends/ocarina-backends-ada_tree-generator-spark.adb index 42fedd04..18eaeb74 100644 --- a/src/backends/ocarina-backends-ada_tree-generator-spark.adb +++ b/src/backends/ocarina-backends-ada_tree-generator-spark.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -31,8 +31,8 @@ -- -- ------------------------------------------------------------------------------ -with Namet; use Namet; -with Output; use Output; +with Namet; use Namet; +with Output; use Output; with Ocarina.Backends.Ada_Tree.Nodes; with Ocarina.Backends.Ada_Tree.Nutils; @@ -67,22 +67,25 @@ package body Ocarina.Backends.Ada_Tree.Generator.Spark is -- Initialize withed package lists for a package specification if Kind (N) = K_Package_Specification then LS := Withed_Packages (N); - LB := Withed_Packages (Package_Implementation - (Package_Declaration (N))); - -- Initialize withed package lists for a subprogram specification + LB := + Withed_Packages (Package_Implementation (Package_Declaration (N))); + -- Initialize withed package lists for a subprogram specification elsif Kind (N) = K_Subprogram_Specification then LS := Withed_Packages (N); - if Subprogram_Implementation - (Main_Subprogram_Unit (N)) /= No_Node then - LB := Withed_Packages (Subprogram_Implementation - (Main_Subprogram_Unit (N))); + if Subprogram_Implementation (Main_Subprogram_Unit (N)) /= + No_Node + then + LB := + Withed_Packages + (Subprogram_Implementation (Main_Subprogram_Unit (N))); end if; - -- Initialize withed package lists for a subprogram implementation - elsif Kind (N) = K_Subprogram_Implementation then + -- Initialize withed package lists for a subprogram implementation + elsif Kind (N) = K_Subprogram_Implementation then LS := Withed_Packages (N); if Subprogram_Specification (Main_Subprogram_Unit (N)) /= No_Node then - LB := Withed_Packages (Subprogram_Specification - (Main_Subprogram_Unit (N))); + LB := + Withed_Packages + (Subprogram_Specification (Main_Subprogram_Unit (N))); end if; end if; diff --git a/src/backends/ocarina-backends-ada_tree-generator.adb b/src/backends/ocarina-backends-ada_tree-generator.adb index a5712022..d9589680 100644 --- a/src/backends/ocarina-backends-ada_tree-generator.adb +++ b/src/backends/ocarina-backends-ada_tree-generator.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. -- +-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -139,10 +139,11 @@ package body Ocarina.Backends.Ada_Tree.Generator is ------------------- function Get_File_Name (N : Node_Id) return Name_Id is - pragma Assert (Kind (N) = K_Package_Specification or else - Kind (N) = K_Package_Implementation or else - Kind (N) = K_Subprogram_Specification or else - Kind (N) = K_Subprogram_Implementation); + pragma Assert + (Kind (N) = K_Package_Specification + or else Kind (N) = K_Package_Implementation + or else Kind (N) = K_Subprogram_Specification + or else Kind (N) = K_Subprogram_Implementation); Package_Spec_Suffix : constant String := ".ads"; Package_Body_Suffix : constant String := ".adb"; @@ -161,10 +162,8 @@ package body Ocarina.Backends.Ada_Tree.Generator is else Get_Name_String (Conventional_Base_Name - (Fully_Qualified_Name - (Defining_Identifier - (Main_Subprogram_Unit - (N))))); + (Fully_Qualified_Name + (Defining_Identifier (Main_Subprogram_Unit (N))))); end if; else if Has_Custom_File_Name (Package_Declaration (N)) then @@ -172,10 +171,8 @@ package body Ocarina.Backends.Ada_Tree.Generator is else Get_Name_String (Conventional_Base_Name - (Fully_Qualified_Name - (Defining_Identifier - (Package_Declaration - (N))))); + (Fully_Qualified_Name + (Defining_Identifier (Package_Declaration (N))))); end if; end if; @@ -497,7 +494,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is L := 1; else L := 0; - while L + 1 <= Name_Len and then Name_Buffer (L + 1) /= ' ' loop + while L + 1 <= Name_Len and then Name_Buffer (L + 1) /= ' ' loop L := L + 1; end loop; end if; @@ -764,20 +761,15 @@ package body Ocarina.Backends.Ada_Tree.Generator is -- Generate the different part of the component -- association but add a new line after "=>" - Generate - (Defining_Identifier - (Excp_Handler_Alternative)); + Generate (Defining_Identifier (Excp_Handler_Alternative)); Write_Space; Write (Tok_Arrow); Write_Eol; Increment_Indentation; Write_Indentation; - Generate - (Expression - (Excp_Handler_Alternative)); + Generate (Expression (Excp_Handler_Alternative)); Generate_Statement_Delimiter - (Expression - (Excp_Handler_Alternative)); + (Expression (Excp_Handler_Alternative)); Decrement_Indentation; Excp_Handler_Alternative := @@ -1171,9 +1163,9 @@ package body Ocarina.Backends.Ada_Tree.Generator is ------------------------- procedure Generate_Expression (N : Node_Id) is - L_Expr : constant Node_Id := Left_Expr (N); - Op : constant Operator_Id := Operator (N); - R_Expr : constant Node_Id := Right_Expr (N); + L_Expr : constant Node_Id := Left_Expr (N); + Op : constant Operator_Id := Operator (N); + R_Expr : constant Node_Id := Right_Expr (N); begin -- Each expression having a right part and a left part is -- systematically put between two parentheses. @@ -1455,7 +1447,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is --------------------------------------------- procedure Generate_Main_Subprogram_Implementation (N : Node_Id) is - Fd : File_Descriptor; + Fd : File_Descriptor; begin if Present (Subprogram_Specification (N)) then Fd := Set_Output (Get_File_Name (Subprogram_Specification (N))); @@ -1537,8 +1529,8 @@ package body Ocarina.Backends.Ada_Tree.Generator is Generate (Renamed_Entity (N)); Decrement_Indentation; - -- If an object renames another object, it cannot be - -- initialized, + -- If an object renames another object, it cannot be + -- initialized, else if Present (Expression (N)) then Write_Space; @@ -1584,8 +1576,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is -- If the user wants to generates only the spec, or if the -- package body is empty, we don't generate it. - if Disable_Pkg_Body_Gen - or else Is_Empty (Statements (N)) then + if Disable_Pkg_Body_Gen or else Is_Empty (Statements (N)) then return; end if; @@ -1648,12 +1639,11 @@ package body Ocarina.Backends.Ada_Tree.Generator is Write_Indentation; end if; - Write (Tok_End); + Write (Tok_End); Write_Space; Generate (Defining_Identifier (Package_Declaration (N))); Generate_Statement_Delimiter - (Defining_Identifier - (Package_Declaration (N))); + (Defining_Identifier (Package_Declaration (N))); Release_Output (Fd); end Generate_Package_Implementation; @@ -1712,9 +1702,9 @@ package body Ocarina.Backends.Ada_Tree.Generator is -- Do not generate empty non instanciated specs - if not Is_Instantiated_Package (N) and then - Is_Empty (Visible_Part (N)) and then - Is_Empty (Private_Part (N)) + if not Is_Instantiated_Package (N) + and then Is_Empty (Visible_Part (N)) + and then Is_Empty (Private_Part (N)) then return; end if; @@ -1792,8 +1782,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is Write_Space; Generate (Defining_Identifier (Package_Declaration (N))); Generate_Statement_Delimiter - (Defining_Identifier - (Package_Declaration (N))); + (Defining_Identifier (Package_Declaration (N))); end if; Release_Output (Fd); @@ -1814,7 +1803,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is Write_Str (Name_Buffer (1 .. Name_Len)); Write_Space; - Write (Tok_Colon); + Write (Tok_Colon); Write_Space; if Kind (Parameter_Type (N)) /= K_Access_Type_Definition then @@ -2285,7 +2274,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is Write (Tok_Is); Write_Eol; - if not Is_Empty (D) then + if not Is_Empty (D) then Increment_Indentation; M := First_Node (D); while Present (M) loop @@ -2491,8 +2480,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is C := First_Node (Discrete_Choices (V)); if No (C) - or else (Kind (C) = K_Literal - and then Value (C) = No_Value) + or else (Kind (C) = K_Literal and then Value (C) = No_Value) then O := V; else @@ -2625,7 +2613,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is ---------------------- procedure Generate_HI_Node (N : Node_Id) is - U : Node_Id := First_Node (Units (N)); + U : Node_Id := First_Node (Units (N)); Partition_Directory : constant Name_Id := To_Lower (Name (N)); begin -- Create the node directory diff --git a/src/backends/ocarina-backends-ada_tree-generator.ads b/src/backends/ocarina-backends-ada_tree-generator.ads index 596246be..d72beb35 100644 --- a/src/backends/ocarina-backends-ada_tree-generator.ads +++ b/src/backends/ocarina-backends-ada_tree-generator.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -33,7 +33,7 @@ package Ocarina.Backends.Ada_Tree.Generator is - Var_Name_Len : Natural := 0; + Var_Name_Len : Natural := 0; Disable_Pkg_Body_Gen : Boolean := False; Disable_Pkg_Spec_Gen : Boolean := False; diff --git a/src/backends/ocarina-backends-ada_tree-nutils.adb b/src/backends/ocarina-backends-ada_tree-nutils.adb index ef8f2a6a..d63e1367 100644 --- a/src/backends/ocarina-backends-ada_tree-nutils.adb +++ b/src/backends/ocarina-backends-ada_tree-nutils.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. -- +-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -52,8 +52,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is package ADN renames Ocarina.Backends.Ada_Tree.Nodes; package AAN renames Ocarina.ME_AADL.AADL_Tree.Nodes; - Var_Suffix : constant String := "_Ü"; - Initialized : Boolean := False; + Var_Suffix : constant String := "_Ü"; + Initialized : Boolean := False; Keyword_Suffix : constant String := "%Ada"; -- Used to mark Ada keywords and avoid collision with other @@ -65,15 +65,18 @@ package body Ocarina.Backends.Ada_Tree.Nutils is end record; No_Depth : constant Int := -1; - package Entity_Stack is - new GNAT.Table (Entity_Stack_Entry, Int, No_Depth + 1, 10, 10); + package Entity_Stack is new GNAT.Table + (Entity_Stack_Entry, + Int, + No_Depth + 1, + 10, + 10); use Entity_Stack; function Create_Unique_Identifier - (Name : Name_Id; - Suffix : String := "") - return Name_Id; + (Name : Name_Id; + Suffix : String := "") return Name_Id; -- This function returns a unique identifier for Name with a UT_ prefix, -- followed by the name of the node, name of the package, Name -- and Suffix if exists. @@ -83,9 +86,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- to the pragma style_checks. The 'Off' value is does not ignore -- line length. - procedure New_Operator - (O : Operator_Type; - I : String := ""); + procedure New_Operator (O : Operator_Type; I : String := ""); ---------------------- -- Add_With_Package -- @@ -118,7 +119,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is if No (U) then if Output_Tree_Warnings then - Write_Str ("WARNING: node "); + Write_Str ("WARNING: node "); Write_Name (Name (Defining_Identifier (E))); Write_Line (" has a null corresponding node"); end if; @@ -129,8 +130,9 @@ package body Ocarina.Backends.Ada_Tree.Nutils is U := Package_Specification (U); end if; - pragma Assert (Kind (U) = K_Package_Specification - or else Kind (U) = K_Package_Instantiation); + pragma Assert + (Kind (U) = K_Package_Specification + or else Kind (U) = K_Package_Instantiation); -- This is a subunit and we do not need to add a with for -- this unit but for one of its parents. If the kind of the @@ -138,7 +140,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- consider it as a subunit. if Kind (U) = K_Package_Instantiation - or else Is_Subunit_Package (U) then + or else Is_Subunit_Package (U) + then U := Parent_Unit_Name (E); -- This is a special case to handle package Standard @@ -179,10 +182,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is if To_Lower (Fully_Qualified_Name (P)) = To_Lower - (Fully_Qualified_Name - (Defining_Identifier - (Package_Declaration - (Current_Package)))) + (Fully_Qualified_Name + (Defining_Identifier (Package_Declaration (Current_Package)))) then return; end if; @@ -219,10 +220,9 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- package generated for a root node if Present - (Main_Subprogram - (Distributed_Application_Unit - (Package_Declaration - (Current_Package)))) + (Main_Subprogram + (Distributed_Application_Unit + (Package_Declaration (Current_Package)))) then Add_Char_To_Name_Buffer (' '); Get_Name_String_And_Append @@ -230,8 +230,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (Defining_Identifier (Main_Subprogram (Distributed_Application_Unit - (Package_Declaration - (Current_Package)))))); + (Package_Declaration (Current_Package)))))); end if; elsif Kind (Current_Package) /= K_Subprogram_Specification then @@ -261,7 +260,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (Existing_With, ADN.Warnings_Off (Existing_With) or else Warnings_Off); Set_Elaborated - (Existing_With, ADN.Elaborated (Existing_With) or else Elaborated); + (Existing_With, + ADN.Elaborated (Existing_With) or else Elaborated); return; end if; @@ -288,8 +288,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Append_Node_To_Current_Package -- ------------------------------------ - procedure Append_Node_To_Current_Package (N : Node_Id) - is + procedure Append_Node_To_Current_Package (N : Node_Id) is begin case Kind (Current_Package) is when K_Package_Specification => @@ -360,8 +359,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Copy_Designator (Designator : Node_Id; - Withed : Boolean := True) - return Node_Id + Withed : Boolean := True) return Node_Id is D : Node_Id; P : Node_Id := Parent_Unit_Name (Designator); @@ -421,7 +419,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Create_Subtype_From_Range_Constraint -- ------------------------------------------ - function Create_Subtype_From_Range_Constraint (R : Node_Id) return Node_Id + function Create_Subtype_From_Range_Constraint + (R : Node_Id) return Node_Id is N : Node_Id := No_Node; C_First : Node_Id := No_Node; @@ -443,20 +442,22 @@ package body Ocarina.Backends.Ada_Tree.Nutils is case Kind (Nodes.First (R)) is when K_Attribute_Designator => C_First := Defining_Identifier (Nodes.Prefix (Nodes.First (R))); - Ident := C_First; + Ident := C_First; when K_Designator => C_First := Defining_Identifier (Nodes.First (R)); - Ident := C_First; + Ident := C_First; when K_Literal => C_First := Nodes.First (R); - Ident := Make_Defining_Identifier - (Get_String_Name (Ada_Values.Image (Nodes.Value (C_First)))); + Ident := + Make_Defining_Identifier + (Get_String_Name + (Ada_Values.Image (Nodes.Value (C_First)))); when K_Defining_Identifier => C_First := Nodes.First (R); - Ident := C_First; + Ident := C_First; when others => null; end case; @@ -473,8 +474,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is when K_Literal => C_Last := Make_Defining_Identifier - (Get_String_Name - (Ada_Values.Image (Nodes.Value (Nodes.Last (R))))); + (Get_String_Name + (Ada_Values.Image (Nodes.Value (Nodes.Last (R))))); when K_Defining_Identifier => C_Last := Nodes.Last (R); @@ -495,21 +496,21 @@ package body Ocarina.Backends.Ada_Tree.Nutils is when K_Attribute_Designator => Ident := Defining_Identifier (Nodes.Prefix (Index_Type (R))); - if C_First = No_Node and then - C_Last = No_Node then + if C_First = No_Node and then C_Last = No_Node then -- Consider only Range attribute. Can be problematic -- with a size attribute for instance. - C_Index := Make_Range_Constraint - (Make_Attribute_Designator (Ident, A_First), - Make_Attribute_Designator (Ident, A_Last), - Ident); - - Sub_Ident := Make_Defining_Identifier - (Name (Index_Type (R))); + C_Index := + Make_Range_Constraint + (Make_Attribute_Designator (Ident, A_First), + Make_Attribute_Designator (Ident, A_Last), + Ident); + + Sub_Ident := + Make_Defining_Identifier (Name (Index_Type (R))); end if; when K_Designator => - Ident := Defining_Identifier (Index_Type (R)); + Ident := Defining_Identifier (Index_Type (R)); C_Index := Index_Type (R); when others => @@ -519,74 +520,93 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Case of unconstraint array (range <>) -- or a range attribute (Index'Range). - if (C_First = No_Node) and then (C_Last = No_Node) + if (C_First = No_Node) + and then (C_Last = No_Node) and then (C_Index /= No_Node) - and then Ident /= No_Node then + and then Ident /= No_Node + then -- if C_Index is an unconstraint array (range <>) -- return a range constraint, else return created type. if Kind (C_Index) = K_Designator then N := Make_Range_Constraint (No_Node, No_Node, Ident); else - Sub_Ident := Make_Defining_Identifier - (Create_Unique_Identifier - (Name (Ident), Get_Name_String (Name (Sub_Ident)))); + Sub_Ident := + Make_Defining_Identifier + (Create_Unique_Identifier + (Name (Ident), + Get_Name_String (Name (Sub_Ident)))); if Get_Name_Table_Info (Name (Sub_Ident)) = Int (No_Node) then - N := Make_Full_Type_Declaration - (Defining_Identifier => Sub_Ident, - Type_Definition => C_Index, - Is_Subtype => true); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Sub_Ident, + Type_Definition => C_Index, + Is_Subtype => True); Set_Name_Table_Info (Name (Sub_Ident), Int (Sub_Ident)); Append_Node_To_Current_Package (N); else - N := Corresponding_Node - (Node_Id (Get_Name_Table_Info (Name (Sub_Ident)))); + N := + Corresponding_Node + (Node_Id (Get_Name_Table_Info (Name (Sub_Ident)))); end if; end if; -- Case range constraint is of the form : -- My_Type range Range_First .. Range_Last -- create a type : subtype UT_Type is My_Type Range_First ..Range_Last - elsif (C_First /= No_Node) and then (C_Last /= No_Node) - and then (C_Index /= No_Node) then + elsif (C_First /= No_Node) + and then (C_Last /= No_Node) + and then (C_Index /= No_Node) + then - Sub_Ident := Make_Defining_Identifier - (Create_Unique_Identifier (Name (Sub_Ident))); + Sub_Ident := + Make_Defining_Identifier + (Create_Unique_Identifier (Name (Sub_Ident))); - N := Make_Full_Type_Declaration - (Defining_Identifier => Sub_Ident, - Type_Definition => Make_Range_Constraint (C_First, C_Last, Ident), - Is_Subtype => true); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Sub_Ident, + Type_Definition => + Make_Range_Constraint (C_First, C_Last, Ident), + Is_Subtype => True); if Get_Name_Table_Info (Name (Sub_Ident)) = Int (No_Node) then Set_Name_Table_Info (Name (Sub_Ident), Int (Sub_Ident)); Append_Node_To_Current_Package (N); else - N := Corresponding_Node - (Node_Id (Get_Name_Table_Info (Name (Sub_Ident)))); + N := + Corresponding_Node + (Node_Id (Get_Name_Table_Info (Name (Sub_Ident)))); end if; -- Case range constraint is of the form : 1 .. Max_Size, -- create a type : type UT_Type is Integer range 1 .. Max_Size - elsif (C_First /= No_Node) and then (C_Last /= No_Node) - and then (C_Index = No_Node) then + elsif (C_First /= No_Node) + and then (C_Last /= No_Node) + and then (C_Index = No_Node) + then - Sub_Ident := Make_Defining_Identifier - (Create_Unique_Identifier (Name (Sub_Ident))); + Sub_Ident := + Make_Defining_Identifier + (Create_Unique_Identifier (Name (Sub_Ident))); - N := Make_Full_Type_Declaration - (Defining_Identifier => Sub_Ident, - Type_Definition => - Make_Range_Constraint - (C_First, C_Last, Make_Defining_Identifier (TN (T_Integer))), - Is_Subtype => true); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Sub_Ident, + Type_Definition => + Make_Range_Constraint + (C_First, + C_Last, + Make_Defining_Identifier (TN (T_Integer))), + Is_Subtype => True); if Get_Name_Table_Info (Name (Sub_Ident)) = Int (No_Node) then Set_Name_Table_Info (Name (Sub_Ident), Int (Sub_Ident)); Append_Node_To_Current_Package (N); else - N := Corresponding_Node - (Node_Id (Get_Name_Table_Info (Name (Sub_Ident)))); + N := + Corresponding_Node + (Node_Id (Get_Name_Table_Info (Name (Sub_Ident)))); end if; end if; @@ -627,8 +647,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (N : Node_Id; Copy : Boolean := False; Keep_Parent : Boolean := True; - Keep_Corresponding_Node : Boolean := True) - return Node_Id + Keep_Corresponding_Node : Boolean := True) return Node_Id is P : Node_Id; Def_Id : Node_Id := N; @@ -644,9 +663,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is end if; if Keep_Corresponding_Node then - Set_Corresponding_Node - (Def_Id, - Corresponding_Node (N)); + Set_Corresponding_Node (Def_Id, Corresponding_Node (N)); end if; P := New_Node (K_Designator); @@ -963,15 +980,14 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (Subtype_Indication : Node_Id; Is_All : Boolean := False; Is_Constant : Boolean := False; - Is_Not_Null : Boolean := False) - return Node_Id + Is_Not_Null : Boolean := False) return Node_Id is N : Node_Id; begin N := New_Node (K_Access_Type_Definition); Set_Subtype_Indication (N, Subtype_Indication); - Set_Is_All (N, Is_All); + Set_Is_All (N, Is_All); Set_Is_Constant (N, Is_Constant); Set_Is_Not_Null (N, Is_Not_Null); return N; @@ -983,8 +999,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Ada_Comment (N : Name_Id; - Has_Header_Spaces : Boolean := True) - return Node_Id + Has_Header_Spaces : Boolean := True) return Node_Id is C : Node_Id; begin @@ -1013,13 +1028,13 @@ package body Ocarina.Backends.Ada_Tree.Nutils is ------------------------------ function Create_Unique_Identifier - (Name : Name_Id; - Suffix : String := "") - return Name_Id + (Name : Name_Id; + Suffix : String := "") return Name_Id is Name_Returned : Name_Id; - Pack : constant Name_Id := Nodes.Name - (Defining_Identifier (Package_Declaration (Current_Package))); + Pack : constant Name_Id := + Nodes.Name + (Defining_Identifier (Package_Declaration (Current_Package))); begin Set_Str_To_Name_Buffer (""); Get_Name_String (Pack); @@ -1029,15 +1044,15 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (Defining_Identifier (Main_Subprogram (Distributed_Application_Unit - (Package_Declaration - (Current_Package)))))); - GNAT.Case_Util.To_Mixed - (Name_Buffer (1 .. Name_Len)); + (Package_Declaration (Current_Package)))))); + GNAT.Case_Util.To_Mixed (Name_Buffer (1 .. Name_Len)); Add_Char_To_Name_Buffer ('_'); Get_Name_String_And_Append (Name); if Suffix /= "" then - Name_Returned := Add_Prefix_To_Name - ("UT_", Add_Suffix_To_Name ("_" & Suffix, Name_Find)); + Name_Returned := + Add_Prefix_To_Name + ("UT_", + Add_Suffix_To_Name ("_" & Suffix, Name_Find)); else Name_Returned := Add_Prefix_To_Name ("UT_", Name_Find); end if; @@ -1051,8 +1066,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Array_Type_Definition (Range_Constraints : List_Id; Component_Definition : Node_Id; - Aliased_Present : Boolean := False) - return Node_Id + Aliased_Present : Boolean := False) return Node_Id is N : Node_Id; @@ -1070,8 +1084,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Assignment_Statement (Variable_Identifier : Node_Id; - Expression : Node_Id) - return Node_Id + Expression : Node_Id) return Node_Id is N : Node_Id; begin @@ -1088,8 +1101,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Attribute_Definition_Clause (Defining_Identifier : Node_Id; Attribute_Designator : Attribute_Id; - Expression : Node_Id) - return Node_Id + Expression : Node_Id) return Node_Id is N : Node_Id; begin @@ -1107,8 +1119,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Attribute_Designator (Prefix : Node_Id; - Attribute : Attribute_Id) - return Node_Id + Attribute : Attribute_Id) return Node_Id is N : Node_Id; begin @@ -1126,8 +1137,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (Statement_Identifier : Node_Id := No_Node; Declarative_Part : List_Id; Statements : List_Id; - Exception_Handler : List_Id := No_List) - return Node_Id + Exception_Handler : List_Id := No_List) return Node_Id is N : Node_Id; begin @@ -1162,8 +1172,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Case_Statement (Expression : Node_Id; - Case_Statement_Alternatives : List_Id) - return Node_Id + Case_Statement_Alternatives : List_Id) return Node_Id is N : Node_Id; begin @@ -1179,8 +1188,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Case_Statement_Alternative (Discret_Choice_List : List_Id; - Statements : List_Id) - return Node_Id + Statements : List_Id) return Node_Id is N : Node_Id; begin @@ -1196,8 +1204,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Component_Association (Selector_Name : Node_Id; - Expression : Node_Id) - return Node_Id + Expression : Node_Id) return Node_Id is N : Node_Id; begin @@ -1215,8 +1222,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (Defining_Identifier : Node_Id; Subtype_Indication : Node_Id; Expression : Node_Id := No_Node; - Aliased_Present : Boolean := False) - return Node_Id is + Aliased_Present : Boolean := False) return Node_Id + is N : Node_Id; begin @@ -1234,23 +1241,20 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Decimal_Type_Definition (D_Digits : Unsigned_Long_Long; - D_Scale : Unsigned_Long_Long) - return Node_Id + D_Scale : Unsigned_Long_Long) return Node_Id is N : Node_Id; V : Value_Id; begin N := New_Node (K_Decimal_Type_Definition); - V := New_Floating_Point_Value - (Long_Double (1.0 / (10 ** (Integer (D_Scale))))); + V := + New_Floating_Point_Value + (Long_Double (1.0 / (10**(Integer (D_Scale))))); Set_Scale (N, Make_Literal (V)); - V := New_Integer_Value - (D_Digits, - 1, - 10); + V := New_Integer_Value (D_Digits, 1, 10); Set_Total (N, V); return N; @@ -1260,10 +1264,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Make_Defining_Identifier -- ------------------------------ - function Make_Defining_Identifier - (Name : Name_Id) - return Node_Id - is + function Make_Defining_Identifier (Name : Name_Id) return Node_Id is N : Node_Id; begin @@ -1278,8 +1279,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Delay_Statement (Expression : Node_Id; - Is_Until : Boolean := False) - return Node_Id + Is_Until : Boolean := False) return Node_Id is N : Node_Id; begin @@ -1298,8 +1298,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is Record_Extension_Part : Node_Id := No_Node; Is_Abstract_Type : Boolean := False; Is_Private_Extention : Boolean := False; - Is_Subtype : Boolean := False) - return Node_Id + Is_Subtype : Boolean := False) return Node_Id is N : Node_Id; @@ -1320,8 +1319,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Designator (Designator : Name_Id; Parent : Name_Id := No_Name; - Is_All : Boolean := False) - return Node_Id + Is_All : Boolean := False) return Node_Id is N : Node_Id; P : Node_Id; @@ -1345,8 +1343,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Element_Association (Index : Node_Id; - Expression : Node_Id) - return Node_Id + Expression : Node_Id) return Node_Id is N : Node_Id; begin @@ -1362,8 +1359,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Elsif_Statement (Condition : Node_Id; - Then_Statements : List_Id) - return Node_Id + Then_Statements : List_Id) return Node_Id is N : Node_Id; begin @@ -1378,8 +1374,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -------------------------------------- function Make_Enumeration_Type_Definition - (Enumeration_Literals : List_Id) - return Node_Id + (Enumeration_Literals : List_Id) return Node_Id is N : Node_Id; @@ -1395,14 +1390,13 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Enumeration_Representation_Clause (Defining_Identifier : Node_Id; - Array_Aggregate : Node_Id) - return Node_Id + Array_Aggregate : Node_Id) return Node_Id is N : Node_Id; begin - N := New_Node (K_Enumeration_Representation_Clause); + N := New_Node (K_Enumeration_Representation_Clause); Set_Defining_Identifier (N, Defining_Identifier); - Set_Array_Aggregate (N, Array_Aggregate); + Set_Array_Aggregate (N, Array_Aggregate); return N; end Make_Enumeration_Representation_Clause; @@ -1410,10 +1404,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Make_Explicit_Dereference -- ------------------------------- - function Make_Explicit_Dereference - (Prefix : Node_Id) - return Node_Id - is + function Make_Explicit_Dereference (Prefix : Node_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Explicit_Dereference); @@ -1427,17 +1418,16 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Exception_Declaration (Defining_Identifier : Node_Id; - Renamed_Exception : Node_Id := No_Node) - return Node_Id + Renamed_Exception : Node_Id := No_Node) return Node_Id is N : Node_Id; begin - N := New_Node (K_Exception_Declaration); + N := New_Node (K_Exception_Declaration); Set_Defining_Identifier (N, Defining_Identifier); - Set_Renamed_Entity (N, Renamed_Exception); - Set_Corresponding_Node (Defining_Identifier, N); - Set_Parent (N, Current_Package); + Set_Renamed_Entity (N, Renamed_Exception); + Set_Corresponding_Node (Defining_Identifier, N); + Set_Parent (N, Current_Package); return N; end Make_Exception_Declaration; @@ -1448,8 +1438,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Expression (Left_Expr : Node_Id; Operator : Operator_Type := Op_None; - Right_Expr : Node_Id := No_Node) - return Node_Id + Right_Expr : Node_Id := No_Node) return Node_Id is N : Node_Id; begin @@ -1467,8 +1456,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_For_Statement (Defining_Identifier : Node_Id; Range_Constraint : Node_Id; - Statements : List_Id) - return Node_Id + Statements : List_Id) return Node_Id is N : Node_Id; begin @@ -1483,10 +1471,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Make_Loop_Statement -- ------------------------- - function Make_Loop_Statement - (Statements : List_Id) - return Node_Id - is + function Make_Loop_Statement (Statements : List_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Loop_Statement); @@ -1503,20 +1488,20 @@ package body Ocarina.Backends.Ada_Tree.Nutils is Type_Definition : Node_Id; Discriminant_Spec : Node_Id := No_Node; Parent : Node_Id := No_Node; - Is_Subtype : Boolean := False) - return Node_Id + Is_Subtype : Boolean := False) return Node_Id is - N : Node_Id; + N : Node_Id; T_Definition : Node_Id := Type_Definition; begin -- Remove anonymous type if necessary. if Kind (Type_Definition) = K_Array_Type_Definition then - T_Definition := Remove_Anonymous_Array_Type_Definition - (Range_Constraints (Type_Definition), - Component_Definition (Type_Definition), - Nodes.Aliased_Present (Type_Definition), - Defining_Identifier, - True); + T_Definition := + Remove_Anonymous_Array_Type_Definition + (Range_Constraints (Type_Definition), + Component_Definition (Type_Definition), + Nodes.Aliased_Present (Type_Definition), + Defining_Identifier, + True); end if; N := New_Node (K_Full_Type_Declaration); @@ -1537,10 +1522,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Make_Exit_When_Statement -- ------------------------------ - function Make_Exit_When_Statement - (Condition : Node_Id) - return Node_Id - is + function Make_Exit_When_Statement (Condition : Node_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Exit_When_Statement); @@ -1556,8 +1538,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (Condition : Node_Id; Then_Statements : List_Id; Elsif_Statements : List_Id := No_List; - Else_Statements : List_Id := No_List) - return Node_Id + Else_Statements : List_Id := No_List) return Node_Id is N : Node_Id; begin @@ -1575,8 +1556,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Indexed_Component (Prefix : Node_Id; - Expressions : List_Id) - return Node_Id + Expressions : List_Id) return Node_Id is N : Node_Id; begin @@ -1594,8 +1574,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (N1 : Node_Id; N2 : Node_Id := No_Node; N3 : Node_Id := No_Node; - N4 : Node_Id := No_Node) - return List_Id + N4 : Node_Id := No_Node) return List_Id is L : List_Id; begin @@ -1621,8 +1600,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Literal (Value : Value_Id; - Parent_Designator : Node_Id := No_Node) - return Node_Id is + Parent_Designator : Node_Id := No_Node) return Node_Id + is N : Node_Id; begin @@ -1639,12 +1618,11 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Main_Subprogram_Implementation (Identifier : Node_Id; Build_Spec : Boolean := False; - Build_Body : Boolean := True) - return Node_Id + Build_Body : Boolean := True) return Node_Id is - Unit : Node_Id; - Spg : Node_Id; - N : Node_Id; + Unit : Node_Id; + Spg : Node_Id; + N : Node_Id; Style_State : constant Value_Id := Get_Style_State; begin Unit := New_Node (K_Main_Subprogram_Implementation); @@ -1655,12 +1633,13 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Spec -- ---------- - Spg := Make_Subprogram_Specification - (Defining_Identifier => Copy_Node (Identifier), - Parameter_Profile => No_List, - Return_Type => No_Node, - Parent => No_Node, - Renamed_Subprogram => No_Node); + Spg := + Make_Subprogram_Specification + (Defining_Identifier => Copy_Node (Identifier), + Parameter_Profile => No_List, + Return_Type => No_Node, + Parent => No_Node, + Renamed_Subprogram => No_Node); if Build_Spec then Set_Withed_Packages (Spg, New_List (K_Withed_Packages)); @@ -1672,9 +1651,10 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Disabling style checks - N := Make_Pragma_Statement - (Pragma_Style_Checks, - Make_List_Id (Make_Literal (Style_State))); + N := + Make_Pragma_Statement + (Pragma_Style_Checks, + Make_List_Id (Make_Literal (Style_State))); Append_Node_To_List (N, Package_Headers (Spg)); -- Binding @@ -1689,10 +1669,11 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Body -- ---------- - Spg := Make_Subprogram_Implementation - (Specification => Spg, - Declarations => New_List (K_Declaration_List), - Statements => New_List (K_Statement_List)); + Spg := + Make_Subprogram_Implementation + (Specification => Spg, + Declarations => New_List (K_Declaration_List), + Statements => New_List (K_Statement_List)); Set_Withed_Packages (Spg, New_List (K_Withed_Packages)); Set_Package_Headers (Spg, New_List (K_Package_Headers)); @@ -1702,9 +1683,10 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Disabling style checks - N := Make_Pragma_Statement - (Pragma_Style_Checks, - Make_List_Id (Make_Literal (Style_State))); + N := + Make_Pragma_Statement + (Pragma_Style_Checks, + Make_List_Id (Make_Literal (Style_State))); Append_Node_To_List (N, Package_Headers (Spg)); -- Binding @@ -1739,37 +1721,35 @@ package body Ocarina.Backends.Ada_Tree.Nutils is Parent : Node_Id := No_Node; Renamed_Object : Node_Id := No_Node; Aliased_Present : Boolean := False; - Discriminant_Spec : Node_Id := No_Node) - return Node_Id + Discriminant_Spec : Node_Id := No_Node) return Node_Id is - N : Node_Id; + N : Node_Id; Obj_Definition : Node_Id := Object_Definition; Exp : Node_Id := Expression; begin -- Remove anonymous type if necessary. if Kind (Obj_Definition) = K_Array_Type_Definition then - Obj_Definition := Remove_Anonymous_Array_Type_Definition - (Range_Constraints (Object_Definition), - Component_Definition (Object_Definition), - Nodes.Aliased_Present (Object_Definition), - Defining_Identifier); + Obj_Definition := + Remove_Anonymous_Array_Type_Definition + (Range_Constraints (Object_Definition), + Component_Definition (Object_Definition), + Nodes.Aliased_Present (Object_Definition), + Defining_Identifier); -- Fully qualify aggregates if Kind (Exp) = K_Array_Aggregate then - Exp := Make_Qualified_Expression - (Obj_Definition, - Expression); + Exp := Make_Qualified_Expression (Obj_Definition, Expression); end if; end if; - N := New_Node (K_Object_Declaration); + N := New_Node (K_Object_Declaration); Set_Defining_Identifier (N, Defining_Identifier); - Set_Corresponding_Node (Defining_Identifier, N); - Set_Constant_Present (N, Constant_Present); - Set_Aliased_Present (N, Aliased_Present); - Set_Object_Definition (N, Obj_Definition); - Set_Expression (N, Exp); - Set_Renamed_Entity (N, Renamed_Object); - Set_Discriminant_Spec (N, Discriminant_Spec); + Set_Corresponding_Node (Defining_Identifier, N); + Set_Constant_Present (N, Constant_Present); + Set_Aliased_Present (N, Aliased_Present); + Set_Object_Definition (N, Obj_Definition); + Set_Expression (N, Exp); + Set_Renamed_Entity (N, Renamed_Object); + Set_Discriminant_Spec (N, Discriminant_Spec); if No (Parent) then Set_Parent (N, Current_Package); @@ -1785,8 +1765,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is ------------------------------- function Make_Object_Instantiation - (Qualified_Expression : Node_Id) - return Node_Id + (Qualified_Expression : Node_Id) return Node_Id is N : Node_Id; begin @@ -1799,12 +1778,11 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Make_Spark_Own_Annotation -- ------------------------------- - function Make_Spark_Own_Annotation + function Make_SPARK_Own_Annotation (Variable : Node_Id; Own_Mode : Mode_Id := Mode_In; Is_Initialized : Boolean := True; - Is_Protected : Boolean := False) - return Node_Id + Is_Protected : Boolean := False) return Node_Id is N : Node_Id; begin @@ -1814,16 +1792,16 @@ package body Ocarina.Backends.Ada_Tree.Nutils is Set_Is_Initialized (N, Is_Initialized); Set_Is_Protected (N, Is_Protected); return N; - end Make_Spark_Own_Annotation; + end Make_SPARK_Own_Annotation; ------------------------------ -- Make_Package_Declaration -- ------------------------------ function Make_Package_Declaration (Identifier : Node_Id) return Node_Id is - Pkg : Node_Id; - Unit : Node_Id; - N : Node_Id; + Pkg : Node_Id; + Unit : Node_Id; + N : Node_Id; Style_State : constant Value_Id := Get_Style_State; begin Unit := New_Node (K_Package_Declaration); @@ -1846,13 +1824,15 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Disabling style checks - N := Make_Pragma_Statement (Pragma_Style_Checks, - Make_List_Id (Make_Literal (Style_State))); + N := + Make_Pragma_Statement + (Pragma_Style_Checks, + Make_List_Id (Make_Literal (Style_State))); Append_Node_To_List (N, Package_Headers (Pkg)); Set_Visible_Part (Pkg, New_List (K_Declaration_List)); Set_Private_Part (Pkg, New_List (K_Declaration_List)); - Set_SPARK_Own_Annotations (Pkg, New_List (K_Annotation_List)); + Set_SPARK_Own_Annotations (Pkg, New_List (K_Annotation_list)); Set_Package_Declaration (Pkg, Unit); Set_Package_Specification (Unit, Pkg); @@ -1870,8 +1850,10 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Disabling style checks - N := Make_Pragma_Statement (Pragma_Style_Checks, - Make_List_Id (Make_Literal (Style_State))); + N := + Make_Pragma_Statement + (Pragma_Style_Checks, + Make_List_Id (Make_Literal (Style_State))); Append_Node_To_List (N, Package_Headers (Pkg)); Set_Declarations (Pkg, New_List (K_Declaration_List)); @@ -1889,8 +1871,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Package_Instantiation (Defining_Identifier : Node_Id; Generic_Package : Node_Id; - Parameter_List : List_Id := No_List) - return Node_Id + Parameter_List : List_Id := No_List) return Node_Id is N : Node_Id; begin @@ -1917,8 +1898,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Parameter_Association (Selector_Name : Node_Id; - Actual_Parameter : Node_Id) - return Node_Id + Actual_Parameter : Node_Id) return Node_Id is N : Node_Id; begin @@ -1936,8 +1916,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (Defining_Identifier : Node_Id; Subtype_Mark : Node_Id; Parameter_Mode : Mode_Id := Mode_In; - Expression : Node_Id := No_Node) - return Node_Id + Expression : Node_Id := No_Node) return Node_Id is P : Node_Id; @@ -1956,8 +1935,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Pragma_Statement (The_Pragma : Pragma_Id; - Argument_List : List_Id := No_List) - return Node_Id + Argument_List : List_Id := No_List) return Node_Id is N : Node_Id; begin @@ -1977,8 +1955,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is Visible_Part : List_Id; Private_Part : List_Id; Parent : Node_Id := Current_Package; - Is_Type : Boolean := False) - return Node_Id + Is_Type : Boolean := False) return Node_Id is N : Node_Id; begin @@ -1997,8 +1974,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Protected_Object_Body (Defining_Identifier : Node_Id; - Statements : List_Id) - return Node_Id + Statements : List_Id) return Node_Id is N : Node_Id; begin @@ -2013,9 +1989,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is ------------------------------- function Make_Qualified_Expression - (Subtype_Mark : Node_Id; - Aggregate : Node_Id) - return Node_Id + (Subtype_Mark : Node_Id; + Aggregate : Node_Id) return Node_Id is N : Node_Id; begin @@ -2030,8 +2005,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -------------------------- function Make_Raise_Statement - (Raised_Error : Node_Id := No_Node) - return Node_Id is + (Raised_Error : Node_Id := No_Node) return Node_Id + is N : Node_Id; begin N := New_Node (K_Raise_Statement); @@ -2046,8 +2021,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Range_Constraint (First : Node_Id; Last : Node_Id; - Index_Type : Node_Id := No_Node) - return Node_Id + Index_Type : Node_Id := No_Node) return Node_Id is N : Node_Id; begin @@ -2062,10 +2036,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Make_Record_Aggregate -- --------------------------- - function Make_Record_Aggregate - (L : List_Id) - return Node_Id - is + function Make_Record_Aggregate (L : List_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Record_Aggregate); @@ -2077,9 +2048,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Make_Record_Definition -- ---------------------------- - function Make_Record_Definition - (Component_List : List_Id) - return Node_Id is + function Make_Record_Definition (Component_List : List_Id) return Node_Id is N : Node_Id; begin @@ -2096,8 +2065,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (Record_Definition : Node_Id; Is_Abstract_Type : Boolean := False; Is_Tagged_Type : Boolean := False; - Is_Limited_Type : Boolean := False) - return Node_Id is + Is_Limited_Type : Boolean := False) return Node_Id + is N : Node_Id; begin @@ -2113,10 +2082,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Make_Return_Statement -- --------------------------- - function Make_Return_Statement - (Expression : Node_Id) - return Node_Id - is + function Make_Return_Statement (Expression : Node_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Return_Statement); @@ -2130,8 +2096,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Selected_Component (Prefix : Node_Id; - Selector_Name : Node_Id) - return Node_Id + Selector_Name : Node_Id) return Node_Id is N : Node_Id; begin @@ -2147,8 +2112,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Subprogram_Call (Defining_Identifier : Node_Id; - Actual_Parameter_Part : List_Id := No_List) - return Node_Id + Actual_Parameter_Part : List_Id := No_List) return Node_Id is N : Node_Id; begin @@ -2165,9 +2129,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Subprogram_Implementation (Specification : Node_Id; Declarations : List_Id; - Statements : List_Id) - - return Node_Id + Statements : List_Id) return Node_Id is N : Node_Id; @@ -2189,17 +2151,16 @@ package body Ocarina.Backends.Ada_Tree.Nutils is Return_Type : Node_Id := No_Node; Parent : Node_Id := Current_Package; Renamed_Subprogram : Node_Id := No_Node; - Instantiated_Subprogram : Node_Id := No_Node) - return Node_Id + Instantiated_Subprogram : Node_Id := No_Node) return Node_Id is N : Node_Id; begin - N := New_Node (K_Subprogram_Specification); + N := New_Node (K_Subprogram_Specification); Set_Defining_Identifier (N, Defining_Identifier); - Set_Parameter_Profile (N, Parameter_Profile); - Set_Return_Type (N, Return_Type); - Set_Parent (N, Parent); - Set_Renamed_Entity (N, Renamed_Subprogram); + Set_Parameter_Profile (N, Parameter_Profile); + Set_Return_Type (N, Return_Type); + Set_Parent (N, Parent); + Set_Renamed_Entity (N, Renamed_Subprogram); Set_Instantiated_Entity (N, Instantiated_Subprogram); return N; end Make_Subprogram_Specification; @@ -2210,8 +2171,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Type_Attribute (Designator : Node_Id; - Attribute : Attribute_Id) - return Node_Id + Attribute : Attribute_Id) return Node_Id is procedure Get_Scoped_Name_String (S : Node_Id); @@ -2245,8 +2205,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Make_Type_Conversion (Subtype_Mark : Node_Id; - Expression : Node_Id) - return Node_Id + Expression : Node_Id) return Node_Id is N : Node_Id; begin @@ -2260,10 +2219,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Make_Used_Type -- -------------------- - function Make_Used_Type - (The_Used_Type : Node_Id) - return Node_Id - is + function Make_Used_Type (The_Used_Type : Node_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Used_Type); @@ -2280,8 +2236,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is (Defining_Identifier : Node_Id; Used : Boolean := False; Warnings_Off : Boolean := False; - Elaborated : Boolean := False) - return Node_Id + Elaborated : Boolean := False) return Node_Id is N : Node_Id; begin @@ -2289,7 +2244,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is Set_Defining_Identifier (N, Defining_Identifier); Set_Used (N, Used); Set_Warnings_Off (N, Warnings_Off); - Set_Elaborated (N, Elaborated); + Set_Elaborated (N, Elaborated); return N; end Make_Withed_Package; @@ -2297,10 +2252,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Make_Used_Package -- ----------------------- - function Make_Used_Package - (The_Used_Package : Node_Id) - return Node_Id - is + function Make_Used_Package (The_Used_Package : Node_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Used_Package); @@ -2314,9 +2266,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is ----------------------- function Make_Variant_Part - (Discriminant : Node_Id; - Variant_List : List_Id) - return Node_Id + (Discriminant : Node_Id; + Variant_List : List_Id) return Node_Id is N : Node_Id; @@ -2331,10 +2282,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- Make_Comment_Header -- ------------------------- - procedure Make_Comment_Header - (Package_Header : List_Id) - is - N : Node_Id; + procedure Make_Comment_Header (Package_Header : List_Id) is + N : Node_Id; begin -- Appending the comment header lines to the package header @@ -2385,19 +2334,19 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function New_List (Kind : Node_Kind; - From : Node_Id := No_Node) - return List_Id is + From : Node_Id := No_Node) return List_Id + is N : Node_Id; begin Entries.Increment_Last; - N := Entries.Last; + N := Entries.Last; Entries.Table (N) := Default_Node; Set_Kind (N, Kind); if Present (From) then - Set_Loc (N, Loc (From)); + Set_Loc (N, Loc (From)); else - Set_Loc (N, No_Location); + Set_Loc (N, No_Location); end if; return List_Id (N); end New_List; @@ -2408,13 +2357,12 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function New_Node (Kind : Node_Kind; - From : Node_Id := No_Node) - return Node_Id + From : Node_Id := No_Node) return Node_Id is N : Node_Id; begin Entries.Increment_Last; - N := Entries.Last; + N := Entries.Last; Entries.Table (N) := Default_Node; Set_Kind (N, Kind); @@ -2431,10 +2379,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- New_Token -- --------------- - procedure New_Token - (T : Token_Type; - I : String := "") - is + procedure New_Token (T : Token_Type; I : String := "") is Name : Name_Id; begin if T in Keyword_Type or else T in Spark_Keyword_Type then @@ -2458,9 +2403,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- New_Operator -- ------------------ - procedure New_Operator - (O : Operator_Type; - I : String := "") is + procedure New_Operator (O : Operator_Type; I : String := "") is begin if O in Keyword_Operator then Set_Str_To_Name_Buffer (Image (O)); @@ -2499,11 +2442,11 @@ package body Ocarina.Backends.Ada_Tree.Nutils is N : Node_Id; begin N := New_Node (K_Designator); - Set_Defining_Identifier - (N, Make_Defining_Identifier (Name (P))); + Set_Defining_Identifier (N, Make_Defining_Identifier (Name (P))); if Present (Parent_Unit_Name (P)) then Set_Homogeneous_Parent_Unit_Name - (N, Qualified_Designator (Parent_Unit_Name (P))); + (N, + Qualified_Designator (Parent_Unit_Name (P))); else Set_Homogeneous_Parent_Unit_Name (N, No_Node); end if; @@ -2520,12 +2463,11 @@ package body Ocarina.Backends.Ada_Tree.Nutils is Component_Definition : Node_Id; Aliased_Present : Boolean := False; Variable_Name : Node_Id; - Is_Full_Type : Boolean := False) - return Node_Id + Is_Full_Type : Boolean := False) return Node_Id is N : Node_Id; R : Node_Id; - Comp : Node_Id := No_Node; + Comp : Node_Id := No_Node; T_Def : Node_Id; Tmp_Id : Node_Id; List_Constraints : constant List_Id := New_List (K_List_Id); @@ -2549,7 +2491,8 @@ package body Ocarina.Backends.Ada_Tree.Nutils is if Kind (N) = K_Full_Type_Declaration then Append_Node_To_List - (Defining_Identifier (N), List_Constraints); + (Defining_Identifier (N), + List_Constraints); else Append_Node_To_List (N, List_Constraints); end if; @@ -2586,19 +2529,22 @@ package body Ocarina.Backends.Ada_Tree.Nutils is exit when No (R); end loop; - Comp := Make_Indexed_Component - (Prefix => Nodes.Prefix (Component_Definition), - Expressions => List_Comp); + Comp := + Make_Indexed_Component + (Prefix => Nodes.Prefix (Component_Definition), + Expressions => List_Comp); -- Create a unique name for component type - Tmp_Id := Make_Defining_Identifier - (Create_Unique_Identifier (Name (Variable_Name), "Component")); + Tmp_Id := + Make_Defining_Identifier + (Create_Unique_Identifier (Name (Variable_Name), "Component")); - N := Make_Full_Type_Declaration - (Defining_Identifier => Tmp_Id, - Type_Definition => Comp, - Is_Subtype => True); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Tmp_Id, + Type_Definition => Comp, + Is_Subtype => True); Comp := Defining_Identifier (N); @@ -2611,16 +2557,17 @@ package body Ocarina.Backends.Ada_Tree.Nutils is Comp := Component_Definition; end case; - N := Make_Array_Type_Definition - (List_Constraints, Comp, Aliased_Present); + N := + Make_Array_Type_Definition (List_Constraints, Comp, Aliased_Present); -- Add a full type node, only if the caller of -- Remove_Anonymous_Array_Type_Definition is Make_Object_Declaration. if not Is_Full_Type then - Tmp_Id := Make_Defining_Identifier - (Create_Unique_Identifier (Name (Variable_Name), "Array")); + Tmp_Id := + Make_Defining_Identifier + (Create_Unique_Identifier (Name (Variable_Name), "Array")); -- We don't call Make_Full_Type_Declaration in order to -- avoid recursive calls. @@ -2681,47 +2628,43 @@ package body Ocarina.Backends.Ada_Tree.Nutils is Parent : Node_Id) is begin - pragma Assert (ADN.Kind (Child) = K_Defining_Identifier - or else ADN.Kind (Child) = K_Designator); + pragma Assert + (ADN.Kind (Child) = K_Defining_Identifier + or else ADN.Kind (Child) = K_Designator); - pragma Assert (Parent = No_Node - or else ADN.Kind (Parent) = K_Defining_Identifier - or else ADN.Kind (Parent) = K_Designator); + pragma Assert + (Parent = No_Node + or else ADN.Kind (Parent) = K_Defining_Identifier + or else ADN.Kind (Parent) = K_Designator); case ADN.Kind (Child) is when K_Defining_Identifier => if Parent = No_Node then - Set_Parent_Unit_Name - (Child, Parent); + Set_Parent_Unit_Name (Child, Parent); elsif ADN.Kind (Parent) = K_Defining_Identifier then - Set_Parent_Unit_Name - (Child, Parent); + Set_Parent_Unit_Name (Child, Parent); elsif ADN.Kind (Parent) = K_Designator then - Set_Parent_Unit_Name - (Child, Defining_Identifier (Parent)); + Set_Parent_Unit_Name (Child, Defining_Identifier (Parent)); else raise Program_Error; end if; when K_Designator => if Parent = No_Node then - Set_Parent_Unit_Name - (Child, Parent); + Set_Parent_Unit_Name (Child, Parent); if Present (Defining_Identifier (Child)) then - Set_Parent_Unit_Name - (Defining_Identifier (Child), Parent); + Set_Parent_Unit_Name (Defining_Identifier (Child), Parent); end if; elsif ADN.Kind (Parent) = K_Defining_Identifier then Set_Parent_Unit_Name - (Child, Defining_Identifier_To_Designator (Parent)); + (Child, + Defining_Identifier_To_Designator (Parent)); if Present (Defining_Identifier (Child)) then - Set_Parent_Unit_Name - (Defining_Identifier (Child), Parent); + Set_Parent_Unit_Name (Defining_Identifier (Child), Parent); end if; elsif ADN.Kind (Parent) = K_Designator then - Set_Parent_Unit_Name - (Child, Parent); + Set_Parent_Unit_Name (Child, Parent); if Present (Defining_Identifier (Child)) then Set_Parent_Unit_Name (Defining_Identifier (Child), @@ -3098,9 +3041,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is V : Byte; begin Get_Name_String (Normalize_Name (N)); - while First <= Name_Len - and then Name_Buffer (First) = '_' - loop + while First <= Name_Len and then Name_Buffer (First) = '_' loop First := First + 1; end loop; @@ -3122,7 +3063,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is -- "AADL_" string before the identifier. Test_Name := Add_Suffix_To_Name (Keyword_Suffix, Name); - V := Get_Name_Table_Byte (Test_Name); + V := Get_Name_Table_Byte (Test_Name); if V > 0 then Set_Str_To_Name_Buffer ("AADL_"); Get_Name_String_And_Append (Name); @@ -3138,8 +3079,7 @@ package body Ocarina.Backends.Ada_Tree.Nutils is function Extract_Designator (N : Node_Id; - Add_With_Clause : Boolean := True) - return Node_Id + Add_With_Clause : Boolean := True) return Node_Id is P : Node_Id; D : Node_Id := No_Node; @@ -3148,13 +3088,11 @@ package body Ocarina.Backends.Ada_Tree.Nutils is begin case Kind (N) is - when K_Full_Type_Declaration | - K_Subprogram_Specification => + when K_Full_Type_Declaration | K_Subprogram_Specification => P := Parent (X); FE := Frontend_Node (X); - when K_Object_Declaration - | K_Exception_Declaration => + when K_Object_Declaration | K_Exception_Declaration => P := Parent (X); FE := Frontend_Node (X); @@ -3180,9 +3118,10 @@ package body Ocarina.Backends.Ada_Tree.Nutils is raise Program_Error; end case; - D := Defining_Identifier_To_Designator - (N => Defining_Identifier (X), - Keep_Parent => False); + D := + Defining_Identifier_To_Designator + (N => Defining_Identifier (X), + Keep_Parent => False); Set_Frontend_Node (D, FE); if No (P) then @@ -3193,19 +3132,17 @@ package body Ocarina.Backends.Ada_Tree.Nutils is if Kind (N) = K_Full_Type_Declaration and then Present (Parent_Unit_Name (Defining_Identifier (N))) - and then Kind - (Corresponding_Node - (Parent_Unit_Name - (Defining_Identifier - (N)))) = K_Package_Instantiation + and then + Kind + (Corresponding_Node (Parent_Unit_Name (Defining_Identifier (N)))) = + K_Package_Instantiation then Set_Homogeneous_Parent_Unit_Name (D, Parent_Unit_Name (Defining_Identifier (N))); P := Extract_Designator (P); else - Set_Homogeneous_Parent_Unit_Name - (D, Extract_Designator (P, False)); + Set_Homogeneous_Parent_Unit_Name (D, Extract_Designator (P, False)); P := Parent_Unit_Name (D); end if; @@ -3239,9 +3176,9 @@ package body Ocarina.Backends.Ada_Tree.Nutils is if Pos = 0 or else Pos = 1 then Display_Error - ("""" - & Get_Name_String (N) - & """ is not an Ada fully qualified entity name", + ("""" & + Get_Name_String (N) & + """ is not an Ada fully qualified entity name", Fatal => True); end if; @@ -3271,9 +3208,9 @@ package body Ocarina.Backends.Ada_Tree.Nutils is if Pos = Name_Len or else Pos = Name_Len - 1 then Display_Error - ("""" - & Get_Name_String (N) - & """ is not an Ada fully qualified entity name", + ("""" & + Get_Name_String (N) & + """ is not an Ada fully qualified entity name", Fatal => True); end if; diff --git a/src/backends/ocarina-backends-ada_tree-nutils.ads b/src/backends/ocarina-backends-ada_tree-nutils.ads index a6f1faf6..7f955c4c 100644 --- a/src/backends/ocarina-backends-ada_tree-nutils.ads +++ b/src/backends/ocarina-backends-ada_tree-nutils.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. -- +-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -35,8 +35,8 @@ with Ocarina.Backends.Ada_Tree.Nodes; use Ocarina.Backends.Ada_Tree.Nodes; package Ocarina.Backends.Ada_Tree.Nutils is - Int0_Val : Value_Id; - Int1_Val : Value_Id; + Int0_Val : Value_Id; + Int1_Val : Value_Id; Output_Tree_Warnings : Boolean := False; Output_Unit_Withing : Boolean := False; @@ -44,9 +44,9 @@ package Ocarina.Backends.Ada_Tree.Nutils is type Token_Type is ( - -- Token name Token type - -- Keywords - Tok_Mod, -- MOD **** First Keyword + -- Token name Token type + -- Keywords + Tok_Mod, -- MOD **** First Keyword Tok_Rem, -- REM Tok_New, -- NEW Tok_Abs, -- ABS @@ -120,7 +120,7 @@ package Ocarina.Backends.Ada_Tree.Nutils is Tok_With, -- WITH Tok_Separate, -- SEPARATE **** Last Keyword - -- Graphic Characters + -- Graphic Characters Tok_Double_Asterisk, -- ** Tok_Ampersand, -- & Tok_Minus, -- - @@ -149,7 +149,7 @@ package Ocarina.Backends.Ada_Tree.Nutils is Tok_Dot_Dot, -- .. Tok_Minus_Minus, -- -- - -- SPARK + -- SPARK Tok_Annotation, -- --# Tok_Own, -- Own Tok_Inherit, @@ -157,13 +157,11 @@ package Ocarina.Backends.Ada_Tree.Nutils is Token_Image : array (Token_Type) of Name_Id; - subtype Keyword_Type is Token_Type - range Tok_Mod .. Tok_Separate; + subtype Keyword_Type is Token_Type range Tok_Mod .. Tok_Separate; - subtype Spark_Keyword_Type is Token_Type - range Tok_Own .. Tok_Initialized; + subtype Spark_Keyword_Type is Token_Type range Tok_Own .. Tok_Initialized; - type Operator_Type is + type Operator_Type is (Op_Not, -- not Op_And, -- and Op_In, -- in @@ -193,11 +191,11 @@ package Ocarina.Backends.Ada_Tree.Nutils is Op_None); -- No operation Operator_Image : array - (Operator_Type'Pos (Op_And) .. Operator_Type'Pos (Op_Vertical_Bar)) - of Name_Id; + (Operator_Type'Pos (Op_And) .. + Operator_Type'Pos (Op_Vertical_Bar)) of Name_Id; - subtype Keyword_Operator is Operator_Type - range Operator_Type'First .. Op_Or_Else; + subtype Keyword_Operator is + Operator_Type range Operator_Type'First .. Op_Or_Else; type Parameter_Id is (P_A, @@ -436,10 +434,7 @@ package Ocarina.Backends.Ada_Tree.Nutils is GN : array (Pragma_Id) of Name_Id; - type Error_Id is - (E_Program_Error, - E_Constraint_Error, - E_NYI); + type Error_Id is (E_Program_Error, E_Constraint_Error, E_NYI); EN : array (Error_Id) of Name_Id; @@ -459,29 +454,23 @@ package Ocarina.Backends.Ada_Tree.Nutils is procedure Push_Entity (E : Node_Id); procedure Pop_Entity; - function Current_Entity return Node_Id; - function Current_Package return Node_Id; + function Current_Entity return Node_Id; + function Current_Package return Node_Id; - function Copy_Node - (N : Node_Id) - return Node_Id; + function Copy_Node (N : Node_Id) return Node_Id; - function Create_Subtype_From_Range_Constraint - (R : Node_Id) - return Node_Id; + function Create_Subtype_From_Range_Constraint (R : Node_Id) return Node_Id; -- This function takes a range_constraint, creates a node for -- the anonymous type of the range constraint and returns it. -- It's called only by Remove_Anonymous_Array_Type_Definition function New_Node (Kind : Node_Kind; - From : Node_Id := No_Node) - return Node_Id; + From : Node_Id := No_Node) return Node_Id; function New_List (Kind : Node_Kind; - From : Node_Id := No_Node) - return List_Id; + From : Node_Id := No_Node) return List_Id; function Image (T : Token_Type) return String; function Image (O : Operator_Type) return String; @@ -502,27 +491,23 @@ package Ocarina.Backends.Ada_Tree.Nutils is function Copy_Designator (Designator : Node_Id; - Withed : Boolean := True) - return Node_Id; + Withed : Boolean := True) return Node_Id; function Defining_Identifier_To_Designator (N : Node_Id; Copy : Boolean := False; Keep_Parent : Boolean := True; - Keep_Corresponding_Node : Boolean := True) - return Node_Id; + Keep_Corresponding_Node : Boolean := True) return Node_Id; function Make_Access_Type_Definition (Subtype_Indication : Node_Id; Is_All : Boolean := False; Is_Constant : Boolean := False; - Is_Not_Null : Boolean := False) - return Node_Id; + Is_Not_Null : Boolean := False) return Node_Id; function Make_Ada_Comment (N : Name_Id; - Has_Header_Spaces : Boolean := True) - return Node_Id; + Has_Header_Spaces : Boolean := True) return Node_Id; -- This function does only the fllowing thing: it creates a node -- whose name is the full text of the comment. It does not split -- the comment into many lines. This is done in the code @@ -533,136 +518,111 @@ package Ocarina.Backends.Ada_Tree.Nutils is function Make_Array_Type_Definition (Range_Constraints : List_Id; Component_Definition : Node_Id; - Aliased_Present : Boolean := False) - return Node_Id; + Aliased_Present : Boolean := False) return Node_Id; -- Usually used with Make_Full_Type_Declaration function Make_Assignment_Statement (Variable_Identifier : Node_Id; - Expression : Node_Id) - return Node_Id; + Expression : Node_Id) return Node_Id; function Make_Attribute_Definition_Clause (Defining_Identifier : Node_Id; Attribute_Designator : Attribute_Id; - Expression : Node_Id) - return Node_Id; + Expression : Node_Id) return Node_Id; function Make_Attribute_Designator (Prefix : Node_Id; - Attribute : Attribute_Id) - return Node_Id; + Attribute : Attribute_Id) return Node_Id; function Make_Block_Statement (Statement_Identifier : Node_Id := No_Node; Declarative_Part : List_Id; Statements : List_Id; - Exception_Handler : List_Id := No_List) - return Node_Id; + Exception_Handler : List_Id := No_List) return Node_Id; function Make_Case_Label (Value : Value_Id) return Node_Id; function Make_Case_Statement (Expression : Node_Id; - Case_Statement_Alternatives : List_Id) - return Node_Id; + Case_Statement_Alternatives : List_Id) return Node_Id; function Make_Case_Statement_Alternative (Discret_Choice_List : List_Id; - Statements : List_Id) - return Node_Id; + Statements : List_Id) return Node_Id; function Make_Component_Association (Selector_Name : Node_Id; - Expression : Node_Id) - return Node_Id; + Expression : Node_Id) return Node_Id; function Make_Component_Declaration (Defining_Identifier : Node_Id; Subtype_Indication : Node_Id; Expression : Node_Id := No_Node; - Aliased_Present : Boolean := False) - return Node_Id; + Aliased_Present : Boolean := False) return Node_Id; function Make_Decimal_Type_Definition (D_Digits : Unsigned_Long_Long; - D_Scale : Unsigned_Long_Long) - return Node_Id; + D_Scale : Unsigned_Long_Long) return Node_Id; - function Make_Defining_Identifier (Name : Name_Id) return Node_Id; + function Make_Defining_Identifier (Name : Name_Id) return Node_Id; function Make_Delay_Statement (Expression : Node_Id; - Is_Until : Boolean := False) - return Node_Id; + Is_Until : Boolean := False) return Node_Id; function Make_Derived_Type_Definition (Subtype_Indication : Node_Id; Record_Extension_Part : Node_Id := No_Node; Is_Abstract_Type : Boolean := False; Is_Private_Extention : Boolean := False; - Is_Subtype : Boolean := False) - return Node_Id; + Is_Subtype : Boolean := False) return Node_Id; function Make_Designator (Designator : Name_Id; Parent : Name_Id := No_Name; - Is_All : Boolean := False) - return Node_Id; + Is_All : Boolean := False) return Node_Id; function Make_Elsif_Statement (Condition : Node_Id; - Then_Statements : List_Id) - return Node_Id; + Then_Statements : List_Id) return Node_Id; function Make_Element_Association (Index : Node_Id; - Expression : Node_Id) - return Node_Id; + Expression : Node_Id) return Node_Id; -- If 'Index' is No_Node, then 'others => ' will be -- generated function Make_Enumeration_Type_Definition - (Enumeration_Literals : List_Id) - return Node_Id; + (Enumeration_Literals : List_Id) return Node_Id; function Make_Enumeration_Representation_Clause (Defining_Identifier : Node_Id; - Array_Aggregate : Node_Id) - return Node_Id; + Array_Aggregate : Node_Id) return Node_Id; function Make_Exception_Declaration (Defining_Identifier : Node_Id; - Renamed_Exception : Node_Id := No_Node) - return Node_Id; + Renamed_Exception : Node_Id := No_Node) return Node_Id; - function Make_Explicit_Dereference - (Prefix : Node_Id) - return Node_Id; + function Make_Explicit_Dereference (Prefix : Node_Id) return Node_Id; function Make_Expression (Left_Expr : Node_Id; Operator : Operator_Type := Op_None; - Right_Expr : Node_Id := No_Node) - return Node_Id; + Right_Expr : Node_Id := No_Node) return Node_Id; function Make_For_Statement (Defining_Identifier : Node_Id; Range_Constraint : Node_Id; - Statements : List_Id) - return Node_Id; + Statements : List_Id) return Node_Id; - function Make_Loop_Statement - (Statements : List_Id) - return Node_Id; + function Make_Loop_Statement (Statements : List_Id) return Node_Id; function Make_Full_Type_Declaration (Defining_Identifier : Node_Id; Type_Definition : Node_Id; Discriminant_Spec : Node_Id := No_Node; Parent : Node_Id := No_Node; - Is_Subtype : Boolean := False) - return Node_Id; + Is_Subtype : Boolean := False) return Node_Id; -- No_Node as Type_Definition made type declaration without actual -- definition (eg. "type X;"). @@ -670,31 +630,26 @@ package Ocarina.Backends.Ada_Tree.Nutils is (Condition : Node_Id; Then_Statements : List_Id; Elsif_Statements : List_Id := No_List; - Else_Statements : List_Id := No_List) - return Node_Id; + Else_Statements : List_Id := No_List) return Node_Id; function Make_Indexed_Component (Prefix : Node_Id; - Expressions : List_Id) - return Node_Id; + Expressions : List_Id) return Node_Id; function Make_List_Id (N1 : Node_Id; N2 : Node_Id := No_Node; N3 : Node_Id := No_Node; - N4 : Node_Id := No_Node) - return List_Id; + N4 : Node_Id := No_Node) return List_Id; function Make_Literal (Value : Value_Id; - Parent_Designator : Node_Id := No_Node) - return Node_Id; + Parent_Designator : Node_Id := No_Node) return Node_Id; function Make_Main_Subprogram_Implementation (Identifier : Node_Id; Build_Spec : Boolean := False; - Build_Body : Boolean := True) - return Node_Id; + Build_Body : Boolean := True) return Node_Id; -- If Build_Body is false generate only the spec of a main -- subprogram @@ -708,111 +663,87 @@ package Ocarina.Backends.Ada_Tree.Nutils is Parent : Node_Id := No_Node; Renamed_Object : Node_Id := No_Node; Aliased_Present : Boolean := False; - Discriminant_Spec : Node_Id := No_Node) - return Node_Id; + Discriminant_Spec : Node_Id := No_Node) return Node_Id; function Make_Object_Instantiation - (Qualified_Expression : Node_Id) - return Node_Id; + (Qualified_Expression : Node_Id) return Node_Id; function Make_SPARK_Own_Annotation (Variable : Node_Id; Own_Mode : Mode_Id := Mode_In; Is_Initialized : Boolean := True; - Is_Protected : Boolean := False) - return Node_Id; + Is_Protected : Boolean := False) return Node_Id; - function Make_Package_Declaration - (Identifier : Node_Id) - return Node_Id; + function Make_Package_Declaration (Identifier : Node_Id) return Node_Id; function Make_Package_Instantiation (Defining_Identifier : Node_Id; Generic_Package : Node_Id; - Parameter_List : List_Id := No_List) - return Node_Id; + Parameter_List : List_Id := No_List) return Node_Id; function Make_Private_Type_Definition return Node_Id; function Make_Parameter_Association (Selector_Name : Node_Id; - Actual_Parameter : Node_Id) - return Node_Id; + Actual_Parameter : Node_Id) return Node_Id; function Make_Parameter_Specification (Defining_Identifier : Node_Id; Subtype_Mark : Node_Id; Parameter_Mode : Mode_Id := Mode_In; - Expression : Node_Id := No_Node) - return Node_Id; + Expression : Node_Id := No_Node) return Node_Id; function Make_Pragma_Statement (The_Pragma : Pragma_Id; - Argument_List : List_Id := No_List) - return Node_Id; + Argument_List : List_Id := No_List) return Node_Id; function Make_Protected_Object_Spec (Defining_Identifier : Node_Id; Visible_Part : List_Id; Private_Part : List_Id; Parent : Node_Id := Current_Package; - Is_Type : Boolean := False) - return Node_Id; + Is_Type : Boolean := False) return Node_Id; function Make_Protected_Object_Body (Defining_Identifier : Node_Id; - Statements : List_Id) - return Node_Id; + Statements : List_Id) return Node_Id; function Make_Qualified_Expression - (Subtype_Mark : Node_Id; - Aggregate : Node_Id) - return Node_Id; + (Subtype_Mark : Node_Id; + Aggregate : Node_Id) return Node_Id; function Make_Raise_Statement - (Raised_Error : Node_Id := No_Node) - return Node_Id; + (Raised_Error : Node_Id := No_Node) return Node_Id; function Make_Range_Constraint (First : Node_Id; Last : Node_Id; - Index_Type : Node_Id := No_Node) - return Node_Id; + Index_Type : Node_Id := No_Node) return Node_Id; - function Make_Record_Aggregate - (L : List_Id) - return Node_Id; + function Make_Record_Aggregate (L : List_Id) return Node_Id; - function Make_Record_Definition - (Component_List : List_Id) - return Node_Id; + function Make_Record_Definition (Component_List : List_Id) return Node_Id; function Make_Record_Type_Definition (Record_Definition : Node_Id; Is_Abstract_Type : Boolean := False; Is_Tagged_Type : Boolean := False; - Is_Limited_Type : Boolean := False) - return Node_Id; + Is_Limited_Type : Boolean := False) return Node_Id; - function Make_Return_Statement - (Expression : Node_Id) - return Node_Id; + function Make_Return_Statement (Expression : Node_Id) return Node_Id; function Make_Subprogram_Call (Defining_Identifier : Node_Id; - Actual_Parameter_Part : List_Id := No_List) - return Node_Id; + Actual_Parameter_Part : List_Id := No_List) return Node_Id; function Make_Selected_Component (Prefix : Node_Id; - Selector_Name : Node_Id) - return Node_Id; + Selector_Name : Node_Id) return Node_Id; function Make_Subprogram_Implementation (Specification : Node_Id; Declarations : List_Id; - Statements : List_Id) - return Node_Id; + Statements : List_Id) return Node_Id; function Make_Subprogram_Specification (Defining_Identifier : Node_Id; @@ -820,45 +751,33 @@ package Ocarina.Backends.Ada_Tree.Nutils is Return_Type : Node_Id := No_Node; Parent : Node_Id := Current_Package; Renamed_Subprogram : Node_Id := No_Node; - Instantiated_Subprogram : Node_Id := No_Node) - return Node_Id; + Instantiated_Subprogram : Node_Id := No_Node) return Node_Id; function Make_Type_Attribute (Designator : Node_Id; - Attribute : Attribute_Id) - return Node_Id; + Attribute : Attribute_Id) return Node_Id; function Make_Type_Conversion (Subtype_Mark : Node_Id; - Expression : Node_Id) - return Node_Id; + Expression : Node_Id) return Node_Id; function Make_Withed_Package (Defining_Identifier : Node_Id; Used : Boolean := False; Warnings_Off : Boolean := False; - Elaborated : Boolean := False) - return Node_Id; + Elaborated : Boolean := False) return Node_Id; - function Make_Exit_When_Statement - (Condition : Node_Id) - return Node_Id; + function Make_Exit_When_Statement (Condition : Node_Id) return Node_Id; - function Make_Used_Package - (The_Used_Package : Node_Id) - return Node_Id; + function Make_Used_Package (The_Used_Package : Node_Id) return Node_Id; - function Make_Used_Type - (The_Used_Type : Node_Id) - return Node_Id; + function Make_Used_Type (The_Used_Type : Node_Id) return Node_Id; function Make_Variant_Part - (Discriminant : Node_Id; - Variant_List : List_Id) - return Node_Id; + (Discriminant : Node_Id; + Variant_List : List_Id) return Node_Id; - procedure Make_Comment_Header - (Package_Header : List_Id); + procedure Make_Comment_Header (Package_Header : List_Id); -- This procedure generates a comment header for the generated -- packages. @@ -870,17 +789,14 @@ package Ocarina.Backends.Ada_Tree.Nutils is -- Return a comment message. Used by all the tree -- converters - function Qualified_Designator - (P : Node_Id) - return Node_Id; + function Qualified_Designator (P : Node_Id) return Node_Id; function Remove_Anonymous_Array_Type_Definition (Range_Constraints : List_Id; Component_Definition : Node_Id; Aliased_Present : Boolean := False; Variable_Name : Node_Id; - Is_Full_Type : Boolean := False) - return Node_Id; + Is_Full_Type : Boolean := False) return Node_Id; -- This function removes the anonymous arrays type definition -- by creating subtypes, and returns the identifier of type -- replacing the anonymous type. Only Make_Full_Type_Declaration @@ -961,8 +877,7 @@ package Ocarina.Backends.Ada_Tree.Nutils is function Extract_Designator (N : Node_Id; - Add_With_Clause : Boolean := True) - return Node_Id; + Add_With_Clause : Boolean := True) return Node_Id; -- Extracts the designator of the *Ada* entity N and return a copy -- of it after adding the proper 'with' clause to the current -- package if 'Add_With_Clause' is True. N may be: diff --git a/src/backends/ocarina-backends-ada_values.adb b/src/backends/ocarina-backends-ada_values.adb index 4e484e54..807b90be 100644 --- a/src/backends/ocarina-backends-ada_values.adb +++ b/src/backends/ocarina-backends-ada_values.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -31,7 +31,7 @@ -- -- ------------------------------------------------------------------------------ -with Namet; use Namet; +with Namet; use Namet; with Ocarina.AADL_Values; @@ -41,10 +41,9 @@ package body Ocarina.Backends.Ada_Values is package OV renames Ocarina.AADL_Values; - Hex : constant String := "0123456789ABCDEF"; + Hex : constant String := "0123456789ABCDEF"; - package VT is - new GNAT.Table (Value_Type, Value_Id, No_Value + 1, 10, 10); + package VT is new GNAT.Table (Value_Type, Value_Id, No_Value + 1, 10, 10); subtype ULL is Unsigned_Long_Long; @@ -63,8 +62,7 @@ package body Ocarina.Backends.Ada_Values is -- "*" -- --------- - function "*" (L, R : Value_Type) return Value_Type - is + function "*" (L, R : Value_Type) return Value_Type is V : Value_Type := L; begin case V.K is @@ -88,9 +86,8 @@ package body Ocarina.Backends.Ada_Values is -- "+" -- --------- - function "+" (L, R : Value_Type) return Value_Type - is - V : Value_Type := R; + function "+" (L, R : Value_Type) return Value_Type is + V : Value_Type := R; begin case R.K is when K_Integer => @@ -121,8 +118,7 @@ package body Ocarina.Backends.Ada_Values is -- "-" -- --------- - function "-" (R : Value_Type) return Value_Type - is + function "-" (R : Value_Type) return Value_Type is V : Value_Type := R; begin case R.K is @@ -143,8 +139,7 @@ package body Ocarina.Backends.Ada_Values is -- "-" -- --------- - function "-" (L, R : Value_Type) return Value_Type - is + function "-" (L, R : Value_Type) return Value_Type is V : Value_Type := R; begin case R.K is @@ -165,9 +160,8 @@ package body Ocarina.Backends.Ada_Values is -- "/" -- --------- - function "/" (L, R : Value_Type) return Value_Type - is - V : Value_Type := L; + function "/" (L, R : Value_Type) return Value_Type is + V : Value_Type := L; begin case V.K is when K_Integer => @@ -219,8 +213,7 @@ package body Ocarina.Backends.Ada_Values is -- "and" -- ----------- - function "and" (L, R : Value_Type) return Value_Type - is + function "and" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -251,8 +244,7 @@ package body Ocarina.Backends.Ada_Values is -- "mod" -- ----------- - function "mod" (L, R : Value_Type) return Value_Type - is + function "mod" (L, R : Value_Type) return Value_Type is V : Value_Type := L; begin case L.K is @@ -273,8 +265,7 @@ package body Ocarina.Backends.Ada_Values is -- "not" -- ----------- - function "not" (R : Value_Type) return Value_Type - is + function "not" (R : Value_Type) return Value_Type is V : Value_Type := R; begin case V.K is @@ -294,8 +285,7 @@ package body Ocarina.Backends.Ada_Values is -- "or" -- ---------- - function "or" (L, R : Value_Type) return Value_Type - is + function "or" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -326,8 +316,7 @@ package body Ocarina.Backends.Ada_Values is -- "xor" -- ----------- - function "xor" (L, R : Value_Type) return Value_Type - is + function "xor" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -358,8 +347,7 @@ package body Ocarina.Backends.Ada_Values is -- Add_ULL_To_Name_Buffer -- ---------------------------- - procedure Add_ULL_To_Name_Buffer (U : ULL; B : ULL; S : Integer := 1) - is + procedure Add_ULL_To_Name_Buffer (U : ULL; B : ULL; S : Integer := 1) is Q : constant ULL := U / B; R : constant ULL := U mod B; begin @@ -373,14 +361,13 @@ package body Ocarina.Backends.Ada_Values is -- Image -- ----------- - function Image (Value : Value_Id) return String - is + function Image (Value : Value_Id) return String is V : Value_Type; begin if Value = No_Value then return "<>"; end if; - V := VT.Table (Value); + V := VT.Table (Value); Name_Len := 0; case V.K is when K_Boolean => @@ -422,8 +409,7 @@ package body Ocarina.Backends.Ada_Values is if Index > 0 then Index := Index + 2; - while Index <= Name_Len - and then Name_Buffer (Index) = '0' + while Index <= Name_Len and then Name_Buffer (Index) = '0' loop Name_Buffer (Index .. Name_Len - 1) := Name_Buffer (Index + 1 .. Name_Len); @@ -434,7 +420,7 @@ package body Ocarina.Backends.Ada_Values is if Index > Name_Len then Name_Len := Name_Len - 2; - Index := Name_Len; + Index := Name_Len; else Index := Name_Len; @@ -538,9 +524,7 @@ package body Ocarina.Backends.Ada_Values is -- New_Boolean_Value -- ----------------------- - function New_Boolean_Value - (Value : Boolean) - return Value_Id is + function New_Boolean_Value (Value : Boolean) return Value_Id is begin return New_Value (Value_Type'(K_Boolean, Boolean'Pos (Value), 1, 10)); end New_Boolean_Value; @@ -549,9 +533,7 @@ package body Ocarina.Backends.Ada_Values is -- New_Floating_Point_Value -- ------------------------------ - function New_Floating_Point_Value - (Value : Long_Double) - return Value_Id is + function New_Floating_Point_Value (Value : Long_Double) return Value_Id is begin return New_Value (Value_Type'(K_Float, Value)); end New_Floating_Point_Value; @@ -563,8 +545,8 @@ package body Ocarina.Backends.Ada_Values is function New_Integer_Value (Value : Unsigned_Long_Long; Sign : Short_Short; - Base : Unsigned_Short_Short) - return Value_Id is + Base : Unsigned_Short_Short) return Value_Id + is begin return New_Value (Value_Type'(K_Integer, Value, Sign, Base)); end New_Integer_Value; @@ -575,8 +557,8 @@ package body Ocarina.Backends.Ada_Values is function New_String_Value (Value : Name_Id; - Wide : Boolean := False) - return Value_Id is + Wide : Boolean := False) return Value_Id + is begin if Wide then return New_Value (Value_Type'(K_Wide_String, Value)); @@ -591,8 +573,7 @@ package body Ocarina.Backends.Ada_Values is function New_Character_Value (Value : Unsigned_Short; - Wide : Boolean := False) - return Value_Id + Wide : Boolean := False) return Value_Id is begin if Wide then @@ -606,12 +587,11 @@ package body Ocarina.Backends.Ada_Values is -- New_Value -- --------------- - function New_Value (Value : Value_Type) return Value_Id - is + function New_Value (Value : Value_Type) return Value_Id is V : Value_Id; begin VT.Increment_Last; - V := VT.Last; + V := VT.Last; VT.Table (V) := Value; return V; end New_Value; @@ -629,8 +609,7 @@ package body Ocarina.Backends.Ada_Values is -- Shift_Left -- ---------------- - function Shift_Left (L, R : Value_Type) return Value_Type - is + function Shift_Left (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -655,8 +634,7 @@ package body Ocarina.Backends.Ada_Values is -- Shift_Right -- ----------------- - function Shift_Right (L, R : Value_Type) return Value_Type - is + function Shift_Right (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin diff --git a/src/backends/ocarina-backends-ada_values.ads b/src/backends/ocarina-backends-ada_values.ads index 040bd607..bcfc4573 100644 --- a/src/backends/ocarina-backends-ada_values.ads +++ b/src/backends/ocarina-backends-ada_values.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -35,59 +35,48 @@ with Ocarina.Backends.Ada_Tree.Nodes; use Ocarina.Backends.Ada_Tree.Nodes; package Ocarina.Backends.Ada_Values is - type Value_Type (K : Node_Kind := K_Boolean) is - record - case K is - when K_Integer - | K_Boolean => - IVal : Unsigned_Long_Long; - Sign : Short_Short; - Base : Unsigned_Short_Short; + type Value_Type (K : Node_Kind := K_Boolean) is record + case K is + when K_Integer | K_Boolean => + IVal : Unsigned_Long_Long; + Sign : Short_Short; + Base : Unsigned_Short_Short; - when K_Float => - FVal : Long_Double; + when K_Float => + FVal : Long_Double; - when K_String | K_Wide_String => - SVal : Name_Id; + when K_String | K_Wide_String => + SVal : Name_Id; - when K_Character | K_Wide_Character => - CVal : Unsigned_Short; + when K_Character | K_Wide_Character => + CVal : Unsigned_Short; - when others => - null; - end case; - end record; + when others => + null; + end case; + end record; Bad_Value : constant Value_Type; - No_Value : constant Value_Id; + No_Value : constant Value_Id; - function New_Boolean_Value - (Value : Boolean) - return Value_Id; + function New_Boolean_Value (Value : Boolean) return Value_Id; - function New_Floating_Point_Value - (Value : Long_Double) - return Value_Id; + function New_Floating_Point_Value (Value : Long_Double) return Value_Id; function New_Integer_Value (Value : Unsigned_Long_Long; Sign : Short_Short; - Base : Unsigned_Short_Short) - return Value_Id; + Base : Unsigned_Short_Short) return Value_Id; function New_String_Value (Value : Name_Id; - Wide : Boolean := False) - return Value_Id; + Wide : Boolean := False) return Value_Id; function New_Character_Value (Value : Unsigned_Short; - Wide : Boolean := False) - return Value_Id; + Wide : Boolean := False) return Value_Id; - function New_Value - (Value : Value_Type) - return Value_Id; + function New_Value (Value : Value_Type) return Value_Id; function Value (V : Value_Id) return Value_Type; procedure Set_Value (V : Value_Id; X : Value_Type); @@ -98,19 +87,19 @@ package Ocarina.Backends.Ada_Values is -- Converts an AADL value to and Ada one function "not" (R : Value_Type) return Value_Type; - function "-" (R : Value_Type) return Value_Type; - function "-" (L, R : Value_Type) return Value_Type; - function "+" (L, R : Value_Type) return Value_Type; + function "-" (R : Value_Type) return Value_Type; + function "-" (L, R : Value_Type) return Value_Type; + function "+" (L, R : Value_Type) return Value_Type; function "mod" (L, R : Value_Type) return Value_Type; - function "/" (L, R : Value_Type) return Value_Type; - function "*" (L, R : Value_Type) return Value_Type; + function "/" (L, R : Value_Type) return Value_Type; + function "*" (L, R : Value_Type) return Value_Type; function "and" (L, R : Value_Type) return Value_Type; - function "or" (L, R : Value_Type) return Value_Type; + function "or" (L, R : Value_Type) return Value_Type; function "xor" (L, R : Value_Type) return Value_Type; - function Shift_Left (L, R : Value_Type) return Value_Type; + function Shift_Left (L, R : Value_Type) return Value_Type; function Shift_Right (L, R : Value_Type) return Value_Type; - function "<" (L, R : Value_Type) return Boolean; + function "<" (L, R : Value_Type) return Boolean; -- Assume L and R have the same type. procedure Reset; @@ -119,6 +108,6 @@ package Ocarina.Backends.Ada_Values is private Bad_Value : constant Value_Type := Value_Type'((K => K_Node_Id)); - No_Value : constant Value_Id := 0; + No_Value : constant Value_Id := 0; end Ocarina.Backends.Ada_Values; diff --git a/src/backends/ocarina-backends-arinc653_conf-connections.adb b/src/backends/ocarina-backends-arinc653_conf-connections.adb index d3560eb0..9d439212 100644 --- a/src/backends/ocarina-backends-arinc653_conf-connections.adb +++ b/src/backends/ocarina-backends-arinc653_conf-connections.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -91,8 +91,7 @@ package body Ocarina.Backends.ARINC653_Conf.Connections is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -127,16 +126,16 @@ package body Ocarina.Backends.ARINC653_Conf.Connections is --------------------------- procedure Visit_System_Instance (E : Node_Id) is - S : Node_Id; - C : Node_Id; - Connection_Table : Node_Id; - Channel_Identifier : Unsigned_Long_Long := 0; + S : Node_Id; + C : Node_Id; + Connection_Table : Node_Id; + Channel_Identifier : Unsigned_Long_Long := 0; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. if AINU.Is_Processor (Corresponding_Instance (S)) then Visit (Corresponding_Instance (S)); @@ -144,17 +143,18 @@ package body Ocarina.Backends.ARINC653_Conf.Connections is -- processor, we can use it. if not AINU.Is_Empty (AIN.Connections (E)) then Connection_Table := Make_XML_Node ("Connection_Table"); - C := First_Node (AIN.Connections (E)); - while Present (C) loop - if Get_Category_Of_Connection (C) /= CT_Access_Bus then - Channel_Identifier := Channel_Identifier + 1; - Append_Node_To_List - (Map_Connection (C, Channel_Identifier), - XTN.Subitems (Connection_Table)); - end if; - C := Next_Node (C); - end loop; - Append_Node_To_List (Connection_Table, + C := First_Node (AIN.Connections (E)); + while Present (C) loop + if Get_Category_Of_Connection (C) /= CT_Access_Bus then + Channel_Identifier := Channel_Identifier + 1; + Append_Node_To_List + (Map_Connection (C, Channel_Identifier), + XTN.Subitems (Connection_Table)); + end if; + C := Next_Node (C); + end loop; + Append_Node_To_List + (Connection_Table, XTN.Subitems (Current_XML_Node)); end if; end if; @@ -178,14 +178,13 @@ package body Ocarina.Backends.ARINC653_Conf.Connections is Push_Entity (U); Push_Entity (P); - Current_XML_Node := XTN.Root_Node - (XTN.XML_File (U)); + Current_XML_Node := XTN.Root_Node (XTN.XML_File (U)); if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -201,14 +200,14 @@ package body Ocarina.Backends.ARINC653_Conf.Connections is -------------------------------------- procedure Visit_Virtual_Processor_Instance (E : Node_Id) is - Processes : List_Id; - S : Node_Id; + Processes : List_Id; + S : Node_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -217,7 +216,7 @@ package body Ocarina.Backends.ARINC653_Conf.Connections is if Present (Backend_Node (Identifier (E))) then Processes := XTN.Processes (Backend_Node (Identifier (E))); - S := XTN.First_Node (Processes); + S := XTN.First_Node (Processes); while Present (S) loop Visit (XTN.Content (S)); S := XTN.Next_Node (S); diff --git a/src/backends/ocarina-backends-arinc653_conf-mapping.adb b/src/backends/ocarina-backends-arinc653_conf-mapping.adb index 6c91e5d8..bb14417e 100644 --- a/src/backends/ocarina-backends-arinc653_conf-mapping.adb +++ b/src/backends/ocarina-backends-arinc653_conf-mapping.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -61,7 +61,7 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is package ATE renames Ocarina.ME_AADL.AADL_Tree.Entities; package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes; package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils; - package XV renames Ocarina.Backends.XML_Values; + package XV renames Ocarina.Backends.XML_Values; package XTN renames Ocarina.Backends.XML_Tree.Nodes; procedure Map_Scheduler (E : Node_Id; N : Node_Id) is @@ -103,10 +103,7 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is XML_Root := D; - XTN.Set_Name (D, To_XML_Name - (AIN.Name - (AIN.Identifier - (E)))); + XTN.Set_Name (D, To_XML_Name (AIN.Name (AIN.Identifier (E)))); XTN.Set_Units (D, New_List (XTN.K_List_Id)); XTN.Set_HI_Nodes (D, New_List (XTN.K_List_Id)); @@ -120,17 +117,17 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is function Map_HI_Node (E : Node_Id) return Node_Id is N : constant Node_Id := New_Node (XTN.K_HI_Node); begin - pragma Assert (AINU.Is_Process (E) - or else AINU.Is_System (E) - or else AINU.Is_Processor (E)); + pragma Assert + (AINU.Is_Process (E) + or else AINU.Is_System (E) + or else AINU.Is_Processor (E)); if AINU.Is_System (E) then Set_Str_To_Name_Buffer ("general"); else Get_Name_String - (To_XML_Name (AIN.Name - (AIN.Identifier - (AIN.Parent_Subcomponent (E))))); + (To_XML_Name + (AIN.Name (AIN.Identifier (AIN.Parent_Subcomponent (E))))); Add_Str_To_Name_Buffer ("_arinc653"); end if; @@ -150,26 +147,24 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is -- Map_HI_Unit -- ----------------- - function Map_HI_Unit (E : Node_Id) - return Node_Id is - U : Node_Id; - N : Node_Id; - P : Node_Id; - Q : Node_Id; - R : Node_Id; - Root : Node_Id; + function Map_HI_Unit (E : Node_Id) return Node_Id is + U : Node_Id; + N : Node_Id; + P : Node_Id; + Q : Node_Id; + R : Node_Id; + Root : Node_Id; begin - pragma Assert (AINU.Is_System (E) - or else AINU.Is_Process (E) - or else AINU.Is_Processor (E)); + pragma Assert + (AINU.Is_System (E) + or else AINU.Is_Process (E) + or else AINU.Is_Processor (E)); U := New_Node (XTN.K_HI_Unit, AIN.Identifier (E)); -- Packages that are common to all nodes Get_Name_String - (To_XML_Name - (Display_Name - (Identifier (Parent_Subcomponent (E))))); + (To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E))))); Add_Str_To_Name_Buffer ("_arinc653-conf"); N := Make_Defining_Identifier (Name_Find); P := Make_XML_File (N); @@ -197,8 +192,7 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Set_Str_To_Name_Buffer ("ModuleName"); R := Make_Defining_Identifier (Name_Find); - Get_Name_String - (To_XML_Name (Display_Name (Identifier (E)))); + Get_Name_String (To_XML_Name (Display_Name (Identifier (E)))); Q := Make_Defining_Identifier (Name_Find); Append_Node_To_List (Make_Assignement (R, Q), XTN.Items (Root)); @@ -216,9 +210,9 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is ------------------------- function Map_Port_Connection (E : Node_Id) return Node_Id is - N : Node_Id; - R : Node_Id; - Q : Node_Id; + N : Node_Id; + R : Node_Id; + Q : Node_Id; Src : Node_Id; Dst : Node_Id; begin @@ -243,21 +237,17 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Src := Item (AIN.First_Node (Path (Source (E)))); Dst := Item (AIN.First_Node (Path (Destination (E)))); - R := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Src)))); + R := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Src)))); Set_Str_To_Name_Buffer ("src"); Q := Make_Defining_Identifier (Name_Find); Append_Node_To_List (Make_Assignement (Q, R), XTN.Items (N)); - R := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Dst)))); + R := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Dst)))); Set_Str_To_Name_Buffer ("dst"); Q := Make_Defining_Identifier (Name_Find); @@ -270,9 +260,9 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is -------------------- function Map_Bus_Access (E : Node_Id) return Node_Id is - N : Node_Id; - R : Node_Id; - Q : Node_Id; + N : Node_Id; + R : Node_Id; + Q : Node_Id; Src : Node_Id; Dst : Node_Id; begin @@ -289,21 +279,17 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Src := Item (AIN.First_Node (Path (Source (E)))); Dst := Item (AIN.First_Node (Path (Destination (E)))); - R := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Src)))); + R := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Src)))); Set_Str_To_Name_Buffer ("src"); Q := Make_Defining_Identifier (Name_Find); Append_Node_To_List (Make_Assignement (Q, R), XTN.Items (N)); - R := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Dst)))); + R := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Dst)))); Set_Str_To_Name_Buffer ("dst"); Q := Make_Defining_Identifier (Name_Find); @@ -317,9 +303,9 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is --------------------- function Map_Data_Access (E : Node_Id) return Node_Id is - N : Node_Id; - R : Node_Id; - Q : Node_Id; + N : Node_Id; + R : Node_Id; + Q : Node_Id; Src : Node_Id; Dst : Node_Id; begin @@ -336,21 +322,17 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Src := Item (AIN.First_Node (Path (Source (E)))); Dst := Item (AIN.First_Node (Path (Destination (E)))); - R := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Src)))); + R := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Src)))); Set_Str_To_Name_Buffer ("src"); Q := Make_Defining_Identifier (Name_Find); Append_Node_To_List (Make_Assignement (Q, R), XTN.Items (N)); - R := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Dst)))); + R := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Dst)))); Set_Str_To_Name_Buffer ("dst"); Q := Make_Defining_Identifier (Name_Find); @@ -363,8 +345,7 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is -- Map_System -- ---------------- - function Map_System (E : Node_Id) - return Node_Id is + function Map_System (E : Node_Id) return Node_Id is N : Node_Id; Q : Node_Id; P : Node_Id; @@ -373,10 +354,7 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is -- Set the name of the system - P := Make_Defining_Identifier - (To_XML_Name - (AIN.Name - (Identifier (E)))); + P := Make_Defining_Identifier (To_XML_Name (AIN.Name (Identifier (E)))); Set_Str_To_Name_Buffer ("ModuleName"); Q := Make_Defining_Identifier (Name_Find); @@ -390,9 +368,9 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is -- Map_Process -- ----------------- - function Map_Process (E : Node_Id; - Partition_Identifier : Unsigned_Long_Long) - return Node_Id + function Map_Process + (E : Node_Id; + Partition_Identifier : Unsigned_Long_Long) return Node_Id is N : Node_Id; P : Node_Id; @@ -400,22 +378,18 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is begin N := Make_XML_Node ("Partition"); - P := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Parent_Subcomponent (E))))); + P := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E))))); Set_Str_To_Name_Buffer ("PartitionName"); Q := Make_Defining_Identifier (Name_Find); Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N)); - P := Make_Literal (XV.New_Numeric_Value - (Partition_Identifier, 1, 10)); + P := Make_Literal (XV.New_Numeric_Value (Partition_Identifier, 1, 10)); Set_Str_To_Name_Buffer ("PartitionIdentifier"); Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List (Make_Assignement (Q, P), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N)); AIN.Set_Backend_Node (Identifier (E), Copy_Node (P)); @@ -423,15 +397,13 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("EntryPoint"); Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List (Make_Assignement (Q, P), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N)); Set_Str_To_Name_Buffer ("true"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("SystemPartition"); Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List (Make_Assignement (Q, P), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N)); return N; end Map_Process; @@ -446,11 +418,9 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is begin N := Make_XML_Node ("processor"); - P := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Parent_Subcomponent (E))))); + P := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E))))); Set_Str_To_Name_Buffer ("name"); Q := Make_Defining_Identifier (Name_Find); @@ -470,11 +440,9 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is begin N := Make_XML_Node ("bus"); - P := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Parent_Subcomponent (E))))); + P := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E))))); Set_Str_To_Name_Buffer ("name"); Q := Make_Defining_Identifier (Name_Find); @@ -488,22 +456,19 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is --------------------------- function Map_Virtual_Processor (E : Node_Id) return Node_Id is - N : Node_Id; - P : Node_Id; - Q : Node_Id; + N : Node_Id; + P : Node_Id; + Q : Node_Id; begin N := Make_XML_Node ("virtual_processor"); - P := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Parent_Subcomponent (E))))); + P := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E))))); Set_Str_To_Name_Buffer ("name"); Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List (Make_Assignement (Q, P), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N)); Map_Scheduler (E, N); @@ -521,16 +486,13 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is begin N := Make_XML_Node ("data"); - P := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Parent_Subcomponent (E))))); + P := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E))))); Set_Str_To_Name_Buffer ("name"); Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List (Make_Assignement (Q, P), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N)); return N; end Map_Data; @@ -539,24 +501,25 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is -------------------- function Map_Connection - (Connection : Node_Id; Channel_Identifier : Unsigned_Long_Long) - return Node_Id is - Channel_Node : Node_Id; - Source_Node : Node_Id; - Destination_Node : Node_Id; - P : Node_Id; - N : Node_Id; - Q : Node_Id; - Source_Port_Name : Name_Id; - Destination_Port_Name : Name_Id; - Source_Component_Name : Name_Id; - Destination_Component_Name : Name_Id; - Partition_Source : Node_Id; - Partition_Destination : Node_Id; + (Connection : Node_Id; + Channel_Identifier : Unsigned_Long_Long) return Node_Id + is + Channel_Node : Node_Id; + Source_Node : Node_Id; + Destination_Node : Node_Id; + P : Node_Id; + N : Node_Id; + Q : Node_Id; + Source_Port_Name : Name_Id; + Destination_Port_Name : Name_Id; + Source_Component_Name : Name_Id; + Destination_Component_Name : Name_Id; + Partition_Source : Node_Id; + Partition_Destination : Node_Id; begin - Channel_Node := Make_XML_Node ("Channel"); - Source_Node := Make_XML_Node ("Source"); - Destination_Node := Make_XML_Node ("Destination"); + Channel_Node := Make_XML_Node ("Channel"); + Source_Node := Make_XML_Node ("Source"); + Destination_Node := Make_XML_Node ("Destination"); Set_Str_To_Name_Buffer ("ChannelIdentifier"); P := Make_Defining_Identifier (Name_Find); @@ -566,43 +529,35 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is N := Make_XML_Node ("Standard_Partition"); Partition_Source := - AIN.Corresponding_Instance - (AIN.Item - (AIN.First_Node - (AIN.Path (AIN.Source (Connection))))); + AIN.Corresponding_Instance + (AIN.Item (AIN.First_Node (AIN.Path (AIN.Source (Connection))))); Partition_Destination := - AIN.Corresponding_Instance - (AIN.Item - (AIN.First_Node - (AIN.Path (AIN.Destination (Connection))))); + AIN.Corresponding_Instance + (AIN.Item + (AIN.First_Node (AIN.Path (AIN.Destination (Connection))))); Source_Component_Name := - AIN.Name - (AIN.Identifier - (AIN.Item - (AIN.First_Node - (AIN.Path (AIN.Source (Connection)))))); + AIN.Name + (AIN.Identifier + (AIN.Item (AIN.First_Node (AIN.Path (AIN.Source (Connection)))))); Source_Port_Name := - AIN.Name - (AIN.Identifier - (AIN.Item - (AIN.Next_Node - (AIN.First_Node - (AIN.Path (AIN.Source (Connection))))))); + AIN.Name + (AIN.Identifier + (AIN.Item + (AIN.Next_Node + (AIN.First_Node (AIN.Path (AIN.Source (Connection))))))); Set_Str_To_Name_Buffer ("PortName"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Defining_Identifier - (To_XML_Name (Source_Port_Name)); + Q := Make_Defining_Identifier (To_XML_Name (Source_Port_Name)); Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); Set_Str_To_Name_Buffer ("PartitionName"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Defining_Identifier - (To_XML_Name (Source_Component_Name)); + Q := Make_Defining_Identifier (To_XML_Name (Source_Component_Name)); Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); @@ -610,40 +565,38 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Set_Str_To_Name_Buffer ("PartitionIdentifier"); Q := Make_Defining_Identifier (Name_Find); Append_Node_To_List - (Make_Assignement - (Q, Copy_Node (Backend_Node (Identifier (Partition_Source)))), - XTN.Items (N)); + (Make_Assignement + (Q, + Copy_Node (Backend_Node (Identifier (Partition_Source)))), + XTN.Items (N)); end if; Append_Node_To_List (N, XTN.Subitems (Source_Node)); Destination_Component_Name := - AIN.Name - (AIN.Identifier - (AIN.Item - (AIN.First_Node - (AIN.Path (AIN.Destination (Connection)))))); + AIN.Name + (AIN.Identifier + (AIN.Item + (AIN.First_Node (AIN.Path (AIN.Destination (Connection)))))); Destination_Port_Name := - AIN.Name - (AIN.Identifier - (AIN.Item - (AIN.Next_Node - (AIN.First_Node - (AIN.Path (AIN.Destination (Connection))))))); + AIN.Name + (AIN.Identifier + (AIN.Item + (AIN.Next_Node + (AIN.First_Node + (AIN.Path (AIN.Destination (Connection))))))); N := Make_XML_Node ("Standard_Partition"); Set_Str_To_Name_Buffer ("PortName"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Defining_Identifier - (To_XML_Name (Destination_Port_Name)); + Q := Make_Defining_Identifier (To_XML_Name (Destination_Port_Name)); Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); Set_Str_To_Name_Buffer ("PartitionName"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Defining_Identifier - (To_XML_Name (Destination_Component_Name)); + Q := Make_Defining_Identifier (To_XML_Name (Destination_Component_Name)); Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); @@ -651,10 +604,10 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Set_Str_To_Name_Buffer ("PartitionIdentifier"); Q := Make_Defining_Identifier (Name_Find); Append_Node_To_List - (Make_Assignement - (Q, Copy_Node - (Backend_Node (Identifier (Partition_Destination)))), - XTN.Items (N)); + (Make_Assignement + (Q, + Copy_Node (Backend_Node (Identifier (Partition_Destination)))), + XTN.Items (N)); end if; Append_Node_To_List (N, XTN.Subitems (Destination_Node)); @@ -670,30 +623,30 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is ------------------------ function Map_Process_Memory (Process : Node_Id) return Node_Id is - N : Node_Id; - M : Node_Id; - P : Node_Id; - Q : Node_Id; + N : Node_Id; + M : Node_Id; + P : Node_Id; + Q : Node_Id; Memory : Node_Id; begin N := Make_XML_Node ("Partition_Memory"); Set_Str_To_Name_Buffer ("PartitionName"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Parent_Subcomponent (Process))))); + Q := + Make_Defining_Identifier + (To_XML_Name + (Display_Name (Identifier (Parent_Subcomponent (Process))))); Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); if Present (Backend_Node (Identifier (Process))) then Set_Str_To_Name_Buffer ("PartitionIdentifier"); Q := Make_Defining_Identifier (Name_Find); Append_Node_To_List - (Make_Assignement - (Q, Copy_Node (Backend_Node (Identifier (Process)))), - XTN.Items (N)); + (Make_Assignement + (Q, + Copy_Node (Backend_Node (Identifier (Process)))), + XTN.Items (N)); end if; if Get_Data_Size (Process) /= Null_Size then @@ -701,8 +654,12 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Set_Str_To_Name_Buffer ("SizeBytes"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal (XV.New_Numeric_Value - (To_Bytes (Get_Data_Size (Process)), 1, 10)); + Q := + Make_Literal + (XV.New_Numeric_Value + (To_Bytes (Get_Data_Size (Process)), + 1, + 10)); Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (M)); Set_Str_To_Name_Buffer ("Type"); @@ -725,8 +682,12 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Set_Str_To_Name_Buffer ("SizeBytes"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal (XV.New_Numeric_Value - (To_Bytes (Get_Code_Size (Process)), 1, 10)); + Q := + Make_Literal + (XV.New_Numeric_Value + (To_Bytes (Get_Code_Size (Process)), + 1, + 10)); Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (M)); Set_Str_To_Name_Buffer ("Type"); @@ -748,22 +709,23 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Memory := Get_Bound_Memory (Process); declare Byte_Count : Unsigned_Long_Long := 1; - Word_Size : Unsigned_Long_Long := 1; + Word_Size : Unsigned_Long_Long := 1; begin if Get_Byte_Count (Get_Bound_Memory (Process)) /= 0 then Byte_Count := Get_Byte_Count (Get_Bound_Memory (Process)); end if; if Get_Word_Size (Get_Bound_Memory (Process)) /= Null_Size then - Word_Size := To_Bytes - (Get_Word_Size (Get_Bound_Memory (Process))); + Word_Size := + To_Bytes (Get_Word_Size (Get_Bound_Memory (Process))); end if; M := Make_XML_Node ("Memory_Requirements"); Set_Str_To_Name_Buffer ("SizeBytes"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal (XV.New_Numeric_Value - (Byte_Count * Word_Size, 1, 10)); + Q := + Make_Literal + (XV.New_Numeric_Value (Byte_Count * Word_Size, 1, 10)); Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (M)); if Get_ARINC653_Memory_Kind (Memory) = Data then @@ -812,30 +774,27 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is ---------------------------- procedure Map_Process_Scheduling - (Process : Node_Id; + (Process : Node_Id; Window_Number : in out Unsigned_Long_Long; - N : out Node_Id) + N : out Node_Id) is - P : Node_Id; - Q : Node_Id; - Window_Node : Node_Id; - Associated_Virtual_Processor : constant Node_Id - := Get_Bound_Processor (Process); - Associated_Processor : constant Node_Id - := Parent_Component - (Parent_Subcomponent (Associated_Virtual_Processor)); - Slots : constant Time_Array - := Get_POK_Slots (Associated_Processor); - Slots_Allocation : List_Id; - S : Node_Id; - Referenced_Entity : Node_Id; - Start_Time : Long_Double := 0.0; - Duration_Time : Long_Double := 0.0; + P : Node_Id; + Q : Node_Id; + Window_Node : Node_Id; + Associated_Virtual_Processor : constant Node_Id := + Get_Bound_Processor (Process); + Associated_Processor : constant Node_Id := + Parent_Component (Parent_Subcomponent (Associated_Virtual_Processor)); + Slots : constant Time_Array := Get_POK_Slots (Associated_Processor); + Slots_Allocation : List_Id; + S : Node_Id; + Referenced_Entity : Node_Id; + Start_Time : Long_Double := 0.0; + Duration_Time : Long_Double := 0.0; begin N := Make_XML_Node ("Partition_Schedule"); - Slots_Allocation := Get_POK_Slots_Allocation - (Associated_Processor); + Slots_Allocation := Get_POK_Slots_Allocation (Associated_Processor); if Slots_Allocation = No_List then Display_Error @@ -845,29 +804,28 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Set_Str_To_Name_Buffer ("PartitionName"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Parent_Subcomponent (Process))))); + Q := + Make_Defining_Identifier + (To_XML_Name + (Display_Name (Identifier (Parent_Subcomponent (Process))))); Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); if Present (Backend_Node (Identifier (Process))) then Set_Str_To_Name_Buffer ("PartitionIdentifier"); Q := Make_Defining_Identifier (Name_Find); Append_Node_To_List - (Make_Assignement - (Q, Copy_Node (Backend_Node (Identifier (Process)))), - XTN.Items (N)); + (Make_Assignement + (Q, + Copy_Node (Backend_Node (Identifier (Process)))), + XTN.Items (N)); end if; Set_Str_To_Name_Buffer ("PeriodSeconds"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal - (XV.New_Floating_Point_Value - (To_Seconds - (Get_POK_Major_Frame - (Associated_Processor)))); + Q := + Make_Literal + (XV.New_Floating_Point_Value + (To_Seconds (Get_POK_Major_Frame (Associated_Processor)))); Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); Start_Time := 0.0; @@ -881,26 +839,26 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Set_Str_To_Name_Buffer ("WindowStartSeconds"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal - (XV.New_Floating_Point_Value (Start_Time)); + Q := Make_Literal (XV.New_Floating_Point_Value (Start_Time)); Append_Node_To_List - (Make_Assignement (P, Q), XTN.Items (Window_Node)); + (Make_Assignement (P, Q), + XTN.Items (Window_Node)); Set_Str_To_Name_Buffer ("WindowIdentifier"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal - (XV.New_Numeric_Value - (Window_Number, 1, 10)); + Q := Make_Literal (XV.New_Numeric_Value (Window_Number, 1, 10)); Append_Node_To_List - (Make_Assignement (P, Q), XTN.Items (Window_Node)); + (Make_Assignement (P, Q), + XTN.Items (Window_Node)); Set_Str_To_Name_Buffer ("WindowDurationSeconds"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal - (XV.New_Floating_Point_Value - (To_Seconds (Slots (I)))); + Q := + Make_Literal + (XV.New_Floating_Point_Value (To_Seconds (Slots (I)))); Append_Node_To_List - (Make_Assignement (P, Q), XTN.Items (Window_Node)); + (Make_Assignement (P, Q), + XTN.Items (Window_Node)); Append_Node_To_List (Window_Node, XTN.Subitems (N)); Window_Number := Window_Number + 1; @@ -908,13 +866,12 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is end if; Start_Time := Start_Time + To_Seconds (Slots (I)); - S := ATN.Next_Node (S); + S := ATN.Next_Node (S); end loop; Set_Str_To_Name_Buffer ("PeriodDurationSeconds"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal - (XV.New_Floating_Point_Value (Duration_Time)); + Q := Make_Literal (XV.New_Floating_Point_Value (Duration_Time)); Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); end Map_Process_Scheduling; @@ -956,8 +913,8 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is Set_Str_To_Name_Buffer ("Name"); R := Make_Defining_Identifier (Name_Find); - Q := Make_Defining_Identifier - (To_XML_Name (Display_Name (Identifier (F)))); + Q := + Make_Defining_Identifier (To_XML_Name (Display_Name (Identifier (F)))); Append_Node_To_List (Make_Assignement (R, Q), XTN.Items (N)); @@ -966,9 +923,10 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is R := Make_Defining_Identifier (Name_Find); if Get_POK_Refresh_Time (F) /= Null_Time then - Q := Make_Literal - (XV.New_Floating_Point_Value - (To_Seconds (Get_POK_Refresh_Time (F)))); + Q := + Make_Literal + (XV.New_Floating_Point_Value + (To_Seconds (Get_POK_Refresh_Time (F)))); else Q := Map_Time (Null_Time); end if; @@ -978,9 +936,12 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is P := Make_Defining_Identifier (Name_Find); if Get_Queue_Size (F) /= -1 then - Q := Make_Literal - (XV.New_Numeric_Value - (Unsigned_Long_Long (Get_Queue_Size (F)), 1, 10)); + Q := + Make_Literal + (XV.New_Numeric_Value + (Unsigned_Long_Long (Get_Queue_Size (F)), + 1, + 10)); else Q := Make_Literal (XV.New_Numeric_Value (1, 1, 10)); end if; @@ -993,11 +954,12 @@ package body Ocarina.Backends.ARINC653_Conf.Mapping is P := Make_Defining_Identifier (Name_Find); if Get_Data_Size (Corresponding_Instance (F)) /= Null_Size then - Q := Make_Literal - (XV.New_Numeric_Value - (To_Bytes - (Get_Data_Size - (Corresponding_Instance (F))), 1, 10)); + Q := + Make_Literal + (XV.New_Numeric_Value + (To_Bytes (Get_Data_Size (Corresponding_Instance (F))), + 1, + 10)); else Q := Make_Literal (XV.New_Numeric_Value (1, 1, 10)); end if; diff --git a/src/backends/ocarina-backends-arinc653_conf-mapping.ads b/src/backends/ocarina-backends-arinc653_conf-mapping.ads index 03a216d6..fcc2e37c 100644 --- a/src/backends/ocarina-backends-arinc653_conf-mapping.ads +++ b/src/backends/ocarina-backends-arinc653_conf-mapping.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -43,9 +43,9 @@ package Ocarina.Backends.ARINC653_Conf.Mapping is function Map_Data_Access (E : Node_Id) return Node_Id; function Map_Bus_Access (E : Node_Id) return Node_Id; function Map_System (E : Node_Id) return Node_Id; - function Map_Process (E : Node_Id; - Partition_Identifier : Unsigned_Long_Long) - return Node_Id; + function Map_Process + (E : Node_Id; + Partition_Identifier : Unsigned_Long_Long) return Node_Id; function Map_Data_Size (T : Size_Type) return Unsigned_Long_Long; function Map_Virtual_Processor (E : Node_Id) return Node_Id; function Map_Processor (E : Node_Id) return Node_Id; @@ -53,13 +53,13 @@ package Ocarina.Backends.ARINC653_Conf.Mapping is function Map_Port_Connection (E : Node_Id) return Node_Id; function Map_Process_Memory (Process : Node_Id) return Node_Id; procedure Map_Process_Scheduling - (Process : Node_Id; + (Process : Node_Id; Window_Number : in out Unsigned_Long_Long; - N : out Node_Id); + N : out Node_Id); function Map_Connection - (Connection : Node_Id; Channel_Identifier : Unsigned_Long_Long) - return Node_Id; + (Connection : Node_Id; + Channel_Identifier : Unsigned_Long_Long) return Node_Id; function Map_Process_HM_Table (Process : Node_Id) return Node_Id; diff --git a/src/backends/ocarina-backends-arinc653_conf-memory.adb b/src/backends/ocarina-backends-arinc653_conf-memory.adb index 9cf79e67..87a8f010 100644 --- a/src/backends/ocarina-backends-arinc653_conf-memory.adb +++ b/src/backends/ocarina-backends-arinc653_conf-memory.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -90,8 +90,7 @@ package body Ocarina.Backends.ARINC653_Conf.Memory is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -117,8 +116,9 @@ package body Ocarina.Backends.ARINC653_Conf.Memory is procedure Visit_Process_Instance (E : Node_Id) is begin - Append_Node_To_List (Map_Process_Memory (E), - XTN.Subitems (Current_XML_Node)); + Append_Node_To_List + (Map_Process_Memory (E), + XTN.Subitems (Current_XML_Node)); end Visit_Process_Instance; --------------------------- @@ -126,13 +126,13 @@ package body Ocarina.Backends.ARINC653_Conf.Memory is --------------------------- procedure Visit_System_Instance (E : Node_Id) is - S : Node_Id; + S : Node_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. if AINU.Is_Processor (Corresponding_Instance (S)) then Visit (Corresponding_Instance (S)); @@ -149,9 +149,9 @@ package body Ocarina.Backends.ARINC653_Conf.Memory is ------------------------------ procedure Visit_Processor_Instance (E : Node_Id) is - S : Node_Id; - U : Node_Id; - P : Node_Id; + S : Node_Id; + U : Node_Id; + P : Node_Id; begin U := XTN.Unit (Backend_Node (Identifier (E))); P := XTN.Node (Backend_Node (Identifier (E))); @@ -159,14 +159,13 @@ package body Ocarina.Backends.ARINC653_Conf.Memory is Push_Entity (U); Push_Entity (P); - Current_XML_Node := XTN.Root_Node - (XTN.XML_File (U)); + Current_XML_Node := XTN.Root_Node (XTN.XML_File (U)); if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -182,14 +181,14 @@ package body Ocarina.Backends.ARINC653_Conf.Memory is -------------------------------------- procedure Visit_Virtual_Processor_Instance (E : Node_Id) is - S : Node_Id; - Processes : List_Id; + S : Node_Id; + Processes : List_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -198,7 +197,7 @@ package body Ocarina.Backends.ARINC653_Conf.Memory is if Present (Backend_Node (Identifier (E))) then Processes := XTN.Processes (Backend_Node (Identifier (E))); - S := XTN.First_Node (Processes); + S := XTN.First_Node (Processes); while Present (S) loop Visit (XTN.Content (S)); S := XTN.Next_Node (S); diff --git a/src/backends/ocarina-backends-arinc653_conf-module_hm.adb b/src/backends/ocarina-backends-arinc653_conf-module_hm.adb index 7d49d9a1..55e05e06 100644 --- a/src/backends/ocarina-backends-arinc653_conf-module_hm.adb +++ b/src/backends/ocarina-backends-arinc653_conf-module_hm.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -89,8 +89,7 @@ package body Ocarina.Backends.ARINC653_Conf.Module_HM is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -112,13 +111,13 @@ package body Ocarina.Backends.ARINC653_Conf.Module_HM is --------------------------- procedure Visit_System_Instance (E : Node_Id) is - S : Node_Id; + S : Node_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. if AINU.Is_Processor (Corresponding_Instance (S)) then Visit (Corresponding_Instance (S)); end if; @@ -142,14 +141,13 @@ package body Ocarina.Backends.ARINC653_Conf.Module_HM is Push_Entity (U); Push_Entity (P); - Current_XML_Node := XTN.Root_Node - (XTN.XML_File (U)); + Current_XML_Node := XTN.Root_Node (XTN.XML_File (U)); if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -157,7 +155,8 @@ package body Ocarina.Backends.ARINC653_Conf.Module_HM is end if; Append_Node_To_List - (Map_Processor_HM_Table (E), XTN.Subitems (Current_XML_Node)); + (Map_Processor_HM_Table (E), + XTN.Subitems (Current_XML_Node)); Pop_Entity; Pop_Entity; end Visit_Processor_Instance; @@ -172,8 +171,8 @@ package body Ocarina.Backends.ARINC653_Conf.Module_HM is if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); diff --git a/src/backends/ocarina-backends-arinc653_conf-partition_hm.adb b/src/backends/ocarina-backends-arinc653_conf-partition_hm.adb index a2e0d823..8627aeaf 100644 --- a/src/backends/ocarina-backends-arinc653_conf-partition_hm.adb +++ b/src/backends/ocarina-backends-arinc653_conf-partition_hm.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -90,8 +90,7 @@ package body Ocarina.Backends.ARINC653_Conf.Partition_HM is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -118,7 +117,8 @@ package body Ocarina.Backends.ARINC653_Conf.Partition_HM is procedure Visit_Process_Instance (E : Node_Id) is begin Append_Node_To_List - (Map_Process_HM_Table (E), XTN.Subitems (Current_XML_Node)); + (Map_Process_HM_Table (E), + XTN.Subitems (Current_XML_Node)); end Visit_Process_Instance; --------------------------- @@ -126,13 +126,13 @@ package body Ocarina.Backends.ARINC653_Conf.Partition_HM is --------------------------- procedure Visit_System_Instance (E : Node_Id) is - S : Node_Id; + S : Node_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. if AINU.Is_Processor (Corresponding_Instance (S)) then Visit (Corresponding_Instance (S)); end if; @@ -157,14 +157,13 @@ package body Ocarina.Backends.ARINC653_Conf.Partition_HM is Push_Entity (U); Push_Entity (P); - Current_XML_Node := XTN.Root_Node - (XTN.XML_File (U)); + Current_XML_Node := XTN.Root_Node (XTN.XML_File (U)); if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -186,8 +185,8 @@ package body Ocarina.Backends.ARINC653_Conf.Partition_HM is if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -196,7 +195,7 @@ package body Ocarina.Backends.ARINC653_Conf.Partition_HM is if Present (Backend_Node (Identifier (E))) then Processes := XTN.Processes (Backend_Node (Identifier (E))); - S := XTN.First_Node (Processes); + S := XTN.First_Node (Processes); while Present (S) loop Visit (XTN.Content (S)); S := XTN.Next_Node (S); diff --git a/src/backends/ocarina-backends-arinc653_conf-partitions.adb b/src/backends/ocarina-backends-arinc653_conf-partitions.adb index 8ae971ac..a087dc7f 100644 --- a/src/backends/ocarina-backends-arinc653_conf-partitions.adb +++ b/src/backends/ocarina-backends-arinc653_conf-partitions.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -62,9 +62,9 @@ package body Ocarina.Backends.ARINC653_Conf.Partitions is procedure Visit_Virtual_Processor_Instance (E : Node_Id); procedure Visit_Data_Instance (E : Node_Id); - System_Nb_Processes : Unsigned_Long_Long := 0; - Current_Parent_Node : Node_Id; - Process_Node : Node_Id; + System_Nb_Processes : Unsigned_Long_Long := 0; + Current_Parent_Node : Node_Id; + Process_Node : Node_Id; ----------- -- Visit -- @@ -98,8 +98,7 @@ package body Ocarina.Backends.ARINC653_Conf.Partitions is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -133,8 +132,8 @@ package body Ocarina.Backends.ARINC653_Conf.Partitions is ---------------------------- procedure Visit_Process_Instance (E : Node_Id) is - S : Node_Id; - F : Node_Id; + S : Node_Id; + F : Node_Id; Old_Current_Parent : Node_Id; begin System_Nb_Processes := System_Nb_Processes + 1; @@ -145,14 +144,14 @@ package body Ocarina.Backends.ARINC653_Conf.Partitions is -- Look for a possible bounded virtual processor/processor -- N := Get_Bound_Processor (E); - Old_Current_Parent := Current_Parent_Node; + Old_Current_Parent := Current_Parent_Node; Current_Parent_Node := Process_Node; if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -164,7 +163,8 @@ package body Ocarina.Backends.ARINC653_Conf.Partitions is while Present (F) loop if Kind (F) = K_Port_Spec_Instance - and then Get_Connection_Pattern (F) = Inter_Process then + and then Get_Connection_Pattern (F) = Inter_Process + then Append_Node_To_List (Map_Port (F), XTN.Subitems (Process_Node)); end if; F := Next_Node (F); @@ -193,13 +193,13 @@ package body Ocarina.Backends.ARINC653_Conf.Partitions is --------------------------- procedure Visit_System_Instance (E : Node_Id) is - S : Node_Id; + S : Node_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. if AINU.Is_Processor (Corresponding_Instance (S)) then Visit (Corresponding_Instance (S)); end if; @@ -219,14 +219,14 @@ package body Ocarina.Backends.ARINC653_Conf.Partitions is O : Node_Id; begin -- Create the main node and set its name as an item - N := Map_Bus (E); - O := Current_Parent_Node; + N := Map_Bus (E); + O := Current_Parent_Node; Current_Parent_Node := N; if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -248,22 +248,21 @@ package body Ocarina.Backends.ARINC653_Conf.Partitions is P : Node_Id; begin System_Nb_Processes := 0; - U := XTN.Unit (Backend_Node (Identifier (E))); - P := XTN.Node (Backend_Node (Identifier (E))); + U := XTN.Unit (Backend_Node (Identifier (E))); + P := XTN.Node (Backend_Node (Identifier (E))); Push_Entity (U); Push_Entity (P); - Current_XML_Node := XTN.Root_Node - (XTN.XML_File (U)); + Current_XML_Node := XTN.Root_Node (XTN.XML_File (U)); Current_Parent_Node := Current_XML_Node; if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -279,14 +278,14 @@ package body Ocarina.Backends.ARINC653_Conf.Partitions is -------------------------------------- procedure Visit_Virtual_Processor_Instance (E : Node_Id) is - S : Node_Id; + S : Node_Id; Processes : List_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -295,7 +294,7 @@ package body Ocarina.Backends.ARINC653_Conf.Partitions is if Present (Backend_Node (Identifier (E))) then Processes := XTN.Processes (Backend_Node (Identifier (E))); - S := XTN.First_Node (Processes); + S := XTN.First_Node (Processes); while Present (S) loop Visit (XTN.Content (S)); S := XTN.Next_Node (S); diff --git a/src/backends/ocarina-backends-arinc653_conf-scheduling.adb b/src/backends/ocarina-backends-arinc653_conf-scheduling.adb index 1a25091a..387fa7a5 100644 --- a/src/backends/ocarina-backends-arinc653_conf-scheduling.adb +++ b/src/backends/ocarina-backends-arinc653_conf-scheduling.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -58,7 +58,7 @@ package body Ocarina.Backends.ARINC653_Conf.Scheduling is package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils; package XTN renames Ocarina.Backends.XML_Tree.Nodes; - package XV renames Ocarina.Backends.XML_Values; + package XV renames Ocarina.Backends.XML_Values; procedure Visit_Architecture_Instance (E : Node_Id); procedure Visit_Component_Instance (E : Node_Id); @@ -68,7 +68,7 @@ package body Ocarina.Backends.ARINC653_Conf.Scheduling is procedure Visit_Virtual_Processor_Instance (E : Node_Id); Scheduling_Node : Node_Id; - Window_Number : Unsigned_Long_Long := 0; + Window_Number : Unsigned_Long_Long := 0; ----------- -- Visit -- @@ -102,8 +102,7 @@ package body Ocarina.Backends.ARINC653_Conf.Scheduling is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -139,13 +138,13 @@ package body Ocarina.Backends.ARINC653_Conf.Scheduling is --------------------------- procedure Visit_System_Instance (E : Node_Id) is - S : Node_Id; + S : Node_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. if AINU.Is_Processor (Corresponding_Instance (S)) then Visit (Corresponding_Instance (S)); end if; @@ -171,31 +170,31 @@ package body Ocarina.Backends.ARINC653_Conf.Scheduling is Push_Entity (U); Push_Entity (R); - Current_XML_Node := XTN.Root_Node - (XTN.XML_File (U)); + Current_XML_Node := XTN.Root_Node (XTN.XML_File (U)); Scheduling_Node := Make_XML_Node ("Module_Schedule"); Set_Str_To_Name_Buffer ("MajorFrameSeconds"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal - (XV.New_Floating_Point_Value (To_Seconds (Get_POK_Major_Frame (E)))); + Q := + Make_Literal + (XV.New_Floating_Point_Value (To_Seconds (Get_POK_Major_Frame (E)))); Append_Node_To_List - (Make_Assignement (P, Q), XTN.Items (Scheduling_Node)); + (Make_Assignement (P, Q), + XTN.Items (Scheduling_Node)); if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); end loop; end if; - Append_Node_To_List (Scheduling_Node, - XTN.Subitems (Current_XML_Node)); + Append_Node_To_List (Scheduling_Node, XTN.Subitems (Current_XML_Node)); Pop_Entity; Pop_Entity; end Visit_Processor_Instance; @@ -205,14 +204,14 @@ package body Ocarina.Backends.ARINC653_Conf.Scheduling is -------------------------------------- procedure Visit_Virtual_Processor_Instance (E : Node_Id) is - S : Node_Id; - Processes : List_Id; + S : Node_Id; + Processes : List_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -221,7 +220,7 @@ package body Ocarina.Backends.ARINC653_Conf.Scheduling is if Present (Backend_Node (Identifier (E))) then Processes := XTN.Processes (Backend_Node (Identifier (E))); - S := XTN.First_Node (Processes); + S := XTN.First_Node (Processes); while Present (S) loop Visit (XTN.Content (S)); S := XTN.Next_Node (S); diff --git a/src/backends/ocarina-backends-arinc653_conf-system_hm.adb b/src/backends/ocarina-backends-arinc653_conf-system_hm.adb index be5adc27..1609cf85 100644 --- a/src/backends/ocarina-backends-arinc653_conf-system_hm.adb +++ b/src/backends/ocarina-backends-arinc653_conf-system_hm.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -97,8 +97,7 @@ package body Ocarina.Backends.ARINC653_Conf.System_HM is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -131,8 +130,8 @@ package body Ocarina.Backends.ARINC653_Conf.System_HM is if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -145,13 +144,13 @@ package body Ocarina.Backends.ARINC653_Conf.System_HM is --------------------------- procedure Visit_System_Instance (E : Node_Id) is - S : Node_Id; + S : Node_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. if AINU.Is_Processor (Corresponding_Instance (S)) then Visit (Corresponding_Instance (S)); end if; @@ -185,17 +184,17 @@ package body Ocarina.Backends.ARINC653_Conf.System_HM is Push_Entity (P); Push_Entity (U); - Current_XML_Node := XTN.Root_Node - (XTN.XML_File (U)); + Current_XML_Node := XTN.Root_Node (XTN.XML_File (U)); Append_Node_To_List - (Map_System_HM_Table (E), XTN.Subitems (Current_XML_Node)); + (Map_System_HM_Table (E), + XTN.Subitems (Current_XML_Node)); if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -216,8 +215,8 @@ package body Ocarina.Backends.ARINC653_Conf.System_HM is if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - -- Visit the component instance corresponding to the - -- subcomponent S. + -- Visit the component instance corresponding to the + -- subcomponent S. Visit (Corresponding_Instance (S)); S := Next_Node (S); @@ -260,8 +259,8 @@ package body Ocarina.Backends.ARINC653_Conf.System_HM is --------------------- procedure Visit_Component (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := + Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -289,16 +288,15 @@ package body Ocarina.Backends.ARINC653_Conf.System_HM is ------------------- procedure Visit_Process (E : Node_Id) is - N : Node_Id; + N : Node_Id; Processes_List : List_Id; begin - Processes_List := XTN.Processes - (Backend_Node (Identifier (Get_Bound_Processor (E)))); + Processes_List := + XTN.Processes (Backend_Node (Identifier (Get_Bound_Processor (E)))); N := XTU.Make_Container (E); - XTU.Append_Node_To_List - (N, Processes_List); + XTU.Append_Node_To_List (N, Processes_List); end Visit_Process; -------------------------------------- @@ -324,9 +322,9 @@ package body Ocarina.Backends.ARINC653_Conf.System_HM is --------------------- procedure Visit_Processor (E : Node_Id) is - S : Node_Id; - P : Node_Id; - U : Node_Id; + S : Node_Id; + P : Node_Id; + U : Node_Id; N : Node_Id; Processes : List_Id; begin @@ -367,15 +365,16 @@ package body Ocarina.Backends.ARINC653_Conf.System_HM is ------------------ procedure Visit_System (E : Node_Id) is - S : Node_Id; + S : Node_Id; Component_Instance : Node_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop Component_Instance := Corresponding_Instance (S); - if Get_Category_Of_Component - (Component_Instance) = CC_Processor then + if Get_Category_Of_Component (Component_Instance) = + CC_Processor + then Visit_Processor (Component_Instance); end if; S := Next_Node (S); diff --git a/src/backends/ocarina-backends-arinc653_conf.adb b/src/backends/ocarina-backends-arinc653_conf.adb index bb53bc82..c3eee206 100644 --- a/src/backends/ocarina-backends-arinc653_conf.adb +++ b/src/backends/ocarina-backends-arinc653_conf.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -81,7 +81,8 @@ package body Ocarina.Backends.ARINC653_Conf is if No (XML_Root) then Display_Error - ("ARINC653 configuration generation failed", Fatal => True); + ("ARINC653 configuration generation failed", + Fatal => True); end if; -- At this point, we have a valid tree, we can begin the XML @@ -175,8 +176,7 @@ package body Ocarina.Backends.ARINC653_Conf is -- Get_XML_Root -- ------------------ - function Get_XML_Root return Node_Id - is + function Get_XML_Root return Node_Id is begin return XML_Root; end Get_XML_Root; diff --git a/src/backends/ocarina-backends-asn1-deployment.adb b/src/backends/ocarina-backends-asn1-deployment.adb index ee1d0c52..dbda18ed 100644 --- a/src/backends/ocarina-backends-asn1-deployment.adb +++ b/src/backends/ocarina-backends-asn1-deployment.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -118,79 +118,74 @@ package body Ocarina.Backends.ASN1.Deployment is procedure Visit_Architecture_Instance (E : Node_Id) is begin - ASN1_Root := Make_ASN1_File - (Make_Defining_Identifier - (Get_String_Name ("asn1_deployment"))); + ASN1_Root := + Make_ASN1_File + (Make_Defining_Identifier (Get_String_Name ("asn1_deployment"))); ASN1N.Set_Name - (ASN1N.Module_Node (ASN1_Root), + (ASN1N.Module_Node (ASN1_Root), Get_String_Name ("POHIC-DEPLOYMENT")); Module_Node := ASN1N.Module_Node (ASN1_Root); - Thread_Enumeration := New_List (ASN1N.K_Enumerated_Value_List); - Port_Enumeration := New_List (ASN1N.K_Enumerated_Value_List); - Msg_Choices := New_List (ASN1N.K_Enumerated_Value_List); + Thread_Enumeration := New_List (ASN1N.K_Enumerated_Value_List); + Port_Enumeration := New_List (ASN1N.K_Enumerated_Value_List); + Msg_Choices := New_List (ASN1N.K_Enumerated_Value_List); Visit (Root_System (E)); if Length (Thread_Enumeration) > 0 then Append_Node_To_List - (Make_Type_Definition - (Get_String_Name ("Thread-id"), - Make_Enumerated (Thread_Enumeration)), - ASN1N.Definitions (Module_Node)); + (Make_Type_Definition + (Get_String_Name ("Thread-id"), + Make_Enumerated (Thread_Enumeration)), + ASN1N.Definitions (Module_Node)); end if; if Length (Thread_Enumeration) > 0 then Append_Node_To_List - (Make_Type_Definition - (Get_String_Name ("Port-id"), - Make_Enumerated (Port_Enumeration)), - ASN1N.Definitions (Module_Node)); + (Make_Type_Definition + (Get_String_Name ("Port-id"), + Make_Enumerated (Port_Enumeration)), + ASN1N.Definitions (Module_Node)); end if; declare Pkt_Contents : constant List_Id := ASN1U.New_List (ASN1N.K_List_Id); begin Append_Node_To_List - (Make_Sequence_Member - (Get_String_Name ("sender-thread"), - Make_Defining_Identifier - (Get_String_Name ("Thread-id"))), - Pkt_Contents); + (Make_Sequence_Member + (Get_String_Name ("sender-thread"), + Make_Defining_Identifier (Get_String_Name ("Thread-id"))), + Pkt_Contents); Append_Node_To_List - (Make_Sequence_Member - (Get_String_Name ("sender-port"), - Make_Defining_Identifier - (Get_String_Name ("Port-id"))), - Pkt_Contents); + (Make_Sequence_Member + (Get_String_Name ("sender-port"), + Make_Defining_Identifier (Get_String_Name ("Port-id"))), + Pkt_Contents); Append_Node_To_List - (Make_Sequence_Member - (Get_String_Name ("receiver-thread"), - Make_Defining_Identifier - (Get_String_Name ("Thread-id"))), - Pkt_Contents); + (Make_Sequence_Member + (Get_String_Name ("receiver-thread"), + Make_Defining_Identifier (Get_String_Name ("Thread-id"))), + Pkt_Contents); Append_Node_To_List - (Make_Sequence_Member - (Get_String_Name ("receiver-port"), - Make_Defining_Identifier - (Get_String_Name ("Port-id"))), - Pkt_Contents); + (Make_Sequence_Member + (Get_String_Name ("receiver-port"), + Make_Defining_Identifier (Get_String_Name ("Port-id"))), + Pkt_Contents); Append_Node_To_List - (Make_Sequence_Member - (Get_String_Name ("msg"), + (Make_Sequence_Member + (Get_String_Name ("msg"), Make_Choice (Msg_Choices)), - Pkt_Contents); + Pkt_Contents); Packet_Type := - Make_Type_Definition - (Get_String_Name ("Pkt"), - Make_Sequence (Pkt_Contents)); - Append_Node_To_List - (Packet_Type, ASN1N.Definitions (Module_Node)); + Make_Type_Definition + (Get_String_Name ("Pkt"), + Make_Sequence (Pkt_Contents)); + Append_Node_To_List (Packet_Type, ASN1N.Definitions (Module_Node)); end; end Visit_Architecture_Instance; @@ -200,8 +195,7 @@ package body Ocarina.Backends.ASN1.Deployment is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -229,7 +223,7 @@ package body Ocarina.Backends.ASN1.Deployment is ---------------------------- procedure Visit_Process_Instance (E : Node_Id) is - S : Node_Id; + S : Node_Id; begin if not AAU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); @@ -269,31 +263,29 @@ package body Ocarina.Backends.ASN1.Deployment is --------------------------- procedure Visit_Thread_Instance (E : Node_Id) is - S : Node_Id; - F : Node_Id; - Call_Seq : Node_Id; - Spg_Call : Node_Id; - Thread_Name : Name_Id; - Port_Name : Name_Id; - Parent_Name : Name_Id; + S : Node_Id; + F : Node_Id; + Call_Seq : Node_Id; + Spg_Call : Node_Id; + Thread_Name : Name_Id; + Port_Name : Name_Id; + Parent_Name : Name_Id; -- Name of the containing process. - Msg_Choice : Node_Id; - Msg_Name : Name_Id; + Msg_Choice : Node_Id; + Msg_Name : Name_Id; Msg_Constraints : Node_Id; begin Set_Str_To_Name_Buffer ("thread-"); - Parent_Name := Display_Name - (Identifier - (Parent_Subcomponent - (Parent_Component - (Parent_Subcomponent (E))))); + Parent_Name := + Display_Name + (Identifier + (Parent_Subcomponent + (Parent_Component (Parent_Subcomponent (E))))); Get_Name_String_And_Append (Parent_Name); Add_Str_To_Name_Buffer ("-"); Get_Name_String_And_Append - (Display_Name - (Identifier - (Parent_Subcomponent (E)))); + (Display_Name (Identifier (Parent_Subcomponent (E)))); Thread_Name := Name_Find; Thread_Name := To_Lower (Thread_Name); @@ -303,8 +295,7 @@ package body Ocarina.Backends.ASN1.Deployment is -- character _. Append_Node_To_List - (Make_Enumerated_Value - (Thread_Name, Thread_Id), + (Make_Enumerated_Value (Thread_Name, Thread_Id), Thread_Enumeration); Thread_Id := Thread_Id + 1; @@ -351,13 +342,11 @@ package body Ocarina.Backends.ASN1.Deployment is F := First_Node (Features (E)); while Present (F) loop - if Kind (F) = K_Port_Spec_Instance and then - Is_Data (F) then + if Kind (F) = K_Port_Spec_Instance and then Is_Data (F) then Set_Str_To_Name_Buffer ("port-"); Get_Name_String_And_Append (Thread_Name); Add_Str_To_Name_Buffer ("-"); - Get_Name_String_And_Append - (Display_Name (Identifier (F))); + Get_Name_String_And_Append (Display_Name (Identifier (F))); Port_Name := Name_Find; Port_Name := To_Lower (Port_Name); @@ -366,9 +355,8 @@ package body Ocarina.Backends.ASN1.Deployment is -- character _. Append_Node_To_List - (Make_Enumerated_Value - (Port_Name, Port_Id), - Port_Enumeration); + (Make_Enumerated_Value (Port_Name, Port_Id), + Port_Enumeration); Port_Id := Port_Id + 1; -- Here, we build the port identifier (we increment it) @@ -376,21 +364,23 @@ package body Ocarina.Backends.ASN1.Deployment is -- it to the Port_Enumeration list that contains all -- port identifiers. - Msg_Name := Port_Name; - Msg_Constraints := Make_Type_Constraints - (Size_Down => ASN1V.New_Int_Value - (0, 1, 10), - Size_Up => ASN1V.New_Int_Value - (To_Bytes - (Get_Data_Size - (Corresponding_Instance (F))), 1, 10)); - Msg_Choice := Make_Choice_Member - (Msg_Name, - Make_Type_Designator - (Type_Name => - Make_Defining_Identifier + Msg_Name := Port_Name; + Msg_Constraints := + Make_Type_Constraints + (Size_Down => ASN1V.New_Int_Value (0, 1, 10), + Size_Up => + ASN1V.New_Int_Value + (To_Bytes (Get_Data_Size (Corresponding_Instance (F))), + 1, + 10)); + Msg_Choice := + Make_Choice_Member + (Msg_Name, + Make_Type_Designator + (Type_Name => + Make_Defining_Identifier (Get_String_Name ("OCTET STRING")), - Type_Constraints => Msg_Constraints)); + Type_Constraints => Msg_Constraints)); Append_Node_To_List (Msg_Choice, Msg_Choices); @@ -410,9 +400,9 @@ package body Ocarina.Backends.ASN1.Deployment is null; end Visit_Subprogram_Instance; - --------------------------- - -- Visit_Device_Instance -- - --------------------------- + --------------------------- + -- Visit_Device_Instance -- + --------------------------- procedure Visit_Device_Instance (E : Node_Id) is pragma Unreferenced (E); diff --git a/src/backends/ocarina-backends-asn1_tree-debug.adb b/src/backends/ocarina-backends-asn1_tree-debug.adb index e1aa097a..bb166da3 100644 --- a/src/backends/ocarina-backends-asn1_tree-debug.adb +++ b/src/backends/ocarina-backends-asn1_tree-debug.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -31,10 +31,10 @@ -- -- ------------------------------------------------------------------------------ -with Charset; use Charset; -with Locations; use Locations; -with Namet; use Namet; -with Utils; use Utils; +with Charset; use Charset; +with Locations; use Locations; +with Namet; use Namet; +with Utils; use Utils; with Ocarina.Backends.ASN1_Tree.Nutils; use Ocarina.Backends.ASN1_Tree.Nutils; with Ocarina.Backends.ASN1_Values; use Ocarina.Backends.ASN1_Values; @@ -163,25 +163,21 @@ package body Ocarina.Backends.ASN1_Tree.Debug is is C : Node_Id; begin - if A = "Next_Node" - or else A = "Package_Declaration" - then + if A = "Next_Node" or else A = "Package_Declaration" then return; end if; N_Indents := N_Indents + 1; W_Indents; - Write_Str (A); + Write_Str (A); Write_Char (' '); - Write_Str (K); + Write_Str (K); Write_Char (' '); C := Node_Id (N); if K = "Name_Id" then Write_Line (Quoted (V)); - elsif K = "Node_Id" - and then Present (C) - then + elsif K = "Node_Id" and then Present (C) then case Kind (C) is when others => Write_Line (V); @@ -214,9 +210,9 @@ package body Ocarina.Backends.ASN1_Tree.Debug is procedure W_Node_Header (N : Node_Id) is begin W_Indents; - Write_Int (Int (N)); + Write_Int (Int (N)); Write_Char (' '); - Write_Str (Image (Kind (N))); + Write_Str (Image (Kind (N))); Write_Char (' '); Write_Line (Image (Loc (N))); end W_Node_Header; diff --git a/src/backends/ocarina-backends-asn1_tree-debug.ads b/src/backends/ocarina-backends-asn1_tree-debug.ads index d994fd81..920dcfea 100644 --- a/src/backends/ocarina-backends-asn1_tree-debug.ads +++ b/src/backends/ocarina-backends-asn1_tree-debug.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -39,15 +39,15 @@ package Ocarina.Backends.ASN1_Tree.Debug is N_Indents : Natural := 0; - procedure W_Eol (N : Natural := 1) renames Output.Write_Eol; - procedure W_Int (N : Int) renames Output.Write_Int; - procedure W_Line (N : String) renames Output.Write_Line; - procedure W_Str (N : String) renames Output.Write_Str; + procedure W_Eol (N : Natural := 1) renames Output.Write_Eol; + procedure W_Int (N : Int) renames Output.Write_Int; + procedure W_Line (N : String) renames Output.Write_Line; + procedure W_Str (N : String) renames Output.Write_Str; procedure W_Indents; - procedure W_Byte (N : Byte); - procedure W_List_Id (L : List_Id); - procedure W_Node_Id (N : Node_Id); + procedure W_Byte (N : Byte); + procedure W_List_Id (L : List_Id); + procedure W_Node_Id (N : Node_Id); procedure W_Node_Header (N : Node_Id); procedure W_Node_Attribute diff --git a/src/backends/ocarina-backends-asn1_tree-generator.adb b/src/backends/ocarina-backends-asn1_tree-generator.adb index 7663ac37..6f0ba42d 100644 --- a/src/backends/ocarina-backends-asn1_tree-generator.adb +++ b/src/backends/ocarina-backends-asn1_tree-generator.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -32,9 +32,9 @@ ------------------------------------------------------------------------------ with GNAT.OS_Lib; use GNAT.OS_Lib; -with Outfiles; use Outfiles; -with Namet; use Namet; -with Output; use Output; +with Outfiles; use Outfiles; +with Namet; use Namet; +with Output; use Output; with Ocarina.Backends.ASN1_Values; with Ocarina.Backends.ASN1_Tree.Nodes; @@ -320,8 +320,9 @@ package body Ocarina.Backends.ASN1_Tree.Generator is begin Generate (Type_Name (N)); if Cons /= No_Node then - if Size_Down (Cons) /= No_Value and then - Size_Up (Cons) /= No_Value then + if Size_Down (Cons) /= No_Value + and then Size_Up (Cons) /= No_Value + then Write_Str (" (SIZE ("); Write_Str (Image (Size_Down (Cons))); Write_Str (" .. "); diff --git a/src/backends/ocarina-backends-asn1_tree-generator.ads b/src/backends/ocarina-backends-asn1_tree-generator.ads index e11608af..d272d639 100644 --- a/src/backends/ocarina-backends-asn1_tree-generator.ads +++ b/src/backends/ocarina-backends-asn1_tree-generator.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -33,7 +33,7 @@ package Ocarina.Backends.ASN1_Tree.Generator is - Var_Name_Len : Natural := 0; + Var_Name_Len : Natural := 0; procedure Generate (N : Node_Id); -- All code generation is performed in the current directory. It diff --git a/src/backends/ocarina-backends-asn1_tree-nutils.adb b/src/backends/ocarina-backends-asn1_tree-nutils.adb index f4b37421..fe2eebc6 100644 --- a/src/backends/ocarina-backends-asn1_tree-nutils.adb +++ b/src/backends/ocarina-backends-asn1_tree-nutils.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -52,19 +52,21 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- Used to mark C keywords and avoid collision with other languages type Entity_Stack_Entry is record - Current_File : Node_Id; - Current_Entity : Node_Id; + Current_File : Node_Id; + Current_Entity : Node_Id; end record; No_Depth : constant Int := -1; - package Entity_Stack is - new GNAT.Table (Entity_Stack_Entry, Int, No_Depth + 1, 10, 10); + package Entity_Stack is new GNAT.Table + (Entity_Stack_Entry, + Int, + No_Depth + 1, + 10, + 10); use Entity_Stack; - procedure New_Operator - (O : Operator_Type; - I : String := ""); + procedure New_Operator (O : Operator_Type; I : String := ""); ------------------------ -- Add_Prefix_To_Name -- @@ -72,8 +74,7 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is function Add_Prefix_To_Name (Prefix : String; - Name : Name_Id) - return Name_Id + Name : Name_Id) return Name_Id is begin Set_Str_To_Name_Buffer (Prefix); @@ -87,8 +88,7 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is function Add_Suffix_To_Name (Suffix : String; - Name : Name_Id) - return Name_Id + Name : Name_Id) return Name_Id is begin Get_Name_String (Name); @@ -102,8 +102,7 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is function Remove_Suffix_From_Name (Suffix : String; - Name : Name_Id) - return Name_Id + Name : Name_Id) return Name_Id is Length : Natural; Temp_Str : String (1 .. Suffix'Length); @@ -125,18 +124,20 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- New_List -- -------------- - function New_List (Kind : ASN1_Nodes.Node_Kind; From : Node_Id := No_Node) - return List_Id is + function New_List + (Kind : ASN1_Nodes.Node_Kind; + From : Node_Id := No_Node) return List_Id + is N : Node_Id; begin ASN1_Nodes.Entries.Increment_Last; - N := ASN1_Nodes.Entries.Last; + N := ASN1_Nodes.Entries.Last; ASN1_Nodes.Entries.Table (N) := ASN1_Nodes.Default_Node; Set_Kind (N, Kind); if Present (From) then - ASN1_Nodes.Set_Loc (N, ASN1_Nodes.Loc (From)); + ASN1_Nodes.Set_Loc (N, ASN1_Nodes.Loc (From)); else - ASN1_Nodes.Set_Loc (N, No_Location); + ASN1_Nodes.Set_Loc (N, No_Location); end if; return List_Id (N); end New_List; @@ -206,7 +207,8 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is C := New_Node (ASN1_Nodes.K_Defining_Identifier); ASN1_Nodes.Set_Name (C, ASN1_Nodes.Name (N)); ASN1_Nodes.Set_Corresponding_Node - (C, ASN1_Nodes.Corresponding_Node (N)); + (C, + ASN1_Nodes.Corresponding_Node (N)); when others => raise Program_Error; @@ -368,13 +370,12 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is function New_Node (Kind : ASN1_Nodes.Node_Kind; - From : Node_Id := No_Node) - return Node_Id + From : Node_Id := No_Node) return Node_Id is N : Node_Id; begin ASN1_Nodes.Entries.Increment_Last; - N := ASN1_Nodes.Entries.Last; + N := ASN1_Nodes.Entries.Last; ASN1_Nodes.Entries.Table (N) := ASN1_Nodes.Default_Node; ASN1_Nodes.Set_Kind (N, Kind); @@ -391,10 +392,7 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- New_Token -- --------------- - procedure New_Token - (T : Token_Type; - I : String := "") - is + procedure New_Token (T : Token_Type; I : String := "") is Name : Name_Id; begin if T in Keyword_Type then @@ -418,9 +416,7 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- New_Operator -- ------------------ - procedure New_Operator - (O : Operator_Type; - I : String := "") is + procedure New_Operator (O : Operator_Type; I : String := "") is begin if O in Keyword_Operator then Set_Str_To_Name_Buffer (Image (O)); @@ -442,11 +438,8 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is Set_Corresponding_Node (Identifier, File); Set_Module_Node (File, New_Node (K_ASN1_Module)); - Set_Name - (Module_Node (File), - Get_String_Name ("unknownmodule")); - Set_Definitions - (Module_Node (File), New_List (K_List_Id)); + Set_Name (Module_Node (File), Get_String_Name ("unknownmodule")); + Set_Definitions (Module_Node (File), New_List (K_List_Id)); return File; end Make_ASN1_File; @@ -454,9 +447,7 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- Make_Defining_Identifier -- ------------------------------ - function Make_Defining_Identifier (Name : Name_Id) - return Node_Id - is + function Make_Defining_Identifier (Name : Name_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Defining_Identifier); @@ -468,9 +459,7 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- Make_Enumerated_Value -- --------------------------- - function Make_Enumerated_Value (Name : Name_Id) - return Node_Id - is + function Make_Enumerated_Value (Name : Name_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Enumerated_Value); @@ -483,8 +472,9 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- Make_Enumerated_Value -- --------------------------- - function Make_Enumerated_Value (Name : Name_Id; V : Unsigned_Long_Long) - return Node_Id + function Make_Enumerated_Value + (Name : Name_Id; + V : Unsigned_Long_Long) return Node_Id is N : Node_Id; begin @@ -497,8 +487,9 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- Make_Type_Definition -- -------------------------- - function Make_Type_Definition (Name : Name_Id; Decl : Node_Id) - return Node_Id + function Make_Type_Definition + (Name : Name_Id; + Decl : Node_Id) return Node_Id is N : Node_Id; begin @@ -512,8 +503,7 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- Make_Enumerated -- --------------------- - function Make_Enumerated return Node_Id - is + function Make_Enumerated return Node_Id is N : Node_Id; begin N := New_Node (K_Enumerated); @@ -525,8 +515,7 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- Make_Enumerated -- --------------------- - function Make_Enumerated (L : List_Id) return Node_Id - is + function Make_Enumerated (L : List_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Enumerated); @@ -538,8 +527,7 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- Make_Sequence -- ------------------- - function Make_Sequence (Sequence_Members : List_Id) return Node_Id - is + function Make_Sequence (Sequence_Members : List_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Sequence); @@ -552,7 +540,8 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -------------------------- function Make_Sequence_Member - (Member_Name : Name_Id; Member_Type : Node_Id) return Node_Id + (Member_Name : Name_Id; + Member_Type : Node_Id) return Node_Id is N : Node_Id; begin @@ -566,8 +555,7 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- Make_Choice -- ----------------- - function Make_Choice (Choice_Members : List_Id) return Node_Id - is + function Make_Choice (Choice_Members : List_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Choice); @@ -580,7 +568,8 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is ------------------------ function Make_Choice_Member - (Member_Name : Name_Id; Member_Type : Node_Id) return Node_Id + (Member_Name : Name_Id; + Member_Type : Node_Id) return Node_Id is N : Node_Id; begin @@ -607,9 +596,9 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is --------------------------- function Make_Type_Constraints - (Size_Up : Value_Id := No_Value; - Size_Down : Value_Id := No_Value) - return Node_Id is + (Size_Up : Value_Id := No_Value; + Size_Down : Value_Id := No_Value) return Node_Id + is N : Node_Id; begin N := New_Node (K_Type_Constraints); @@ -622,9 +611,9 @@ package body Ocarina.Backends.ASN1_Tree.Nutils is -- Make_Type_Designator -- -------------------------- - function Make_Type_Designator (Type_Name : Node_Id; - Type_Constraints : Node_Id := No_Node) - return Node_Id + function Make_Type_Designator + (Type_Name : Node_Id; + Type_Constraints : Node_Id := No_Node) return Node_Id is N : Node_Id; begin diff --git a/src/backends/ocarina-backends-asn1_tree-nutils.ads b/src/backends/ocarina-backends-asn1_tree-nutils.ads index d15319d8..5bc86fcf 100644 --- a/src/backends/ocarina-backends-asn1_tree-nutils.ads +++ b/src/backends/ocarina-backends-asn1_tree-nutils.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -42,12 +42,12 @@ package Ocarina.Backends.ASN1_Tree.Nutils is type Token_Type is ( - -- Token name Token type - -- Keywords - Tok_Null, -- NULL **** First Keyword + -- Token name Token type + -- Keywords + Tok_Null, -- NULL **** First Keyword Tok_Module, -- MODULE - -- Graphic Characters + -- Graphic Characters Tok_Xor, -- ^ Tok_Sharp, -- # Tok_Mod, -- % @@ -86,10 +86,9 @@ package Ocarina.Backends.ASN1_Tree.Nutils is Token_Image : array (Token_Type) of Name_Id; - subtype Keyword_Type is Token_Type - range Tok_Null .. Tok_Module; + subtype Keyword_Type is Token_Type range Tok_Null .. Tok_Module; - type Operator_Type is + type Operator_Type is (Op_Not, -- not Op_And, -- and Op_In, -- in @@ -117,11 +116,11 @@ package Ocarina.Backends.ASN1_Tree.Nutils is Op_None); -- No operation Operator_Image : array - (Operator_Type'Pos (Op_And) .. Operator_Type'Pos (Op_Vertical_Bar)) - of Name_Id; + (Operator_Type'Pos (Op_And) .. + Operator_Type'Pos (Op_Vertical_Bar)) of Name_Id; - subtype Keyword_Operator is Operator_Type - range Operator_Type'First .. Op_Or_Else; + subtype Keyword_Operator is + Operator_Type range Operator_Type'First .. Op_Or_Else; function Length (L : List_Id) return Natural; @@ -131,8 +130,9 @@ package Ocarina.Backends.ASN1_Tree.Nutils is procedure Initialize; - function New_List (Kind : ASN1_Nodes.Node_Kind; From : Node_Id := No_Node) - return List_Id; + function New_List + (Kind : ASN1_Nodes.Node_Kind; + From : Node_Id := No_Node) return List_Id; function Image (O : Operator_Type) return String; @@ -147,18 +147,20 @@ package Ocarina.Backends.ASN1_Tree.Nutils is procedure Append_Node_To_List (E : Node_Id; L : List_Id); function Remove_Suffix_From_Name - (Suffix : String; Name : Name_Id) return Name_Id; + (Suffix : String; + Name : Name_Id) return Name_Id; function Add_Suffix_To_Name - (Suffix : String; Name : Name_Id) return Name_Id; + (Suffix : String; + Name : Name_Id) return Name_Id; function Add_Prefix_To_Name - (Prefix : String; Name : Name_Id) return Name_Id; + (Prefix : String; + Name : Name_Id) return Name_Id; function New_Node (Kind : ASN1_Nodes.Node_Kind; - From : Node_Id := No_Node) - return Node_Id; + From : Node_Id := No_Node) return Node_Id; procedure New_Token (T : Token_Type; I : String := ""); @@ -173,8 +175,9 @@ package Ocarina.Backends.ASN1_Tree.Nutils is -- Build a node that describes a member of an enumeration but -- does not associate any value with it. - function Make_Enumerated_Value (Name : Name_Id; V : Unsigned_Long_Long) - return Node_Id; + function Make_Enumerated_Value + (Name : Name_Id; + V : Unsigned_Long_Long) return Node_Id; -- Make a node that describes a member of an enumeration and associated -- an integer value to it. The first parameter is the name of the -- enumeration while the second is its corresponding value. @@ -188,8 +191,9 @@ package Ocarina.Backends.ASN1_Tree.Nutils is -- of the enumeration. The returned node_id can be associated -- with a type definition. - function Make_Type_Definition (Name : Name_Id; Decl : Node_Id) - return Node_Id; + function Make_Type_Definition + (Name : Name_Id; + Decl : Node_Id) return Node_Id; -- Make a Type_Definition node. First parameter is the name -- of the type, the second one is the declaration of this type -- Enumerated/Choice/... node. @@ -202,7 +206,8 @@ package Ocarina.Backends.ASN1_Tree.Nutils is -- Make a sequence that contains the members given in parameter. function Make_Sequence_Member - (Member_Name : Name_Id; Member_Type : Node_Id) return Node_Id; + (Member_Name : Name_Id; + Member_Type : Node_Id) return Node_Id; -- Make a sequence member identified by Member_Name which has the -- type Member_Type. @@ -210,13 +215,14 @@ package Ocarina.Backends.ASN1_Tree.Nutils is -- Make a choice that contains the members given in parameter. function Make_Choice_Member - (Member_Name : Name_Id; Member_Type : Node_Id) return Node_Id; + (Member_Name : Name_Id; + Member_Type : Node_Id) return Node_Id; -- Make a choice member identified by Member_Name which has the -- type Member_Type. - function Make_Type_Designator (Type_Name : Node_Id; - Type_Constraints : Node_Id := No_Node) - return Node_Id; + function Make_Type_Designator + (Type_Name : Node_Id; + Type_Constraints : Node_Id := No_Node) return Node_Id; -- Make a node that points to a type. The type name is either a reference -- to a type node, either a defining_identifier node that contains -- the name of the pointed type. The second parameter is optional @@ -225,9 +231,8 @@ package Ocarina.Backends.ASN1_Tree.Nutils is -- information. function Make_Type_Constraints - (Size_Up : Value_Id := No_Value; - Size_Down : Value_Id := No_Value) - return Node_Id; + (Size_Up : Value_Id := No_Value; + Size_Down : Value_Id := No_Value) return Node_Id; -- Make the Type_Constraints node. This node contains all potential -- constraints that a type designator can contain. So, all parameters -- are not mandatory and have a default value. diff --git a/src/backends/ocarina-backends-asn1_values.adb b/src/backends/ocarina-backends-asn1_values.adb index 4e099564..590e057c 100644 --- a/src/backends/ocarina-backends-asn1_values.adb +++ b/src/backends/ocarina-backends-asn1_values.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2012 ESA & ISAE. -- +-- Copyright (C) 2012-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -31,7 +31,7 @@ -- -- ------------------------------------------------------------------------------ -with Namet; use Namet; +with Namet; use Namet; with Ocarina.AADL_Values; @@ -41,10 +41,9 @@ package body Ocarina.Backends.ASN1_Values is package OV renames Ocarina.AADL_Values; - Hex : constant String := "0123456789ABCDEF"; + Hex : constant String := "0123456789ABCDEF"; - package VT is - new GNAT.Table (Value_Type, Value_Id, No_Value + 1, 10, 10); + package VT is new GNAT.Table (Value_Type, Value_Id, No_Value + 1, 10, 10); subtype ULL is Unsigned_Long_Long; @@ -54,8 +53,7 @@ package body Ocarina.Backends.ASN1_Values is -- "*" -- --------- - function "*" (L, R : Value_Type) return Value_Type - is + function "*" (L, R : Value_Type) return Value_Type is V : Value_Type := L; begin case V.K is @@ -79,9 +77,8 @@ package body Ocarina.Backends.ASN1_Values is -- "+" -- --------- - function "+" (L, R : Value_Type) return Value_Type - is - V : Value_Type := R; + function "+" (L, R : Value_Type) return Value_Type is + V : Value_Type := R; begin case R.K is when K_Int => @@ -112,8 +109,7 @@ package body Ocarina.Backends.ASN1_Values is -- "-" -- --------- - function "-" (R : Value_Type) return Value_Type - is + function "-" (R : Value_Type) return Value_Type is V : Value_Type := R; begin case R.K is @@ -134,8 +130,7 @@ package body Ocarina.Backends.ASN1_Values is -- "-" -- --------- - function "-" (L, R : Value_Type) return Value_Type - is + function "-" (L, R : Value_Type) return Value_Type is V : Value_Type := R; begin case R.K is @@ -156,9 +151,8 @@ package body Ocarina.Backends.ASN1_Values is -- "/" -- --------- - function "/" (L, R : Value_Type) return Value_Type - is - V : Value_Type := L; + function "/" (L, R : Value_Type) return Value_Type is + V : Value_Type := L; begin case V.K is when K_Int => @@ -210,8 +204,7 @@ package body Ocarina.Backends.ASN1_Values is -- "and" -- ----------- - function "and" (L, R : Value_Type) return Value_Type - is + function "and" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -239,8 +232,7 @@ package body Ocarina.Backends.ASN1_Values is -- "mod" -- ----------- - function "mod" (L, R : Value_Type) return Value_Type - is + function "mod" (L, R : Value_Type) return Value_Type is V : Value_Type := L; begin case L.K is @@ -261,8 +253,7 @@ package body Ocarina.Backends.ASN1_Values is -- "not" -- ----------- - function "not" (R : Value_Type) return Value_Type - is + function "not" (R : Value_Type) return Value_Type is V : Value_Type := R; begin case V.K is @@ -279,8 +270,7 @@ package body Ocarina.Backends.ASN1_Values is -- "or" -- ---------- - function "or" (L, R : Value_Type) return Value_Type - is + function "or" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -308,8 +298,7 @@ package body Ocarina.Backends.ASN1_Values is -- "xor" -- ----------- - function "xor" (L, R : Value_Type) return Value_Type - is + function "xor" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -337,8 +326,7 @@ package body Ocarina.Backends.ASN1_Values is -- Add_ULL_To_Name_Buffer -- ---------------------------- - procedure Add_ULL_To_Name_Buffer (U : ULL; B : ULL; S : Integer := 1) - is + procedure Add_ULL_To_Name_Buffer (U : ULL; B : ULL; S : Integer := 1) is Q : constant ULL := U / B; R : constant ULL := U mod B; begin @@ -352,14 +340,13 @@ package body Ocarina.Backends.ASN1_Values is -- Image -- ----------- - function Image (Value : Value_Id) return String - is + function Image (Value : Value_Id) return String is V : Value_Type; begin if Value = No_Value then return "<>"; end if; - V := VT.Table (Value); + V := VT.Table (Value); Name_Len := 0; case V.K is @@ -395,8 +382,7 @@ package body Ocarina.Backends.ASN1_Values is if Index > 0 then Index := Index + 2; - while Index <= Name_Len - and then Name_Buffer (Index) = '0' + while Index <= Name_Len and then Name_Buffer (Index) = '0' loop Name_Buffer (Index .. Name_Len - 1) := Name_Buffer (Index + 1 .. Name_Len); @@ -407,7 +393,7 @@ package body Ocarina.Backends.ASN1_Values is if Index > Name_Len then Name_Len := Name_Len - 2; - Index := Name_Len; + Index := Name_Len; else Index := Name_Len; @@ -470,9 +456,7 @@ package body Ocarina.Backends.ASN1_Values is -- New_Floating_Point_Value -- ------------------------------ - function New_Floating_Point_Value - (Value : Long_Double) - return Value_Id is + function New_Floating_Point_Value (Value : Long_Double) return Value_Id is begin return New_Value (Value_Type'(K_Float, Value)); end New_Floating_Point_Value; @@ -484,8 +468,8 @@ package body Ocarina.Backends.ASN1_Values is function New_Int_Value (Value : Unsigned_Long_Long; Sign : Short_Short; - Base : Unsigned_Short_Short) - return Value_Id is + Base : Unsigned_Short_Short) return Value_Id + is begin return New_Value (Value_Type'(K_Int, Value, Sign, Base)); end New_Int_Value; @@ -494,9 +478,7 @@ package body Ocarina.Backends.ASN1_Values is -- New_Character_Value -- ------------------------- - function New_Char_Value (Value : Unsigned_Short) - return Value_Id - is + function New_Char_Value (Value : Unsigned_Short) return Value_Id is begin return New_Value (Value_Type'(K_Char, Value)); end New_Char_Value; @@ -505,12 +487,11 @@ package body Ocarina.Backends.ASN1_Values is -- New_Value -- --------------- - function New_Value (Value : Value_Type) return Value_Id - is + function New_Value (Value : Value_Type) return Value_Id is V : Value_Id; begin VT.Increment_Last; - V := VT.Last; + V := VT.Last; VT.Table (V) := Value; return V; end New_Value; @@ -528,8 +509,7 @@ package body Ocarina.Backends.ASN1_Values is -- Shift_Left -- ---------------- - function Shift_Left (L, R : Value_Type) return Value_Type - is + function Shift_Left (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -554,8 +534,7 @@ package body Ocarina.Backends.ASN1_Values is -- Shift_Right -- ----------------- - function Shift_Right (L, R : Value_Type) return Value_Type - is + function Shift_Right (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -580,8 +559,7 @@ package body Ocarina.Backends.ASN1_Values is -- New_String_Value -- ---------------------- - function New_String_Value (Value : Name_Id) - return Value_Id is + function New_String_Value (Value : Name_Id) return Value_Id is begin return New_Value (Value_Type'(K_String, Value)); end New_String_Value; diff --git a/src/backends/ocarina-backends-asn1_values.ads b/src/backends/ocarina-backends-asn1_values.ads index fd31b906..d21203f4 100644 --- a/src/backends/ocarina-backends-asn1_values.ads +++ b/src/backends/ocarina-backends-asn1_values.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2012 ESA & ISAE. -- +-- Copyright (C) 2012-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -31,57 +31,46 @@ -- -- ------------------------------------------------------------------------------ -with Ocarina.Backends.ASN1_Tree.Nodes; -use Ocarina.Backends.ASN1_Tree.Nodes; +with Ocarina.Backends.ASN1_Tree.Nodes; use Ocarina.Backends.ASN1_Tree.Nodes; package Ocarina.Backends.ASN1_Values is - type Value_Type (K : Node_Kind := K_Int) is - record - case K is - when K_Int => - IVal : Unsigned_Long_Long; - Sign : Short_Short; - Base : Unsigned_Short_Short; + type Value_Type (K : Node_Kind := K_Int) is record + case K is + when K_Int => + IVal : Unsigned_Long_Long; + Sign : Short_Short; + Base : Unsigned_Short_Short; - when K_Float => - FVal : Long_Double; + when K_Float => + FVal : Long_Double; - when K_Char => - CVal : Unsigned_Short; + when K_Char => + CVal : Unsigned_Short; - when K_String => - PCVal : Name_Id; + when K_String => + PCVal : Name_Id; - when others => - null; - end case; - end record; + when others => + null; + end case; + end record; Bad_Value : constant Value_Type; - No_Value : constant Value_Id; + No_Value : constant Value_Id; - function New_Floating_Point_Value - (Value : Long_Double) - return Value_Id; + function New_Floating_Point_Value (Value : Long_Double) return Value_Id; function New_Int_Value (Value : Unsigned_Long_Long; Sign : Short_Short; - Base : Unsigned_Short_Short) - return Value_Id; + Base : Unsigned_Short_Short) return Value_Id; - function New_Char_Value - (Value : Unsigned_Short) - return Value_Id; + function New_Char_Value (Value : Unsigned_Short) return Value_Id; - function New_String_Value - (Value : Name_Id) - return Value_Id; + function New_String_Value (Value : Name_Id) return Value_Id; - function New_Value - (Value : Value_Type) - return Value_Id; + function New_Value (Value : Value_Type) return Value_Id; function Value (V : Value_Id) return Value_Type; procedure Set_Value (V : Value_Id; X : Value_Type); @@ -89,19 +78,19 @@ package Ocarina.Backends.ASN1_Values is function Image (Value : Value_Id) return String; function "not" (R : Value_Type) return Value_Type; - function "-" (R : Value_Type) return Value_Type; - function "-" (L, R : Value_Type) return Value_Type; - function "+" (L, R : Value_Type) return Value_Type; + function "-" (R : Value_Type) return Value_Type; + function "-" (L, R : Value_Type) return Value_Type; + function "+" (L, R : Value_Type) return Value_Type; function "mod" (L, R : Value_Type) return Value_Type; - function "/" (L, R : Value_Type) return Value_Type; - function "*" (L, R : Value_Type) return Value_Type; + function "/" (L, R : Value_Type) return Value_Type; + function "*" (L, R : Value_Type) return Value_Type; function "and" (L, R : Value_Type) return Value_Type; - function "or" (L, R : Value_Type) return Value_Type; + function "or" (L, R : Value_Type) return Value_Type; function "xor" (L, R : Value_Type) return Value_Type; - function Shift_Left (L, R : Value_Type) return Value_Type; + function Shift_Left (L, R : Value_Type) return Value_Type; function Shift_Right (L, R : Value_Type) return Value_Type; - function "<" (L, R : Value_Type) return Boolean; + function "<" (L, R : Value_Type) return Boolean; -- Assume L and R have the same type. procedure Reset; @@ -112,6 +101,6 @@ package Ocarina.Backends.ASN1_Values is private Bad_Value : constant Value_Type := Value_Type'((K => K_Node_Id)); - No_Value : constant Value_Id := 0; + No_Value : constant Value_Id := 0; end Ocarina.Backends.ASN1_Values; diff --git a/src/backends/ocarina-backends-boundt.adb b/src/backends/ocarina-backends-boundt.adb index ea5c7984..4c25aae6 100644 --- a/src/backends/ocarina-backends-boundt.adb +++ b/src/backends/ocarina-backends-boundt.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -37,12 +37,12 @@ with Ocarina.ME_AADL; with Ocarina.ME_AADL.AADL_Instances.Nodes; with Ocarina.ME_AADL.AADL_Tree.Nodes; with Ocarina.ME_AADL.AADL_Instances.Nutils; -with Ocarina.Instances; use Ocarina.Instances; +with Ocarina.Instances; use Ocarina.Instances; with Ocarina.ME_AADL.AADL_Instances.Entities; with Ocarina.Backends.Properties; use Ocarina.Backends.Properties; -with Ocarina.Options; use Ocarina.Options; +with Ocarina.Options; use Ocarina.Options; with GNAT.Command_Line; -with Utils; use Utils; +with Utils; use Utils; with Ada.Text_IO; with GNAT.IO_Aux; @@ -111,19 +111,19 @@ package body Ocarina.Backends.BoundT is procedure Visit_Component_Instance (E : Node_Id) is use Ocarina.ME_AADL.AADL_Instances.Entities; - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => Visit_System_Instance (E); when CC_Process => - if Boundt_Process = No_Name or else - To_Lower - (AIN.Name - (AIN.Identifier - (AIN.Parent_Subcomponent (E)))) = Boundt_Process then + if Boundt_Process = No_Name + or else + To_Lower + (AIN.Name (AIN.Identifier (AIN.Parent_Subcomponent (E)))) = + Boundt_Process + then Visit_Process_Instance (E); end if; @@ -141,18 +141,20 @@ package body Ocarina.Backends.BoundT is procedure Visit_Thread_Instance (E : Node_Id) is Raw_Name : constant String := - String'(Get_Name_String (P_Model_Name) & "_" & - Get_Name_String (Current_Thread_Instance)); + String' + (Get_Name_String (P_Model_Name) & + "_" & + Get_Name_String (Current_Thread_Instance)); Base_Name : constant String := - String'("polyorb_hi_generated__activity__" & - Get_Name_String (Current_Thread_Instance)); - Procedure_Name : constant String := - String'(Base_Name & "_job"); + String' + ("polyorb_hi_generated__activity__" & + Get_Name_String (Current_Thread_Instance)); + Procedure_Name : constant String := String'(Base_Name & "_job"); Assertion_Basis : constant String := String'(Base_Name & "_interrogators"); - Assertion_Send : constant String := + Assertion_Send : constant String := String'(Assertion_Basis & "__send_outputXn"); - Assertion_Get : constant String := + Assertion_Get : constant String := String'(Assertion_Basis & "__get_valueXn"); T_Dispatch_Protocol : Supported_Thread_Dispatch_Protocol; @@ -184,14 +186,12 @@ package body Ocarina.Backends.BoundT is -- PolyORB-HI generates unbounded subprograms - Put_Line (Assertions_FD, "subprogram """ & - Assertion_Send & """"); + Put_Line (Assertions_FD, "subprogram """ & Assertion_Send & """"); Put_Line (Assertions_FD, " time 0 cycles;"); Put_Line (Assertions_FD, "end;"); Put_Line (Assertions_FD, ""); - Put_Line (Assertions_FD, "subprogram """ & - Assertion_Get & """"); + Put_Line (Assertions_FD, "subprogram """ & Assertion_Get & """"); Put_Line (Assertions_FD, " time 0 cycles;"); Put_Line (Assertions_FD, "end;"); Put_Line (Assertions_FD, ""); @@ -204,10 +204,12 @@ package body Ocarina.Backends.BoundT is Modes_Nb := Int (Length (Modes (E))); - Put_Line (Assertions_FD, "subprogram """ & - Procedure_Name & """"); - Put_Line (Assertions_FD, " all loops repeats " & - Int'Image (Modes_Nb) & " times; end loops;"); + Put_Line (Assertions_FD, "subprogram """ & Procedure_Name & """"); + Put_Line + (Assertions_FD, + " all loops repeats " & + Int'Image (Modes_Nb) & + " times; end loops;"); Put_Line (Assertions_FD, "end;"); Put_Line (Assertions_FD, ""); end if; @@ -221,13 +223,12 @@ package body Ocarina.Backends.BoundT is procedure Visit_Process_Instance (E : Node_Id) is T : Node_Id; begin - P_Model_Name := ATN.Name - (ATN.Identifier - (Corresponding_Declaration - (Parent_Subcomponent (E)))); + P_Model_Name := + ATN.Name + (ATN.Identifier + (Corresponding_Declaration (Parent_Subcomponent (E)))); - Put_Line (FD, "program " & - Get_Name_String (P_Model_Name)); + Put_Line (FD, "program " & Get_Name_String (P_Model_Name)); -- Then we parse all threads which are subcomponent -- of the process @@ -237,23 +238,24 @@ package body Ocarina.Backends.BoundT is case AADL_Version is when AADL_V1 => - Current_Thread_Instance := ATN.Name - (ATN.Identifier - (Corresponding_Declaration (T))); + Current_Thread_Instance := + ATN.Name (ATN.Identifier (Corresponding_Declaration (T))); when AADL_V2 => - Current_Thread_Instance := Get_String_Name - (Get_Name_String (To_Lower - (AIN.Name - (AIN.Identifier - (AIN.Namespace - (AIN.Corresponding_Instance (T)))))) - & "_" & - Get_Name_String (ATN.Name - (ATN.Identifier - (Corresponding_Declaration (T))))); + Current_Thread_Instance := + Get_String_Name + (Get_Name_String + (To_Lower + (AIN.Name + (AIN.Identifier + (AIN.Namespace + (AIN.Corresponding_Instance (T)))))) & + "_" & + Get_Name_String + (ATN.Name + (ATN.Identifier (Corresponding_Declaration (T))))); end case; - Visit (Corresponding_Instance (T)); + Visit (Corresponding_Instance (T)); T := Next_Node (T); end loop; @@ -271,7 +273,7 @@ package body Ocarina.Backends.BoundT is -- Visit all the subcomponents of the system if not Ocarina.ME_AADL.AADL_Instances.Nutils.Is_Empty - (Subcomponents (E)) + (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop @@ -333,23 +335,23 @@ package body Ocarina.Backends.BoundT is if Boundt_Process = No_Name then Create (File => FD, Name => "scenario.tpo"); else - Create (File => FD, - Name => "scenario_" & - Get_Name_String (Boundt_Process) & ".tpo"); + Create + (File => FD, + Name => "scenario_" & Get_Name_String (Boundt_Process) & ".tpo"); end if; -- Open the assertion template file if not GNAT.IO_Aux.File_Exists ("assertions.txt") then Display_Error ("No assertion file found, create a new one", - Fatal => False, + Fatal => False, Warning => True); - Create (File => Assertions_FD, - Name => "assertions.txt"); + Create (File => Assertions_FD, Name => "assertions.txt"); else - Open (File => Assertions_FD, - Mode => Append_File, - Name => "assertions.txt"); + Open + (File => Assertions_FD, + Mode => Append_File, + Name => "assertions.txt"); end if; Put_Line (Assertions_FD, ""); @@ -373,7 +375,7 @@ package body Ocarina.Backends.BoundT is procedure Reset is begin - P_Model_Name := No_Name; + P_Model_Name := No_Name; Current_Thread_Instance := No_Name; end Reset; diff --git a/src/backends/ocarina-backends-build_utils.adb b/src/backends/ocarina-backends-build_utils.adb index 5c76f0a1..9579921a 100644 --- a/src/backends/ocarina-backends-build_utils.adb +++ b/src/backends/ocarina-backends-build_utils.adb @@ -45,9 +45,9 @@ with Utils; use Utils; with Ocarina.ME_AADL; with Ocarina.ME_AADL.AADL_Instances.Nodes; with Ocarina.ME_AADL.AADL_Instances.Nutils; -with Ocarina.Options; use Ocarina.Options; +with Ocarina.Options; use Ocarina.Options; with Ocarina.ME_AADL.AADL_Instances.Entities; -with Ocarina.Backends; use Ocarina.Backends; +with Ocarina.Backends; use Ocarina.Backends; with Ocarina.Backends.Utils; with Ocarina.Backends.Messages; with Ocarina.Backends.Ada_Tree.Nutils; @@ -165,10 +165,10 @@ package body Ocarina.Backends.Build_Utils is Get_Name_String (Directory); end if; declare - Normalized_Dir : constant String - := Normalize_Pathname (Name_Buffer (1 .. Name_Len)); - Resolved_Filename : constant String - := Normalize_Pathname (Get_Name_String (Filename), Normalized_Dir); + Normalized_Dir : constant String := + Normalize_Pathname (Name_Buffer (1 .. Name_Len)); + Resolved_Filename : constant String := + Normalize_Pathname (Get_Name_String (Filename), Normalized_Dir); begin Dirname := Get_String_Name (Dir_Name (Resolved_Filename)); Basename := Get_String_Name (Base_Name (Resolved_Filename)); @@ -217,11 +217,11 @@ package body Ocarina.Backends.Build_Utils is function Get (P : Node_Id) return Build_Util is I_Name : constant Name_Id := Get_Internal_Name (P); - Index : constant Nat := Get_Name_Table_Info (I_Name); + Index : constant Nat := Get_Name_Table_Info (I_Name); begin if Index = 0 then - raise Program_Error with "Try to get a build utils which has" - & " not been set"; + raise Program_Error + with "Try to get a build utils which has" & " not been set"; end if; return Internal_Table.Table (Index); @@ -287,60 +287,61 @@ package body Ocarina.Backends.Build_Utils is package body Makefiles is procedure Visit_Architecture_Instance (E : Node_Id); - procedure Visit_Component_Instance (E : Node_Id); - procedure Visit_System_Instance (E : Node_Id); - procedure Visit_Process_Instance (E : Node_Id); - procedure Visit_Thread_Instance (E : Node_Id); + procedure Visit_Component_Instance (E : Node_Id); + procedure Visit_System_Instance (E : Node_Id); + procedure Visit_Process_Instance (E : Node_Id); + procedure Visit_Thread_Instance (E : Node_Id); procedure Visit_Subprogram_Instance - (E : Node_Id; Force_Parent : Node_Id := No_Node); - procedure Visit_Port_Instance (E : Node_Id); - procedure Visit_Bus_Instance (E : Node_Id); - procedure Visit_Virtual_Bus_Instance (E : Node_Id); - procedure Visit_Data_Instance (E : Node_Id); - procedure Visit_Abstract_Instance (E : Node_Id); + (E : Node_Id; + Force_Parent : Node_Id := No_Node); + procedure Visit_Port_Instance (E : Node_Id); + procedure Visit_Bus_Instance (E : Node_Id); + procedure Visit_Virtual_Bus_Instance (E : Node_Id); + procedure Visit_Data_Instance (E : Node_Id); + procedure Visit_Abstract_Instance (E : Node_Id); procedure Build_Architecture_Instance (E : Node_Id); - procedure Build_Component_Instance (E : Node_Id); - procedure Build_System_Instance (E : Node_Id); - procedure Build_Process_Instance (E : Node_Id); + procedure Build_Component_Instance (E : Node_Id); + procedure Build_System_Instance (E : Node_Id); + procedure Build_Process_Instance (E : Node_Id); procedure Clean_Architecture_Instance (E : Node_Id); - procedure Clean_Component_Instance (E : Node_Id); - procedure Clean_System_Instance (E : Node_Id); + procedure Clean_Component_Instance (E : Node_Id); + procedure Clean_System_Instance (E : Node_Id); Current_Process : Node_Id := No_Node; type Makefile_Rec is record - Appli_Name : Name_Id; + Appli_Name : Name_Id; -- The distributed application name - Node_Name : Name_Id; + Node_Name : Name_Id; -- The node name (in lower case) Execution_Platform : Supported_Execution_Platform := Platform_None; - Execution_Platform_Name : Name_Id := No_Name; + Execution_Platform_Name : Name_Id := No_Name; -- The execution platform of the processor the current node -- is bound to. - Transport_API : Supported_Transport_APIs; + Transport_API : Supported_Transport_APIs; -- The transport API used by the current node to -- communicate with other nodes. - C_Objs : Name_Tables.Instance; + C_Objs : Name_Tables.Instance; - Ada_Sources : Name_Tables.Instance; + Ada_Sources : Name_Tables.Instance; - Asn_Sources : Name_Tables.Instance; + Asn_Sources : Name_Tables.Instance; - C_Sources : Name_Tables.Instance; + C_Sources : Name_Tables.Instance; -- The C source files that may implement some subprograms of -- the current node (absolute or relative path). - CPP_Sources : Name_Tables.Instance; + CPP_Sources : Name_Tables.Instance; -- The C source files that may implement some subprograms of -- the current node (absolute or relative path). - C_Libraries : Name_Tables.Instance; + C_Libraries : Name_Tables.Instance; -- The C libraries that may contain the binary code of some -- subprograms of the current node (absolute or relative -- path). @@ -359,19 +360,19 @@ package body Ocarina.Backends.Build_Utils is -- The Simulink_Directory corresponds to the directory -- that contains the simulink application code. - Simulink_Node : Name_Id; + Simulink_Node : Name_Id; -- The Simulink_Node is the name of the node we try to -- integrate in our AADL model. - Use_Simulink : Boolean; + Use_Simulink : Boolean; -- Use_Simulink states if we integrate simulink application -- code or not. - Scade_Directory : Name_Id; + Scade_Directory : Name_Id; -- The Scade_Directory is the name of the directory that contains -- Scade source code. - Use_Scade : Boolean; + Use_Scade : Boolean; -- The Use_Scade variable tells the build-system if we try -- to integrate SCADE application code in our generated -- system. @@ -387,10 +388,10 @@ package body Ocarina.Backends.Build_Utils is -- Deallocates the internals of T procedure Ada_C_Command_Line_Flags - (Ada_Sources : Name_Tables.Instance; - C_Sources : Name_Tables.Instance; - CPP_Sources : Name_Tables.Instance; - C_Libraries : Name_Tables.Instance); + (Ada_Sources : Name_Tables.Instance; + C_Sources : Name_Tables.Instance; + CPP_Sources : Name_Tables.Instance; + C_Libraries : Name_Tables.Instance); procedure Compile_Ada_Files (Ada_Sources : Name_Tables.Instance); procedure Compile_C_Files (C_Sources : Name_Tables.Instance); @@ -435,7 +436,8 @@ package body Ocarina.Backends.Build_Utils is procedure Free (M : in out Makefile_Type) is procedure Deallocate is new Ada.Unchecked_Deallocation - (Makefile_Rec, Makefile_Type); + (Makefile_Rec, + Makefile_Type); begin Name_Tables.Free (M.all.Ada_Sources); Name_Tables.Free (M.all.Asn_Sources); @@ -448,7 +450,9 @@ package body Ocarina.Backends.Build_Utils is end Free; package Makefiles is new Generic_List - (Makefile_Type, "Makefile_List", Free); + (Makefile_Type, + "Makefile_List", + Free); -- The list of all the makefile structures ----------- @@ -565,9 +569,7 @@ package body Ocarina.Backends.Build_Utils is Get_Name_String_And_Append (M.Node_Name); if Get_Name_Table_Byte (Name_Find) = 0 then - Name_Tables.Append - (M.User_Source_Dirs, - Source_Dirname); + Name_Tables.Append (M.User_Source_Dirs, Source_Dirname); Set_Name_Table_Byte (Name_Find, 1); end if; @@ -603,12 +605,12 @@ package body Ocarina.Backends.Build_Utils is -- Library names MUST begin with "lib" if Name_Buffer (Name_Len - 1 .. Name_Len) = ".a" - and then (Name_Len <= 5 - or else Name_Buffer (1 .. 3) /= "lib") + and then + (Name_Len <= 5 or else Name_Buffer (1 .. 3) /= "lib") then Display_Error - ("Invalid library name" - & Name_Buffer (1 .. Name_Len), + ("Invalid library name" & + Name_Buffer (1 .. Name_Len), Fatal => True); end if; @@ -700,9 +702,7 @@ package body Ocarina.Backends.Build_Utils is Get_Name_String_And_Append (M.Node_Name); if Get_Name_Table_Byte (Name_Find) = 0 then - Name_Tables.Append - (M.User_Source_Dirs, - Source_Dirname); + Name_Tables.Append (M.User_Source_Dirs, Source_Dirname); Set_Name_Table_Byte (Name_Find, 1); end if; @@ -803,8 +803,8 @@ package body Ocarina.Backends.Build_Utils is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := + Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -886,17 +886,15 @@ package body Ocarina.Backends.Build_Utils is ------------------------- procedure Visit_Data_Instance (E : Node_Id) is - Source : Name_Id; - Sources : constant Name_Array := Get_Source_Text (E); - M : constant Makefile_Type := - Makefiles.Get (Current_Process); + Source : Name_Id; + Sources : constant Name_Array := Get_Source_Text (E); + M : constant Makefile_Type := Makefiles.Get (Current_Process); begin - if Get_Source_Language (E) = Language_ASN1 and then - Sources'Length /= 0 then + if Get_Source_Language (E) = Language_ASN1 + and then Sources'Length /= 0 + then Source := Sources (1); - Name_Tables.Append - (M.Asn_Sources, - Source); + Name_Tables.Append (M.Asn_Sources, Source); end if; end Visit_Data_Instance; @@ -929,18 +927,18 @@ package body Ocarina.Backends.Build_Utils is ---------------------------- procedure Visit_Process_Instance (E : Node_Id) is - C : Node_Id; - S : constant Node_Id := Parent_Subcomponent (E); - A : constant Node_Id := Parent_Component (Parent_Subcomponent (E)); - M : constant Makefile_Type := new Makefile_Rec; - SC : Node_Id; + C : Node_Id; + S : constant Node_Id := Parent_Subcomponent (E); + A : constant Node_Id := Parent_Component (Parent_Subcomponent (E)); + M : constant Makefile_Type := new Makefile_Rec; + SC : Node_Id; Current_Device : Node_Id; Feature : Node_Id; Parent : Node_Id; Src : Node_Id; Dst : Node_Id; - The_System : constant Node_Id := Parent_Component - (Parent_Subcomponent (E)); + The_System : constant Node_Id := + Parent_Component (Parent_Subcomponent (E)); begin -- Associates the Makefile structure to the process -- instance. Keep in mind that it is important to use @@ -952,8 +950,8 @@ package body Ocarina.Backends.Build_Utils is Makefiles.Set (E, M); - M.Appli_Name := Normalize_Name (Name (Identifier (A))); - M.Node_Name := Normalize_Name (Name (Identifier (S))); + M.Appli_Name := Normalize_Name (Name (Identifier (A))); + M.Node_Name := Normalize_Name (Name (Identifier (S))); M.Use_Transport := False; M.Use_Simulink := False; M.Use_Scade := False; @@ -961,10 +959,10 @@ package body Ocarina.Backends.Build_Utils is -- Get the execution platform of the processor this node is -- bound to. - M.Execution_Platform := Get_Execution_Platform - (Get_Bound_Processor (E)); - M.Execution_Platform_Name := Get_Execution_Platform - (Get_Bound_Processor (E)); + M.Execution_Platform := + Get_Execution_Platform (Get_Bound_Processor (E)); + M.Execution_Platform_Name := + Get_Execution_Platform (Get_Bound_Processor (E)); -- Get the transport API used by this node. It is -- important to ensure that the Namings package visitors @@ -1009,14 +1007,13 @@ package body Ocarina.Backends.Build_Utils is Parent := Parent_Component (Item (Src)); - if AAU.Is_Process (Parent) - and then Parent /= E - then - if Get_Provided_Virtual_Bus_Class - (Extra_Item (Src)) /= No_Node then + if AAU.Is_Process (Parent) and then Parent /= E then + if Get_Provided_Virtual_Bus_Class (Extra_Item (Src)) /= + No_Node + then Visit - (Get_Provided_Virtual_Bus_Class - (Extra_Item (Src))); + (Get_Provided_Virtual_Bus_Class + (Extra_Item (Src))); end if; end if; @@ -1032,14 +1029,13 @@ package body Ocarina.Backends.Build_Utils is while Present (Dst) loop Parent := Parent_Component (Item (Dst)); - if AAU.Is_Process (Parent) - and then Parent /= E - then - if Get_Provided_Virtual_Bus_Class - (Extra_Item (Dst)) /= No_Node then + if AAU.Is_Process (Parent) and then Parent /= E then + if Get_Provided_Virtual_Bus_Class (Extra_Item (Dst)) /= + No_Node + then Visit - (Get_Provided_Virtual_Bus_Class - (Extra_Item (Dst))); + (Get_Provided_Virtual_Bus_Class + (Extra_Item (Dst))); end if; end if; @@ -1059,13 +1055,13 @@ package body Ocarina.Backends.Build_Utils is C := First_Node (Subcomponents (The_System)); while Present (C) loop if AAU.Is_Device (Corresponding_Instance (C)) then - Current_Device := Corresponding_Instance (C); + Current_Device := Corresponding_Instance (C); declare - Source_Files : constant Name_Array - := Get_Source_Text (Current_Device); + Source_Files : constant Name_Array := + Get_Source_Text (Current_Device); begin Handle_C_Source - (Parent_Subcomponent (Current_Device), + (Parent_Subcomponent (Current_Device), No_Name, Source_Files, M); @@ -1105,17 +1101,15 @@ package body Ocarina.Backends.Build_Utils is procedure Visit_Thread_Instance (E : Node_Id) is Parent_Process : constant Node_Id := Corresponding_Instance (Get_Container_Process (E)); - M : constant Makefile_Type := - Makefiles.Get (Parent_Process); - Compute_Entrypoint : Name_Id; - Initialize_Entrypoint : constant Name_Id := + M : constant Makefile_Type := Makefiles.Get (Parent_Process); + Compute_Entrypoint : Name_Id; + Initialize_Entrypoint : constant Name_Id := Get_Thread_Initialize_Entrypoint (E); - Language : constant Supported_Source_Language := - Resolve_Language (E); - Source_Files : constant Name_Array := Get_Source_Text (E); - Call_Seq : Node_Id; - Spg_Call : Node_Id; - F : Node_Id; + Language : constant Supported_Source_Language := Resolve_Language (E); + Source_Files : constant Name_Array := Get_Source_Text (E); + Call_Seq : Node_Id; + Spg_Call : Node_Id; + F : Node_Id; begin -- If the thread implementation is in C, we need to update -- the makefile structure. @@ -1173,17 +1167,19 @@ package body Ocarina.Backends.Build_Utils is ------------------------------- procedure Visit_Subprogram_Instance - (E : Node_Id; Force_Parent : Node_Id := No_Node) is + (E : Node_Id; + Force_Parent : Node_Id := No_Node) + is Parent_Process : Node_Id; M : Makefile_Type; Subprogram_Kind : constant Supported_Subprogram_Kind := Get_Subprogram_Kind (E); - Source_Name : constant Name_Id := Get_Source_Name (E); - Source_Files : constant Name_Array := Get_Source_Text (E); - Call_Seq : Node_Id; - Spg_Call : Node_Id; - Simulink_Dir : Name_Id; - Scade_Dir : Name_Id; + Source_Name : constant Name_Id := Get_Source_Name (E); + Source_Files : constant Name_Array := Get_Source_Text (E); + Call_Seq : Node_Id; + Spg_Call : Node_Id; + Simulink_Dir : Name_Id; + Scade_Dir : Name_Id; begin -- Only C subprogram influence the structure of the -- generated makefile. @@ -1191,8 +1187,7 @@ package body Ocarina.Backends.Build_Utils is Parent_Process := Force_Parent; else Parent_Process := - Corresponding_Instance - (Get_Container_Process (E)); + Corresponding_Instance (Get_Container_Process (E)); end if; M := Makefiles.Get (Parent_Process); @@ -1224,8 +1219,8 @@ package body Ocarina.Backends.Build_Utils is Handle_Ada_Source (E, Source_Name, Source_Files, M); when Subprogram_Scade => - Scade_Dir := Source_Files (1); - M.Use_Scade := True; + Scade_Dir := Source_Files (1); + M.Use_Scade := True; M.Scade_Directory := Scade_Dir; when Subprogram_Simulink => @@ -1275,17 +1270,15 @@ package body Ocarina.Backends.Build_Utils is ------------------------- procedure Visit_Port_Instance (E : Node_Id) is - Parent_Process : constant Node_Id := Corresponding_Instance - (Get_Container_Process - (Parent_Component (E))); - M : constant Makefile_Type := Makefiles.Get - (Parent_Process); - Language : constant Supported_Source_Language := - Resolve_Language (E); - Compute_Entrypoint : constant Name_Id := + Parent_Process : constant Node_Id := + Corresponding_Instance + (Get_Container_Process (Parent_Component (E))); + M : constant Makefile_Type := Makefiles.Get (Parent_Process); + Language : constant Supported_Source_Language := Resolve_Language (E); + Compute_Entrypoint : constant Name_Id := Get_Port_Compute_Entrypoint (E); - Source_Files : constant Name_Array := Get_Source_Text (E); - Data : Node_Id; + Source_Files : constant Name_Array := Get_Source_Text (E); + Data : Node_Id; begin -- If the port implementation is in C, we need to update -- the makefile structure. @@ -1309,7 +1302,7 @@ package body Ocarina.Backends.Build_Utils is end if; if Get_Source_Name (Data) /= No_Name then - M.Simulink_Node := Get_Source_Name (Data); + M.Simulink_Node := Get_Source_Name (Data); end if; end; elsif Get_Source_Language (Data) = Language_ASN1 then @@ -1317,22 +1310,19 @@ package body Ocarina.Backends.Build_Utils is Source_Text : constant Name_Array := Get_Source_Text (Data); begin if Get_Name_Table_Byte (Name_Find) = 0 then - Name_Tables.Append - (M.Asn_Sources, - Source_Text (1)); + Name_Tables.Append (M.Asn_Sources, Source_Text (1)); Set_Name_Table_Byte (Source_Text (1), 1); end if; if Get_Source_Name (Data) /= No_Name then - M.Simulink_Node := Get_Source_Name (Data); + M.Simulink_Node := Get_Source_Name (Data); end if; end; else declare - Source_Name : constant Name_Id - := Get_Type_Source_Name (Data); - Source_Files : constant Name_Array - := Get_Source_Text (Data); + Source_Name : constant Name_Id := + Get_Type_Source_Name (Data); + Source_Files : constant Name_Array := Get_Source_Text (Data); begin Handle_C_Source (E, Source_Name, Source_Files, M); end; @@ -1348,10 +1338,10 @@ package body Ocarina.Backends.Build_Utils is procedure Generate (E : Node_Id) is procedure Generate_Architecture_Instance (E : Node_Id); - procedure Generate_Component_Instance (E : Node_Id); - procedure Generate_System_Instance (E : Node_Id); - procedure Generate_Process_Instance (E : Node_Id); - procedure Generate_Processor_Instance (E : Node_Id); + procedure Generate_Component_Instance (E : Node_Id); + procedure Generate_System_Instance (E : Node_Id); + procedure Generate_Process_Instance (E : Node_Id); + procedure Generate_Processor_Instance (E : Node_Id); ------------------------------------ -- Generate_Architecture_Instance -- @@ -1367,8 +1357,8 @@ package body Ocarina.Backends.Build_Utils is --------------------------------- procedure Generate_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := + Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -1390,10 +1380,10 @@ package body Ocarina.Backends.Build_Utils is ------------------------------ procedure Generate_System_Instance (E : Node_Id) is - Dir_Name : constant Name_Id - := Normalize_Name (Name (Identifier (E))); + Dir_Name : constant Name_Id := + Normalize_Name (Name (Identifier (E))); - S : Node_Id; + S : Node_Id; Fd : File_Descriptor; begin @@ -1432,9 +1422,7 @@ package body Ocarina.Backends.Build_Utils is while Present (S) loop if AAU.Is_Process (Corresponding_Instance (S)) then - Write_Name - (Normalize_Name - (Name (Identifier (S)))); + Write_Name (Normalize_Name (Name (Identifier (S)))); Write_Str (" "); -- Corresponding_Instance (S))))); @@ -1446,13 +1434,14 @@ package body Ocarina.Backends.Build_Utils is Write_Line ("all:"); Write_Line - (ASCII.HT - & "set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d ; done"); + (ASCII.HT & + "set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d ; done"); Write_Line ("clean:"); Write_Line - (ASCII.HT & " set -e; for d in $(SUBDIRS); do $(MAKE) " - & "clean -C $$d ; done"); + (ASCII.HT & + " set -e; for d in $(SUBDIRS); do $(MAKE) " & + "clean -C $$d ; done"); -- Close the file @@ -1522,16 +1511,15 @@ package body Ocarina.Backends.Build_Utils is end if; Write_Eol; - Write_Line ("# Transport API : " - & M.Transport_API'Img); + Write_Line + ("# Transport API : " & M.Transport_API'Img); Write_Eol; if Get_Current_Backend_Kind = PolyORB_HI_C then Write_Str ("USER_OBJS = "); if Length (M.C_Objs) > 0 then - for J in - Name_Tables.First .. Name_Tables.Last (M.C_Objs) + for J in Name_Tables.First .. Name_Tables.Last (M.C_Objs) loop Write_Name (M.C_Objs.Table (J)); exit when J = Name_Tables.Last (M.C_Objs); @@ -1543,7 +1531,10 @@ package body Ocarina.Backends.Build_Utils is end if; Ada_C_Command_Line_Flags - (M.Ada_Sources, M.C_Sources, M.CPP_Sources, M.C_Libraries); + (M.Ada_Sources, + M.C_Sources, + M.CPP_Sources, + M.C_Libraries); if Length (M.Ada_Sources) > 0 then Write_Line ("USER_LD=gnatlink `cat ali_file`"); @@ -1551,7 +1542,10 @@ package body Ocarina.Backends.Build_Utils is else Write_Str ("C_OBJECTS="); Ada_C_Command_Line_Flags - (M.Ada_Sources, M.C_Sources, M.CPP_Sources, M.C_Libraries); + (M.Ada_Sources, + M.C_Sources, + M.CPP_Sources, + M.C_Libraries); end if; Write_Eol; @@ -1586,9 +1580,10 @@ package body Ocarina.Backends.Build_Utils is Write_Eol; Write_Line ("prove:"); - Write_Line (ASCII.HT - & "gnatprove -P$(PROJECT_FILE) --warnings=continue " - & "--report=fail"); + Write_Line + (ASCII.HT & + "gnatprove -P$(PROJECT_FILE) --warnings=continue " & + "--report=fail"); -- Close the file @@ -1606,10 +1601,10 @@ package body Ocarina.Backends.Build_Utils is --------------------------------- procedure Generate_Processor_Instance (E : Node_Id) is - Fd : File_Descriptor; - S : Node_Id; - The_System : Node_Id; - PID : Unsigned_Long_Long := 0; + Fd : File_Descriptor; + S : Node_Id; + The_System : Node_Id; + PID : Unsigned_Long_Long := 0; begin -- The following part is very specific to PolyORB-HI-C and especially @@ -1629,20 +1624,19 @@ package body Ocarina.Backends.Build_Utils is -- Enter the directories Enter_Directory - (To_Lower - (Normalize_Name - (Display_Name - (Identifier (The_System))))); + (To_Lower + (Normalize_Name (Display_Name (Identifier (The_System))))); -- Create the file - Fd := Create_File - ("Makefile." & - Get_Name_String - (To_Lower (Normalize_Name - (Display_Name - (Identifier (The_System))))), - Text); + Fd := + Create_File + ("Makefile." & + Get_Name_String + (To_Lower + (Normalize_Name + (Display_Name (Identifier (The_System))))), + Text); if Fd = Invalid_FD then raise Program_Error; @@ -1671,9 +1665,8 @@ package body Ocarina.Backends.Build_Utils is Write_Str ("MAINAPP="); Write_Name - (To_Lower (Normalize_Name - (Display_Name - (Identifier (The_System))))); + (To_Lower + (Normalize_Name (Display_Name (Identifier (The_System))))); Write_Eol; Write_Str ("PARTITIONS_NAME="); @@ -1685,9 +1678,8 @@ package body Ocarina.Backends.Build_Utils is while Present (S) loop if AAU.Is_Process (Corresponding_Instance (S)) then Write_Name - (To_Lower - (Normalize_Name - (Display_Name (Identifier (S))))); + (To_Lower + (Normalize_Name (Display_Name (Identifier (S))))); Write_Space; end if; S := Next_Node (S); @@ -1705,13 +1697,12 @@ package body Ocarina.Backends.Build_Utils is while Present (S) loop if AAU.Is_Process (Corresponding_Instance (S)) then Write_Name - (To_Lower - (Normalize_Name (Display_Name (Identifier (S))))); + (To_Lower + (Normalize_Name (Display_Name (Identifier (S))))); Write_Str ("/"); Write_Name - (To_Lower - (Normalize_Name - (Display_Name (Identifier (S))))); + (To_Lower + (Normalize_Name (Display_Name (Identifier (S))))); Write_Str (".xef"); Write_Space; end if; @@ -1735,14 +1726,12 @@ package body Ocarina.Backends.Build_Utils is Write_Str (Unsigned_Long_Long'Image (PID)); Write_Str (":"); Write_Name - (To_Lower - (Normalize_Name - (Display_Name (Identifier (S))))); + (To_Lower + (Normalize_Name (Display_Name (Identifier (S))))); Write_Str ("/"); Write_Name - (To_Lower - (Normalize_Name - (Display_Name (Identifier (S))))); + (To_Lower + (Normalize_Name (Display_Name (Identifier (S))))); Write_Str (".xef"); Write_Space; PID := PID + 1; @@ -1767,7 +1756,7 @@ package body Ocarina.Backends.Build_Utils is Leave_Directory; end Generate_Processor_Instance; - -- Main part of Generate begins here + -- Main part of Generate begins here begin case Kind (E) is @@ -1787,10 +1776,11 @@ package body Ocarina.Backends.Build_Utils is ------------------------------ procedure Ada_C_Command_Line_Flags - (Ada_Sources : Name_Tables.Instance; - C_Sources : Name_Tables.Instance; - CPP_Sources : Name_Tables.Instance; - C_Libraries : Name_Tables.Instance) is + (Ada_Sources : Name_Tables.Instance; + C_Sources : Name_Tables.Instance; + CPP_Sources : Name_Tables.Instance; + C_Libraries : Name_Tables.Instance) + is begin if Length (Ada_Sources) > 0 or else Length (C_Sources) > 0 @@ -1863,9 +1853,9 @@ package body Ocarina.Backends.Build_Utils is declare Is_Object : constant Boolean := Name_Buffer (Name_Len) = 'o'; - Dirname : constant String := Dir_Name - (Name_Buffer (1 .. Name_Len)); - Basename : constant String := + Dirname : constant String := + Dir_Name (Name_Buffer (1 .. Name_Len)); + Basename : constant String := Base_Name (Name_Buffer (1 .. Name_Len)); begin if Is_Object then @@ -1902,7 +1892,7 @@ package body Ocarina.Backends.Build_Utils is for J in Name_Tables.First .. Name_Tables.Last (C_Sources) loop declare - O_File : Name_Id; + O_File : Name_Id; Include_Dir : Name_Id; begin Get_Name_String (C_Sources.Table (J)); @@ -1913,14 +1903,13 @@ package body Ocarina.Backends.Build_Utils is Get_Name_String (C_Sources.Table (J)); while (Name_Buffer (Name_Len) /= Directory_Separator) - and then - Name_Len > 0 loop + and then Name_Len > 0 + loop Name_Len := Name_Len - 1; end loop; if Name_Len > 0 then - Set_Str_To_Name_Buffer - (Name_Buffer (1 .. Name_Len)); + Set_Str_To_Name_Buffer (Name_Buffer (1 .. Name_Len)); Include_Dir := Name_Find; else Include_Dir := No_Name; @@ -1957,7 +1946,7 @@ package body Ocarina.Backends.Build_Utils is for J in Name_Tables.First .. Name_Tables.Last (CPP_Sources) loop declare - O_File : Name_Id; + O_File : Name_Id; Include_Dir : Name_Id; begin Get_Name_String (CPP_Sources.Table (J)); @@ -1968,14 +1957,13 @@ package body Ocarina.Backends.Build_Utils is Get_Name_String (CPP_Sources.Table (J)); while (Name_Buffer (Name_Len) /= Directory_Separator) - and then - Name_Len > 0 loop + and then Name_Len > 0 + loop Name_Len := Name_Len - 1; end loop; if Name_Len > 0 then - Set_Str_To_Name_Buffer - (Name_Buffer (1 .. Name_Len)); + Set_Str_To_Name_Buffer (Name_Buffer (1 .. Name_Len)); Include_Dir := Name_Find; else Include_Dir := No_Name; @@ -2011,7 +1999,7 @@ package body Ocarina.Backends.Build_Utils is if Length (Ada_Sources) > 0 then for J in Name_Tables.First .. Name_Tables.Last (Ada_Sources) loop declare - O_File : Name_Id; + O_File : Name_Id; Ali_File : Name_Id; begin Get_Name_String (Ada_Sources.Table (J)); @@ -2077,8 +2065,8 @@ package body Ocarina.Backends.Build_Utils is ------------------------------ procedure Build_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := + Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -2118,7 +2106,7 @@ package body Ocarina.Backends.Build_Utils is procedure Build_Process_Instance (E : Node_Id) is M : constant Makefile_Type := Makefiles.Get (E); Pid : Process_Id; - Out_Pid : Process_Id := Invalid_Pid; + Out_Pid : Process_Id := Invalid_Pid; Success : Boolean; Args : Argument_List (1 .. 1); begin @@ -2132,17 +2120,18 @@ package body Ocarina.Backends.Build_Utils is declare Build_Kind : String_Access := Getenv ("BUILD"); - GNU_Make_Path : String_Access := Locate_Exec_On_Path - (GNU_Make_Cmd); + GNU_Make_Path : String_Access := + Locate_Exec_On_Path (GNU_Make_Cmd); begin Change_If_Empty (String_Ptr (Build_Kind), "Debug"); Args (1) := new String'("BUILD=" & Build_Kind.all); -- Invoke the 'make' command - Pid := Non_Blocking_Spawn - (Program_Name => GNU_Make_Path.all, - Args => Args); + Pid := + Non_Blocking_Spawn + (Program_Name => GNU_Make_Path.all, + Args => Args); -- Wait until the command achieves its execution @@ -2153,12 +2142,14 @@ package body Ocarina.Backends.Build_Utils is if Out_Pid = Pid then if not Success then - Display_Error (GNU_Make_Path.all & " died unexpectedly", - Fatal => True); + Display_Error + (GNU_Make_Path.all & " died unexpectedly", + Fatal => True); else - pragma Debug (Display_Debug_Message - (GNU_Make_Cmd & " terminated normally", - Force => True)); + pragma Debug + (Display_Debug_Message + (GNU_Make_Cmd & " terminated normally", + Force => True)); null; end if; end if; @@ -2209,8 +2200,8 @@ package body Ocarina.Backends.Build_Utils is ------------------------------ procedure Clean_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := + Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -2240,17 +2231,19 @@ package body Ocarina.Backends.Build_Utils is -- nodes. declare - M : constant Makefile_Type := Makefiles.Get - (Corresponding_Instance (S)); + M : constant Makefile_Type := + Makefiles.Get (Corresponding_Instance (S)); begin GNAT.Directory_Operations.Remove_Dir - (Get_Name_String (M.Appli_Name), True); + (Get_Name_String (M.Appli_Name), + True); exception when GNAT.Directory_Operations.Directory_Error => pragma Debug (Display_Debug_Message - (Get_Name_String (M.Appli_Name) & " already clean", - Force => True)); + (Get_Name_String (M.Appli_Name) & + " already clean", + Force => True)); null; end; @@ -2271,29 +2264,30 @@ package body Ocarina.Backends.Build_Utils is package body Ada_Project_Files is procedure Visit_Architecture_Instance (E : Node_Id); - procedure Visit_Component_Instance (E : Node_Id); - procedure Visit_System_Instance (E : Node_Id); - procedure Visit_Process_Instance (E : Node_Id); - procedure Visit_Thread_Instance (E : Node_Id); + procedure Visit_Component_Instance (E : Node_Id); + procedure Visit_System_Instance (E : Node_Id); + procedure Visit_Process_Instance (E : Node_Id); + procedure Visit_Thread_Instance (E : Node_Id); procedure Visit_Subprogram_Instance - (E : Node_Id; Force_Parent : Node_Id := No_Node); - procedure Visit_Port_Instance (E : Node_Id); + (E : Node_Id; + Force_Parent : Node_Id := No_Node); + procedure Visit_Port_Instance (E : Node_Id); type Ada_Project_File_Rec is record - Appli_Name : Name_Id; + Appli_Name : Name_Id; -- The distributed application name - Node_Name : Name_Id; + Node_Name : Name_Id; -- The node name (in lower case) - Is_Server : Boolean; + Is_Server : Boolean; -- True of the process has IN ports Execution_Platform : Supported_Execution_Platform; -- The execution platform of the processor the current node -- is bound to. - Transport_API : Supported_Transport_APIs; + Transport_API : Supported_Transport_APIs; -- The transport API used by the current node to -- communicate with other nodes. @@ -2339,7 +2333,8 @@ package body Ocarina.Backends.Build_Utils is procedure Free (P : in out Ada_Project_File_Type) is procedure Deallocate is new Ada.Unchecked_Deallocation - (Ada_Project_File_Rec, Ada_Project_File_Type); + (Ada_Project_File_Rec, + Ada_Project_File_Type); begin -- Deallocate internal tables @@ -2353,7 +2348,9 @@ package body Ocarina.Backends.Build_Utils is end Free; package Ada_Project_Files is new Generic_List - (Ada_Project_File_Type, "Ada_Project_File_List", Free); + (Ada_Project_File_Type, + "Ada_Project_File_List", + Free); -- The list of all the makefile structures ----------- @@ -2383,8 +2380,8 @@ package body Ocarina.Backends.Build_Utils is Binding_Key : constant String := "%user_src_dir%"; begin if Implem_Name /= No_Name then - Conv_Base_Name := ADU.Conventional_Base_Name - (ADU.Unit_Name (Implem_Name)); + Conv_Base_Name := + ADU.Conventional_Base_Name (ADU.Unit_Name (Implem_Name)); end if; -- Ensure the user gives at most 2 sources files (a spec and @@ -2415,9 +2412,7 @@ package body Ocarina.Backends.Build_Utils is Get_Name_String_And_Append (P.Node_Name); if Get_Name_Table_Byte (Name_Find) = 0 then - Name_Tables.Append - (P.User_Source_Dirs, - Source_Dirname); + Name_Tables.Append (P.User_Source_Dirs, Source_Dirname); Set_Name_Table_Byte (Name_Find, 1); end if; @@ -2437,9 +2432,7 @@ package body Ocarina.Backends.Build_Utils is Get_Name_String_And_Append (P.Node_Name); if Get_Name_Table_Byte (Name_Find) = 0 then - Name_Tables.Append - (P.User_Source_Dirs, - Source_Dirname); + Name_Tables.Append (P.User_Source_Dirs, Source_Dirname); Set_Name_Table_Byte (Name_Find, 1); end if; @@ -2465,25 +2458,23 @@ package body Ocarina.Backends.Build_Utils is -- Add a custom Spec clause Name_Tables.Append - (P.Spec_Names, ADU.Unit_Name (Implem_Name)); - Name_Tables.Append - (P.Custom_Spec_Names, Custom_Name); + (P.Spec_Names, + ADU.Unit_Name (Implem_Name)); + Name_Tables.Append (P.Custom_Spec_Names, Custom_Name); end if; elsif Suffix = ".adb" then if Custom_Name /= Conv_Base_Name then -- Add a custom Body clause Name_Tables.Append - (P.Body_Names, ADU.Unit_Name (Implem_Name)); - Name_Tables.Append - (P.Custom_Body_Names, Custom_Name); + (P.Body_Names, + ADU.Unit_Name (Implem_Name)); + Name_Tables.Append (P.Custom_Body_Names, Custom_Name); end if; else Display_Located_Error (Loc (E), - "Unknown suffix for Ada file name: """ - & Suffix - & """", + "Unknown suffix for Ada file name: """ & Suffix & """", Fatal => True); end if; end loop; @@ -2525,8 +2516,8 @@ package body Ocarina.Backends.Build_Utils is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := + Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -2551,7 +2542,7 @@ package body Ocarina.Backends.Build_Utils is ---------------------------- procedure Visit_Process_Instance (E : Node_Id) is - S : constant Node_Id := Parent_Subcomponent (E); + S : constant Node_Id := Parent_Subcomponent (E); A : constant Node_Id := Parent_Component (Parent_Subcomponent (E)); P : constant Ada_Project_File_Type := new Ada_Project_File_Rec; SC : Node_Id; @@ -2572,8 +2563,8 @@ package body Ocarina.Backends.Build_Utils is -- Get the execution platform of the processor this node is -- bound to. - P.Execution_Platform := Get_Execution_Platform - (Get_Bound_Processor (E)); + P.Execution_Platform := + Get_Execution_Platform (Get_Bound_Processor (E)); -- Get the transport API used by this node. It is -- important to ensure that the Namings package visitors @@ -2634,18 +2625,17 @@ package body Ocarina.Backends.Build_Utils is --------------------------- procedure Visit_Thread_Instance (E : Node_Id) is - Parent_Process : constant Node_Id := + Parent_Process : constant Node_Id := Corresponding_Instance (Get_Container_Process (E)); - P : constant Ada_Project_File_Type := + P : constant Ada_Project_File_Type := Ada_Project_Files.Get (Parent_Process); - Language : constant Supported_Source_Language := - Resolve_Language (E); - Compute_Entrypoint : constant Name_Id := + Language : constant Supported_Source_Language := Resolve_Language (E); + Compute_Entrypoint : constant Name_Id := Get_Thread_Compute_Entrypoint (E); - Source_Files : constant Name_Array := Get_Source_Text (E); - Call_Seq : Node_Id; - Spg_Call : Node_Id; - F : Node_Id; + Source_Files : constant Name_Array := Get_Source_Text (E); + Call_Seq : Node_Id; + Spg_Call : Node_Id; + F : Node_Id; begin -- Only Ada files affect the structure of Ada project files @@ -2697,19 +2687,21 @@ package body Ocarina.Backends.Build_Utils is ------------------------------- procedure Visit_Subprogram_Instance - (E : Node_Id; Force_Parent : Node_Id := No_Node) is + (E : Node_Id; + Force_Parent : Node_Id := No_Node) + is Parent_Process : Node_Id; P : Ada_Project_File_Type; Subprogram_Kind : constant Supported_Subprogram_Kind := Get_Subprogram_Kind (E); - Source_Name : constant Name_Id := Get_Source_Name (E); - Source_Files : constant Name_Array := Get_Source_Text (E); - Call_Seq : Node_Id; - Spg_Call : Node_Id; + Source_Name : constant Name_Id := Get_Source_Name (E); + Source_Files : constant Name_Array := Get_Source_Text (E); + Call_Seq : Node_Id; + Spg_Call : Node_Id; begin if Force_Parent = No_Node then Parent_Process := - Corresponding_Instance (Get_Container_Process (E)); + Corresponding_Instance (Get_Container_Process (E)); else Parent_Process := Force_Parent; end if; @@ -2755,16 +2747,15 @@ package body Ocarina.Backends.Build_Utils is ------------------------- procedure Visit_Port_Instance (E : Node_Id) is - Parent_Process : constant Node_Id := Corresponding_Instance - (Get_Container_Process - (Parent_Component (E))); - P : constant Ada_Project_File_Type := + Parent_Process : constant Node_Id := + Corresponding_Instance + (Get_Container_Process (Parent_Component (E))); + P : constant Ada_Project_File_Type := Ada_Project_Files.Get (Parent_Process); - Language : constant Supported_Source_Language := - Resolve_Language (E); - Compute_Entrypoint : constant Name_Id := + Language : constant Supported_Source_Language := Resolve_Language (E); + Compute_Entrypoint : constant Name_Id := Get_Port_Compute_Entrypoint (E); - Source_Files : constant Name_Array := Get_Source_Text (E); + Source_Files : constant Name_Array := Get_Source_Text (E); begin -- Only Ada files affect the structure of Ada project files @@ -2780,9 +2771,9 @@ package body Ocarina.Backends.Build_Utils is procedure Generate (E : Node_Id) is procedure Generate_Architecture_Instance (E : Node_Id); - procedure Generate_Component_Instance (E : Node_Id); - procedure Generate_System_Instance (E : Node_Id); - procedure Generate_Process_Instance (E : Node_Id); + procedure Generate_Component_Instance (E : Node_Id); + procedure Generate_System_Instance (E : Node_Id); + procedure Generate_Process_Instance (E : Node_Id); ------------------------------------ -- Generate_Architecture_Instance -- @@ -2798,8 +2789,8 @@ package body Ocarina.Backends.Build_Utils is --------------------------------- procedure Generate_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := + Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -2880,10 +2871,9 @@ package body Ocarina.Backends.Build_Utils is Write_Name (P.Node_Name); Write_Eol; - Write_Line ("-- Execution platform : " - & P.Execution_Platform'Img); - Write_Line ("-- Transport API : " - & P.Transport_API'Img); + Write_Line + ("-- Execution platform : " & P.Execution_Platform'Img); + Write_Line ("-- Transport API : " & P.Transport_API'Img); Write_Eol; @@ -2910,7 +2900,7 @@ package body Ocarina.Backends.Build_Utils is Leave_Directory; end Generate_Process_Instance; - -- Main processing part of Generate begins here + -- Main processing part of Generate begins here begin case Kind (E) is diff --git a/src/backends/ocarina-backends-build_utils.ads b/src/backends/ocarina-backends-build_utils.ads index 1df8c758..acbbbb16 100644 --- a/src/backends/ocarina-backends-build_utils.ads +++ b/src/backends/ocarina-backends-build_utils.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -68,22 +68,22 @@ package Ocarina.Backends.Build_Utils is generic with procedure Generate_Runtime_Specific - (Appli_Name : Name_Id; - Node_Name : Name_Id; + (Appli_Name : Name_Id; + Node_Name : Name_Id; Execution_Platform : Supported_Execution_Platform := Platform_None; Execution_Platform_Name : Name_Id; - Transport_API : Supported_Transport_APIs; - Ada_Sources : Name_Tables.Instance; - Asn_Sources : Name_Tables.Instance; - C_Sources : Name_Tables.Instance; - C_Libraries : Name_Tables.Instance; - User_Source_Dirs : Name_Tables.Instance; - Use_Transport : Boolean; - Use_Simulink : Boolean; - Simulink_Directory : Name_Id; - Simulink_Node : Name_Id; - Use_Scade : Boolean; - Scade_Directory : Name_Id); + Transport_API : Supported_Transport_APIs; + Ada_Sources : Name_Tables.Instance; + Asn_Sources : Name_Tables.Instance; + C_Sources : Name_Tables.Instance; + C_Libraries : Name_Tables.Instance; + User_Source_Dirs : Name_Tables.Instance; + Use_Transport : Boolean; + Use_Simulink : Boolean; + Simulink_Directory : Name_Id; + Simulink_Node : Name_Id; + Use_Scade : Boolean; + Scade_Directory : Name_Id); -- Generate the part of the Makefile that is specific to -- the corresponding runtime. diff --git a/src/backends/ocarina-backends-c_common-mapping.adb b/src/backends/ocarina-backends-c_common-mapping.adb index 943e46dc..bb3eabb0 100644 --- a/src/backends/ocarina-backends-c_common-mapping.adb +++ b/src/backends/ocarina-backends-c_common-mapping.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -87,10 +87,10 @@ package body Ocarina.Backends.C_Common.Mapping is --------------------------- procedure Call_Remote_Functions - (Caller_Thread : Node_Id; - Spg_Call : Node_Id; - Declarations : List_Id; - Statements : List_Id) + (Caller_Thread : Node_Id; + Spg_Call : Node_Id; + Declarations : List_Id; + Statements : List_Id) is procedure Check_Connection_Consistency (F : Node_Id); -- Verifies that the feature F is connected to at least one @@ -150,12 +150,11 @@ package body Ocarina.Backends.C_Common.Mapping is -- The container of the subprogram containing F has to be -- necessarily a Thread. - pragma Assert (AINU.Is_Thread - (Parent_Component - (Parent_Sequence - (Parent_Subcomponent - (Parent_Component - (Root_F)))))); + pragma Assert + (AINU.Is_Thread + (Parent_Component + (Parent_Sequence + (Parent_Subcomponent (Parent_Component (Root_F)))))); -- Check the feature consistency @@ -223,35 +222,32 @@ package body Ocarina.Backends.C_Common.Mapping is Profile := New_List (CTN.K_List_Id); -- Add the FROM argument (first argument) - N := Make_Defining_Identifier - (Map_C_Enumerator_Name - (Parent_Subcomponent - (Caller_Thread), - Entity => True)); + N := + Make_Defining_Identifier + (Map_C_Enumerator_Name + (Parent_Subcomponent (Caller_Thread), + Entity => True)); Append_Node_To_List (N, Profile); -- Add the TO argument (second argument) - N := Make_Defining_Identifier - (Map_C_Enumerator_Name - (Parent_Subcomponent - (Get_Container_Thread - (Remote_Spg)), - Entity => True)); + N := + Make_Defining_Identifier + (Map_C_Enumerator_Name + (Parent_Subcomponent (Get_Container_Thread (Remote_Spg)), + Entity => True)); Append_Node_To_List (N, Profile); -- Add the message argument (third argument) - N := Make_Variable_Address - (Make_Defining_Identifier (PN (P_Message))); + N := + Make_Variable_Address + (Make_Defining_Identifier (PN (P_Message))); Append_Node_To_List (N, Profile); -- Create the subprogram call - N := Make_Call_Profile - (Map_Stub_Identifier - (Remote_Spg), - Profile); + N := Make_Call_Profile (Map_Stub_Identifier (Remote_Spg), Profile); Append_Node_To_List (N, Statements); -- Mark the call as being added. The info we associate @@ -263,23 +259,24 @@ package body Ocarina.Backends.C_Common.Mapping is Profile := List_Id (Get_Name_Table_Info (R_Name)); end if; - N := Make_Defining_Identifier - (Map_C_Full_Parameter_Name - (Spg_Call, Param_Value)); + N := + Make_Defining_Identifier + (Map_C_Full_Parameter_Name (Spg_Call, Param_Value)); Append_Node_To_List (N, Profile); end Update_Remote_Calls; - Spg : constant Node_Id := Corresponding_Instance (Spg_Call); - F : Node_Id; + Spg : constant Node_Id := Corresponding_Instance (Spg_Call); + F : Node_Id; begin pragma Assert (AINU.Is_Thread (Caller_Thread)); -- The lists have to be created if Declarations = No_List or else Statements = No_List then - raise Program_Error with "Lists have to be created before any " - & "call to Get_Remote_Subprogram"; + raise Program_Error + with "Lists have to be created before any " & + "call to Get_Remote_Subprogram"; end if; if not AINU.Is_Empty (Features (Spg)) then @@ -317,10 +314,11 @@ package body Ocarina.Backends.C_Common.Mapping is -- the distributed application and generate the source files. if Get_Current_Backend_Kind = PolyORB_Kernel_C then - CTN.Set_Name (D, To_C_Name - (AIN.Name - (AIN.Identifier (Parent_Subcomponent (E))), - Keyword_Check => False)); + CTN.Set_Name + (D, + To_C_Name + (AIN.Name (AIN.Identifier (Parent_Subcomponent (E))), + Keyword_Check => False)); else CTN.Set_Name (D, To_C_Name (AIN.Name (AIN.Identifier (E)))); end if; @@ -335,12 +333,14 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_HI_Node -- ----------------- - function Map_HI_Node (E : Node_Id; Kernel : Boolean := False) - return Node_Id is + function Map_HI_Node + (E : Node_Id; + Kernel : Boolean := False) return Node_Id + is N : constant Node_Id := New_Node (CTN.K_HI_Node); begin pragma Assert - (AINU.Is_Process_Or_Device (E) + (AINU.Is_Process_Or_Device (E) or else AINU.Is_System (E) or else AINU.Is_Processor (E)); @@ -352,12 +352,11 @@ package body Ocarina.Backends.C_Common.Mapping is Set_Str_To_Name_Buffer ("kernel"); CTN.Set_Name (N, Name_Find); else - CTN.Set_Name (N, To_C_Name - (AIN.Name - (AIN.Identifier - (AIN.Parent_Subcomponent - (E))), - Keyword_Check => False)); + CTN.Set_Name + (N, + To_C_Name + (AIN.Name (AIN.Identifier (AIN.Parent_Subcomponent (E))), + Keyword_Check => False)); end if; Set_Units (N, New_List (K_List_Id)); @@ -377,15 +376,16 @@ package body Ocarina.Backends.C_Common.Mapping is ----------------- function Map_HI_Unit (E : Node_Id) return Node_Id is - U : Node_Id; - S : List_Id; - H : List_Id; - N : Node_Id; - P : Node_Id; + U : Node_Id; + S : List_Id; + H : List_Id; + N : Node_Id; + P : Node_Id; begin - pragma Assert (AINU.Is_System (E) - or else AINU.Is_Process_Or_Device (E) - or else AINU.Is_Processor (E)); + pragma Assert + (AINU.Is_System (E) + or else AINU.Is_Process_Or_Device (E) + or else AINU.Is_Processor (E)); U := New_Node (CTN.K_HI_Unit, AIN.Identifier (E)); S := New_List (K_Sources); @@ -855,21 +855,19 @@ package body Ocarina.Backends.C_Common.Mapping is ----------------------------- function Map_Task_Job_Identifier - (E : Node_Id; Prefix_Component : Node_Id := No_Node) - return Node_Id is + (E : Node_Id; + Prefix_Component : Node_Id := No_Node) return Node_Id + is Name : Name_Id; C1 : Name_Id := No_Name; C2 : Name_Id := No_Name; begin if Prefix_Component /= No_Node then Get_Name_String - (To_C_Name - (AIN.Display_Name - (Identifier (Prefix_Component)))); + (To_C_Name (AIN.Display_Name (Identifier (Prefix_Component)))); C1 := Name_Find; end if; - Get_Name_String - (To_C_Name (AIN.Display_Name (Identifier (E)))); + Get_Name_String (To_C_Name (AIN.Display_Name (Identifier (E)))); C2 := Name_Find; Set_Str_To_Name_Buffer (""); @@ -904,7 +902,9 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_C_Enum_Name -- --------------------- - function Map_C_Enum_Name (E : Node_Id; Enumerator : Name_Id) return Name_Id + function Map_C_Enum_Name + (E : Node_Id; + Enumerator : Name_Id) return Name_Id is Enum_Name : Name_Id; begin @@ -912,8 +912,7 @@ package body Ocarina.Backends.C_Common.Mapping is -- collision of enumerators, as C does not allow twice the same -- enumerators in two different enum types. - Enum_Name := To_C_Name - (Display_Name (Identifier (E))); + Enum_Name := To_C_Name (Display_Name (Identifier (E))); Get_Name_String_And_Append (Enum_Name); Add_Str_To_Name_Buffer ("_"); @@ -926,27 +925,23 @@ package body Ocarina.Backends.C_Common.Mapping is --------------------------- function Map_C_Enumerator_Name - (E : Node_Id; - Custom_Parent : Node_Id := No_Node; - Entity : Boolean := False; - Server : Boolean := False; - Port_Type : Boolean := False; - Local_Port : Boolean := False) - return Name_Id + (E : Node_Id; + Custom_Parent : Node_Id := No_Node; + Entity : Boolean := False; + Server : Boolean := False; + Port_Type : Boolean := False; + Local_Port : Boolean := False) return Name_Id is C_Name_1 : Name_Id; C_Name_2 : Name_Id; begin if Kind (E) = K_Port_Spec_Instance then - C_Name_1 := CTU.To_C_Name - (Display_Name (Identifier (E))); + C_Name_1 := CTU.To_C_Name (Display_Name (Identifier (E))); Get_Name_String (CTU.To_C_Name (Display_Name - (Identifier - (Parent_Subcomponent - (Parent_Component (E)))))); + (Identifier (Parent_Subcomponent (Parent_Component (E)))))); if Local_Port then Add_Str_To_Name_Buffer ("_local_"); Get_Name_String_And_Append (C_Name_1); @@ -957,19 +952,14 @@ package body Ocarina.Backends.C_Common.Mapping is elsif AINU.Is_Bus (E) then Set_Str_To_Name_Buffer ("bus_"); Get_Name_String_And_Append - (AIN.Name - (AIN.Identifier (Parent_Subcomponent (E)))); + (AIN.Name (AIN.Identifier (Parent_Subcomponent (E)))); elsif AINU.Is_Virtual_Bus (E) then Set_Str_To_Name_Buffer ("virtual_bus_"); if Parent_Subcomponent (E) /= No_Node then Get_Name_String_And_Append - (AIN.Name - (AIN.Identifier - (Parent_Subcomponent (E)))); + (AIN.Name (AIN.Identifier (Parent_Subcomponent (E)))); else - Get_Name_String_And_Append - (AIN.Name - (AIN.Identifier (E))); + Get_Name_String_And_Append (AIN.Name (AIN.Identifier (E))); end if; elsif AINU.Is_Subprogram (E) then -- For subprograms and processes, the enemerator name is @@ -977,17 +967,17 @@ package body Ocarina.Backends.C_Common.Mapping is Get_Name_String (CTU.To_C_Name (Display_Name (Identifier (E)))); Add_Str_To_Name_Buffer ("_k"); - elsif Get_Current_Backend_Kind = PolyORB_HI_C and then - AINU.Is_Device (E) then + elsif Get_Current_Backend_Kind = PolyORB_HI_C + and then AINU.Is_Device (E) + then Get_Name_String - (CTU.To_C_Name - (Display_Name - (Identifier - (Parent_Subcomponent (E))))); + (CTU.To_C_Name + (Display_Name (Identifier (Parent_Subcomponent (E))))); Add_Str_To_Name_Buffer ("_device_id"); - elsif (Present (Corresponding_Instance (E)) - and then AINU.Is_Process_Or_Device - (Corresponding_Instance (E))) then + elsif + (Present (Corresponding_Instance (E)) + and then AINU.Is_Process_Or_Device (Corresponding_Instance (E))) + then Get_Name_String (CTU.To_C_Name (Display_Name (Identifier (E)))); Add_Str_To_Name_Buffer ("_k"); @@ -995,24 +985,18 @@ package body Ocarina.Backends.C_Common.Mapping is -- For threads, the enumerator name is mapped from the -- containing process name and the thread subcomponent name. if Custom_Parent /= No_Node then - C_Name_1 := CTU.To_C_Name - (Display_Name - (Identifier - (Parent_Subcomponent - (Custom_Parent)))); + C_Name_1 := + CTU.To_C_Name + (Display_Name + (Identifier (Parent_Subcomponent (Custom_Parent)))); else - C_Name_1 := CTU.To_C_Name - (Display_Name - (Identifier - (Parent_Subcomponent - (Parent_Component - (E))))); + C_Name_1 := + CTU.To_C_Name + (Display_Name + (Identifier (Parent_Subcomponent (Parent_Component (E))))); end if; - C_Name_2 := CTU.To_C_Name - (Display_Name - (Identifier - (E))); + C_Name_2 := CTU.To_C_Name (Display_Name (Identifier (E))); if Port_Type then Set_Str_To_Name_Buffer ("__po_hi_"); @@ -1033,8 +1017,7 @@ package body Ocarina.Backends.C_Common.Mapping is Add_Str_To_Name_Buffer ("_entity"); end if; else - raise Program_Error with - "Wrong node kind for Map_C_Enumerator_Name"; + raise Program_Error with "Wrong node kind for Map_C_Enumerator_Name"; end if; C_Name_1 := Name_Find; @@ -1048,9 +1031,8 @@ package body Ocarina.Backends.C_Common.Mapping is ----------------------- function Map_C_Define_Name - (E : Node_Id; - Nb_Ports : Boolean := False) - return Name_Id + (E : Node_Id; + Nb_Ports : Boolean := False) return Name_Id is C_Name : Name_Id; begin @@ -1058,10 +1040,7 @@ package body Ocarina.Backends.C_Common.Mapping is -- For threads, the enumerator name is mapped from the -- containing process name and the thread subcomponent name. - C_Name := - Display_Name - (Identifier - (E)); + C_Name := Display_Name (Identifier (E)); Set_Str_To_Name_Buffer ("__PO_HI_"); @@ -1070,8 +1049,7 @@ package body Ocarina.Backends.C_Common.Mapping is Add_Str_To_Name_Buffer ("_NB_PORTS"); end if; else - raise Program_Error with - "Wrong node kind for Map_C_Enumerator_Name"; + raise Program_Error with "Wrong node kind for Map_C_Enumerator_Name"; end if; C_Name := Name_Find; @@ -1101,25 +1079,20 @@ package body Ocarina.Backends.C_Common.Mapping is Port_Destinations : Boolean := False; Port_Total_Fifo : Boolean := False; Port_Request : Boolean := False; - Request_Variable : Boolean := False) - return Name_Id + Request_Variable : Boolean := False) return Name_Id is C_Name : Name_Id; begin C_Name := To_C_Name (Display_Name (Identifier (E))); - if not Port_Request - and then not Request_Variable - then + if not Port_Request and then not Request_Variable then Set_Str_To_Name_Buffer ("__po_hi_"); if Port_Local_Dest then Get_Name_String_And_Append (AIN.Name - (Identifier - (Parent_Subcomponent - (Parent_Component (E))))); + (Identifier (Parent_Subcomponent (Parent_Component (E))))); Add_Str_To_Name_Buffer ("_"); end if; @@ -1171,10 +1144,7 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_C_Operation_Name -- -------------------------- - function Map_C_Operation_Name - (E : Node_Id) - return Name_Id - is + function Map_C_Operation_Name (E : Node_Id) return Name_Id is C_Name : Name_Id; begin Get_Name_String (CTU.To_C_Name (Display_Name (Identifier (E)))); @@ -1189,14 +1159,14 @@ package body Ocarina.Backends.C_Common.Mapping is function Map_C_Full_Parameter_Name (Spg : Node_Id; P : Node_Id; - Suffix : Character := ASCII.NUL) - return Name_Id + Suffix : Character := ASCII.NUL) return Name_Id is begin pragma Assert (Kind (P) = K_Parameter_Instance); if Kind (Spg) = K_Component_Instance - and then AINU.Is_Subprogram (Spg) then + and then AINU.Is_Subprogram (Spg) + then Get_Name_String (AINU.Compute_Full_Name_Of_Instance (Spg, True)); elsif Kind (Spg) = K_Call_Instance then Get_Name_String (Display_Name (Identifier (Spg))); @@ -1220,11 +1190,7 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_C_Port_Data_Name -- -------------------------- - function Map_C_Port_Data_Name - (E : Node_Id; - P : Node_Id) - return Name_Id - is + function Map_C_Port_Data_Name (E : Node_Id; P : Node_Id) return Name_Id is begin Get_Name_String (AINU.Compute_Full_Name_Of_Instance (E, True)); @@ -1251,11 +1217,12 @@ package body Ocarina.Backends.C_Common.Mapping is end if; if Present (Backend_Node (Identifier (E))) - and then Present (CTN.Type_Definition_Node - (Backend_Node (Identifier (E)))) + and then Present + (CTN.Type_Definition_Node (Backend_Node (Identifier (E)))) then - N := Type_Name - (CTN.Type_Definition_Node (Backend_Node (Identifier (E)))); + N := + Type_Name + (CTN.Type_Definition_Node (Backend_Node (Identifier (E)))); if Kind (N) = K_Defining_Identifier then return N; @@ -1279,9 +1246,10 @@ package body Ocarina.Backends.C_Common.Mapping is Result : Node_Id; Spg_Name : Name_Id; begin - pragma Assert (AINU.Is_Thread (E) or else - AINU.Is_Subprogram (E) or else - Kind (E) = K_Port_Spec_Instance); + pragma Assert + (AINU.Is_Thread (E) + or else AINU.Is_Subprogram (E) + or else Kind (E) = K_Port_Spec_Instance); if AINU.Is_Subprogram (E) and then Get_Source_Language (E) /= Language_C @@ -1311,9 +1279,11 @@ package body Ocarina.Backends.C_Common.Mapping is ------------------------------- function Map_C_Defining_Identifier - (A : Node_Id; Is_Pointer : Boolean := False) return Node_Id is - I, J : Node_Id; - Result : Node_Id; + (A : Node_Id; + Is_Pointer : Boolean := False) return Node_Id + is + I, J : Node_Id; + Result : Node_Id; Name_List : List_Id; begin @@ -1337,8 +1307,8 @@ package body Ocarina.Backends.C_Common.Mapping is J := AIN.Next_Node (J); while Present (J) loop - Add_Str_To_Name_Buffer ("__" - & Get_Name_String (Display_Name (J))); + Add_Str_To_Name_Buffer + ("__" & Get_Name_String (Display_Name (J))); J := AIN.Next_Node (J); end loop; end if; @@ -1349,8 +1319,8 @@ package body Ocarina.Backends.C_Common.Mapping is Get_Name_String (Display_Name (I)); end if; - Result := CTU.Make_Defining_Identifier - (To_C_Name (Name_Find), True, Is_Pointer); + Result := + CTU.Make_Defining_Identifier (To_C_Name (Name_Find), True, Is_Pointer); return Result; end Map_C_Defining_Identifier; @@ -1359,69 +1329,62 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Scade_Function -- ------------------------ - function Map_Scade_Function_Name (Subprogram : Node_Id) - return Node_Id is + function Map_Scade_Function_Name (Subprogram : Node_Id) return Node_Id is begin Get_Name_String (Get_Source_Name (Subprogram)); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Scade_Function_Name; ------------------------- -- Map_Scade_Struct_In -- ------------------------- - function Map_Scade_Struct_In (Subprogram : Node_Id) - return Node_Id is + function Map_Scade_Struct_In (Subprogram : Node_Id) return Node_Id is begin Set_Str_To_Name_Buffer ("inC_"); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Scade_Struct_In; -------------------------- -- Map_Scade_Struct_Out -- -------------------------- - function Map_Scade_Struct_Out (Subprogram : Node_Id) - return Node_Id is + function Map_Scade_Struct_Out (Subprogram : Node_Id) return Node_Id is begin Set_Str_To_Name_Buffer ("outC_"); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Scade_Struct_Out; ------------------------- -- Map_Scade_Parameter -- ------------------------- - function Map_Scade_Parameter (Parameter : Node_Id) - return Node_Id is + function Map_Scade_Parameter (Parameter : Node_Id) return Node_Id is begin Get_Name_String (Get_Scade_Signal (Parameter)); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Scade_Parameter; ---------------------- -- Map_Simulink_Var -- ---------------------- - function Map_Simulink_Var (Corresponding_Feature : Node_Id) - return Node_Id is + function Map_Simulink_Var + (Corresponding_Feature : Node_Id) return Node_Id + is Variable_Name : Name_Id; Simulink_Var : Node_Id; begin Set_Str_To_Name_Buffer (""); Get_Name_String - (Get_Source_Name (Parent_Component (Corresponding_Feature))); + (Get_Source_Name (Parent_Component (Corresponding_Feature))); if Is_In (Corresponding_Feature) then Add_Str_To_Name_Buffer ("_U"); @@ -1433,10 +1396,13 @@ package body Ocarina.Backends.C_Common.Mapping is Variable_Name := Name_Find; - Simulink_Var := Make_Member_Designator - (Make_Defining_Identifier - (Get_Source_Name (Corresponding_Feature), False), - Make_Defining_Identifier (Variable_Name, False), False); + Simulink_Var := + Make_Member_Designator + (Make_Defining_Identifier + (Get_Source_Name (Corresponding_Feature), + False), + Make_Defining_Identifier (Variable_Name, False), + False); return Simulink_Var; end Map_Simulink_Var; @@ -1444,29 +1410,25 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Simulink_Init_Func -- ---------------------------- - function Map_Simulink_Init_Func (Subprogram : Node_Id) - return Node_Id is + function Map_Simulink_Init_Func (Subprogram : Node_Id) return Node_Id is begin Get_Name_String (Get_Source_Name (Subprogram)); Add_Str_To_Name_Buffer ("_InitializeDataMapInfo"); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Simulink_Init_Func; ----------------------------- -- Map_Simulink_Model_Type -- ----------------------------- - function Map_Simulink_Model_Type (Subprogram : Node_Id) - return Node_Id is + function Map_Simulink_Model_Type (Subprogram : Node_Id) return Node_Id is begin Set_Str_To_Name_Buffer ("RT_MODEL_"); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Simulink_Model_Type; ------------------------- @@ -1493,89 +1455,77 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Source_Name -- --------------------- - function Map_Source_Name (Subprogram : Node_Id) - return Node_Id is + function Map_Source_Name (Subprogram : Node_Id) return Node_Id is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Source_Name; ----------------------------- -- Map_Lustre_Context_Name -- ----------------------------- - function Map_Lustre_Context_Name (Subprogram : Node_Id) - return Node_Id is + function Map_Lustre_Context_Name (Subprogram : Node_Id) return Node_Id is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); Add_Str_To_Name_Buffer ("_context"); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Lustre_Context_Name; ------------------------------ -- Map_Lustre_Context_Reset -- ------------------------------ - function Map_Lustre_Context_Reset (Subprogram : Node_Id) - return Node_Id is + function Map_Lustre_Context_Reset (Subprogram : Node_Id) return Node_Id is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); Add_Str_To_Name_Buffer ("_reset"); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Lustre_Context_Reset; ----------------------------- -- Map_Lustre_Context_Init -- ----------------------------- - function Map_Lustre_Context_Init (Subprogram : Node_Id) - return Node_Id is + function Map_Lustre_Context_Init (Subprogram : Node_Id) return Node_Id is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); Add_Str_To_Name_Buffer ("_new_ctx"); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Lustre_Context_Init; ----------------------------- -- Map_Lustre_Context_Type -- ----------------------------- - function Map_Lustre_Context_Type (Subprogram : Node_Id) - return Node_Id is + function Map_Lustre_Context_Type (Subprogram : Node_Id) return Node_Id is begin Set_Str_To_Name_Buffer ("struct "); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); Add_Str_To_Name_Buffer ("_ctx"); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Lustre_Context_Type; -------------------------- -- Map_Lustre_Step_Name -- -------------------------- - function Map_Lustre_Step_Name (Subprogram : Node_Id) - return Node_Id is + function Map_Lustre_Step_Name (Subprogram : Node_Id) return Node_Id is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); Add_Str_To_Name_Buffer ("_step"); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Lustre_Step_Name; ------------------------------------ @@ -1583,16 +1533,16 @@ package body Ocarina.Backends.C_Common.Mapping is ------------------------------------ function Map_Lustre_Input_Function_Name - (Subprogram : Node_Id; Port : Node_Id) - return Node_Id is + (Subprogram : Node_Id; + Port : Node_Id) return Node_Id + is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); Add_Str_To_Name_Buffer ("_I_"); Get_Name_String_And_Append (Get_Source_Name (Port)); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Lustre_Input_Function_Name; ------------------------- @@ -1600,8 +1550,9 @@ package body Ocarina.Backends.C_Common.Mapping is ------------------------- function Map_Lustre_Temp_Var - (Subprogram : Node_Id; Port : Node_Id) - return Node_Id is + (Subprogram : Node_Id; + Port : Node_Id) return Node_Id + is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); @@ -1609,8 +1560,7 @@ package body Ocarina.Backends.C_Common.Mapping is Get_Name_String_And_Append (Get_Source_Name (Port)); Add_Str_To_Name_Buffer ("_lustre_tmpvar"); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Lustre_Temp_Var; ------------------------------------- @@ -1618,47 +1568,43 @@ package body Ocarina.Backends.C_Common.Mapping is ------------------------------------- function Map_Lustre_Output_Function_Name - (Subprogram : Node_Id; Port : Node_Id) - return Node_Id is + (Subprogram : Node_Id; + Port : Node_Id) return Node_Id + is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); Add_Str_To_Name_Buffer ("_O_"); Get_Name_String_And_Append (Get_Source_Name (Port)); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Lustre_Output_Function_Name; ------------------------ -- Map_Esterel_Header -- ------------------------ - function Map_Esterel_Header (Subprogram : Node_Id) - return Node_Id is + function Map_Esterel_Header (Subprogram : Node_Id) return Node_Id is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Location (Subprogram)); Set_Str_To_Name_Buffer (Name_Buffer (1 .. Name_Len - 2)); Add_Str_To_Name_Buffer ("_strl"); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Esterel_Header; -------------------------------- -- Map_Esterel_Reset_Function -- -------------------------------- - function Map_Esterel_Reset_Function (Subprogram : Node_Id) - return Node_Id is + function Map_Esterel_Reset_Function (Subprogram : Node_Id) return Node_Id is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); Add_Str_To_Name_Buffer ("_reset"); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Esterel_Reset_Function; -------------------------------- @@ -1666,16 +1612,16 @@ package body Ocarina.Backends.C_Common.Mapping is -------------------------------- function Map_Esterel_Input_Function - (Subprogram : Node_Id; Feature : Node_Id) - return Node_Id is + (Subprogram : Node_Id; + Feature : Node_Id) return Node_Id + is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); Add_Str_To_Name_Buffer ("_I_"); Get_Name_String_And_Append (Get_Source_Name (Feature)); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Esterel_Input_Function; --------------------------------- @@ -1683,16 +1629,16 @@ package body Ocarina.Backends.C_Common.Mapping is --------------------------------- function Map_Esterel_Output_Function - (Subprogram : Node_Id; Feature : Node_Id) - return Node_Id is + (Subprogram : Node_Id; + Feature : Node_Id) return Node_Id + is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); Add_Str_To_Name_Buffer ("_O_"); Get_Name_String_And_Append (Get_Source_Name (Feature)); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Esterel_Output_Function; -------------------------- @@ -1700,8 +1646,9 @@ package body Ocarina.Backends.C_Common.Mapping is -------------------------- function Map_Esterel_Temp_Var - (Subprogram : Node_Id; Port : Node_Id) - return Node_Id is + (Subprogram : Node_Id; + Port : Node_Id) return Node_Id + is begin Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append (Get_Source_Name (Subprogram)); @@ -1709,8 +1656,7 @@ package body Ocarina.Backends.C_Common.Mapping is Get_Name_String_And_Append (Get_Source_Name (Port)); Add_Str_To_Name_Buffer ("_esterel_tmpvar"); - return CTU.Make_Defining_Identifier - (Name_Find, C_Conversion => False); + return CTU.Make_Defining_Identifier (Name_Find, C_Conversion => False); end Map_Esterel_Temp_Var; ------------------------------ @@ -1719,8 +1665,7 @@ package body Ocarina.Backends.C_Common.Mapping is function Map_C_Feature_Subprogram (A : Node_Id; - Owner : Node_Id := No_Node) - return Node_Id + Owner : Node_Id := No_Node) return Node_Id is I : Node_Id; Result : Node_Id; @@ -1743,7 +1688,7 @@ package body Ocarina.Backends.C_Common.Mapping is Add_Char_To_Name_Buffer ('_'); Get_Name_String_And_Append (N); - N := Name_Find; + N := Name_Find; Result := CTU.Make_Defining_Identifier (N); return Result; @@ -1756,20 +1701,20 @@ package body Ocarina.Backends.C_Common.Mapping is function Map_C_Marshaller_Subprogram (A : Node_Id; Is_Unmarshall : Boolean := False; - Is_Request : Boolean := False) return Node_Id is - I : Node_Id; - Result : Node_Id; - N : Name_Id; - C_Name : Name_Id; + Is_Request : Boolean := False) return Node_Id + is + I : Node_Id; + Result : Node_Id; + N : Name_Id; + C_Name : Name_Id; begin I := Identifier (A); if Kind (A) = K_Port_Spec_Instance then - C_Name := CTU.To_C_Name - (Display_Name - (Identifier - (Parent_Subcomponent - (Parent_Component (A))))); + C_Name := + CTU.To_C_Name + (Display_Name + (Identifier (Parent_Subcomponent (Parent_Component (A))))); end if; N := CTU.To_C_Name (Display_Name (I)); @@ -1795,9 +1740,8 @@ package body Ocarina.Backends.C_Common.Mapping is Get_Name_String_And_Append (N); - N := Name_Find; - Result := CTU.Make_Defining_Identifier - (N); + N := Name_Find; + Result := CTU.Make_Defining_Identifier (N); return Result; end Map_C_Marshaller_Subprogram; @@ -1925,7 +1869,9 @@ package body Ocarina.Backends.C_Common.Mapping is --------------------------- function Map_C_Subprogram_Spec - (S : Node_Id; Containing_Device : Node_Id := No_Node) return Node_Id is + (S : Node_Id; + Containing_Device : Node_Id := No_Node) return Node_Id + is Profile : constant List_Id := CTU.New_List (CTN.K_Parameter_Profile); Param : Node_Id; Mode : Mode_Id; @@ -1937,12 +1883,12 @@ package body Ocarina.Backends.C_Common.Mapping is pragma Assert (AINU.Is_Subprogram (S)); if Get_Current_Backend_Kind = PolyORB_HI_C - and then Containing_Device /= No_Node then - Param := CTU.Make_Parameter_Specification - (Defining_Identifier => - Make_Defining_Identifier (VN (V_Dev_Id)), - Parameter_Type => - (RE (RE_Device_Id))); + and then Containing_Device /= No_Node + then + Param := + CTU.Make_Parameter_Specification + (Defining_Identifier => Make_Defining_Identifier (VN (V_Dev_Id)), + Parameter_Type => (RE (RE_Device_Id))); CTU.Append_Node_To_List (Param, Profile); end if; @@ -1972,18 +1918,17 @@ package body Ocarina.Backends.C_Common.Mapping is D := Corresponding_Instance (F); if Mode = Mode_In then - Param := CTU.Make_Parameter_Specification - (Defining_Identifier => - Map_C_Defining_Identifier (F), - Parameter_Type => - Map_C_Data_Type_Designator (D)); + Param := + CTU.Make_Parameter_Specification + (Defining_Identifier => Map_C_Defining_Identifier (F), + Parameter_Type => Map_C_Data_Type_Designator (D)); else - Param := CTU.Make_Parameter_Specification - (Defining_Identifier => - Map_C_Defining_Identifier (F), - Parameter_Type => - CTU.Make_Pointer_Type - (Map_C_Data_Type_Designator (D))); + Param := + CTU.Make_Parameter_Specification + (Defining_Identifier => Map_C_Defining_Identifier (F), + Parameter_Type => + CTU.Make_Pointer_Type + (Map_C_Data_Type_Designator (D))); end if; CTU.Append_Node_To_List (Param, Profile); end if; @@ -2022,34 +1967,36 @@ package body Ocarina.Backends.C_Common.Mapping is D := Corresponding_Instance (F); case Get_Data_Representation (D) is - when Data_Integer - | Data_Boolean - | Data_Float - | Data_Fixed - | Data_Struct - | Data_String - | Data_Wide_String - | Data_Character - | Data_Wide_Character - | Data_Array => + when Data_Integer | + Data_Boolean | + Data_Float | + Data_Fixed | + Data_Struct | + Data_String | + Data_Wide_String | + Data_Character | + Data_Wide_Character | + Data_Array => -- If the data component is a simple data -- component (not a structure), we simply add a -- parameter with the computed mode and with a -- type mapped from the data component. if Mode = Mode_In then - Param := CTU.Make_Parameter_Specification - (Defining_Identifier => - Map_C_Defining_Identifier (F), - Parameter_Type => - Map_C_Data_Type_Designator (D)); + Param := + CTU.Make_Parameter_Specification + (Defining_Identifier => + Map_C_Defining_Identifier (F), + Parameter_Type => + Map_C_Data_Type_Designator (D)); else - Param := CTU.Make_Parameter_Specification - (Defining_Identifier => - Map_C_Defining_Identifier (F), - Parameter_Type => - CTU.Make_Pointer_Type - (Map_C_Data_Type_Designator (D))); + Param := + CTU.Make_Parameter_Specification + (Defining_Identifier => + Map_C_Defining_Identifier (F), + Parameter_Type => + CTU.Make_Pointer_Type + (Map_C_Data_Type_Designator (D))); end if; CTU.Append_Node_To_List (Param, Profile); @@ -2064,23 +2011,26 @@ package body Ocarina.Backends.C_Common.Mapping is while Present (Field) loop if AINU.Is_Data - (Corresponding_Instance (Field)) + (Corresponding_Instance (Field)) then if Mode = Mode_In then - Param := CTU.Make_Parameter_Specification - (Defining_Identifier => - Map_C_Defining_Identifier (Field), - Parameter_Type => - Map_C_Data_Type_Designator - (Corresponding_Instance (Field))); + Param := + CTU.Make_Parameter_Specification + (Defining_Identifier => + Map_C_Defining_Identifier (Field), + Parameter_Type => + Map_C_Data_Type_Designator + (Corresponding_Instance (Field))); else - Param := CTU.Make_Parameter_Specification - (Defining_Identifier => - Map_C_Defining_Identifier (Field), - Parameter_Type => - Make_Pointer_Type - (Map_C_Data_Type_Designator - (Corresponding_Instance (Field)))); + Param := + CTU.Make_Parameter_Specification + (Defining_Identifier => + Map_C_Defining_Identifier (Field), + Parameter_Type => + Make_Pointer_Type + (Map_C_Data_Type_Designator + (Corresponding_Instance + (Field)))); end if; CTU.Append_Node_To_List (Param, Profile); end if; @@ -2100,11 +2050,11 @@ package body Ocarina.Backends.C_Common.Mapping is end if; end if; - N := CTU.Make_Function_Specification - (Defining_Identifier => - Map_C_Defining_Identifier (S), - Parameters => Profile, - Return_Type => New_Node (CTN.K_Void)); + N := + CTU.Make_Function_Specification + (Defining_Identifier => Map_C_Defining_Identifier (S), + Parameters => Profile, + Return_Type => New_Node (CTN.K_Void)); return N; end Map_C_Subprogram_Spec; @@ -2114,25 +2064,25 @@ package body Ocarina.Backends.C_Common.Mapping is --------------------------- function Map_C_Subprogram_Body - (S : Node_Id; - Containing_Device : Node_Id := No_Node) return Node_Id is - Spec : constant Node_Id := - Map_C_Subprogram_Spec (S, Containing_Device); - User_Spec : constant Node_Id := - Map_C_Subprogram_Spec (S, Containing_Device); - Declarations : constant List_Id := New_List (CTN.K_Declaration_List); - Statements : constant List_Id := New_List (CTN.K_Statement_List); - Call_Profile : List_Id := New_List (CTN.K_Parameter_Profile); - D : Node_Id; - N : Node_Id; - P : Node_Id; - T : Node_Id; - Z : Node_Id; - Feature : Node_Id; - Left_Assign : Node_Id; - Right_Assign : Node_Id; + (S : Node_Id; + Containing_Device : Node_Id := No_Node) return Node_Id + is + Spec : constant Node_Id := Map_C_Subprogram_Spec (S, Containing_Device); + User_Spec : constant Node_Id := + Map_C_Subprogram_Spec (S, Containing_Device); + Declarations : constant List_Id := New_List (CTN.K_Declaration_List); + Statements : constant List_Id := New_List (CTN.K_Statement_List); + Call_Profile : List_Id := New_List (CTN.K_Parameter_Profile); + D : Node_Id; + N : Node_Id; + P : Node_Id; + T : Node_Id; + Z : Node_Id; + Feature : Node_Id; + Left_Assign : Node_Id; + Right_Assign : Node_Id; Call_Parameters : List_Id; - Return_Code_Declared : Boolean := False; + Return_Code_Declared : Boolean := False; Function_Call : Node_Id; Function_Name : Node_Id; Param_Representation : Supported_Data_Representation; @@ -2146,9 +2096,11 @@ package body Ocarina.Backends.C_Common.Mapping is CTU.Append_Node_To_List (N, Statements); return Make_Function_Implementation - (Spec, Declarations, Statements); + (Spec, + Declarations, + Statements); - when Subprogram_LUA => + when Subprogram_Lua => if Get_Source_Text (S)'Size = 0 then Display_Located_Error (AIN.Loc (S), @@ -2157,27 +2109,24 @@ package body Ocarina.Backends.C_Common.Mapping is end if; Append_Node_To_List - (Make_Variable_Declaration - (Defining_Identifier => - Make_Defining_Identifier (VN (V_Lua_Context)), - Used_Type => - RE (RE_Lua_Context_T)), + (Make_Variable_Declaration + (Defining_Identifier => + Make_Defining_Identifier (VN (V_Lua_Context)), + Used_Type => RE (RE_Lua_Context_T)), Declarations); Append_Node_To_List - (Make_Variable_Address - (Make_Defining_Identifier (VN (V_Lua_Context))), + (Make_Variable_Address + (Make_Defining_Identifier (VN (V_Lua_Context))), Call_Profile); Append_Node_To_List - (Make_Literal - (C_Values.New_Pointed_Char_Value - (Get_Source_Text (S)(1))), + (Make_Literal + (C_Values.New_Pointed_Char_Value (Get_Source_Text (S) (1))), Call_Profile); Append_Node_To_List - (CTU.Make_Call_Profile - (RE (RE_LUA_Load), Call_Profile), + (CTU.Make_Call_Profile (RE (RE_LUA_Load), Call_Profile), Statements); if Get_Source_Name (S) /= No_Name then @@ -2185,19 +2134,19 @@ package body Ocarina.Backends.C_Common.Mapping is Call_Profile := New_List (CTN.K_Parameter_Profile); Append_Node_To_List - (Make_Variable_Address - (Make_Defining_Identifier (VN (V_Lua_Context))), + (Make_Variable_Address + (Make_Defining_Identifier (VN (V_Lua_Context))), Call_Profile); Append_Node_To_List - (Make_Literal - (C_Values.New_Pointed_Char_Value - (Get_Source_Name (S))), + (Make_Literal + (C_Values.New_Pointed_Char_Value (Get_Source_Name (S))), Call_Profile); Append_Node_To_List - (CTU.Make_Call_Profile - (RE (RE_LUA_Init_Function_Call), Call_Profile), + (CTU.Make_Call_Profile + (RE (RE_LUA_Init_Function_Call), + Call_Profile), Statements); -- Push all the IN parameters on the stack @@ -2205,8 +2154,9 @@ package body Ocarina.Backends.C_Common.Mapping is Feature := AIN.First_Node (Features (S)); while Present (Feature) loop - if Kind (Feature) = K_Parameter_Instance and then - Is_In (Feature) then + if Kind (Feature) = K_Parameter_Instance + and then Is_In (Feature) + then D := Corresponding_Instance (Feature); @@ -2215,20 +2165,20 @@ package body Ocarina.Backends.C_Common.Mapping is Call_Profile := New_List (CTN.K_Parameter_Profile); Append_Node_To_List - (Make_Variable_Address - (Make_Defining_Identifier (VN (V_Lua_Context))), + (Make_Variable_Address + (Make_Defining_Identifier (VN (V_Lua_Context))), Call_Profile); Append_Node_To_List - (Map_C_Defining_Identifier (Feature), + (Map_C_Defining_Identifier (Feature), Call_Profile); if Param_Representation = Data_Integer then - Function_Name := RE (RE_Lua_Push_Number); + Function_Name := RE (RE_LUA_Push_Number); elsif Param_Representation = Data_String then - Function_Name := RE (RE_Lua_Push_String); + Function_Name := RE (RE_LUA_Push_String); elsif Param_Representation = Data_Boolean then - Function_Name := RE (RE_Lua_Push_Boolean); + Function_Name := RE (RE_LUA_Push_Boolean); else Display_Located_Error (AIN.Loc (Feature), @@ -2238,8 +2188,7 @@ package body Ocarina.Backends.C_Common.Mapping is end if; Append_Node_To_List - (CTU.Make_Call_Profile - (Function_Name, Call_Profile), + (CTU.Make_Call_Profile (Function_Name, Call_Profile), Statements); end if; Feature := AIN.Next_Node (Feature); @@ -2250,13 +2199,14 @@ package body Ocarina.Backends.C_Common.Mapping is Call_Profile := New_List (CTN.K_Parameter_Profile); Append_Node_To_List - (Make_Variable_Address - (Make_Defining_Identifier (VN (V_Lua_Context))), + (Make_Variable_Address + (Make_Defining_Identifier (VN (V_Lua_Context))), Call_Profile); Append_Node_To_List - (CTU.Make_Call_Profile - (RE (RE_LUA_Perform_Function_Call), Call_Profile), + (CTU.Make_Call_Profile + (RE (RE_LUA_Perform_Function_Call), + Call_Profile), Statements); -- Get all the OUT parameters from LUA to C. @@ -2264,8 +2214,9 @@ package body Ocarina.Backends.C_Common.Mapping is Feature := AIN.First_Node (Features (S)); while Present (Feature) loop - if Kind (Feature) = K_Parameter_Instance and then - Is_Out (Feature) then + if Kind (Feature) = K_Parameter_Instance + and then Is_Out (Feature) + then D := Corresponding_Instance (Feature); @@ -2274,28 +2225,27 @@ package body Ocarina.Backends.C_Common.Mapping is Call_Profile := New_List (CTN.K_Parameter_Profile); Append_Node_To_List - (Make_Variable_Address - (Make_Defining_Identifier (VN (V_Lua_Context))), + (Make_Variable_Address + (Make_Defining_Identifier (VN (V_Lua_Context))), Call_Profile); Append_Node_To_List - (Make_Literal - (C_Values.New_Pointed_Char_Value - (To_C_Name - (AIN.Name - (AIN.Identifier (Feature))))), + (Make_Literal + (C_Values.New_Pointed_Char_Value + (To_C_Name + (AIN.Name (AIN.Identifier (Feature))))), Call_Profile); Append_Node_To_List - (Map_C_Defining_Identifier (Feature), + (Map_C_Defining_Identifier (Feature), Call_Profile); if Param_Representation = Data_Integer then - Function_Name := RE (RE_Lua_Get_Number); + Function_Name := RE (RE_LUA_Get_Number); elsif Param_Representation = Data_String then - Function_Name := RE (RE_Lua_Get_String); + Function_Name := RE (RE_LUA_Get_String); elsif Param_Representation = Data_Boolean then - Function_Name := RE (RE_Lua_Get_Boolean); + Function_Name := RE (RE_LUA_Get_Boolean); else Display_Located_Error (AIN.Loc (Feature), @@ -2305,8 +2255,7 @@ package body Ocarina.Backends.C_Common.Mapping is end if; Append_Node_To_List - (CTU.Make_Call_Profile - (Function_Name, Call_Profile), + (CTU.Make_Call_Profile (Function_Name, Call_Profile), Statements); end if; Feature := AIN.Next_Node (Feature); @@ -2316,11 +2265,13 @@ package body Ocarina.Backends.C_Common.Mapping is end if; return Make_Function_Implementation - (Spec, Declarations, Statements); + (Spec, + Declarations, + Statements); - when Subprogram_Opaque_C - | Subprogram_Opaque_CPP - | Subprogram_Default => + when Subprogram_Opaque_C | + Subprogram_Opaque_CPP | + Subprogram_Default => -- Create function to lock the data. @@ -2331,8 +2282,8 @@ package body Ocarina.Backends.C_Common.Mapping is while Present (Feature) loop if Kind (Feature) = K_Subcomponent_Access_Instance - and then - Is_Protected_Data (Corresponding_Instance (Feature)) + and then Is_Protected_Data + (Corresponding_Instance (Feature)) then -- Declare the return variable added to -- function-call. This variable must be @@ -2346,27 +2297,33 @@ package body Ocarina.Backends.C_Common.Mapping is if Get_Accessed_Data (Feature) = No_Node then Display_Located_Error - (AIN.Loc (Feature), + (AIN.Loc (Feature), "This parameter is not connected correctly", Fatal => True); end if; - Append_Node_To_List (Make_Defining_Identifier - (Map_Associated_Locking_Entity_Name - (Get_Accessed_Data (Feature))), Call_Parameters); + Append_Node_To_List + (Make_Defining_Identifier + (Map_Associated_Locking_Entity_Name + (Get_Accessed_Data (Feature))), + Call_Parameters); Append_Node_To_List - (Make_Literal (New_Int_Value (0, 1, 10)), + (Make_Literal (New_Int_Value (0, 1, 10)), Call_Parameters); if POK_Flavor = ARINC653 then Add_Return_Variable_In_Parameters (Call_Parameters); - Function_Call := POK_Make_Function_Call_With_Assert - (RF (RE_Wait_Semaphore), Call_Parameters); + Function_Call := + POK_Make_Function_Call_With_Assert + (RF (RE_Wait_Semaphore), + Call_Parameters); else - Function_Call := POK_Make_Function_Call_With_Assert - (RF (RE_Pok_Sem_Wait), Call_Parameters); + Function_Call := + POK_Make_Function_Call_With_Assert + (RF (RE_Pok_Sem_Wait), + Call_Parameters); end if; Append_Node_To_List (Function_Call, Statements); end if; @@ -2396,9 +2353,10 @@ package body Ocarina.Backends.C_Common.Mapping is -- Then, call the function provided by the user in our -- subprogram. - N := Make_Call_Profile - (Make_Defining_Identifier - (Get_Source_Name (S)), Call_Profile); + N := + Make_Call_Profile + (Make_Defining_Identifier (Get_Source_Name (S)), + Call_Profile); Append_Node_To_List (N, Statements); -- Create function to unlock the data. @@ -2409,22 +2367,30 @@ package body Ocarina.Backends.C_Common.Mapping is Feature := AIN.First_Node (Features (S)); while Present (Feature) loop - if Kind (Feature) = K_Subcomponent_Access_Instance and then - Is_Protected_Data (Corresponding_Instance (Feature)) then + if Kind (Feature) = K_Subcomponent_Access_Instance + and then Is_Protected_Data + (Corresponding_Instance (Feature)) + then Call_Parameters := New_List (CTN.K_Parameter_List); - Append_Node_To_List (Make_Defining_Identifier - (Map_Associated_Locking_Entity_Name - (Get_Accessed_Data (Feature))), Call_Parameters); + Append_Node_To_List + (Make_Defining_Identifier + (Map_Associated_Locking_Entity_Name + (Get_Accessed_Data (Feature))), + Call_Parameters); if POK_Flavor = ARINC653 then Add_Return_Variable_In_Parameters (Call_Parameters); - Function_Call := POK_Make_Function_Call_With_Assert - (RF (RE_Signal_Semaphore), Call_Parameters); + Function_Call := + POK_Make_Function_Call_With_Assert + (RF (RE_Signal_Semaphore), + Call_Parameters); else - Function_Call := POK_Make_Function_Call_With_Assert - (RF (RE_Pok_Sem_Signal), Call_Parameters); + Function_Call := + POK_Make_Function_Call_With_Assert + (RF (RE_Pok_Sem_Signal), + Call_Parameters); end if; Append_Node_To_List (Function_Call, Statements); end if; @@ -2433,7 +2399,9 @@ package body Ocarina.Backends.C_Common.Mapping is end if; return CTU.Make_Function_Implementation - (Spec, Declarations, Statements); + (Spec, + Declarations, + Statements); when Subprogram_Opaque_Ada_95 => if not Is_Empty (Parameters (Spec)) then @@ -2452,51 +2420,60 @@ package body Ocarina.Backends.C_Common.Mapping is Set_Defining_Identifier (User_Spec, - (Make_Defining_Identifier (Get_Source_Name (S), - Ada_Conversion => True))); + (Make_Defining_Identifier + (Get_Source_Name (S), + Ada_Conversion => True))); Append_Node_To_List (User_Spec, CTN.Declarations (Current_File)); -- Then, call the function provided by the user in our -- subprogram. - N := Make_Call_Profile - (Make_Defining_Identifier - (Get_Source_Name (S), - Ada_Conversion => True), Call_Profile); + N := + Make_Call_Profile + (Make_Defining_Identifier + (Get_Source_Name (S), + Ada_Conversion => True), + Call_Profile); Append_Node_To_List (N, Statements); return CTU.Make_Function_Implementation - (Spec, Declarations, Statements); + (Spec, + Declarations, + Statements); when Subprogram_Simulink => Add_Include - (Make_Include_Clause - (Make_Defining_Identifier - (Get_Source_Name (S), False), False), True); + (Make_Include_Clause + (Make_Defining_Identifier (Get_Source_Name (S), False), + False), + True); if not AINU.Is_Empty (Features (S)) then P := AIN.First_Node (Features (S)); while Present (P) loop if AIN.Is_In (P) then - Left_Assign := Map_Simulink_Var (P); + Left_Assign := Map_Simulink_Var (P); Right_Assign := Map_C_Defining_Identifier (P); - if Get_Data_Representation - (Corresponding_Instance (P)) = Data_Array then + if Get_Data_Representation (Corresponding_Instance (P)) = + Data_Array + then Append_Node_To_List - (Make_Call_Profile - (RE (RE_Copy_Array), + (Make_Call_Profile + (RE (RE_Copy_Array), Make_List_Id - (Make_Variable_Address (Left_Assign), + (Make_Variable_Address (Left_Assign), Make_Variable_Address (Right_Assign), Get_Data_Size (Corresponding_Instance (P)))), Statements); else Append_Node_To_List - (Make_Expression - (Left_Assign, Op_Equal, Right_Assign), + (Make_Expression + (Left_Assign, + Op_Equal, + Right_Assign), Statements); end if; end if; @@ -2506,8 +2483,7 @@ package body Ocarina.Backends.C_Common.Mapping is end if; Append_Node_To_List - (CTU.Make_Call_Profile - (RE (RE_Simulink_Update), No_List), + (CTU.Make_Call_Profile (RE (RE_Simulink_Update), No_List), Statements); if not AINU.Is_Empty (Features (S)) then @@ -2515,25 +2491,28 @@ package body Ocarina.Backends.C_Common.Mapping is while Present (P) loop if AIN.Is_Out (P) then - Left_Assign := Map_C_Defining_Identifier (P); + Left_Assign := Map_C_Defining_Identifier (P); Right_Assign := Map_Simulink_Var (P); CTN.Set_Is_Pointer (Left_Assign, True); - if Get_Data_Representation - (Corresponding_Instance (P)) = Data_Array then + if Get_Data_Representation (Corresponding_Instance (P)) = + Data_Array + then Set_Is_Pointer (Left_Assign, False); Append_Node_To_List - (Make_Call_Profile - (RE (RE_Copy_Array), + (Make_Call_Profile + (RE (RE_Copy_Array), Make_List_Id - (Left_Assign, + (Left_Assign, Make_Variable_Address (Right_Assign), Get_Data_Size (Corresponding_Instance (P)))), Statements); else Append_Node_To_List - (Make_Expression - (Left_Assign, Op_Equal, Right_Assign), + (Make_Expression + (Left_Assign, + Op_Equal, + Right_Assign), Statements); end if; end if; @@ -2543,12 +2522,14 @@ package body Ocarina.Backends.C_Common.Mapping is end if; return CTU.Make_Function_Implementation - (Spec, Declarations, Statements); + (Spec, + Declarations, + Statements); when Subprogram_Scade => Add_Include - (Make_Include_Clause - (Map_Scade_Function_Name (S)), Preserve_Case => True); + (Make_Include_Clause (Map_Scade_Function_Name (S)), + Preserve_Case => True); -- At first, we declare structures used as parameters -- for SCADE functions. So, if the subprograms has IN -- parameters, we declare as such function. The same @@ -2562,42 +2543,49 @@ package body Ocarina.Backends.C_Common.Mapping is Z := AIN.Corresponding_Instance (P); T := No_Node; - if Present (Backend_Node (Identifier (Z))) and then - Present (CTN.Type_Definition_Node - (Backend_Node (Identifier (Z)))) then - T := CTN.Type_Name - (CTN.Type_Definition_Node - (Backend_Node (Identifier (Z)))); + if Present (Backend_Node (Identifier (Z))) + and then Present + (CTN.Type_Definition_Node + (Backend_Node (Identifier (Z)))) + then + T := + CTN.Type_Name + (CTN.Type_Definition_Node + (Backend_Node (Identifier (Z)))); end if; - Left_Assign := Make_Member_Designator - (Map_Scade_Parameter (P), - Make_Defining_Identifier (VN (V_In))); + Left_Assign := + Make_Member_Designator + (Map_Scade_Parameter (P), + Make_Defining_Identifier (VN (V_In))); Right_Assign := Map_C_Defining_Identifier (P); - if T /= No_Node and then - CTN.Kind (T) = CTN.K_Array_Declaration then - Call_Profile - := New_List (CTN.K_Parameter_Profile); + if T /= No_Node + and then CTN.Kind (T) = CTN.K_Array_Declaration + then + Call_Profile := New_List (CTN.K_Parameter_Profile); - Append_Node_To_List - (Make_Variable_Address (Left_Assign), - Call_Profile); + Append_Node_To_List + (Make_Variable_Address (Left_Assign), + Call_Profile); - Append_Node_To_List - (Make_Variable_Address (Right_Assign), - Call_Profile); + Append_Node_To_List + (Make_Variable_Address (Right_Assign), + Call_Profile); - Append_Node_To_List - (Get_Data_Size (Z), Call_Profile); + Append_Node_To_List (Get_Data_Size (Z), Call_Profile); - N := CTU.Make_Call_Profile - (RE (RE_Copy_Array), Call_Profile); - Append_Node_To_List (N, Statements); + N := + CTU.Make_Call_Profile + (RE (RE_Copy_Array), + Call_Profile); + Append_Node_To_List (N, Statements); else Append_Node_To_List - (Make_Expression - (Left_Assign, Op_Equal, Right_Assign), + (Make_Expression + (Left_Assign, + Op_Equal, + Right_Assign), Statements); end if; end if; @@ -2611,18 +2599,17 @@ package body Ocarina.Backends.C_Common.Mapping is Call_Profile := New_List (CTN.K_Parameter_Profile); Append_Node_To_List - (Make_Variable_Address - (Make_Defining_Identifier (VN (V_In))), + (Make_Variable_Address (Make_Defining_Identifier (VN (V_In))), Call_Profile); Append_Node_To_List - (Make_Variable_Address - (Make_Defining_Identifier (VN (V_Out))), + (Make_Variable_Address (Make_Defining_Identifier (VN (V_Out))), Call_Profile); Append_Node_To_List - (CTU.Make_Call_Profile - (Map_Scade_Function_Name (S), Call_Profile), + (CTU.Make_Call_Profile + (Map_Scade_Function_Name (S), + Call_Profile), Statements); -- Then, we take the out signal from the SCADE code @@ -2635,44 +2622,50 @@ package body Ocarina.Backends.C_Common.Mapping is Z := AIN.Corresponding_Instance (P); T := No_Node; - if Present (Backend_Node (Identifier (Z))) and then - Present (CTN.Type_Definition_Node - (Backend_Node (Identifier (Z)))) then - T := CTN.Type_Name - (CTN.Type_Definition_Node - (Backend_Node (Identifier (Z)))); + if Present (Backend_Node (Identifier (Z))) + and then Present + (CTN.Type_Definition_Node + (Backend_Node (Identifier (Z)))) + then + T := + CTN.Type_Name + (CTN.Type_Definition_Node + (Backend_Node (Identifier (Z)))); end if; - Left_Assign := Map_C_Defining_Identifier (P); - Right_Assign := Make_Member_Designator - (Map_Scade_Parameter (P), - Make_Defining_Identifier (VN (V_Out))); + Left_Assign := Map_C_Defining_Identifier (P); + Right_Assign := + Make_Member_Designator + (Map_Scade_Parameter (P), + Make_Defining_Identifier (VN (V_Out))); - if T /= No_Node and then - CTN.Kind (T) = CTN.K_Array_Declaration then - Call_Profile - := New_List (CTN.K_Parameter_Profile); + if T /= No_Node + and then CTN.Kind (T) = CTN.K_Array_Declaration + then + Call_Profile := New_List (CTN.K_Parameter_Profile); - Append_Node_To_List - (Left_Assign, Call_Profile); + Append_Node_To_List (Left_Assign, Call_Profile); - Append_Node_To_List - (Make_Variable_Address (Right_Assign), - Call_Profile); + Append_Node_To_List + (Make_Variable_Address (Right_Assign), + Call_Profile); - Append_Node_To_List - (Get_Data_Size (Z), Call_Profile); + Append_Node_To_List (Get_Data_Size (Z), Call_Profile); - N := CTU.Make_Call_Profile - (RE (RE_Copy_Array), Call_Profile); + N := + CTU.Make_Call_Profile + (RE (RE_Copy_Array), + Call_Profile); - Append_Node_To_List (N, Statements); + Append_Node_To_List (N, Statements); else CTN.Set_Is_Pointer (Left_Assign, True); Append_Node_To_List - (Make_Expression - (Left_Assign, Op_Equal, Right_Assign), + (Make_Expression + (Left_Assign, + Op_Equal, + Right_Assign), Statements); end if; end if; @@ -2682,22 +2675,22 @@ package body Ocarina.Backends.C_Common.Mapping is end if; return CTU.Make_Function_Implementation - (Spec, Declarations, Statements); + (Spec, + Declarations, + Statements); when Subprogram_Lustre => Add_Include - (Make_Include_Clause - (Map_Source_Name (S)), Preserve_Case => True); + (Make_Include_Clause (Map_Source_Name (S)), + Preserve_Case => True); Append_Node_To_List - (Make_Extern_Entity_Declaration - (Make_Variable_Declaration - (Defining_Identifier => - Map_Lustre_Context_Name (S), - Used_Type => - Make_Pointer_Type - ((Map_Lustre_Context_Type (S))))), - CTN.Declarations (Current_File)); + (Make_Extern_Entity_Declaration + (Make_Variable_Declaration + (Defining_Identifier => Map_Lustre_Context_Name (S), + Used_Type => + Make_Pointer_Type ((Map_Lustre_Context_Type (S))))), + CTN.Declarations (Current_File)); if not AINU.Is_Empty (Features (S)) then P := AIN.First_Node (Features (S)); @@ -2705,10 +2698,10 @@ package body Ocarina.Backends.C_Common.Mapping is while Present (P) loop if AIN.Is_In (P) then Append_Node_To_List - (Make_Call_Profile - (Map_Lustre_Input_Function_Name (S, P), + (Make_Call_Profile + (Map_Lustre_Input_Function_Name (S, P), Make_List_Id - (Map_Lustre_Context_Name (S), + (Map_Lustre_Context_Name (S), Map_C_Defining_Identifier (P))), Statements); end if; @@ -2718,8 +2711,8 @@ package body Ocarina.Backends.C_Common.Mapping is end if; Append_Node_To_List - (CTU.Make_Call_Profile - (Map_Lustre_Step_Name (S), + (CTU.Make_Call_Profile + (Map_Lustre_Step_Name (S), Make_List_Id (Map_Lustre_Context_Name (S))), Statements); @@ -2733,69 +2726,66 @@ package body Ocarina.Backends.C_Common.Mapping is Z := AIN.Corresponding_Instance (P); T := No_Node; - if Present (Backend_Node (Identifier (Z))) and then - Present (CTN.Type_Definition_Node - (Backend_Node (Identifier (Z)))) then - T := CTN.Type_Name - (CTN.Type_Definition_Node - (Backend_Node (Identifier (Z)))); + if Present (Backend_Node (Identifier (Z))) + and then Present + (CTN.Type_Definition_Node + (Backend_Node (Identifier (Z)))) + then + T := + CTN.Type_Name + (CTN.Type_Definition_Node + (Backend_Node (Identifier (Z)))); end if; declare Spec : Node_Id; - Stats : constant List_Id - := New_List (CTN.K_Statement_List); + Stats : constant List_Id := + New_List (CTN.K_Statement_List); begin Append_Node_To_List - (Make_Variable_Declaration - (Defining_Identifier => - Map_Lustre_Temp_Var (S, P), - Used_Type => - CTU.Copy_Node (T)), + (Make_Variable_Declaration + (Defining_Identifier => + Map_Lustre_Temp_Var (S, P), + Used_Type => CTU.Copy_Node (T)), CTN.Declarations (Current_File)); - Spec := CTU.Make_Function_Specification - (Defining_Identifier => - Map_Lustre_Output_Function_Name (S, P), - Parameters => - Make_List_Id + Spec := + CTU.Make_Function_Specification + (Defining_Identifier => + Map_Lustre_Output_Function_Name (S, P), + Parameters => + Make_List_Id (Make_Parameter_Specification (Defining_Identifier => Make_Defining_Identifier - (PN (P_Unused)), - Parameter_Type => + (PN (P_Unused)), + Parameter_Type => Make_Pointer_Type - (Make_Defining_Identifier - (TN (T_Void)))), - Make_Parameter_Specification + (Make_Defining_Identifier + (TN (T_Void)))), + Make_Parameter_Specification (Defining_Identifier => Map_Source_Name (P), - Parameter_Type => - CTU.Copy_Node (T))), - Return_Type => New_Node (CTN.K_Void)); + Parameter_Type => CTU.Copy_Node (T))), + Return_Type => New_Node (CTN.K_Void)); Append_Node_To_List - (Make_Expression - (Left_Expr => - Map_Lustre_Temp_Var (S, P), - Operator => Op_Equal, - Right_Expr => - Map_Source_Name (P)), + (Make_Expression + (Left_Expr => Map_Lustre_Temp_Var (S, P), + Operator => Op_Equal, + Right_Expr => Map_Source_Name (P)), Stats); Append_Node_To_List - (Make_Function_Implementation - (Spec, No_List, Stats), + (Make_Function_Implementation (Spec, No_List, Stats), CTN.Declarations (Current_File)); Append_Node_To_List - (Make_Expression - (Left_Expr => - Map_C_Defining_Identifier (P, True), - Operator => Op_Equal, - Right_Expr => - Map_Lustre_Temp_Var (S, P)), - Statements); + (Make_Expression + (Left_Expr => Map_C_Defining_Identifier (P, True), + Operator => Op_Equal, + Right_Expr => Map_Lustre_Temp_Var (S, P)), + Statements); end; end if; @@ -2804,12 +2794,14 @@ package body Ocarina.Backends.C_Common.Mapping is end if; return CTU.Make_Function_Implementation - (Spec, Declarations, Statements); + (Spec, + Declarations, + Statements); when Subprogram_Esterel => Add_Include - (Make_Include_Clause - (Map_Esterel_Header (S)), Preserve_Case => True); + (Make_Include_Clause (Map_Esterel_Header (S)), + Preserve_Case => True); if not AINU.Is_Empty (Features (S)) then P := AIN.First_Node (Features (S)); @@ -2817,10 +2809,9 @@ package body Ocarina.Backends.C_Common.Mapping is while Present (P) loop if AIN.Is_In (P) then Append_Node_To_List - (Make_Call_Profile - (Map_Esterel_Input_Function (S, P), - Make_List_Id - (Map_C_Defining_Identifier (P))), + (Make_Call_Profile + (Map_Esterel_Input_Function (S, P), + Make_List_Id (Map_C_Defining_Identifier (P))), Statements); end if; @@ -2829,7 +2820,7 @@ package body Ocarina.Backends.C_Common.Mapping is end if; Append_Node_To_List - (Make_Call_Profile (Map_Source_Name (S)), + (Make_Call_Profile (Map_Source_Name (S)), Statements); if not AINU.Is_Empty (Features (S)) then @@ -2840,61 +2831,58 @@ package body Ocarina.Backends.C_Common.Mapping is Z := AIN.Corresponding_Instance (P); T := No_Node; - if Present (Backend_Node (Identifier (Z))) and then - Present (CTN.Type_Definition_Node - (Backend_Node (Identifier (Z)))) then - T := CTN.Type_Name - (CTN.Type_Definition_Node - (Backend_Node (Identifier (Z)))); + if Present (Backend_Node (Identifier (Z))) + and then Present + (CTN.Type_Definition_Node + (Backend_Node (Identifier (Z)))) + then + T := + CTN.Type_Name + (CTN.Type_Definition_Node + (Backend_Node (Identifier (Z)))); end if; declare Spec : Node_Id; - Stats : constant List_Id - := New_List (CTN.K_Statement_List); + Stats : constant List_Id := + New_List (CTN.K_Statement_List); begin Append_Node_To_List - (Make_Variable_Declaration - (Defining_Identifier => - Map_Esterel_Temp_Var (S, P), - Used_Type => - CTU.Copy_Node (T)), + (Make_Variable_Declaration + (Defining_Identifier => + Map_Esterel_Temp_Var (S, P), + Used_Type => CTU.Copy_Node (T)), CTN.Declarations (Current_File)); - Spec := CTU.Make_Function_Specification - (Defining_Identifier => - Map_Esterel_Output_Function (S, P), - Parameters => - Make_List_Id + Spec := + CTU.Make_Function_Specification + (Defining_Identifier => + Map_Esterel_Output_Function (S, P), + Parameters => + Make_List_Id (Make_Parameter_Specification (Defining_Identifier => Map_Source_Name (P), - Parameter_Type => - CTU.Copy_Node (T))), - Return_Type => New_Node (CTN.K_Void)); + Parameter_Type => CTU.Copy_Node (T))), + Return_Type => New_Node (CTN.K_Void)); Append_Node_To_List - (Make_Expression - (Left_Expr => - Map_Esterel_Temp_Var (S, P), - Operator => Op_Equal, - Right_Expr => - Map_Source_Name (P)), + (Make_Expression + (Left_Expr => Map_Esterel_Temp_Var (S, P), + Operator => Op_Equal, + Right_Expr => Map_Source_Name (P)), Stats); Append_Node_To_List - (Make_Function_Implementation - (Spec, No_List, Stats), + (Make_Function_Implementation (Spec, No_List, Stats), CTN.Declarations (Current_File)); Append_Node_To_List - (Make_Expression - (Left_Expr => - Map_C_Defining_Identifier (P, True), - Operator => Op_Equal, - Right_Expr => - Map_Esterel_Temp_Var (S, P)), - Statements); + (Make_Expression + (Left_Expr => Map_C_Defining_Identifier (P, True), + Operator => Op_Equal, + Right_Expr => Map_Esterel_Temp_Var (S, P)), + Statements); end; end if; @@ -2903,7 +2891,9 @@ package body Ocarina.Backends.C_Common.Mapping is end if; return CTU.Make_Function_Implementation - (Spec, Declarations, Statements); + (Spec, + Declarations, + Statements); when Subprogram_Pure_Call_Sequence => -- A pure call sequence subprogram is a subprogram that @@ -2912,16 +2902,21 @@ package body Ocarina.Backends.C_Common.Mapping is -- present in its call list. CTU.Handle_Call_Sequence - (S, AIN.First_Node (AIN.Calls (S)), Declarations, Statements); + (S, + AIN.First_Node (AIN.Calls (S)), + Declarations, + Statements); return CTU.Make_Function_Implementation - (Spec, Declarations, Statements); + (Spec, + Declarations, + Statements); when others => Display_Located_Error (AIN.Loc (S), - "This kind of subprogram is not supported " - & Get_Subprogram_Kind (S)'Img, + "This kind of subprogram is not supported " & + Get_Subprogram_Kind (S)'Img, Fatal => True); return No_Node; end case; @@ -2935,46 +2930,52 @@ package body Ocarina.Backends.C_Common.Mapping is (E : Node_Id; Containing_Component : Node_Id := No_Node) return Name_Id is - F : Node_Id; - Parent : Node_Id; + F : Node_Id; + Parent : Node_Id; begin Set_Str_To_Name_Buffer (""); Parent := No_Node; -- default init. - if Get_Connection_Pattern (E) = Inter_Process or else - Get_Port_By_Name (E, Containing_Component) /= No_Node then + if Get_Connection_Pattern (E) = Inter_Process + or else Get_Port_By_Name (E, Containing_Component) /= No_Node + then if Get_Category_Of_Component - (Parent_Subcomponent - (Parent_Component (E))) = CC_Thread then + (Parent_Subcomponent (Parent_Component (E))) = + CC_Thread + then if Is_In (E) and then not Is_Out (E) then - if AIN.Sources (E) /= No_List and then - not AINU.Is_Empty (AIN.Sources (E)) then + if AIN.Sources (E) /= No_List + and then not AINU.Is_Empty (AIN.Sources (E)) + then F := Item (AIN.First_Node (AIN.Sources (E))); else - F := E; + F := E; Parent := - Parent_Component - (Parent_Subcomponent - (Parent_Component (E))); + Parent_Component + (Parent_Subcomponent (Parent_Component (E))); end if; else - if AIN.Destinations (E) /= No_List and then - not AINU.Is_Empty (AIN.Destinations (E)) then + if AIN.Destinations (E) /= No_List + and then not AINU.Is_Empty (AIN.Destinations (E)) + then F := Item (AIN.First_Node (AIN.Destinations (E))); else - F := E; + F := E; Parent := - Parent_Component - (Parent_Subcomponent - (Parent_Component (E))); + Parent_Component + (Parent_Subcomponent (Parent_Component (E))); end if; end if; elsif Get_Category_Of_Component - (Parent_Subcomponent (Parent_Component (E))) = CC_Process then + (Parent_Subcomponent (Parent_Component (E))) = + CC_Process + then F := E; elsif Get_Category_Of_Component - (Parent_Subcomponent (Parent_Component (E))) = CC_Device then + (Parent_Subcomponent (Parent_Component (E))) = + CC_Device + then F := E; end if; @@ -2995,10 +2996,7 @@ package body Ocarina.Backends.C_Common.Mapping is end if; end if; - Get_Name_String_And_Append - (Display_Name - (Identifier - (F))); + Get_Name_String_And_Append (Display_Name (Identifier (F))); return Name_Find; end Map_Port; @@ -3007,14 +3005,12 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Node_Name -- ------------------- - function Map_Node_Name (Processor : Node_Id) return Name_Id - is + function Map_Node_Name (Processor : Node_Id) return Name_Id is N : Name_Id; begin Set_Str_To_Name_Buffer (""); Get_Name_String - (Display_Name - (Identifier (Parent_Subcomponent (Processor)))); + (Display_Name (Identifier (Parent_Subcomponent (Processor)))); N := Name_Find; return N; end Map_Node_Name; @@ -3026,8 +3022,7 @@ package body Ocarina.Backends.C_Common.Mapping is function Map_Port_Name (E : Node_Id; Is_Global : Boolean := False; - Containing_Component : Node_Id := No_Node) - return Name_Id + Containing_Component : Node_Id := No_Node) return Name_Id is N : Name_Id; begin @@ -3046,16 +3041,13 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Bus_Name -- ------------------ - function Map_Bus_Name (Bus : Node_Id) return Name_Id - is + function Map_Bus_Name (Bus : Node_Id) return Name_Id is N : Name_Id; begin if Bus /= No_Node then Set_Str_To_Name_Buffer ("bus_"); Get_Name_String_And_Append - (Display_Name - (Identifier - (Parent_Subcomponent (Bus)))); + (Display_Name (Identifier (Parent_Subcomponent (Bus)))); else Set_Str_To_Name_Buffer ("invalid_bus"); end if; @@ -3067,10 +3059,7 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Port_Name_For_Asn1 -- ---------------------------- - function Map_Port_Name_For_Asn1 - (E : Node_Id) - return Name_Id - is + function Map_Port_Name_For_Asn1 (E : Node_Id) return Name_Id is N : Name_Id; Thread_Name : Name_Id; Parent_Name : Name_Id; @@ -3079,17 +3068,13 @@ package body Ocarina.Backends.C_Common.Mapping is Containing_Thr := Parent_Subcomponent (Parent_Component (E)); Set_Str_To_Name_Buffer ("thread-"); - Parent_Name := Display_Name - (Identifier - (Parent_Subcomponent - (Parent_Component - (Containing_Thr)))); + Parent_Name := + Display_Name + (Identifier + (Parent_Subcomponent (Parent_Component (Containing_Thr)))); Get_Name_String_And_Append (Parent_Name); Add_Str_To_Name_Buffer ("-"); - Get_Name_String_And_Append - (Display_Name - (Identifier - (Containing_Thr))); + Get_Name_String_And_Append (Display_Name (Identifier (Containing_Thr))); Thread_Name := Name_Find; Thread_Name := To_Lower (Thread_Name); @@ -3097,8 +3082,7 @@ package body Ocarina.Backends.C_Common.Mapping is Set_Str_To_Name_Buffer ("port-"); Get_Name_String_And_Append (Thread_Name); Add_Str_To_Name_Buffer ("-"); - Get_Name_String_And_Append - (Display_Name (Identifier (E))); + Get_Name_String_And_Append (Display_Name (Identifier (E))); N := Name_Find; return (To_Lower (N)); end Map_Port_Name_For_Asn1; @@ -3107,10 +3091,7 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Port_Name_Present_For_Asn1 -- ------------------------------------ - function Map_Port_Name_Present_For_Asn1 - (E : Node_Id) - return Name_Id - is + function Map_Port_Name_Present_For_Asn1 (E : Node_Id) return Name_Id is N : Name_Id; begin Get_Name_String (Map_Port_Name_For_Asn1 (E)); @@ -3125,16 +3106,14 @@ package body Ocarina.Backends.C_Common.Mapping is -------------------------------------- function Map_Port_Deployment_Destinations - (E : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id + (E : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id is N : Name_Id; begin N := Map_Port (E, Containing_Component); Get_Name_String (N); - Add_Str_To_Name_Buffer - ("_deployment_destinations"); + Add_Str_To_Name_Buffer ("_deployment_destinations"); N := To_Lower (Name_Find); return N; end Map_Port_Deployment_Destinations; @@ -3144,9 +3123,8 @@ package body Ocarina.Backends.C_Common.Mapping is ------------------ function Map_Port_Var - (E : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id + (E : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id is N : Name_Id; begin @@ -3164,9 +3142,8 @@ package body Ocarina.Backends.C_Common.Mapping is ------------------- function Map_Port_Data - (E : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id + (E : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id is N : Name_Id; begin @@ -3184,10 +3161,9 @@ package body Ocarina.Backends.C_Common.Mapping is ------------------------------------ function Map_Port_Data_With_Virtual_Bus - (E : Node_Id; - Virtual_Bus : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id + (E : Node_Id; + Virtual_Bus : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id is N : Name_Id; begin @@ -3197,7 +3173,7 @@ package body Ocarina.Backends.C_Common.Mapping is Add_Str_To_Name_Buffer ("_virtual_bus_"); Get_Name_String_And_Append - (AAN.Display_Name (AAN.Identifier (Virtual_Bus))); + (AAN.Display_Name (AAN.Identifier (Virtual_Bus))); return Name_Find; end Map_Port_Data_With_Virtual_Bus; @@ -3207,10 +3183,9 @@ package body Ocarina.Backends.C_Common.Mapping is ------------------------------------------ function Map_Port_Var_Length_With_Virtual_Bus - (E : Node_Id; - Virtual_Bus : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id + (E : Node_Id; + Virtual_Bus : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id is N : Name_Id; begin @@ -3220,7 +3195,7 @@ package body Ocarina.Backends.C_Common.Mapping is Add_Str_To_Name_Buffer ("_virtual_bus_"); Get_Name_String_And_Append - (AAN.Display_Name (AAN.Identifier (Virtual_Bus))); + (AAN.Display_Name (AAN.Identifier (Virtual_Bus))); return Name_Find; end Map_Port_Var_Length_With_Virtual_Bus; @@ -3230,9 +3205,8 @@ package body Ocarina.Backends.C_Common.Mapping is ------------------------- function Map_Port_Var_Length - (E : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id + (E : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id is N : Name_Id; begin @@ -3250,9 +3224,8 @@ package body Ocarina.Backends.C_Common.Mapping is ------------------------ function Map_Port_Var_Valid - (E : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id + (E : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id is N : Name_Id; begin @@ -3269,19 +3242,11 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Port_Deployment_Partition -- ----------------------------------- - function Map_Port_Deployment_Partition - (E : Node_Id) - return Name_Id - is + function Map_Port_Deployment_Partition (E : Node_Id) return Name_Id is begin Get_Name_String - (To_C_Name - (AIN.Name - (AIN.Identifier - (AIN.Parent_Subcomponent - (E))))); - Add_Str_To_Name_Buffer - ("_partport"); + (To_C_Name (AIN.Name (AIN.Identifier (AIN.Parent_Subcomponent (E))))); + Add_Str_To_Name_Buffer ("_partport"); return (To_Lower (Name_Find)); end Map_Port_Deployment_Partition; @@ -3289,12 +3254,13 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Time -- -------------- - function Map_Time (T : Time_Type; - Variable : Name_Id := No_Name) return Node_Id is - Time : Unsigned_Long_Long; - S : Node_Id; - Parameters : constant List_Id - := New_List (CTN.K_Parameter_List); + function Map_Time + (T : Time_Type; + Variable : Name_Id := No_Name) return Node_Id + is + Time : Unsigned_Long_Long; + S : Node_Id; + Parameters : constant List_Id := New_List (CTN.K_Parameter_List); begin case T.U is when Picosecond => @@ -3303,14 +3269,14 @@ package body Ocarina.Backends.C_Common.Mapping is -- Picosecond and Nanosecond are ignored if T.T mod 1_000_000_000 = 0 then Time := T.T / 1_000_000_000; - S := PKR.RF (RE_Pok_Time_Milliseconds); + S := PKR.RF (RE_Pok_Time_Milliseconds); else return No_Node; end if; elsif Get_Current_Backend_Kind = PolyORB_HI_C then if T.T mod 1_000_000 = 0 then Time := T.T / 1_000_000; - S := PHR.RE (RE_Microseconds); + S := PHR.RE (RE_Microseconds); else return No_Node; end if; @@ -3320,14 +3286,14 @@ package body Ocarina.Backends.C_Common.Mapping is if Get_Current_Backend_Kind = PolyORB_Kernel_C then if T.T mod 1000 = 0 then Time := T.T / 1_000_000; - S := PKR.RF (RE_Pok_Time_Milliseconds); + S := PKR.RF (RE_Pok_Time_Milliseconds); else return No_Node; end if; elsif Get_Current_Backend_Kind = PolyORB_HI_C then if T.T mod 1000 = 0 then Time := T.T / 1000; - S := PHR.RE (RE_Microseconds); + S := PHR.RE (RE_Microseconds); else return No_Node; end if; @@ -3337,10 +3303,10 @@ package body Ocarina.Backends.C_Common.Mapping is when Microsecond => if Get_Current_Backend_Kind = PolyORB_Kernel_C then Time := T.T * 1_000; - S := PKR.RF (RE_Pok_Time_Milliseconds); + S := PKR.RF (RE_Pok_Time_Milliseconds); elsif Get_Current_Backend_Kind = PolyORB_HI_C then Time := T.T; - S := PHR.RE (RE_Microseconds); + S := PHR.RE (RE_Microseconds); end if; when Millisecond => @@ -3380,16 +3346,15 @@ package body Ocarina.Backends.C_Common.Mapping is if Variable /= No_Name then Append_Node_To_List - (Make_Variable_Address - (Make_Defining_Identifier (Variable)), + (Make_Variable_Address (Make_Defining_Identifier (Variable)), Parameters); end if; Append_Node_To_List - (Make_Literal (New_Int_Value (Time, 1, 10)), Parameters); + (Make_Literal (New_Int_Value (Time, 1, 10)), + Parameters); - return Make_Call_Profile - (S, Parameters); + return Make_Call_Profile (S, Parameters); end Map_Time; ----------------------------- @@ -3413,8 +3378,7 @@ package body Ocarina.Backends.C_Common.Mapping is Time := T.T / 1_000_000; when others => - raise Program_Error with - "time value not handled at this time"; + raise Program_Error with "time value not handled at this time"; end case; return Make_Literal (New_Int_Value (Time, 1, 10)); @@ -3453,16 +3417,16 @@ package body Ocarina.Backends.C_Common.Mapping is -------------------------------- function Map_Queue_Size_With_Data (Port : Node_Id) return Node_Id is - Size : Node_Id; - Result : Node_Id; + Size : Node_Id; + Result : Node_Id; begin Size := CTU.Get_Data_Size (Corresponding_Instance (Port)); - Result := Make_Expression - (Left_Expr => - Map_Queue_Size (Port), - Operator => Op_Asterisk, - Right_Expr => Size); + Result := + Make_Expression + (Left_Expr => Map_Queue_Size (Port), + Operator => Op_Asterisk, + Right_Expr => Size); return Result; end Map_Queue_Size_With_Data; @@ -3472,130 +3436,134 @@ package body Ocarina.Backends.C_Common.Mapping is ---------------------- function Map_POK_Action - (Action : Supported_POK_Action; - Thread_Id : Unsigned_Long_Long := 0; - Corresponding_Error : Node_Id := No_Node) - return Node_Id is + (Action : Supported_POK_Action; + Thread_Id : Unsigned_Long_Long := 0; + Corresponding_Error : Node_Id := No_Node) return Node_Id + is N : Node_Id; begin case Action is when POK_Action_Ignore => - N := Make_Call_Profile - (RE (RE_Pok_Error_Ignore), - Make_List_Id - (Copy_Node (Corresponding_Error), - Make_Literal - (New_Int_Value (Thread_Id, 1, 10)))); + N := + Make_Call_Profile + (RE (RE_Pok_Error_Ignore), + Make_List_Id + (Copy_Node (Corresponding_Error), + Make_Literal (New_Int_Value (Thread_Id, 1, 10)))); when POK_Action_Confirm => - N := Make_Call_Profile - (RE (RE_Pok_Error_Ignore), - Make_List_Id - (Copy_Node (Corresponding_Error), - Make_Literal - (New_Int_Value (Thread_Id, 1, 10)))); + N := + Make_Call_Profile + (RE (RE_Pok_Error_Ignore), + Make_List_Id + (Copy_Node (Corresponding_Error), + Make_Literal (New_Int_Value (Thread_Id, 1, 10)))); when POK_Action_Thread_Restart => - N := Make_Call_Profile - (RE (RE_Pok_Thread_Restart), - Make_List_Id (Make_Literal - (New_Int_Value (Thread_Id, 1, 10)))); + N := + Make_Call_Profile + (RE (RE_Pok_Thread_Restart), + Make_List_Id + (Make_Literal (New_Int_Value (Thread_Id, 1, 10)))); when POK_Action_Thread_Stop_And_Start_Another => Display_Error - ("The process stop and start another is not supported", - Fatal => True); + ("The process stop and start another is not supported", + Fatal => True); when POK_Action_Thread_Stop => - N := Make_Call_Profile - (RE (RE_Pok_Thread_Stop), - Make_List_Id (Make_Literal - (New_Int_Value (Thread_Id, 1, 10)))); + N := + Make_Call_Profile + (RE (RE_Pok_Thread_Stop), + Make_List_Id + (Make_Literal (New_Int_Value (Thread_Id, 1, 10)))); when POK_Action_Partition_Restart => - N := Make_Call_Profile - (RE (RE_Pok_Partition_Set_Mode), - Make_List_Id (RE (RE_Pok_Partition_Mode_Init_Warm))); + N := + Make_Call_Profile + (RE (RE_Pok_Partition_Set_Mode), + Make_List_Id (RE (RE_Pok_Partition_Mode_Init_Warm))); - when POK_Action_Partition_Stop => - N := Make_Call_Profile - (RF (RE_Pok_Partition_Set_Mode), - Make_List_Id (RE (RE_Pok_Partition_Mode_Stopped))); + when POK_Action_Partition_stop => + N := + Make_Call_Profile + (RF (RE_Pok_Partition_Set_Mode), + Make_List_Id (RE (RE_Pok_Partition_Mode_Stopped))); when POK_Action_Nothing => Display_Error - ("The nothing action cannot be raised at thread level", - Fatal => True); + ("The nothing action cannot be raised at thread level", + Fatal => True); when others => - Display_Error - ("Invalid action for a thread", - Fatal => True); + Display_Error ("Invalid action for a thread", Fatal => True); end case; return N; end Map_POK_Action; function Map_POK_Action - (Action : Supported_ARINC653_Action; - Thread_Id : Unsigned_Long_Long := 0; - Corresponding_Error : Node_Id := No_Node) - return Node_Id is + (Action : Supported_ARINC653_Action; + Thread_Id : Unsigned_Long_Long := 0; + Corresponding_Error : Node_Id := No_Node) return Node_Id + is N : Node_Id; begin case Action is when ARINC653_Action_Ignore => - N := Make_Call_Profile - (RE (RE_Pok_Error_Ignore), - Make_List_Id - (Copy_Node (Corresponding_Error), - Make_Literal - (New_Int_Value (Thread_Id, 1, 10)))); + N := + Make_Call_Profile + (RE (RE_Pok_Error_Ignore), + Make_List_Id + (Copy_Node (Corresponding_Error), + Make_Literal (New_Int_Value (Thread_Id, 1, 10)))); when ARINC653_Action_Confirm => - N := Make_Call_Profile - (RE (RE_Pok_Error_Confirm), - Make_List_Id - (Copy_Node (Corresponding_Error), - Make_Literal - (New_Int_Value (Thread_Id, 1, 10)))); + N := + Make_Call_Profile + (RE (RE_Pok_Error_Confirm), + Make_List_Id + (Copy_Node (Corresponding_Error), + Make_Literal (New_Int_Value (Thread_Id, 1, 10)))); when ARINC653_Action_Process_Restart => - N := Make_Call_Profile - (RF (RE_Pok_Thread_Restart), - Make_List_Id (Make_Literal - (New_Int_Value (Thread_Id, 1, 10)))); + N := + Make_Call_Profile + (RF (RE_Pok_Thread_Restart), + Make_List_Id + (Make_Literal (New_Int_Value (Thread_Id, 1, 10)))); when ARINC653_Action_Process_Stop_And_Start_Another => Display_Error - ("The process stop and start another is not supported", - Fatal => True); + ("The process stop and start another is not supported", + Fatal => True); when ARINC653_Action_Process_Stop => - N := Make_Call_Profile - (RF (RE_Pok_Thread_Stop), - Make_List_Id (Make_Literal - (New_Int_Value (Thread_Id, 1, 10)))); + N := + Make_Call_Profile + (RF (RE_Pok_Thread_Stop), + Make_List_Id + (Make_Literal (New_Int_Value (Thread_Id, 1, 10)))); when ARINC653_Action_Partition_Restart => - N := Make_Call_Profile - (RF (RE_Pok_Partition_Set_Mode), - Make_List_Id (RE (RE_Pok_Partition_Mode_Init_Warm))); + N := + Make_Call_Profile + (RF (RE_Pok_Partition_Set_Mode), + Make_List_Id (RE (RE_Pok_Partition_Mode_Init_Warm))); when ARINC653_Action_Partition_Stop => - N := Make_Call_Profile - (RF (RE_Pok_Partition_Set_Mode), - Make_List_Id (RE (RE_Pok_Partition_Mode_Stopped))); + N := + Make_Call_Profile + (RF (RE_Pok_Partition_Set_Mode), + Make_List_Id (RE (RE_Pok_Partition_Mode_Stopped))); when ARINC653_Action_Nothing => Display_Error - ("The nothing action cannot be raised at thread level", - Fatal => True); + ("The nothing action cannot be raised at thread level", + Fatal => True); when others => - Display_Error - ("Invalid action for a thread", - Fatal => True); + Display_Error ("Invalid action for a thread", Fatal => True); end case; return N; @@ -3606,110 +3574,112 @@ package body Ocarina.Backends.C_Common.Mapping is ----------------------------- function Map_POK_Kernel_Action - (Action : Supported_POK_Action; + (Action : Supported_POK_Action; Partition_Id : Unsigned_Long_Long := 0; - Kernel_Level : Boolean := True) - return Node_Id is + Kernel_Level : Boolean := True) return Node_Id + is N : Node_Id; begin case Action is when POK_Action_Ignore => - N := Make_Call_Profile - (RE (RE_Pok_Error_Ignore), No_List); + N := Make_Call_Profile (RE (RE_Pok_Error_Ignore), No_List); when POK_Action_Kernel_Stop => - N := Make_Call_Profile - (RE (RE_Pok_Kernel_Stop), No_List); + N := Make_Call_Profile (RE (RE_Pok_Kernel_Stop), No_List); when POK_Action_Kernel_Restart => - N := Make_Call_Profile - (RE (RE_Pok_Kernel_Restart), No_List); + N := Make_Call_Profile (RE (RE_Pok_Kernel_Restart), No_List); when POK_Action_Partition_Restart => - N := Make_Call_Profile - (RE (RE_Pok_Partition_Set_Mode), - Make_List_Id - (Make_Literal (New_Int_Value (Partition_Id, 1, 10)), - RE (RE_Pok_Partition_Mode_Init_Warm))); - - when POK_Action_Partition_Stop => - N := Make_Call_Profile - (RE (RE_Pok_Partition_Set_Mode), - Make_List_Id - (Make_Literal (New_Int_Value (Partition_Id, 1, 10)), - RE (RE_Pok_Partition_Mode_Stopped))); + N := + Make_Call_Profile + (RE (RE_Pok_Partition_Set_Mode), + Make_List_Id + (Make_Literal (New_Int_Value (Partition_Id, 1, 10)), + RE (RE_Pok_Partition_Mode_Init_Warm))); + + when POK_Action_Partition_stop => + N := + Make_Call_Profile + (RE (RE_Pok_Partition_Set_Mode), + Make_List_Id + (Make_Literal (New_Int_Value (Partition_Id, 1, 10)), + RE (RE_Pok_Partition_Mode_Stopped))); when POK_Action_Nothing => if Kernel_Level then - N := Make_Call_Profile - (RE (RE_Pok_Error_Kernel_CallBack), No_List); + N := + Make_Call_Profile + (RE (RE_Pok_Error_Kernel_Callback), + No_List); else - N := Make_Call_Profile - (RE (RE_Pok_Error_Partition_Callback), - Make_List_Id - (Make_Literal - (New_Int_Value (Partition_Id, 1, 10)))); + N := + Make_Call_Profile + (RE (RE_Pok_Error_Partition_Callback), + Make_List_Id + (Make_Literal (New_Int_Value (Partition_Id, 1, 10)))); end if; when others => Display_Error - ("Invalid action for a partition or the kernel", - Fatal => True); + ("Invalid action for a partition or the kernel", + Fatal => True); end case; return N; end Map_POK_Kernel_Action; function Map_POK_Kernel_Action - (Action : Supported_ARINC653_Action; + (Action : Supported_ARINC653_Action; Partition_Id : Unsigned_Long_Long := 0; - Kernel_Level : Boolean := True) - return Node_Id is + Kernel_Level : Boolean := True) return Node_Id + is N : Node_Id; begin case Action is when ARINC653_Action_Ignore => - N := Make_Call_Profile - (RE (RE_Pok_Error_Ignore), No_List); + N := Make_Call_Profile (RE (RE_Pok_Error_Ignore), No_List); when ARINC653_Action_Module_Stop => - N := Make_Call_Profile - (RE (RE_Pok_Kernel_Stop), No_List); + N := Make_Call_Profile (RE (RE_Pok_Kernel_Stop), No_List); when ARINC653_Action_Module_Restart => - N := Make_Call_Profile - (RE (RE_Pok_Kernel_Restart), No_List); + N := Make_Call_Profile (RE (RE_Pok_Kernel_Restart), No_List); when ARINC653_Action_Partition_Restart => - N := Make_Call_Profile - (RE (RE_Pok_Partition_Set_Mode), - Make_List_Id - (Make_Literal (New_Int_Value (Partition_Id, 1, 10)), - RE (RE_Pok_Partition_Mode_Init_Warm))); + N := + Make_Call_Profile + (RE (RE_Pok_Partition_Set_Mode), + Make_List_Id + (Make_Literal (New_Int_Value (Partition_Id, 1, 10)), + RE (RE_Pok_Partition_Mode_Init_Warm))); when ARINC653_Action_Partition_Stop => - N := Make_Call_Profile - (RE (RE_Pok_Partition_Set_Mode), - Make_List_Id - (Make_Literal (New_Int_Value (Partition_Id, 1, 10)), - RE (RE_Pok_Partition_Mode_Stopped))); + N := + Make_Call_Profile + (RE (RE_Pok_Partition_Set_Mode), + Make_List_Id + (Make_Literal (New_Int_Value (Partition_Id, 1, 10)), + RE (RE_Pok_Partition_Mode_Stopped))); when ARINC653_Action_Nothing => if Kernel_Level then - N := Make_Call_Profile - (RE (RE_Pok_Error_Kernel_CallBack), No_List); + N := + Make_Call_Profile + (RE (RE_Pok_Error_Kernel_Callback), + No_List); else - N := Make_Call_Profile - (RE (RE_Pok_Error_Partition_Callback), - Make_List_Id - (Make_Literal - (New_Int_Value (Partition_Id, 1, 10)))); + N := + Make_Call_Profile + (RE (RE_Pok_Error_Partition_Callback), + Make_List_Id + (Make_Literal (New_Int_Value (Partition_Id, 1, 10)))); end if; when others => Display_Error - ("Invalid action for a partition or the kernel", - Fatal => True); + ("Invalid action for a partition or the kernel", + Fatal => True); end case; return N; @@ -3735,71 +3705,70 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_POK_Error -- --------------------- - function Map_POK_Error (Error : Supported_POK_Error) - return Node_Id is + function Map_POK_Error (Error : Supported_POK_Error) return Node_Id is begin case Error is - -- Here, for each error, we create a switch - -- case that will handle each declared error. + -- Here, for each error, we create a switch + -- case that will handle each declared error. - when POK_Error_Deadline_Missed => - if POK_Flavor = ARINC653 then - return RE (RE_Deadline_Missed); - else - return RE (RE_Pok_Error_Kind_Deadline_Missed); - end if; + when POK_Error_Deadline_Missed => + if POK_Flavor = ARINC653 then + return RE (RE_Deadline_Missed); + else + return RE (RE_Pok_Error_Kind_Deadline_Missed); + end if; - when POK_Error_Application => - if POK_Flavor = ARINC653 then - return RE (RE_Application_Error); - else - return RE (RE_Pok_Error_Kind_Application_Error); - end if; + when POK_Error_Application => + if POK_Flavor = ARINC653 then + return RE (RE_Application_Error); + else + return RE (RE_Pok_Error_Kind_Application_Error); + end if; - when POK_Error_Numeric => - if POK_Flavor = ARINC653 then - return RE (RE_Numeric_Error); - else - return RE (RE_Pok_Error_Kind_Numeric_Error); - end if; + when POK_Error_Numeric => + if POK_Flavor = ARINC653 then + return RE (RE_Numeric_Error); + else + return RE (RE_Pok_Error_Kind_Numeric_Error); + end if; - when POK_Error_Illegal_Request => - if POK_Flavor = ARINC653 then - return RE (RE_Illegal_Request); - else - return RE (RE_Pok_Error_Kind_Illegal_Request); - end if; + when POK_Error_Illegal_Request => + if POK_Flavor = ARINC653 then + return RE (RE_Illegal_Request); + else + return RE (RE_Pok_Error_Kind_Illegal_Request); + end if; - when POK_Error_Stack_Overflow => - if POK_Flavor = ARINC653 then - return RE (RE_Stack_Overflow); - else - return RE (RE_Pok_Error_Kind_Stack_Overflow); - end if; + when POK_Error_Stack_Overflow => + if POK_Flavor = ARINC653 then + return RE (RE_Stack_Overflow); + else + return RE (RE_Pok_Error_Kind_Stack_Overflow); + end if; - when POK_Error_Memory_Violation => - if POK_Flavor = ARINC653 then - return RE (RE_Memory_Violation); - else - return RE (RE_Pok_Error_Kind_Memory_Violation); - end if; + when POK_Error_Memory_Violation => + if POK_Flavor = ARINC653 then + return RE (RE_Memory_Violation); + else + return RE (RE_Pok_Error_Kind_Memory_Violation); + end if; - when POK_Error_Hardware_Fault => - if POK_Flavor = ARINC653 then - return RE (RE_Hardware_Fault); - else - return RE (RE_Pok_Error_Kind_Hardware_Fault); - end if; + when POK_Error_Hardware_Fault => + if POK_Flavor = ARINC653 then + return RE (RE_Hardware_Fault); + else + return RE (RE_Pok_Error_Kind_Hardware_Fault); + end if; - when POK_Error_Power_Fail => - if POK_Flavor = ARINC653 then - return RE (RE_Power_Fail); - else - return RE (RE_Pok_Error_Kind_Power_Fail); - end if; + when POK_Error_Power_Fail => + if POK_Flavor = ARINC653 then + return RE (RE_Power_Fail); + else + return RE (RE_Pok_Error_Kind_Power_Fail); + end if; - when others => - return No_Node; + when others => + return No_Node; end case; end Map_POK_Error; @@ -3807,71 +3776,72 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_ARINC653_Error -- -------------------------- - function Map_ARINC653_Error (Error : Supported_ARINC653_Error) - return Node_Id is + function Map_ARINC653_Error + (Error : Supported_ARINC653_Error) return Node_Id + is begin case Error is - -- Here, for each error, we create a switch - -- case that will handle each declared error. + -- Here, for each error, we create a switch + -- case that will handle each declared error. - when ARINC653_Error_Deadline_Miss => - if POK_Flavor = ARINC653 then - return RE (RE_Deadline_Missed); - else - return RE (RE_Pok_Error_Kind_Deadline_Missed); - end if; + when ARINC653_Error_Deadline_Miss => + if POK_Flavor = ARINC653 then + return RE (RE_Deadline_Missed); + else + return RE (RE_Pok_Error_Kind_Deadline_Missed); + end if; - when ARINC653_Error_Application => - if POK_Flavor = ARINC653 then - return RE (RE_Application_Error); - else - return RE (RE_Pok_Error_Kind_Application_Error); - end if; + when ARINC653_Error_Application => + if POK_Flavor = ARINC653 then + return RE (RE_Application_Error); + else + return RE (RE_Pok_Error_Kind_Application_Error); + end if; - when ARINC653_Error_Numeric => - if POK_Flavor = ARINC653 then - return RE (RE_Numeric_Error); - else - return RE (RE_Pok_Error_Kind_Numeric_Error); - end if; + when ARINC653_Error_Numeric => + if POK_Flavor = ARINC653 then + return RE (RE_Numeric_Error); + else + return RE (RE_Pok_Error_Kind_Numeric_Error); + end if; - when ARINC653_Error_Illegal_Request => - if POK_Flavor = ARINC653 then - return RE (RE_Illegal_Request); - else - return RE (RE_Pok_Error_Kind_Illegal_Request); - end if; + when ARINC653_Error_Illegal_Request => + if POK_Flavor = ARINC653 then + return RE (RE_Illegal_Request); + else + return RE (RE_Pok_Error_Kind_Illegal_Request); + end if; - when ARINC653_Error_Stack_Overflow => - if POK_Flavor = ARINC653 then - return RE (RE_Stack_Overflow); - else - return RE (RE_Pok_Error_Kind_Stack_Overflow); - end if; + when ARINC653_Error_Stack_Overflow => + if POK_Flavor = ARINC653 then + return RE (RE_Stack_Overflow); + else + return RE (RE_Pok_Error_Kind_Stack_Overflow); + end if; - when ARINC653_Error_Memory_Violation => - if POK_Flavor = ARINC653 then - return RE (RE_Memory_Violation); - else - return RE (RE_Pok_Error_Kind_Memory_Violation); - end if; + when ARINC653_Error_Memory_Violation => + if POK_Flavor = ARINC653 then + return RE (RE_Memory_Violation); + else + return RE (RE_Pok_Error_Kind_Memory_Violation); + end if; - when ARINC653_Error_Hardware_Fault => - if POK_Flavor = ARINC653 then - return RE (RE_Hardware_Fault); - else - return RE (RE_Pok_Error_Kind_Hardware_Fault); - end if; + when ARINC653_Error_Hardware_Fault => + if POK_Flavor = ARINC653 then + return RE (RE_Hardware_Fault); + else + return RE (RE_Pok_Error_Kind_Hardware_Fault); + end if; - when ARINC653_Error_Power_Fail => - if POK_Flavor = ARINC653 then - return RE (RE_Power_Fail); - else - return RE (RE_Pok_Error_Kind_Power_Fail); - end if; + when ARINC653_Error_Power_Fail => + if POK_Flavor = ARINC653 then + return RE (RE_Power_Fail); + else + return RE (RE_Pok_Error_Kind_Power_Fail); + end if; - when others => - return No_Node; + when others => + return No_Node; end case; end Map_ARINC653_Error; @@ -3879,12 +3849,11 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Device_Function_Read -- -------------------------------- - function Map_Device_Function_Read (Device : Node_Id) return Name_Id - is + function Map_Device_Function_Read (Device : Node_Id) return Name_Id is begin Set_Str_To_Name_Buffer (""); Get_Name_String - (To_C_Name (Get_String_Property (Device, "pok::device_name"))); + (To_C_Name (Get_String_Property (Device, "pok::device_name"))); Add_Str_To_Name_Buffer ("_read"); return Name_Find; end Map_Device_Function_Read; @@ -3893,12 +3862,11 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Device_Function_Write -- --------------------------------- - function Map_Device_Function_Write (Device : Node_Id) return Name_Id - is + function Map_Device_Function_Write (Device : Node_Id) return Name_Id is begin Set_Str_To_Name_Buffer (""); Get_Name_String - (To_C_Name (Get_String_Property (Device, "pok::device_name"))); + (To_C_Name (Get_String_Property (Device, "pok::device_name"))); Add_Str_To_Name_Buffer ("_write"); return Name_Find; end Map_Device_Function_Write; @@ -3908,23 +3876,23 @@ package body Ocarina.Backends.C_Common.Mapping is ----------------------------- procedure Map_Virtual_Bus_Calls - (Port : Node_Id; - Declarations : List_Id; - Statements : List_Id; - Handled_Kind : Virtual_Bus_Call_Kind; + (Port : Node_Id; + Declarations : List_Id; + Statements : List_Id; + Handled_Kind : Virtual_Bus_Call_Kind; New_Data : out Node_Id; New_Size : out Node_Id; - Containing_Component : Node_Id := No_Node) + Containing_Component : Node_Id := No_Node) is - Virtual_Buses : List_Id; - Virtual_Bus : Node_Id; - Implementation : Node_Id; - Subprogram : Node_Id; - Function_Call : Node_Id; - Property_Node : Node_Id; - Tmp_Node : Node_Id; - VB_Type : Node_Id; - Marshall_Type : Node_Id := No_Node; + Virtual_Buses : List_Id; + Virtual_Bus : Node_Id; + Implementation : Node_Id; + Subprogram : Node_Id; + Function_Call : Node_Id; + Property_Node : Node_Id; + Tmp_Node : Node_Id; + VB_Type : Node_Id; + Marshall_Type : Node_Id := No_Node; Call_Parameters : List_Id; begin New_Data := No_Node; @@ -3939,9 +3907,9 @@ package body Ocarina.Backends.C_Common.Mapping is Tmp_Node := AAN.First_Node (Virtual_Buses); while Present (Tmp_Node) loop - Virtual_Bus := AAN.Entity (Tmp_Node); - Property_Node := Look_For_Property_In_Declarative - (Virtual_Bus, "implemented_as"); + Virtual_Bus := AAN.Entity (Tmp_Node); + Property_Node := + Look_For_Property_In_Declarative (Virtual_Bus, "implemented_as"); -- Now, we are trying to catch the value of the "Implemented_As" -- property of the virtual bus. The virtual bus should have @@ -3958,33 +3926,34 @@ package body Ocarina.Backends.C_Common.Mapping is -- Here, get the type we use to marshall data - VB_Type := Look_For_Subcomponent_In_Declarative - (Implementation, "marshalling_type"); + VB_Type := + Look_For_Subcomponent_In_Declarative + (Implementation, + "marshalling_type"); if VB_Type /= No_Node then - Property_Node := Look_For_Property_In_Declarative - (VB_Type, "type_source_name"); + Property_Node := + Look_For_Property_In_Declarative (VB_Type, "type_source_name"); if Property_Node /= No_Node then Marshall_Type := - Make_Defining_Identifier - (Get_String_Of_Property_Value - (AAN.Single_Value (Property_Node))); + Make_Defining_Identifier + (Get_String_Of_Property_Value + (AAN.Single_Value (Property_Node))); end if; end if; if Marshall_Type = No_Node then - Marshall_Type := - Make_Defining_Identifier (TN (T_Int)); + Marshall_Type := Make_Defining_Identifier (TN (T_Int)); end if; -- Finished to retrieve the type used to marshall data if Handled_Kind = Sending then - Subprogram := Look_For_Subcomponent_In_Declarative - (Implementation, "send"); + Subprogram := + Look_For_Subcomponent_In_Declarative (Implementation, "send"); else - Subprogram := Look_For_Subcomponent_In_Declarative - (Implementation, "receive"); + Subprogram := + Look_For_Subcomponent_In_Declarative (Implementation, "receive"); end if; -- We catch the subprogram relevant for sending/receiving data. @@ -3993,40 +3962,38 @@ package body Ocarina.Backends.C_Common.Mapping is return; end if; - Property_Node := Look_For_Property_In_Declarative - (Subprogram, "source_name"); + Property_Node := + Look_For_Property_In_Declarative (Subprogram, "source_name"); -- Here, the Source_Name property corresponds to the -- name of the subprogram. This subprogram is contained -- in an abstract component. if Property_Node /= No_Node then Append_Node_To_List - (Make_Variable_Declaration - (Defining_Identifier => - (Make_Defining_Identifier - (Map_Port_Data_With_Virtual_Bus - (Port, - Virtual_Bus, - Containing_Component))), - Used_type => - Get_Type_Identifier_Associated_With_Virtual_Bus - (Port)), - Declarations); + (Make_Variable_Declaration + (Defining_Identifier => + (Make_Defining_Identifier + (Map_Port_Data_With_Virtual_Bus + (Port, + Virtual_Bus, + Containing_Component))), + Used_Type => + Get_Type_Identifier_Associated_With_Virtual_Bus (Port)), + Declarations); -- Declare the variable that will store the result -- of the virtual bus invokation. Append_Node_To_List - (Make_Variable_Declaration - (Defining_Identifier => - (Make_Defining_Identifier - (Map_Port_Var_Length_With_Virtual_Bus - (Port, - Virtual_Bus, - Containing_Component))), - Used_type => - (RE (RE_Size_T))), - Declarations); + (Make_Variable_Declaration + (Defining_Identifier => + (Make_Defining_Identifier + (Map_Port_Var_Length_With_Virtual_Bus + (Port, + Virtual_Bus, + Containing_Component))), + Used_Type => (RE (RE_Size_T))), + Declarations); -- Declare the variable that will store data length -- of the virtual bus invokation. @@ -4034,43 +4001,48 @@ package body Ocarina.Backends.C_Common.Mapping is Call_Parameters := New_List (CTN.K_Parameter_List); if Handled_Kind = Sending then - -- Here, it is the order of the sending side. - -- We invoke the function like this: - -- - -- receiving_function - -- (data_to_marshall, size, data_marshalled, size) - - if Get_Data_Representation - (Corresponding_Instance (Port)) = Data_Array then + -- Here, it is the order of the sending side. + -- We invoke the function like this: + -- + -- receiving_function + -- (data_to_marshall, size, data_marshalled, size) + + if Get_Data_Representation (Corresponding_Instance (Port)) = + Data_Array + then Append_Node_To_List - (Make_Defining_Identifier - (Map_Port_Data - (Port, Containing_Component)), - Call_Parameters); + (Make_Defining_Identifier + (Map_Port_Data (Port, Containing_Component)), + Call_Parameters); else Append_Node_To_List - (Make_Variable_Address - (Make_Defining_Identifier - (Map_Port_Data - (Port, Containing_Component))), - Call_Parameters); + (Make_Variable_Address + (Make_Defining_Identifier + (Map_Port_Data (Port, Containing_Component))), + Call_Parameters); end if; - Append_Node_To_List (Get_Data_Size - (Corresponding_Instance (Port)), - Call_Parameters); + Append_Node_To_List + (Get_Data_Size (Corresponding_Instance (Port)), + Call_Parameters); Append_Node_To_List - (Make_Variable_Address (Make_Defining_Identifier - (Map_Port_Data_With_Virtual_Bus - (Port, Virtual_Bus, Containing_Component))), - Call_Parameters); + (Make_Variable_Address + (Make_Defining_Identifier + (Map_Port_Data_With_Virtual_Bus + (Port, + Virtual_Bus, + Containing_Component))), + Call_Parameters); Append_Node_To_List - (Make_Variable_Address (Make_Defining_Identifier - (Map_Port_Var_Length_With_Virtual_Bus - (Port, Virtual_Bus, Containing_Component))), - Call_Parameters); + (Make_Variable_Address + (Make_Defining_Identifier + (Map_Port_Var_Length_With_Virtual_Bus + (Port, + Virtual_Bus, + Containing_Component))), + Call_Parameters); elsif Handled_Kind = Receiving then @@ -4081,57 +4053,65 @@ package body Ocarina.Backends.C_Common.Mapping is -- (data_to_unmarshall, size, data_unmarshalled, size) Append_Node_To_List - (Make_Variable_Address - (Make_Defining_Identifier - (Map_Port_Data_With_Virtual_Bus - (Port, Virtual_Bus, Containing_Component))), - Call_Parameters); + (Make_Variable_Address + (Make_Defining_Identifier + (Map_Port_Data_With_Virtual_Bus + (Port, + Virtual_Bus, + Containing_Component))), + Call_Parameters); Append_Node_To_List - (CTU.Get_Data_Size (Corresponding_Instance (Port)), + (CTU.Get_Data_Size (Corresponding_Instance (Port)), Call_Parameters); - if Get_Data_Representation - (Corresponding_Instance (Port)) = Data_Array then + if Get_Data_Representation (Corresponding_Instance (Port)) = + Data_Array + then Append_Node_To_List - (Make_Defining_Identifier - (Map_Port_Data - (Port, Containing_Component)), - Call_Parameters); + (Make_Defining_Identifier + (Map_Port_Data (Port, Containing_Component)), + Call_Parameters); else Append_Node_To_List - (Make_Variable_Address - (Make_Defining_Identifier - (Map_Port_Data - (Port, Containing_Component))), - Call_Parameters); + (Make_Variable_Address + (Make_Defining_Identifier + (Map_Port_Data (Port, Containing_Component))), + Call_Parameters); end if; Append_Node_To_List - (Make_Variable_Address (Make_Defining_Identifier - (Map_Port_Var_Length - (Port, Containing_Component))), - Call_Parameters); + (Make_Variable_Address + (Make_Defining_Identifier + (Map_Port_Var_Length (Port, Containing_Component))), + Call_Parameters); end if; - Function_Call := Make_Call_Profile - (Make_Defining_Identifier - (Get_String_Of_Property_Value - (AAN.Single_Value (Property_Node))), - Call_Parameters); + Function_Call := + Make_Call_Profile + (Make_Defining_Identifier + (Get_String_Of_Property_Value + (AAN.Single_Value (Property_Node))), + Call_Parameters); Append_Node_To_List (Function_Call, Statements); -- Finally, we make the final function call -- that invokes our marshaller/unmarshaller. - New_Data := Make_Defining_Identifier - (Map_Port_Data_With_Virtual_Bus - (Port, Virtual_Bus, Containing_Component)); + New_Data := + Make_Defining_Identifier + (Map_Port_Data_With_Virtual_Bus + (Port, + Virtual_Bus, + Containing_Component)); - New_Size := Make_Defining_Identifier - (Map_Port_Var_Length_With_Virtual_Bus - (Port, Virtual_Bus, Containing_Component)); + New_Size := + Make_Defining_Identifier + (Map_Port_Var_Length_With_Virtual_Bus + (Port, + Virtual_Bus, + Containing_Component)); -- We create identifier so that the backend -- can use the identifier we used in our marshall -- functions to invoke code, receive/send data/... @@ -4147,20 +4127,20 @@ package body Ocarina.Backends.C_Common.Mapping is ------------------------------------------------------- function Get_Type_Identifier_Associated_With_Virtual_Bus - (Port : Node_Id) return Node_Id + (Port : Node_Id) return Node_Id is Instance_Type : Node_Id; begin Instance_Type := Get_Instance_Type_Associated_With_Virtual_Bus (Port); - if Instance_Type /= No_Node and then - Is_Defined_Property (Instance_Type, "type_source_name") then + if Instance_Type /= No_Node + and then Is_Defined_Property (Instance_Type, "type_source_name") + then return Make_Defining_Identifier - (To_C_Name - (Get_String_Property (Instance_Type, "type_source_name"))); + (To_C_Name + (Get_String_Property (Instance_Type, "type_source_name"))); end if; - return Map_C_Data_Type_Designator - (Corresponding_Instance (Port)); + return Map_C_Data_Type_Designator (Corresponding_Instance (Port)); end Get_Type_Identifier_Associated_With_Virtual_Bus; --------------------------------------- @@ -4186,44 +4166,45 @@ package body Ocarina.Backends.C_Common.Mapping is while Present (Tmp_Node) loop Virtual_Bus := AAN.Entity (Tmp_Node); - Property_Node := Look_For_Property_In_Declarative - (Virtual_Bus, "pok::protocol"); + Property_Node := + Look_For_Property_In_Declarative (Virtual_Bus, "pok::protocol"); if Property_Node /= No_Node then if Get_Enumeration_Of_Property_Value - (AAN.Single_Value (Property_Node)) = "ceasar" then + (AAN.Single_Value (Property_Node)) = + "ceasar" + then CTU.Append_Node_To_List - (CTU.Make_Define_Statement - (Defining_Identifier => - RE (RE_Pok_Needs_Protocols_Ceasar), - Value => - CTU.Make_Literal (New_Int_Value (1, 1, 10))), + (CTU.Make_Define_Statement + (Defining_Identifier => RE (RE_Pok_Needs_Protocols_Ceasar), + Value => CTU.Make_Literal (New_Int_Value (1, 1, 10))), CTN.Declarations (CTU.Current_File)); end if; end if; if Property_Node /= No_Node then if Get_Enumeration_Of_Property_Value - (AAN.Single_Value (Property_Node)) = "des" then + (AAN.Single_Value (Property_Node)) = + "des" + then CTU.Append_Node_To_List - (CTU.Make_Define_Statement - (Defining_Identifier => - RE (RE_Pok_Needs_Protocols_Des), - Value => - CTU.Make_Literal (New_Int_Value (1, 1, 10))), + (CTU.Make_Define_Statement + (Defining_Identifier => RE (RE_Pok_Needs_Protocols_Des), + Value => CTU.Make_Literal (New_Int_Value (1, 1, 10))), CTN.Declarations (CTU.Current_File)); end if; end if; if Property_Node /= No_Node then if Get_Enumeration_Of_Property_Value - (AAN.Single_Value (Property_Node)) = "blowfish" then + (AAN.Single_Value (Property_Node)) = + "blowfish" + then CTU.Append_Node_To_List - (CTU.Make_Define_Statement - (Defining_Identifier => - RE (RE_Pok_Needs_Protocols_Blowfish), - Value => - CTU.Make_Literal (New_Int_Value (1, 1, 10))), + (CTU.Make_Define_Statement + (Defining_Identifier => + RE (RE_Pok_Needs_Protocols_Blowfish), + Value => CTU.Make_Literal (New_Int_Value (1, 1, 10))), CTN.Declarations (CTU.Current_File)); end if; end if; @@ -4233,78 +4214,80 @@ package body Ocarina.Backends.C_Common.Mapping is -- using. Depending on the detected protocol, we activate -- it in POK by declaring an appropriate macro. - Property_Node := Look_For_Property_In_Declarative - (Virtual_Bus, "pok::des_key"); + Property_Node := + Look_For_Property_In_Declarative (Virtual_Bus, "pok::des_key"); if Property_Node /= No_Node then Macro_Name := RE (RE_Pok_Protocols_Des_Key); Macro_Value := - Make_Defining_Identifier - (Get_String_Of_Property_Value - (AAN.Single_Value (Property_Node))); + Make_Defining_Identifier + (Get_String_Of_Property_Value + (AAN.Single_Value (Property_Node))); Append_Node_To_List - (Make_Define_Statement - (Defining_Identifier => Macro_Name, - Value => Macro_Value), + (Make_Define_Statement + (Defining_Identifier => Macro_Name, + Value => Macro_Value), CTN.Declarations (CTU.Current_File)); end if; - Property_Node := Look_For_Property_In_Declarative - (Virtual_Bus, "pok::des_init"); + Property_Node := + Look_For_Property_In_Declarative (Virtual_Bus, "pok::des_init"); if Property_Node /= No_Node then Macro_Name := RE (RE_Pok_Protocols_Des_Init); Macro_Value := - Make_Defining_Identifier - (Get_String_Of_Property_Value - (AAN.Single_Value (Property_Node))); + Make_Defining_Identifier + (Get_String_Of_Property_Value + (AAN.Single_Value (Property_Node))); Append_Node_To_List - (Make_Define_Statement - (Defining_Identifier => Macro_Name, - Value => Macro_Value), + (Make_Define_Statement + (Defining_Identifier => Macro_Name, + Value => Macro_Value), CTN.Declarations (CTU.Current_File)); end if; -- The part declares all the code required -- to configure the DES cipher algorithm. - Property_Node := Look_For_Property_In_Declarative - (Virtual_Bus, "pok::blowfish_init"); + Property_Node := + Look_For_Property_In_Declarative + (Virtual_Bus, + "pok::blowfish_init"); if Property_Node /= No_Node then Macro_Name := RE (RE_Pok_Protocols_Blowfish_Init); Macro_Value := - Make_Defining_Identifier - (Get_String_Of_Property_Value - (AAN.Single_Value (Property_Node))); + Make_Defining_Identifier + (Get_String_Of_Property_Value + (AAN.Single_Value (Property_Node))); Append_Node_To_List - (Make_Define_Statement - (Defining_Identifier => Macro_Name, - Value => Macro_Value), + (Make_Define_Statement + (Defining_Identifier => Macro_Name, + Value => Macro_Value), CTN.Declarations (CTU.Current_File)); end if; - Property_Node := Look_For_Property_In_Declarative - (Virtual_Bus, "pok::blowfish_key"); + Property_Node := + Look_For_Property_In_Declarative (Virtual_Bus, "pok::blowfish_key"); if Property_Node /= No_Node then Macro_Name := RE (RE_Pok_Protocols_Blowfish_Key); Macro_Value := - Make_Defining_Identifier - (Get_String_Of_Property_Value - (AAN.Single_Value (Property_Node))); + Make_Defining_Identifier + (Get_String_Of_Property_Value + (AAN.Single_Value (Property_Node))); Append_Node_To_List - (Make_Define_Statement - (Defining_Identifier => Macro_Name, - Value => Macro_Value), + (Make_Define_Statement + (Defining_Identifier => Macro_Name, + Value => Macro_Value), CTN.Declarations (CTU.Current_File)); - -- The part declares all the code required - -- to configure the blowfish cipher algorithm. + -- The part declares all the code required + -- to configure the blowfish cipher algorithm. end if; Tmp_Node := AAN.Next_Node (Tmp_Node); @@ -4315,16 +4298,12 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Devices_Buses_Array_Name -- ---------------------------------- - function Map_Devices_Buses_Array_Name - (E : Node_Id) - return Name_Id - is + function Map_Devices_Buses_Array_Name (E : Node_Id) return Name_Id is begin if AINU.Is_Device (E) then Set_Str_To_Name_Buffer ("device_"); Get_Name_String_And_Append - (AIN.Name - (AIN.Identifier (Parent_Subcomponent (E)))); + (AIN.Name (AIN.Identifier (Parent_Subcomponent (E)))); Add_Str_To_Name_Buffer ("_accessed_buses"); return Name_Find; end if; @@ -4335,16 +4314,12 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_Device_Confvar_Name -- ----------------------------- - function Map_Device_Confvar_Name - (E : Node_Id) - return Name_Id - is + function Map_Device_Confvar_Name (E : Node_Id) return Name_Id is begin if AINU.Is_Device (E) then Set_Str_To_Name_Buffer ("pohidrv_"); Get_Name_String_And_Append - (AIN.Name - (AIN.Identifier (Parent_Subcomponent (E)))); + (AIN.Name (AIN.Identifier (Parent_Subcomponent (E)))); return Name_Find; end if; return No_Name; @@ -4354,8 +4329,7 @@ package body Ocarina.Backends.C_Common.Mapping is -- Map_ASN_Type -- ------------------ - function Map_ASN_Type (ASN_Name : Name_Id) return Name_Id - is + function Map_ASN_Type (ASN_Name : Name_Id) return Name_Id is Converted : Name_Id; begin Set_Str_To_Name_Buffer ("__po_hi_c_"); diff --git a/src/backends/ocarina-backends-c_common-mapping.ads b/src/backends/ocarina-backends-c_common-mapping.ads index 75395ce8..e352aaec 100644 --- a/src/backends/ocarina-backends-c_common-mapping.ads +++ b/src/backends/ocarina-backends-c_common-mapping.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -48,9 +48,9 @@ package Ocarina.Backends.C_Common.Mapping is -- Tree binding operations function Map_Distributed_Application (E : Node_Id) return Node_Id; - function Map_HI_Node (E : Node_Id; - Kernel : Boolean := False) - return Node_Id; + function Map_HI_Node + (E : Node_Id; + Kernel : Boolean := False) return Node_Id; function Map_HI_Unit (E : Node_Id) return Node_Id; procedure Bind_AADL_To_Activity (G : Node_Id; A : Node_Id); procedure Bind_AADL_To_Global_Names (G : Node_Id; A : Node_Id); @@ -65,31 +65,30 @@ package Ocarina.Backends.C_Common.Mapping is procedure Bind_AADL_To_Servers (G : Node_Id; A : Node_Id); procedure Bind_AADL_To_Entities (G : Node_Id; A : Node_Id); function Map_Task_Job_Identifier - (E : Node_Id; Prefix_Component : Node_Id := No_Node) - return Node_Id; - function Map_Time (T : Time_Type; - Variable : Name_Id := No_Name) return Node_Id; + (E : Node_Id; + Prefix_Component : Node_Id := No_Node) return Node_Id; + function Map_Time + (T : Time_Type; + Variable : Name_Id := No_Name) return Node_Id; function Map_C_Enum_Name (E : Node_Id; Enumerator : Name_Id) return Name_Id; - function Map_C_Enumerator_Name (E : Node_Id; - Custom_Parent : Node_Id := No_Node; - Entity : Boolean := False; - Server : Boolean := False; - Port_Type : Boolean := False; - Local_Port : Boolean := False) - return Name_Id; + function Map_C_Enumerator_Name + (E : Node_Id; + Custom_Parent : Node_Id := No_Node; + Entity : Boolean := False; + Server : Boolean := False; + Port_Type : Boolean := False; + Local_Port : Boolean := False) return Name_Id; function Map_C_Define_Name - (E : Node_Id; - Nb_Ports : Boolean := False) return Name_Id; + (E : Node_Id; + Nb_Ports : Boolean := False) return Name_Id; function Map_C_Full_Parameter_Name (Spg : Node_Id; P : Node_Id; - Suffix : Character := ASCII.NUL) - return Name_Id; + Suffix : Character := ASCII.NUL) return Name_Id; function Map_C_Feature_Subprogram (A : Node_Id; - Owner : Node_Id := No_Node) - return Node_Id; + Owner : Node_Id := No_Node) return Node_Id; -- Maps an Identifier from the given Subprogram spec instance. If -- Owner is not given (typically when mapping a data component -- instance to a C type) deduce it from the parent component of @@ -100,7 +99,8 @@ package Ocarina.Backends.C_Common.Mapping is function Map_C_Data_Type_Designator (E : Node_Id) return Node_Id; function Map_C_Defining_Identifier - (A : Node_Id; Is_Pointer : Boolean := False) return Node_Id; + (A : Node_Id; + Is_Pointer : Boolean := False) return Node_Id; procedure Bind_AADL_To_Type_Definition (G : Node_Id; A : Node_Id); procedure Bind_AADL_To_Process_Request (G : Node_Id; A : Node_Id); procedure Bind_AADL_To_Types (G : Node_Id; A : Node_Id); @@ -114,25 +114,20 @@ package Ocarina.Backends.C_Common.Mapping is procedure Bind_AADL_To_Global_Port (G : Node_Id; A : Node_Id); function Map_Stub_Identifier (E : Node_Id) return Node_Id; function Map_C_Subprogram_Spec - (S : Node_Id; Containing_Device : Node_Id := No_Node) - return Node_Id; + (S : Node_Id; + Containing_Device : Node_Id := No_Node) return Node_Id; function Map_C_Subprogram_Body - (S : Node_Id; Containing_Device : Node_Id := No_Node) - return Node_Id; + (S : Node_Id; + Containing_Device : Node_Id := No_Node) return Node_Id; function Map_C_Subprogram_Identifier (E : Node_Id) return Node_Id; - function Map_C_Marshaller_Subprogram (A : Node_Id; - Is_Unmarshall : Boolean := False; - Is_Request : Boolean := False) - return Node_Id; + function Map_C_Marshaller_Subprogram + (A : Node_Id; + Is_Unmarshall : Boolean := False; + Is_Request : Boolean := False) return Node_Id; procedure Bind_AADL_To_Default_Value (G : Node_Id; A : Node_Id); function Map_Task_Deliver_Identifier (E : Node_Id) return Node_Id; - function Map_C_Operation_Name - (E : Node_Id) - return Name_Id; - function Map_C_Port_Data_Name - (E : Node_Id; - P : Node_Id) - return Name_Id; + function Map_C_Operation_Name (E : Node_Id) return Name_Id; + function Map_C_Port_Data_Name (E : Node_Id; P : Node_Id) return Name_Id; function Map_C_Variable_Name (E : Node_Id; Port_Variable : Boolean := False; @@ -150,14 +145,12 @@ package Ocarina.Backends.C_Common.Mapping is Port_Destinations : Boolean := False; Port_Total_Fifo : Boolean := False; Port_Request : Boolean := False; - Request_Variable : Boolean := False) - return Name_Id; + Request_Variable : Boolean := False) return Name_Id; function Map_Port_Data_With_Virtual_Bus - (E : Node_Id; - Virtual_Bus : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id; + (E : Node_Id; + Virtual_Bus : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id; -- Map the name of the data variable when we receive on a port. -- Here, this function is dedicated to virtual bus and should be @@ -166,28 +159,26 @@ package Ocarina.Backends.C_Common.Mapping is -- model whereas parameter Virtual_Bus is a component from the AADL tree. function Map_Port_Name - (E : Node_Id; - Is_Global : Boolean := False; - Containing_Component : Node_Id := No_Node) - return Name_Id; + (E : Node_Id; + Is_Global : Boolean := False; + Containing_Component : Node_Id := No_Node) return Name_Id; - function Map_Port_Data (E : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id; + function Map_Port_Data + (E : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id; - function Map_Port_Var (E : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id; + function Map_Port_Var + (E : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id; - function Map_Port_Var_Length (E : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id; + function Map_Port_Var_Length + (E : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id; function Map_Port_Var_Length_With_Virtual_Bus - (E : Node_Id; - Virtual_Bus : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id; + (E : Node_Id; + Virtual_Bus : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id; -- Map the name of the length variable when we receive on a port. -- Here, this function is dedicated to virtual bus and should be @@ -195,22 +186,19 @@ package Ocarina.Backends.C_Common.Mapping is -- Parameter E and Containing_Component come from the instance -- model whereas parameter Virtual_Bus is a component from the AADL tree. - function Map_Port_Var_Valid (E : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id; + function Map_Port_Var_Valid + (E : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id; - function Map_Port (E : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id; + function Map_Port + (E : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id; function Map_Port_Deployment_Destinations - (E : Node_Id; - Containing_Component : Node_Id := No_Node) - return Name_Id; + (E : Node_Id; + Containing_Component : Node_Id := No_Node) return Name_Id; - function Map_Port_Deployment_Partition - (E : Node_Id) - return Name_Id; + function Map_Port_Deployment_Partition (E : Node_Id) return Name_Id; function Map_Queue_Size (Port : Node_Id) return Node_Id; -- Return a node that represents the required size of the port (in bytes). @@ -248,12 +236,14 @@ package Ocarina.Backends.C_Common.Mapping is -- Map a SCADE parameter function Map_Lustre_Output_Function_Name - (Subprogram : Node_Id; Port : Node_Id) return Node_Id; + (Subprogram : Node_Id; + Port : Node_Id) return Node_Id; -- Generate the name of the output function for the context to use for -- a given Lustre node and a given port. function Map_Lustre_Input_Function_Name - (Subprogram : Node_Id; Port : Node_Id) return Node_Id; + (Subprogram : Node_Id; + Port : Node_Id) return Node_Id; -- Generate the name of the input function for the context to use for -- a given Lustre node and a given port. @@ -280,16 +270,16 @@ package Ocarina.Backends.C_Common.Mapping is -- a given Lustre node. function Map_Lustre_Temp_Var - (Subprogram : Node_Id; Port : Node_Id) return Node_Id; + (Subprogram : Node_Id; + Port : Node_Id) return Node_Id; -- When we use the Lustre academic version, we need to make a temporary -- variable between the thread and other generated functions. -- This function generates the name of the temporary variable. function Map_POK_Action - (Action : Supported_POK_Action; - Thread_Id : Unsigned_Long_Long := 0; - Corresponding_Error : Node_Id := No_Node) - return Node_Id; + (Action : Supported_POK_Action; + Thread_Id : Unsigned_Long_Long := 0; + Corresponding_Error : Node_Id := No_Node) return Node_Id; -- For a given recovery action, map it and make the right -- function call to recover the error. This function is -- dedicated to threads. There is another function @@ -297,43 +287,38 @@ package Ocarina.Backends.C_Common.Mapping is -- partitions. function Map_POK_Kernel_Action - (Action : Supported_POK_Action; + (Action : Supported_POK_Action; Partition_Id : Unsigned_Long_Long := 0; - Kernel_Level : Boolean := True) - return Node_Id; + Kernel_Level : Boolean := True) return Node_Id; function Map_POK_Kernel_Action - (Action : Supported_ARINC653_Action; - Partition_Id : Unsigned_Long_Long := 0; - Kernel_Level : Boolean := True) - - return Node_Id; + (Action : Supported_ARINC653_Action; + Partition_Id : Unsigned_Long_Long := 0; + Kernel_Level : Boolean := True) return Node_Id; function Map_POK_Action - (Action : Supported_ARINC653_Action; - Thread_Id : Unsigned_Long_Long := 0; - Corresponding_Error : Node_Id := No_Node) - return Node_Id; + (Action : Supported_ARINC653_Action; + Thread_Id : Unsigned_Long_Long := 0; + Corresponding_Error : Node_Id := No_Node) return Node_Id; function Map_Esterel_Output_Function - (Subprogram : Node_Id; Feature : Node_Id) - return Node_Id; + (Subprogram : Node_Id; + Feature : Node_Id) return Node_Id; -- Generate the name of the function -- used to store out signals. function Map_Esterel_Input_Function - (Subprogram : Node_Id; Feature : Node_Id) - return Node_Id; + (Subprogram : Node_Id; + Feature : Node_Id) return Node_Id; -- Map the name of a given function to transmit -- the input signals. function Map_Esterel_Temp_Var - (Subprogram : Node_Id; Port : Node_Id) - return Node_Id; + (Subprogram : Node_Id; + Port : Node_Id) return Node_Id; -- Map a temporary variable to store output signals. - function Map_Esterel_Reset_Function (Subprogram : Node_Id) - return Node_Id; + function Map_Esterel_Reset_Function (Subprogram : Node_Id) return Node_Id; -- Map the reset function used in the Esterel application -- code. This function should be called before any reaction -- of the Esterel application code. @@ -347,8 +332,8 @@ package Ocarina.Backends.C_Common.Mapping is function Map_Associated_Locking_Entity_Name (E : Node_Id) return Name_Id; - function Map_ARINC653_Error (Error : Supported_ARINC653_Error) - return Node_Id; + function Map_ARINC653_Error + (Error : Supported_ARINC653_Error) return Node_Id; -- Map an ARINC653 error property into a runtime entity. function Map_POK_Error (Error : Supported_POK_Error) return Node_Id; @@ -363,26 +348,24 @@ package Ocarina.Backends.C_Common.Mapping is type Virtual_Bus_Call_Kind is (Sending, Receiving); procedure Map_Virtual_Bus_Calls - (Port : Node_Id; - Declarations : List_Id; - Statements : List_Id; - Handled_Kind : Virtual_Bus_Call_Kind; + (Port : Node_Id; + Declarations : List_Id; + Statements : List_Id; + Handled_Kind : Virtual_Bus_Call_Kind; New_Data : out Node_Id; New_Size : out Node_Id; - Containing_Component : Node_Id := No_Node); + Containing_Component : Node_Id := No_Node); -- Makes calls to the protocol stack designed by a port. function Get_Type_Identifier_Associated_With_Virtual_Bus - (Port : Node_Id) return Node_Id; + (Port : Node_Id) return Node_Id; -- Returns the type identifier that should be used with a port -- if this port is associated to virtual bus layers. - function Map_Port_Name_For_Asn1 - (E : Node_Id) return Name_Id; + function Map_Port_Name_For_Asn1 (E : Node_Id) return Name_Id; -- Map the name of a port for ASN1 marshalling. - function Map_Port_Name_Present_For_Asn1 - (E : Node_Id) return Name_Id; + function Map_Port_Name_Present_For_Asn1 (E : Node_Id) return Name_Id; -- Map the name of a port for ASN1 marshalling. procedure Handle_Virtual_Buses_Properties (Port : Node_Id); diff --git a/src/backends/ocarina-backends-c_common-subprograms.adb b/src/backends/ocarina-backends-c_common-subprograms.adb index d2421bb4..f3399aa0 100644 --- a/src/backends/ocarina-backends-c_common-subprograms.adb +++ b/src/backends/ocarina-backends-c_common-subprograms.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -71,7 +71,8 @@ package body Ocarina.Backends.C_Common.Subprograms is procedure Visit_Bus_Instance (E : Node_Id); procedure Visit_Virtual_Bus_Instance (E : Node_Id); procedure Visit_Process_Instance - (E : Node_Id; Real_Process : Boolean := True); + (E : Node_Id; + Real_Process : Boolean := True); procedure Visit_Processor_Instance (E : Node_Id); procedure Visit_Virtual_Processor_Instance (E : Node_Id); procedure Visit_Thread_Instance (E : Node_Id); @@ -117,8 +118,8 @@ package body Ocarina.Backends.C_Common.Subprograms is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := + Get_Category_Of_Component (E); begin case Category is when CC_Abstract => @@ -229,15 +230,16 @@ package body Ocarina.Backends.C_Common.Subprograms is --------------------------- procedure Visit_Device_Instance (E : Node_Id) is - U : Node_Id; - P : Node_Id; - Implementation : Node_Id; - S : Node_Id; + U : Node_Id; + P : Node_Id; + Implementation : Node_Id; + S : Node_Id; begin Current_Device := E; if Get_Current_Backend_Kind = PolyORB_Kernel_C then - U := CTN.Distributed_Application_Unit - (CTN.Naming_Node (Backend_Node (Identifier (E)))); + U := + CTN.Distributed_Application_Unit + (CTN.Naming_Node (Backend_Node (Identifier (E)))); P := CTN.Entity (U); @@ -253,7 +255,8 @@ package body Ocarina.Backends.C_Common.Subprograms is while Present (S) loop if Get_Category_Of_Component (S) = CC_Process then Visit_Process_Instance - (Corresponding_Instance (S), False); + (Corresponding_Instance (S), + False); end if; if Get_Current_Backend_Kind = PolyORB_HI_C then @@ -278,9 +281,9 @@ package body Ocarina.Backends.C_Common.Subprograms is ------------------------- procedure Visit_Data_Instance (E : Node_Id) is - Data_Type : constant Supported_Data_Representation - := Get_Data_Representation (E); - S : Node_Id; + Data_Type : constant Supported_Data_Representation := + Get_Data_Representation (E); + S : Node_Id; begin if Data_Type = Data_With_Accessors then -- Visit all the accessor subprograms of the data type @@ -331,8 +334,8 @@ package body Ocarina.Backends.C_Common.Subprograms is -------------------------------------- procedure Visit_Virtual_Processor_Instance (E : Node_Id) is - Processes : List_Id; - S : Node_Id; + Processes : List_Id; + S : Node_Id; begin if Get_Current_Backend_Kind /= PolyORB_Kernel_C then return; @@ -340,7 +343,7 @@ package body Ocarina.Backends.C_Common.Subprograms is if Present (Backend_Node (Identifier (E))) then Processes := CTN.Processes (Backend_Node (Identifier (E))); - S := AIN.First_Node (Processes); + S := AIN.First_Node (Processes); while Present (S) loop Visit (AIN.Item (S)); S := AIN.Next_Node (S); @@ -353,21 +356,24 @@ package body Ocarina.Backends.C_Common.Subprograms is ---------------------------- procedure Visit_Process_Instance - (E : Node_Id; Real_Process : Boolean := True) is - U : Node_Id; - P : Node_Id; - S : Node_Id; - C : Node_Id; - Feature : Node_Id; - Src : Node_Id; - Parent : Node_Id; - Dst : Node_Id; - The_System : constant Node_Id := Parent_Component - (Parent_Subcomponent (E)); + (E : Node_Id; + Real_Process : Boolean := True) + is + U : Node_Id; + P : Node_Id; + S : Node_Id; + C : Node_Id; + Feature : Node_Id; + Src : Node_Id; + Parent : Node_Id; + Dst : Node_Id; + The_System : constant Node_Id := + Parent_Component (Parent_Subcomponent (E)); begin if Real_Process then - U := CTN.Distributed_Application_Unit - (CTN.Naming_Node (Backend_Node (Identifier (E)))); + U := + CTN.Distributed_Application_Unit + (CTN.Naming_Node (Backend_Node (Identifier (E)))); P := CTN.Entity (U); Push_Entity (P); @@ -405,14 +411,13 @@ package body Ocarina.Backends.C_Common.Subprograms is Parent := Parent_Component (Item (Src)); - if AINU.Is_Process (Parent) - and then Parent /= E - then - if Get_Provided_Virtual_Bus_Class - (Extra_Item (Src)) /= No_Node then + if AINU.Is_Process (Parent) and then Parent /= E then + if Get_Provided_Virtual_Bus_Class (Extra_Item (Src)) /= + No_Node + then Visit - (Get_Provided_Virtual_Bus_Class - (Extra_Item (Src))); + (Get_Provided_Virtual_Bus_Class + (Extra_Item (Src))); end if; end if; @@ -428,14 +433,13 @@ package body Ocarina.Backends.C_Common.Subprograms is while Present (Dst) loop Parent := Parent_Component (Item (Dst)); - if AINU.Is_Process (Parent) - and then Parent /= E - then - if Get_Provided_Virtual_Bus_Class - (Extra_Item (Dst)) /= No_Node then + if AINU.Is_Process (Parent) and then Parent /= E then + if Get_Provided_Virtual_Bus_Class (Extra_Item (Dst)) /= + No_Node + then Visit - (Get_Provided_Virtual_Bus_Class - (Extra_Item (Dst))); + (Get_Provided_Virtual_Bus_Class + (Extra_Item (Dst))); end if; end if; @@ -450,14 +454,15 @@ package body Ocarina.Backends.C_Common.Subprograms is -- Visit all devices attached to the parent system that -- share the same processor as process E. - if Get_Current_Backend_Kind = PolyORB_HI_C and then - not AINU.Is_Empty (Subcomponents (The_System)) then + if Get_Current_Backend_Kind = PolyORB_HI_C + and then not AINU.Is_Empty (Subcomponents (The_System)) + then C := First_Node (Subcomponents (The_System)); while Present (C) loop if AINU.Is_Device (Corresponding_Instance (C)) - and then - Get_Bound_Processor (Corresponding_Instance (C)) - = Get_Bound_Processor (E) + and then + Get_Bound_Processor (Corresponding_Instance (C)) = + Get_Bound_Processor (E) then -- Build the enumerator corresponding to the device -- Note: we reuse the process name XXX @@ -482,9 +487,9 @@ package body Ocarina.Backends.C_Common.Subprograms is ------------------------------- procedure Visit_Subprogram_Instance (E : Node_Id) is - N : Node_Id; - Call_Seq : Node_Id; - Spg_Call : Node_Id; + N : Node_Id; + Call_Seq : Node_Id; + Spg_Call : Node_Id; begin -- Generate the spec of the subprogram @@ -544,13 +549,14 @@ package body Ocarina.Backends.C_Common.Subprograms is -- Visit the component instance corresponding to the -- subcomponent S. if Get_Current_Backend_Kind = PolyORB_Kernel_C - and then Get_Category_Of_Component - (Corresponding_Instance (S)) = CC_Process + and then + Get_Category_Of_Component (Corresponding_Instance (S)) = + CC_Process then null; else - if Get_Category_Of_Component - (Corresponding_Instance (S)) /= CC_Device + if Get_Category_Of_Component (Corresponding_Instance (S)) /= + CC_Device then Visit (Corresponding_Instance (S)); end if; @@ -630,7 +636,8 @@ package body Ocarina.Backends.C_Common.Subprograms is procedure Visit_Bus_Instance (E : Node_Id); procedure Visit_Virtual_Bus_Instance (E : Node_Id); procedure Visit_Process_Instance - (E : Node_Id; Real_Process : Boolean := True); + (E : Node_Id; + Real_Process : Boolean := True); procedure Visit_Processor_Instance (E : Node_Id); procedure Visit_Virtual_Processor_Instance (E : Node_Id); procedure Visit_Thread_Instance (E : Node_Id); @@ -672,8 +679,8 @@ package body Ocarina.Backends.C_Common.Subprograms is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := + Get_Category_Of_Component (E); begin case Category is when CC_Abstract => @@ -815,8 +822,8 @@ package body Ocarina.Backends.C_Common.Subprograms is -------------------------------------- procedure Visit_Virtual_Processor_Instance (E : Node_Id) is - Processes : List_Id; - S : Node_Id; + Processes : List_Id; + S : Node_Id; begin if Get_Current_Backend_Kind /= PolyORB_Kernel_C then return; @@ -824,7 +831,7 @@ package body Ocarina.Backends.C_Common.Subprograms is if Present (Backend_Node (Identifier (E))) then Processes := CTN.Processes (Backend_Node (Identifier (E))); - S := AIN.First_Node (Processes); + S := AIN.First_Node (Processes); while Present (S) loop Visit (AIN.Item (S)); S := AIN.Next_Node (S); @@ -837,9 +844,9 @@ package body Ocarina.Backends.C_Common.Subprograms is ------------------------- procedure Visit_Data_Instance (E : Node_Id) is - Data_Type : constant Supported_Data_Representation - := Get_Data_Representation (E); - S : Node_Id; + Data_Type : constant Supported_Data_Representation := + Get_Data_Representation (E); + S : Node_Id; begin if Data_Type = Data_With_Accessors then -- Visit all the accessor subprograms of the data type @@ -859,23 +866,25 @@ package body Ocarina.Backends.C_Common.Subprograms is ---------------------------- procedure Visit_Process_Instance - (E : Node_Id; - Real_Process : Boolean := True) is + (E : Node_Id; + Real_Process : Boolean := True) + is U : Node_Id; P : Node_Id; S : Node_Id; C : Node_Id; N : Node_Id; - Feature : Node_Id; - Src : Node_Id; - Parent : Node_Id; - Dst : Node_Id; - The_System : constant Node_Id := Parent_Component - (Parent_Subcomponent (E)); + Feature : Node_Id; + Src : Node_Id; + Parent : Node_Id; + Dst : Node_Id; + The_System : constant Node_Id := + Parent_Component (Parent_Subcomponent (E)); begin if Real_Process then - U := CTN.Distributed_Application_Unit - (CTN.Naming_Node (Backend_Node (Identifier (E)))); + U := + CTN.Distributed_Application_Unit + (CTN.Naming_Node (Backend_Node (Identifier (E)))); P := CTN.Entity (U); Push_Entity (P); Push_Entity (U); @@ -893,32 +902,34 @@ package body Ocarina.Backends.C_Common.Subprograms is S := First_Node (Subcomponents (E)); while Present (S) loop if AINU.Is_Data (Corresponding_Instance (S)) then - if Get_Current_Backend_Kind = PolyORB_HI_C and then - Get_Data_Representation (Corresponding_Instance (S)) = - Data_With_Accessors then + if Get_Current_Backend_Kind = PolyORB_HI_C + and then + Get_Data_Representation (Corresponding_Instance (S)) = + Data_With_Accessors + then -- For POHIC, generate globvars that have only accessors - N := Make_Variable_Declaration - (Map_C_Defining_Identifier (S), - Map_C_Data_Type_Designator - (Corresponding_Instance (S))); + N := + Make_Variable_Declaration + (Map_C_Defining_Identifier (S), + Map_C_Data_Type_Designator + (Corresponding_Instance (S))); N := Make_Extern_Entity_Declaration (N); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + Append_Node_To_List (N, CTN.Declarations (Current_File)); else -- For POK, generate all variables that are -- declared in the process. - N := Make_Variable_Declaration - (Map_C_Defining_Identifier (S), - Map_C_Data_Type_Designator - (Corresponding_Instance (S))); + N := + Make_Variable_Declaration + (Map_C_Defining_Identifier (S), + Map_C_Data_Type_Designator + (Corresponding_Instance (S))); N := Make_Extern_Entity_Declaration (N); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + Append_Node_To_List (N, CTN.Declarations (Current_File)); end if; end if; @@ -933,33 +944,36 @@ package body Ocarina.Backends.C_Common.Subprograms is while Present (S) loop Visit (Corresponding_Instance (S)); - if Get_Current_Backend_Kind = PolyORB_HI_C and then - AINU.Is_Data (Corresponding_Instance (S)) and then - Get_Data_Representation (Corresponding_Instance (S)) = - Data_With_Accessors then + if Get_Current_Backend_Kind = PolyORB_HI_C + and then AINU.Is_Data (Corresponding_Instance (S)) + and then + Get_Data_Representation (Corresponding_Instance (S)) = + Data_With_Accessors + then - N := Make_Variable_Declaration - (Map_C_Defining_Identifier (S), - Map_C_Data_Type_Designator - (Corresponding_Instance (S))); + N := + Make_Variable_Declaration + (Map_C_Defining_Identifier (S), + Map_C_Data_Type_Designator + (Corresponding_Instance (S))); N := Make_Extern_Entity_Declaration (N); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + Append_Node_To_List (N, CTN.Declarations (Current_File)); end if; S := Next_Node (S); end loop; end if; - if Get_Current_Backend_Kind = PolyORB_HI_C and then - not AINU.Is_Empty (Subcomponents (The_System)) then + if Get_Current_Backend_Kind = PolyORB_HI_C + and then not AINU.Is_Empty (Subcomponents (The_System)) + then C := First_Node (Subcomponents (The_System)); while Present (C) loop if AINU.Is_Device (Corresponding_Instance (C)) - and then - Get_Bound_Processor (Corresponding_Instance (C)) - = Get_Bound_Processor (E) + and then + Get_Bound_Processor (Corresponding_Instance (C)) = + Get_Bound_Processor (E) then Visit_Device_Instance (Corresponding_Instance (C)); end if; @@ -980,14 +994,13 @@ package body Ocarina.Backends.C_Common.Subprograms is Parent := Parent_Component (Item (Src)); - if AINU.Is_Process (Parent) - and then Parent /= E - then - if Get_Provided_Virtual_Bus_Class - (Extra_Item (Src)) /= No_Node then + if AINU.Is_Process (Parent) and then Parent /= E then + if Get_Provided_Virtual_Bus_Class (Extra_Item (Src)) /= + No_Node + then Visit - (Get_Provided_Virtual_Bus_Class - (Extra_Item (Src))); + (Get_Provided_Virtual_Bus_Class + (Extra_Item (Src))); end if; end if; @@ -1003,14 +1016,13 @@ package body Ocarina.Backends.C_Common.Subprograms is while Present (Dst) loop Parent := Parent_Component (Item (Dst)); - if AINU.Is_Process (Parent) - and then Parent /= E - then - if Get_Provided_Virtual_Bus_Class - (Extra_Item (Dst)) /= No_Node then + if AINU.Is_Process (Parent) and then Parent /= E then + if Get_Provided_Virtual_Bus_Class (Extra_Item (Dst)) /= + No_Node + then Visit - (Get_Provided_Virtual_Bus_Class - (Extra_Item (Dst))); + (Get_Provided_Virtual_Bus_Class + (Extra_Item (Dst))); end if; end if; @@ -1037,28 +1049,26 @@ package body Ocarina.Backends.C_Common.Subprograms is ------------------------------- procedure Visit_Subprogram_Instance (E : Node_Id) is - N : Node_Id; - Call_Seq : Node_Id; - Spg_Call : Node_Id; + N : Node_Id; + Call_Seq : Node_Id; + Spg_Call : Node_Id; begin -- Generate the body of the subprogram if No (Get_Handling (E, By_Name, H_C_Subprogram_Body)) then if Get_Subprogram_Kind (E) = Subprogram_Scade then Append_Node_To_List - (Make_Variable_Declaration - (Defining_Identifier => - Make_Defining_Identifier (VN (V_In)), - Used_type => - Map_Scade_Struct_In (E)), + (Make_Variable_Declaration + (Defining_Identifier => + Make_Defining_Identifier (VN (V_In)), + Used_Type => Map_Scade_Struct_In (E)), CTN.Declarations (Current_File)); Append_Node_To_List - (Make_Variable_Declaration - (Defining_Identifier => - Make_Defining_Identifier (VN (V_Out)), - Used_type => - Map_Scade_Struct_Out (E)), + (Make_Variable_Declaration + (Defining_Identifier => + Make_Defining_Identifier (VN (V_Out)), + Used_Type => Map_Scade_Struct_Out (E)), CTN.Declarations (Current_File)); end if; @@ -1113,12 +1123,15 @@ package body Ocarina.Backends.C_Common.Subprograms is -- Visit the component instance corresponding to the -- subcomponent S. if Get_Current_Backend_Kind = PolyORB_Kernel_C - and then Get_Category_Of_Component - (Corresponding_Instance (S)) = CC_Process then + and then + Get_Category_Of_Component (Corresponding_Instance (S)) = + CC_Process + then null; else - if Get_Category_Of_Component - (Corresponding_Instance (S)) /= CC_Device then + if Get_Category_Of_Component (Corresponding_Instance (S)) /= + CC_Device + then Visit (Corresponding_Instance (S)); end if; end if; @@ -1188,18 +1201,19 @@ package body Ocarina.Backends.C_Common.Subprograms is --------------------------- procedure Visit_Device_Instance (E : Node_Id) is - U : Node_Id; - P : Node_Id; - Implementation : Node_Id; - S : Node_Id; + U : Node_Id; + P : Node_Id; + Implementation : Node_Id; + S : Node_Id; begin Current_Device := E; if Get_Current_Backend_Kind = PolyORB_Kernel_C then - U := CTN.Distributed_Application_Unit - (CTN.Naming_Node (Backend_Node (Identifier (E)))); + U := + CTN.Distributed_Application_Unit + (CTN.Naming_Node (Backend_Node (Identifier (E)))); P := CTN.Entity (U); @@ -1215,7 +1229,8 @@ package body Ocarina.Backends.C_Common.Subprograms is while Present (S) loop if Get_Category_Of_Component (S) = CC_Process then Visit_Process_Instance - (Corresponding_Instance (S), False); + (Corresponding_Instance (S), + False); end if; if Get_Current_Backend_Kind = PolyORB_HI_C then diff --git a/src/backends/ocarina-backends-c_common-types.adb b/src/backends/ocarina-backends-c_common-types.adb index fb793b6e..9c16b24e 100644 --- a/src/backends/ocarina-backends-c_common-types.adb +++ b/src/backends/ocarina-backends-c_common-types.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -86,7 +86,8 @@ package body Ocarina.Backends.C_Common.Types is procedure Visit_Component_Instance (E : Node_Id); procedure Visit_System_Instance (E : Node_Id); procedure Visit_Process_Instance - (E : Node_Id; Real_Process : Boolean := True); + (E : Node_Id; + Real_Process : Boolean := True); procedure Visit_Processor_Instance (E : Node_Id); procedure Visit_Virtual_Processor_Instance (E : Node_Id); procedure Visit_Thread_Instance (E : Node_Id); @@ -107,8 +108,9 @@ package body Ocarina.Backends.C_Common.Types is Spg : Node_Id; Parameters : constant List_Id := New_List (CTN.K_Parameter_List); begin - pragma Assert (Kind (E) = K_Subprogram_Spec_Instance - or else Kind (E) = K_Subcomponent_Access_Instance); + pragma Assert + (Kind (E) = K_Subprogram_Spec_Instance + or else Kind (E) = K_Subcomponent_Access_Instance); Spg := Corresponding_Instance (E); @@ -116,19 +118,17 @@ package body Ocarina.Backends.C_Common.Types is Append_Node_To_List (Make_Parameter_Specification - (Defining_Identifier => - Make_Defining_Identifier (PN (P_Value)), - Parameter_Type => - Make_Pointer_Type - (Map_C_Defining_Identifier - (Parent_Component (E)))), + (Defining_Identifier => Make_Defining_Identifier (PN (P_Value)), + Parameter_Type => + Make_Pointer_Type + (Map_C_Defining_Identifier (Parent_Component (E)))), Parameters); - N := Make_Function_Specification - (Defining_Identifier => Map_C_Feature_Subprogram (E), - Parameters => Parameters, - Return_Type => New_Node (CTN.K_Void) - ); + N := + Make_Function_Specification + (Defining_Identifier => Map_C_Feature_Subprogram (E), + Parameters => Parameters, + Return_Type => New_Node (CTN.K_Void)); return N; end Feature_Spg_Spec; @@ -168,8 +168,8 @@ package body Ocarina.Backends.C_Common.Types is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := + Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -280,14 +280,15 @@ package body Ocarina.Backends.C_Common.Types is --------------------------- procedure Visit_Device_Instance (E : Node_Id) is - U : Node_Id; - P : Node_Id; - Implementation : Node_Id; - S : Node_Id; + U : Node_Id; + P : Node_Id; + Implementation : Node_Id; + S : Node_Id; begin if Get_Current_Backend_Kind = PolyORB_Kernel_C then - U := CTN.Distributed_Application_Unit - (CTN.Naming_Node (Backend_Node (Identifier (E)))); + U := + CTN.Distributed_Application_Unit + (CTN.Naming_Node (Backend_Node (Identifier (E)))); P := CTN.Entity (U); @@ -305,11 +306,11 @@ package body Ocarina.Backends.C_Common.Types is if Get_Current_Backend_Kind = PolyORB_Kernel_C then if Get_Category_Of_Component (S) = CC_Process then Visit_Process_Instance - (Corresponding_Instance (S), False); + (Corresponding_Instance (S), + False); end if; else - Visit - (Corresponding_Instance (S)); + Visit (Corresponding_Instance (S)); end if; S := Next_Node (S); @@ -360,8 +361,8 @@ package body Ocarina.Backends.C_Common.Types is -------------------------------------- procedure Visit_Virtual_Processor_Instance (E : Node_Id) is - Processes : List_Id; - S : Node_Id; + Processes : List_Id; + S : Node_Id; begin if Get_Current_Backend_Kind /= PolyORB_Kernel_C then return; @@ -369,7 +370,7 @@ package body Ocarina.Backends.C_Common.Types is if Present (Backend_Node (Identifier (E))) then Processes := CTN.Processes (Backend_Node (Identifier (E))); - S := AIN.First_Node (Processes); + S := AIN.First_Node (Processes); while Present (S) loop Visit (AIN.Item (S)); S := AIN.Next_Node (S); @@ -389,176 +390,178 @@ package body Ocarina.Backends.C_Common.Types is R : Node_Id; Data_Size : Size_Type; Data_Array_Size : constant ULL_Array := Get_Dimension (E); - Number_Representation : constant Supported_Number_Representation - := Get_Number_Representation (E); - Is_Signed : constant Boolean - := (Number_Representation = Representation_Signed); - - Type_Uint8 : Node_Id; - Type_Int8 : Node_Id; - Type_Uint16 : Node_Id; - Type_Int16 : Node_Id; - Type_Uint32 : Node_Id; - Type_Int32 : Node_Id; - Type_Uint64 : Node_Id; - Type_Int64 : Node_Id; - Type_Source_Name : Name_Id; - - Actual_Data_Size : Unsigned_Long_Long; - Struct_Members : constant List_Id := New_List - (CTN.K_Enumeration_Literals); - Protected_Struct_Members : constant List_Id := New_List - (CTN.K_Enumeration_Literals); + Number_Representation : constant Supported_Number_Representation := + Get_Number_Representation (E); + Is_Signed : constant Boolean := + (Number_Representation = Representation_Signed); + + Type_Uint8 : Node_Id; + Type_Int8 : Node_Id; + Type_Uint16 : Node_Id; + Type_Int16 : Node_Id; + Type_Uint32 : Node_Id; + Type_Int32 : Node_Id; + Type_Uint64 : Node_Id; + Type_Int64 : Node_Id; + Type_Source_Name : Name_Id; + + Actual_Data_Size : Unsigned_Long_Long; + Struct_Members : constant List_Id := + New_List (CTN.K_Enumeration_Literals); + Protected_Struct_Members : constant List_Id := + New_List (CTN.K_Enumeration_Literals); begin if No (Get_Handling (E, By_Name, H_C_Type_Spec)) then if Get_Current_Backend_Kind = PolyORB_HI_C then Add_Include (PHR.RH (RH_PO_HI_Types)); - Type_Uint8 := PHR.RE (RE_Uint8_T); - Type_Int8 := PHR.RE (RE_Int8_T); + Type_Uint8 := PHR.RE (RE_Uint8_T); + Type_Int8 := PHR.RE (RE_Int8_T); Type_Uint16 := PHR.RE (RE_Uint16_T); - Type_Int16 := PHR.RE (RE_Int16_T); + Type_Int16 := PHR.RE (RE_Int16_T); Type_Uint32 := PHR.RE (RE_Uint32_T); - Type_Int32 := PHR.RE (RE_Int32_T); + Type_Int32 := PHR.RE (RE_Int32_T); Type_Uint64 := PHR.RE (RE_Uint64_T); - Type_Int64 := PHR.RE (RE_Int64_T); + Type_Int64 := PHR.RE (RE_Int64_T); elsif Get_Current_Backend_Kind = PolyORB_Kernel_C then Add_Include (PKR.RH (RH_Types)); - Type_Uint8 := PKR.RE (RE_Uint8_T); - Type_Int8 := PKR.RE (RE_Int8_T); + Type_Uint8 := PKR.RE (RE_Uint8_T); + Type_Int8 := PKR.RE (RE_Int8_T); Type_Uint16 := PKR.RE (RE_Uint16_T); - Type_Int16 := PKR.RE (RE_Int16_T); + Type_Int16 := PKR.RE (RE_Int16_T); Type_Uint32 := PKR.RE (RE_Uint32_T); - Type_Int32 := PKR.RE (RE_Int32_T); + Type_Int32 := PKR.RE (RE_Int32_T); Type_Uint64 := PKR.RE (RE_Uint64_T); - Type_Int64 := PKR.RE (RE_Int64_T); + Type_Int64 := PKR.RE (RE_Int64_T); end if; Data_Representation := Get_Data_Representation (E); - Data_Size := Get_Data_Size (E); - Actual_Data_Size := To_Bytes (Data_Size); + Data_Size := Get_Data_Size (E); + Actual_Data_Size := To_Bytes (Data_Size); case Data_Representation is when Data_Boolean => - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => PHR.RE (RE_Bool_T)); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => PHR.RE (RE_Bool_T)); + Append_Node_To_List (N, CTN.Declarations (Current_File)); when Data_Float => if Data_Size.S = 0 then -- If no size info is given, we default to float - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => Make_Defining_Identifier - (TN (T_Float))); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => + Make_Defining_Identifier (TN (T_Float))); + Append_Node_To_List (N, CTN.Declarations (Current_File)); elsif Actual_Data_Size = 4 then - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => PHR.RE (RE_Float32_T)); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => PHR.RE (RE_Float32_T)); + Append_Node_To_List (N, CTN.Declarations (Current_File)); elsif Actual_Data_Size = 8 then - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => PHR.RE (RE_Float64_T)); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => PHR.RE (RE_Float64_T)); + Append_Node_To_List (N, CTN.Declarations (Current_File)); else Display_Located_Error - (Loc (E), "Unsupported data size: " - & Actual_Data_Size'Img, Fatal => True); + (Loc (E), + "Unsupported data size: " & Actual_Data_Size'Img, + Fatal => True); end if; when Data_Integer => if Data_Size.S = 0 then -- If no size info is given, we default to int - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => Make_Defining_Identifier - (TN (T_Int))); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => + Make_Defining_Identifier (TN (T_Int))); + Append_Node_To_List (N, CTN.Declarations (Current_File)); elsif Actual_Data_Size = 1 and then Is_Signed then R := Type_Int8; - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => R); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => R); + Append_Node_To_List (N, CTN.Declarations (Current_File)); elsif Actual_Data_Size = 1 and then not Is_Signed then R := Type_Uint8; - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => R); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => R); + Append_Node_To_List (N, CTN.Declarations (Current_File)); elsif Actual_Data_Size = 2 and then Is_Signed then R := Type_Int16; - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => R); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => R); + Append_Node_To_List (N, CTN.Declarations (Current_File)); elsif Actual_Data_Size = 2 and then not Is_Signed then R := Type_Uint16; - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => R); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => R); + Append_Node_To_List (N, CTN.Declarations (Current_File)); elsif Actual_Data_Size = 4 and then Is_Signed then R := Type_Int32; - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => R); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => R); + Append_Node_To_List (N, CTN.Declarations (Current_File)); elsif Actual_Data_Size = 4 and then not Is_Signed then R := Type_Uint32; - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => R); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => R); + Append_Node_To_List (N, CTN.Declarations (Current_File)); elsif Actual_Data_Size = 8 and then Is_Signed then R := Type_Int64; - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => R); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => R); + Append_Node_To_List (N, CTN.Declarations (Current_File)); elsif Actual_Data_Size = 8 and then not Is_Signed then R := Type_Uint64; - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => R); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => R); + Append_Node_To_List (N, CTN.Declarations (Current_File)); else Display_Located_Error - (Loc (E), "Unsupported data size" - & Actual_Data_Size'Img, Fatal => True); + (Loc (E), + "Unsupported data size" & Actual_Data_Size'Img, + Fatal => True); end if; when Data_Struct | Data_With_Accessors => declare - C : Node_Id := No_Node; + C : Node_Id := No_Node; begin if No (Subcomponents (E)) then C := No_Node; @@ -576,11 +579,13 @@ package body Ocarina.Backends.C_Common.Types is -- Make the record or private type component - N := Make_Member_Declaration - (Defining_Identifier => - Map_C_Defining_Identifier (C), - Used_Type => Map_C_Data_Type_Designator - (Corresponding_Instance (C))); + N := + Make_Member_Declaration + (Defining_Identifier => + Map_C_Defining_Identifier (C), + Used_Type => + Map_C_Data_Type_Designator + (Corresponding_Instance (C))); Append_Node_To_List (N, Struct_Members); end if; @@ -590,43 +595,48 @@ package body Ocarina.Backends.C_Common.Types is if Data_Representation = Data_Struct then -- Record type - N := Make_Full_Type_Declaration - (Defining_Identifier => - Map_C_Defining_Identifier (E), - Type_Definition => Make_Struct_Aggregate - (Members => Struct_Members)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => + Map_C_Defining_Identifier (E), + Type_Definition => + Make_Struct_Aggregate + (Members => Struct_Members)); Append_Node_To_List - (N, CTN.Declarations (Current_File)); + (N, + CTN.Declarations (Current_File)); else -- Protected type Append_Node_To_List (Make_Member_Declaration - (Used_Type => RE (RE_Protected_T), - Defining_Identifier => - Make_Defining_Identifier - (MN (M_Protected_Id))), + (Used_Type => RE (RE_Protected_T), + Defining_Identifier => + Make_Defining_Identifier + (MN (M_Protected_Id))), Protected_Struct_Members); if not Is_Empty (Struct_Members) then S := CTN.First_Node (Struct_Members); while Present (S) loop Append_Node_To_List - (S, Protected_Struct_Members); + (S, + Protected_Struct_Members); S := CTN.Next_Node (S); end loop; end if; - N := Make_Full_Type_Declaration - (Defining_Identifier => - Map_C_Defining_Identifier (E), - Type_Definition => - Make_Struct_Aggregate - (Members => - Protected_Struct_Members)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => + Map_C_Defining_Identifier (E), + Type_Definition => + Make_Struct_Aggregate + (Members => Protected_Struct_Members)); Append_Node_To_List - (N, CTN.Declarations (Current_File)); + (N, + CTN.Declarations (Current_File)); S := First_Node (Features (E)); @@ -641,10 +651,10 @@ package body Ocarina.Backends.C_Common.Types is -- type. M := Feature_Spg_Spec (S); - Bind_AADL_To_Feature_Subprogram - (Identifier (S), M); + Bind_AADL_To_Feature_Subprogram (Identifier (S), M); Append_Node_To_List - (M, CTN.Declarations (Current_File)); + (M, + CTN.Declarations (Current_File)); S := Next_Node (S); end loop; @@ -653,9 +663,9 @@ package body Ocarina.Backends.C_Common.Types is when Data_Enum => declare - Enumerators : constant Name_Array := Get_Enumerators (E); - Enum_Members : constant List_Id := New_List - (CTN.K_Enumeration_Literals); + Enumerators : constant Name_Array := Get_Enumerators (E); + Enum_Members : constant List_Id := + New_List (CTN.K_Enumeration_Literals); begin for J in Enumerators'Range loop Append_Node_To_List @@ -664,77 +674,88 @@ package body Ocarina.Backends.C_Common.Types is Enum_Members); end loop; - N := Make_Full_Type_Declaration - (Defining_Identifier => - Map_C_Defining_Identifier (E), - Type_Definition => - Make_Enum_Aggregate (Enum_Members)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => + Make_Enum_Aggregate (Enum_Members)); Append_Node_To_List (N, CTN.Declarations (Current_File)); end; when Data_Array => Visit_Data_Instance - (ATN.Entity (ATN.First_Node (Get_Base_Type (E)))); - - N := Make_Full_Type_Declaration - (Defining_Identifier => Make_Array_Declaration - (Defining_Identifier => - Map_C_Defining_Identifier (E), - Array_Size => - Make_Literal - (CV.New_Int_Value (Data_Array_Size (1), 0, 10))), - Type_Definition => - Map_C_Defining_Identifier + (ATN.Entity (ATN.First_Node (Get_Base_Type (E)))); + + N := + Make_Full_Type_Declaration + (Defining_Identifier => + Make_Array_Declaration + (Defining_Identifier => + Map_C_Defining_Identifier (E), + Array_Size => + Make_Literal + (CV.New_Int_Value + (Data_Array_Size (1), + 0, + 10))), + Type_Definition => + Map_C_Defining_Identifier (ATN.Entity (ATN.First_Node (Get_Base_Type (E))))); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + Append_Node_To_List (N, CTN.Declarations (Current_File)); when Data_String => - N := Make_Full_Type_Declaration - (Defining_Identifier => Make_Array_Declaration - (Defining_Identifier => - Map_C_Defining_Identifier (E), - Array_Size => - Make_Literal - (CV.New_Int_Value (Data_Array_Size (1), 0, 10))), - Type_Definition => Make_Defining_Identifier - (TN (T_Char))); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => + Make_Array_Declaration + (Defining_Identifier => + Map_C_Defining_Identifier (E), + Array_Size => + Make_Literal + (CV.New_Int_Value + (Data_Array_Size (1), + 0, + 10))), + Type_Definition => + Make_Defining_Identifier (TN (T_Char))); + Append_Node_To_List (N, CTN.Declarations (Current_File)); when Data_Character => - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => Make_Defining_Identifier - (TN (T_Char))); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); - - when Data_Wide_Character - | Data_Fixed - | Data_Wide_String - | Data_Union => + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => + Make_Defining_Identifier (TN (T_Char))); + Append_Node_To_List (N, CTN.Declarations (Current_File)); + + when Data_Wide_Character | + Data_Fixed | + Data_Wide_String | + Data_Union => Display_Located_Error - (Loc (E), "unsupported data type (" - & Supported_Data_Representation'Image - (Data_Representation) & ")", + (Loc (E), + "unsupported data type (" & + Supported_Data_Representation'Image + (Data_Representation) & + ")", Fatal => True); when Data_None => Type_Source_Name := Get_Type_Source_Name (E); if Type_Source_Name /= No_Name then - N := Make_Full_Type_Declaration - (Defining_Identifier => Map_C_Defining_Identifier (E), - Type_Definition => - CTU.Make_Defining_Identifier - (Type_Source_Name, False)); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => + CTU.Make_Defining_Identifier + (Type_Source_Name, + False)); + Append_Node_To_List (N, CTN.Declarations (Current_File)); declare - Source_Files : constant Name_Array - := Get_Source_Text (E); + Source_Files : constant Name_Array := + Get_Source_Text (E); To_Include : Name_Id; begin if Source_Files'Length > 1 then @@ -745,39 +766,40 @@ package body Ocarina.Backends.C_Common.Types is elsif Source_Files'Length = 1 then To_Include := Source_Files (Source_Files'First); Get_Name_String (To_Include); - if Name_Buffer (Name_Len - 3 .. Name_Len) - = ".asn" then - Name_Len := Name_Len - 4; + if Name_Buffer (Name_Len - 3 .. Name_Len) = + ".asn" + then + Name_Len := Name_Len - 4; To_Include := Name_Find; end if; Add_Include (Make_Include_Clause - (Make_Defining_Identifier - (To_Include, False)), + (Make_Defining_Identifier (To_Include, False)), Preserve_Case => True); end if; end; if Get_Source_Language (E) = Language_Simulink then Add_Include - (Make_Include_Clause - (Make_Defining_Identifier - (Get_String_Name ("rtwtypes"), False), + (Make_Include_Clause + (Make_Defining_Identifier + (Get_String_Name ("rtwtypes"), + False), False), True); end if; elsif Get_Concurrency_Protocol (E) = - Concurrency_Protected_Access - or else - Get_Concurrency_Protocol (E) = - Concurrency_Immediate_Priority_Ceiling - or else - Get_Concurrency_Protocol (E) = - Concurrency_Priority_Inheritance - or else - Get_Concurrency_Protocol (E) = - Concurrency_Priority_Ceiling + Concurrency_Protected_Access + or else + Get_Concurrency_Protocol (E) = + Concurrency_Immediate_Priority_Ceiling + or else + Get_Concurrency_Protocol (E) = + Concurrency_Priority_Inheritance + or else + Get_Concurrency_Protocol (E) = + Concurrency_Priority_Ceiling then -- Protected type that does not have struct members. @@ -794,35 +816,32 @@ package body Ocarina.Backends.C_Common.Types is Append_Node_To_List (Make_Member_Declaration - (Used_Type => RE (RE_Protected_T), - Defining_Identifier => - Make_Defining_Identifier - (MN (M_Protected_Id))), + (Used_Type => RE (RE_Protected_T), + Defining_Identifier => + Make_Defining_Identifier (MN (M_Protected_Id))), Protected_Struct_Members); if not Is_Empty (Struct_Members) then S := CTN.First_Node (Struct_Members); while Present (S) loop - Append_Node_To_List - (S, Protected_Struct_Members); + Append_Node_To_List (S, Protected_Struct_Members); S := CTN.Next_Node (S); end loop; end if; - N := Make_Full_Type_Declaration - (Defining_Identifier => - Map_C_Defining_Identifier (E), - Type_Definition => - Make_Struct_Aggregate - (Members => - Protected_Struct_Members)); + N := + Make_Full_Type_Declaration + (Defining_Identifier => Map_C_Defining_Identifier (E), + Type_Definition => + Make_Struct_Aggregate + (Members => Protected_Struct_Members)); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + Append_Node_To_List (N, CTN.Declarations (Current_File)); else Display_Located_Error - (Loc (E), "unspecified data representation", + (Loc (E), + "unspecified data representation", Fatal => True); end if; end case; @@ -864,27 +883,30 @@ package body Ocarina.Backends.C_Common.Types is ---------------------------- procedure Visit_Process_Instance - (E : Node_Id; Real_Process : Boolean := True) is - S : Node_Id; - C : Node_Id; - F : Node_Id; - I : Node_Id; - J : Node_Id; - D : Node_Id; - U : Node_Id; - P : Node_Id; - Feature : Node_Id; - Parent : Node_Id; - Src : Node_Id; - Dst : Node_Id; - Declaration : Node_Id; - The_System : constant Node_Id := Parent_Component - (Parent_Subcomponent (E)); + (E : Node_Id; + Real_Process : Boolean := True) + is + S : Node_Id; + C : Node_Id; + F : Node_Id; + I : Node_Id; + J : Node_Id; + D : Node_Id; + U : Node_Id; + P : Node_Id; + Feature : Node_Id; + Parent : Node_Id; + Src : Node_Id; + Dst : Node_Id; + Declaration : Node_Id; + The_System : constant Node_Id := + Parent_Component (Parent_Subcomponent (E)); Remote_Process : Node_Id; begin if Real_Process then - U := CTN.Distributed_Application_Unit - (CTN.Naming_Node (Backend_Node (Identifier (E)))); + U := + CTN.Distributed_Application_Unit + (CTN.Naming_Node (Backend_Node (Identifier (E)))); P := CTN.Entity (U); Push_Entity (P); @@ -913,21 +935,24 @@ package body Ocarina.Backends.C_Common.Types is Add_Include (PKR.RH (RH_Deployment)); if POK_Flavor = ARINC653 then - Declaration := Make_Extern_Entity_Declaration - (Make_Variable_Declaration - (Make_Defining_Identifier - (Map_Associated_Locking_Entity_Name (S)), - PKR.RE (RE_Semaphore_Id_Type))); + Declaration := + Make_Extern_Entity_Declaration + (Make_Variable_Declaration + (Make_Defining_Identifier + (Map_Associated_Locking_Entity_Name (S)), + PKR.RE (RE_Semaphore_Id_Type))); else - Declaration := Make_Extern_Entity_Declaration - (Make_Variable_Declaration - (Make_Defining_Identifier - (Map_Associated_Locking_Entity_Name (S)), - PKR.RE (RE_Pok_Sem_Id_T))); + Declaration := + Make_Extern_Entity_Declaration + (Make_Variable_Declaration + (Make_Defining_Identifier + (Map_Associated_Locking_Entity_Name (S)), + PKR.RE (RE_Pok_Sem_Id_T))); end if; Append_Node_To_List - (Declaration, CTN.Declarations (Current_File)); + (Declaration, + CTN.Declarations (Current_File)); end if; S := Next_Node (S); @@ -951,14 +976,15 @@ package body Ocarina.Backends.C_Common.Types is -- Visit all devices attached to the parent system that -- share the same processor as process E. - if Get_Current_Backend_Kind = PolyORB_HI_C and then - not AINU.Is_Empty (Subcomponents (The_System)) then + if Get_Current_Backend_Kind = PolyORB_HI_C + and then not AINU.Is_Empty (Subcomponents (The_System)) + then C := First_Node (Subcomponents (The_System)); while Present (C) loop if AINU.Is_Device (Corresponding_Instance (C)) - and then - Get_Bound_Processor (Corresponding_Instance (C)) - = Get_Bound_Processor (E) + and then + Get_Bound_Processor (Corresponding_Instance (C)) = + Get_Bound_Processor (E) then -- Build the enumerator corresponding to the device -- Note: we reuse the process name XXX @@ -972,11 +998,9 @@ package body Ocarina.Backends.C_Common.Types is -- (see ocarina-backends-po_hi_c-request.adb) are used. elsif AINU.Is_Process (Corresponding_Instance (C)) then - S := First_Node (Subcomponents - (Corresponding_Instance (C))); + S := First_Node (Subcomponents (Corresponding_Instance (C))); while Present (S) loop - Visit_Component_Instance - (Corresponding_Instance (S)); + Visit_Component_Instance (Corresponding_Instance (S)); S := Next_Node (S); end loop; end if; @@ -991,13 +1015,15 @@ package body Ocarina.Backends.C_Common.Types is C := First_Node (Features (E)); while Present (C) loop - if Kind (C) = K_Port_Spec_Instance and then - not AINU.Is_Empty (Destinations (C)) then + if Kind (C) = K_Port_Spec_Instance + and then not AINU.Is_Empty (Destinations (C)) + then D := First_Node (Destinations (C)); I := Item (D); - if Get_Category_Of_Component - (Parent_Component (I)) = CC_Process then + if Get_Category_Of_Component (Parent_Component (I)) = + CC_Process + then Remote_Process := Parent_Component (I); if not AINU.Is_Empty (Subcomponents (Remote_Process)) then @@ -1011,9 +1037,10 @@ package body Ocarina.Backends.C_Common.Types is end if; end if; - if Present (I) and then - Kind (I) = K_Port_Spec_Instance and then - not AINU.Is_Empty (Destinations (I)) then + if Present (I) + and then Kind (I) = K_Port_Spec_Instance + and then not AINU.Is_Empty (Destinations (I)) + then F := First_Node (Destinations (I)); while Present (F) loop J := Item (F); @@ -1033,13 +1060,15 @@ package body Ocarina.Backends.C_Common.Types is C := First_Node (Features (E)); while Present (C) loop - if Kind (C) = K_Port_Spec_Instance and then - not AINU.Is_Empty (Sources (C)) then + if Kind (C) = K_Port_Spec_Instance + and then not AINU.Is_Empty (Sources (C)) + then D := First_Node (Sources (C)); I := Item (D); - if Get_Category_Of_Component - (Parent_Component (I)) = CC_Process then + if Get_Category_Of_Component (Parent_Component (I)) = + CC_Process + then Remote_Process := Parent_Component (I); if not AINU.Is_Empty (Subcomponents (Remote_Process)) then @@ -1053,9 +1082,10 @@ package body Ocarina.Backends.C_Common.Types is end if; end if; - if Present (I) and then - Kind (I) = K_Port_Spec_Instance and then - not AINU.Is_Empty (Sources (I)) then + if Present (I) + and then Kind (I) = K_Port_Spec_Instance + and then not AINU.Is_Empty (Sources (I)) + then F := First_Node (Sources (I)); while Present (F) loop J := Item (F); @@ -1087,14 +1117,13 @@ package body Ocarina.Backends.C_Common.Types is Parent := Parent_Component (Item (Src)); - if AINU.Is_Process (Parent) - and then Parent /= E - then - if Get_Provided_Virtual_Bus_Class - (Extra_Item (Src)) /= No_Node then + if AINU.Is_Process (Parent) and then Parent /= E then + if Get_Provided_Virtual_Bus_Class (Extra_Item (Src)) /= + No_Node + then Visit - (Get_Provided_Virtual_Bus_Class - (Extra_Item (Src))); + (Get_Provided_Virtual_Bus_Class + (Extra_Item (Src))); end if; end if; @@ -1110,14 +1139,13 @@ package body Ocarina.Backends.C_Common.Types is while Present (Dst) loop Parent := Parent_Component (Item (Dst)); - if AINU.Is_Process (Parent) - and then Parent /= E - then - if Get_Provided_Virtual_Bus_Class - (Extra_Item (Dst)) /= No_Node then + if AINU.Is_Process (Parent) and then Parent /= E then + if Get_Provided_Virtual_Bus_Class (Extra_Item (Dst)) /= + No_Node + then Visit - (Get_Provided_Virtual_Bus_Class - (Extra_Item (Dst))); + (Get_Provided_Virtual_Bus_Class + (Extra_Item (Dst))); end if; end if; @@ -1217,13 +1245,14 @@ package body Ocarina.Backends.C_Common.Types is -- (processor or virtual processor). if Get_Current_Backend_Kind = PolyORB_Kernel_C - and then AINU.Is_Process_Or_Device - (Corresponding_Instance (S)) + and then AINU.Is_Process_Or_Device + (Corresponding_Instance (S)) then null; else - if Get_Category_Of_Component - (Corresponding_Instance (S)) /= CC_Device then + if Get_Category_Of_Component (Corresponding_Instance (S)) /= + CC_Device + then Visit (Corresponding_Instance (S)); end if; end if; @@ -1249,9 +1278,7 @@ package body Ocarina.Backends.C_Common.Types is F := First_Node (Features (E)); while Present (F) loop - if Kind (F) = K_Port_Spec_Instance - and then AIN.Is_Data (F) - then + if Kind (F) = K_Port_Spec_Instance and then AIN.Is_Data (F) then Visit (Corresponding_Instance (F)); end if; @@ -1318,8 +1345,9 @@ package body Ocarina.Backends.C_Common.Types is Statements : constant List_Id := New_List (CTN.K_Statement_List); Spg : Node_Id; begin - pragma Assert (Kind (E) = K_Subprogram_Spec_Instance - or else Kind (E) = K_Subcomponent_Access_Instance); + pragma Assert + (Kind (E) = K_Subprogram_Spec_Instance + or else Kind (E) = K_Subcomponent_Access_Instance); Spg := Corresponding_Instance (E); @@ -1330,15 +1358,16 @@ package body Ocarina.Backends.C_Common.Types is Call_Profile := New_List (CTN.K_Parameter_Profile); Append_Node_To_List (Make_Member_Designator - (Make_Defining_Identifier (MN (M_Protected_Id)), - Make_Defining_Identifier (PN (P_Value)), - Is_Pointer => True), + (Make_Defining_Identifier (MN (M_Protected_Id)), + Make_Defining_Identifier (PN (P_Value)), + Is_Pointer => True), Call_Profile); Append_Node_To_List (Make_Call_Profile - (Defining_Identifier => RE (RE_Protected_Lock), - Parameters => Call_Profile), Statements); + (Defining_Identifier => RE (RE_Protected_Lock), + Parameters => Call_Profile), + Statements); Call_Profile := New_List (CTN.K_Parameter_Profile); @@ -1378,14 +1407,14 @@ package body Ocarina.Backends.C_Common.Types is while Present (Param) loop -- Create a parameter association if AINU.Is_Data (Corresponding_Instance (Param)) then - N := Make_Variable_Address - (Make_Member_Designator - (Defining_Identifier => - Map_C_Defining_Identifier (Param), - Aggregate_Name => - Make_Defining_Identifier (PN (P_Value)), - Is_Pointer => - True)); + N := + Make_Variable_Address + (Make_Member_Designator + (Defining_Identifier => + Map_C_Defining_Identifier (Param), + Aggregate_Name => + Make_Defining_Identifier (PN (P_Value)), + Is_Pointer => True)); Append_Node_To_List (N, Call_Profile); end if; @@ -1405,14 +1434,12 @@ package body Ocarina.Backends.C_Common.Types is Add_Include (PKR.RH (RH_Subprograms)); end if; - N := Make_Call_Profile - (CTN.Defining_Identifier - (CTN.Subprogram_Node - (Backend_Node - (Identifier - (Corresponding_Instance - (E))))), - Call_Profile); + N := + Make_Call_Profile + (CTN.Defining_Identifier + (CTN.Subprogram_Node + (Backend_Node (Identifier (Corresponding_Instance (E))))), + Call_Profile); Append_Node_To_List (N, Statements); -- Make the call to __po_hi_protected_unlock @@ -1420,24 +1447,24 @@ package body Ocarina.Backends.C_Common.Types is Call_Profile := New_List (CTN.K_Parameter_Profile); Append_Node_To_List (Make_Member_Designator - (Make_Defining_Identifier (MN (M_Protected_Id)), - Make_Defining_Identifier (PN (P_Value)), - Is_Pointer => True), + (Make_Defining_Identifier (MN (M_Protected_Id)), + Make_Defining_Identifier (PN (P_Value)), + Is_Pointer => True), Call_Profile); Append_Node_To_List (Make_Call_Profile - (Defining_Identifier => RE (RE_Protected_Unlock), - Parameters => Call_Profile), Statements); + (Defining_Identifier => RE (RE_Protected_Unlock), + Parameters => Call_Profile), + Statements); -- Build the subprogram implementation - N := Make_Function_Implementation - (CTN.Feature_Subprogram_Node - (Backend_Node - (Identifier (E))), - No_List, - Statements); + N := + Make_Function_Implementation + (CTN.Feature_Subprogram_Node (Backend_Node (Identifier (E))), + No_List, + Statements); return N; end Feature_Spg_Body; @@ -1478,8 +1505,8 @@ package body Ocarina.Backends.C_Common.Types is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := + Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -1544,8 +1571,8 @@ package body Ocarina.Backends.C_Common.Types is -------------------------------------- procedure Visit_Virtual_Processor_Instance (E : Node_Id) is - Processes : List_Id; - S : Node_Id; + Processes : List_Id; + S : Node_Id; begin if Get_Current_Backend_Kind /= PolyORB_Kernel_C then return; @@ -1553,7 +1580,7 @@ package body Ocarina.Backends.C_Common.Types is if Present (Backend_Node (Identifier (E))) then Processes := CTN.Processes (Backend_Node (Identifier (E))); - S := AIN.First_Node (Processes); + S := AIN.First_Node (Processes); while Present (S) loop Visit (AIN.Item (S)); S := AIN.Next_Node (S); @@ -1585,8 +1612,8 @@ package body Ocarina.Backends.C_Common.Types is if Data_Representation = Data_With_Accessors then if No (Get_Handling (E, By_Name, H_C_Type_Body)) then declare - C : Node_Id := First_Node (Subcomponents (E)); - S : Node_Id; + C : Node_Id := First_Node (Subcomponents (E)); + S : Node_Id; begin -- Visit the subcomponents @@ -1607,8 +1634,7 @@ package body Ocarina.Backends.C_Common.Types is -- the visible part of the protected type. N := Feature_Spg_Body (S); - Append_Node_To_List - (N, CTN.Declarations (Current_File)); + Append_Node_To_List (N, CTN.Declarations (Current_File)); S := Next_Node (S); end loop; @@ -1630,11 +1656,12 @@ package body Ocarina.Backends.C_Common.Types is ---------------------------- procedure Visit_Process_Instance (E : Node_Id) is - U : constant Node_Id := CTN.Distributed_Application_Unit - (CTN.Naming_Node (Backend_Node (Identifier (E)))); - P : constant Node_Id := CTN.Entity (U); - S : Node_Id; - Declaration : Node_Id; + U : constant Node_Id := + CTN.Distributed_Application_Unit + (CTN.Naming_Node (Backend_Node (Identifier (E)))); + P : constant Node_Id := CTN.Entity (U); + S : Node_Id; + Declaration : Node_Id; begin Push_Entity (P); Push_Entity (U); @@ -1647,28 +1674,30 @@ package body Ocarina.Backends.C_Common.Types is if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - if Get_Current_Backend_Kind = PolyORB_Kernel_C and then - AINU.Is_Data (Corresponding_Instance (S)) and then - Is_Protected_Data (Corresponding_Instance (S)) then + if Get_Current_Backend_Kind = PolyORB_Kernel_C + and then AINU.Is_Data (Corresponding_Instance (S)) + and then Is_Protected_Data (Corresponding_Instance (S)) + then Add_Include (PKR.RH (RH_Deployment)); if POK_Flavor = ARINC653 then - Declaration := Make_Variable_Declaration - (Make_Defining_Identifier - (Map_Associated_Locking_Entity_Name - (S)), - PKR.RE (RE_Semaphore_Id_Type)); + Declaration := + Make_Variable_Declaration + (Make_Defining_Identifier + (Map_Associated_Locking_Entity_Name (S)), + PKR.RE (RE_Semaphore_Id_Type)); else - Declaration := Make_Variable_Declaration - (Make_Defining_Identifier - (Map_Associated_Locking_Entity_Name - (S)), - PKR.RE (RE_Pok_Sem_Id_T)); + Declaration := + Make_Variable_Declaration + (Make_Defining_Identifier + (Map_Associated_Locking_Entity_Name (S)), + PKR.RE (RE_Pok_Sem_Id_T)); end if; Append_Node_To_List - (Declaration, CTN.Declarations (Current_File)); + (Declaration, + CTN.Declarations (Current_File)); else Visit (Corresponding_Instance (S)); end if; @@ -1733,8 +1762,10 @@ package body Ocarina.Backends.C_Common.Types is -- Visit the component instance corresponding to the -- subcomponent S. if Get_Current_Backend_Kind = PolyORB_Kernel_C - and then Get_Category_Of_Component - (Corresponding_Instance (S)) = CC_Process then + and then + Get_Category_Of_Component (Corresponding_Instance (S)) = + CC_Process + then null; else Visit (Corresponding_Instance (S)); diff --git a/src/backends/ocarina-backends-c_tree-debug.adb b/src/backends/ocarina-backends-c_tree-debug.adb index 13f5279f..81831c69 100644 --- a/src/backends/ocarina-backends-c_tree-debug.adb +++ b/src/backends/ocarina-backends-c_tree-debug.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -163,25 +163,21 @@ package body Ocarina.Backends.C_Tree.Debug is is C : Node_Id; begin - if A = "Next_Node" - or else A = "Package_Declaration" - then + if A = "Next_Node" or else A = "Package_Declaration" then return; end if; N_Indents := N_Indents + 1; W_Indents; - Write_Str (A); + Write_Str (A); Write_Char (' '); - Write_Str (K); + Write_Str (K); Write_Char (' '); C := Node_Id (N); if K = "Name_Id" then Write_Line (Quoted (V)); - elsif K = "Node_Id" - and then Present (C) - then + elsif K = "Node_Id" and then Present (C) then case Kind (C) is when K_Int .. K_Char => Write_Line ('(' & Image (Kind (Node_Id (N))) & ')'); @@ -216,9 +212,9 @@ package body Ocarina.Backends.C_Tree.Debug is procedure W_Node_Header (N : Node_Id) is begin W_Indents; - Write_Int (Int (N)); + Write_Int (Int (N)); Write_Char (' '); - Write_Str (Image (Kind (N))); + Write_Str (Image (Kind (N))); Write_Char (' '); Write_Line (Image (Loc (N))); end W_Node_Header; diff --git a/src/backends/ocarina-backends-c_tree-debug.ads b/src/backends/ocarina-backends-c_tree-debug.ads index 1bf07f12..e1828c69 100644 --- a/src/backends/ocarina-backends-c_tree-debug.ads +++ b/src/backends/ocarina-backends-c_tree-debug.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -39,15 +39,15 @@ package Ocarina.Backends.C_Tree.Debug is N_Indents : Natural := 0; - procedure W_Eol (N : Natural := 1) renames Output.Write_Eol; - procedure W_Int (N : Int) renames Output.Write_Int; - procedure W_Line (N : String) renames Output.Write_Line; - procedure W_Str (N : String) renames Output.Write_Str; + procedure W_Eol (N : Natural := 1) renames Output.Write_Eol; + procedure W_Int (N : Int) renames Output.Write_Int; + procedure W_Line (N : String) renames Output.Write_Line; + procedure W_Str (N : String) renames Output.Write_Str; procedure W_Indents; - procedure W_Byte (N : Byte); - procedure W_List_Id (L : List_Id); - procedure W_Node_Id (N : Node_Id); + procedure W_Byte (N : Byte); + procedure W_List_Id (L : List_Id); + procedure W_Node_Id (N : Node_Id); procedure W_Node_Header (N : Node_Id); procedure W_Node_Attribute diff --git a/src/backends/ocarina-backends-c_tree-generator.adb b/src/backends/ocarina-backends-c_tree-generator.adb index e2059f73..85a024ba 100644 --- a/src/backends/ocarina-backends-c_tree-generator.adb +++ b/src/backends/ocarina-backends-c_tree-generator.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -115,10 +115,7 @@ package body Ocarina.Backends.C_Tree.Generator is -- The File name corresponding is the lowerd name of N Get_Name_String - (Conventional_Base_Name - (Name - (Defining_Identifier - (N)))); + (Conventional_Base_Name (Name (Defining_Identifier (N)))); -- Adding file suffix @@ -320,7 +317,7 @@ package body Ocarina.Backends.C_Tree.Generator is L := 1; else L := 0; - while L + 1 <= Name_Len and then Name_Buffer (L + 1) /= ' ' loop + while L + 1 <= Name_Len and then Name_Buffer (L + 1) /= ' ' loop L := L + 1; end loop; end if; @@ -350,7 +347,7 @@ package body Ocarina.Backends.C_Tree.Generator is end if; end Get_Next_Word; - First_Line : Boolean := True; + First_Line : Boolean := True; Used_Columns : Natural; begin Get_Name_String (Name (Defining_Identifier (N))); @@ -447,7 +444,7 @@ package body Ocarina.Backends.C_Tree.Generator is L := 1; else L := 0; - while L + 1 <= Name_Len and then Name_Buffer (L + 1) /= ' ' loop + while L + 1 <= Name_Len and then Name_Buffer (L + 1) /= ' ' loop L := L + 1; end loop; end if; @@ -553,15 +550,13 @@ package body Ocarina.Backends.C_Tree.Generator is if Summary (N) /= No_Node then Write_Eol; Write_Str (" * \brief "); - Write_Name - (Name (Summary (N))); + Write_Name (Name (Summary (N))); Write_Eol; Write_Str (" *"); end if; Write_Eol; - Get_Name_String - (Name (Description (N))); + Get_Name_String (Name (Description (N))); while Are_There_More_Words loop Used_Columns := N_Space; @@ -680,9 +675,9 @@ package body Ocarina.Backends.C_Tree.Generator is ------------------------- procedure Generate_Expression (N : Node_Id) is - L_Expr : constant Node_Id := Left_Expression (N); - Op : constant Operator_Id := Operator (N); - R_Expr : constant Node_Id := Right_Expression (N); + L_Expr : constant Node_Id := Left_Expression (N); + Op : constant Operator_Id := Operator (N); + R_Expr : constant Node_Id := Right_Expression (N); begin -- Each expression having a right part and a left part is -- systematically put between two parentheses. @@ -982,7 +977,7 @@ package body Ocarina.Backends.C_Tree.Generator is Write_Eol; Increment_Indentation; - if not Is_Empty (D) then + if not Is_Empty (D) then M := First_Node (D); while Present (M) loop Write_Indentation; @@ -1252,7 +1247,7 @@ package body Ocarina.Backends.C_Tree.Generator is ---------------------- procedure Generate_HI_Node (N : Node_Id) is - U : Node_Id := First_Node (Units (N)); + U : Node_Id := First_Node (Units (N)); Partition_Directory : constant Name_Id := To_Lower (Name (N)); begin -- Create the node directory @@ -1329,7 +1324,7 @@ package body Ocarina.Backends.C_Tree.Generator is procedure Generate_Source_File (N : Node_Id) is Fd : File_Descriptor; - D : Node_Id := First_Node (Declarations (N)); + D : Node_Id := First_Node (Declarations (N)); begin if No (N) then return; @@ -1391,7 +1386,7 @@ package body Ocarina.Backends.C_Tree.Generator is procedure Generate_Header_File (N : Node_Id) is Fd : File_Descriptor; - D : Node_Id := First_Node (Declarations (N)); + D : Node_Id := First_Node (Declarations (N)); NA : Name_Id; begin if No (D) then diff --git a/src/backends/ocarina-backends-c_tree-generator.ads b/src/backends/ocarina-backends-c_tree-generator.ads index 21251d76..03290b5f 100644 --- a/src/backends/ocarina-backends-c_tree-generator.ads +++ b/src/backends/ocarina-backends-c_tree-generator.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -33,7 +33,7 @@ package Ocarina.Backends.C_Tree.Generator is - Var_Name_Len : Natural := 0; + Var_Name_Len : Natural := 0; Disable_Pkg_Body_Gen : Boolean := False; Disable_Pkg_Spec_Gen : Boolean := False; diff --git a/src/backends/ocarina-backends-c_tree-nutils.adb b/src/backends/ocarina-backends-c_tree-nutils.adb index 8ff0bf7e..989a300c 100644 --- a/src/backends/ocarina-backends-c_tree-nutils.adb +++ b/src/backends/ocarina-backends-c_tree-nutils.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -70,7 +70,7 @@ package body Ocarina.Backends.C_Tree.Nutils is package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils; package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes; package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes; - package CV renames Ocarina.Backends.C_Values; + package CV renames Ocarina.Backends.C_Values; package CTU renames Ocarina.Backends.C_Tree.Nutils; package CTN renames Ocarina.Backends.C_Tree.Nodes; package PHCR renames Ocarina.Backends.PO_HI_C.Runtime; @@ -80,19 +80,21 @@ package body Ocarina.Backends.C_Tree.Nutils is -- Used to mark C keywords and avoid collision with other languages type Entity_Stack_Entry is record - Current_File : Node_Id; - Current_Entity : Node_Id; + Current_File : Node_Id; + Current_Entity : Node_Id; end record; No_Depth : constant Int := -1; - package Entity_Stack is - new GNAT.Table (Entity_Stack_Entry, Int, No_Depth + 1, 10, 10); + package Entity_Stack is new GNAT.Table + (Entity_Stack_Entry, + Int, + No_Depth + 1, + 10, + 10); use Entity_Stack; - procedure New_Operator - (O : Operator_Type; - I : String := ""); + procedure New_Operator (O : Operator_Type; I : String := ""); ------------------------ -- Add_Prefix_To_Name -- @@ -100,8 +102,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Add_Prefix_To_Name (Prefix : String; - Name : Name_Id) - return Name_Id + Name : Name_Id) return Name_Id is begin Set_Str_To_Name_Buffer (Prefix); @@ -115,8 +116,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Add_Suffix_To_Name (Suffix : String; - Name : Name_Id) - return Name_Id + Name : Name_Id) return Name_Id is begin Get_Name_String (Name); @@ -130,8 +130,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Remove_Suffix_From_Name (Suffix : String; - Name : Name_Id) - return Name_Id + Name : Name_Id) return Name_Id is Length : Natural; Temp_Str : String (1 .. Suffix'Length); @@ -218,14 +217,14 @@ package body Ocarina.Backends.C_Tree.Nutils is when K_Function_Specification => C := New_Node (K_Function_Specification); CTN.Set_Defining_Identifier - (C, CTU.Copy_Node (Defining_Identifier (N))); + (C, + CTU.Copy_Node (Defining_Identifier (N))); CTN.Set_Parameters (C, CTN.Parameters (N)); CTN.Set_Return_Type (C, CTN.Return_Type (N)); when K_Include_Clause => C := New_Node (K_Include_Clause); - CTN.Set_Header_Name - (C, CTU.Copy_Node (Header_Name (N))); + CTN.Set_Header_Name (C, CTU.Copy_Node (Header_Name (N))); CTN.Set_Is_Local (C, CTN.Is_Local (N)); when K_Literal => @@ -466,8 +465,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_C_Comment (N : Name_Id; - Has_Header_Spaces : Boolean := True) - return Node_Id + Has_Header_Spaces : Boolean := True) return Node_Id is C : Node_Id; begin @@ -484,8 +482,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Assignment_Statement (Variable_Identifier : Node_Id; - Expression : Node_Id) - return Node_Id + Expression : Node_Id) return Node_Id is N : Node_Id; begin @@ -500,11 +497,10 @@ package body Ocarina.Backends.C_Tree.Nutils is ------------------------------ function Make_Defining_Identifier - (Name : Name_Id; - C_Conversion : Boolean := True; + (Name : Name_Id; + C_Conversion : Boolean := True; Ada_Conversion : Boolean := False; - Pointer : Boolean := False) - return Node_Id + Pointer : Boolean := False) return Node_Id is N : Node_Id; @@ -530,8 +526,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Expression (Left_Expr : Node_Id; Operator : Operator_Type := Op_None; - Right_Expr : Node_Id := No_Node) - return Node_Id + Right_Expr : Node_Id := No_Node) return Node_Id is N : Node_Id; begin @@ -551,8 +546,7 @@ package body Ocarina.Backends.C_Tree.Nutils is Pre_Cond : Node_Id; Condition : Node_Id; Post_Cond : Node_Id; - Statements : List_Id) - return Node_Id + Statements : List_Id) return Node_Id is N : Node_Id; begin @@ -582,9 +576,8 @@ package body Ocarina.Backends.C_Tree.Nutils is ------------------------- function Make_While_Statement - (Condition : Node_Id; - Statements : List_Id) - return Node_Id + (Condition : Node_Id; + Statements : List_Id) return Node_Id is N : Node_Id; begin @@ -600,8 +593,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Full_Type_Declaration (Defining_Identifier : Node_Id; - Type_Definition : Node_Id) - return Node_Id + Type_Definition : Node_Id) return Node_Id is N : Node_Id; @@ -617,10 +609,9 @@ package body Ocarina.Backends.C_Tree.Nutils is ----------------------- function Make_If_Statement - (Condition : Node_Id; - Statements : List_Id; - Else_Statements : List_Id := No_List) - return Node_Id + (Condition : Node_Id; + Statements : List_Id; + Else_Statements : List_Id := No_List) return Node_Id is N : Node_Id; begin @@ -638,8 +629,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_List_Id (N1 : Node_Id; N2 : Node_Id := No_Node; - N3 : Node_Id := No_Node) - return List_Id + N3 : Node_Id := No_Node) return List_Id is L : List_Id; begin @@ -661,8 +651,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Parameter_Specification (Defining_Identifier : Node_Id; - Parameter_Type : Node_Id := No_Node) - return Node_Id + Parameter_Type : Node_Id := No_Node) return Node_Id is P : Node_Id; @@ -678,8 +667,7 @@ package body Ocarina.Backends.C_Tree.Nutils is --------------------------- function Make_Return_Statement - (Expression : Node_Id := No_Node) - return Node_Id + (Expression : Node_Id := No_Node) return Node_Id is N : Node_Id; begin @@ -695,17 +683,16 @@ package body Ocarina.Backends.C_Tree.Nutils is --------------------------------- function Make_Function_Specification - (Defining_Identifier : Node_Id; - Parameters : List_Id := No_List; - Return_Type : Node_Id := No_Node) - return Node_Id + (Defining_Identifier : Node_Id; + Parameters : List_Id := No_List; + Return_Type : Node_Id := No_Node) return Node_Id is N : Node_Id; begin - N := New_Node (K_Function_Specification); - Set_Parameters (N, Parameters); + N := New_Node (K_Function_Specification); + Set_Parameters (N, Parameters); Set_Defining_Identifier (N, Defining_Identifier); - Set_Return_Type (N, Return_Type); + Set_Return_Type (N, Return_Type); return N; end Make_Function_Specification; @@ -716,9 +703,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Function_Implementation (Specification : Node_Id; Declarations : List_Id; - Statements : List_Id) - - return Node_Id + Statements : List_Id) return Node_Id is N : Node_Id; @@ -736,8 +721,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Member_Declaration (Defining_Identifier : Node_Id; - Used_Type : Node_Id) - return Node_Id + Used_Type : Node_Id) return Node_Id is P : Node_Id; begin @@ -753,8 +737,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Variable_Declaration (Defining_Identifier : Node_Id; - Used_Type : Node_Id) - return Node_Id + Used_Type : Node_Id) return Node_Id is P : Node_Id; begin @@ -768,10 +751,7 @@ package body Ocarina.Backends.C_Tree.Nutils is -- Make_Variable_Address -- --------------------------- - function Make_Variable_Address - (Expression : Node_Id) - return Node_Id - is + function Make_Variable_Address (Expression : Node_Id) return Node_Id is P : Node_Id; begin P := New_Node (K_Variable_Address); @@ -783,10 +763,7 @@ package body Ocarina.Backends.C_Tree.Nutils is -- Make_Extern_Entity_Declaration -- ------------------------------------ - function Make_Extern_Entity_Declaration - (Entity : Node_Id) - return Node_Id - is + function Make_Extern_Entity_Declaration (Entity : Node_Id) return Node_Id is P : Node_Id; begin P := New_Node (K_Extern_Entity_Declaration); @@ -800,8 +777,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Struct_Aggregate (Defining_Identifier : Node_Id := No_Node; - Members : List_Id) - return Node_Id + Members : List_Id) return Node_Id is N : Node_Id; begin @@ -819,8 +795,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Union_Aggregate (Defining_Identifier : Node_Id := No_Node; - Members : List_Id) - return Node_Id + Members : List_Id) return Node_Id is N : Node_Id; begin @@ -836,10 +811,7 @@ package body Ocarina.Backends.C_Tree.Nutils is -- Make_Enum_Aggregate -- ------------------------- - function Make_Enum_Aggregate - (Members : List_Id) - return Node_Id - is + function Make_Enum_Aggregate (Members : List_Id) return Node_Id is N : Node_Id; begin N := New_Node (K_Enum_Aggregate); @@ -852,9 +824,8 @@ package body Ocarina.Backends.C_Tree.Nutils is ----------------------- function Make_Call_Profile - (Defining_Identifier : Node_Id; - Parameters : List_Id := No_List) - return Node_Id + (Defining_Identifier : Node_Id; + Parameters : List_Id := No_List) return Node_Id is N : Node_Id; begin @@ -869,9 +840,8 @@ package body Ocarina.Backends.C_Tree.Nutils is --------------------- function Make_Macro_Call - (Defining_Identifier : Node_Id; - Parameters : List_Id := No_List) - return Node_Id + (Defining_Identifier : Node_Id; + Parameters : List_Id := No_List) return Node_Id is N : Node_Id; begin @@ -887,8 +857,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Type_Attribute (Designator : Node_Id; - Attribute : Attribute_Id) - return Node_Id + Attribute : Attribute_Id) return Node_Id is procedure Get_Scoped_Name_String (S : Node_Id); @@ -915,8 +884,7 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Type_Conversion (Subtype_Mark : Node_Id; - Expression : Node_Id) - return Node_Id + Expression : Node_Id) return Node_Id is N : Node_Id; begin @@ -982,19 +950,19 @@ package body Ocarina.Backends.C_Tree.Nutils is function New_List (Kind : CTN.Node_Kind; - From : Node_Id := No_Node) - return List_Id is + From : Node_Id := No_Node) return List_Id + is N : Node_Id; begin CTN.Entries.Increment_Last; - N := CTN.Entries.Last; + N := CTN.Entries.Last; CTN.Entries.Table (N) := CTN.Default_Node; Set_Kind (N, Kind); if Present (From) then - CTN.Set_Loc (N, CTN.Loc (From)); + CTN.Set_Loc (N, CTN.Loc (From)); else - CTN.Set_Loc (N, No_Location); + CTN.Set_Loc (N, No_Location); end if; return List_Id (N); end New_List; @@ -1005,13 +973,12 @@ package body Ocarina.Backends.C_Tree.Nutils is function New_Node (Kind : CTN.Node_Kind; - From : Node_Id := No_Node) - return Node_Id + From : Node_Id := No_Node) return Node_Id is N : Node_Id; begin CTN.Entries.Increment_Last; - N := CTN.Entries.Last; + N := CTN.Entries.Last; CTN.Entries.Table (N) := CTN.Default_Node; CTN.Set_Kind (N, Kind); @@ -1028,10 +995,7 @@ package body Ocarina.Backends.C_Tree.Nutils is -- New_Token -- --------------- - procedure New_Token - (T : Token_Type; - I : String := "") - is + procedure New_Token (T : Token_Type; I : String := "") is Name : Name_Id; begin if T in Keyword_Type then @@ -1055,9 +1019,7 @@ package body Ocarina.Backends.C_Tree.Nutils is -- New_Operator -- ------------------ - procedure New_Operator - (O : Operator_Type; - I : String := "") is + procedure New_Operator (O : Operator_Type; I : String := "") is begin if O in Keyword_Operator then Set_Str_To_Name_Buffer (Image (O)); @@ -1147,10 +1109,9 @@ package body Ocarina.Backends.C_Tree.Nutils is --------------- function To_C_Name - (N : Name_Id; - Ada_Style : Boolean := False; - Keyword_Check : Boolean := True) - return Name_Id + (N : Name_Id; + Ada_Style : Boolean := False; + Keyword_Check : Boolean := True) return Name_Id is Name : Name_Id; Test_Name : Name_Id; @@ -1165,7 +1126,7 @@ package body Ocarina.Backends.C_Tree.Nutils is -- "AADL_" string before the identifier. Test_Name := Add_Suffix_To_Name (Keyword_Suffix, Name); - V := Get_Name_Table_Byte (Test_Name); + V := Get_Name_Table_Byte (Test_Name); if V > 0 then Set_Str_To_Name_Buffer ("AADL_"); Get_Name_String_And_Append (Name); @@ -1437,11 +1398,10 @@ package body Ocarina.Backends.C_Tree.Nutils is -- Add_Include -- ----------------- - procedure Add_Include (E : Node_Id; Preserve_Case : Boolean := False) - is - W : Node_Id; - N : Name_Id; - M : Name_Id; + procedure Add_Include (E : Node_Id; Preserve_Case : Boolean := False) is + W : Node_Id; + N : Name_Id; + M : Name_Id; Existing_Include : Node_Id; begin -- Get the info associated to the obtained name in the hash @@ -1456,8 +1416,9 @@ package body Ocarina.Backends.C_Tree.Nutils is -- If the included file is the file in which we add the -- include, we return immediatly, because a file don't -- include itself - if To_Lower (CTN.Name (CTN.Header_Name (E))) - = To_Lower (CTN.Name (Defining_Identifier (Current_File))) then + if To_Lower (CTN.Name (CTN.Header_Name (E))) = + To_Lower (CTN.Name (Defining_Identifier (Current_File))) + then return; end if; @@ -1467,17 +1428,17 @@ package body Ocarina.Backends.C_Tree.Nutils is end if; Get_Name_String_And_Append (CTN.Name (CTN.Header_Name (E))); - Get_Name_String_And_Append (CTN.Name - (CTN.Entity (Distributed_Application_Unit (Current_File)))); + Get_Name_String_And_Append + (CTN.Name (CTN.Entity (Distributed_Application_Unit (Current_File)))); if Distributed_Application - (Entity - (Distributed_Application_Unit (Current_File))) /= No_Node then + (Entity (Distributed_Application_Unit (Current_File))) /= + No_Node + then Get_Name_String_And_Append - (CTN.Name - (Distributed_Application - (Entity - (Distributed_Application_Unit (Current_File))))); + (CTN.Name + (Distributed_Application + (Entity (Distributed_Application_Unit (Current_File))))); end if; if Preserve_Case then @@ -1497,9 +1458,10 @@ package body Ocarina.Backends.C_Tree.Nutils is Get_Name_String (CTN.Name (Header_Name ((E)))); M := Name_Find; - W := Make_Include_Clause - (Make_Defining_Identifier (M, not Preserve_Case), - Is_Local (E)); + W := + Make_Include_Clause + (Make_Defining_Identifier (M, not Preserve_Case), + Is_Local (E)); Set_Name_Table_Info (N, Int (W)); Append_Node_To_List (W, Included_Headers (Current_File)); @@ -1509,8 +1471,10 @@ package body Ocarina.Backends.C_Tree.Nutils is -- Make_Define_Statement -- --------------------------- - function Make_Define_Statement (Defining_Identifier : Node_Id; - Value : Node_Id) return Node_Id is + function Make_Define_Statement + (Defining_Identifier : Node_Id; + Value : Node_Id) return Node_Id + is N : Node_Id; begin N := New_Node (K_Define_Statement); @@ -1550,8 +1514,8 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Member_Designator (Defining_Identifier : Node_Id; Aggregate_Name : Node_Id; - Is_Pointer : Boolean := False) - return Node_Id is + Is_Pointer : Boolean := False) return Node_Id + is N : Node_Id; begin N := New_Node (K_Member_Designator); @@ -1567,7 +1531,8 @@ package body Ocarina.Backends.C_Tree.Nutils is function Make_Array_Declaration (Defining_Identifier : Node_Id; - Array_Size : Node_Id) return Node_Id is + Array_Size : Node_Id) return Node_Id + is N : Node_Id; begin N := New_Node (K_Array_Declaration); @@ -1580,8 +1545,7 @@ package body Ocarina.Backends.C_Tree.Nutils is -- Make_Array_Values -- ----------------------- - function Make_Array_Values - (Values : List_Id := No_List) return Node_Id is + function Make_Array_Values (Values : List_Id := No_List) return Node_Id is L : List_Id; N : Node_Id; begin @@ -1599,8 +1563,10 @@ package body Ocarina.Backends.C_Tree.Nutils is -- Make_Array_Value -- ---------------------- - function Make_Array_Value (Array_Name : Node_Id; Array_Item : Node_Id) - return Node_Id is + function Make_Array_Value + (Array_Name : Node_Id; + Array_Item : Node_Id) return Node_Id + is N : Node_Id; begin N := New_Node (K_Array_Value); @@ -1614,9 +1580,9 @@ package body Ocarina.Backends.C_Tree.Nutils is --------------------------- function Make_Switch_Statement - (Expression : Node_Id; - Alternatives : List_Id) - return Node_Id is + (Expression : Node_Id; + Alternatives : List_Id) return Node_Id + is N : Node_Id; begin N := New_Node (K_Switch_Statement); @@ -1630,8 +1596,9 @@ package body Ocarina.Backends.C_Tree.Nutils is ----------------------------- function Make_Switch_Alternative - (Labels : List_Id; - Statements : List_Id) return Node_Id is + (Labels : List_Id; + Statements : List_Id) return Node_Id + is N : Node_Id; begin N := New_Node (K_Switch_Alternative); @@ -1651,28 +1618,30 @@ package body Ocarina.Backends.C_Tree.Nutils is Statements : List_Id; Containing_Device : Node_Id := No_Node) is - Destination_F : Node_Id; - Source_F : Node_Id; - Source_Parent : Node_Id; - Param_Value : Node_Id; - Call_Profile : List_Id; - Spg : Node_Id; - Spg_Call : Node_Id; - N : Node_Id; - F : Node_Id; - M : Node_Id; - Owner : Node_Id; - Declaration : Node_Id; - Hybrid : constant Boolean := - AINU.Is_Subprogram (Caller) and then - Properties.Get_Subprogram_Kind (Caller) = - Properties.Subprogram_Hybrid_Ada_95; -- XXX why Ada ? + Destination_F : Node_Id; + Source_F : Node_Id; + Source_Parent : Node_Id; + Param_Value : Node_Id; + Call_Profile : List_Id; + Spg : Node_Id; + Spg_Call : Node_Id; + N : Node_Id; + F : Node_Id; + M : Node_Id; + Owner : Node_Id; + Declaration : Node_Id; + Hybrid : constant Boolean := + AINU.Is_Subprogram (Caller) + and then + Properties.Get_Subprogram_Kind (Caller) = + Properties.Subprogram_Hybrid_Ada_95; -- XXX why Ada ? begin -- The lists have to be created if Declarations = No_List or else Statements = No_List then - raise Program_Error with "Lists have to be created before any call " - & "to Handle_Call_Sequence"; + raise Program_Error + with "Lists have to be created before any call " & + "to Handle_Call_Sequence"; end if; -- The call sequence generally contains at least one call to a @@ -1689,7 +1658,7 @@ package body Ocarina.Backends.C_Tree.Nutils is Spg_Call := AIN.First_Node (AIN.Subprogram_Calls (Call_Seq)); while Present (Spg_Call) loop - Spg := AIN.Corresponding_Instance (Spg_Call); + Spg := AIN.Corresponding_Instance (Spg_Call); Call_Profile := New_List (CTN.K_List_Id); if not AINU.Is_Empty (AIN.Features (Spg)) then @@ -1702,9 +1671,9 @@ package body Ocarina.Backends.C_Tree.Nutils is -- handle the shared data with the same patterns as -- in PolyORB-HI-C. This could be updated later. - Param_Value := Make_Variable_Address - (Map_C_Defining_Identifier - (Get_Accessed_Data (F))); + Param_Value := + Make_Variable_Address + (Map_C_Defining_Identifier (Get_Accessed_Data (F))); Append_Node_To_List (Param_Value, Call_Profile); @@ -1717,8 +1686,8 @@ package body Ocarina.Backends.C_Tree.Nutils is if AINU.Length (AIN.Destinations (F)) = 0 then Display_Located_Error (AIN.Loc (F), - "This OUT parameter is not connected to" - & " any destination", + "This OUT parameter is not connected to" & + " any destination", Fatal => True); elsif AINU.Length (AIN.Destinations (F)) > 1 then Display_Located_Error @@ -1730,8 +1699,8 @@ package body Ocarina.Backends.C_Tree.Nutils is -- At this point, we have a subprogram call -- parameter that has exactly one destination. - Destination_F := AIN.Item - (AIN.First_Node (AIN.Destinations (F))); + Destination_F := + AIN.Item (AIN.First_Node (AIN.Destinations (F))); -- For each OUT parameter, we declare a local -- variable if the OUT parameter is connected to @@ -1751,38 +1720,43 @@ package body Ocarina.Backends.C_Tree.Nutils is -- calls twice the same subprogram. if Get_Current_Backend_Kind = PolyORB_HI_C then - M := Map_C_Data_Type_Designator - (Corresponding_Instance (F)); + M := + Map_C_Data_Type_Designator + (Corresponding_Instance (F)); Declaration := - Make_Variable_Declaration - (Defining_Identifier => - Make_Defining_Identifier - (Map_C_Variable_Name - (F, Request_Variable => True)), - Used_Type => M); + Make_Variable_Declaration + (Defining_Identifier => + Make_Defining_Identifier + (Map_C_Variable_Name + (F, + Request_Variable => True)), + Used_Type => M); - Append_Node_To_List - (Declaration, Declarations); + Append_Node_To_List (Declaration, Declarations); - M := Make_Defining_Identifier - (Map_C_Variable_Name - (F, Request_Variable => True)); + M := + Make_Defining_Identifier + (Map_C_Variable_Name + (F, + Request_Variable => True)); elsif Get_Current_Backend_Kind = PolyORB_Kernel_C then - M := Map_C_Data_Type_Designator - (Corresponding_Instance (F)); + M := + Map_C_Data_Type_Designator + (Corresponding_Instance (F)); Declaration := - Make_Variable_Declaration - (Defining_Identifier => - Make_Defining_Identifier - (Map_Port_Data (Destination_F)), - Used_Type => M); + Make_Variable_Declaration + (Defining_Identifier => + Make_Defining_Identifier + (Map_Port_Data (Destination_F)), + Used_Type => M); Append_Node_To_List (Declaration, Declarations); - M := Make_Defining_Identifier - (Map_Port_Data (Destination_F)); + M := + Make_Defining_Identifier + (Map_Port_Data (Destination_F)); end if; Param_Value := Make_Variable_Address (M); @@ -1794,10 +1768,12 @@ package body Ocarina.Backends.C_Tree.Nutils is -- record field corresponding to the calleR -- parameter. - Param_Value := Make_Member_Designator - (Make_Defining_Identifier - (To_C_Name (AIN.Display_Name (AIN.Identifier (F)))), - Make_Defining_Identifier (PN (P_Status))); + Param_Value := + Make_Member_Designator + (Make_Defining_Identifier + (To_C_Name + (AIN.Display_Name (AIN.Identifier (F)))), + Make_Defining_Identifier (PN (P_Status))); else -- (3) If the calleD parameter is connected to @@ -1805,11 +1781,11 @@ package body Ocarina.Backends.C_Tree.Nutils is -- is NOT hybrid, then we use simply the -- corresponding parameter of the calleR. - Param_Value := Make_Defining_Identifier - (To_C_Name - (AIN.Display_Name - (AIN.Identifier - (Destination_F)))); + Param_Value := + Make_Defining_Identifier + (To_C_Name + (AIN.Display_Name + (AIN.Identifier (Destination_F)))); end if; -- For each OUT parameter we build a parameter @@ -1828,8 +1804,8 @@ package body Ocarina.Backends.C_Tree.Nutils is if AINU.Length (AIN.Sources (F)) = 0 then Display_Located_Error (AIN.Loc (F), - "This IN parameter is not connected to" - & " any source", + "This IN parameter is not connected to" & + " any source", Fatal => True); elsif AINU.Length (AIN.Sources (F)) > 1 then Display_Located_Error @@ -1859,39 +1835,39 @@ package body Ocarina.Backends.C_Tree.Nutils is if Get_Current_Backend_Kind = PolyORB_HI_C then Param_Value := Make_Member_Designator - (Defining_Identifier => - Make_Member_Designator - (Defining_Identifier => - Make_Member_Designator - (Defining_Identifier => - Make_Defining_Identifier - (Map_C_Enumerator_Name - (Source_F)), - Aggregate_Name => - Make_Defining_Identifier - (Map_C_Enumerator_Name - (Source_F))), - Aggregate_Name => - Make_Defining_Identifier (MN (M_Vars))), - Aggregate_Name => - Make_Defining_Identifier - (Map_C_Variable_Name - (Source_F, Port_Request => True))); + (Defining_Identifier => + Make_Member_Designator + (Defining_Identifier => + Make_Member_Designator + (Defining_Identifier => + Make_Defining_Identifier + (Map_C_Enumerator_Name (Source_F)), + Aggregate_Name => + Make_Defining_Identifier + (Map_C_Enumerator_Name (Source_F))), + Aggregate_Name => + Make_Defining_Identifier (MN (M_Vars))), + Aggregate_Name => + Make_Defining_Identifier + (Map_C_Variable_Name + (Source_F, + Port_Request => True))); else - M := Map_C_Data_Type_Designator - (Corresponding_Instance (F)); + M := + Map_C_Data_Type_Designator + (Corresponding_Instance (F)); Declaration := - Make_Variable_Declaration - (Defining_Identifier => - Make_Defining_Identifier - (Map_Port_Data (Source_F)), - Used_Type => M); + Make_Variable_Declaration + (Defining_Identifier => + Make_Defining_Identifier + (Map_Port_Data (Source_F)), + Used_Type => M); Append_Node_To_List (Declaration, Declarations); - Param_Value := Make_Defining_Identifier - (Map_Port_Data (Source_F)); + Param_Value := + Make_Defining_Identifier (Map_Port_Data (Source_F)); end if; elsif Source_Parent /= Caller then @@ -1899,9 +1875,11 @@ package body Ocarina.Backends.C_Tree.Nutils is -- the englobing subprogram, we use the -- formerly declared variable. - Param_Value := Make_Defining_Identifier - (Map_C_Variable_Name - (Source_F, Request_Variable => True)); + Param_Value := + Make_Defining_Identifier + (Map_C_Variable_Name + (Source_F, + Request_Variable => True)); elsif Hybrid then -- (3) If the calleD parameter is connected to @@ -1909,22 +1887,22 @@ package body Ocarina.Backends.C_Tree.Nutils is -- hybrid, then we use the 'Status' record field -- corresponding to the calleR parameter. - Param_Value := Make_Member_Designator - (Make_Defining_Identifier - (To_C_Name - (AIN.Display_Name - (AIN.Identifier (Source_F)))), - Make_Defining_Identifier - (PN (P_Status))); + Param_Value := + Make_Member_Designator + (Make_Defining_Identifier + (To_C_Name + (AIN.Display_Name (AIN.Identifier (Source_F)))), + Make_Defining_Identifier (PN (P_Status))); else -- (4) If the calleD parameter is connected to -- the calleR parameter and then then calleR -- is NOT hybrid, then we use simply the -- corresponding paremeter of the calleR. - Param_Value := Make_Defining_Identifier - (To_C_Name (AIN.Display_Name - (AIN.Identifier (Source_F)))); + Param_Value := + Make_Defining_Identifier + (To_C_Name + (AIN.Display_Name (AIN.Identifier (Source_F)))); end if; -- For each IN parameter we build a parameter @@ -1949,9 +1927,10 @@ package body Ocarina.Backends.C_Tree.Nutils is CTU.Append_Node_To_List (N, Statements); Owner := Get_Actual_Owner (Spg_Call); - N := Make_Variable_Address - (CTN.Defining_Identifier - (CTN.Object_Node (Backend_Node (Identifier (Owner))))); + N := + Make_Variable_Address + (CTN.Defining_Identifier + (CTN.Object_Node (Backend_Node (Identifier (Owner))))); Append_Node_To_List (N, Call_Profile); @@ -1960,9 +1939,10 @@ package body Ocarina.Backends.C_Tree.Nutils is -- of the 'Path' list) and from the actual data component -- instance the call is connected to. - N := Map_C_Feature_Subprogram - (Item (AIN.Last_Node (Path (Spg_Call))), - Corresponding_Instance (Get_Actual_Owner (Spg_Call))); + N := + Map_C_Feature_Subprogram + (Item (AIN.Last_Node (Path (Spg_Call))), + Corresponding_Instance (Get_Actual_Owner (Spg_Call))); N := Make_Call_Profile (N, Call_Profile); CTU.Append_Node_To_List (N, Statements); @@ -1984,8 +1964,8 @@ package body Ocarina.Backends.C_Tree.Nutils is N := Map_C_Defining_Identifier (Spg); if Containing_Device /= No_Node then CTU.Append_Node_To_List - (Make_Defining_Identifier - (Map_C_Enumerator_Name (Containing_Device)), + (Make_Defining_Identifier + (Map_C_Enumerator_Name (Containing_Device)), Call_Profile); end if; elsif Get_Current_Backend_Kind = PolyORB_Kernel_C then @@ -2015,33 +1995,30 @@ package body Ocarina.Backends.C_Tree.Nutils is when Data_Integer => -- For integers, default value is 0 - Result := CTU.Make_Literal - (CV.New_Int_Value (0, 1, 10)); + Result := CTU.Make_Literal (CV.New_Int_Value (0, 1, 10)); when Data_Float | Data_Fixed => -- For reals, the default value is 0.0 - Result := CTU.Make_Literal - (CV.New_Floating_Point_Value (0.0)); + Result := CTU.Make_Literal (CV.New_Floating_Point_Value (0.0)); when Data_Boolean => -- For booleans, the default value is FALSE - Result := CTU.Make_Literal - (CV.New_Int_Value (0, 1, 10)); + Result := CTU.Make_Literal (CV.New_Int_Value (0, 1, 10)); when Data_Character => -- For characters, the default value is the space ' ' - Result := CTU.Make_Literal - (CV.New_Char_Value (Character'Pos (' '))); + Result := + CTU.Make_Literal (CV.New_Char_Value (Character'Pos (' '))); when Data_Wide_Character => -- For wide characters, the default value is the wide -- space ' '. - Result := CTU.Make_Literal - (CV.New_Char_Value (Character'Pos (' '))); + Result := + CTU.Make_Literal (CV.New_Char_Value (Character'Pos (' '))); when Data_String => Display_Located_Error @@ -2064,8 +2041,9 @@ package body Ocarina.Backends.C_Tree.Nutils is when Data_With_Accessors => -- This is definitely a code generation error - raise Program_Error with "Data types with accessors should" - & " not have default values"; + raise Program_Error + with "Data types with accessors should" & + " not have default values"; when others => raise Program_Error with "Unsupported data type default value!"; @@ -2080,9 +2058,8 @@ package body Ocarina.Backends.C_Tree.Nutils is ------------------------- function Make_Include_Clause - (Header_Name : Node_Id; - Local : Boolean := False) - return Node_Id + (Header_Name : Node_Id; + Local : Boolean := False) return Node_Id is N : Node_Id; begin @@ -2097,18 +2074,17 @@ package body Ocarina.Backends.C_Tree.Nutils is -- Add_Define_Deployment -- --------------------------- - procedure Add_Define_Deployment (E : Node_Id) - is - W : Node_Id; - N : Name_Id; - F : Node_Id; - Existing_Def : Node_Id; + procedure Add_Define_Deployment (E : Node_Id) is + W : Node_Id; + N : Name_Id; + F : Node_Id; + Existing_Def : Node_Id; begin Set_Str_To_Name_Buffer ("deployment"); Get_Name_String_And_Append (CTN.Name (E)); Get_Name_String_And_Append - (CTN.Name (CTN.Entity (Table (Last).Current_Entity))); + (CTN.Name (CTN.Entity (Table (Last).Current_Entity))); N := Name_Find; Existing_Def := Node_Id (Get_Name_Table_Info (N)); @@ -2119,16 +2095,16 @@ package body Ocarina.Backends.C_Tree.Nutils is end if; -- Else, we add the corresponding header file to included files - W := CTU.Make_Define_Statement - (Defining_Identifier => Copy_Node (E), - Value => CTU.Make_Literal - (CV.New_Int_Value (1, 1, 10))); + W := + CTU.Make_Define_Statement + (Defining_Identifier => Copy_Node (E), + Value => CTU.Make_Literal (CV.New_Int_Value (1, 1, 10))); Set_Name_Table_Info (N, Int (W)); - F := Table (Last).Current_File; - Table (Last).Current_File := Deployment_Header - (Table (Last).Current_Entity); + F := Table (Last).Current_File; + Table (Last).Current_File := + Deployment_Header (Table (Last).Current_Entity); Append_Node_To_List (W, CTN.Declarations (Current_File)); Table (Last).Current_File := F; end Add_Define_Deployment; @@ -2138,7 +2114,7 @@ package body Ocarina.Backends.C_Tree.Nutils is -------------------------- procedure POK_Add_Return_Assertion - (Statements : List_Id; + (Statements : List_Id; Exception_Error : Node_Id := No_Node) is begin @@ -2148,16 +2124,16 @@ package body Ocarina.Backends.C_Tree.Nutils is if Exception_Error = No_Node then Append_Node_To_List - (Make_Macro_Call - (PKR.RE (PKR.RE_Assert_Ret), + (Make_Macro_Call + (PKR.RE (PKR.RE_Assert_Ret), Make_List_Id (Make_Defining_Identifier (VN (V_Ret)))), Statements); else Append_Node_To_List - (Make_Macro_Call - (PKR.RE (PKR.RE_Assert_Ret_With_Exception), + (Make_Macro_Call + (PKR.RE (PKR.RE_Assert_Ret_With_Exception), Make_List_Id - (Make_Defining_Identifier (VN (V_Ret)), + (Make_Defining_Identifier (VN (V_Ret)), Exception_Error)), Statements); end if; @@ -2168,19 +2144,18 @@ package body Ocarina.Backends.C_Tree.Nutils is ---------------------------------------- function POK_Make_Function_Call_With_Assert - (Function_Name : Node_Id; Parameters : List_Id) - return Node_Id + (Function_Name : Node_Id; + Parameters : List_Id) return Node_Id is use Ocarina.Backends.POK_C; Function_Call : Node_Id; begin Function_Call := Make_Call_Profile (Function_Name, Parameters); - if POK_C.Add_Assertions - and then POK_Flavor = POK then + if POK_C.Add_Assertions and then POK_Flavor = POK then return Make_Expression - (Make_Defining_Identifier (VN (V_Ret)), - Op_Equal, - Function_Call); + (Make_Defining_Identifier (VN (V_Ret)), + Op_Equal, + Function_Call); else return Function_Call; end if; @@ -2191,16 +2166,16 @@ package body Ocarina.Backends.C_Tree.Nutils is ------------------- function Get_Data_Size (Data : Node_Id) return Node_Id is - Data_Representation : Supported_Data_Representation; - Value_UUL : Unsigned_Long_Long; - Value_Node : Node_Id := No_Node; - Dimension : constant ULL_Array := Get_Dimension (Data); - Type_Size : Size_Type; + Data_Representation : Supported_Data_Representation; + Value_UUL : Unsigned_Long_Long; + Value_Node : Node_Id := No_Node; + Dimension : constant ULL_Array := Get_Dimension (Data); + Type_Size : Size_Type; begin pragma Assert (AINU.Is_Data (Data)); Data_Representation := Get_Data_Representation (Data); - Type_Size := Get_Data_Size (Data); + Type_Size := Get_Data_Size (Data); if Get_Data_Size (Data) /= Null_Size then Value_UUL := To_Bytes (Type_Size); @@ -2209,52 +2184,57 @@ package body Ocarina.Backends.C_Tree.Nutils is if Is_Defined_Property (Data, "type_source_name") then return Make_Call_Profile - (Make_Defining_Identifier (FN (F_Sizeof)), - Make_List_Id - (Make_Defining_Identifier - (To_C_Name - (Get_String_Property - (Data, "type_source_name"))))); + (Make_Defining_Identifier (FN (F_Sizeof)), + Make_List_Id + (Make_Defining_Identifier + (To_C_Name + (Get_String_Property (Data, "type_source_name"))))); end if; case Data_Representation is when Data_Integer | Data_Boolean => - Value_Node := Make_Call_Profile - (Make_Defining_Identifier (FN (F_Sizeof)), - Make_List_Id (Make_Defining_Identifier (TN (T_Int)))); + Value_Node := + Make_Call_Profile + (Make_Defining_Identifier (FN (F_Sizeof)), + Make_List_Id (Make_Defining_Identifier (TN (T_Int)))); when Data_Float => - Value_Node := Make_Call_Profile - (Make_Defining_Identifier (FN (F_Sizeof)), - Make_List_Id (Make_Defining_Identifier (TN (T_Float)))); + Value_Node := + Make_Call_Profile + (Make_Defining_Identifier (FN (F_Sizeof)), + Make_List_Id (Make_Defining_Identifier (TN (T_Float)))); when Data_String | Data_Wide_String => Value_UUL := Dimension (1); when Data_Array => - Value_Node := Make_Expression - (Left_Expr => - Make_Literal (New_Int_Value (Dimension (1), 1, 10)), - Operator => Op_Asterisk, - Right_Expr => Get_Data_Size + Value_Node := + Make_Expression + (Left_Expr => + Make_Literal (New_Int_Value (Dimension (1), 1, 10)), + Operator => Op_Asterisk, + Right_Expr => + Get_Data_Size (ATN.Entity (ATN.First_Node (Get_Base_Type (Data))))); when Data_None => - Value_Node := Make_Call_Profile - (Make_Defining_Identifier (FN (F_Sizeof)), - Make_List_Id (Map_C_Defining_Identifier (Data))); + Value_Node := + Make_Call_Profile + (Make_Defining_Identifier (FN (F_Sizeof)), + Make_List_Id (Map_C_Defining_Identifier (Data))); when others => - Value_Node := Make_Call_Profile - (Make_Defining_Identifier (FN (F_Sizeof)), - Make_List_Id (Map_C_Defining_Identifier (Data))); + Value_Node := + Make_Call_Profile + (Make_Defining_Identifier (FN (F_Sizeof)), + Make_List_Id (Map_C_Defining_Identifier (Data))); end case; if Value_Node /= No_Node then return Value_Node; else - raise Program_Error with - "Impossible to get the data size of this data"; + raise Program_Error + with "Impossible to get the data size of this data"; end if; end Get_Data_Size; @@ -2265,7 +2245,7 @@ package body Ocarina.Backends.C_Tree.Nutils is procedure Add_Return_Variable_In_Parameters (Parameters : List_Id) is begin Append_Node_To_List - (Make_Variable_Address (Make_Defining_Identifier (VN (V_Ret))), + (Make_Variable_Address (Make_Defining_Identifier (VN (V_Ret))), Parameters); end Add_Return_Variable_In_Parameters; @@ -2273,23 +2253,24 @@ package body Ocarina.Backends.C_Tree.Nutils is -- Declare_Return_Variable_In_Function_Declaration -- ----------------------------------------------------- - procedure POK_Declare_Return_Variable - (Declarations : List_Id) is + procedure POK_Declare_Return_Variable (Declarations : List_Id) is use Ocarina.Backends.POK_C; use Ocarina.Backends.POK_C.Runtime; N : Node_Id; begin - if POK_C.Add_Assertions and then POK_Flavor = POK then - N := Make_Variable_Declaration - (Defining_Identifier => Make_Defining_Identifier (VN (V_Ret)), - Used_Type => RE (RE_Pok_Ret_T)); - Append_Node_To_List (N, Declarations); - elsif POK_Flavor = ARINC653 then - N := Make_Variable_Declaration - (Defining_Identifier => Make_Defining_Identifier (VN (V_Ret)), - Used_Type => RE (RE_Return_Code_Type)); - Append_Node_To_List (N, Declarations); - end if; + if POK_C.Add_Assertions and then POK_Flavor = POK then + N := + Make_Variable_Declaration + (Defining_Identifier => Make_Defining_Identifier (VN (V_Ret)), + Used_Type => RE (RE_Pok_Ret_T)); + Append_Node_To_List (N, Declarations); + elsif POK_Flavor = ARINC653 then + N := + Make_Variable_Declaration + (Defining_Identifier => Make_Defining_Identifier (VN (V_Ret)), + Used_Type => RE (RE_Return_Code_Type)); + Append_Node_To_List (N, Declarations); + end if; end POK_Declare_Return_Variable; ------------------------- @@ -2297,10 +2278,11 @@ package body Ocarina.Backends.C_Tree.Nutils is ------------------------- function Make_Ifdef_Clause - (Clause : Node_Id; - Negation : Boolean := False; + (Clause : Node_Id; + Negation : Boolean := False; Then_Statements : List_Id; - Else_Statements : List_Id) return Node_Id is + Else_Statements : List_Id) return Node_Id + is N : Node_Id; begin N := New_Node (K_Ifdef_Clause); @@ -2317,19 +2299,20 @@ package body Ocarina.Backends.C_Tree.Nutils is function Get_Inter_Partition_Port_Size (Port : Node_Id) return Node_Id is - Type_Found : Node_Id; + Type_Found : Node_Id; - function Get_Inter_Partition_Port_Size_Rec (Port : Node_Id; - Method : Browsing_Kind) - return Node_Id is - Source_Port : Node_Id; - Destination_Port : Node_Id; - Tmp : Node_Id; - Associated_Type : Node_Id; + function Get_Inter_Partition_Port_Size_Rec + (Port : Node_Id; + Method : Browsing_Kind) return Node_Id + is + Source_Port : Node_Id; + Destination_Port : Node_Id; + Tmp : Node_Id; + Associated_Type : Node_Id; begin - Associated_Type := Get_Instance_Type_Associated_With_Virtual_Bus - (Port); + Associated_Type := + Get_Instance_Type_Associated_With_Virtual_Bus (Port); if Associated_Type /= No_Node then return CTU.Get_Data_Size (Associated_Type); @@ -2343,15 +2326,16 @@ package body Ocarina.Backends.C_Tree.Nutils is -- no virtual bus was found so we fallback to the thread application -- data. - if Method = By_Source and then - not AINU.Is_Empty (AIN.Sources (Port)) then + if Method = By_Source + and then not AINU.Is_Empty (AIN.Sources (Port)) + then Tmp := AIN.First_Node (AIN.Sources (Port)); while Present (Tmp) loop Source_Port := AIN.Item (Tmp); - Associated_Type := Get_Inter_Partition_Port_Size_Rec - (Source_Port, Method); + Associated_Type := + Get_Inter_Partition_Port_Size_Rec (Source_Port, Method); if Associated_Type /= No_Node then return Associated_Type; @@ -2362,15 +2346,16 @@ package body Ocarina.Backends.C_Tree.Nutils is end loop; end if; - if Method = By_Destination and then - not AINU.Is_Empty (AIN.Destinations (Port)) then + if Method = By_Destination + and then not AINU.Is_Empty (AIN.Destinations (Port)) + then Tmp := AIN.First_Node (AIN.Destinations (Port)); while Present (Tmp) loop Destination_Port := AIN.Item (Tmp); - Associated_Type := Get_Inter_Partition_Port_Size_Rec - (Destination_Port, Method); + Associated_Type := + Get_Inter_Partition_Port_Size_Rec (Destination_Port, Method); if Associated_Type /= No_Node then return Associated_Type; @@ -2387,15 +2372,15 @@ package body Ocarina.Backends.C_Tree.Nutils is begin if not AIN.Is_Data (Port) then - raise Program_Error with - "Call to Get_Inter_Partition_Port_Size with non DATA port"; + raise Program_Error + with "Call to Get_Inter_Partition_Port_Size with non DATA port"; end if; if AIN.Is_In (Port) then Type_Found := Get_Inter_Partition_Port_Size_Rec (Port, By_Source); else - Type_Found := Get_Inter_Partition_Port_Size_Rec - (Port, By_Destination); + Type_Found := + Get_Inter_Partition_Port_Size_Rec (Port, By_Destination); end if; if Type_Found = No_Node then @@ -2409,29 +2394,30 @@ package body Ocarina.Backends.C_Tree.Nutils is -- Get_Inter_Partition_Port_Type -- ------------------------------------- - function Get_Inter_Partition_Port_Type (Port : Node_Id) - return Node_Id is + function Get_Inter_Partition_Port_Type (Port : Node_Id) return Node_Id is Type_Found : Node_Id; - function Get_Inter_Partition_Port_Type_Rec (Port : Node_Id; - Method : Browsing_Kind) - return Node_Id is - Source_Port : Node_Id; - Destination_Port : Node_Id; - Tmp : Node_Id; - Associated_Type : Node_Id; + function Get_Inter_Partition_Port_Type_Rec + (Port : Node_Id; + Method : Browsing_Kind) return Node_Id + is + Source_Port : Node_Id; + Destination_Port : Node_Id; + Tmp : Node_Id; + Associated_Type : Node_Id; begin - Associated_Type := Get_Instance_Type_Associated_With_Virtual_Bus - (Port); + Associated_Type := + Get_Instance_Type_Associated_With_Virtual_Bus (Port); if Associated_Type /= No_Node then if Is_Defined_Property (Associated_Type, "type_source_name") then return Make_Defining_Identifier - (To_C_Name - (Get_String_Property - (Associated_Type, "type_source_name"))); + (To_C_Name + (Get_String_Property + (Associated_Type, + "type_source_name"))); else return Map_C_Data_Type_Designator (Associated_Type); end if; @@ -2445,15 +2431,16 @@ package body Ocarina.Backends.C_Tree.Nutils is -- no virtual bus was found so we fallback to the thread application -- data. - if Method = By_Source and then - not AINU.Is_Empty (AIN.Sources (Port)) then + if Method = By_Source + and then not AINU.Is_Empty (AIN.Sources (Port)) + then Tmp := AIN.First_Node (AIN.Sources (Port)); while Present (Tmp) loop Source_Port := AIN.Item (Tmp); - Associated_Type := Get_Inter_Partition_Port_Type_Rec - (Source_Port, Method); + Associated_Type := + Get_Inter_Partition_Port_Type_Rec (Source_Port, Method); if Associated_Type /= No_Node then return Associated_Type; @@ -2464,15 +2451,16 @@ package body Ocarina.Backends.C_Tree.Nutils is end loop; end if; - if Method = By_Destination and then - not AINU.Is_Empty (AIN.Destinations (Port)) then + if Method = By_Destination + and then not AINU.Is_Empty (AIN.Destinations (Port)) + then Tmp := AIN.First_Node (AIN.Destinations (Port)); while Present (Tmp) loop Destination_Port := AIN.Item (Tmp); - Associated_Type := Get_Inter_Partition_Port_Type_Rec - (Destination_Port, Method); + Associated_Type := + Get_Inter_Partition_Port_Type_Rec (Destination_Port, Method); if Associated_Type /= No_Node then return Associated_Type; @@ -2489,8 +2477,8 @@ package body Ocarina.Backends.C_Tree.Nutils is begin if not AIN.Is_Data (Port) then - raise Program_Error with - "Call to Get_Inter_Partition_Port_Type with non DATA port"; + raise Program_Error + with "Call to Get_Inter_Partition_Port_Type with non DATA port"; end if; Type_Found := Get_Inter_Partition_Port_Type_Rec (Port, By_Source); @@ -2513,22 +2501,21 @@ package body Ocarina.Backends.C_Tree.Nutils is ---------------------------- function Make_Doxygen_C_Comment - (Desc : String; - Brief : String := ""; - Element_Name : String := ""; - Is_Struct : Boolean := False; - Is_Union : Boolean := False; - Is_Enum : Boolean := False; - Is_Function : Boolean := False; - Is_Variable : Boolean := False; - Is_Define : Boolean := False; - Is_Typedef : Boolean := False; - Is_File : Boolean := False; - Is_Namespace : Boolean := False; - Is_Package : Boolean := False; - Is_Interface : Boolean := False; - Has_Header_Spaces : Boolean := True) - return Node_Id + (Desc : String; + Brief : String := ""; + Element_Name : String := ""; + Is_Struct : Boolean := False; + Is_Union : Boolean := False; + Is_Enum : Boolean := False; + Is_Function : Boolean := False; + Is_Variable : Boolean := False; + Is_Define : Boolean := False; + Is_Typedef : Boolean := False; + Is_File : Boolean := False; + Is_Namespace : Boolean := False; + Is_Package : Boolean := False; + Is_Interface : Boolean := False; + Has_Header_Spaces : Boolean := True) return Node_Id is C : Node_Id; begin @@ -2551,24 +2538,18 @@ package body Ocarina.Backends.C_Tree.Nutils is CTN.Set_Has_Header_Spaces (C, Has_Header_Spaces); if Desc /= "" then - Set_Description - (C, New_Node (K_Defining_Identifier)); - CTN.Set_Name - (Description (C), Get_String_Name (Desc)); + Set_Description (C, New_Node (K_Defining_Identifier)); + CTN.Set_Name (Description (C), Get_String_Name (Desc)); end if; if Element_Name /= "" then - Set_Element - (C, New_Node (K_Defining_Identifier)); - CTN.Set_Name - (Element (C), Get_String_Name (Element_Name)); + Set_Element (C, New_Node (K_Defining_Identifier)); + CTN.Set_Name (Element (C), Get_String_Name (Element_Name)); end if; if Brief /= "" then - Set_Summary - (C, New_Node (K_Defining_Identifier)); - CTN.Set_Name - (Summary (C), Get_String_Name (Brief)); + Set_Summary (C, New_Node (K_Defining_Identifier)); + CTN.Set_Name (Summary (C), Get_String_Name (Brief)); end if; CTN.Set_For_Struct (C, Is_Struct); diff --git a/src/backends/ocarina-backends-c_tree-nutils.ads b/src/backends/ocarina-backends-c_tree-nutils.ads index ecc489a8..7d32e0b3 100644 --- a/src/backends/ocarina-backends-c_tree-nutils.ads +++ b/src/backends/ocarina-backends-c_tree-nutils.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -35,22 +35,22 @@ with Ocarina.Backends.C_Tree.Nodes; use Ocarina.Backends.C_Tree.Nodes; package Ocarina.Backends.C_Tree.Nutils is - Int0_Val : Value_Id; - Int1_Val : Value_Id; + Int0_Val : Value_Id; + Int1_Val : Value_Id; - Var_Suffix : constant String := "_j"; - Initialized : Boolean := False; + Var_Suffix : constant String := "_j"; + Initialized : Boolean := False; - Output_Unit_Withing : Boolean := False; + Output_Unit_Withing : Boolean := False; -- Control flags type Browsing_Kind is (By_Source, By_Destination, Default); type Token_Type is ( - -- Token name Token type - -- Keywords - Tok_Null, -- NULL **** First Keyword + -- Token name Token type + -- Keywords + Tok_Null, -- NULL **** First Keyword Tok_Break, -- BREAK Tok_Case, -- CASE Tok_Const, -- CONST @@ -75,7 +75,7 @@ package Ocarina.Backends.C_Tree.Nutils is Tok_Switch, -- SWITCH Tok_Typedef, -- TYPEDEF - -- Graphic Characters + -- Graphic Characters Tok_Xor, -- ^ Tok_Sharp, -- # Tok_Mod, -- % @@ -114,10 +114,9 @@ package Ocarina.Backends.C_Tree.Nutils is Token_Image : array (Token_Type) of Name_Id; - subtype Keyword_Type is Token_Type - range Tok_Null .. Tok_Typedef; + subtype Keyword_Type is Token_Type range Tok_Null .. Tok_Typedef; - type Operator_Type is + type Operator_Type is (Op_Not, -- not Op_And, -- and Op_In, -- in @@ -145,11 +144,11 @@ package Ocarina.Backends.C_Tree.Nutils is Op_None); -- No operation Operator_Image : array - (Operator_Type'Pos (Op_And) .. Operator_Type'Pos (Op_Vertical_Bar)) - of Name_Id; + (Operator_Type'Pos (Op_And) .. + Operator_Type'Pos (Op_Vertical_Bar)) of Name_Id; - subtype Keyword_Operator is Operator_Type - range Operator_Type'First .. Op_Or_Else; + subtype Keyword_Operator is + Operator_Type range Operator_Type'First .. Op_Or_Else; type Parameter_Id is (P_From, @@ -196,8 +195,7 @@ package Ocarina.Backends.C_Tree.Nutils is MN : array (Member_Id) of Name_Id; - type Constant_Id is - (C_Null); + type Constant_Id is (C_Null); CONST : array (Constant_Id) of Name_Id; @@ -228,11 +226,7 @@ package Ocarina.Backends.C_Tree.Nutils is VN : array (Variable_Id) of Name_Id; type Function_Id is - (F_Process_Request, - F_Register_Source, - F_Init_Lane, - F_Sizeof, - F_Create); + (F_Process_Request, F_Register_Source, F_Init_Lane, F_Sizeof, F_Create); FN : array (Function_Id) of Name_Id; @@ -281,18 +275,15 @@ package Ocarina.Backends.C_Tree.Nutils is function Add_Prefix_To_Name (Prefix : String; - Name : Name_Id) - return Name_Id; + Name : Name_Id) return Name_Id; function Add_Suffix_To_Name (Suffix : String; - Name : Name_Id) - return Name_Id; + Name : Name_Id) return Name_Id; function Remove_Suffix_From_Name (Suffix : String; - Name : Name_Id) - return Name_Id; + Name : Name_Id) return Name_Id; -- This function returns a new name without the suffix. If the -- suffix does not exist, the returned name is equal to the given -- name. @@ -303,22 +294,18 @@ package Ocarina.Backends.C_Tree.Nutils is procedure Push_Entity (E : Node_Id); procedure Pop_Entity; - function Current_Entity return Node_Id; - function Current_File return Node_Id; + function Current_Entity return Node_Id; + function Current_File return Node_Id; - function Copy_Node - (N : Node_Id) - return Node_Id; + function Copy_Node (N : Node_Id) return Node_Id; function New_Node (Kind : Node_Kind; - From : Node_Id := No_Node) - return Node_Id; + From : Node_Id := No_Node) return Node_Id; function New_List (Kind : Node_Kind; - From : Node_Id := No_Node) - return List_Id; + From : Node_Id := No_Node) return List_Id; function Image (T : Token_Type) return String; function Image (O : Operator_Type) return String; @@ -339,8 +326,7 @@ package Ocarina.Backends.C_Tree.Nutils is function Make_C_Comment (N : Name_Id; - Has_Header_Spaces : Boolean := True) - return Node_Id; + Has_Header_Spaces : Boolean := True) return Node_Id; -- This function does only the fllowing thing: it creates a node -- whose name is the full text of the comment. It does not split -- the comment into many lines. This is done in the code @@ -348,116 +334,94 @@ package Ocarina.Backends.C_Tree.Nutils is function Make_Assignment_Statement (Variable_Identifier : Node_Id; - Expression : Node_Id) - return Node_Id; + Expression : Node_Id) return Node_Id; function Make_Defining_Identifier - (Name : Name_Id; - C_Conversion : Boolean := True; + (Name : Name_Id; + C_Conversion : Boolean := True; Ada_Conversion : Boolean := False; - Pointer : Boolean := False) - return Node_Id; + Pointer : Boolean := False) return Node_Id; function Make_Expression (Left_Expr : Node_Id; Operator : Operator_Type := Op_None; - Right_Expr : Node_Id := No_Node) - return Node_Id; + Right_Expr : Node_Id := No_Node) return Node_Id; function Make_For_Statement (Defining_Identifier : Node_Id; Pre_Cond : Node_Id; Condition : Node_Id; Post_Cond : Node_Id; - Statements : List_Id) - return Node_Id; + Statements : List_Id) return Node_Id; function Make_Variable_Declaration (Defining_Identifier : Node_Id; - Used_Type : Node_Id) - return Node_Id; + Used_Type : Node_Id) return Node_Id; function Make_Member_Declaration (Defining_Identifier : Node_Id; - Used_Type : Node_Id) - return Node_Id; + Used_Type : Node_Id) return Node_Id; - function Make_Enum_Aggregate - (Members : List_Id) - return Node_Id; + function Make_Enum_Aggregate (Members : List_Id) return Node_Id; function Make_Struct_Aggregate (Defining_Identifier : Node_Id := No_Node; - Members : List_Id) - return Node_Id; + Members : List_Id) return Node_Id; function Make_Union_Aggregate (Defining_Identifier : Node_Id := No_Node; - Members : List_Id) - return Node_Id; + Members : List_Id) return Node_Id; function Make_While_Statement - (Condition : Node_Id; - Statements : List_Id) - return Node_Id; + (Condition : Node_Id; + Statements : List_Id) return Node_Id; function Make_Full_Type_Declaration (Defining_Identifier : Node_Id; - Type_Definition : Node_Id) - return Node_Id; + Type_Definition : Node_Id) return Node_Id; -- No_Node as Type_Definition made type declaration without actual -- definition (eg. "type X;"). function Make_If_Statement - (Condition : Node_Id; - Statements : List_Id; - Else_Statements : List_Id := No_List) - return Node_Id; + (Condition : Node_Id; + Statements : List_Id; + Else_Statements : List_Id := No_List) return Node_Id; function Make_List_Id (N1 : Node_Id; N2 : Node_Id := No_Node; - N3 : Node_Id := No_Node) - return List_Id; + N3 : Node_Id := No_Node) return List_Id; function Make_Parameter_Specification (Defining_Identifier : Node_Id; - Parameter_Type : Node_Id := No_Node) - return Node_Id; + Parameter_Type : Node_Id := No_Node) return Node_Id; function Make_Return_Statement - (Expression : Node_Id := No_Node) - return Node_Id; + (Expression : Node_Id := No_Node) return Node_Id; function Make_Call_Profile - (Defining_Identifier : Node_Id; - Parameters : List_Id := No_List) - return Node_Id; + (Defining_Identifier : Node_Id; + Parameters : List_Id := No_List) return Node_Id; function Make_Function_Implementation (Specification : Node_Id; Declarations : List_Id; - Statements : List_Id) - return Node_Id; + Statements : List_Id) return Node_Id; function Make_Function_Specification - (Defining_Identifier : Node_Id; - Parameters : List_Id := No_List; - Return_Type : Node_Id := No_Node) - return Node_Id; + (Defining_Identifier : Node_Id; + Parameters : List_Id := No_List; + Return_Type : Node_Id := No_Node) return Node_Id; function Make_Type_Attribute (Designator : Node_Id; - Attribute : Attribute_Id) - return Node_Id; + Attribute : Attribute_Id) return Node_Id; function Make_Type_Conversion (Subtype_Mark : Node_Id; - Expression : Node_Id) - return Node_Id; + Expression : Node_Id) return Node_Id; - procedure Make_Comment_Header - (Header : List_Id); + procedure Make_Comment_Header (Header : List_Id); -- This procedure generates a comment header for the generated -- packages. @@ -481,10 +445,10 @@ package Ocarina.Backends.C_Tree.Nutils is procedure Set_Request_Header (N : Node_Id := No_Node); - function To_C_Name (N : Name_Id; - Ada_Style : Boolean := False; - Keyword_Check : Boolean := True) - return Name_Id; + function To_C_Name + (N : Name_Id; + Ada_Style : Boolean := False; + Keyword_Check : Boolean := True) return Name_Id; -- Convert N to a valid Ada identifier (no clashing with keywords, -- no consecutive '_', no heading '_'...). -- If Ada_Style is true, '.' is replaced by "__" @@ -500,13 +464,13 @@ package Ocarina.Backends.C_Tree.Nutils is function Make_Literal (Value : Value_Id) return Node_Id; - function Make_Define_Statement (Defining_Identifier : Node_Id; - Value : Node_Id) return Node_Id; + function Make_Define_Statement + (Defining_Identifier : Node_Id; + Value : Node_Id) return Node_Id; function Make_Pointer_Type (Used_Type : Node_Id) return Node_Id; - procedure Add_Include - (E : Node_Id; Preserve_Case : Boolean := False); + procedure Add_Include (E : Node_Id; Preserve_Case : Boolean := False); procedure Set_Types_Header (N : Node_Id := No_Node); @@ -522,9 +486,7 @@ package Ocarina.Backends.C_Tree.Nutils is procedure Set_Marshallers_Header (N : Node_Id := No_Node); - function Make_Variable_Address - (Expression : Node_Id) - return Node_Id; + function Make_Variable_Address (Expression : Node_Id) return Node_Id; function Make_Member_Designator (Defining_Identifier : Node_Id; @@ -532,21 +494,19 @@ package Ocarina.Backends.C_Tree.Nutils is Is_Pointer : Boolean := False) return Node_Id; function Make_Switch_Alternative - (Labels : List_Id; + (Labels : List_Id; Statements : List_Id) return Node_Id; function Make_Switch_Statement - (Expression : Node_Id; - Alternatives : List_Id) - return Node_Id; + (Expression : Node_Id; + Alternatives : List_Id) return Node_Id; function Make_Macro_Call - (Defining_Identifier : Node_Id; - Parameters : List_Id := No_List) - return Node_Id; + (Defining_Identifier : Node_Id; + Parameters : List_Id := No_List) return Node_Id; procedure POK_Add_Return_Assertion - (Statements : List_Id; + (Statements : List_Id; Exception_Error : Node_Id := No_Node); procedure Handle_Call_Sequence @@ -566,12 +526,9 @@ package Ocarina.Backends.C_Tree.Nutils is (Defining_Identifier : Node_Id; Array_Size : Node_Id) return Node_Id; - function Make_Array_Values - (Values : List_Id := No_List) return Node_Id; + function Make_Array_Values (Values : List_Id := No_List) return Node_Id; - function Make_Extern_Entity_Declaration - (Entity : Node_Id) - return Node_Id; + function Make_Extern_Entity_Declaration (Entity : Node_Id) return Node_Id; function Make_Constant_Type (Used_Type : Node_Id) return Node_Id; @@ -580,21 +537,24 @@ package Ocarina.Backends.C_Tree.Nutils is function Get_C_Default_Value (D : Node_Id) return Node_Id; function POK_Make_Function_Call_With_Assert - (Function_Name : Node_Id; Parameters : List_Id) return Node_Id; + (Function_Name : Node_Id; + Parameters : List_Id) return Node_Id; - function Make_Include_Clause (Header_Name : Node_Id; - Local : Boolean := False) return Node_Id; + function Make_Include_Clause + (Header_Name : Node_Id; + Local : Boolean := False) return Node_Id; function Make_Ifdef_Clause - (Clause : Node_Id; - Negation : Boolean := False; + (Clause : Node_Id; + Negation : Boolean := False; Then_Statements : List_Id; Else_Statements : List_Id) return Node_Id; procedure Add_Define_Deployment (E : Node_Id); - function Make_Array_Value (Array_Name : Node_Id; Array_Item : Node_Id) - return Node_Id; + function Make_Array_Value + (Array_Name : Node_Id; + Array_Item : Node_Id) return Node_Id; function Get_Data_Size (Data : Node_Id) return Node_Id; -- Returns a node that represent an expression with the size @@ -616,29 +576,27 @@ package Ocarina.Backends.C_Tree.Nutils is -- and look for virtual bus binding in this flow to see if we need -- larger data. - function Get_Inter_Partition_Port_Type - (Port : Node_Id) return Node_Id; + function Get_Inter_Partition_Port_Type (Port : Node_Id) return Node_Id; -- Get_Inter_Partition_Port_Type returns a Node_Id that contains -- all information to generate a C data type linked with -- virtual bus layers. function Make_Doxygen_C_Comment - (Desc : String; - Brief : String := ""; - Element_Name : String := ""; - Is_Struct : Boolean := False; - Is_Union : Boolean := False; - Is_Enum : Boolean := False; - Is_Function : Boolean := False; - Is_Variable : Boolean := False; - Is_Define : Boolean := False; - Is_Typedef : Boolean := False; - Is_File : Boolean := False; - Is_Namespace : Boolean := False; - Is_Package : Boolean := False; - Is_Interface : Boolean := False; - Has_Header_Spaces : Boolean := True) - return Node_Id; + (Desc : String; + Brief : String := ""; + Element_Name : String := ""; + Is_Struct : Boolean := False; + Is_Union : Boolean := False; + Is_Enum : Boolean := False; + Is_Function : Boolean := False; + Is_Variable : Boolean := False; + Is_Define : Boolean := False; + Is_Typedef : Boolean := False; + Is_File : Boolean := False; + Is_Namespace : Boolean := False; + Is_Package : Boolean := False; + Is_Interface : Boolean := False; + Has_Header_Spaces : Boolean := True) return Node_Id; -- The Make_Doxygen_C_Comment. diff --git a/src/backends/ocarina-backends-c_values.adb b/src/backends/ocarina-backends-c_values.adb index 10e57048..f8219e63 100644 --- a/src/backends/ocarina-backends-c_values.adb +++ b/src/backends/ocarina-backends-c_values.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -31,7 +31,7 @@ -- -- ------------------------------------------------------------------------------ -with Namet; use Namet; +with Namet; use Namet; with Ocarina.AADL_Values; @@ -41,10 +41,9 @@ package body Ocarina.Backends.C_Values is package OV renames Ocarina.AADL_Values; - Hex : constant String := "0123456789ABCDEF"; + Hex : constant String := "0123456789ABCDEF"; - package VT is - new GNAT.Table (Value_Type, Value_Id, No_Value + 1, 10, 10); + package VT is new GNAT.Table (Value_Type, Value_Id, No_Value + 1, 10, 10); subtype ULL is Unsigned_Long_Long; @@ -54,8 +53,7 @@ package body Ocarina.Backends.C_Values is -- "*" -- --------- - function "*" (L, R : Value_Type) return Value_Type - is + function "*" (L, R : Value_Type) return Value_Type is V : Value_Type := L; begin case V.K is @@ -79,9 +77,8 @@ package body Ocarina.Backends.C_Values is -- "+" -- --------- - function "+" (L, R : Value_Type) return Value_Type - is - V : Value_Type := R; + function "+" (L, R : Value_Type) return Value_Type is + V : Value_Type := R; begin case R.K is when K_Int => @@ -112,8 +109,7 @@ package body Ocarina.Backends.C_Values is -- "-" -- --------- - function "-" (R : Value_Type) return Value_Type - is + function "-" (R : Value_Type) return Value_Type is V : Value_Type := R; begin case R.K is @@ -134,8 +130,7 @@ package body Ocarina.Backends.C_Values is -- "-" -- --------- - function "-" (L, R : Value_Type) return Value_Type - is + function "-" (L, R : Value_Type) return Value_Type is V : Value_Type := R; begin case R.K is @@ -156,9 +151,8 @@ package body Ocarina.Backends.C_Values is -- "/" -- --------- - function "/" (L, R : Value_Type) return Value_Type - is - V : Value_Type := L; + function "/" (L, R : Value_Type) return Value_Type is + V : Value_Type := L; begin case V.K is when K_Int => @@ -210,8 +204,7 @@ package body Ocarina.Backends.C_Values is -- "and" -- ----------- - function "and" (L, R : Value_Type) return Value_Type - is + function "and" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -239,8 +232,7 @@ package body Ocarina.Backends.C_Values is -- "mod" -- ----------- - function "mod" (L, R : Value_Type) return Value_Type - is + function "mod" (L, R : Value_Type) return Value_Type is V : Value_Type := L; begin case L.K is @@ -261,8 +253,7 @@ package body Ocarina.Backends.C_Values is -- "not" -- ----------- - function "not" (R : Value_Type) return Value_Type - is + function "not" (R : Value_Type) return Value_Type is V : Value_Type := R; begin case V.K is @@ -279,8 +270,7 @@ package body Ocarina.Backends.C_Values is -- "or" -- ---------- - function "or" (L, R : Value_Type) return Value_Type - is + function "or" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -308,8 +298,7 @@ package body Ocarina.Backends.C_Values is -- "xor" -- ----------- - function "xor" (L, R : Value_Type) return Value_Type - is + function "xor" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -337,8 +326,7 @@ package body Ocarina.Backends.C_Values is -- Add_ULL_To_Name_Buffer -- ---------------------------- - procedure Add_ULL_To_Name_Buffer (U : ULL; B : ULL; S : Integer := 1) - is + procedure Add_ULL_To_Name_Buffer (U : ULL; B : ULL; S : Integer := 1) is Q : constant ULL := U / B; R : constant ULL := U mod B; begin @@ -352,14 +340,13 @@ package body Ocarina.Backends.C_Values is -- Image -- ----------- - function Image (Value : Value_Id) return String - is + function Image (Value : Value_Id) return String is V : Value_Type; begin if Value = No_Value then return "<>"; end if; - V := VT.Table (Value); + V := VT.Table (Value); Name_Len := 0; case V.K is @@ -395,8 +382,7 @@ package body Ocarina.Backends.C_Values is if Index > 0 then Index := Index + 2; - while Index <= Name_Len - and then Name_Buffer (Index) = '0' + while Index <= Name_Len and then Name_Buffer (Index) = '0' loop Name_Buffer (Index .. Name_Len - 1) := Name_Buffer (Index + 1 .. Name_Len); @@ -407,7 +393,7 @@ package body Ocarina.Backends.C_Values is if Index > Name_Len then Name_Len := Name_Len - 2; - Index := Name_Len; + Index := Name_Len; else Index := Name_Len; @@ -498,9 +484,7 @@ package body Ocarina.Backends.C_Values is -- New_Floating_Point_Value -- ------------------------------ - function New_Floating_Point_Value - (Value : Long_Double) - return Value_Id is + function New_Floating_Point_Value (Value : Long_Double) return Value_Id is begin return New_Value (Value_Type'(K_Float, Value)); end New_Floating_Point_Value; @@ -512,8 +496,8 @@ package body Ocarina.Backends.C_Values is function New_Int_Value (Value : Unsigned_Long_Long; Sign : Short_Short; - Base : Unsigned_Short_Short) - return Value_Id is + Base : Unsigned_Short_Short) return Value_Id + is begin return New_Value (Value_Type'(K_Int, Value, Sign, Base)); end New_Int_Value; @@ -522,9 +506,7 @@ package body Ocarina.Backends.C_Values is -- New_Character_Value -- ------------------------- - function New_Char_Value (Value : Unsigned_Short) - return Value_Id - is + function New_Char_Value (Value : Unsigned_Short) return Value_Id is begin return New_Value (Value_Type'(K_Char, Value)); end New_Char_Value; @@ -533,12 +515,11 @@ package body Ocarina.Backends.C_Values is -- New_Value -- --------------- - function New_Value (Value : Value_Type) return Value_Id - is + function New_Value (Value : Value_Type) return Value_Id is V : Value_Id; begin VT.Increment_Last; - V := VT.Last; + V := VT.Last; VT.Table (V) := Value; return V; end New_Value; @@ -556,8 +537,7 @@ package body Ocarina.Backends.C_Values is -- Shift_Left -- ---------------- - function Shift_Left (L, R : Value_Type) return Value_Type - is + function Shift_Left (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -582,8 +562,7 @@ package body Ocarina.Backends.C_Values is -- Shift_Right -- ----------------- - function Shift_Right (L, R : Value_Type) return Value_Type - is + function Shift_Right (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -608,9 +587,7 @@ package body Ocarina.Backends.C_Values is -- New_Pointed_Char_Value -- ---------------------------- - function New_Pointed_Char_Value - (Value : Name_Id) - return Value_Id is + function New_Pointed_Char_Value (Value : Name_Id) return Value_Id is begin return New_Value (Value_Type'(K_Pointed_Char, Value)); end New_Pointed_Char_Value; diff --git a/src/backends/ocarina-backends-c_values.ads b/src/backends/ocarina-backends-c_values.ads index 841cbfff..53013fe5 100644 --- a/src/backends/ocarina-backends-c_values.ads +++ b/src/backends/ocarina-backends-c_values.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -35,52 +35,42 @@ with Ocarina.Backends.C_Tree.Nodes; use Ocarina.Backends.C_Tree.Nodes; package Ocarina.Backends.C_Values is - type Value_Type (K : Node_Kind := K_Int) is - record - case K is - when K_Int => - IVal : Unsigned_Long_Long; - Sign : Short_Short; - Base : Unsigned_Short_Short; + type Value_Type (K : Node_Kind := K_Int) is record + case K is + when K_Int => + IVal : Unsigned_Long_Long; + Sign : Short_Short; + Base : Unsigned_Short_Short; - when K_Float => - FVal : Long_Double; + when K_Float => + FVal : Long_Double; - when K_Char => - CVal : Unsigned_Short; + when K_Char => + CVal : Unsigned_Short; - when K_Pointed_Char => - PCVal : Name_Id; + when K_Pointed_Char => + PCVal : Name_Id; - when others => - null; - end case; - end record; + when others => + null; + end case; + end record; Bad_Value : constant Value_Type; - No_Value : constant Value_Id; + No_Value : constant Value_Id; - function New_Floating_Point_Value - (Value : Long_Double) - return Value_Id; + function New_Floating_Point_Value (Value : Long_Double) return Value_Id; function New_Int_Value (Value : Unsigned_Long_Long; Sign : Short_Short; - Base : Unsigned_Short_Short) - return Value_Id; + Base : Unsigned_Short_Short) return Value_Id; - function New_Char_Value - (Value : Unsigned_Short) - return Value_Id; + function New_Char_Value (Value : Unsigned_Short) return Value_Id; - function New_Pointed_Char_Value - (Value : Name_Id) - return Value_Id; + function New_Pointed_Char_Value (Value : Name_Id) return Value_Id; - function New_Value - (Value : Value_Type) - return Value_Id; + function New_Value (Value : Value_Type) return Value_Id; function Value (V : Value_Id) return Value_Type; procedure Set_Value (V : Value_Id; X : Value_Type); @@ -91,19 +81,19 @@ package Ocarina.Backends.C_Values is -- Converts an AADL value to a C one function "not" (R : Value_Type) return Value_Type; - function "-" (R : Value_Type) return Value_Type; - function "-" (L, R : Value_Type) return Value_Type; - function "+" (L, R : Value_Type) return Value_Type; + function "-" (R : Value_Type) return Value_Type; + function "-" (L, R : Value_Type) return Value_Type; + function "+" (L, R : Value_Type) return Value_Type; function "mod" (L, R : Value_Type) return Value_Type; - function "/" (L, R : Value_Type) return Value_Type; - function "*" (L, R : Value_Type) return Value_Type; + function "/" (L, R : Value_Type) return Value_Type; + function "*" (L, R : Value_Type) return Value_Type; function "and" (L, R : Value_Type) return Value_Type; - function "or" (L, R : Value_Type) return Value_Type; + function "or" (L, R : Value_Type) return Value_Type; function "xor" (L, R : Value_Type) return Value_Type; - function Shift_Left (L, R : Value_Type) return Value_Type; + function Shift_Left (L, R : Value_Type) return Value_Type; function Shift_Right (L, R : Value_Type) return Value_Type; - function "<" (L, R : Value_Type) return Boolean; + function "<" (L, R : Value_Type) return Boolean; -- Assume L and R have the same type. procedure Reset; @@ -112,6 +102,6 @@ package Ocarina.Backends.C_Values is private Bad_Value : constant Value_Type := Value_Type'((K => K_Node_Id)); - No_Value : constant Value_Id := 0; + No_Value : constant Value_Id := 0; end Ocarina.Backends.C_Values; diff --git a/src/backends/ocarina-backends-carts-main.adb b/src/backends/ocarina-backends-carts-main.adb index f46a6872..c5b1ef8a 100644 --- a/src/backends/ocarina-backends-carts-main.adb +++ b/src/backends/ocarina-backends-carts-main.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -60,28 +60,30 @@ package body Ocarina.Backends.Carts.Main is procedure Look_For_Threads (E : Node_Id); procedure Visit_Virtual_Processor (E : Node_Id); - Root_System_Node : Node_Id := No_Node; - Current_Processor_Node : Node_Id; - Current_System_Node : Node_Id; - Current_Virtual_Processor_Node : Node_Id; - Current_AADL_Virtual_Processor : Node_Id; + Root_System_Node : Node_Id := No_Node; + Current_Processor_Node : Node_Id; + Current_System_Node : Node_Id; + Current_Virtual_Processor_Node : Node_Id; + Current_AADL_Virtual_Processor : Node_Id; ---------------------- -- Look_For_Threads -- ---------------------- procedure Look_For_Threads (E : Node_Id) is - S : Node_Id; - Bound_Processor : Node_Id; + S : Node_Id; + Bound_Processor : Node_Id; begin if AINU.Is_Thread (E) then - Bound_Processor := Get_Bound_Processor - (Parent_Component (Parent_Subcomponent (E))); + Bound_Processor := + Get_Bound_Processor (Parent_Component (Parent_Subcomponent (E))); if Bound_Processor /= No_Node - and then Bound_Processor = Current_AADL_Virtual_Processor then + and then Bound_Processor = Current_AADL_Virtual_Processor + then Append_Node_To_List - (Map_Thread (E), XTN.Subitems (Current_Virtual_Processor_Node)); + (Map_Thread (E), + XTN.Subitems (Current_Virtual_Processor_Node)); end if; else if not AINU.Is_Empty (Subcomponents (E)) then @@ -120,8 +122,7 @@ package body Ocarina.Backends.Carts.Main is --------------------- procedure Visit_Component (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -160,7 +161,7 @@ package body Ocarina.Backends.Carts.Main is Current_AADL_Virtual_Processor := E; Current_Virtual_Processor_Node := Map_Virtual_Processor (E); XTU.Append_Node_To_List - (Current_Virtual_Processor_Node, + (Current_Virtual_Processor_Node, XTN.Subitems (Current_Processor_Node)); Look_For_Threads (Root_System_Node); @@ -171,11 +172,12 @@ package body Ocarina.Backends.Carts.Main is --------------------- procedure Visit_Processor (E : Node_Id) is - S : Node_Id; + S : Node_Id; begin Current_Processor_Node := Map_Processor (E); Append_Node_To_List - (Current_Processor_Node, XTN.Subitems (Current_System_Node)); + (Current_Processor_Node, + XTN.Subitems (Current_System_Node)); if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); @@ -194,9 +196,9 @@ package body Ocarina.Backends.Carts.Main is ------------------ procedure Visit_System (E : Node_Id) is - S : Node_Id; - P : Node_Id; - U : Node_Id; + S : Node_Id; + P : Node_Id; + U : Node_Id; begin P := Map_HI_Node (E); Push_Entity (P); diff --git a/src/backends/ocarina-backends-carts-mapping.adb b/src/backends/ocarina-backends-carts-mapping.adb index 57375119..147fa3a3 100644 --- a/src/backends/ocarina-backends-carts-mapping.adb +++ b/src/backends/ocarina-backends-carts-mapping.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -57,7 +57,7 @@ package body Ocarina.Backends.Carts.Mapping is package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes; package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils; - package XV renames Ocarina.Backends.XML_Values; + package XV renames Ocarina.Backends.XML_Values; package XTN renames Ocarina.Backends.XML_Tree.Nodes; procedure Map_Scheduler (E : Node_Id; N : Node_Id) is @@ -104,10 +104,7 @@ package body Ocarina.Backends.Carts.Mapping is XML_Root := D; - XTN.Set_Name (D, To_XML_Name - (AIN.Name - (AIN.Identifier - (E)))); + XTN.Set_Name (D, To_XML_Name (AIN.Name (AIN.Identifier (E)))); XTN.Set_Units (D, New_List (XTN.K_List_Id)); XTN.Set_HI_Nodes (D, New_List (XTN.K_List_Id)); @@ -121,17 +118,17 @@ package body Ocarina.Backends.Carts.Mapping is function Map_HI_Node (E : Node_Id) return Node_Id is N : constant Node_Id := New_Node (XTN.K_HI_Node); begin - pragma Assert (AINU.Is_Process (E) - or else AINU.Is_System (E) - or else AINU.Is_Processor (E)); + pragma Assert + (AINU.Is_Process (E) + or else AINU.Is_System (E) + or else AINU.Is_Processor (E)); if AINU.Is_System (E) then Set_Str_To_Name_Buffer ("general"); else Get_Name_String - (To_XML_Name (AIN.Name - (AIN.Identifier - (AIN.Parent_Subcomponent (E))))); + (To_XML_Name + (AIN.Name (AIN.Identifier (AIN.Parent_Subcomponent (E))))); Add_Str_To_Name_Buffer ("_carts"); end if; @@ -151,31 +148,25 @@ package body Ocarina.Backends.Carts.Mapping is -- Map_HI_Unit -- ----------------- - function Map_HI_Unit (E : Node_Id) - return Node_Id is - U : Node_Id; - N : Node_Id; - P : Node_Id; - Root : Node_Id; + function Map_HI_Unit (E : Node_Id) return Node_Id is + U : Node_Id; + N : Node_Id; + P : Node_Id; + Root : Node_Id; begin - pragma Assert (AINU.Is_System (E) - or else AINU.Is_Process (E) - or else AINU.Is_Processor (E)); + pragma Assert + (AINU.Is_System (E) + or else AINU.Is_Process (E) + or else AINU.Is_Processor (E)); U := New_Node (XTN.K_HI_Unit, AIN.Identifier (E)); -- Packages that are common to all nodes if AINU.Is_System (E) then - Get_Name_String - (To_XML_Name - (Display_Name - (Identifier (E)))); + Get_Name_String (To_XML_Name (Display_Name (Identifier (E)))); else Get_Name_String - (To_XML_Name - (Display_Name - (Identifier - (Parent_Subcomponent (E))))); + (To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E))))); end if; Add_Str_To_Name_Buffer ("_carts"); N := Make_Defining_Identifier (Name_Find); @@ -204,11 +195,9 @@ package body Ocarina.Backends.Carts.Mapping is begin N := Make_XML_Node ("system"); - P := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Parent_Subcomponent (E))))); + P := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E))))); Set_Str_To_Name_Buffer ("name"); Q := Make_Defining_Identifier (Name_Find); @@ -222,22 +211,19 @@ package body Ocarina.Backends.Carts.Mapping is --------------------------- function Map_Virtual_Processor (E : Node_Id) return Node_Id is - N : Node_Id; - P : Node_Id; - Q : Node_Id; + N : Node_Id; + P : Node_Id; + Q : Node_Id; begin N := Make_XML_Node ("component"); - P := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Parent_Subcomponent (E))))); + P := + Make_Defining_Identifier + (To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E))))); Set_Str_To_Name_Buffer ("name"); Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List (Make_Assignement (Q, P), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N)); -- Always make subtype=tasks for partition. @@ -246,8 +232,7 @@ package body Ocarina.Backends.Carts.Mapping is Set_Str_To_Name_Buffer ("subtype"); Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List (Make_Assignement (Q, P), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N)); -- Map partition scheduler. @@ -259,16 +244,18 @@ package body Ocarina.Backends.Carts.Mapping is Q := Make_Defining_Identifier (Name_Find); if Is_Defined_Property (E, "pok::criticality") then - P := Make_Literal - (XV.New_Numeric_Value - (Get_Integer_Property (E, "pok::criticality"), 1, 10)); + P := + Make_Literal + (XV.New_Numeric_Value + (Get_Integer_Property (E, "pok::criticality"), + 1, + 10)); else Set_Str_To_Name_Buffer ("?"); P := Make_Defining_Identifier (Name_Find); end if; - Append_Node_To_List (Make_Assignement (Q, P), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N)); return N; end Map_Virtual_Processor; @@ -284,36 +271,36 @@ package body Ocarina.Backends.Carts.Mapping is begin N := Make_XML_Node ("task"); - P := Make_Defining_Identifier - (To_XML_Name - (Display_Name - (Identifier - (Parent_Subcomponent (Thread))))); + P := + Make_Defining_Identifier + (To_XML_Name + (Display_Name (Identifier (Parent_Subcomponent (Thread))))); Set_Str_To_Name_Buffer ("name"); Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List (Make_Assignement (Q, P), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N)); Set_Str_To_Name_Buffer ("p"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal - (XV.New_Numeric_Value - (To_Milliseconds (Get_Thread_Period (Thread)), - 1, 10)); + Q := + Make_Literal + (XV.New_Numeric_Value + (To_Milliseconds (Get_Thread_Period (Thread)), + 1, + 10)); - Append_Node_To_List (Make_Assignement (P, Q), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); Set_Str_To_Name_Buffer ("d"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal - (XV.New_Numeric_Value - (To_Milliseconds (Get_Thread_Deadline (Thread)), - 1, 10)); + Q := + Make_Literal + (XV.New_Numeric_Value + (To_Milliseconds (Get_Thread_Deadline (Thread)), + 1, + 10)); - Append_Node_To_List (Make_Assignement (P, Q), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); -- Make the non_interrupt_fraction value of the XML node. @@ -321,8 +308,7 @@ package body Ocarina.Backends.Carts.Mapping is P := Make_Defining_Identifier (Name_Find); Q := Make_Literal (XV.New_Numeric_Value (0, 1, 10)); - Append_Node_To_List (Make_Assignement (P, Q), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); -- Make the jitter value of the XML node. @@ -330,8 +316,7 @@ package body Ocarina.Backends.Carts.Mapping is P := Make_Defining_Identifier (Name_Find); Q := Make_Literal (XV.New_Numeric_Value (0, 1, 10)); - Append_Node_To_List (Make_Assignement (P, Q), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); declare TA : constant Time_Array := Get_Execution_Time (Thread); @@ -339,13 +324,11 @@ package body Ocarina.Backends.Carts.Mapping is if TA /= Empty_Time_Array then Set_Str_To_Name_Buffer ("e"); P := Make_Defining_Identifier (Name_Find); - Q := Make_Literal - (XV.New_Numeric_Value - (To_Milliseconds (TA (1)), - 1, 10)); + Q := + Make_Literal + (XV.New_Numeric_Value (To_Milliseconds (TA (1)), 1, 10)); - Append_Node_To_List (Make_Assignement (P, Q), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N)); end if; end; return N; diff --git a/src/backends/ocarina-backends-carts.adb b/src/backends/ocarina-backends-carts.adb index 1530824c..1ca1e7b8 100644 --- a/src/backends/ocarina-backends-carts.adb +++ b/src/backends/ocarina-backends-carts.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -158,8 +158,7 @@ package body Ocarina.Backends.Carts is -- Get_XML_Root -- ------------------ - function Get_XML_Root return Node_Id - is + function Get_XML_Root return Node_Id is begin return XML_Root; end Get_XML_Root; diff --git a/src/backends/ocarina-backends-cheddar-main.adb b/src/backends/ocarina-backends-cheddar-main.adb index 4d2ffebb..709e7b8c 100644 --- a/src/backends/ocarina-backends-cheddar-main.adb +++ b/src/backends/ocarina-backends-cheddar-main.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -110,8 +110,7 @@ package body Ocarina.Backends.Cheddar.Main is --------------------- procedure Visit_Component (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -141,21 +140,20 @@ package body Ocarina.Backends.Cheddar.Main is procedure Visit_Thread (E : Node_Id) is F : Node_Id; begin - Append_Node_To_List - (Map_Thread (E), XTN.Subitems (Tasks_Node)); + Append_Node_To_List (Map_Thread (E), XTN.Subitems (Tasks_Node)); if Present (Features (E)) then F := First_Node (Features (E)); while Present (F) loop - if Kind (F) = K_Port_Spec_Instance - and then Is_Event (F) - then + if Kind (F) = K_Port_Spec_Instance and then Is_Event (F) then if Is_In (F) then Append_Node_To_List - (Map_Buffer (E, F), XTN.Subitems (Buffers_Node)); + (Map_Buffer (E, F), + XTN.Subitems (Buffers_Node)); end if; Append_Node_To_List - (Map_Dependency (E, F), XTN.Subitems (Dependencies_Node)); + (Map_Dependency (E, F), + XTN.Subitems (Dependencies_Node)); end if; F := Next_Node (F); end loop; @@ -170,8 +168,7 @@ package body Ocarina.Backends.Cheddar.Main is procedure Visit_Data (E : Node_Id) is begin - Append_Node_To_List - (Map_Data (E), XTN.Subitems (Resources_Node)); + Append_Node_To_List (Map_Data (E), XTN.Subitems (Resources_Node)); Visit_Subcomponents_Of (E); end Visit_Data; @@ -181,8 +178,7 @@ package body Ocarina.Backends.Cheddar.Main is procedure Visit_Process (E : Node_Id) is begin - Append_Node_To_List - (Map_Process (E), XTN.Subitems (Address_Node)); + Append_Node_To_List (Map_Process (E), XTN.Subitems (Address_Node)); Visit_Subcomponents_Of (E); end Visit_Process; @@ -192,8 +188,7 @@ package body Ocarina.Backends.Cheddar.Main is procedure Visit_Processor (E : Node_Id) is begin - Append_Node_To_List - (Map_Processor (E), XTN.Subitems (Processors_Node)); + Append_Node_To_List (Map_Processor (E), XTN.Subitems (Processors_Node)); Visit_Subcomponents_Of (E); end Visit_Processor; @@ -231,7 +226,8 @@ package body Ocarina.Backends.Cheddar.Main is if Cheddar_Node = No_Node then Cheddar_Node := Make_XML_Node ("cheddar"); Append_Node_To_List - (Cheddar_Node, XTN.Subitems (XTN.Root_Node (XTN.XML_File (U)))); + (Cheddar_Node, + XTN.Subitems (XTN.Root_Node (XTN.XML_File (U)))); end if; if Processors_Node = No_Node then @@ -262,7 +258,8 @@ package body Ocarina.Backends.Cheddar.Main is if Dependencies_Node = No_Node then Dependencies_Node := Make_XML_Node ("dependencies"); Append_Node_To_List - (Dependencies_Node, XTN.Subitems (Cheddar_Node)); + (Dependencies_Node, + XTN.Subitems (Cheddar_Node)); end if; end if; diff --git a/src/backends/ocarina-backends-cheddar-mapping.adb b/src/backends/ocarina-backends-cheddar-mapping.adb index 26c06c2b..95799030 100644 --- a/src/backends/ocarina-backends-cheddar-mapping.adb +++ b/src/backends/ocarina-backends-cheddar-mapping.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2013 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -32,8 +32,8 @@ ------------------------------------------------------------------------------ with GNAT.OS_Lib; use GNAT.OS_Lib; -with Namet; use Namet; -with Utils; use Utils; +with Namet; use Namet; +with Utils; use Utils; with Ocarina.ME_AADL.AADL_Instances.Nodes; with Ocarina.ME_AADL.AADL_Instances.Nutils; @@ -90,9 +90,10 @@ package body Ocarina.Backends.Cheddar.Mapping is function Map_HI_Node (E : Node_Id) return Node_Id is N : constant Node_Id := New_Node (XTN.K_HI_Node); begin - pragma Assert (AINU.Is_Process (E) - or else AINU.Is_System (E) - or else AINU.Is_Processor (E)); + pragma Assert + (AINU.Is_Process (E) + or else AINU.Is_System (E) + or else AINU.Is_Processor (E)); if AINU.Is_System (E) then Set_Str_To_Name_Buffer ("general"); @@ -117,17 +118,17 @@ package body Ocarina.Backends.Cheddar.Mapping is -- Map_HI_Unit -- ----------------- - function Map_HI_Unit (E : Node_Id) - return Node_Id is - U : Node_Id; - N : Node_Id; - P : Node_Id; - Root : Node_Id; - DTD : Node_Id; + function Map_HI_Unit (E : Node_Id) return Node_Id is + U : Node_Id; + N : Node_Id; + P : Node_Id; + Root : Node_Id; + DTD : Node_Id; begin - pragma Assert (AINU.Is_System (E) - or else AINU.Is_Process (E) - or else AINU.Is_Processor (E)); + pragma Assert + (AINU.Is_System (E) + or else AINU.Is_Process (E) + or else AINU.Is_Processor (E)); U := New_Node (XTN.K_HI_Unit, Identifier (E)); @@ -138,16 +139,14 @@ package body Ocarina.Backends.Cheddar.Mapping is else Get_Name_String - (To_XML_Name - (Display_Name (Identifier (Parent_Subcomponent (E))))); + (To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E))))); end if; Add_Str_To_Name_Buffer ("_cheddar"); N := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer - (Get_Runtime_Path ("cheddar") - & Directory_Separator & "cheddar.dtd"); + (Get_Runtime_Path ("cheddar") & Directory_Separator & "cheddar.dtd"); DTD := Make_Defining_Identifier (Name_Find); P := Make_XML_File (N, DTD); @@ -172,17 +171,16 @@ package body Ocarina.Backends.Cheddar.Mapping is N : Node_Id; P : Node_Id; - Schedulers : constant array (Supported_Scheduling_Protocol'Range) - of Name_Id := + Schedulers : constant array + (Supported_Scheduling_Protocol'Range) of Name_Id := (RATE_MONOTONIC_PROTOCOL => Get_String_Name ("RATE_MONOTONIC_PROTOCOL"), POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL => Get_String_Name ("POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL"), EARLIEST_DEADLINE_FIRST_PROTOCOL => Get_String_Name ("EARLIEST_DEADLINE_FIRST_PROTOCOL"), - ROUND_ROBIN_PROTOCOL => - Get_String_Name ("ROUND_ROBIN_PROTOCOL"), - others => No_Name); + ROUND_ROBIN_PROTOCOL => Get_String_Name ("ROUND_ROBIN_PROTOCOL"), + others => No_Name); Quantum : constant Time_Type := Get_Scheduler_Quantum (E); begin @@ -199,20 +197,23 @@ package body Ocarina.Backends.Cheddar.Mapping is Append_Node_To_List (P, XTN.Subitems (N)); -- scheduler: computed from Scheduling_Protocol policy - P := Map_To_XML_Node ("scheduler", - Schedulers (Get_Scheduling_Protocol (E))); + P := + Map_To_XML_Node + ("scheduler", + Schedulers (Get_Scheduling_Protocol (E))); -- quantum: XXX use default value if Quantum /= Null_Time then declare - Name : constant Node_Id - := Make_Defining_Identifier (Get_String_Name ("quantum")); - Value : constant Node_Id - := Make_Literal (XV.New_Numeric_Value - (To_Milliseconds (Quantum), 1, 10)); + Name : constant Node_Id := + Make_Defining_Identifier (Get_String_Name ("quantum")); + Value : constant Node_Id := + Make_Literal + (XV.New_Numeric_Value (To_Milliseconds (Quantum), 1, 10)); begin - Append_Node_To_List (Make_Assignement (Name, Value), - XTN.Items (P)); + Append_Node_To_List + (Make_Assignement (Name, Value), + XTN.Items (P)); end; end if; @@ -234,9 +235,8 @@ package body Ocarina.Backends.Cheddar.Mapping is P : Node_Id; Concurrency_Protocols : constant array - (Supported_Concurrency_Control_Protocol'Range) of Name_Id := - (Concurrency_NoneSpecified => - Get_String_Name ("NO_PROTOCOL"), + (Supported_Concurrency_Control_Protocol'Range) of Name_Id := + (Concurrency_NoneSpecified => Get_String_Name ("NO_PROTOCOL"), Concurrency_Priority_Ceiling => Get_String_Name ("PRIORITY_CEILING_PROTOCOL"), others => No_Name); @@ -256,19 +256,20 @@ package body Ocarina.Backends.Cheddar.Mapping is -- cpu_name: computed from the processor binding of the -- container process of the current data - P := Map_Node_Identifier_To_XML_Node - ("cpu_name", - Parent_Subcomponent - (Get_Bound_Processor - (Corresponding_Instance - (Get_Container_Process - (Parent_Subcomponent (E)))))); + P := + Map_Node_Identifier_To_XML_Node + ("cpu_name", + Parent_Subcomponent + (Get_Bound_Processor + (Corresponding_Instance + (Get_Container_Process (Parent_Subcomponent (E)))))); Append_Node_To_List (P, XTN.Subitems (N)); -- address_space: name of the enclosing process - P := Map_Node_Identifier_To_XML_Node - ("address_space_name", - Get_Container_Process (Parent_Subcomponent (E))); + P := + Map_Node_Identifier_To_XML_Node + ("address_space_name", + Get_Container_Process (Parent_Subcomponent (E))); Append_Node_To_List (P, XTN.Subitems (N)); -- name: computed from data instance name @@ -280,9 +281,10 @@ package body Ocarina.Backends.Cheddar.Mapping is Append_Node_To_List (P, XTN.Subitems (N)); -- protocol: computed from Concurrency_Protocol property - P := Map_To_XML_Node - ("protocol", - Concurrency_Protocols (Get_Concurrency_Protocol (E))); + P := + Map_To_XML_Node + ("protocol", + Concurrency_Protocols (Get_Concurrency_Protocol (E))); Append_Node_To_List (P, XTN.Subitems (N)); -- resource_used_by: computed from the list of threads @@ -291,29 +293,32 @@ package body Ocarina.Backends.Cheddar.Mapping is -- enclosing process. P := Make_XML_Node ("resource_used_by"); declare - Access_List : constant List_Id := Connections - (Corresponding_Instance - (Get_Container_Process (Parent_Subcomponent (E)))); + Access_List : constant List_Id := + Connections + (Corresponding_Instance + (Get_Container_Process (Parent_Subcomponent (E)))); Connection : Node_Id; - K, M : Node_Id; + K, M : Node_Id; begin if not AINU.Is_Empty (Access_List) then Connection := AIN.First_Node (Access_List); while Present (Connection) loop if Kind (Connection) = K_Connection_Instance - and then Get_Category_Of_Connection (Connection) - = CT_Access_Data + and then + Get_Category_Of_Connection (Connection) = + CT_Access_Data then - if Item (AIN.First_Node (Path (Source (Connection)))) - = Parent_Subcomponent (E) + if Item (AIN.First_Node (Path (Source (Connection)))) = + Parent_Subcomponent (E) then M := Make_XML_Node ("resource_user"); - K := Make_Defining_Identifier - (Fully_Qualified_Instance_Name - (Corresponding_Instance - (Item - (AIN.First_Node - (Path (Destination (Connection))))))); + K := + Make_Defining_Identifier + (Fully_Qualified_Instance_Name + (Corresponding_Instance + (Item + (AIN.First_Node + (Path (Destination (Connection))))))); Append_Node_To_List (K, XTN.Subitems (M)); -- For now, we assume all tasks take the @@ -322,16 +327,18 @@ package body Ocarina.Backends.Cheddar.Mapping is K := Make_Literal (XV.New_Numeric_Value (1, 1, 10)); Append_Node_To_List (K, XTN.Subitems (M)); - K := Make_Literal - (XV.New_Numeric_Value - (To_Milliseconds - (Get_Execution_Time - (Corresponding_Instance - (Item - (AIN.First_Node - (Path (Destination (Connection)))))) - (1)), - 1, 10)); + K := + Make_Literal + (XV.New_Numeric_Value + (To_Milliseconds + (Get_Execution_Time + (Corresponding_Instance + (Item + (AIN.First_Node + (Path (Destination (Connection)))))) + (1)), + 1, + 10)); Append_Node_To_List (K, XTN.Subitems (M)); Append_Node_To_List (M, XTN.Subitems (P)); @@ -366,14 +373,18 @@ package body Ocarina.Backends.Cheddar.Mapping is N := Make_XML_Node ("address_space"); -- name: computed from process instance name - P := Map_Node_Identifier_To_XML_Node - ("name", Fully_Qualified_Instance_Name (E)); + P := + Map_Node_Identifier_To_XML_Node + ("name", + Fully_Qualified_Instance_Name (E)); Append_Node_To_List (P, XTN.Subitems (N)); -- cpu_name: computed from the processor binding of the -- container process of the current thread - P := Map_Node_Identifier_To_XML_Node - ("cpu_name", Parent_Subcomponent (Get_Bound_Processor (E))); + P := + Map_Node_Identifier_To_XML_Node + ("cpu_name", + Parent_Subcomponent (Get_Bound_Processor (E))); Append_Node_To_List (P, XTN.Subitems (N)); -- text_memory_size: XXX @@ -400,22 +411,22 @@ package body Ocarina.Backends.Cheddar.Mapping is ---------------- function Map_Thread (E : Node_Id) return Node_Id is - N, P : Node_Id; + N, P : Node_Id; Value : Node_Id; - Name : Node_Id; + Name : Node_Id; Dispatch_Protocols : constant array - (Supported_Thread_Dispatch_Protocol'Range) of Name_Id := + (Supported_Thread_Dispatch_Protocol'Range) of Name_Id := (Thread_Sporadic => Get_String_Name ("SPORADIC_TYPE"), Thread_Periodic => Get_String_Name ("PERIODIC_TYPE"), - others => No_Name); + others => No_Name); POSIX_Policies : constant array - (Supported_POSIX_Scheduling_Policy'Range) of Name_Id := - (SCHED_FIFO => Get_String_Name ("SCHED_FIFO"), + (Supported_POSIX_Scheduling_Policy'Range) of Name_Id := + (SCHED_FIFO => Get_String_Name ("SCHED_FIFO"), SCHED_OTHERS => Get_String_Name ("SCHED_OTHERS"), - SCHED_RR => Get_String_Name ("SCHED_RR"), - None => No_Name); + SCHED_RR => Get_String_Name ("SCHED_RR"), + None => No_Name); Dispatch : constant Supported_Thread_Dispatch_Protocol := Get_Thread_Dispatch_Protocol (E); @@ -450,36 +461,37 @@ package body Ocarina.Backends.Cheddar.Mapping is -- task_type attribute -- supported values are PERIODIC or SPORADIC - if Dispatch = Thread_Sporadic - or else Dispatch = Thread_Periodic - then - Name := Make_Defining_Identifier (Get_String_Name ("task_type")); + if Dispatch = Thread_Sporadic or else Dispatch = Thread_Periodic then + Name := Make_Defining_Identifier (Get_String_Name ("task_type")); Value := Make_Defining_Identifier (Dispatch_Protocols (Dispatch)); - Append_Node_To_List (Make_Assignement (Name, Value), - XTN.Items (N)); + Append_Node_To_List (Make_Assignement (Name, Value), XTN.Items (N)); end if; -- cpu_name: computed from the processor binding of the -- container process of the current thread - P := Map_Node_Identifier_To_XML_Node - ("cpu_name", - Parent_Subcomponent - (Get_Bound_Processor - (Corresponding_Instance - (Get_Container_Process (Parent_Subcomponent (E)))))); + P := + Map_Node_Identifier_To_XML_Node + ("cpu_name", + Parent_Subcomponent + (Get_Bound_Processor + (Corresponding_Instance + (Get_Container_Process (Parent_Subcomponent (E)))))); Append_Node_To_List (P, XTN.Subitems (N)); -- address_space: name of the enclosing process - P := Map_Node_Identifier_To_XML_Node - ("address_space_name", - Fully_Qualified_Instance_Name - (Corresponding_Instance - (Get_Container_Process (Parent_Subcomponent (E))))); + P := + Map_Node_Identifier_To_XML_Node + ("address_space_name", + Fully_Qualified_Instance_Name + (Corresponding_Instance + (Get_Container_Process (Parent_Subcomponent (E))))); Append_Node_To_List (P, XTN.Subitems (N)); -- name: computed from thread instance name - P := Map_Node_Identifier_To_XML_Node - ("name", Fully_Qualified_Instance_Name (E)); + P := + Map_Node_Identifier_To_XML_Node + ("name", + Fully_Qualified_Instance_Name (E)); Append_Node_To_List (P, XTN.Subitems (N)); -- capacity: computed from the Compute_Execution_Time property @@ -488,21 +500,24 @@ package body Ocarina.Backends.Cheddar.Mapping is Display_Located_Error (AIN.Loc (E), "Property Compute_Exeuction_Time not set," & - " assuming default value of 0", - Fatal => False, - Warning => true); + " assuming default value of 0", + Fatal => False, + Warning => True); P := Map_To_XML_Node ("capacity", Unsigned_Long_Long'(0)); else - P := Map_To_XML_Node ("capacity", - To_Milliseconds (Get_Execution_Time (E) (1))); + P := + Map_To_XML_Node + ("capacity", + To_Milliseconds (Get_Execution_Time (E) (1))); end if; Append_Node_To_List (P, XTN.Subitems (N)); -- start_time: computed from First_Dispatch_Time property, XXX units - P := Map_To_XML_Node - ("start_time", - To_Milliseconds (Get_Thread_First_Dispatch_Time (E))); + P := + Map_To_XML_Node + ("start_time", + To_Milliseconds (Get_Thread_First_Dispatch_Time (E))); Append_Node_To_List (P, XTN.Subitems (N)); -- policy: computed from the POSIX_Scheduling_Policy properties @@ -513,8 +528,10 @@ package body Ocarina.Backends.Cheddar.Mapping is if Dispatch = Thread_Periodic or else Dispatch = Thread_Sporadic then -- deadline: computed from Deadline property, XXX check units - P := Map_To_XML_Node ("deadline", - To_Milliseconds (Get_Thread_Deadline (E))); + P := + Map_To_XML_Node + ("deadline", + To_Milliseconds (Get_Thread_Deadline (E))); Append_Node_To_List (P, XTN.Subitems (N)); end if; @@ -531,14 +548,16 @@ package body Ocarina.Backends.Cheddar.Mapping is Append_Node_To_List (P, XTN.Subitems (N)); -- stack_memory_size: computed from Source_Stack_Size property - P := Map_To_XML_Node ("stack_memory_size", - To_Bytes (Get_Thread_Stack_Size (E))); + P := + Map_To_XML_Node + ("stack_memory_size", + To_Bytes (Get_Thread_Stack_Size (E))); Append_Node_To_List (P, XTN.Subitems (N)); if Dispatch = Thread_Periodic or else Dispatch = Thread_Sporadic then -- period: computed from Period property, XXX check units - P := Map_To_XML_Node ("period", - To_Milliseconds (Get_Thread_Period (E))); + P := + Map_To_XML_Node ("period", To_Milliseconds (Get_Thread_Period (E))); Append_Node_To_List (P, XTN.Subitems (N)); end if; @@ -570,18 +589,20 @@ package body Ocarina.Backends.Cheddar.Mapping is -- cpu_name: computed from the processor binding of the -- container process of the current thread - K := Map_Node_Identifier_To_XML_Node - ("cpu_name", - Parent_Subcomponent - (Get_Bound_Processor - (Corresponding_Instance - (Get_Container_Process (Parent_Subcomponent (E)))))); + K := + Map_Node_Identifier_To_XML_Node + ("cpu_name", + Parent_Subcomponent + (Get_Bound_Processor + (Corresponding_Instance + (Get_Container_Process (Parent_Subcomponent (E)))))); Append_Node_To_List (K, XTN.Subitems (N)); -- address_space: name of the enclosing process - K := Map_Node_Identifier_To_XML_Node - ("address_space_name", - Get_Container_Process (Parent_Subcomponent (E))); + K := + Map_Node_Identifier_To_XML_Node + ("address_space_name", + Get_Container_Process (Parent_Subcomponent (E))); Append_Node_To_List (K, XTN.Subitems (N)); -- qs: XXX @@ -589,7 +610,7 @@ package body Ocarina.Backends.Cheddar.Mapping is Append_Node_To_List (K, XTN.Subitems (N)); -- name: computed from thread instance name + port_name - K := Map_To_Xml_Node ("name", Map_Buffer_Name (E, P)); + K := Map_To_XML_Node ("name", Map_Buffer_Name (E, P)); Append_Node_To_List (K, XTN.Subitems (N)); -- size: computed from the queue size @@ -634,15 +655,16 @@ package body Ocarina.Backends.Cheddar.Mapping is declare List_Sources : constant List_Id := Get_Source_Ports (P); - Z : Node_Id; + Z : Node_Id; begin if not AINU.Is_Empty (List_Sources) then Z := AIN.First_Node (List_Sources); while Present (Z) loop M := Make_XML_Node ("buffer_user"); - K := Make_Defining_Identifier - (Fully_Qualified_Instance_Name - (Parent_Component (Item (Z)))); + K := + Make_Defining_Identifier + (Fully_Qualified_Instance_Name + (Parent_Component (Item (Z)))); Append_Node_To_List (K, XTN.Subitems (M)); K := Make_Literal (XV.New_Numeric_Value (1, 1, 10)); Append_Node_To_List (K, XTN.Subitems (M)); @@ -681,8 +703,7 @@ package body Ocarina.Backends.Cheddar.Mapping is XTN.Items (N)); K := Make_Defining_Identifier (Map_Buffer_Name (E, P)); Append_Node_To_List (K, XTN.Subitems (N)); - K := Make_Defining_Identifier - (Fully_Qualified_Instance_Name (E)); + K := Make_Defining_Identifier (Fully_Qualified_Instance_Name (E)); Append_Node_To_List (K, XTN.Subitems (N)); else @@ -694,14 +715,14 @@ package body Ocarina.Backends.Cheddar.Mapping is (Make_Defining_Identifier (Get_String_Name ("to_type")), Make_Defining_Identifier (Get_String_Name ("buffer"))), XTN.Items (N)); - K := Make_Defining_Identifier - (Fully_Qualified_Instance_Name (E)); + K := Make_Defining_Identifier (Fully_Qualified_Instance_Name (E)); Append_Node_To_List (K, XTN.Subitems (N)); - K := Make_Defining_Identifier - (Map_Buffer_Name - (Parent_Component - (Item (AIN.First_Node (Get_Destination_Ports (P)))), - Item (AIN.First_Node (Get_Destination_Ports (P))))); + K := + Make_Defining_Identifier + (Map_Buffer_Name + (Parent_Component + (Item (AIN.First_Node (Get_Destination_Ports (P)))), + Item (AIN.First_Node (Get_Destination_Ports (P))))); Append_Node_To_List (K, XTN.Subitems (N)); end if; diff --git a/src/backends/ocarina-backends-cheddar.adb b/src/backends/ocarina-backends-cheddar.adb index aee37193..fb014a1b 100644 --- a/src/backends/ocarina-backends-cheddar.adb +++ b/src/backends/ocarina-backends-cheddar.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -41,7 +41,7 @@ with Ocarina.Backends.XML_Tree.Nutils; with Ocarina.Backends.XML_Tree.Generator; with GNAT.Command_Line; use GNAT.Command_Line; -with GNAT.OS_Lib; use GNAT.OS_Lib; +with GNAT.OS_Lib; use GNAT.OS_Lib; with Namet; use Namet; @@ -56,8 +56,8 @@ package body Ocarina.Backends.Cheddar is package XTU renames Ocarina.Backends.XML_Tree.Nutils; Generated_Sources_Directory : Name_Id := No_Name; - Invoke_Cheddar : Boolean := False; - Cheddarlite_Path : String_Access; + Invoke_Cheddar : Boolean := False; + Cheddarlite_Path : String_Access; procedure Visit_Architecture_Instance (E : Node_Id); -- Most top level visitor routine. E is the root of the AADL @@ -102,7 +102,7 @@ package body Ocarina.Backends.Cheddar is end if; declare - Args : GNAT.OS_Lib.Argument_List (1 .. 4); + Args : GNAT.OS_Lib.Argument_List (1 .. 4); Success : Boolean; begin Args (1) := new String'("-file"); diff --git a/src/backends/ocarina-backends-connection_matrix-main.adb b/src/backends/ocarina-backends-connection_matrix-main.adb index f14001c6..b3c13f4f 100644 --- a/src/backends/ocarina-backends-connection_matrix-main.adb +++ b/src/backends/ocarina-backends-connection_matrix-main.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2011-2012 ESA & ISAE. -- +-- Copyright (C) 2011-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -56,17 +56,17 @@ package body Ocarina.Backends.Connection_Matrix.Main is use Ocarina.Instances.Queries; - package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes; - package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes; - package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils; - package XTN renames Ocarina.Backends.XML_Tree.Nodes; + package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes; + package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes; + package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils; + package XTN renames Ocarina.Backends.XML_Tree.Nodes; procedure Visit_Architecture_Instance (E : Node_Id); procedure Visit_Component_Instance (E : Node_Id); procedure Visit_System_Instance (E : Node_Id); - Current_Parent_Node : Node_Id; - My_Root : Node_Id; + Current_Parent_Node : Node_Id; + My_Root : Node_Id; ----------- -- Visit -- @@ -91,8 +91,8 @@ package body Ocarina.Backends.Connection_Matrix.Main is --------------------------------- procedure Visit_Architecture_Instance (E : Node_Id) is - N : constant Node_Id := New_Node (XTN.K_HI_Node); - D : constant Node_Id := New_Node (XTN.K_HI_Distributed_Application); + N : constant Node_Id := New_Node (XTN.K_HI_Node); + D : constant Node_Id := New_Node (XTN.K_HI_Distributed_Application); U : Node_Id; T : Node_Id; P : Node_Id; @@ -126,8 +126,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is Push_Entity (N); U := New_Node (XTN.K_HI_Unit, AIN.Identifier (My_Root)); - Get_Name_String - (To_XML_Name (Display_Name (Identifier (My_Root)))); + Get_Name_String (To_XML_Name (Display_Name (Identifier (My_Root)))); Add_Str_To_Name_Buffer ("_connection_matrix"); T := Make_Defining_Identifier (Name_Find); P := Make_XML_File (T); @@ -145,8 +144,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is Push_Entity (U); - Current_Parent_Node := XTN.Root_Node - (XTN.XML_File (U)); + Current_Parent_Node := XTN.Root_Node (XTN.XML_File (U)); -- Make the node of the HTML file. Tmp := Make_XML_Node ("head"); @@ -174,7 +172,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is -- Style of the

node Set_Str_To_Name_Buffer - ("font-family: Arial;" & + ("font-family: Arial;" & "text-align: center; font-weight: bold; font-size: 1.2em"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); @@ -200,8 +198,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -217,28 +214,28 @@ package body Ocarina.Backends.Connection_Matrix.Main is --------------------------- procedure Visit_System_Instance (E : Node_Id) is - S : Node_Id; - N : Node_Id; - Conn : Node_Id; - T : Node_Id; - TR : Node_Id; - TD : Node_Id; - UL : Node_Id; - LI : Node_Id; - H2 : Node_Id; - Table : Node_Id; - P : Node_Id; - Q : Node_Id; - Connected : Boolean; - Source_Component : Node_Id; - Dest_Component : Node_Id; - Bandwidth : Unsigned_Long_Long; - Bandwidth_Unit : Name_Id; - Latency : Unsigned_Long_Long; - Latency_Unit : Name_Id; - Associated_Bus : Node_Id; - Has_Bus : Boolean := False; - Bus_Instance : Node_Id; + S : Node_Id; + N : Node_Id; + Conn : Node_Id; + T : Node_Id; + TR : Node_Id; + TD : Node_Id; + UL : Node_Id; + LI : Node_Id; + H2 : Node_Id; + Table : Node_Id; + P : Node_Id; + Q : Node_Id; + Connected : Boolean; + Source_Component : Node_Id; + Dest_Component : Node_Id; + Bandwidth : Unsigned_Long_Long; + Bandwidth_Unit : Name_Id; + Latency : Unsigned_Long_Long; + Latency_Unit : Name_Id; + Associated_Bus : Node_Id; + Has_Bus : Boolean := False; + Bus_Instance : Node_Id; begin -- Declare the table node that will contain the connectivity matrix. Table := Make_XML_Node ("table"); @@ -258,8 +255,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is -- Add a node that represent a colon in the line. TD := Make_XML_Node ("td"); - Append_Node_To_List (TD, - XTN.Subitems (TR)); + Append_Node_To_List (TD, XTN.Subitems (TR)); S := First_Node (Subcomponents (E)); @@ -273,7 +269,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is TD := Make_XML_Node ("td"); Set_Str_To_Name_Buffer - ("font-family: Arial; background-color: #0a97ac;" & + ("font-family: Arial; background-color: #0a97ac;" & "text-align: center; font-weight: bold; font-size: 0.8em"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); @@ -285,14 +281,12 @@ package body Ocarina.Backends.Connection_Matrix.Main is N := Make_Defining_Identifier (Name_Find); XTN.Set_Node_Value (TD, N); - Append_Node_To_List (TD, - XTN.Subitems (TR)); + Append_Node_To_List (TD, XTN.Subitems (TR)); end if; S := Next_Node (S); end loop; - Append_Node_To_List (TR, - XTN.Subitems (Table)); + Append_Node_To_List (TR, XTN.Subitems (Table)); end if; if not AINU.Is_Empty (Subcomponents (E)) then @@ -310,7 +304,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is TD := Make_XML_Node ("td"); Set_Str_To_Name_Buffer - ("font-family: Arial; background-color: #0a97ac;" & + ("font-family: Arial; background-color: #0a97ac;" & "text-align: center; font-weight: bold; font-size: 0.8em"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); @@ -322,8 +316,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is N := Make_Defining_Identifier (Name_Find); XTN.Set_Node_Value (TD, N); - Append_Node_To_List (TD, - XTN.Subitems (TR)); + Append_Node_To_List (TD, XTN.Subitems (TR)); T := First_Node (Subcomponents (E)); @@ -334,7 +327,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is while Present (T) loop if Get_Category_Of_Component (T) /= CC_Bus then - TD := Make_XML_Node ("td"); + TD := Make_XML_Node ("td"); -- Default initialization. Connected := False; @@ -346,34 +339,42 @@ package body Ocarina.Backends.Connection_Matrix.Main is while Present (Conn) loop if Kind (Conn) = K_Connection_Instance then if Get_Category_Of_Connection (Conn) = - CT_Port_Connection then - Source_Component := Item - (AIN.First_Node - (Path - (Source (Conn)))); - - Dest_Component := Item - (AIN.First_Node - (Path - (Destination (Conn)))); - if Dest_Component = T and then - Source_Component = S then + CT_Port_Connection + then + Source_Component := + Item + (AIN.First_Node (Path (Source (Conn)))); + + Dest_Component := + Item + (AIN.First_Node + (Path (Destination (Conn)))); + if Dest_Component = T + and then Source_Component = S + then Associated_Bus := - Get_Bound_Bus (Conn, False); + Get_Bound_Bus (Conn, False); if Is_Defined_Property - (Conn, - "bus_properties::required_bandwidth") then - Bandwidth := Get_Integer_Property (Conn, - "bus_properties::required_bandwidth"); - - Bandwidth_Unit := ATN.Name - (ATN.Unit_Identifier - (Get_Value_Of_Property_Association - (Conn, - Get_String_Name - ("bus_properties::required_bandwidth")))); + (Conn, + "bus_properties::required_bandwidth") + then + Bandwidth := + Get_Integer_Property + (Conn, + "bus_properties:" + & ":required_bandwidth"); + + Bandwidth_Unit := + ATN.Name + (ATN.Unit_Identifier + (Get_Value_Of_Property_Association + (Conn, + Get_String_Name + ("bus_properties:" + & ":required_bandwidth" + )))); Connected := True; end if; end if; @@ -394,7 +395,8 @@ package body Ocarina.Backends.Connection_Matrix.Main is P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List (Make_Assignement (Q, P), + Append_Node_To_List + (Make_Assignement (Q, P), XTN.Items (TD)); -- If Connected is true, the component being analyzed @@ -407,8 +409,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is if Bandwidth /= 0 then Set_Str_To_Name_Buffer (""); Add_Str_To_Name_Buffer - (Unsigned_Long_Long'Image - (Bandwidth)); + (Unsigned_Long_Long'Image (Bandwidth)); Get_Name_String_And_Append (Bandwidth_Unit); Add_Str_To_Name_Buffer (""); @@ -417,24 +418,25 @@ package body Ocarina.Backends.Connection_Matrix.Main is if Associated_Bus /= No_Node then Add_Str_To_Name_Buffer ("
("); - Get_Name_String_And_Append (Display_Name - (Identifier (Associated_Bus))); + Get_Name_String_And_Append + (Display_Name (Identifier (Associated_Bus))); Add_Str_To_Name_Buffer (")"); else Add_Str_To_Name_Buffer - ("
(unknwon bus)"); + ("
(unknwon bus)"); end if; N := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer - ("font-family: Arial; " & - "background-color: #91ff94;" & + ("font-family: Arial; " & + "background-color: #91ff94;" & "text-align: center; font-size: 0.8em"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); Q := Make_Defining_Identifier (Name_Find); Append_Node_To_List - (Make_Assignement (Q, P), XTN.Items (TD)); + (Make_Assignement (Q, P), + XTN.Items (TD)); else -- We put N/A in the cell as a text when @@ -444,39 +446,37 @@ package body Ocarina.Backends.Connection_Matrix.Main is N := Make_Defining_Identifier (Name_Find); end if; else - -- Components are not connected, we put - -- the cell to red. - Set_Str_To_Name_Buffer - ("font-family: Arial; " & - "background-color: #b83f3f;" & - "text-align: center; font-size: 0.8em"); - P := Make_Defining_Identifier (Name_Find); - Set_Str_To_Name_Buffer ("style"); - Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List - (Make_Assignement (Q, P), XTN.Items (TD)); + -- Components are not connected, we put + -- the cell to red. + Set_Str_To_Name_Buffer + ("font-family: Arial; " & + "background-color: #b83f3f;" & + "text-align: center; font-size: 0.8em"); + P := Make_Defining_Identifier (Name_Find); + Set_Str_To_Name_Buffer ("style"); + Q := Make_Defining_Identifier (Name_Find); + Append_Node_To_List + (Make_Assignement (Q, P), + XTN.Items (TD)); end if; if N /= No_Node then XTN.Set_Node_Value (TD, N); end if; - Append_Node_To_List (TD, - XTN.Subitems (TR)); + Append_Node_To_List (TD, XTN.Subitems (TR)); end if; T := Next_Node (T); end loop; - Append_Node_To_List (TR, - XTN.Subitems (Table)); + Append_Node_To_List (TR, XTN.Subitems (Table)); end if; S := Next_Node (S); end loop; end if; -- Add the table to the main HTML node (). - Append_Node_To_List (Table, - XTN.Subitems (Current_Parent_Node)); + Append_Node_To_List (Table, XTN.Subitems (Current_Parent_Node)); -- Now, we are enumerating all buses that are used -- in the model. @@ -487,8 +487,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is H2 := Make_XML_Node ("h2"); Set_Str_To_Name_Buffer - ("font-family: Arial;" & - "font-weight: bold; font-size: 1.2em"); + ("font-family: Arial;" & "font-weight: bold; font-size: 1.2em"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); Q := Make_Defining_Identifier (Name_Find); @@ -498,8 +497,7 @@ package body Ocarina.Backends.Connection_Matrix.Main is N := Make_Defining_Identifier (Name_Find); XTN.Set_Node_Value (H2, N); - Append_Node_To_List (H2, - XTN.Subitems (Current_Parent_Node)); + Append_Node_To_List (H2, XTN.Subitems (Current_Parent_Node)); -- Add a
    node that represent a line. UL := Make_XML_Node ("ul"); @@ -511,11 +509,10 @@ package body Ocarina.Backends.Connection_Matrix.Main is while Present (S) loop if Get_Category_Of_Component (S) = CC_Bus then Bus_Instance := Corresponding_Instance (S); - LI := Make_XML_Node ("li"); + LI := Make_XML_Node ("li"); Set_Str_To_Name_Buffer - ("font-family: Arial;" & - "font-size: 0.8em"); + ("font-family: Arial;" & "font-size: 0.8em"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); Q := Make_Defining_Identifier (Name_Find); @@ -526,31 +523,40 @@ package body Ocarina.Backends.Connection_Matrix.Main is -- Try to find the bus properties: bandwidth and latency. if Is_Defined_Property - (Bus_Instance, "bus_properties::bandwidth") then - - Bandwidth := Get_Integer_Property - (Bus_Instance, "bus_properties::bandwidth"); - - Bandwidth_Unit := ATN.Name - (ATN.Unit_Identifier - (Get_Value_Of_Property_Association - (Bus_Instance, - Get_String_Name - ("bus_properties::bandwidth")))); + (Bus_Instance, + "bus_properties::bandwidth") + then + + Bandwidth := + Get_Integer_Property + (Bus_Instance, + "bus_properties::bandwidth"); + + Bandwidth_Unit := + ATN.Name + (ATN.Unit_Identifier + (Get_Value_Of_Property_Association + (Bus_Instance, + Get_String_Name ("bus_properties::bandwidth")))); end if; if Is_Defined_Property - (Bus_Instance, "bus_properties::max_latency") then - - Latency := Get_Integer_Property - (Bus_Instance, "bus_properties::max_latency"); - - Latency_Unit := ATN.Name - (ATN.Unit_Identifier - (Get_Value_Of_Property_Association - (Bus_Instance, - Get_String_Name - ("bus_properties::max_latency")))); + (Bus_Instance, + "bus_properties::max_latency") + then + + Latency := + Get_Integer_Property + (Bus_Instance, + "bus_properties::max_latency"); + + Latency_Unit := + ATN.Name + (ATN.Unit_Identifier + (Get_Value_Of_Property_Association + (Bus_Instance, + Get_String_Name + ("bus_properties::max_latency")))); end if; -- First, display the name of the bus in bold @@ -558,27 +564,24 @@ package body Ocarina.Backends.Connection_Matrix.Main is Set_Str_To_Name_Buffer (""); Get_Name_String_And_Append - (Display_Name - (Identifier (Bus_Instance))); + (Display_Name (Identifier (Bus_Instance))); Add_Str_To_Name_Buffer (" ("); -- Then, put its properties between parenthesis. if Bandwidth = 0 and then Latency = 0 then - Add_Str_To_Name_Buffer - ("bus properties are not declared"); + Add_Str_To_Name_Buffer ("bus properties are not declared"); end if; if Bandwidth > 0 then Add_Str_To_Name_Buffer ("bandwidth: "); Add_Str_To_Name_Buffer - (Unsigned_Long_Long'Image (Bandwidth)); + (Unsigned_Long_Long'Image (Bandwidth)); Get_Name_String_And_Append (Bandwidth_Unit); end if; if Latency > 0 then Add_Str_To_Name_Buffer (" latency: "); - Add_Str_To_Name_Buffer - (Unsigned_Long_Long'Image (Latency)); + Add_Str_To_Name_Buffer (Unsigned_Long_Long'Image (Latency)); Get_Name_String_And_Append (Latency_Unit); end if; @@ -587,14 +590,12 @@ package body Ocarina.Backends.Connection_Matrix.Main is N := Make_Defining_Identifier (Name_Find); XTN.Set_Node_Value (LI, N); - Append_Node_To_List (LI, - XTN.Subitems (UL)); + Append_Node_To_List (LI, XTN.Subitems (UL)); end if; S := Next_Node (S); end loop; - Append_Node_To_List (UL, - XTN.Subitems (Current_Parent_Node)); + Append_Node_To_List (UL, XTN.Subitems (Current_Parent_Node)); end if; end Visit_System_Instance; diff --git a/src/backends/ocarina-backends-connection_matrix.adb b/src/backends/ocarina-backends-connection_matrix.adb index 3e8a7366..0f9059ca 100644 --- a/src/backends/ocarina-backends-connection_matrix.adb +++ b/src/backends/ocarina-backends-connection_matrix.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2011-2012 ESA & ISAE. -- +-- Copyright (C) 2011-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -126,7 +126,7 @@ package body Ocarina.Backends.Connection_Matrix is end loop; Register_Backend - ("Connection_Matrix", + ("Connection_Matrix", Generate'Access, Connection_Matrix_Analysis); end Init; diff --git a/src/backends/ocarina-backends-execution_tests.adb b/src/backends/ocarina-backends-execution_tests.adb index 059cf5b7..d57cd8e7 100644 --- a/src/backends/ocarina-backends-execution_tests.adb +++ b/src/backends/ocarina-backends-execution_tests.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -60,8 +60,8 @@ package body Ocarina.Backends.Execution_Tests is use Ocarina.Backends.Utils; use String_String_Maps; - package Addr_To_Acc is - new System.Address_To_Access_Conversions (Unbounded_String); + package Addr_To_Acc is new System.Address_To_Access_Conversions + (Unbounded_String); procedure Exit_On_Error (Error : Boolean; Reason : String); @@ -83,9 +83,9 @@ package body Ocarina.Backends.Execution_Tests is ---------- procedure Init is - -- -- Example to find the size of the Pattern_Matcher Parse_Regexp : - -- Parse_Regexp : constant Pattern_Matcher := - -- Compile ("(\[-? *[0-9]+\.[0-9]* *\])", Single_Line); + -- -- Example to find the size of the Pattern_Matcher Parse_Regexp : + -- Parse_Regexp : constant Pattern_Matcher := + -- Compile ("(\[-? *[0-9]+\.[0-9]* *\])", Single_Line); begin -- Put_Line (Integer'Image (Parse_Regexp'Size)); -- -- => 1184, the real Pattern_Matcher will be (1184 - 160) / 8 = 128 @@ -93,18 +93,19 @@ package body Ocarina.Backends.Execution_Tests is TSim_ERC32_Path := GNAT.OS_Lib.Locate_Exec_On_Path ("tsim-erc32"); TSim_LEON_Path := GNAT.OS_Lib.Locate_Exec_On_Path ("tsim-leon"); Qemu_Path := GNAT.OS_Lib.Locate_Exec_On_Path ("qemu"); - Qemu_Sparc_Path := GNAT.OS_Lib.Locate_Exec_On_Path - ("qemu-system-sparc"); + Qemu_Sparc_Path := GNAT.OS_Lib.Locate_Exec_On_Path ("qemu-system-sparc"); Xcov_Path := GNAT.OS_Lib.Locate_Exec_On_Path ("xcov"); - Command_Name_Path := new String'(Dir_Name - (Ada.Directories.Full_Name - (Ada.Command_Line.Command_Name))); + Command_Name_Path := + new String' + (Dir_Name + (Ada.Directories.Full_Name (Ada.Command_Line.Command_Name))); Compile (Parse_Regexp, "(\[-? *[0-9]+\.[0-9]* *\])", Single_Line); Compile (Strip_CR_Regexp, "(\r)", Single_Line); Compile (Header_End_Regexp, "(resuming at.*)", Multiple_Lines); - Compile (Tsim_Traces_Regexp, - "(tsim>|Program exited normally.)", - Single_Line); + Compile + (Tsim_Traces_Regexp, + "(tsim>|Program exited normally.)", + Single_Line); Compile (Empty_Line_Regexp, "(^\n)", Multiple_Lines); end Init; @@ -128,11 +129,10 @@ package body Ocarina.Backends.Execution_Tests is ------------------- function No_Regression - (Trace : Unbounded_String; - Ref : Unbounded_String; - App : Name_Id; - Ref_Path : String) - return Boolean + (Trace : Unbounded_String; + Ref : Unbounded_String; + App : Name_Id; + Ref_Path : String) return Boolean is File : File_Type; Trace_Filtered : String_Ptr; @@ -140,8 +140,8 @@ package body Ocarina.Backends.Execution_Tests is Padding : Integer; begin Write_Eol; - Write_Line ("--- Testing regression for : " - & Get_Name_String (App) & " ---"); + Write_Line + ("--- Testing regression for : " & Get_Name_String (App) & " ---"); Write_Line ("Using following referencial : " & Ref_Path); Filter_Line (To_String (Trace), Trace_Filtered); @@ -151,31 +151,29 @@ package body Ocarina.Backends.Execution_Tests is declare Referencial_Log_File : constant String := Get_Current_Dir & "log." & Get_Name_String (App) & ".ref.txt"; - Trace_Log_File : constant String := + Trace_Log_File : constant String := Get_Current_Dir & "log." & Get_Name_String (App) & ".trace.txt"; begin - Write_Line ("Writing log for referencial in : " - & Referencial_Log_File); - Create (File, - Out_File, - Referencial_Log_File); + Write_Line + ("Writing log for referencial in : " & Referencial_Log_File); + Create (File, Out_File, Referencial_Log_File); Put (File, Ref_Filtered.all); Close (File); Write_Line ("Writing log for trace in : " & Trace_Log_File); - Create (File, - Out_File, - Trace_Log_File); + Create (File, Out_File, Trace_Log_File); Put (File, Trace_Filtered.all); Close (File); end; end if; if Trace_Filtered.all'Length < Ref_Filtered.all'Length then - Write_Line ("Warning : trace length (" - & Trace_Filtered.all'Length'Img - & " ) is lower than referencial length (" - & Ref_Filtered.all'Length'Img & " )"); + Write_Line + ("Warning : trace length (" & + Trace_Filtered.all'Length'Img & + " ) is lower than referencial length (" & + Ref_Filtered.all'Length'Img & + " )"); end if; Padding := Trace_Filtered'First - Ref_Filtered'First; @@ -183,10 +181,14 @@ package body Ocarina.Backends.Execution_Tests is exit when I + Padding > Trace_Filtered.all'Last; if Ref_Filtered.all (I) /= Trace_Filtered.all (I + Padding) then - Write_Line ("Failed at char position = " & I'Img - & " (ref = '" & Ref_Filtered.all (I) - & "' trace= '" & Trace_Filtered.all (I + Padding) - & "')"); + Write_Line + ("Failed at char position = " & + I'Img & + " (ref = '" & + Ref_Filtered.all (I) & + "' trace= '" & + Trace_Filtered.all (I + Padding) & + "')"); return False; end if; end loop; @@ -223,8 +225,11 @@ package body Ocarina.Backends.Execution_Tests is is File : File_Type; begin - Write_Line ("Writing referencial for " - & Get_Name_String (App) & " to : " & File_Path); + Write_Line + ("Writing referencial for " & + Get_Name_String (App) & + " to : " & + File_Path); Create (File, Out_File, File_Path); Put_Line (File, To_String (Ref)); Close (File); @@ -237,13 +242,12 @@ package body Ocarina.Backends.Execution_Tests is function Execute_Regression_Test (Scenario_Dirname : String; Ref_Map : Map; - Timeout : Natural) - return Boolean + Timeout : Natural) return Boolean is Result : Expect_Match; Referencial : Unbounded_String; - Return_Value : Boolean := True; - TimeoutVar : Integer := Timeout; + Return_Value : Boolean := True; + TimeoutVar : Integer := Timeout; First : constant Int := Ref_Name_Tables.First; Last : constant Int := Ref_Name_Tables.Last (Process_List); Processes : Fd_Array (Integer (First) .. Integer (Last)); @@ -254,22 +258,23 @@ package body Ocarina.Backends.Execution_Tests is All_Traces := new Trace (Integer (First) .. Integer (Last)); for J in First .. Last loop - M := Process_List.Table (J); + M := Process_List.Table (J); Position := Find (Ref_Map, Get_Name_String (M.Node_Name)); if Position = No_Element then - Exit_On_Error (True, "Error : no referencial defined for " - & Get_Name_String (M.Node_Name)); + Exit_On_Error + (True, + "Error : no referencial defined for " & + Get_Name_String (M.Node_Name)); end if; declare -- Application path Appli_File : constant String := - Get_Current_Dir - & Get_Name_String (M.Appli_Name) - & Dir_Separator - & Get_Binary_Location (Get_Current_Backend_Kind, - M.Node_Name); + Get_Current_Dir & + Get_Name_String (M.Appli_Name) & + Dir_Separator & + Get_Binary_Location (Get_Current_Backend_Kind, M.Node_Name); Ref_File : constant String := Scenario_Dirname & Element (Position); @@ -279,43 +284,48 @@ package body Ocarina.Backends.Execution_Tests is Create_Referencial := True; end if; - Exit_On_Error (not Ada.Directories.Exists (Appli_File), - "Error : application " & Appli_File - & " does not exist"); + Exit_On_Error + (not Ada.Directories.Exists (Appli_File), + "Error : application " & Appli_File & " does not exist"); Write_Line ("Launching : " & Appli_File); - Launch_Test (Processes (Integer (J)), - Appli_File, - M.Execution_Platform, - TimeoutVar); - Add_Filter (Processes (Integer (J)), - Filter_Procedure'Access, - GNAT.Expect.Output, - All_Traces (Integer (J))'Address); + Launch_Test + (Processes (Integer (J)), + Appli_File, + M.Execution_Platform, + TimeoutVar); + Add_Filter + (Processes (Integer (J)), + Filter_Procedure'Access, + GNAT.Expect.Output, + All_Traces (Integer (J))'Address); end; end loop; Write_Eol; if M.Execution_Platform = Platform_LEON_ORK - or else M.Execution_Platform = Platform_ERC32_ORK then + or else M.Execution_Platform = Platform_ERC32_ORK + then -- Let tsim deal with the timeout TimeoutVar := -1; end if; for J in First .. Last loop - M := Process_List.Table (J); - Ref_Path := new String'(Scenario_Dirname - & Element (Ref_Map, - Get_Name_String (M.Node_Name))); + M := Process_List.Table (J); + Ref_Path := + new String' + (Scenario_Dirname & + Element (Ref_Map, Get_Name_String (M.Node_Name))); begin Expect (Processes (Integer (J)), Result, Never_Match, TimeoutVar); exception when GNAT.Expect.Process_Died => - Write_Line ("Warning: process " - & Get_Name_String (M.Node_Name) - & " has died during test phase"); + Write_Line + ("Warning: process " & + Get_Name_String (M.Node_Name) & + " has died during test phase"); end; Close (Processes (Integer (J))); @@ -323,25 +333,32 @@ package body Ocarina.Backends.Execution_Tests is if not Create_Referencial then Referencial := Load_Referencial (Ref_Path.all); if M.Execution_Platform = Platform_LEON_ORK - or else M.Execution_Platform = Platform_ERC32_ORK then + or else M.Execution_Platform = Platform_ERC32_ORK + then Append (All_Traces (Integer (J)), ASCII.LF); end if; - if No_Regression (All_Traces (Integer (J)), - Referencial, M.Node_Name, - Ref_Path.all) then - Write_Line ("--- Regression test result for " - & Get_Name_String (M.Node_Name) - & " : SUCCESS ---"); + if No_Regression + (All_Traces (Integer (J)), + Referencial, + M.Node_Name, + Ref_Path.all) + then + Write_Line + ("--- Regression test result for " & + Get_Name_String (M.Node_Name) & + " : SUCCESS ---"); else Return_Value := False; - Write_Line ("--- Regression test result for " - & Get_Name_String (M.Node_Name) - & " : !!! FAILED !!! ---"); + Write_Line + ("--- Regression test result for " & + Get_Name_String (M.Node_Name) & + " : !!! FAILED !!! ---"); end if; else - Write_Referencial (Ref_Path.all, - All_Traces (Integer (J)), - M.Node_Name); + Write_Referencial + (Ref_Path.all, + All_Traces (Integer (J)), + M.Node_Name); end if; Free (Ref_Path); @@ -358,9 +375,9 @@ package body Ocarina.Backends.Execution_Tests is procedure Launch_Test (Fd : out GNAT.Expect.Process_Descriptor; - Command : String; - Arch : Supported_Execution_Platform; - Timeout : Natural) + Command : String; + Arch : Supported_Execution_Platform; + Timeout : Natural) is begin case Arch is @@ -368,9 +385,10 @@ package body Ocarina.Backends.Execution_Tests is declare TSim_LEON_Args : GNAT.OS_Lib.Argument_List (1 .. 1); begin - Exit_On_Error (TSim_LEON_Path = null, - "Error : tsim-leon not found in PATH"); - Header_Has_Ended := False; + Exit_On_Error + (TSim_LEON_Path = null, + "Error : tsim-leon not found in PATH"); + Header_Has_Ended := False; TSim_LEON_Args (1) := new String'(Command); Non_Blocking_Spawn @@ -380,24 +398,25 @@ package body Ocarina.Backends.Execution_Tests is Buffer_Size => 128000, Err_To_Out => True); end; - Send (Fd, Tsim_Cmd ("go 0x40000000 " - & Integer'Image (Timeout) - & " ms")); + Send + (Fd, + Tsim_Cmd ("go 0x40000000 " & Integer'Image (Timeout) & " ms")); GNAT.OS_Lib.Close (Get_Input_Fd (Fd)); when Platform_LEON_GNAT => declare - Args : GNAT.OS_Lib.Argument_List (1 .. 5); + Args : GNAT.OS_Lib.Argument_List (1 .. 5); begin - Exit_On_Error (Qemu_Sparc_Path = null, - "Error : qemu_system_sparc not found in PATH"); + Exit_On_Error + (Qemu_Sparc_Path = null, + "Error : qemu_system_sparc not found in PATH"); Write_Line ("Launching qemu_system_sparc"); - Args (1) := new String'("-nographic"); - Args (2) := new String'("-M"); - Args (3) := new String'("at697"); - Args (4) := new String'("-kernel"); - Args (5) := new String'(Command); + Args (1) := new String'("-nographic"); + Args (2) := new String'("-M"); + Args (3) := new String'("at697"); + Args (4) := new String'("-kernel"); + Args (5) := new String'(Command); GNAT.Expect.Non_Blocking_Spawn (Descriptor => Fd, @@ -412,9 +431,10 @@ package body Ocarina.Backends.Execution_Tests is declare TSim_ERC32_Args : GNAT.OS_Lib.Argument_List (1 .. 1); begin - Exit_On_Error (TSim_ERC32_Path = null, - "Error : tsim-erc32 not found in PATH"); - Header_Has_Ended := False; + Exit_On_Error + (TSim_ERC32_Path = null, + "Error : tsim-erc32 not found in PATH"); + Header_Has_Ended := False; TSim_ERC32_Args (1) := new String'(Command); Non_Blocking_Spawn @@ -424,9 +444,9 @@ package body Ocarina.Backends.Execution_Tests is Buffer_Size => 128000, Err_To_Out => True); end; - Send (Fd, Tsim_Cmd ("go 0x02000000 " - & Integer'Image (Timeout) - & " ms")); + Send + (Fd, + Tsim_Cmd ("go 0x02000000 " & Integer'Image (Timeout) & " ms")); GNAT.OS_Lib.Close (Get_Input_Fd (Fd)); when Platform_Native => @@ -446,31 +466,33 @@ package body Ocarina.Backends.Execution_Tests is when Platform_LEON_RTEMS => declare - Args : GNAT.OS_Lib.Argument_List (1 .. 11); - Dir : constant String := Dir_Name (Normalize_Pathname - (Command - & Dir_Separator)); - App_Name : constant String := File_Name (Normalize_Pathname - (Command)); + Args : GNAT.OS_Lib.Argument_List (1 .. 11); + Dir : constant String := + Dir_Name (Normalize_Pathname (Command & Dir_Separator)); + App_Name : constant String := + File_Name (Normalize_Pathname (Command)); File : File_Type; Boot_File : Unbounded_String := - To_Unbounded_String (Command_Name_Path.all - & "resources" - & Dir_Separator - & "rtems-boot.img"); + To_Unbounded_String + (Command_Name_Path.all & + "resources" & + Dir_Separator & + "rtems-boot.img"); begin - Exit_On_Error (Qemu_Path = null, - "Error : QEMU not found in PATH"); + Exit_On_Error + (Qemu_Path = null, + "Error : QEMU not found in PATH"); if not Ada.Directories.Exists (To_String (Boot_File)) then - Boot_File := To_Unbounded_String (Command_Name_Path.all - & "rtems-boot.img"); + Boot_File := + To_Unbounded_String + (Command_Name_Path.all & "rtems-boot.img"); end if; - Exit_On_Error (not Ada.Directories.Exists - (To_String (Boot_File)), - "Error : QEMU image boot file 'rtems-boot.img' " - & "not found"); + Exit_On_Error + (not Ada.Directories.Exists (To_String (Boot_File)), + "Error : QEMU image boot file 'rtems-boot.img' " & + "not found"); Create (File, Out_File, Dir & "rtems-grub.cfg"); Put_Line (File, "set default=0"); @@ -481,8 +503,8 @@ package body Ocarina.Backends.Execution_Tests is Put_Line (File, "}"); Close (File); - Write_Line ("Launching qemu with following dir as hda : " - & Dir); + Write_Line + ("Launching qemu with following dir as hda : " & Dir); Args (1) := new String'("-boot"); Args (2) := new String'("a"); Args (3) := new String'("-fda"); @@ -492,7 +514,7 @@ package body Ocarina.Backends.Execution_Tests is Args (7) := new String'("-nographic"); Args (8) := new String'("-no-kqemu"); Args (9) := new String'("-serial"); - Args (10) := new String'("stdio"); + Args (10) := new String'("stdio"); Args (11) := new String'("-no-reboot"); GNAT.Expect.Non_Blocking_Spawn @@ -505,8 +527,9 @@ package body Ocarina.Backends.Execution_Tests is end; when others => - Exit_On_Error (True, - "Platform " & Arch'Img & " is not supported yet."); + Exit_On_Error + (True, + "Platform " & Arch'Img & " is not supported yet."); end case; end Launch_Test; @@ -516,7 +539,7 @@ package body Ocarina.Backends.Execution_Tests is procedure Clean_String_From_Regexp (Str : in out String_Ptr; - Regexp : Pattern_Matcher) + Regexp : Pattern_Matcher) is Matches : Match_Array (1 .. 1); Old_Str : String_Ptr; @@ -527,10 +550,10 @@ package body Ocarina.Backends.Execution_Tests is Old_Str := Str; -- create new parsed string from Output_Regexp - Str := new String'(Old_Str.all - (Old_Str.all'First .. Matches (1).First - 1) & - Old_Str.all - (Matches (1).Last + 1 .. Old_Str.all'Last)); + Str := + new String' + (Old_Str.all (Old_Str.all'First .. Matches (1).First - 1) & + Old_Str.all (Matches (1).Last + 1 .. Old_Str.all'Last)); -- Deallocate old string Free (Old_Str); @@ -542,9 +565,7 @@ package body Ocarina.Backends.Execution_Tests is -- Clean_String_From_All_Regexp -- ----------------------------------- - procedure Clean_String_From_All_Regexp - (Str : in out String_Ptr) - is + procedure Clean_String_From_All_Regexp (Str : in out String_Ptr) is begin Clean_String_From_Regexp (Str, Parse_Regexp); Clean_String_From_Regexp (Str, Strip_CR_Regexp); @@ -557,10 +578,7 @@ package body Ocarina.Backends.Execution_Tests is -- Filter_Line -- ----------------- - procedure Filter_Line - (Line : String; - Output_Str : in out String_Ptr) - is + procedure Filter_Line (Line : String; Output_Str : in out String_Ptr) is begin Output_Str := new String'(Line); @@ -577,8 +595,8 @@ package body Ocarina.Backends.Execution_Tests is Str : String; User_Data : System.Address) is - Output_Buffer : constant Unbounded_String_Ptr - := Unbounded_String_Ptr (Addr_To_Acc.To_Pointer (User_Data)); + Output_Buffer : constant Unbounded_String_Ptr := + Unbounded_String_Ptr (Addr_To_Acc.To_Pointer (User_Data)); begin pragma Unreferenced (Descriptor); @@ -600,8 +618,8 @@ package body Ocarina.Backends.Execution_Tests is Str : String; User_Data : System.Address) is - Output_Buffer : constant Unbounded_String_Ptr - := Unbounded_String_Ptr (Addr_To_Acc.To_Pointer (User_Data)); + Output_Buffer : constant Unbounded_String_Ptr := + Unbounded_String_Ptr (Addr_To_Acc.To_Pointer (User_Data)); begin pragma Unreferenced (Descriptor); Append (Output_Buffer.all, Str); @@ -620,14 +638,13 @@ package body Ocarina.Backends.Execution_Tests is -- Execute_Coverage_Test -- --------------------------- - function Execute_Coverage_Test (Timeout : Natural) return Boolean - is + function Execute_Coverage_Test (Timeout : Natural) return Boolean is use Ada.Real_Time; Result : Expect_Match; Return_Value : Boolean; - TimeoutVar : Natural := Timeout; - First : constant Int := Ref_Name_Tables.First; - Last : constant Int := Ref_Name_Tables.Last (Process_List); + TimeoutVar : Natural := Timeout; + First : constant Int := Ref_Name_Tables.First; + Last : constant Int := Ref_Name_Tables.Last (Process_List); Processes : Fd_Array (Integer (First) .. Integer (Last)); M : Process_Type; Span : constant Time_Span := Seconds (2); @@ -658,38 +675,38 @@ package body Ocarina.Backends.Execution_Tests is when Platform_LEON_GNAT => Args (2) := new String'("--target=leon-elf"); when others => - Exit_On_Error (True, - "Error : This platform is not yet" - & " supported for coverage test"); + Exit_On_Error + (True, + "Error : This platform is not yet" & + " supported for coverage test"); end case; end if; - Args (3) := new String'(Get_Current_Dir - & Get_Name_String (M.Appli_Name) - & Dir_Separator - & Get_Binary_Location - (Get_Current_Backend_Kind, - M.Node_Name)); + Args (3) := + new String' + (Get_Current_Dir & + Get_Name_String (M.Appli_Name) & + Dir_Separator & + Get_Binary_Location (Get_Current_Backend_Kind, M.Node_Name)); - Exit_On_Error (not Ada.Directories.Exists (Args (3).all), - "Error : application " & Args (3).all - & " does not exist"); + Exit_On_Error + (not Ada.Directories.Exists (Args (3).all), + "Error : application " & Args (3).all & " does not exist"); Write_Line ("Launching : " & Args (3).all); if Get_Current_Backend_Kind = PolyORB_Kernel_C then declare - Args2 : GNAT.OS_Lib.Argument_List (1 .. 8); + Args2 : GNAT.OS_Lib.Argument_List (1 .. 8); Success : Boolean; begin -- Prepare trace file with xcov - GNAT.OS_Lib.Spawn - (Xcov_Path.all, - Args, - Success); + GNAT.OS_Lib.Spawn (Xcov_Path.all, Args, Success); -- Get traces with Qemu Args2 (1) := new String'("-fda"); - Args2 (2) := new String'(GNAT.OS_Lib.Getenv ("POK_PATH").all - & "/misc/grub-boot-only.img"); + Args2 (2) := + new String' + (GNAT.OS_Lib.Getenv ("POK_PATH").all & + "/misc/grub-boot-only.img"); Args2 (3) := new String'("-hda"); Args2 (4) := new String'("fat:."); Args2 (5) := new String'("-boot"); @@ -712,10 +729,11 @@ package body Ocarina.Backends.Execution_Tests is Buffer_Size => 128000, Err_To_Out => True); end if; - Add_Filter (Processes (Integer (J)), - No_Filter_Procedure'Access, - GNAT.Expect.Output, - All_Traces (Integer (J))'Address); + Add_Filter + (Processes (Integer (J)), + No_Filter_Procedure'Access, + GNAT.Expect.Output, + All_Traces (Integer (J))'Address); end; Leave_Directory; end loop; @@ -728,9 +746,10 @@ package body Ocarina.Backends.Execution_Tests is Expect (Processes (Integer (J)), Result, Never_Match, TimeoutVar); exception when GNAT.Expect.Process_Died => - Write_Line ("Warning: process " - & Get_Name_String (M.Node_Name) - & " has died during coverage test phase"); + Write_Line + ("Warning: process " & + Get_Name_String (M.Node_Name) & + " has died during coverage test phase"); end; Write_Line (To_String (80 * '#')); Write_Line (To_String (All_Traces (Integer (J)))); @@ -739,7 +758,8 @@ package body Ocarina.Backends.Execution_Tests is -- Send "Ctrl-a x" command to stop qemu if Get_Current_Backend_Kind = PolyORB_Kernel_C - or else M.Execution_Platform = Platform_LEON_GNAT then + or else M.Execution_Platform = Platform_LEON_GNAT + then Send (Processes (Integer (J)), ASCII.SOH & 'x'); end if; Close (Processes (Integer (J))); @@ -756,7 +776,7 @@ package body Ocarina.Backends.Execution_Tests is for J in First .. Last loop M := Process_List.Table (J); declare - File : File_Type; + File : File_Type; O_Files : Unbounded_String; procedure Add_To_O_Files @@ -777,20 +797,22 @@ package body Ocarina.Backends.Execution_Tests is Append (O_Files, Item & ASCII.LF); end Add_To_O_Files; - procedure Find_O_Files is new - GNAT.Directory_Operations.Iteration.Find + procedure Find_O_Files is new GNAT.Directory_Operations.Iteration + .Find (Action => Add_To_O_Files); - -- Procedure used to find object files in the application - -- directory. + -- Procedure used to find object files in the application + -- directory. begin -- List object files - Find_O_Files (Get_Current_Dir & Get_Name_String (M.Appli_Name), - ".*\.o"); + Find_O_Files + (Get_Current_Dir & Get_Name_String (M.Appli_Name), + ".*\.o"); - Find_O_Files (Get_Current_Dir & Get_Name_String (M.Appli_Name), - ".*\.lo"); + Find_O_Files + (Get_Current_Dir & Get_Name_String (M.Appli_Name), + ".*\.lo"); -- Extract functions to analyze with xcov from previously found -- object files @@ -798,7 +820,7 @@ package body Ocarina.Backends.Execution_Tests is declare Nb_O_Files : constant Integer := Ada.Strings.Unbounded.Count (O_Files, ASCII.LF & ""); - Args2 : GNAT.OS_Lib.Argument_List (1 .. Nb_O_Files + 1); + Args2 : GNAT.OS_Lib.Argument_List (1 .. Nb_O_Files + 1); Lst, Next_Lst : Integer := 1; begin Args2 (1) := new String'("disp-routines"); @@ -810,9 +832,11 @@ package body Ocarina.Backends.Execution_Tests is -- Search the end of the next object file (assuming they -- are separated with spaces) - Next_Lst := Lst + Index - (Tail (O_Files, To_String (O_Files)'Length - Lst), - ASCII.LF & ""); + Next_Lst := + Lst + + Index + (Tail (O_Files, To_String (O_Files)'Length - Lst), + ASCII.LF & ""); -- Add the object file with its full path to the argument -- list (without the space). @@ -830,18 +854,18 @@ package body Ocarina.Backends.Execution_Tests is -- Finally, get functions to analyze with xcov GNAT.Expect.Non_Blocking_Spawn - (Descriptor => Processes (Integer (J)), - Command => Xcov_Path.all, - Args => Args2, + (Descriptor => Processes (Integer (J)), + Command => Xcov_Path.all, + Args => Args2, Buffer_Size => 128000, Err_To_Out => True); - Add_Filter (Processes (Integer (J)), - No_Filter_Procedure'Access, - GNAT.Expect.Output, - All_Traces (Integer (J))'Address); + Add_Filter + (Processes (Integer (J)), + No_Filter_Procedure'Access, + GNAT.Expect.Output, + All_Traces (Integer (J))'Address); begin - Expect (Processes (Integer (J)), - Result, Never_Match); + Expect (Processes (Integer (J)), Result, Never_Match); exception when GNAT.Expect.Process_Died => null; @@ -850,13 +874,16 @@ package body Ocarina.Backends.Execution_Tests is -- Write result in .trace.list file - Create (File, Out_File, Get_Current_Dir - & Get_Name_String (M.Node_Name) - & ".trace.list"); + Create + (File, + Out_File, + Get_Current_Dir & + Get_Name_String (M.Node_Name) & + ".trace.list"); Put (File, To_String (All_Traces (Integer (J)))); Close (File); - Write_Line (Get_Name_String (M.Node_Name) - & ".trace.list file created"); + Write_Line + (Get_Name_String (M.Node_Name) & ".trace.list file created"); end; end; end loop; @@ -870,28 +897,37 @@ package body Ocarina.Backends.Execution_Tests is for J in First .. Last loop M := Process_List.Table (J); declare - Args : GNAT.OS_Lib.Argument_List (1 .. 5); + Args : GNAT.OS_Lib.Argument_List (1 .. 5); Success : Boolean; begin Args (1) := new String'("coverage"); Args (2) := new String'("--level=branch"); Args (3) := new String'("--annotate=html+asm"); - Args (4) := new String'("--routine-list=" - & Get_Current_Dir - & Get_Name_String (M.Node_Name) - & ".trace.list"); - Args (5) := new String'(Get_Current_Dir - & Get_Name_String (M.Appli_Name) - & Dir_Separator - & Get_Name_String (M.Node_Name) - & ".trace"); - Write_Line ("xcov " & Args (1).all & " " & Args (2).all & " " - & Args (3).all & " " & Args (4).all & " " - & Args (5).all); - GNAT.OS_Lib.Spawn - (Xcov_Path.all, - Args, - Success); + Args (4) := + new String' + ("--routine-list=" & + Get_Current_Dir & + Get_Name_String (M.Node_Name) & + ".trace.list"); + Args (5) := + new String' + (Get_Current_Dir & + Get_Name_String (M.Appli_Name) & + Dir_Separator & + Get_Name_String (M.Node_Name) & + ".trace"); + Write_Line + ("xcov " & + Args (1).all & + " " & + Args (2).all & + " " & + Args (3).all & + " " & + Args (4).all & + " " & + Args (5).all); + GNAT.OS_Lib.Spawn (Xcov_Path.all, Args, Success); if not Success then Return_Value := False; end if; diff --git a/src/backends/ocarina-backends-execution_tests.ads b/src/backends/ocarina-backends-execution_tests.ads index 1c6d1a97..5316f308 100644 --- a/src/backends/ocarina-backends-execution_tests.ads +++ b/src/backends/ocarina-backends-execution_tests.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2013 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -52,8 +52,7 @@ package Ocarina.Backends.Execution_Tests is use Ada.Containers; use Ocarina.Backends.Properties; - package String_String_Maps is - new Ada.Containers.Indefinite_Hashed_Maps + package String_String_Maps is new Ada.Containers.Indefinite_Hashed_Maps (String, String, Ada.Strings.Hash, @@ -70,9 +69,9 @@ package Ocarina.Backends.Execution_Tests is procedure Launch_Test (Fd : out GNAT.Expect.Process_Descriptor; - Command : String; - Arch : Supported_Execution_Platform; - Timeout : Natural); + Command : String; + Arch : Supported_Execution_Platform; + Timeout : Natural); -- Used to launch the test-program on a specific envoronnement -- with specific arguments (invokes Non_Blocking_Spawn) @@ -80,14 +79,12 @@ package Ocarina.Backends.Execution_Tests is (Trace : Ada.Strings.Unbounded.Unbounded_String; Ref : Ada.Strings.Unbounded.Unbounded_String; App : Name_Id; - Ref_Path : String) - return Boolean; + Ref_Path : String) return Boolean; -- The actual oracle function: it compares the trace with the -- given referencial function Load_Referencial - (File_Path : String) - return Ada.Strings.Unbounded.Unbounded_String; + (File_Path : String) return Ada.Strings.Unbounded.Unbounded_String; -- Loads the referencial from a file and cleans it from unwanted -- characters. @@ -105,15 +102,13 @@ package Ocarina.Backends.Execution_Tests is procedure Clean_String_From_Regexp (Str : in out String_Ptr; - Regexp : Pattern_Matcher); + Regexp : Pattern_Matcher); -- Clean a string from Regexp - procedure Clean_String_From_All_Regexp - (Str : in out String_Ptr); + procedure Clean_String_From_All_Regexp (Str : in out String_Ptr); -- Clean a string from all Regexps - procedure Filter_Line (Line : String; - Output_Str : in out String_Ptr); + procedure Filter_Line (Line : String; Output_Str : in out String_Ptr); -- Clean a line from non conventional characters (\r) and from Clean_Regexp -- Line : non filtered raw Line -- Clean_Regexp : Regexp used to stip Line from unwanted informations @@ -152,43 +147,43 @@ package Ocarina.Backends.Execution_Tests is access all Ada.Strings.Unbounded.Unbounded_String; -- Define an access type for Unbounded_String - type Trace is array (Positive range <>) - of aliased Ada.Strings.Unbounded.Unbounded_String; + type Trace is + array + (Positive range <>) of aliased Ada.Strings.Unbounded.Unbounded_String; -- Type for all traces type Trace_Ptr is access all Trace; -- Access to previous type - procedure Free is - new Ada.Unchecked_Deallocation (Trace, Trace_Ptr); + procedure Free is new Ada.Unchecked_Deallocation (Trace, Trace_Ptr); -- Deallocation procedure for Trace_Ptr All_Traces : Trace_Ptr; -- Points to all traces generated from apps executions - Header_Has_Ended : Boolean := True; + Header_Has_Ended : Boolean := True; -- Tells whether header has ended or not this is -- explicitly set to False when simulator is Tsim -- when Header has ended, then every lines read from -- application stdout are added to its trace - Command_Name_Path : String_Ptr; + Command_Name_Path : String_Ptr; -- The command name path - Scenario_Dir : String_Ptr; + Scenario_Dir : String_Ptr; -- Path to scenario directory Create_Referencial : Boolean := False; -- Decides if we make a regression test or if we write a referencial -- file - Ref_Map : String_String_Maps.Map; + Ref_Map : String_String_Maps.Map; -- Map table for referencial files - Timeout : Unsigned_Long_Long; + Timeout : Unsigned_Long_Long; -- Timeout used to stop the testing process - Write_Log : Boolean := True; + Write_Log : Boolean := True; -- Decides if we should write log files for referencials and traces Parse_Regexp : Pattern_Matcher (4 * 1024); @@ -207,10 +202,10 @@ package Ocarina.Backends.Execution_Tests is private type Fd_Array is array (Positive range <>) of Process_Descriptor; - TSim_ERC32_Path : String_Access; - TSim_LEON_Path : String_Access; - Qemu_Path : String_Access; - Qemu_Sparc_Path : String_Access; - Xcov_Path : String_Access; + TSim_ERC32_Path : String_Access; + TSim_LEON_Path : String_Access; + Qemu_Path : String_Access; + Qemu_Sparc_Path : String_Access; + Xcov_Path : String_Access; end Ocarina.Backends.Execution_Tests; diff --git a/src/backends/ocarina-backends-execution_utils.adb b/src/backends/ocarina-backends-execution_utils.adb index 274c4cae..a5c5ce11 100644 --- a/src/backends/ocarina-backends-execution_utils.adb +++ b/src/backends/ocarina-backends-execution_utils.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2013 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -57,10 +57,10 @@ package body Ocarina.Backends.Execution_Utils is package AAU renames Ocarina.ME_AADL.AADL_Instances.Nutils; procedure Visit_Architecture_Instance (E : Node_Id); - procedure Visit_Component_Instance (E : Node_Id); - procedure Visit_System_Instance (E : Node_Id); - procedure Visit_Process_Instance (E : Node_Id); - procedure Visit_Processor_Instance (E : Node_Id); + procedure Visit_Component_Instance (E : Node_Id); + procedure Visit_System_Instance (E : Node_Id); + procedure Visit_Process_Instance (E : Node_Id); + procedure Visit_Processor_Instance (E : Node_Id); ----------- -- Reset -- @@ -134,9 +134,9 @@ package body Ocarina.Backends.Execution_Utils is ---------------------------- procedure Visit_Process_Instance (E : Node_Id) is - S : constant Node_Id := Parent_Subcomponent (E); - A : constant Node_Id := Parent_Component (Parent_Subcomponent (E)); - M : constant Process_Type := new Process_Rec; + S : constant Node_Id := Parent_Subcomponent (E); + A : constant Node_Id := Parent_Component (Parent_Subcomponent (E)); + M : constant Process_Type := new Process_Rec; begin if Get_Current_Backend_Kind /= PolyORB_Kernel_C then M.Appli_Name := Normalize_Name (Name (Identifier (A))); @@ -144,8 +144,8 @@ package body Ocarina.Backends.Execution_Utils is -- Get the execution platform of the processor this node is -- bound to. - M.Execution_Platform := Get_Execution_Platform - (Get_Bound_Processor (E)); + M.Execution_Platform := + Get_Execution_Platform (Get_Bound_Processor (E)); Ref_Name_Tables.Append (Process_List, M); end if; @@ -156,15 +156,15 @@ package body Ocarina.Backends.Execution_Utils is ------------------------------ procedure Visit_Processor_Instance (E : Node_Id) is - S : constant Node_Id := Parent_Subcomponent (E); - M : constant Process_Type := new Process_Rec; + S : constant Node_Id := Parent_Subcomponent (E); + M : constant Process_Type := new Process_Rec; begin if Get_Current_Backend_Kind = PolyORB_Kernel_C then Set_Str_To_Name_Buffer ("generated-code/"); Get_Name_String_And_Append (Name (Identifier (S))); M.Appli_Name := Name_Find; Set_Str_To_Name_Buffer ("pok.elf"); - M.Node_Name := Name_Find; + M.Node_Name := Name_Find; Ref_Name_Tables.Append (Process_List, M); end if; @@ -196,8 +196,7 @@ package body Ocarina.Backends.Execution_Utils is function Get_Binary_Location (Backend : Backend_Kind; - Node_Name : Name_Id) - return String + Node_Name : Name_Id) return String is begin Set_Str_To_Name_Buffer (""); @@ -205,7 +204,7 @@ package body Ocarina.Backends.Execution_Utils is case Backend is when PolyORB_HI_Ada | PolyORB_HI_C => Get_Name_String_And_Append (Node_Name); - Add_Str_To_Name_buffer (Dir_Separator & ""); + Add_Str_To_Name_Buffer (Dir_Separator & ""); Get_Name_String_And_Append (Node_Name); when PolyORB_Kernel_C => Get_Name_String_And_Append (Node_Name); diff --git a/src/backends/ocarina-backends-execution_utils.ads b/src/backends/ocarina-backends-execution_utils.ads index 5f3fccff..420ca0ff 100644 --- a/src/backends/ocarina-backends-execution_utils.ads +++ b/src/backends/ocarina-backends-execution_utils.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -40,10 +40,10 @@ package Ocarina.Backends.Execution_Utils is use Ocarina.Backends.Properties; type Process_Rec is record - Appli_Name : Name_Id; + Appli_Name : Name_Id; -- The distributed application name - Node_Name : Name_Id; + Node_Name : Name_Id; -- The node name (in lower case) Execution_Platform : Supported_Execution_Platform := Platform_None; @@ -56,11 +56,15 @@ package Ocarina.Backends.Execution_Utils is type Process_Type is access all Process_Rec; - package Ref_Name_Tables is new GNAT.Dynamic_Tables (Process_Type, Nat, - 1, 10, 10); + package Ref_Name_Tables is new GNAT.Dynamic_Tables + (Process_Type, + Nat, + 1, + 10, + 10); -- Provides a flexible Makefile_Type list - Process_List : Ref_Name_Tables.Instance; + Process_List : Ref_Name_Tables.Instance; -- List of all programs to invoke procedure Visit (E : Node_Id); @@ -69,7 +73,6 @@ package Ocarina.Backends.Execution_Utils is function Get_Binary_Location (Backend : Backend_Kind; - Node_Name : Name_Id) - return String; + Node_Name : Name_Id) return String; end Ocarina.Backends.Execution_Utils; diff --git a/src/backends/ocarina-backends-expander.adb b/src/backends/ocarina-backends-expander.adb index cfb5c78f..5ac35b15 100644 --- a/src/backends/ocarina-backends-expander.adb +++ b/src/backends/ocarina-backends-expander.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -93,8 +93,10 @@ package body Ocarina.Backends.Expander is end case; if No (E) then - Display_Error ("Cannot expand AADL models", - Fatal => True, Warning => False); + Display_Error + ("Cannot expand AADL models", + Fatal => True, + Warning => False); end if; end Expand; @@ -114,13 +116,12 @@ package body Ocarina.Backends.Expander is ------------------------------- procedure Expand_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); - N : Node_Id; - I : Node_Id; - F : Node_Id; - K : Node_Id; - L : Node_Id; + Category : constant Component_Category := Get_Category_Of_Component (E); + N : Node_Id; + I : Node_Id; + F : Node_Id; + K : Node_Id; + L : Node_Id; begin if Expanded (E) then return; @@ -141,11 +142,15 @@ package body Ocarina.Backends.Expander is while Present (I) loop if Category = CC_Subprogram then - N := Ocarina.ME_AADL.AADL_Instances.Nutils.New_Node - (K_Parameter_Instance, AIN.Loc (I)); + N := + Ocarina.ME_AADL.AADL_Instances.Nutils.New_Node + (K_Parameter_Instance, + AIN.Loc (I)); else - N := Ocarina.ME_AADL.AADL_Instances.Nutils.New_Node - (AIN.Kind (I), AIN.Loc (I)); + N := + Ocarina.ME_AADL.AADL_Instances.Nutils.New_Node + (AIN.Kind (I), + AIN.Loc (I)); AIN.Set_Identifier (N, AIU.Copy_Node (Identifier (I))); end if; @@ -157,13 +162,11 @@ package body Ocarina.Backends.Expander is end if; AIN.Set_Corresponding_Instance - (N, AIN.Corresponding_Instance (I)); - AIN.Set_Sources - (N, AIN.Sources (I)); - AIN.Set_Destinations - (N, AIN.Destinations (I)); - AIN.Set_Parent_Component - (N, AIN.Parent_Component (F)); + (N, + AIN.Corresponding_Instance (I)); + AIN.Set_Sources (N, AIN.Sources (I)); + AIN.Set_Destinations (N, AIN.Destinations (I)); + AIN.Set_Parent_Component (N, AIN.Parent_Component (F)); if not Is_Empty (Sources (F)) then @@ -172,8 +175,10 @@ package body Ocarina.Backends.Expander is L := No_Node; while Present (K) loop - L := Find_Name_In_List - (Name (Identifier (I)), Features (Item (K))); + L := + Find_Name_In_List + (Name (Identifier (I)), + Features (Item (K))); if L /= No_Node then exit; @@ -183,15 +188,19 @@ package body Ocarina.Backends.Expander is end loop; if L = No_Node then - Display_Error ("Cannot expand port/feature group", - Fatal => True, Warning => False); + Display_Error + ("Cannot expand port/feature group", + Fatal => True, + Warning => False); end if; Append_Node_To_List - (Make_Node_Container (L), Sources (N)); + (Make_Node_Container (L), + Sources (N)); Append_Node_To_List - (Make_Node_Container (N), Destinations (L)); + (Make_Node_Container (N), + Destinations (L)); end if; if not Is_Empty (Destinations (F)) then @@ -200,8 +209,10 @@ package body Ocarina.Backends.Expander is L := No_Node; while Present (K) loop - L := Find_Name_In_List - (Name (Identifier (I)), Features (Item (K))); + L := + Find_Name_In_List + (Name (Identifier (I)), + Features (Item (K))); if L /= No_Node then exit; @@ -211,15 +222,19 @@ package body Ocarina.Backends.Expander is end loop; if L = No_Node then - Display_Error ("Cannot expand port/feature group", - Fatal => True, Warning => False); + Display_Error + ("Cannot expand port/feature group", + Fatal => True, + Warning => False); end if; Append_Node_To_List - (Make_Node_Container (L), Destinations (N)); + (Make_Node_Container (L), + Destinations (N)); Append_Node_To_List - (Make_Node_Container (N), Sources (L)); + (Make_Node_Container (N), + Sources (L)); end if; AIU.Append_Node_To_List (N, Features (E)); @@ -313,22 +328,22 @@ package body Ocarina.Backends.Expander is else Display_Located_Error (AIN.Loc (E), - "A data component cannot have both subcomponents" - & " and Element_Names", + "A data component cannot have both subcomponents" & + " and Element_Names", Fatal => False); end if; F := ATN.First_Node (Types); for J in Fields'Range loop - N := New_Node (K_Subcomponent_Instance, AIN.Loc (E)); + N := New_Node (K_Subcomponent_Instance, AIN.Loc (E)); AIN.Set_Identifier (N, Make_Identifier - (AIN.Loc (E), - To_Lower (Fields (J)), - Fields (J), - N)); + (AIN.Loc (E), + To_Lower (Fields (J)), + Fields (J), + N)); Set_Corresponding_Declaration (N, No_Node); Set_Destinations (N, New_List (K_List_Id, No_Location)); Set_Corresponding_Instance @@ -366,28 +381,27 @@ package body Ocarina.Backends.Expander is -- subcomponents. declare - Types : constant List_Id := Get_Base_Type (E); - F : Node_Id; - N : Node_Id; + Types : constant List_Id := Get_Base_Type (E); + F : Node_Id; + N : Node_Id; begin if AIN.Subcomponents (E) = No_List then AIN.Set_Subcomponents (E, New_List (K_List_Id, No_Location)); else Display_Located_Error (AIN.Loc (E), - "A data component cannot have both subcomponents" - & " and Element_Names", + "A data component cannot have both subcomponents" & + " and Element_Names", Fatal => False); end if; F := ATN.First_Node (Types); while Present (F) loop - N := New_Node (K_Subcomponent_Instance, AIN.Loc (E)); + N := New_Node (K_Subcomponent_Instance, AIN.Loc (E)); AIN.Set_Identifier (N, - Ocarina.ME_AADL. - AADL_Instances.Nodes.Identifier (E)); + Ocarina.ME_AADL.AADL_Instances.Nodes.Identifier (E)); Set_Corresponding_Declaration (N, No_Node); Set_Destinations (N, New_List (K_List_Id, No_Location)); Set_Corresponding_Instance @@ -455,7 +469,8 @@ package body Ocarina.Backends.Expander is while Present (F) loop if Kind (F) /= K_Feature_Group_Spec_Instance - and then Present (Corresponding_Instance (F)) then + and then Present (Corresponding_Instance (F)) + then Expand (Corresponding_Instance (F)); end if; @@ -463,7 +478,7 @@ package body Ocarina.Backends.Expander is end loop; end if; - -- Expand all the call sequences of the subprogram + -- Expand all the call sequences of the subprogram if not Is_Empty (Calls (E)) then Call_Seq := First_Node (Calls (E)); @@ -516,12 +531,12 @@ package body Ocarina.Backends.Expander is Call_Seq : Node_Id; Spg_Call : Node_Id; F : Node_Id; - P : constant Supported_Thread_Dispatch_Protocol - := Get_Thread_Dispatch_Protocol (E); - K : constant Supported_Thread_Implementation - := Get_Thread_Implementation_Kind (E); - N : Node_Id; - G : Node_Id; + P : constant Supported_Thread_Dispatch_Protocol := + Get_Thread_Dispatch_Protocol (E); + K : constant Supported_Thread_Implementation := + Get_Thread_Implementation_Kind (E); + N : Node_Id; + G : Node_Id; begin -- Expand all data types @@ -530,7 +545,8 @@ package body Ocarina.Backends.Expander is while Present (F) loop if Kind (F) = K_Port_Spec_Instance - and then Ocarina.ME_AADL.AADL_Instances.Nodes.Is_Data (F) then + and then Ocarina.ME_AADL.AADL_Instances.Nodes.Is_Data (F) + then Expand (Corresponding_Instance (F)); end if; @@ -572,10 +588,12 @@ package body Ocarina.Backends.Expander is Set_Is_Event (N, True); Set_Is_Data (N, False); Set_Identifier - (N, Make_Identifier (No_Location, - Get_String_Name ("period_event_ü"), - Get_String_Name ("Period_Event_Ü"), - N)); + (N, + Make_Identifier + (No_Location, + Get_String_Name ("period_event_ü"), + Get_String_Name ("Period_Event_Ü"), + N)); Set_Sources (N, New_List (K_List_Id, No_Location)); Set_Destinations (N, New_List (K_List_Id, No_Location)); Set_Parent_Component (N, E); @@ -597,8 +615,7 @@ package body Ocarina.Backends.Expander is Success : Boolean := True; M : Node_Id; begin - AIN.Set_Properties (N, New_List - (AIN.K_List_Id, No_Location)); + AIN.Set_Properties (N, New_List (AIN.K_List_Id, No_Location)); if Has_Modes (E) then @@ -609,34 +626,38 @@ package body Ocarina.Backends.Expander is G := AIN.First_Node (AIN.Modes (E)); while Present (G) loop Mode := AIN.Name (AIN.Identifier (G)); - CE := Get_Thread_Compute_Entrypoint (E, Mode); + CE := Get_Thread_Compute_Entrypoint (E, Mode); if Present (CE) then C := CE; pragma Assert (Present (Instance_Root)); - Success := Add_Property_Instance - (Instance_Root, - N, - AIN.Corresponding_Declaration (CE), - Override_Mode => False); + Success := + Add_Property_Instance + (Instance_Root, + N, + AIN.Corresponding_Declaration (CE), + Override_Mode => False); M := Get_Port_Compute_Entrypoint (N, Mode); - if ATN.Kind (ATN.Expanded_Single_Value - (AIN.Property_Association_Value (M))) = - ATN.K_Reference_Term then + if ATN.Kind + (ATN.Expanded_Single_Value + (AIN.Property_Association_Value (M))) = + ATN.K_Reference_Term + then -- FIXME : -- Should be do by the replace_property_instance ATN.Set_Entity (ATN.Reference_Term - (ATN.Expanded_Single_Value - (AIN.Property_Association_Value (M))), - (ATN.entity - (ATN.Reference_Term (ATN.Expanded_Single_Value - (AIN.Property_Association_Value (CE)))))); + (AIN.Property_Association_Value (M))), + (ATN.Entity + (ATN.Reference_Term + (ATN.Expanded_Single_Value + (AIN.Property_Association_Value + (CE)))))); end if; Remove_Node_From_List (CE, AIN.Properties (E)); @@ -646,35 +667,39 @@ package body Ocarina.Backends.Expander is end loop; else CE := Get_Thread_Compute_Entrypoint (E); - C := CE; + C := CE; - AIN.Set_Properties (N, New_List - (AIN.K_List_Id, No_Location)); + AIN.Set_Properties + (N, + New_List (AIN.K_List_Id, No_Location)); pragma Assert (Present (Instance_Root)); - Success := Replace_Property_Instance - (Instance_Root, - N, - CE, - Override_Mode => True); + Success := + Replace_Property_Instance + (Instance_Root, + N, + CE, + Override_Mode => True); M := Get_Port_Compute_Entrypoint (N); - if ATN.Kind (ATN.Expanded_Single_Value - (AIN.Property_Association_Value (M))) = - ATN.K_Reference_Term then + if ATN.Kind + (ATN.Expanded_Single_Value + (AIN.Property_Association_Value (M))) = + ATN.K_Reference_Term + then -- FIXME : -- Should be do by the replace_property_instance ATN.Set_Entity (ATN.Reference_Term - (ATN.Expanded_Single_Value - (AIN.Property_Association_Value (M))), - (ATN.entity - (ATN.Reference_Term (ATN.Expanded_Single_Value - (AIN.Property_Association_Value (CE)))))); + (AIN.Property_Association_Value (M))), + (ATN.Entity + (ATN.Reference_Term + (ATN.Expanded_Single_Value + (AIN.Property_Association_Value (CE)))))); end if; end if; diff --git a/src/backends/ocarina-backends-functions_matrix-main.adb b/src/backends/ocarina-backends-functions_matrix-main.adb index 510bf3c4..12a0f5d6 100644 --- a/src/backends/ocarina-backends-functions_matrix-main.adb +++ b/src/backends/ocarina-backends-functions_matrix-main.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2011-2012 ESA & ISAE. -- +-- Copyright (C) 2011-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -52,20 +52,21 @@ package body Ocarina.Backends.Functions_Matrix.Main is use Ocarina.Backends.Properties; use Ocarina.Backends.XML_Tree.Nutils; - package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes; - package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils; - package XTN renames Ocarina.Backends.XML_Tree.Nodes; + package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes; + package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils; + package XTN renames Ocarina.Backends.XML_Tree.Nodes; procedure Visit_Architecture_Instance (E : Node_Id); procedure Visit_Component_Instance (E : Node_Id); procedure Visit_System_Instance (E : Node_Id); procedure Visit_Component (E : Node_Id; Table : Node_Id); - function Get_Full_Component_Name (E : Node_Id; R : Boolean := False) - return Name_Id; + function Get_Full_Component_Name + (E : Node_Id; + R : Boolean := False) return Name_Id; - Current_Parent_Node : Node_Id; - Functional_System : Node_Id := No_Node; - My_Root : Node_Id; + Current_Parent_Node : Node_Id; + Functional_System : Node_Id := No_Node; + My_Root : Node_Id; ----------- -- Visit -- @@ -90,8 +91,8 @@ package body Ocarina.Backends.Functions_Matrix.Main is --------------------------------- procedure Visit_Architecture_Instance (E : Node_Id) is - N : constant Node_Id := New_Node (XTN.K_HI_Node); - D : constant Node_Id := New_Node (XTN.K_HI_Distributed_Application); + N : constant Node_Id := New_Node (XTN.K_HI_Node); + D : constant Node_Id := New_Node (XTN.K_HI_Distributed_Application); U : Node_Id; T : Node_Id; P : Node_Id; @@ -125,8 +126,7 @@ package body Ocarina.Backends.Functions_Matrix.Main is Push_Entity (N); U := New_Node (XTN.K_HI_Unit, AIN.Identifier (My_Root)); - Get_Name_String - (To_XML_Name (Display_Name (Identifier (My_Root)))); + Get_Name_String (To_XML_Name (Display_Name (Identifier (My_Root)))); Add_Str_To_Name_Buffer ("_functions_matrix"); T := Make_Defining_Identifier (Name_Find); P := Make_XML_File (T); @@ -144,8 +144,7 @@ package body Ocarina.Backends.Functions_Matrix.Main is Push_Entity (U); - Current_Parent_Node := XTN.Root_Node - (XTN.XML_File (U)); + Current_Parent_Node := XTN.Root_Node (XTN.XML_File (U)); -- Make the node of the HTML file. Tmp := Make_XML_Node ("head"); @@ -155,8 +154,8 @@ package body Ocarina.Backends.Functions_Matrix.Main is -- Add a title in the section node Title := Make_XML_Node ("title"); - Set_Str_To_Name_Buffer ("Traceability of functions " & - "implementation for System "); + Set_Str_To_Name_Buffer + ("Traceability of functions " & "implementation for System "); Get_Name_String_And_Append (Display_Name (Identifier (My_Root))); XTN.Set_Node_Value (Title, Make_Defining_Identifier (Name_Find)); @@ -174,7 +173,7 @@ package body Ocarina.Backends.Functions_Matrix.Main is -- Style of the

    node Set_Str_To_Name_Buffer - ("font-family: Arial;" & + ("font-family: Arial;" & "text-align: center; font-weight: bold; font-size: 1.2em"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); @@ -182,8 +181,8 @@ package body Ocarina.Backends.Functions_Matrix.Main is Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (Tmp)); -- Title of the document - Set_Str_To_Name_Buffer ("Traceability of functions implementation "& - "for System "); + Set_Str_To_Name_Buffer + ("Traceability of functions implementation " & "for System "); Get_Name_String_And_Append (Display_Name (Identifier (My_Root))); H1 := Make_Defining_Identifier (Name_Find); @@ -201,8 +200,7 @@ package body Ocarina.Backends.Functions_Matrix.Main is ------------------------------ procedure Visit_Component_Instance (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -217,8 +215,10 @@ package body Ocarina.Backends.Functions_Matrix.Main is -- Get_Full_Component_Name -- ----------------------------- - function Get_Full_Component_Name (E : Node_Id; R : Boolean := False) - return Name_Id is + function Get_Full_Component_Name + (E : Node_Id; + R : Boolean := False) return Name_Id + is T : Name_Id; pragma Unreferenced (T); begin @@ -226,16 +226,19 @@ package body Ocarina.Backends.Functions_Matrix.Main is Set_Str_To_Name_Buffer (""); end if; - if Parent_Subcomponent (E) /= No_Node and then - Parent_Component (Parent_Subcomponent (E)) /= No_Node and then - Parent_Subcomponent - (Parent_Component (Parent_Subcomponent (E))) /= No_Node then - T := Get_Full_Component_Name - (Parent_Component (Parent_Subcomponent (E))); + if Parent_Subcomponent (E) /= No_Node + and then Parent_Component (Parent_Subcomponent (E)) /= No_Node + and then + Parent_Subcomponent (Parent_Component (Parent_Subcomponent (E))) /= + No_Node + then + T := + Get_Full_Component_Name + (Parent_Component (Parent_Subcomponent (E))); end if; Get_Name_String_And_Append - (Display_Name (Identifier (Parent_Subcomponent (E)))); + (Display_Name (Identifier (Parent_Subcomponent (E)))); if not R then Add_Str_To_Name_Buffer ("."); @@ -253,13 +256,13 @@ package body Ocarina.Backends.Functions_Matrix.Main is --------------------- procedure Visit_Component (E : Node_Id; Table : Node_Id) is - N : Node_Id; - T : Node_Id; - TR : Node_Id; - TD : Node_Id; - P : Node_Id; - Q : Node_Id; - S : Node_Id; + N : Node_Id; + T : Node_Id; + TR : Node_Id; + TD : Node_Id; + P : Node_Id; + Q : Node_Id; + S : Node_Id; begin TR := Make_XML_Node ("tr"); @@ -268,7 +271,7 @@ package body Ocarina.Backends.Functions_Matrix.Main is TD := Make_XML_Node ("td"); Set_Str_To_Name_Buffer - ("font-family: Arial; background-color: #0a97ac;" & + ("font-family: Arial; background-color: #0a97ac;" & "text-align: left; font-weight: bold; font-size: 0.8em"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); @@ -278,8 +281,7 @@ package body Ocarina.Backends.Functions_Matrix.Main is N := Make_Defining_Identifier (Get_Full_Component_Name (E, True)); XTN.Set_Node_Value (TD, N); - Append_Node_To_List (TD, - XTN.Subitems (TR)); + Append_Node_To_List (TD, XTN.Subitems (TR)); T := First_Node (Subcomponents (Functional_System)); @@ -288,33 +290,30 @@ package body Ocarina.Backends.Functions_Matrix.Main is -- actually analyzed (S). while Present (T) loop - TD := Make_XML_Node ("td"); + TD := Make_XML_Node ("td"); - if Get_Bound_Function - (E) /= No_Node and then - Get_Bound_Function - (E) = Corresponding_Instance (T) then + if Get_Bound_Function (E) /= No_Node + and then Get_Bound_Function (E) = Corresponding_Instance (T) + then Set_Str_To_Name_Buffer - ("font-family: Arial; font-weight: bold;" & - "background-color: #91ff94;" & + ("font-family: Arial; font-weight: bold;" & + "background-color: #91ff94;" & "text-align: center; font-size: 0.8em"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List - (Make_Assignement (Q, P), XTN.Items (TD)); + Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (TD)); Set_Str_To_Name_Buffer ("O"); else Set_Str_To_Name_Buffer - ("font-family: Arial; font-weight: bold;" & - "background-color: #b83f3f;" & + ("font-family: Arial; font-weight: bold;" & + "background-color: #b83f3f;" & "text-align: center; font-size: 0.8em"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); Q := Make_Defining_Identifier (Name_Find); - Append_Node_To_List - (Make_Assignement (Q, P), XTN.Items (TD)); + Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (TD)); Set_Str_To_Name_Buffer ("X"); end if; @@ -325,13 +324,11 @@ package body Ocarina.Backends.Functions_Matrix.Main is XTN.Set_Node_Value (TD, N); end if; - Append_Node_To_List (TD, - XTN.Subitems (TR)); + Append_Node_To_List (TD, XTN.Subitems (TR)); T := Next_Node (T); end loop; - Append_Node_To_List - (TR, XTN.Subitems (Table)); + Append_Node_To_List (TR, XTN.Subitems (Table)); if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); @@ -347,14 +344,14 @@ package body Ocarina.Backends.Functions_Matrix.Main is --------------------------- procedure Visit_System_Instance (E : Node_Id) is - S : Node_Id; - N : Node_Id; - TR : Node_Id; - TD : Node_Id; - Table : Node_Id; - P : Node_Id; - Q : Node_Id; - Impl_System : Node_Id := No_Node; + S : Node_Id; + N : Node_Id; + TR : Node_Id; + TD : Node_Id; + Table : Node_Id; + P : Node_Id; + Q : Node_Id; + Impl_System : Node_Id := No_Node; begin -- Declare the table node that will contain the connectivity matrix. Table := Make_XML_Node ("table"); @@ -369,15 +366,17 @@ package body Ocarina.Backends.Functions_Matrix.Main is if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop - if Get_Category_Of_Component (S) = CC_System and then - Display_Name (Identifier (S)) = - Get_String_Name ("Functional") then + if Get_Category_Of_Component (S) = CC_System + and then + Display_Name (Identifier (S)) = + Get_String_Name ("Functional") + then Functional_System := Corresponding_Instance (S); end if; - if Get_Category_Of_Component (S) = CC_System and then - Display_Name (Identifier (S)) = - Get_String_Name ("Impl") then + if Get_Category_Of_Component (S) = CC_System + and then Display_Name (Identifier (S)) = Get_String_Name ("Impl") + then Impl_System := Corresponding_Instance (S); end if; @@ -386,13 +385,11 @@ package body Ocarina.Backends.Functions_Matrix.Main is end if; if Impl_System = No_Node then - Display_Error - ("Implementation system not found", Fatal => True); + Display_Error ("Implementation system not found", Fatal => True); end if; if Functional_System = No_Node then - Display_Error - ("Functional system not found", Fatal => True); + Display_Error ("Functional system not found", Fatal => True); end if; if not AINU.Is_Empty (Subcomponents (Functional_System)) then @@ -403,8 +400,7 @@ package body Ocarina.Backends.Functions_Matrix.Main is -- Add a node that represent a colon in the line. TD := Make_XML_Node ("td"); - Append_Node_To_List (TD, - XTN.Subitems (TR)); + Append_Node_To_List (TD, XTN.Subitems (TR)); S := First_Node (Subcomponents (Functional_System)); @@ -414,7 +410,7 @@ package body Ocarina.Backends.Functions_Matrix.Main is TD := Make_XML_Node ("td"); Set_Str_To_Name_Buffer - ("font-family: Arial; background-color: #0a97ac;" & + ("font-family: Arial; background-color: #0a97ac;" & "text-align: center; font-weight: bold; font-size: 0.8em"); P := Make_Defining_Identifier (Name_Find); Set_Str_To_Name_Buffer ("style"); @@ -426,13 +422,11 @@ package body Ocarina.Backends.Functions_Matrix.Main is N := Make_Defining_Identifier (Name_Find); XTN.Set_Node_Value (TD, N); - Append_Node_To_List (TD, - XTN.Subitems (TR)); + Append_Node_To_List (TD, XTN.Subitems (TR)); S := Next_Node (S); end loop; - Append_Node_To_List (TR, - XTN.Subitems (Table)); + Append_Node_To_List (TR, XTN.Subitems (Table)); end if; if not AINU.Is_Empty (Subcomponents (Impl_System)) then @@ -444,7 +438,6 @@ package body Ocarina.Backends.Functions_Matrix.Main is end if; -- Add the table to the main HTML node (). - Append_Node_To_List (Table, - XTN.Subitems (Current_Parent_Node)); + Append_Node_To_List (Table, XTN.Subitems (Current_Parent_Node)); end Visit_System_Instance; end Ocarina.Backends.Functions_Matrix.Main; diff --git a/src/backends/ocarina-backends-functions_matrix.adb b/src/backends/ocarina-backends-functions_matrix.adb index a982e196..ec76a958 100644 --- a/src/backends/ocarina-backends-functions_matrix.adb +++ b/src/backends/ocarina-backends-functions_matrix.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2011-2012 ESA & ISAE. -- +-- Copyright (C) 2011-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -75,8 +75,8 @@ package body Ocarina.Backends.Functions_Matrix is if No (XML_Root) then Display_Error - ("Functional traceability matrix " & - "generation failed", Fatal => True); + ("Functional traceability matrix " & "generation failed", + Fatal => True); end if; -- At this point, we have a valid tree, we can begin the XML @@ -128,7 +128,7 @@ package body Ocarina.Backends.Functions_Matrix is end loop; Register_Backend - ("Function_Matrix", + ("Function_Matrix", Generate'Access, Functions_Matrix_Analysis); end Init; diff --git a/src/backends/ocarina-backends-mast-main.adb b/src/backends/ocarina-backends-mast-main.adb index 368f25c9..b91e2e3b 100644 --- a/src/backends/ocarina-backends-mast-main.adb +++ b/src/backends/ocarina-backends-mast-main.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -69,29 +69,28 @@ package body Ocarina.Backends.MAST.Main is procedure Visit_Device (E : Node_Id); procedure Visit_Virtual_Processor (E : Node_Id); - function Map_Port_Operation_Name (The_Thread : Node_Id; The_Port : Node_Id) - return Name_Id; - function Map_Driver_Receive_Operation_Name (The_Device : Node_Id) - return Name_Id; - function Map_Driver_Send_Operation_Name (The_Device : Node_Id) - return Name_Id; - function Map_Driver_Scheduling_Server_Name (The_Device : Node_Id) - return Name_Id; + function Map_Port_Operation_Name + (The_Thread : Node_Id; + The_Port : Node_Id) return Name_Id; + function Map_Driver_Receive_Operation_Name + (The_Device : Node_Id) return Name_Id; + function Map_Driver_Send_Operation_Name + (The_Device : Node_Id) return Name_Id; + function Map_Driver_Scheduling_Server_Name + (The_Device : Node_Id) return Name_Id; function Map_Scheduler_Name (The_Processor : Node_Id) return Name_Id; - function Map_Port_Shared_Resource_Name (The_Port : Node_Id) - return Name_Id; - function Map_Port_Shared_Resource_Operation_Name (The_Port : Node_Id) - return Name_Id; + function Map_Port_Shared_Resource_Name (The_Port : Node_Id) return Name_Id; + function Map_Port_Shared_Resource_Operation_Name + (The_Port : Node_Id) return Name_Id; function Make_Driver_Wrapper (The_Device : Node_Id) return Node_Id; -- Return No_Node if the corresponding device has no impact on -- scheduling, i.e. no attached driver or other properties. function Map_Operation_Message_Transmission_Name - (The_Data : Node_Id) - return Name_Id; + (The_Data : Node_Id) return Name_Id; - Root_System_Node : Node_Id := No_Node; + Root_System_Node : Node_Id := No_Node; ------------------------ -- Map_Scheduler_Name -- @@ -101,10 +100,8 @@ package body Ocarina.Backends.MAST.Main is N : Name_Id; begin Get_Name_String - (Normalize_Name - (Name - (Identifier - (Parent_Subcomponent (The_Processor))))); + (Normalize_Name + (Name (Identifier (Parent_Subcomponent (The_Processor))))); Add_Str_To_Name_Buffer ("_scheduler"); N := Name_Find; return N; @@ -114,17 +111,13 @@ package body Ocarina.Backends.MAST.Main is -- Map_Operation_Message_Transmission_Name -- --------------------------------------------- - function Map_Operation_Message_Transmission_Name (The_Data : Node_Id) - return Name_Id + function Map_Operation_Message_Transmission_Name + (The_Data : Node_Id) return Name_Id is N : Name_Id; begin Set_Str_To_Name_Buffer (""); - Get_Name_String - (Normalize_Name - (Name - (Identifier - (The_Data)))); + Get_Name_String (Normalize_Name (Name (Identifier (The_Data)))); Add_Str_To_Name_Buffer ("_transmission_operation"); N := Name_Find; return N; @@ -135,25 +128,25 @@ package body Ocarina.Backends.MAST.Main is ----------------------------------- function Map_Port_Shared_Resource_Name - (The_Port : Node_Id) - return Name_Id + (The_Port : Node_Id) return Name_Id is Component_Instance_Name : Name_Id; - Port_Name : Name_Id; - N : Name_Id; + Port_Name : Name_Id; + N : Name_Id; begin Set_Str_To_Name_Buffer (""); - Component_Instance_Name := Fully_Qualified_Instance_Name - (AIN.Parent_Component (The_Port)); + Component_Instance_Name := + Fully_Qualified_Instance_Name (AIN.Parent_Component (The_Port)); Set_Str_To_Name_Buffer (""); - Port_Name := - (Normalize_Name (Name (Identifier (The_Port)))); + Port_Name := (Normalize_Name (Name (Identifier (The_Port)))); Set_Str_To_Name_Buffer (""); - Set_Str_To_Name_Buffer (Get_Name_String (Component_Instance_Name) - & "_" & Get_Name_String (Port_Name) - & "_shared_resource"); + Set_Str_To_Name_Buffer + (Get_Name_String (Component_Instance_Name) & + "_" & + Get_Name_String (Port_Name) & + "_shared_resource"); N := Name_Find; return N; @@ -164,25 +157,25 @@ package body Ocarina.Backends.MAST.Main is --------------------------------------------- function Map_Port_Shared_Resource_Operation_Name - (The_Port : Node_Id) - return Name_Id + (The_Port : Node_Id) return Name_Id is Component_Instance_Name : Name_Id; - Port_Name : Name_Id; - N : Name_Id; + Port_Name : Name_Id; + N : Name_Id; begin Set_Str_To_Name_Buffer (""); - Component_Instance_Name := Fully_Qualified_Instance_Name - (AIN.Parent_Component (The_Port)); + Component_Instance_Name := + Fully_Qualified_Instance_Name (AIN.Parent_Component (The_Port)); Set_Str_To_Name_Buffer (""); - Port_Name := - (Normalize_Name (Name (Identifier (The_Port)))); + Port_Name := (Normalize_Name (Name (Identifier (The_Port)))); Set_Str_To_Name_Buffer (""); - Set_Str_To_Name_Buffer (Get_Name_String (Component_Instance_Name) - & "_" & Get_Name_String (Port_Name) - & "_shared_resource_operation"); + Set_Str_To_Name_Buffer + (Get_Name_String (Component_Instance_Name) & + "_" & + Get_Name_String (Port_Name) & + "_shared_resource_operation"); N := Name_Find; return N; @@ -192,21 +185,19 @@ package body Ocarina.Backends.MAST.Main is -- Map_Port_Operation_Name -- ----------------------------- - function Map_Port_Operation_Name (The_Thread : Node_Id; The_Port : Node_Id) - return Name_Id + function Map_Port_Operation_Name + (The_Thread : Node_Id; + The_Port : Node_Id) return Name_Id is Thread_Name : Name_Id; Port_Name : Name_Id; - N : Name_Id; + N : Name_Id; begin Set_Str_To_Name_Buffer (""); Thread_Name := - (Normalize_Name - (Name - (Identifier - (Parent_Subcomponent (The_Thread))))); - Port_Name := - (Normalize_Name (Name (Identifier (The_Port)))); + (Normalize_Name + (Name (Identifier (Parent_Subcomponent (The_Thread))))); + Port_Name := (Normalize_Name (Name (Identifier (The_Port)))); Set_Str_To_Name_Buffer (""); Get_Name_String (Port_Name); Add_Str_To_Name_Buffer ("_port_"); @@ -219,14 +210,15 @@ package body Ocarina.Backends.MAST.Main is -- Map_Driver_Send_Operation_Name -- ------------------------------------ - function Map_Driver_Send_Operation_Name (The_Device : Node_Id) - return Name_Id is + function Map_Driver_Send_Operation_Name + (The_Device : Node_Id) return Name_Id + is N : Name_Id; begin Set_Str_To_Name_Buffer (""); Get_Name_String - (Normalize_Name - (Name (Identifier (Parent_Subcomponent (The_Device))))); + (Normalize_Name + (Name (Identifier (Parent_Subcomponent (The_Device))))); Add_Str_To_Name_Buffer ("_operation_send"); N := Name_Find; return N; @@ -236,14 +228,15 @@ package body Ocarina.Backends.MAST.Main is -- Map_Driver_Receive_Operation_Name -- --------------------------------------- - function Map_Driver_Receive_Operation_Name (The_Device : Node_Id) - return Name_Id is + function Map_Driver_Receive_Operation_Name + (The_Device : Node_Id) return Name_Id + is N : Name_Id; begin Set_Str_To_Name_Buffer (""); Get_Name_String - (Normalize_Name - (Name (Identifier (Parent_Subcomponent (The_Device))))); + (Normalize_Name + (Name (Identifier (Parent_Subcomponent (The_Device))))); Add_Str_To_Name_Buffer ("_operation_receive"); N := Name_Find; return N; @@ -253,14 +246,15 @@ package body Ocarina.Backends.MAST.Main is -- Map_Driver_Scheduling_Server_Name -- --------------------------------------- - function Map_Driver_Scheduling_Server_Name (The_Device : Node_Id) - return Name_Id is + function Map_Driver_Scheduling_Server_Name + (The_Device : Node_Id) return Name_Id + is N : Name_Id; begin Set_Str_To_Name_Buffer (""); Get_Name_String - (Normalize_Name - (Name (Identifier (Parent_Subcomponent (The_Device))))); + (Normalize_Name + (Name (Identifier (Parent_Subcomponent (The_Device))))); Add_Str_To_Name_Buffer ("_scheduling_server"); N := Name_Find; return N; @@ -271,15 +265,17 @@ package body Ocarina.Backends.MAST.Main is ------------------------- function Make_Driver_Wrapper (The_Device : Node_Id) return Node_Id is - M : Node_Id; + M : Node_Id; New_Drv : Node_Id; begin - M := Make_Scheduling_Server - (Map_Driver_Scheduling_Server_Name (The_Device), - No_Name); + M := + Make_Scheduling_Server + (Map_Driver_Scheduling_Server_Name (The_Device), + No_Name); if Present (Get_Bound_Processor (The_Device)) then MTN.Set_Associated_Scheduler - (M, Map_Scheduler_Name (Get_Bound_Processor (The_Device))); + (M, + Map_Scheduler_Name (Get_Bound_Processor (The_Device))); else -- This device is not bound to a processor, cannot impact -- scheduling. @@ -288,29 +284,35 @@ package body Ocarina.Backends.MAST.Main is end if; MTN.Set_Parameters - (M, Make_Scheduling_Server_Parameters - (Fixed_Priority, 1)); + (M, + Make_Scheduling_Server_Parameters (Fixed_Priority, 1)); MTU.Append_Node_To_List (M, MTN.Declarations (MAST_File)); - M := Make_Operation - (Map_Driver_Send_Operation_Name (The_Device), Simple, No_List); + M := + Make_Operation + (Map_Driver_Send_Operation_Name (The_Device), + Simple, + No_List); MTU.Append_Node_To_List (M, MTN.Declarations (MAST_File)); - M := Make_Operation - (Map_Driver_Receive_Operation_Name (The_Device), Simple, No_List); + M := + Make_Operation + (Map_Driver_Receive_Operation_Name (The_Device), + Simple, + No_List); MTU.Append_Node_To_List (M, MTN.Declarations (MAST_File)); - New_Drv := MTU.Make_Driver - (Normalize_Name - (Name - (Identifier (Parent_Subcomponent (The_Device)))), - Packet, - Map_Driver_Scheduling_Server_Name (The_Device), - Map_Driver_Send_Operation_Name (The_Device), - Map_Driver_Receive_Operation_Name (The_Device), - False, - Coupled); + New_Drv := + MTU.Make_Driver + (Normalize_Name + (Name (Identifier (Parent_Subcomponent (The_Device)))), + Packet, + Map_Driver_Scheduling_Server_Name (The_Device), + Map_Driver_Send_Operation_Name (The_Device), + Map_Driver_Receive_Operation_Name (The_Device), + False, + Coupled); return New_Drv; end Make_Driver_Wrapper; @@ -338,8 +340,7 @@ package body Ocarina.Backends.MAST.Main is --------------------- procedure Visit_Component (E : Node_Id) is - Category : constant Component_Category - := Get_Category_Of_Component (E); + Category : constant Component_Category := Get_Category_Of_Component (E); begin case Category is when CC_System => @@ -379,18 +380,19 @@ package body Ocarina.Backends.MAST.Main is --------------- procedure Visit_Bus (E : Node_Id) is - N : Node_Id; - C : Node_Id; - C_Src : Node_Id; - C_Dst : Node_Id; - Src_Component : Node_Id; - Dst_Component : Node_Id; + N : Node_Id; + C : Node_Id; + C_Src : Node_Id; + C_Dst : Node_Id; + Src_Component : Node_Id; + Dst_Component : Node_Id; Driver_Component : Node_Id; begin - N := MTU.Make_Processing_Resource - (Normalize_Name (Name (Identifier (Parent_Subcomponent (E)))), - PR_Packet_Based_Network); + N := + MTU.Make_Processing_Resource + (Normalize_Name (Name (Identifier (Parent_Subcomponent (E)))), + PR_Packet_Based_Network); if not AINU.Is_Empty (Connections (Root_System_Node)) then C := First_Node (Connections (Root_System_Node)); @@ -402,14 +404,14 @@ package body Ocarina.Backends.MAST.Main is C_Dst := Get_Referenced_Entity (Destination (C)); if C_Src /= No_Node and then C_Dst /= No_Node then - Dst_Component := Parent_Subcomponent - (Parent_Component (C_Dst)); + Dst_Component := Parent_Subcomponent (Parent_Component (C_Dst)); if Src_Component = Parent_Subcomponent (E) and then Get_Category_Of_Component (Dst_Component) = CC_Device then - Driver_Component := Make_Driver_Wrapper - (Corresponding_Instance (Dst_Component)); + Driver_Component := + Make_Driver_Wrapper + (Corresponding_Instance (Dst_Component)); if Present (Driver_Component) then Append_Node_To_List (Driver_Component, @@ -441,8 +443,8 @@ package body Ocarina.Backends.MAST.Main is ------------------ procedure Visit_Device (E : Node_Id) is - S : Node_Id; - N : Node_Id; + S : Node_Id; + N : Node_Id; begin N := Make_Driver_Wrapper (E); if Present (N) then @@ -468,26 +470,24 @@ package body Ocarina.Backends.MAST.Main is --------------------- procedure Visit_Processor (E : Node_Id) is - S : Node_Id; - N : Node_Id; + S : Node_Id; + N : Node_Id; begin - N := MTU.Make_Processing_Resource - (Normalize_Name (Name (Identifier (Parent_Subcomponent (E)))), - PR_Regular_Processor); + N := + MTU.Make_Processing_Resource + (Normalize_Name (Name (Identifier (Parent_Subcomponent (E)))), + PR_Regular_Processor); MTU.Append_Node_To_List (N, MTN.Declarations (MAST_File)); - N := MTU.Make_Scheduler - (Map_Scheduler_Name (E), - Normalize_Name (Name (Identifier (Parent_Subcomponent (E))))); + N := + MTU.Make_Scheduler + (Map_Scheduler_Name (E), + Normalize_Name (Name (Identifier (Parent_Subcomponent (E))))); MTN.Set_Is_Primary_Scheduler (N, True); MTN.Set_Use_Fixed_Priority (N, True); - MTN.Set_Min_Priority - (N, Make_Literal - (New_Numeric_Value (1, 1, 10))); - MTN.Set_Max_Priority - (N, Make_Literal - (New_Numeric_Value (256, 1, 10))); + MTN.Set_Min_Priority (N, Make_Literal (New_Numeric_Value (1, 1, 10))); + MTN.Set_Max_Priority (N, Make_Literal (New_Numeric_Value (256, 1, 10))); MTU.Append_Node_To_List (N, MTN.Declarations (MAST_File)); @@ -508,7 +508,7 @@ package body Ocarina.Backends.MAST.Main is ------------------- procedure Visit_Process (E : Node_Id) is - S : Node_Id; + S : Node_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); @@ -527,39 +527,43 @@ package body Ocarina.Backends.MAST.Main is ------------------- procedure Visit_Data (E : Node_Id) is - S : Node_Id; - N : Node_Id; - CP : constant Supported_Concurrency_Control_Protocol - := Get_Concurrency_Protocol (E); + S : Node_Id; + N : Node_Id; + CP : constant Supported_Concurrency_Control_Protocol := + Get_Concurrency_Protocol (E); begin - N := Make_Operation - (Map_Operation_Message_Transmission_Name (E), - Message_Transmission, - No_List); + N := + Make_Operation + (Map_Operation_Message_Transmission_Name (E), + Message_Transmission, + No_List); if Get_Data_Size (E) /= Null_Size then MTN.Set_Max_Message_Size - (N, Make_Literal - (New_Numeric_Value - (To_Bytes (Get_Data_Size (E)), 1, 10))); + (N, + Make_Literal + (New_Numeric_Value (To_Bytes (Get_Data_Size (E)), 1, 10))); MTN.Set_Avg_Message_Size - (N, Make_Literal - (New_Numeric_Value - (To_Bytes (Get_Data_Size (E)), 1, 10))); + (N, + Make_Literal + (New_Numeric_Value (To_Bytes (Get_Data_Size (E)), 1, 10))); MTN.Set_Min_Message_Size - (N, Make_Literal - (New_Numeric_Value - (To_Bytes (Get_Data_Size (E)), 1, 10))); + (N, + Make_Literal + (New_Numeric_Value (To_Bytes (Get_Data_Size (E)), 1, 10))); end if; Append_Node_To_List (N, MTN.Declarations (MAST_File)); - if CP = Concurrency_Protected_Access or else - CP = concurrency_Priority_Ceiling or else - Is_Protected_Data (E) or else - Get_Data_Representation (E) = Data_With_Accessors then - N := Make_Shared_Resource - (Immediate_Ceiling, Normalize_Name (Name (Identifier (E)))); + if CP = Concurrency_Protected_Access + or else CP = Concurrency_Priority_Ceiling + or else Is_Protected_Data (E) + or else Get_Data_Representation (E) = Data_With_Accessors + then + N := + Make_Shared_Resource + (Immediate_Ceiling, + Normalize_Name (Name (Identifier (E)))); Append_Node_To_List (N, MTN.Declarations (MAST_File)); end if; @@ -580,31 +584,30 @@ package body Ocarina.Backends.MAST.Main is ------------------ procedure Visit_Thread (E : Node_Id) is - S : Node_Id; - N : Node_Id; - Call : Node_Id; - Spg_Call : Node_Id; - Spg : Node_Id; - Activation_Event : Node_Id; - Activation_Kind : Event_Kind := Regular; - Activation_Event_Name : Name_Id; - Output_Event : Node_Id; - Output_Event_Name : Name_Id; - Event_Handler : Node_Id; - Server_Parameters : Node_Id; - Server_Sched_Name : Name_Id; - Operation_Name : Name_Id; - Operation : Node_Id; - Operations_List : constant List_Id - := MTU.New_List (MTN.K_List_Id); - Output_Event_Req : Node_Id := No_Node; - Prio : Unsigned_Long_Long; - Exec_Time : constant Time_Array := Get_Execution_Time (E); - The_Feature : Node_Id; - Port_Operation : Node_Id; - Port_Shared_Resource : Node_Id; - Port_Shared_Resource_Op : Node_Id; - Port_Shared_Resource_Op_List : List_Id; + S : Node_Id; + N : Node_Id; + Call : Node_Id; + Spg_Call : Node_Id; + Spg : Node_Id; + Activation_Event : Node_Id; + Activation_Kind : Event_Kind := Regular; + Activation_Event_Name : Name_Id; + Output_Event : Node_Id; + Output_Event_Name : Name_Id; + Event_Handler : Node_Id; + Server_Parameters : Node_Id; + Server_Sched_Name : Name_Id; + Operation_Name : Name_Id; + Operation : Node_Id; + Operations_List : constant List_Id := MTU.New_List (MTN.K_List_Id); + Output_Event_Req : Node_Id := No_Node; + Prio : Unsigned_Long_Long; + Exec_Time : constant Time_Array := Get_Execution_Time (E); + The_Feature : Node_Id; + Port_Operation : Node_Id; + Port_Shared_Resource : Node_Id; + Port_Shared_Resource_Op : Node_Id; + Port_Shared_Resource_Op_List : List_Id; begin Set_Str_To_Name_Buffer (""); Get_Name_String (Fully_Qualified_Instance_Name (E)); @@ -620,26 +623,20 @@ package body Ocarina.Backends.MAST.Main is if Prio = 0 then Prio := 1; end if; - Server_Parameters := Make_Scheduling_Server_Parameters - (Fixed_Priority, Prio); + Server_Parameters := + Make_Scheduling_Server_Parameters (Fixed_Priority, Prio); - N := Make_Scheduling_Server - (Server_Sched_Name, - No_Name); + N := Make_Scheduling_Server (Server_Sched_Name, No_Name); MTN.Set_Associated_Scheduler - (N, + (N, Map_Scheduler_Name - (Get_Bound_Processor - (Parent_Component - (Parent_Subcomponent (E))))); + (Get_Bound_Processor (Parent_Component (Parent_Subcomponent (E))))); MTN.Set_Parameters (N, Server_Parameters); Append_Node_To_List (N, MTN.Declarations (MAST_File)); - N := Make_Transaction - (Fully_Qualified_Instance_Name (E), - Regular); + N := Make_Transaction (Fully_Qualified_Instance_Name (E), Regular); Append_Node_To_List (N, MTN.Declarations (MAST_File)); Set_Str_To_Name_Buffer (""); @@ -650,19 +647,19 @@ package body Ocarina.Backends.MAST.Main is if Get_Thread_Dispatch_Protocol (E) = Thread_Periodic then Activation_Kind := Periodic; - Output_Event_Req - := Make_Event_Timing_Requirement - (Hard_Deadline, - To_Milliseconds (Get_Thread_Deadline (E)), - Activation_Event_Name); + Output_Event_Req := + Make_Event_Timing_Requirement + (Hard_Deadline, + To_Milliseconds (Get_Thread_Deadline (E)), + Activation_Event_Name); elsif Get_Thread_Dispatch_Protocol (E) = Thread_Sporadic then Activation_Kind := Sporadic; - Output_Event_Req - := Make_Event_Timing_Requirement - (Hard_Deadline, - To_Milliseconds (Get_Thread_Deadline (E)), - Activation_Event_Name); + Output_Event_Req := + Make_Event_Timing_Requirement + (Hard_Deadline, + To_Milliseconds (Get_Thread_Deadline (E)), + Activation_Event_Name); else Activation_Kind := Regular; @@ -672,22 +669,25 @@ package body Ocarina.Backends.MAST.Main is if Get_Thread_Dispatch_Protocol (E) = Thread_Periodic then MTN.Set_Period - (Activation_Event, + (Activation_Event, Make_Literal - (New_Numeric_Value - (To_Milliseconds (Get_Thread_Period (E)), 1, 10))); + (New_Numeric_Value + (To_Milliseconds (Get_Thread_Period (E)), + 1, + 10))); elsif Get_Thread_Dispatch_Protocol (E) = Thread_Sporadic then MTN.Set_Min_Interarrival - (Activation_Event, + (Activation_Event, Make_Literal - (New_Numeric_Value - (To_Milliseconds (Get_Thread_Period (E)), 1, 10))); + (New_Numeric_Value + (To_Milliseconds (Get_Thread_Period (E)), + 1, + 10))); else MTN.Set_Period (Activation_Event, No_Node); end if; - Append_Node_To_List - (Activation_Event, MTN.External_Events (N)); + Append_Node_To_List (Activation_Event, MTN.External_Events (N)); Set_Str_To_Name_Buffer (""); Get_Name_String (Fully_Qualified_Instance_Name (E)); @@ -698,44 +698,37 @@ package body Ocarina.Backends.MAST.Main is MTN.Set_Timing_Requirements (Output_Event, Output_Event_Req); - Append_Node_To_List - (Output_Event, MTN.Internal_Events (N)); + Append_Node_To_List (Output_Event, MTN.Internal_Events (N)); - Event_Handler := Make_Event_Handler - (Activity, - Activation_Event_Name, - Output_Event_Name, - Operation_Name, - Server_Sched_Name); + Event_Handler := + Make_Event_Handler + (Activity, + Activation_Event_Name, + Output_Event_Name, + Operation_Name, + Server_Sched_Name); - Append_Node_To_List - (Event_Handler, MTN.Event_Handlers (N)); + Append_Node_To_List (Event_Handler, MTN.Event_Handlers (N)); Operation := Make_Operation (Operation_Name, Enclosing); MTN.Set_Operations (Operation, Operations_List); if Exec_Time /= Empty_Time_Array then MTN.Set_Best_Case_Execution_Time - (Operation, + (Operation, Make_Literal - (New_Numeric_Value - (To_Milliseconds (Exec_Time (0)), 1, 10))); + (New_Numeric_Value (To_Milliseconds (Exec_Time (0)), 1, 10))); MTN.Set_Worst_Case_Execution_Time - (Operation, + (Operation, Make_Literal - (New_Numeric_Value - (To_Milliseconds (Exec_Time (1)), 1, 10))); + (New_Numeric_Value (To_Milliseconds (Exec_Time (1)), 1, 10))); else MTN.Set_Best_Case_Execution_Time - (Operation, - Make_Literal - (New_Numeric_Value - (0, 1, 10))); + (Operation, + Make_Literal (New_Numeric_Value (0, 1, 10))); MTN.Set_Worst_Case_Execution_Time - (Operation, - Make_Literal - (New_Numeric_Value - (1, 1, 10))); + (Operation, + Make_Literal (New_Numeric_Value (1, 1, 10))); end if; Append_Node_To_List (Operation, MTN.Declarations (MAST_File)); @@ -749,44 +742,43 @@ package body Ocarina.Backends.MAST.Main is then Append_Node_To_List (Make_Defining_Identifier - (Map_Port_Shared_Resource_Operation_Name - (The_Feature)), + (Map_Port_Shared_Resource_Operation_Name (The_Feature)), Operations_List); - Port_Shared_Resource := Make_Shared_Resource - (Immediate_Ceiling, - Map_Port_Shared_Resource_Name (The_Feature)); + Port_Shared_Resource := + Make_Shared_Resource + (Immediate_Ceiling, + Map_Port_Shared_Resource_Name (The_Feature)); Append_Node_To_List - (Port_Shared_Resource, MTN.Declarations (MAST_File)); + (Port_Shared_Resource, + MTN.Declarations (MAST_File)); Port_Shared_Resource_Op_List := New_List (MTN.K_List_Id); Append_Node_To_List - (Make_Defining_Identifier - (Map_Port_Shared_Resource_Name (The_Feature)), + (Make_Defining_Identifier + (Map_Port_Shared_Resource_Name (The_Feature)), Port_Shared_Resource_Op_List); - Port_Shared_Resource_Op := Make_Operation - (Map_Port_Shared_Resource_Operation_Name (The_Feature), - Simple, - No_List); + Port_Shared_Resource_Op := + Make_Operation + (Map_Port_Shared_Resource_Operation_Name (The_Feature), + Simple, + No_List); MTN.Set_Shared_Resources_List - (Port_Shared_Resource_Op, - Port_Shared_Resource_Op_List); + (Port_Shared_Resource_Op, + Port_Shared_Resource_Op_List); MTN.Set_Best_Case_Execution_Time - (Port_Shared_Resource_Op, - Make_Literal - (New_Numeric_Value - (1, 1, 10))); + (Port_Shared_Resource_Op, + Make_Literal (New_Numeric_Value (1, 1, 10))); MTN.Set_Worst_Case_Execution_Time - (Port_Shared_Resource_Op, - Make_Literal - (New_Numeric_Value - (10, 1, 10))); + (Port_Shared_Resource_Op, + Make_Literal (New_Numeric_Value (10, 1, 10))); Append_Node_To_List - (Port_Shared_Resource_Op, MTN.Declarations (MAST_File)); + (Port_Shared_Resource_Op, + MTN.Declarations (MAST_File)); end if; The_Feature := Next_Node (The_Feature); @@ -798,14 +790,12 @@ package body Ocarina.Backends.MAST.Main is while Present (Call) loop if not AINU.Is_Empty (Subprogram_Calls (Call)) then - Spg_Call := AIN.First_Node - (AIN.Subprogram_Calls (Call)); + Spg_Call := AIN.First_Node (AIN.Subprogram_Calls (Call)); while Present (Spg_Call) loop Spg := AIN.Corresponding_Instance (Spg_Call); Append_Node_To_List - (Make_Defining_Identifier - (Name (Identifier (Spg))), + (Make_Defining_Identifier (Name (Identifier (Spg))), Operations_List); Visit (Spg); Spg_Call := AIN.Next_Node (Spg_Call); @@ -822,32 +812,32 @@ package body Ocarina.Backends.MAST.Main is if Kind (The_Feature) = K_Port_Spec_Instance and then Is_Out (The_Feature) then - declare - Dest_Ports : constant List_Id - := Get_Destination_Ports (The_Feature); - Dest_Port : Node_Id; - begin - if not AINU.Is_Empty (Dest_Ports) then - Dest_Port := AIN.First_Node (Dest_Ports); - while Present (Dest_Port) loop - if Get_Category_Of_Component - (Corresponding_Instance - (Parent_Subcomponent - (Parent_Component - (Item (Dest_Port))))) /= CC_Device - then - -- XXX should also consider device driver - - Append_Node_To_List - (Make_Defining_Identifier - (Map_Port_Shared_Resource_Operation_Name - (Item (Dest_Port))), - Operations_List); - end if; - Dest_Port := AIN.Next_Node (Dest_Port); - end loop; - end if; - end; + declare + Dest_Ports : constant List_Id := + Get_Destination_Ports (The_Feature); + Dest_Port : Node_Id; + begin + if not AINU.Is_Empty (Dest_Ports) then + Dest_Port := AIN.First_Node (Dest_Ports); + while Present (Dest_Port) loop + if Get_Category_Of_Component + (Corresponding_Instance + (Parent_Subcomponent + (Parent_Component (Item (Dest_Port))))) /= + CC_Device + then + -- XXX should also consider device driver + + Append_Node_To_List + (Make_Defining_Identifier + (Map_Port_Shared_Resource_Operation_Name + (Item (Dest_Port))), + Operations_List); + end if; + Dest_Port := AIN.Next_Node (Dest_Port); + end loop; + end if; + end; end if; The_Feature := Next_Node (The_Feature); end loop; @@ -870,23 +860,21 @@ package body Ocarina.Backends.MAST.Main is while Present (The_Feature) loop if Kind (The_Feature) = K_Port_Spec_Instance then Port_Operation := - Make_Operation - (Map_Port_Operation_Name (E, The_Feature), Simple); + Make_Operation + (Map_Port_Operation_Name (E, The_Feature), + Simple); MTN.Set_Operations (Port_Operation, New_List (MTN.K_List_Id)); MTN.Set_Best_Case_Execution_Time - (Port_Operation, - Make_Literal - (New_Numeric_Value - (1, 1, 10))); + (Port_Operation, + Make_Literal (New_Numeric_Value (1, 1, 10))); MTN.Set_Worst_Case_Execution_Time - (Port_Operation, - Make_Literal - (New_Numeric_Value - (2, 1, 10))); + (Port_Operation, + Make_Literal (New_Numeric_Value (2, 1, 10))); Append_Node_To_List - (Port_Operation, MTN.Declarations (MAST_File)); + (Port_Operation, + MTN.Declarations (MAST_File)); end if; The_Feature := Next_Node (The_Feature); end loop; @@ -899,13 +887,12 @@ package body Ocarina.Backends.MAST.Main is ---------------------- procedure Visit_Subprogram (E : Node_Id) is - Operation : Node_Id; - Operation_Name : Name_Id; - Operations_List : constant List_Id - := MTU.New_List (MTN.K_List_Id); + Operation : Node_Id; + Operation_Name : Name_Id; + Operations_List : constant List_Id := MTU.New_List (MTN.K_List_Id); begin Operation_Name := Name (Identifier (E)); - Operation := Make_Operation (Operation_Name, Simple); + Operation := Make_Operation (Operation_Name, Simple); MTN.Set_Operations (Operation, Operations_List); Append_Node_To_List (Operation, MTN.Declarations (MAST_File)); @@ -916,15 +903,16 @@ package body Ocarina.Backends.MAST.Main is ------------------ procedure Visit_System (E : Node_Id) is - S : Node_Id; + S : Node_Id; begin if not AINU.Is_Empty (Subcomponents (E)) then S := First_Node (Subcomponents (E)); while Present (S) loop -- Visit the component instance corresponding to the -- subcomponent S. - if Get_Category_Of_Component - (Corresponding_Instance (S)) /= CC_Device then + if Get_Category_Of_Component (Corresponding_Instance (S)) /= + CC_Device + then Visit (Corresponding_Instance (S)); end if; diff --git a/src/backends/ocarina-backends-mast.adb b/src/backends/ocarina-backends-mast.adb index 0edf5676..1ee4af10 100644 --- a/src/backends/ocarina-backends-mast.adb +++ b/src/backends/ocarina-backends-mast.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -78,7 +78,7 @@ package body Ocarina.Backends.MAST is Visit_Architecture_Instance (Instance_Root); -- Abort if the construction of the XML tree failed - if No (Mast_File) then + if No (MAST_File) then Display_Error ("MAST generation failed", Fatal => True); end if; @@ -139,9 +139,9 @@ package body Ocarina.Backends.MAST is procedure Visit_Architecture_Instance (E : Node_Id) is begin - MAST_File := MTU.Make_MAST_File - (MTU.Make_Defining_Identifier - (Get_String_Name ("mast-model"))); + MAST_File := + MTU.Make_MAST_File + (MTU.Make_Defining_Identifier (Get_String_Name ("mast-model"))); MAST.Main.Visit (E); end Visit_Architecture_Instance; @@ -149,8 +149,7 @@ package body Ocarina.Backends.MAST is -- Get_MAST_File -- ------------------- - function Get_MAST_File return Node_Id - is + function Get_MAST_File return Node_Id is begin return MAST_File; end Get_MAST_File; diff --git a/src/backends/ocarina-backends-mast.ads b/src/backends/ocarina-backends-mast.ads index 5eac56ae..9fb1d664 100644 --- a/src/backends/ocarina-backends-mast.ads +++ b/src/backends/ocarina-backends-mast.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -46,6 +46,6 @@ package Ocarina.Backends.MAST is function Get_MAST_File return Node_Id; private - MAST_File : Node_Id; + MAST_File : Node_Id; end Ocarina.Backends.MAST; diff --git a/src/backends/ocarina-backends-mast_tree-debug.adb b/src/backends/ocarina-backends-mast_tree-debug.adb index 92e3ac74..21fc43c8 100644 --- a/src/backends/ocarina-backends-mast_tree-debug.adb +++ b/src/backends/ocarina-backends-mast_tree-debug.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -31,11 +31,11 @@ -- -- ------------------------------------------------------------------------------ -with Charset; use Charset; -with Locations; use Locations; -with Namet; use Namet; -with Utils; use Utils; -with Ocarina.Backends.MAST_Values; use Ocarina.Backends.MAST_Values; +with Charset; use Charset; +with Locations; use Locations; +with Namet; use Namet; +with Utils; use Utils; +with Ocarina.Backends.MAST_Values; use Ocarina.Backends.MAST_Values; package body Ocarina.Backends.MAST_Tree.Debug is @@ -157,25 +157,21 @@ package body Ocarina.Backends.MAST_Tree.Debug is is C : Node_Id; begin - if A = "Next_Node" - or else A = "Package_Declaration" - then + if A = "Next_Node" or else A = "Package_Declaration" then return; end if; N_Indents := N_Indents + 1; W_Indents; - Write_Str (A); + Write_Str (A); Write_Char (' '); - Write_Str (K); + Write_Str (K); Write_Char (' '); C := Node_Id (N); if K = "Name_Id" then Write_Line (Quoted (V)); - elsif K = "Node_Id" - and then Present (C) - then + elsif K = "Node_Id" and then Present (C) then case Kind (C) is when K_Numeric => Write_Line ('(' & Image (Kind (Node_Id (N))) & ')'); @@ -210,9 +206,9 @@ package body Ocarina.Backends.MAST_Tree.Debug is procedure W_Node_Header (N : Node_Id) is begin W_Indents; - Write_Int (Int (N)); + Write_Int (Int (N)); Write_Char (' '); - Write_Str (Image (Kind (N))); + Write_Str (Image (Kind (N))); Write_Char (' '); Write_Line (Image (Loc (N))); end W_Node_Header; diff --git a/src/backends/ocarina-backends-mast_tree-debug.ads b/src/backends/ocarina-backends-mast_tree-debug.ads index c3be4e5e..1a859320 100644 --- a/src/backends/ocarina-backends-mast_tree-debug.ads +++ b/src/backends/ocarina-backends-mast_tree-debug.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -39,15 +39,15 @@ package Ocarina.Backends.MAST_Tree.Debug is N_Indents : Natural := 0; - procedure W_Eol (N : Natural := 1) renames Output.Write_Eol; - procedure W_Int (N : Int) renames Output.Write_Int; - procedure W_Line (N : String) renames Output.Write_Line; - procedure W_Str (N : String) renames Output.Write_Str; + procedure W_Eol (N : Natural := 1) renames Output.Write_Eol; + procedure W_Int (N : Int) renames Output.Write_Int; + procedure W_Line (N : String) renames Output.Write_Line; + procedure W_Str (N : String) renames Output.Write_Str; procedure W_Indents; - procedure W_Byte (N : Byte); - procedure W_List_Id (L : List_Id); - procedure W_Node_Id (N : Node_Id); + procedure W_Byte (N : Byte); + procedure W_List_Id (L : List_Id); + procedure W_Node_Id (N : Node_Id); procedure W_Node_Header (N : Node_Id); procedure W_Node_Attribute diff --git a/src/backends/ocarina-backends-mast_tree-generator.adb b/src/backends/ocarina-backends-mast_tree-generator.adb index 80c7abf8..f4ed12cb 100644 --- a/src/backends/ocarina-backends-mast_tree-generator.adb +++ b/src/backends/ocarina-backends-mast_tree-generator.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -91,10 +91,7 @@ package body Ocarina.Backends.MAST_Tree.Generator is -- The File name corresponding is the lowerd name of N Get_Name_String - (Conventional_Base_Name - (Name - (Defining_Identifier - (N)))); + (Conventional_Base_Name (Name (Defining_Identifier (N)))); -- Adding file suffix @@ -111,17 +108,15 @@ package body Ocarina.Backends.MAST_Tree.Generator is begin if not Print_On_Stdout then declare - File_Name : constant Name_Id - := Get_File_Name (N); - Fd : File_Descriptor; + File_Name : constant Name_Id := Get_File_Name (N); + Fd : File_Descriptor; begin Get_Name_String (File_Name); -- Create a new file and overwrites existing file with -- the same name - Fd := Create_File - (Name_Buffer (1 .. Name_Len), Text); + Fd := Create_File (Name_Buffer (1 .. Name_Len), Text); if Fd = Invalid_FD then raise Program_Error; @@ -247,7 +242,7 @@ package body Ocarina.Backends.MAST_Tree.Generator is procedure Generate_MAST_File (N : Node_Id) is Fd : File_Descriptor; - F : Node_Id; + F : Node_Id; begin if No (N) then return; @@ -288,8 +283,7 @@ package body Ocarina.Backends.MAST_Tree.Generator is Write_Name (Node_Name (N)); Write_Line (Tok_Colon); - if Fixed_Priority_Processor (N) or else - Regular_Processor (N) then + if Fixed_Priority_Processor (N) or else Regular_Processor (N) then Write_Indentation (-1); Write (Tok_Avg_ISR_Switch); Write_Space; @@ -890,7 +884,7 @@ package body Ocarina.Backends.MAST_Tree.Generator is Write (Tok_Colon); Write_Eol; Write_Indentation (-1); - Write (Tok_Best_Case_Execution_Time); + Write (Tok_Best_Case_Execution_time); Write_Space; Write (Tok_Assign); Write_Space; diff --git a/src/backends/ocarina-backends-mast_tree-nutils.adb b/src/backends/ocarina-backends-mast_tree-nutils.adb index abb0fe07..254eef6e 100644 --- a/src/backends/ocarina-backends-mast_tree-nutils.adb +++ b/src/backends/ocarina-backends-mast_tree-nutils.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -40,8 +40,7 @@ with Ocarina.Backends.MAST_Values; -- with Utils; use Utils; -- with Ocarina.Backends.Utils; -with Ocarina.ME_AADL.AADL_Tree.Nodes; -use Ocarina.ME_AADL.AADL_Tree.Nodes; +with Ocarina.ME_AADL.AADL_Tree.Nodes; use Ocarina.ME_AADL.AADL_Tree.Nodes; use Ocarina.Backends.MAST_Values; -- use Ocarina.Backends.Utils; @@ -53,13 +52,17 @@ package body Ocarina.Backends.MAST_Tree.Nutils is Keyword_Suffix : constant String := "%MAST"; type Entity_Stack_Entry is record - Current_File : Node_Id; - Current_Entity : Node_Id; + Current_File : Node_Id; + Current_Entity : Node_Id; end record; No_Depth : constant Int := -1; - package Entity_Stack is - new GNAT.Table (Entity_Stack_Entry, Int, No_Depth + 1, 10, 10); + package Entity_Stack is new GNAT.Table + (Entity_Stack_Entry, + Int, + No_Depth + 1, + 10, + 10); use Entity_Stack; @@ -69,8 +72,7 @@ package body Ocarina.Backends.MAST_Tree.Nutils is function Add_Prefix_To_Name (Prefix : String; - Name : Name_Id) - return Name_Id + Name : Name_Id) return Name_Id is begin Set_Str_To_Name_Buffer (Prefix); @@ -95,8 +97,7 @@ package body Ocarina.Backends.MAST_Tree.Nutils is function Add_Suffix_To_Name (Suffix : String; - Name : Name_Id) - return Name_Id + Name : Name_Id) return Name_Id is begin Get_Name_String (Name); @@ -110,8 +111,7 @@ package body Ocarina.Backends.MAST_Tree.Nutils is function Remove_Suffix_From_Name (Suffix : String; - Name : Name_Id) - return Name_Id + Name : Name_Id) return Name_Id is Length : Natural; Temp_Str : String (1 .. Suffix'Length); @@ -272,9 +272,7 @@ package body Ocarina.Backends.MAST_Tree.Nutils is -- Make_Defining_Identifier -- ------------------------------ - function Make_Defining_Identifier (Name : Name_Id) - return Node_Id - is + function Make_Defining_Identifier (Name : Name_Id) return Node_Id is N : Node_Id; begin @@ -290,8 +288,7 @@ package body Ocarina.Backends.MAST_Tree.Nutils is function Make_List_Id (N1 : Node_Id; N2 : Node_Id := No_Node; - N3 : Node_Id := No_Node) - return List_Id + N3 : Node_Id := No_Node) return List_Id is L : List_Id; begin @@ -327,19 +324,19 @@ package body Ocarina.Backends.MAST_Tree.Nutils is function New_List (Kind : MTN.Node_Kind; - From : Node_Id := No_Node) - return List_Id is + From : Node_Id := No_Node) return List_Id + is N : Node_Id; begin MTN.Entries.Increment_Last; - N := MTN.Entries.Last; + N := MTN.Entries.Last; MTN.Entries.Table (N) := MTN.Default_Node; Set_Kind (N, Kind); if Present (From) then - MTN.Set_Loc (N, MTN.Loc (From)); + MTN.Set_Loc (N, MTN.Loc (From)); else - MTN.Set_Loc (N, No_Location); + MTN.Set_Loc (N, No_Location); end if; return List_Id (N); end New_List; @@ -350,13 +347,12 @@ package body Ocarina.Backends.MAST_Tree.Nutils is function New_Node (Kind : MTN.Node_Kind; - From : Node_Id := No_Node) - return Node_Id + From : Node_Id := No_Node) return Node_Id is N : Node_Id; begin MTN.Entries.Increment_Last; - N := MTN.Entries.Last; + N := MTN.Entries.Last; MTN.Entries.Table (N) := MTN.Default_Node; MTN.Set_Kind (N, Kind); @@ -373,10 +369,7 @@ package body Ocarina.Backends.MAST_Tree.Nutils is -- New_Token -- --------------- - procedure New_Token - (T : Token_Type; - I : String := "") - is + procedure New_Token (T : Token_Type; I : String := "") is Name : Name_Id; begin if T in Keyword_Type then @@ -530,8 +523,9 @@ package body Ocarina.Backends.MAST_Tree.Nutils is ------------------------------ function Make_Processing_Resource - (PR_Name : Name_Id; PR_Type : Processing_Resource_Kind) - return Node_Id is + (PR_Name : Name_Id; + PR_Type : Processing_Resource_Kind) return Node_Id + is N : Node_Id; begin N := New_Node (MTN.K_Processing_Resource); @@ -553,20 +547,21 @@ package body Ocarina.Backends.MAST_Tree.Nutils is MTN.Set_Is_Full_Duplex (N, False); MTN.Set_Is_Half_Duplex (N, False); MTN.Set_Is_Simplex (N, False); - MTN.Set_Throughput - (N, Make_Literal (New_Floating_Point_Value (0.0))); - MTN.Set_Max_Blocking - (N, Make_Literal (New_Floating_Point_Value (0.0))); + MTN.Set_Throughput (N, Make_Literal (New_Floating_Point_Value (0.0))); + MTN.Set_Max_Blocking (N, Make_Literal (New_Floating_Point_Value (0.0))); MTN.Set_Max_Packet_Size - (N, Make_Literal (New_Floating_Point_Value (10.0))); + (N, + Make_Literal (New_Floating_Point_Value (10.0))); MTN.Set_Min_Packet_Size - (N, Make_Literal (New_Floating_Point_Value (1.0))); + (N, + Make_Literal (New_Floating_Point_Value (1.0))); MTN.Set_Max_Packet_Transmission_Time - (N, Make_Literal (New_Floating_Point_Value (10.0))); + (N, + Make_Literal (New_Floating_Point_Value (10.0))); MTN.Set_Min_Packet_Transmission_Time - (N, Make_Literal (New_Floating_Point_Value (0.1))); - MTN.Set_List_Of_Drivers - (N, New_List (MTN.K_List_Id)); + (N, + Make_Literal (New_Floating_Point_Value (0.1))); + MTN.Set_List_Of_Drivers (N, New_List (MTN.K_List_Id)); return N; end Make_Processing_Resource; @@ -576,9 +571,9 @@ package body Ocarina.Backends.MAST_Tree.Nutils is ---------------------------- function Make_Scheduling_Server - (Server_Name : Name_Id; - Associated_Processor : Name_Id) - return Node_Id is + (Server_Name : Name_Id; + Associated_Processor : Name_Id) return Node_Id + is N : Node_Id; begin N := New_Node (MTN.K_Scheduling_Server); @@ -595,18 +590,16 @@ package body Ocarina.Backends.MAST_Tree.Nutils is --------------------------------------- function Make_Scheduling_Server_Parameters - (Server_Kind : Scheduling_Server_Parameter_Kind; - Prio : Unsigned_Long_Long) - return Node_Id is + (Server_Kind : Scheduling_Server_Parameter_Kind; + Prio : Unsigned_Long_Long) return Node_Id + is N : Node_Id; begin N := New_Node (MTN.K_Scheduling_Server_Parameters); MTN.Set_Fixed_Priority (N, False); MTN.Set_Is_Preassigned (N, False); - MTN.Set_Priority - (N, Make_Literal - (New_Numeric_Value (Prio, 1, 10))); + MTN.Set_Priority (N, Make_Literal (New_Numeric_Value (Prio, 1, 10))); if Server_Kind = Fixed_Priority then MTN.Set_Fixed_Priority (N, True); @@ -619,9 +612,8 @@ package body Ocarina.Backends.MAST_Tree.Nutils is ---------------------- function Make_Transaction - (Trans_Name : Name_Id; - Trans_Type : Transaction_Kind) - return Node_Id + (Trans_Name : Name_Id; + Trans_Type : Transaction_Kind) return Node_Id is pragma Unreferenced (Trans_Type); @@ -641,9 +633,10 @@ package body Ocarina.Backends.MAST_Tree.Nutils is ---------------- function Make_Event - (E_Name : Name_Id; - E_Kind : Event_Kind) return Node_Id is - N : Node_Id; + (E_Name : Name_Id; + E_Kind : Event_Kind) return Node_Id + is + N : Node_Id; begin N := New_Node (MTN.K_Event); MTN.Set_Node_Name (N, E_Name); @@ -669,11 +662,11 @@ package body Ocarina.Backends.MAST_Tree.Nutils is ------------------------ function Make_Event_Handler - (Kind : Event_Handler_Kind; - Input_Event : Name_Id; - Output_Event : Name_Id; - Operation : Name_Id; - Server : Name_Id) return Node_Id + (Kind : Event_Handler_Kind; + Input_Event : Name_Id; + Output_Event : Name_Id; + Operation : Name_Id; + Server : Name_Id) return Node_Id is pragma Unreferenced (Kind); @@ -694,11 +687,11 @@ package body Ocarina.Backends.MAST_Tree.Nutils is -------------------- function Make_Operation - (Op_Name : Name_Id; - Op_Kind : Operation_Kind; - Op_List : List_Id := No_List) - return Node_Id is - N : Node_Id; + (Op_Name : Name_Id; + Op_Kind : Operation_Kind; + Op_List : List_Id := No_List) return Node_Id + is + N : Node_Id; begin N := New_Node (MTN.K_Operation); @@ -739,10 +732,9 @@ package body Ocarina.Backends.MAST_Tree.Nutils is ----------------------------------- function Make_Event_Timing_Requirement - (Req_Kind : Event_Timing_Requirement_Kind; - Deadline : Unsigned_Long_Long; - Ref_Event : Name_Id) - return Node_Id + (Req_Kind : Event_Timing_Requirement_Kind; + Deadline : Unsigned_Long_Long; + Ref_Event : Name_Id) return Node_Id is pragma Unreferenced (Req_Kind); @@ -750,9 +742,7 @@ package body Ocarina.Backends.MAST_Tree.Nutils is begin N := New_Node (MTN.K_Event_Timing_Requirements); MTN.Set_Is_Hard_Deadline (N, True); - MTN.Set_Deadline - (N, Make_Literal - (New_Numeric_Value (Deadline, 1, 10))); + MTN.Set_Deadline (N, Make_Literal (New_Numeric_Value (Deadline, 1, 10))); MTN.Set_Referenced_Event (N, Ref_Event); return N; @@ -763,8 +753,8 @@ package body Ocarina.Backends.MAST_Tree.Nutils is -------------------------- function Make_Shared_Resource - (Res_Kind : Shared_Resource_Kind; Res_Name : Name_Id) - return Node_Id + (Res_Kind : Shared_Resource_Kind; + Res_Name : Name_Id) return Node_Id is N : Node_Id; begin @@ -784,14 +774,13 @@ package body Ocarina.Backends.MAST_Tree.Nutils is ----------------- function Make_Driver - (Driver_Name : Name_Id; + (Driver_Name : Name_Id; Drv_Kind : Driver_Kind; Server_Sched_Name : Name_Id; Send_Name : Name_Id; Receive_Name : Name_Id; Partitioning : Boolean; - Overhead_Kind : RTA_Overhead_Model_Kind) - return Node_Id + Overhead_Kind : RTA_Overhead_Model_Kind) return Node_Id is N : Node_Id; begin @@ -820,8 +809,9 @@ package body Ocarina.Backends.MAST_Tree.Nutils is -- Make_Scheduler -- -------------------- - function Make_Scheduler (Sched_Name : Name_Id; Host_Name : Name_Id) - return Node_Id + function Make_Scheduler + (Sched_Name : Name_Id; + Host_Name : Name_Id) return Node_Id is N : Node_Id; begin diff --git a/src/backends/ocarina-backends-mast_tree-nutils.ads b/src/backends/ocarina-backends-mast_tree-nutils.ads index 9e43a8e0..2a43c586 100644 --- a/src/backends/ocarina-backends-mast_tree-nutils.ads +++ b/src/backends/ocarina-backends-mast_tree-nutils.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -35,11 +35,11 @@ with Ocarina.Backends.MAST_Tree.Nodes; use Ocarina.Backends.MAST_Tree.Nodes; package Ocarina.Backends.MAST_Tree.Nutils is - Int0_Val : Value_Id; - Int1_Val : Value_Id; + Int0_Val : Value_Id; + Int1_Val : Value_Id; - Var_Suffix : constant String := "_mast"; - Initialized : Boolean := False; + Var_Suffix : constant String := "_mast"; + Initialized : Boolean := False; Output_Tree_Warnings : Boolean := False; Output_Unit_Withing : Boolean := False; @@ -47,9 +47,9 @@ package Ocarina.Backends.MAST_Tree.Nutils is type Token_Type is ( - -- Token name Token type - -- Keywords - Tok_First_Keyword, + -- Token name Token type + -- Keywords + Tok_First_Keyword, Tok_Activity_Operation, Tok_Activity_Server, Tok_Avg_Case_Execution_Time, @@ -129,25 +129,22 @@ package Ocarina.Backends.MAST_Tree.Nutils is Token_Image : array (Token_Type) of Name_Id; - subtype Keyword_Type is Token_Type - range Tok_First_Keyword .. Tok_Last_Keyword; + subtype Keyword_Type is + Token_Type range Tok_First_Keyword .. Tok_Last_Keyword; procedure Reset; function Add_Prefix_To_Name (Prefix : String; - Name : Name_Id) - return Name_Id; + Name : Name_Id) return Name_Id; function Add_Suffix_To_Name (Suffix : String; - Name : Name_Id) - return Name_Id; + Name : Name_Id) return Name_Id; function Remove_Suffix_From_Name (Suffix : String; - Name : Name_Id) - return Name_Id; + Name : Name_Id) return Name_Id; -- This function returns a new name without the suffix. If the -- suffix does not exist, the returned name is equal to the given -- name. @@ -158,26 +155,20 @@ package Ocarina.Backends.MAST_Tree.Nutils is procedure Push_Entity (E : Node_Id); procedure Pop_Entity; - function Current_Entity return Node_Id; - function Current_File return Node_Id; + function Current_Entity return Node_Id; + function Current_File return Node_Id; - function Make_Defining_Identifier - (Name : Name_Id) - return Node_Id; + function Make_Defining_Identifier (Name : Name_Id) return Node_Id; - function Copy_Node - (N : Node_Id) - return Node_Id; + function Copy_Node (N : Node_Id) return Node_Id; function New_Node (Kind : Node_Kind; - From : Node_Id := No_Node) - return Node_Id; + From : Node_Id := No_Node) return Node_Id; function New_List (Kind : Node_Kind; - From : Node_Id := No_Node) - return List_Id; + From : Node_Id := No_Node) return List_Id; function Image (T : Token_Type) return String; @@ -197,8 +188,7 @@ package Ocarina.Backends.MAST_Tree.Nutils is function Make_List_Id (N1 : Node_Id; N2 : Node_Id := No_Node; - N3 : Node_Id := No_Node) - return List_Id; + N3 : Node_Id := No_Node) return List_Id; function Next_N_Node (N : Node_Id; Num : Natural) return Node_Id; -- This function executes Next_Node Num times @@ -213,90 +203,71 @@ package Ocarina.Backends.MAST_Tree.Nutils is function Make_Container (Content : Node_Id) return Node_Id; type Processing_Resource_Kind is - ( - PR_Regular_Processor, - PR_Fixed_Priority_Processor, - PR_Packet_Based_Network - ); + (PR_Regular_Processor, + PR_Fixed_Priority_Processor, + PR_Packet_Based_Network); - type Transmission_Kind is - (Simplex, Half_Duplex, Full_Duplex); + type Transmission_Kind is (Simplex, Half_Duplex, Full_Duplex); function Make_Processing_Resource - (PR_Name : Name_Id; PR_Type : Processing_Resource_Kind) - return Node_Id; + (PR_Name : Name_Id; + PR_Type : Processing_Resource_Kind) return Node_Id; - type Scheduling_Server_Parameter_Kind is - ( - Fixed_Priority, - Unknown - ); + type Scheduling_Server_Parameter_Kind is (Fixed_Priority, Unknown); function Make_Scheduling_Server_Parameters - (Server_Kind : Scheduling_Server_Parameter_Kind; - Prio : Unsigned_Long_Long) - return Node_Id; + (Server_Kind : Scheduling_Server_Parameter_Kind; + Prio : Unsigned_Long_Long) return Node_Id; function Make_Scheduling_Server - (Server_Name : Name_Id; - Associated_Processor : Name_Id) - return Node_Id; + (Server_Name : Name_Id; + Associated_Processor : Name_Id) return Node_Id; - type Event_Kind is - (Periodic, Sporadic, Regular); + type Event_Kind is (Periodic, Sporadic, Regular); - function Make_Event - (E_Name : Name_Id; - E_Kind : Event_Kind) return Node_Id; + function Make_Event (E_Name : Name_Id; E_Kind : Event_Kind) return Node_Id; - type Event_Handler_Kind is - (Activity); + type Event_Handler_Kind is (Activity); function Make_Event_Handler - (Kind : Event_Handler_Kind; - Input_Event : Name_Id; - Output_Event : Name_Id; - Operation : Name_Id; - Server : Name_Id) return Node_Id; + (Kind : Event_Handler_Kind; + Input_Event : Name_Id; + Output_Event : Name_Id; + Operation : Name_Id; + Server : Name_Id) return Node_Id; - type Transaction_Kind is - (Regular); + type Transaction_Kind is (Regular); function Make_Transaction - (Trans_Name : Name_Id; - Trans_Type : Transaction_Kind) - return Node_Id; + (Trans_Name : Name_Id; + Trans_Type : Transaction_Kind) return Node_Id; - type Operation_Kind is - (Enclosing, Simple, Composite, Message_Transmission); + type Operation_Kind is (Enclosing, Simple, Composite, Message_Transmission); function Make_Operation - (Op_Name : Name_Id; - Op_Kind : Operation_Kind; - Op_List : List_Id := No_List) - return Node_Id; + (Op_Name : Name_Id; + Op_Kind : Operation_Kind; + Op_List : List_Id := No_List) return Node_Id; - type Event_Timing_Requirement_Kind is - (Hard_Deadline); + type Event_Timing_Requirement_Kind is (Hard_Deadline); function Make_Event_Timing_Requirement - (Req_Kind : Event_Timing_Requirement_Kind; - Deadline : Unsigned_Long_Long; - Ref_Event : Name_Id) - return Node_Id; + (Req_Kind : Event_Timing_Requirement_Kind; + Deadline : Unsigned_Long_Long; + Ref_Event : Name_Id) return Node_Id; type Shared_Resource_Kind is (Immediate_Ceiling, Unknown); function Make_Shared_Resource - (Res_Kind : Shared_Resource_Kind; Res_Name : Name_Id) - return Node_Id; + (Res_Kind : Shared_Resource_Kind; + Res_Name : Name_Id) return Node_Id; type RTA_Overhead_Model_Kind is (Coupled, Decoupled); type Driver_Kind is (Character, Packet); function Make_Driver - (Driver_Name : Name_Id; + (Driver_Name : Name_Id; Drv_Kind : Driver_Kind; Server_Sched_Name : Name_Id; Send_Name : Name_Id; @@ -304,6 +275,7 @@ package Ocarina.Backends.MAST_Tree.Nutils is Partitioning : Boolean; Overhead_Kind : RTA_Overhead_Model_Kind) return Node_Id; - function Make_Scheduler (Sched_Name : Name_Id; Host_Name : Name_Id) - return Node_Id; + function Make_Scheduler + (Sched_Name : Name_Id; + Host_Name : Name_Id) return Node_Id; end Ocarina.Backends.MAST_Tree.Nutils; diff --git a/src/backends/ocarina-backends-mast_values.adb b/src/backends/ocarina-backends-mast_values.adb index be848622..139ac1b9 100644 --- a/src/backends/ocarina-backends-mast_values.adb +++ b/src/backends/ocarina-backends-mast_values.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -31,7 +31,7 @@ -- -- ------------------------------------------------------------------------------ -with Namet; use Namet; +with Namet; use Namet; with Ocarina.AADL_Values; with GNAT.Table; @@ -40,10 +40,9 @@ package body Ocarina.Backends.MAST_Values is package OV renames Ocarina.AADL_Values; - Hex : constant String := "0123456789ABCDEF"; + Hex : constant String := "0123456789ABCDEF"; - package VT is - new GNAT.Table (Value_Type, Value_Id, No_Value + 1, 10, 10); + package VT is new GNAT.Table (Value_Type, Value_Id, No_Value + 1, 10, 10); subtype ULL is Unsigned_Long_Long; @@ -53,8 +52,7 @@ package body Ocarina.Backends.MAST_Values is -- "*" -- --------- - function "*" (L, R : Value_Type) return Value_Type - is + function "*" (L, R : Value_Type) return Value_Type is V : Value_Type := L; begin case V.K is @@ -75,9 +73,8 @@ package body Ocarina.Backends.MAST_Values is -- "+" -- --------- - function "+" (L, R : Value_Type) return Value_Type - is - V : Value_Type := R; + function "+" (L, R : Value_Type) return Value_Type is + V : Value_Type := R; begin case R.K is when K_Numeric => @@ -105,8 +102,7 @@ package body Ocarina.Backends.MAST_Values is -- "-" -- --------- - function "-" (R : Value_Type) return Value_Type - is + function "-" (R : Value_Type) return Value_Type is V : Value_Type := R; begin case R.K is @@ -124,8 +120,7 @@ package body Ocarina.Backends.MAST_Values is -- "-" -- --------- - function "-" (L, R : Value_Type) return Value_Type - is + function "-" (L, R : Value_Type) return Value_Type is V : Value_Type := R; begin case R.K is @@ -143,9 +138,8 @@ package body Ocarina.Backends.MAST_Values is -- "/" -- --------- - function "/" (L, R : Value_Type) return Value_Type - is - V : Value_Type := L; + function "/" (L, R : Value_Type) return Value_Type is + V : Value_Type := L; begin case V.K is when K_Numeric => @@ -191,8 +185,7 @@ package body Ocarina.Backends.MAST_Values is -- "and" -- ----------- - function "and" (L, R : Value_Type) return Value_Type - is + function "and" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -220,8 +213,7 @@ package body Ocarina.Backends.MAST_Values is -- "mod" -- ----------- - function "mod" (L, R : Value_Type) return Value_Type - is + function "mod" (L, R : Value_Type) return Value_Type is V : Value_Type := L; begin case L.K is @@ -242,8 +234,7 @@ package body Ocarina.Backends.MAST_Values is -- "not" -- ----------- - function "not" (R : Value_Type) return Value_Type - is + function "not" (R : Value_Type) return Value_Type is V : Value_Type := R; begin case V.K is @@ -260,8 +251,7 @@ package body Ocarina.Backends.MAST_Values is -- "or" -- ---------- - function "or" (L, R : Value_Type) return Value_Type - is + function "or" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -289,8 +279,7 @@ package body Ocarina.Backends.MAST_Values is -- "xor" -- ----------- - function "xor" (L, R : Value_Type) return Value_Type - is + function "xor" (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -318,8 +307,7 @@ package body Ocarina.Backends.MAST_Values is -- Add_ULL_To_Name_Buffer -- ---------------------------- - procedure Add_ULL_To_Name_Buffer (U : ULL; B : ULL; S : Integer := 1) - is + procedure Add_ULL_To_Name_Buffer (U : ULL; B : ULL; S : Integer := 1) is Q : constant ULL := U / B; R : constant ULL := U mod B; begin @@ -333,14 +321,13 @@ package body Ocarina.Backends.MAST_Values is -- Image -- ----------- - function Image (Value : Value_Id) return String - is + function Image (Value : Value_Id) return String is V : Value_Type; begin if Value = No_Value then return "<>"; end if; - V := VT.Table (Value); + V := VT.Table (Value); Name_Len := 0; case V.K is @@ -430,8 +417,8 @@ package body Ocarina.Backends.MAST_Values is function New_Numeric_Value (Value : Unsigned_Long_Long; Sign : Short_Short; - Base : Unsigned_Short_Short) - return Value_Id is + Base : Unsigned_Short_Short) return Value_Id + is begin return New_Value (Value_Type'(K_Numeric, Value, Sign, Base)); end New_Numeric_Value; @@ -440,12 +427,11 @@ package body Ocarina.Backends.MAST_Values is -- New_Value -- --------------- - function New_Value (Value : Value_Type) return Value_Id - is + function New_Value (Value : Value_Type) return Value_Id is V : Value_Id; begin VT.Increment_Last; - V := VT.Last; + V := VT.Last; VT.Table (V) := Value; return V; end New_Value; @@ -454,9 +440,7 @@ package body Ocarina.Backends.MAST_Values is -- New_Floating_Point_Value -- ------------------------------ - function New_Floating_Point_Value - (Value : Long_Double) - return Value_Id is + function New_Floating_Point_Value (Value : Long_Double) return Value_Id is begin return New_Value (Value_Type'(K_Float, Value)); end New_Floating_Point_Value; @@ -474,8 +458,7 @@ package body Ocarina.Backends.MAST_Values is -- Shift_Left -- ---------------- - function Shift_Left (L, R : Value_Type) return Value_Type - is + function Shift_Left (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -500,8 +483,7 @@ package body Ocarina.Backends.MAST_Values is -- Shift_Right -- ----------------- - function Shift_Right (L, R : Value_Type) return Value_Type - is + function Shift_Right (L, R : Value_Type) return Value_Type is LV : Value_Type := L; RV : Value_Type := R; begin @@ -522,9 +504,7 @@ package body Ocarina.Backends.MAST_Values is end case; end Shift_Right; - function New_String_Value - (Value : Name_Id) - return Value_Id is + function New_String_Value (Value : Name_Id) return Value_Id is begin return New_Value (Value_Type'(K_String, Value)); end New_String_Value; diff --git a/src/backends/ocarina-backends-mast_values.ads b/src/backends/ocarina-backends-mast_values.ads index d133d963..e31687b6 100644 --- a/src/backends/ocarina-backends-mast_values.ads +++ b/src/backends/ocarina-backends-mast_values.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -39,41 +39,35 @@ package Ocarina.Backends.MAST_Values is package FLT_IO is new Ada.Text_IO.Float_IO (Float); - type Value_Type (K : Node_Kind := K_Numeric) is - record - case K is - when K_Numeric => - IVal : Unsigned_Long_Long; - Sign : Short_Short; - Base : Unsigned_Short_Short; + type Value_Type (K : Node_Kind := K_Numeric) is record + case K is + when K_Numeric => + IVal : Unsigned_Long_Long; + Sign : Short_Short; + Base : Unsigned_Short_Short; - when K_String => - PCVal : Name_Id; + when K_String => + PCVal : Name_Id; - when K_Float => - FVal : Long_Double; + when K_Float => + FVal : Long_Double; - when others => - null; - end case; - end record; + when others => + null; + end case; + end record; Bad_Value : constant Value_Type; - No_Value : constant Value_Id; + No_Value : constant Value_Id; function New_Numeric_Value (Value : Unsigned_Long_Long; Sign : Short_Short; - Base : Unsigned_Short_Short) - return Value_Id; + Base : Unsigned_Short_Short) return Value_Id; - function New_String_Value - (Value : Name_Id) - return Value_Id; + function New_String_Value (Value : Name_Id) return Value_Id; - function New_Value - (Value : Value_Type) - return Value_Id; + function New_Value (Value : Value_Type) return Value_Id; function Value (V : Value_Id) return Value_Type; procedure Set_Value (V : Value_Id; X : Value_Type); @@ -84,30 +78,29 @@ package Ocarina.Backends.MAST_Values is -- Converts an AADL value to an MAST one function "not" (R : Value_Type) return Value_Type; - function "-" (R : Value_Type) return Value_Type; - function "-" (L, R : Value_Type) return Value_Type; - function "+" (L, R : Value_Type) return Value_Type; + function "-" (R : Value_Type) return Value_Type; + function "-" (L, R : Value_Type) return Value_Type; + function "+" (L, R : Value_Type) return Value_Type; function "mod" (L, R : Value_Type) return Value_Type; - function "/" (L, R : Value_Type) return Value_Type; - function "*" (L, R : Value_Type) return Value_Type; + function "/" (L, R : Value_Type) return Value_Type; + function "*" (L, R : Value_Type) return Value_Type; function "and" (L, R : Value_Type) return Value_Type; - function "or" (L, R : Value_Type) return Value_Type; + function "or" (L, R : Value_Type) return Value_Type; function "xor" (L, R : Value_Type) return Value_Type; - function Shift_Left (L, R : Value_Type) return Value_Type; + function Shift_Left (L, R : Value_Type) return Value_Type; function Shift_Right (L, R : Value_Type) return Value_Type; - function "<" (L, R : Value_Type) return Boolean; + function "<" (L, R : Value_Type) return Boolean; -- Assume L and R have the same type. procedure Reset; -- Reset the value table - function New_Floating_Point_Value - (Value : Long_Double) return Value_Id; + function New_Floating_Point_Value (Value : Long_Double) return Value_Id; private Bad_Value : constant Value_Type := Value_Type'((K => K_Node_Id)); - No_Value : constant Value_Id := 0; + No_Value : constant Value_Id := 0; end Ocarina.Backends.MAST_Values; diff --git a/src/backends/ocarina-backends-messages.adb b/src/backends/ocarina-backends-messages.adb index fc051f87..c3c1aa00 100644 --- a/src/backends/ocarina-backends-messages.adb +++ b/src/backends/ocarina-backends-messages.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- +-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- @@ -78,7 +78,8 @@ package body Ocarina.Backends.Messages is procedure Display_Error (Message : String; Fatal : Boolean; - Warning : Boolean := False) is + Warning : Boolean := False) + is begin Display_Error_Message (Message, Fatal, Warning); @@ -115,7 +116,8 @@ package body Ocarina.Backends.Messages is procedure Display_Debug_Message (Message : String; - Force : Boolean := False) is + Force : Boolean := False) + is begin if Debug_Mode or else Force then Write_Str ("Backends message: "); diff --git a/src/backends/ocarina-backends-pn-components.adb b/src/backends/ocarina-backends-pn-components.adb index 331d1b10..359de15b 100644 --- a/src/backends/ocarina-backends-pn-components.adb +++ b/src/backends/ocarina-backends-pn-components.adb @@ -45,7 +45,7 @@ with Ocarina.AADL_Values; with Ocarina.Instances.Queries; with Ocarina.Backends.PN.Iutils; with Ocarina.Backends.PN.Utils; -with Ocarina.Backends.Messages; use Ocarina.Backends.Messages; +with Ocarina.Backends.Messages; use Ocarina.Backends.Messages; with Ocarina.Backends.Utils; @@ -62,51 +62,49 @@ package body Ocarina.Backends.PN.Components is package OAV renames Ocarina.AADL_Values; procedure PN_Process_Final_System - (PN_Generated : Node_Id; - PN_P_Init_Proc : PN_Init_Node; - PN_P_New_Proc : PN_New_Node; - PN_A_Init_Proc : PN_Init_Arc; - PN_A_New_Proc : PN_New_Node; + (PN_Generated : Node_Id; + PN_P_Init_Proc : PN_Init_Node; + PN_P_New_Proc : PN_New_Node; + PN_A_Init_Proc : PN_Init_Arc; + PN_A_New_Proc : PN_New_Node; PN_Dup_Arc_Proc : PN_Dup_Arc); function Process_Component_Instance - (Instance : Types.Node_Id; - PN_Generated : Types.Node_Id) - return Boolean; + (Instance : Types.Node_Id; + PN_Generated : Types.Node_Id) return Boolean; function Process_Thread_Instance (Aadl_Instance : Types.Node_Id; - PN_Generated : Types.Node_Id) - return Boolean; + PN_Generated : Types.Node_Id) return Boolean; procedure PN_Process_Thread_Pattern - (Aadl_Instance : Types.Node_Id; - PN_Thread : Types.Node_Id; - PN_Generated : Types.Node_Id; + (Aadl_Instance : Types.Node_Id; + PN_Thread : Types.Node_Id; + PN_Generated : Types.Node_Id; PN_P_Init_Proc : PN_Init_Node; - PN_P_New_Proc : PN_New_Node; + PN_P_New_Proc : PN_New_Node; PN_T_Init_Proc : PN_Init_Node; - PN_T_New_Proc : PN_New_Node; + PN_T_New_Proc : PN_New_Node; PN_A_Init_Proc : PN_Init_Arc; - PN_A_New_Proc : PN_New_Node); + PN_A_New_Proc : PN_New_Node); procedure PN_Thread_Skeleton - (Aadl_Instance : Types.Node_Id; - PN_Thread : Types.Node_Id; - PN_Generated : Types.Node_Id; + (Aadl_Instance : Types.Node_Id; + PN_Thread : Types.Node_Id; + PN_Generated : Types.Node_Id; PN_P_Init_Proc : PN_Init_Node; - PN_P_New_Proc : PN_New_Node; + PN_P_New_Proc : PN_New_Node; PN_T_Init_Proc : PN_Init_Node; - PN_T_New_Proc : PN_New_Node; + PN_T_New_Proc : PN_New_Node; PN_A_Init_Proc : PN_Init_Arc; - PN_A_New_Proc : PN_New_Node); + PN_A_New_Proc : PN_New_Node); procedure PN_Build_Spg_Par - (Aadl_Instance : Types.Node_Id; - PN_Generated : Types.Node_Id; - Spg_Feat : Types.Node_Id; - PN_Spg_Call : Types.Node_Id; - In_Par : Boolean := True; + (Aadl_Instance : Types.Node_Id; + PN_Generated : Types.Node_Id; + Spg_Feat : Types.Node_Id; + PN_Spg_Call : Types.Node_Id; + In_Par : Boolean := True; PN_P_Init_Proc : PN_Init_Node; PN_P_New_Proc : PN_New_Node; PN_T_Init_Proc : PN_Init_Node; @@ -114,24 +112,25 @@ package body Ocarina.Backends.PN.Components is PN_A_Init_Proc : PN_Init_Arc; PN_A_New_Proc : PN_New_Node); - procedure PN_Build_Port (Aadl_Instance : Types.Node_Id; - PN_Generated : Types.Node_Id; - PN_Thread : Types.Node_Id; - F : Types.Value_Id); + procedure PN_Build_Port + (Aadl_Instance : Types.Node_Id; + PN_Generated : Types.Node_Id; + PN_Thread : Types.Node_Id; + F : Types.Value_Id); procedure PN_Build_Tpn_Port (Aadl_Instance : Node_Id; PN_Generated : Types.Node_Id; Port_Instance : Node_Id; - PN_Port : Node_Id; - Is_Data : Boolean := True); + PN_Port : Node_Id; + Is_Data : Boolean := True); procedure PN_Build_Cpn_Port (Aadl_Instance : Node_Id; PN_Generated : Types.Node_Id; Port_Instance : Node_Id; - PN_Port : Node_Id; - Is_Data : Boolean := True); + PN_Port : Node_Id; + Is_Data : Boolean := True); ----------------------------------- -- Process_Architecture_Instance -- @@ -139,18 +138,18 @@ package body Ocarina.Backends.PN.Components is function Process_Architecture_Instance (Architecture_Instance : Types.Node_Id; - F : Unsigned_Long_Long) - return Types.Node_Id + F : Unsigned_Long_Long) return Types.Node_Id is use Ocarina.ME_AADL.AADL_Instances.Nodes; use Ocarina.Backends.PN.Iutils; use Ocarina.ME_AADL.AADL_Instances.Nutils; - use Ocarina.Aadl_Values; + use Ocarina.AADL_Values; use Ocarina.Backends.PN.Nodes; - Instance : Node_Id; + Instance : Node_Id; PN_Generated : Node_Id; - Success : Boolean := False; + Success : Boolean := False; + pragma Warnings (Off, Success); -- 0 for CPN, 1 for TPN Formalism : constant Value_Id := New_Integer_Value (F); @@ -163,23 +162,22 @@ package body Ocarina.Backends.PN.Components is -- initialization of the Petri Net top box PN_Generated := PN_Get_New_PN_Generated; - PN_Init_PN_Generated (PN_Generated, - Formalism); + PN_Init_PN_Generated (PN_Generated, Formalism); declare - F : constant Value_Type := Get_Value_Type - (OPN.Formalism (PN_Generated)); + F : constant Value_Type := + Get_Value_Type (OPN.Formalism (PN_Generated)); begin - case F.Ival is + case F.IVal is when 0 => -- CPN Pattern - Set_PN_Formalism_Specific_Informations + Set_Pn_Formalism_Specific_Informations (PN_Generated, PN_Get_New_CPN_Informations); if Instance /= No_Node and then PN_Generated /= No_Node then - Success := Process_Component_Instance (Instance, - PN_Generated); + Success := + Process_Component_Instance (Instance, PN_Generated); -- XXX ? -- if not Success then -- return No_Node; @@ -187,22 +185,23 @@ package body Ocarina.Backends.PN.Components is end if; -- assembly and final processing - PN_Process_Final_System (PN_Generated, - PN_Cpn_Init_Place'Access, - PN_Cpn_Get_New_Place'Access, - PN_Cpn_Init_Arc'Access, - PN_Cpn_Get_New_Arc'Access, - PN_Cpn_Duplicate_Arc'Access); + PN_Process_Final_System + (PN_Generated, + PN_CPN_Init_Place'Access, + PN_CPN_Get_New_Place'Access, + PN_CPN_Init_Arc'Access, + PN_CPN_Get_New_Arc'Access, + PN_CPN_Duplicate_Arc'Access); when 1 => -- TPN Pattern -- set specific informations - Set_PN_Formalism_Specific_Informations + Set_Pn_Formalism_Specific_Informations (PN_Generated, PN_Get_New_TPN_Informations); if Instance /= No_Node and then PN_Generated /= No_Node then - Success := Process_Component_Instance (Instance, - PN_Generated); + Success := + Process_Component_Instance (Instance, PN_Generated); -- XXX ? -- if not Success then -- return No_Node; @@ -210,12 +209,13 @@ package body Ocarina.Backends.PN.Components is end if; -- assembly and final processing - PN_Process_Final_System (PN_Generated, - PN_Tpn_Init_Place'Access, - PN_Tpn_Get_New_Place'Access, - PN_Tpn_Init_Arc'Access, - PN_Tpn_Get_New_Arc'Access, - PN_Tpn_Duplicate_Arc'Access); + PN_Process_Final_System + (PN_Generated, + PN_TPN_Init_Place'Access, + PN_TPN_Get_New_Place'Access, + PN_TPN_Init_Arc'Access, + PN_TPN_Get_New_Arc'Access, + PN_TPN_Duplicate_Arc'Access); when others => null; end case; @@ -229,11 +229,11 @@ package body Ocarina.Backends.PN.Components is ------------------------------- procedure PN_Process_Final_System - (PN_Generated : Node_Id; - PN_P_Init_Proc : PN_Init_Node; - PN_P_New_Proc : PN_New_Node; - PN_A_Init_Proc : PN_Init_Arc; - PN_A_New_Proc : PN_New_Node; + (PN_Generated : Node_Id; + PN_P_Init_Proc : PN_Init_Node; + PN_P_New_Proc : PN_New_Node; + PN_A_Init_Proc : PN_Init_Arc; + PN_A_New_Proc : PN_New_Node; PN_Dup_Arc_Proc : PN_Dup_Arc) is @@ -241,7 +241,7 @@ package body Ocarina.Backends.PN.Components is use Ocarina.Backends.PN.Nutils; use Namet; use Ocarina.Backends.Properties; - use Ocarina.Aadl_Values; + use Ocarina.AADL_Values; use Ocarina.Backends.PN.Iutils; use Ocarina.Backends.Utils; @@ -251,9 +251,7 @@ package body Ocarina.Backends.PN.Components is Thread_Iter : Node_Id; begin - Thread_Iter := OPN.First_Node - (PN_Subcomponents - (PN_Box (PN_Generated))); + Thread_Iter := OPN.First_Node (Pn_Subcomponents (Pn_Box (PN_Generated))); -- run across subcomponents while Present (Thread_Iter) loop @@ -261,59 +259,59 @@ package body Ocarina.Backends.PN.Components is if OPN.Kind (Thread_Iter) = K_Thread_Pattern then -- run across threads - if OPN.Kind (PN_Formalism_Specific_Informations (PN_Generated)) - = K_TPN_Specific_Informations then + if OPN.Kind (Pn_Formalism_Specific_Informations (PN_Generated)) = + K_TPN_Specific_Informations + then -- manage processor declare - PN_Proc : Node_Id; - Aadl_Proc : constant Node_Id - := Get_Bound_Processor (AIN.Corresponding_Instance - (Get_Container_Process - (Th_Instance - (Thread_Iter)))); + PN_Proc : Node_Id; + Aadl_Proc : constant Node_Id := + Get_Bound_Processor + (AIN.Corresponding_Instance + (Get_Container_Process (Th_Instance (Thread_Iter)))); Proc_Prio_Node : Node_Id; begin if Aadl_Proc /= No_Node then - PN_Proc := Get_Handling (Aadl_Proc, - By_Node, - H_PN_Proc_Creation); + PN_Proc := + Get_Handling (Aadl_Proc, By_Node, H_PN_Proc_Creation); if PN_Proc = No_Node then -- create processor PN_Proc := PN_Get_New_Processor_Pattern; - PN_Init_Processor_Pattern (PN_Proc, - Aadl_Proc); + PN_Init_Processor_Pattern (PN_Proc, Aadl_Proc); -- add place in component declare P_Proc : Node_Id; begin - P_Proc := PN_Tpn_Get_New_Place; - PN_Tpn_Init_Place (P_Proc, - Aadl_Proc, - Get_String_Name ("_Processor"), - PN_Generated, - 0); - - Set_Tokens_Number (P_Proc, - New_Integer_Value (1)); + P_Proc := PN_TPN_Get_New_Place; + PN_TPN_Init_Place + (P_Proc, + Aadl_Proc, + Get_String_Name ("_Processor"), + PN_Generated, + 0); + + Set_Tokens_Number (P_Proc, New_Integer_Value (1)); -- add place into component - Append_Node_To_List (P_Proc, - Internal_Places (PN_Proc)); + Append_Node_To_List + (P_Proc, + Internal_Places (PN_Proc)); end; - Set_Handling (Aadl_Proc, - By_Node, - H_PN_Proc_Creation, - PN_Proc); + Set_Handling + (Aadl_Proc, + By_Node, + H_PN_Proc_Creation, + PN_Proc); -- add processor into components list - Append_Node_To_List (PN_Proc, - PN_Subcomponents - (PN_Box (PN_Generated))); + Append_Node_To_List + (PN_Proc, + Pn_Subcomponents (Pn_Box (PN_Generated))); end if; -- here we have the processor component @@ -321,24 +319,26 @@ package body Ocarina.Backends.PN.Components is -- first, find dedicated entry in tpn_info to update -- priorities - if Is_Empty (Priorities - (PN_Formalism_Specific_Informations - (PN_Generated))) then + if Is_Empty + (Priorities + (Pn_Formalism_Specific_Informations + (PN_Generated))) + then -- first entry in the list Proc_Prio_Node := PN_Get_New_Processor_Priority; - PN_Init_Processor_Priority (Proc_Prio_Node, - Aadl_Proc); + PN_Init_Processor_Priority (Proc_Prio_Node, Aadl_Proc); Append_Node_To_List (Proc_Prio_Node, Priorities - (PN_Formalism_Specific_Informations - (PN_Generated))); + (Pn_Formalism_Specific_Informations + (PN_Generated))); else -- find it - Proc_Prio_Node := OPN.First_Node - (Priorities - (PN_Formalism_Specific_Informations - (PN_Generated))); + Proc_Prio_Node := + OPN.First_Node + (Priorities + (Pn_Formalism_Specific_Informations + (PN_Generated))); while Present (Proc_Prio_Node) loop if P_Instance (Proc_Prio_Node) = Aadl_Proc then -- leave loop @@ -354,109 +354,112 @@ package body Ocarina.Backends.PN.Components is if not Is_Empty (Call_Seq (Thread_Iter)) then declare Cs_Iter, Spg_Iter, Trans_Iter : Node_Id; - P_Proc : constant Node_Id := + P_Proc : constant Node_Id := OPN.First_Node (Internal_Places (PN_Proc)); begin Cs_Iter := OPN.First_Node (Call_Seq (Thread_Iter)); while Present (Cs_Iter) loop if not Is_Empty (Spg_Call (Cs_Iter)) then - Spg_Iter := OPN.First_Node - (Spg_Call (Cs_Iter)); + Spg_Iter := + OPN.First_Node (Spg_Call (Cs_Iter)); while Present (Spg_Iter) loop -- take processor at begin -- leave it at preemp1 -- take it again at preemp2 -- leave it at end - Trans_Iter := OPN.First_Node - (Public_Interfaces (Spg_Iter)); + Trans_Iter := + OPN.First_Node + (Public_Interfaces (Spg_Iter)); declare New_Arc : Node_Id; begin New_Arc := PN_A_New_Proc.all; - PN_A_Init_Proc (New_Arc, - Th_Instance - (Thread_Iter), - P_Proc, - Trans_Iter, - 0); + PN_A_Init_Proc + (New_Arc, + Th_Instance (Thread_Iter), + P_Proc, + Trans_Iter, + 0); Append_Node_To_List (New_Arc, - PN_Arcs_In (Trans_Iter)); + Pn_Arcs_In (Trans_Iter)); end; -- since it is begin, -- its priority needs to be -- recorded - Set_Priority (Trans_Iter, - New_Integer_Value - (Get_Thread_Priority - (Th_Instance - (Thread_Iter)))); - Append_Trans_To_Processor (Trans_Iter, - Proc_Prio_Node); + Set_Priority + (Trans_Iter, + New_Integer_Value + (Get_Thread_Priority + (Th_Instance (Thread_Iter)))); + Append_Trans_To_Processor + (Trans_Iter, + Proc_Prio_Node); ----- Trans_Iter := OPN.Next_Node (Trans_Iter); declare New_Arc : Node_Id; begin New_Arc := PN_A_New_Proc.all; - PN_A_Init_Proc (New_Arc, - Th_Instance - (Thread_Iter), - Trans_Iter, - P_Proc, - 0); + PN_A_Init_Proc + (New_Arc, + Th_Instance (Thread_Iter), + Trans_Iter, + P_Proc, + 0); Append_Node_To_List (New_Arc, - PN_Arcs_Out (Trans_Iter)); + Pn_Arcs_Out (Trans_Iter)); end; -- handle context switch - Trans_Iter := OPN.First_Node - (Internal_Transitions - (Spg_Iter)); + Trans_Iter := + OPN.First_Node + (Internal_Transitions (Spg_Iter)); declare New_Arc : Node_Id; begin New_Arc := PN_A_New_Proc.all; - PN_A_Init_Proc (New_Arc, - Th_Instance - (Thread_Iter), - Trans_Iter, - P_Proc, - 0); + PN_A_Init_Proc + (New_Arc, + Th_Instance (Thread_Iter), + Trans_Iter, + P_Proc, + 0); Append_Node_To_List (New_Arc, - PN_Arcs_Out (Trans_Iter)); + Pn_Arcs_Out (Trans_Iter)); end; -- since it is preemp1, its priority needs -- to be recorded - Set_Priority (Trans_Iter, - New_Integer_Value - (Get_Thread_Priority - (Th_Instance - (Thread_Iter)))); - Append_Trans_To_Processor (Trans_Iter, - Proc_Prio_Node); + Set_Priority + (Trans_Iter, + New_Integer_Value + (Get_Thread_Priority + (Th_Instance (Thread_Iter)))); + Append_Trans_To_Processor + (Trans_Iter, + Proc_Prio_Node); ----- Trans_Iter := OPN.Next_Node (Trans_Iter); declare New_Arc : Node_Id; begin New_Arc := PN_A_New_Proc.all; - PN_A_Init_Proc (New_Arc, - Th_Instance - (Thread_Iter), - P_Proc, - Trans_Iter, - 0); + PN_A_Init_Proc + (New_Arc, + Th_Instance (Thread_Iter), + P_Proc, + Trans_Iter, + 0); Append_Node_To_List (New_Arc, - PN_Arcs_In (Trans_Iter)); + Pn_Arcs_In (Trans_Iter)); end; -- next @@ -473,22 +476,23 @@ package body Ocarina.Backends.PN.Components is end; end if; -- tpn for processors - if OPN.Kind (PN_Formalism_Specific_Informations (PN_Generated)) - = K_TPN_Specific_Informations then + if OPN.Kind (Pn_Formalism_Specific_Informations (PN_Generated)) = + K_TPN_Specific_Informations + then -- TPN -- set hyperperiod - Set_Hyperperiod (Thread_Iter, - Hyperperiod - (PN_Formalism_Specific_Informations - (PN_Generated))); + Set_Hyperperiod + (Thread_Iter, + Hyperperiod + (Pn_Formalism_Specific_Informations (PN_Generated))); -- set hyperperiod values to hyperperiod place declare Node_Iter : Node_Id; begin if not Is_Empty (Internal_Places (Thread_Iter)) then - Node_Iter := OPN.First_Node - (Internal_Places (Thread_Iter)); + Node_Iter := + OPN.First_Node (Internal_Places (Thread_Iter)); while Present (Node_Iter) loop declare @@ -496,25 +500,27 @@ package body Ocarina.Backends.PN.Components is Get_Name_String (Name (Identifier (Node_Iter))); Token_Nb : Unsigned_Long_Long; Hyper_Th : Value_Type; - Time_Th : Time_Type; + Time_Th : Time_Type; begin if S (S'Last - 10 .. S'Last) = "Hyperperiod" then if Get_Thread_Dispatch_Protocol - (Th_Instance (Thread_Iter)) = Thread_Periodic + (Th_Instance (Thread_Iter)) = + Thread_Periodic or else - Get_Thread_Dispatch_Protocol - (Th_Instance (Thread_Iter)) = Thread_Sporadic + Get_Thread_Dispatch_Protocol + (Th_Instance (Thread_Iter)) = + Thread_Sporadic then - Time_Th := Get_Thread_Period - (Th_Instance (Thread_Iter)); - Hyper_Th := Get_Value_Type - (Hyperperiod (Thread_Iter)); - Token_Nb := - Hyper_Th.Ival / Time_Th.T; - - Set_Tokens_Number (Node_Iter, - New_Integer_Value - (Token_Nb)); + Time_Th := + Get_Thread_Period + (Th_Instance (Thread_Iter)); + Hyper_Th := + Get_Value_Type (Hyperperiod (Thread_Iter)); + Token_Nb := Hyper_Th.IVal / Time_Th.T; + + Set_Tokens_Number + (Node_Iter, + New_Integer_Value (Token_Nb)); end if; end if; end; @@ -527,9 +533,9 @@ package body Ocarina.Backends.PN.Components is -- COMMON PART -- manage call sequences - if Get_Thread_Implementation_Kind - (Th_Instance (Thread_Iter)) - = Thread_With_Call_Sequence then + if Get_Thread_Implementation_Kind (Th_Instance (Thread_Iter)) = + Thread_With_Call_Sequence + then -- manage port's pop / in param fusion declare @@ -543,8 +549,8 @@ package body Ocarina.Backends.PN.Components is Spg_Iter := OPN.First_Node (Spg_Call (Cs_Iter)); while Present (Spg_Iter) loop -- run across CS's Spg - Beg_Node := OPN.First_Node (Public_Interfaces - (Spg_Iter)); + Beg_Node := + OPN.First_Node (Public_Interfaces (Spg_Iter)); if not Is_Empty (Param_In (Spg_Iter)) then Param_Iter := OPN.First_Node (Param_In (Spg_Iter)); @@ -556,20 +562,24 @@ package body Ocarina.Backends.PN.Components is Port_Iter : Node_Id; begin if not Is_Empty (In_Ports (Thread_Iter)) then - Port_Iter := OPN.First_Node - (In_Ports (Thread_Iter)); + Port_Iter := + OPN.First_Node (In_Ports (Thread_Iter)); while Present (Port_Iter) loop -- run across in ports if not Is_Empty - (Public_Interfaces (Port_Iter)) then - Pop_Node := OPN.Next_Node - (OPN.First_Node (Public_Interfaces - (Port_Iter))); + (Public_Interfaces (Port_Iter)) + then + Pop_Node := + OPN.Next_Node + (OPN.First_Node + (Public_Interfaces + (Port_Iter))); if Port_Instance (Port_Iter) = - Par_Instance (Param_Iter) then + Par_Instance (Param_Iter) + then -- match -- update arcs to -- delete port's pop @@ -577,46 +587,49 @@ package body Ocarina.Backends.PN.Components is Arc_Iter : Node_Id; begin -- look at in arcs - Arc_Iter := OPN.First_Node - (PN_Arcs_In (Pop_Node)); + Arc_Iter := + OPN.First_Node + (Pn_Arcs_In (Pop_Node)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all (Arc_Iter, Th_Instance - (Thread_Iter), + (Thread_Iter), Beg_Node, False); -- next - Arc_Iter := OPN.Next_Node - (Arc_Iter); + Arc_Iter := + OPN.Next_Node (Arc_Iter); end loop; -- look at out arcs - Arc_Iter := OPN.First_Node - (PN_Arcs_Out (Pop_Node)); + Arc_Iter := + OPN.First_Node + (Pn_Arcs_Out (Pop_Node)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all (Arc_Iter, Th_Instance - (Thread_Iter), + (Thread_Iter), Beg_Node, True); - Arc_Iter := OPN.Next_Node - (Arc_Iter); + Arc_Iter := + OPN.Next_Node (Arc_Iter); end loop; end; -- record where is -- pop interface now -- by_node cause -- name could fail... - Set_Handling (Port_Iter, - By_Node, - H_PN_Port_Creation, - Beg_Node); + Set_Handling + (Port_Iter, + By_Node, + H_PN_Port_Creation, + Beg_Node); -- delete pop Node Delete_Node_From_List @@ -659,8 +672,9 @@ package body Ocarina.Backends.PN.Components is Spg_Iter := OPN.First_Node (Spg_Call (Cs_Iter)); while Present (Spg_Iter) loop -- run across CS's Spg - End_Node := OPN.Next_Node - (OPN.First_Node (Public_Interfaces (Spg_Iter))); + End_Node := + OPN.Next_Node + (OPN.First_Node (Public_Interfaces (Spg_Iter))); if not Is_Empty (Param_Out (Spg_Iter)) then Param_Iter := OPN.First_Node (Param_Out (Spg_Iter)); @@ -672,17 +686,19 @@ package body Ocarina.Backends.PN.Components is Port_Iter : Node_Id; begin if not Is_Empty (Out_Ports (Thread_Iter)) then - Port_Iter := OPN.First_Node - (Out_Ports (Thread_Iter)); + Port_Iter := + OPN.First_Node (Out_Ports (Thread_Iter)); while Present (Port_Iter) loop -- run across in ports - Push_Node := OPN.First_Node - (Public_Interfaces (Port_Iter)); + Push_Node := + OPN.First_Node + (Public_Interfaces (Port_Iter)); if Push_Node /= No_Node then if Port_Instance (Port_Iter) = - Par_Instance (Param_Iter) then + Par_Instance (Param_Iter) + then -- match -- update arcs to -- delete port's pop @@ -690,44 +706,47 @@ package body Ocarina.Backends.PN.Components is Arc_Iter : Node_Id; begin -- look at in arcs - Arc_Iter := OPN.First_Node - (PN_Arcs_In (Push_Node)); + Arc_Iter := + OPN.First_Node + (Pn_Arcs_In (Push_Node)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all (Arc_Iter, Th_Instance - (Thread_Iter), + (Thread_Iter), End_Node, False); -- next - Arc_Iter := OPN.Next_Node - (Arc_Iter); + Arc_Iter := + OPN.Next_Node (Arc_Iter); end loop; -- look at out arcs - Arc_Iter := OPN.First_Node - (PN_Arcs_Out (Push_Node)); + Arc_Iter := + OPN.First_Node + (Pn_Arcs_Out (Push_Node)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all (Arc_Iter, Th_Instance - (Thread_Iter), + (Thread_Iter), End_Node, True); - Arc_Iter := OPN.Next_Node - (Arc_Iter); + Arc_Iter := + OPN.Next_Node (Arc_Iter); end loop; end; -- record where is -- push interface now -- by_node cause name -- could fail... - if OPN.Next_Node (Spg_Iter) - /= No_Node then + if OPN.Next_Node (Spg_Iter) /= + No_Node + then -- push = next (begin node) -- since end will be deleted Set_Handling @@ -735,9 +754,9 @@ package body Ocarina.Backends.PN.Components is By_Node, H_PN_Port_Creation, OPN.First_Node - (Public_Interfaces - (OPN.Next_Node - (Spg_Iter)))); + (Public_Interfaces + (OPN.Next_Node + (Spg_Iter)))); else -- push = end node -- (last spg, no @@ -780,27 +799,29 @@ package body Ocarina.Backends.PN.Components is -- manage CS steps fusion (end, begin (next) ) declare Cs_Iter, Spg_Iter, Spg_Next_Iter : Node_Id; - End_Node, Begin_Next_Node : Node_Id; + End_Node, Begin_Next_Node : Node_Id; begin Cs_Iter := OPN.First_Node (Call_Seq (Thread_Iter)); while Present (Cs_Iter) loop -- run across CS Spg_Iter := OPN.First_Node (Spg_Call (Cs_Iter)); while Present (Spg_Iter) - and then Present (OPN.Next_Node (Spg_Iter)) loop + and then Present (OPN.Next_Node (Spg_Iter)) + loop -- run across CS's Spg Spg_Next_Iter := OPN.Next_Node (Spg_Iter); - End_Node := OPN.Next_Node - (OPN.First_Node (Public_Interfaces (Spg_Iter))); - Begin_Next_Node := OPN.First_Node (Public_Interfaces - (Spg_Next_Iter)); + End_Node := + OPN.Next_Node + (OPN.First_Node (Public_Interfaces (Spg_Iter))); + Begin_Next_Node := + OPN.First_Node (Public_Interfaces (Spg_Next_Iter)); -- update arcs to delete spg's "end_node" declare Arc_Iter : Node_Id; begin -- look at in arcs - Arc_Iter := OPN.First_Node (PN_Arcs_In (End_Node)); + Arc_Iter := OPN.First_Node (Pn_Arcs_In (End_Node)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all @@ -814,7 +835,7 @@ package body Ocarina.Backends.PN.Components is end loop; -- look at out arcs - Arc_Iter := OPN.First_Node (PN_Arcs_Out (End_Node)); + Arc_Iter := OPN.First_Node (Pn_Arcs_Out (End_Node)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all @@ -828,8 +849,9 @@ package body Ocarina.Backends.PN.Components is end loop; end; -- delete end_node - Delete_Node_From_List (End_Node, - Public_Interfaces (Spg_Iter)); + Delete_Node_From_List + (End_Node, + Public_Interfaces (Spg_Iter)); -- next Spg_Iter := OPN.Next_Node (Spg_Iter); @@ -845,16 +867,17 @@ package body Ocarina.Backends.PN.Components is -- here, we have compact compute box -- manage dispatch - if Get_Thread_Dispatch_Protocol - (Th_Instance (Thread_Iter)) = Thread_Aperiodic + if Get_Thread_Dispatch_Protocol (Th_Instance (Thread_Iter)) = + Thread_Aperiodic or else - Get_Thread_Dispatch_Protocol - (Th_Instance (Thread_Iter)) = Thread_Sporadic then + Get_Thread_Dispatch_Protocol (Th_Instance (Thread_Iter)) = + Thread_Sporadic + then declare Wait_Node : Node_Id; Port_Iter : Node_Id; - Pop_Node : Node_Id; + Pop_Node : Node_Id; begin -- connect wait_dispatch to each port's pop interface -- since any port could trigger the dispatch @@ -862,19 +885,23 @@ package body Ocarina.Backends.PN.Components is if not Is_Empty (In_Ports (Thread_Iter)) then Port_Iter := OPN.First_Node (In_Ports (Thread_Iter)); - Wait_Node := OPN.Next_Node (First_Node (Internal_Places - (Thread_Iter))); + Wait_Node := + OPN.Next_Node + (First_Node (Internal_Places (Thread_Iter))); while Present (Port_Iter) loop -- run across in ports - Pop_Node := Get_Handling (Port_Iter, - By_Node, - H_PN_Port_Creation); + Pop_Node := + Get_Handling + (Port_Iter, + By_Node, + H_PN_Port_Creation); if Pop_Node = No_Node then -- this port have not been merged into a param - Pop_Node := OPN.Next_Node (OPN.First_Node - (Public_Interfaces - (Port_Iter))); + Pop_Node := + OPN.Next_Node + (OPN.First_Node + (Public_Interfaces (Port_Iter))); end if; -- here, we have the port's pop interface @@ -882,15 +909,16 @@ package body Ocarina.Backends.PN.Components is New_Arc : Node_Id; begin New_Arc := PN_A_New_Proc.all; - PN_A_Init_Proc (New_Arc, - Th_Instance (Thread_Iter), - Wait_Node, - Pop_Node, - 1); - - Append_Node_To_List (New_Arc, - PN_Arcs_In - (Pop_Node)); + PN_A_Init_Proc + (New_Arc, + Th_Instance (Thread_Iter), + Wait_Node, + Pop_Node, + 1); + + Append_Node_To_List + (New_Arc, + Pn_Arcs_In (Pop_Node)); end; -- next @@ -903,35 +931,37 @@ package body Ocarina.Backends.PN.Components is -- manage clock for periodic or sporadic - if Get_Thread_Dispatch_Protocol - (Th_Instance (Thread_Iter)) = Thread_Periodic then + if Get_Thread_Dispatch_Protocol (Th_Instance (Thread_Iter)) = + Thread_Periodic + then -- manage periodic declare - Beg_Node : Node_Id := No_Node; - Wait_Node : Node_Id; + Beg_Node : Node_Id := No_Node; + Wait_Node : Node_Id; Clock_Node : Node_Id; - Node_Iter : Node_Id; + Node_Iter : Node_Id; begin -- connect wait_dispatch to first call sequence -- first, find wait node - Wait_Node := OPN.Next_Node (First_Node (Internal_Places - (Thread_Iter))); + Wait_Node := + OPN.Next_Node (First_Node (Internal_Places (Thread_Iter))); -- find clock place if not Is_Empty (Internal_Places (Thread_Iter)) then - if OPN.Kind (PN_Formalism_Specific_Informations - (PN_Generated)) - = K_TPN_Specific_Informations then + if OPN.Kind + (Pn_Formalism_Specific_Informations (PN_Generated)) = + K_TPN_Specific_Informations + then - Node_Iter := OPN.First_Node - (Internal_Places (Thread_Iter)); + Node_Iter := + OPN.First_Node (Internal_Places (Thread_Iter)); while Present (Node_Iter) loop declare S : constant String := - Get_Name_String (Name - (Identifier (Node_Iter))); + Get_Name_String + (Name (Identifier (Node_Iter))); begin if S (S'Last - 4 .. S'Last) = "Clock" then Clock_Node := Node_Iter; @@ -946,17 +976,14 @@ package body Ocarina.Backends.PN.Components is -- find begin_node if not Is_Empty (Call_Seq (Thread_Iter)) then - Node_Iter := OPN.First_Node (Call_Seq - (Thread_Iter)); + Node_Iter := OPN.First_Node (Call_Seq (Thread_Iter)); if not Is_Empty (Spg_Call (Node_Iter)) then - Node_Iter := OPN.First_Node (Spg_Call - (Node_Iter)); - if not Is_Empty (Public_Interfaces - (Node_Iter)) then + Node_Iter := OPN.First_Node (Spg_Call (Node_Iter)); + if not Is_Empty (Public_Interfaces (Node_Iter)) then - Beg_Node := OPN.First_Node (Public_Interfaces - (Node_Iter)); + Beg_Node := + OPN.First_Node (Public_Interfaces (Node_Iter)); end if; end if; @@ -964,21 +991,25 @@ package body Ocarina.Backends.PN.Components is -- add new arc for clock if Present (Beg_Node) - and then OPN.Kind (PN_Formalism_Specific_Informations - (PN_Generated)) - = K_TPN_Specific_Informations + and then + OPN.Kind + (Pn_Formalism_Specific_Informations + (PN_Generated)) = + K_TPN_Specific_Informations then declare New_Arc : Node_Id; begin - New_Arc := PN_Tpn_Get_New_Arc; - PN_Tpn_Init_Arc (New_Arc, - Th_Instance (Thread_Iter), - Clock_Node, - Beg_Node, - 0); - Append_Node_To_List (New_Arc, - PN_Arcs_In (Beg_Node)); + New_Arc := PN_TPN_Get_New_Arc; + PN_TPN_Init_Arc + (New_Arc, + Th_Instance (Thread_Iter), + Clock_Node, + Beg_Node, + 0); + Append_Node_To_List + (New_Arc, + Pn_Arcs_In (Beg_Node)); end; end if; @@ -988,14 +1019,16 @@ package body Ocarina.Backends.PN.Components is New_Arc : Node_Id; begin New_Arc := PN_A_New_Proc.all; - PN_A_Init_Proc (New_Arc, - Th_Instance (Thread_Iter), - Wait_Node, - Beg_Node, - 1); - - Append_Node_To_List (New_Arc, - PN_Arcs_In (Beg_Node)); + PN_A_Init_Proc + (New_Arc, + Th_Instance (Thread_Iter), + Wait_Node, + Beg_Node, + 1); + + Append_Node_To_List + (New_Arc, + Pn_Arcs_In (Beg_Node)); end; end if; -- thread internal places for clock end if; @@ -1003,27 +1036,29 @@ package body Ocarina.Backends.PN.Components is end if; -- periodic thread clock -- sporadic thread clock - if Get_Thread_Dispatch_Protocol - (Th_Instance (Thread_Iter)) = Thread_Sporadic then + if Get_Thread_Dispatch_Protocol (Th_Instance (Thread_Iter)) = + Thread_Sporadic + then -- manage sporadic declare Clock_Node : Node_Id; - Node_Iter : Node_Id; + Node_Iter : Node_Id; begin -- find clock place if not Is_Empty (Internal_Places (Thread_Iter)) then - if OPN.Kind (PN_Formalism_Specific_Informations - (PN_Generated)) - = K_TPN_Specific_Informations then + if OPN.Kind + (Pn_Formalism_Specific_Informations (PN_Generated)) = + K_TPN_Specific_Informations + then - Node_Iter := OPN.First_Node - (Internal_Places (Thread_Iter)); + Node_Iter := + OPN.First_Node (Internal_Places (Thread_Iter)); while Present (Node_Iter) loop declare S : constant String := - Get_Name_String (Name (Identifier - (Node_Iter))); + Get_Name_String + (Name (Identifier (Node_Iter))); begin if S (S'Last - 4 .. S'Last) = "Clock" then Clock_Node := Node_Iter; @@ -1035,41 +1070,45 @@ package body Ocarina.Backends.PN.Components is declare Port_Iter : Node_Id; - Pop_Node : Node_Id; + Pop_Node : Node_Id; begin -- connect clock to each port's pop interface -- since any port could trigger the dispatch if not Is_Empty (In_Ports (Thread_Iter)) then - Port_Iter := OPN.First_Node - (In_Ports (Thread_Iter)); + Port_Iter := + OPN.First_Node (In_Ports (Thread_Iter)); while Present (Port_Iter) loop -- run across in ports - Pop_Node := Get_Handling (Port_Iter, - By_Node, - H_PN_Port_Creation); + Pop_Node := + Get_Handling + (Port_Iter, + By_Node, + H_PN_Port_Creation); if Pop_Node = No_Node then -- this port have not been merged -- into a param - Pop_Node := OPN.Next_Node - (OPN.First_Node - (Public_Interfaces (Port_Iter))); + Pop_Node := + OPN.Next_Node + (OPN.First_Node + (Public_Interfaces (Port_Iter))); end if; -- here, we have the port's pop interface declare New_Arc : Node_Id; begin - New_Arc := PN_Tpn_Get_New_Arc; - PN_Tpn_Init_Arc (New_Arc, - Th_Instance (Thread_Iter), - Clock_Node, - Pop_Node, - 0); + New_Arc := PN_TPN_Get_New_Arc; + PN_TPN_Init_Arc + (New_Arc, + Th_Instance (Thread_Iter), + Clock_Node, + Pop_Node, + 0); Append_Node_To_List (New_Arc, - PN_Arcs_In (Pop_Node)); + Pn_Arcs_In (Pop_Node)); end; -- next @@ -1085,9 +1124,9 @@ package body Ocarina.Backends.PN.Components is -- delete _compute trans from public interfaces of thread -- it is now useless - Delete_Node_From_List (OPN.First_Node (Public_Interfaces - (Thread_Iter)), - Public_Interfaces (Thread_Iter)); + Delete_Node_From_List + (OPN.First_Node (Public_Interfaces (Thread_Iter)), + Public_Interfaces (Thread_Iter)); -- now, _complete is the first node of public_interfaces @@ -1098,9 +1137,9 @@ package body Ocarina.Backends.PN.Components is -- a second loop will be necessary (through in ports) to connect -- to in ports declare - Port_Iter : Node_Id; + Port_Iter : Node_Id; Interconnection_Node : Types.Node_Id; - Pop_Node : Node_Id; + Pop_Node : Node_Id; begin if not Is_Empty (Out_Ports (Thread_Iter)) then Port_Iter := OPN.First_Node (Out_Ports (Thread_Iter)); @@ -1108,79 +1147,90 @@ package body Ocarina.Backends.PN.Components is while Present (Port_Iter) loop -- create new node Interconnection_Node := PN_P_New_Proc.all; - PN_P_Init_Proc (Interconnection_Node, - Port_Instance (Port_Iter), - Get_String_Name ("_Bus"), - PN_Generated, - 0); + PN_P_Init_Proc + (Interconnection_Node, + Port_Instance (Port_Iter), + Get_String_Name ("_Bus"), + PN_Generated, + 0); -- set handling to the target port instance -- for next loop - Set_Handling (Interconnection_Node, - By_Node, - H_PN_Port_Creation, - Target_Instance (Port_Iter)); + Set_Handling + (Interconnection_Node, + By_Node, + H_PN_Port_Creation, + Target_Instance (Port_Iter)); -- add place to pn_box - Append_Node_To_List (Interconnection_Node, - PN_Interconnections - (PN_Box (PN_Generated))); + Append_Node_To_List + (Interconnection_Node, + Pn_Interconnections (Pn_Box (PN_Generated))); -- find pop's interface - if Get_Handling (Port_Iter, - By_Node, - H_PN_Port_Creation) /= No_Node then + if Get_Handling + (Port_Iter, + By_Node, + H_PN_Port_Creation) /= + No_Node + then -- this port have been merged into a param - Pop_Node := OPN.First_Node - (Public_Interfaces (Port_Iter)); + Pop_Node := + OPN.First_Node (Public_Interfaces (Port_Iter)); -- CPN specific -- set handling to the source port push -- for next loop - Set_Handling (Interconnection_Node, - By_Node, - H_PN_Interconnection, - Get_Handling (Port_Iter, - By_Node, - H_PN_Port_Creation)); - -- end CPN specific + Set_Handling + (Interconnection_Node, + By_Node, + H_PN_Interconnection, + Get_Handling + (Port_Iter, + By_Node, + H_PN_Port_Creation)); + -- end CPN specific else -- still two interfaces - Pop_Node := OPN.Next_Node (OPN.First_Node - (Public_Interfaces - (Port_Iter))); + Pop_Node := + OPN.Next_Node + (OPN.First_Node (Public_Interfaces (Port_Iter))); -- CPN specific -- set handling to the source port push -- for next loop - Set_Handling (Interconnection_Node, - By_Node, - H_PN_Interconnection, - OPN.First_Node (Public_Interfaces - (Port_Iter))); + Set_Handling + (Interconnection_Node, + By_Node, + H_PN_Interconnection, + OPN.First_Node (Public_Interfaces (Port_Iter))); -- end CPN specific end if; -- create arc - if OPN.Kind (PN_Formalism_Specific_Informations - (PN_Generated)) - = K_TPN_Specific_Informations then + if OPN.Kind + (Pn_Formalism_Specific_Informations (PN_Generated)) = + K_TPN_Specific_Informations + then declare New_Arc : Node_Id; begin New_Arc := PN_A_New_Proc.all; - PN_A_Init_Proc (New_Arc, - Th_Instance (Thread_Iter), - Pop_Node, - Interconnection_Node, - 2); - - Append_Node_To_List (New_Arc, - PN_Arcs_Out (Pop_Node)); + PN_A_Init_Proc + (New_Arc, + Th_Instance (Thread_Iter), + Pop_Node, + Interconnection_Node, + 2); + + Append_Node_To_List + (New_Arc, + Pn_Arcs_Out (Pop_Node)); end; else -- delete Pop - Delete_Node_From_List (Pop_Node, - Public_Interfaces (Port_Iter)); + Delete_Node_From_List + (Pop_Node, + Public_Interfaces (Port_Iter)); end if; -- next @@ -1194,20 +1244,21 @@ package body Ocarina.Backends.PN.Components is -- and then delete complete transition declare - Complete_Node : Node_Id; - Wait_Node : Node_Id; + Complete_Node : Node_Id; + Wait_Node : Node_Id; Cs_Iter, Spg_Iter : Node_Id; - End_Node : Node_Id; + End_Node : Node_Id; begin -- find wait_node - Wait_Node := OPN.Next_Node (OPN.First_Node (Internal_Places - (Thread_Iter))); + Wait_Node := + OPN.Next_Node + (OPN.First_Node (Internal_Places (Thread_Iter))); -- find complete node -- since we already have deleted compute_trans -- complete_trans is first node of public_interface - Complete_Node := OPN.First_Node (Public_Interfaces - (Thread_Iter)); + Complete_Node := + OPN.First_Node (Public_Interfaces (Thread_Iter)); if not Is_Empty (Call_Seq (Thread_Iter)) then Cs_Iter := OPN.First_Node (Call_Seq (Thread_Iter)); @@ -1219,22 +1270,24 @@ package body Ocarina.Backends.PN.Components is Spg_Iter := OPN.Last_Node (Spg_Call (Cs_Iter)); -- end node is last public interface of spg call if not Is_Empty (Public_Interfaces (Spg_Iter)) then - End_Node := OPN.Last_Node (Public_Interfaces - (Spg_Iter)); + End_Node := + OPN.Last_Node (Public_Interfaces (Spg_Iter)); -- make connection declare New_Arc : Node_Id; begin New_Arc := PN_A_New_Proc.all; - PN_A_Init_Proc (New_Arc, - Th_Instance (Thread_Iter), - End_Node, - Wait_Node, - 1); - - Append_Node_To_List (New_Arc, - PN_Arcs_Out (End_Node)); + PN_A_Init_Proc + (New_Arc, + Th_Instance (Thread_Iter), + End_Node, + Wait_Node, + 1); + + Append_Node_To_List + (New_Arc, + Pn_Arcs_Out (End_Node)); end; end if; -- public interface @@ -1246,8 +1299,9 @@ package body Ocarina.Backends.PN.Components is end if; -- have cs -- delete complete_node - Delete_Node_From_List (Complete_Node, - Public_Interfaces (Thread_Iter)); + Delete_Node_From_List + (Complete_Node, + Public_Interfaces (Thread_Iter)); end; end if; -- thread subcomponent @@ -1259,18 +1313,17 @@ package body Ocarina.Backends.PN.Components is ----------- -- next loop through in ports to connect to interconnection -- used to merge all init_dispatch too - Thread_Iter := OPN.First_Node - (PN_Subcomponents - (PN_Box (PN_Generated))); + Thread_Iter := OPN.First_Node (Pn_Subcomponents (Pn_Box (PN_Generated))); if No (Thread_Iter) then - Display_Error ("Petri Net backend : " - & "incomplete AADL model", True); + Display_Error + ("Petri Net backend : " & "incomplete AADL model", + True); end if; declare - Init_Node : constant Node_Id - := OPN.First_Node (Internal_Transitions (Thread_Iter)); + Init_Node : constant Node_Id := + OPN.First_Node (Internal_Transitions (Thread_Iter)); begin -- run across subcomponents while Present (Thread_Iter) loop @@ -1278,17 +1331,17 @@ package body Ocarina.Backends.PN.Components is if OPN.Kind (Thread_Iter) = K_Thread_Pattern then -- merge init - if OPN.First_Node (Internal_Transitions (Thread_Iter)) - /= Init_Node then + if OPN.First_Node (Internal_Transitions (Thread_Iter)) /= + Init_Node + then -- copy all in and out arcs declare - Arc_Iter : Node_Id; - Current_Init : constant Node_Id - := OPN.First_Node (Internal_Transitions (Thread_Iter)); + Arc_Iter : Node_Id; + Current_Init : constant Node_Id := + OPN.First_Node (Internal_Transitions (Thread_Iter)); begin -- look at in arcs - Arc_Iter := OPN.First_Node - (PN_Arcs_In (Current_Init)); + Arc_Iter := OPN.First_Node (Pn_Arcs_In (Current_Init)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all @@ -1302,7 +1355,7 @@ package body Ocarina.Backends.PN.Components is end loop; -- look at out arcs - Arc_Iter := OPN.First_Node (PN_Arcs_Out (Current_Init)); + Arc_Iter := OPN.First_Node (Pn_Arcs_Out (Current_Init)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all @@ -1316,9 +1369,9 @@ package body Ocarina.Backends.PN.Components is end loop; -- delete current init transition - Delete_Node_From_List (Current_Init, - Internal_Transitions - (Thread_Iter)); + Delete_Node_From_List + (Current_Init, + Internal_Transitions (Thread_Iter)); end; end if; -- update init end if; -- thread kind @@ -1328,9 +1381,9 @@ package body Ocarina.Backends.PN.Components is declare Port_Iter, Inter_Iter : Node_Id; - Interconnection_Node : Node_Id := No_Node; - Push_Node : Node_Id; - Handling_Node : Node_Id; + Interconnection_Node : Node_Id := No_Node; + Push_Node : Node_Id; + Handling_Node : Node_Id; begin if not Is_Empty (In_Ports (Thread_Iter)) then Port_Iter := OPN.First_Node (In_Ports (Thread_Iter)); @@ -1339,17 +1392,20 @@ package body Ocarina.Backends.PN.Components is -- run through in ports -- find interconnection place - if not Is_Empty (PN_Interconnections - (PN_Box (PN_Generated))) then - Inter_Iter := OPN.First_Node - (PN_Interconnections (PN_Box (PN_Generated))); + if not Is_Empty + (Pn_Interconnections (Pn_Box (PN_Generated))) + then + Inter_Iter := + OPN.First_Node + (Pn_Interconnections (Pn_Box (PN_Generated))); while Present (Inter_Iter) loop - Handling_Node := Get_Handling - (Inter_Iter, - By_Node, - H_PN_Port_Creation); + Handling_Node := + Get_Handling + (Inter_Iter, + By_Node, + H_PN_Port_Creation); if Handling_Node = Port_Instance (Port_Iter) then -- match : pin port = target_port (inter) @@ -1364,39 +1420,45 @@ package body Ocarina.Backends.PN.Components is -- find push node if not Is_Empty (Public_Interfaces (Port_Iter)) then - Push_Node := OPN.First_Node (Public_Interfaces - (Port_Iter)); + Push_Node := + OPN.First_Node (Public_Interfaces (Port_Iter)); end if; - if OPN.Kind (PN_Formalism_Specific_Informations - (PN_Generated)) - = K_TPN_Specific_Informations then + if OPN.Kind + (Pn_Formalism_Specific_Informations + (PN_Generated)) = + K_TPN_Specific_Informations + then -- create arc declare New_Arc : Node_Id; begin New_Arc := PN_A_New_Proc.all; - PN_A_Init_Proc (New_Arc, - Th_Instance (Thread_Iter), - Interconnection_Node, - Push_Node, - 3); + PN_A_Init_Proc + (New_Arc, + Th_Instance (Thread_Iter), + Interconnection_Node, + Push_Node, + 3); - Append_Node_To_List (New_Arc, - PN_Arcs_In (Push_Node)); + Append_Node_To_List + (New_Arc, + Pn_Arcs_In (Push_Node)); end; end if; - if OPN.Kind (PN_Formalism_Specific_Informations - (PN_Generated)) - = K_CPN_Specific_Informations then + if OPN.Kind + (Pn_Formalism_Specific_Informations + (PN_Generated)) = + K_CPN_Specific_Informations + then -- find ovf node -- and connect to interconnection_node declare - Ovf_Node : constant Node_Id - := OPN.Next_Node (Push_Node); + Ovf_Node : constant Node_Id := + OPN.Next_Node (Push_Node); -- only one next -- because pop has -- been deleted @@ -1405,17 +1467,19 @@ package body Ocarina.Backends.PN.Components is -- get push from source port -- merge it with both push and ovf -- delete interconnection_node - Push_Source := Get_Handling - (Interconnection_Node, - By_Node, - H_PN_Interconnection); + Push_Source := + Get_Handling + (Interconnection_Node, + By_Node, + H_PN_Interconnection); if Push_Source /= No_Node then declare Arc_Iter : Node_Id; begin -- look at in arcs - Arc_Iter := OPN.First_Node - (PN_Arcs_In (Push_Source)); + Arc_Iter := + OPN.First_Node + (Pn_Arcs_In (Push_Source)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all @@ -1429,8 +1493,9 @@ package body Ocarina.Backends.PN.Components is end loop; -- look at out arcs - Arc_Iter := OPN.First_Node - (PN_Arcs_Out (Push_Source)); + Arc_Iter := + OPN.First_Node + (Pn_Arcs_Out (Push_Source)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all @@ -1449,8 +1514,9 @@ package body Ocarina.Backends.PN.Components is Arc_Iter : Node_Id; begin -- look at in arcs - Arc_Iter := OPN.First_Node - (PN_Arcs_In (Push_Source)); + Arc_Iter := + OPN.First_Node + (Pn_Arcs_In (Push_Source)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all @@ -1464,8 +1530,9 @@ package body Ocarina.Backends.PN.Components is end loop; -- look at out arcs - Arc_Iter := OPN.First_Node - (PN_Arcs_Out (Push_Source)); + Arc_Iter := + OPN.First_Node + (Pn_Arcs_Out (Push_Source)); while Present (Arc_Iter) loop PN_Dup_Arc_Proc.all @@ -1481,16 +1548,16 @@ package body Ocarina.Backends.PN.Components is end if; end if; -- delete interconnection_node - Delete_Node_From_List (Interconnection_Node, - PN_Interconnections - (PN_Box - (PN_Generated))); + Delete_Node_From_List + (Interconnection_Node, + Pn_Interconnections (Pn_Box (PN_Generated))); -- delete push source -- too complicated - Set_Handling (Push_Source, - By_Node, - H_PN_To_Delete, - Port_Iter); + Set_Handling + (Push_Source, + By_Node, + H_PN_To_Delete, + Port_Iter); -- impact on GMA can be negleted end; end if; @@ -1514,9 +1581,8 @@ package body Ocarina.Backends.PN.Components is -------------------------------- function Process_Component_Instance - (Instance : Types.Node_Id; - PN_Generated : Types.Node_Id) - return Boolean + (Instance : Types.Node_Id; + PN_Generated : Types.Node_Id) return Boolean is use Ocarina.ME_AADL.AADL_Instances.Entities; use Ocarina.Backends.PN.Nodes; @@ -1525,8 +1591,8 @@ package body Ocarina.Backends.PN.Components is use OPU; use Ocarina.Backends.Properties; - Success : Boolean := False; - List_Node : Node_Id := No_Node; + Success : Boolean := False; + List_Node : Node_Id := No_Node; begin -- browse AADL instance tree if not AINU.Is_Empty (Subcomponents (Instance)) then @@ -1534,21 +1600,22 @@ package body Ocarina.Backends.PN.Components is List_Node := AIN.First_Node (Subcomponents (Instance)); while List_Node /= No_Node loop - case Get_Category_Of_Component - (Corresponding_Instance (List_Node)) + case Get_Category_Of_Component (Corresponding_Instance (List_Node)) is - when CC_Process - | CC_System => + when CC_Process | CC_System => - Success := Process_Component_Instance - (Corresponding_Instance (List_Node), PN_Generated) + Success := + Process_Component_Instance + (Corresponding_Instance (List_Node), + PN_Generated) and then Success; when CC_Thread => - Success := Process_Thread_Instance - (Corresponding_Instance (List_Node), - PN_Generated) + Success := + Process_Thread_Instance + (Corresponding_Instance (List_Node), + PN_Generated) and then Success; when others => @@ -1568,13 +1635,12 @@ package body Ocarina.Backends.PN.Components is function Process_Thread_Instance (Aadl_Instance : Types.Node_Id; - PN_Generated : Types.Node_Id) - return Boolean + PN_Generated : Types.Node_Id) return Boolean is use Ocarina.Backends.PN.Nodes; use Ocarina.Backends.PN.Nutils; use Ocarina.Backends.PN.Iutils; - use Ocarina.Aadl_Values; + use Ocarina.AADL_Values; Success : constant Boolean := True; @@ -1582,44 +1648,46 @@ package body Ocarina.Backends.PN.Components is begin -- Get a new PN thread pattern box PN_Thread := PN_Get_New_Thread_Pattern; - PN_Init_Thread_Pattern (PN_Thread, - Aadl_Instance); + PN_Init_Thread_Pattern (PN_Thread, Aadl_Instance); -- Depending on formalism, compute thread pattern declare F : constant Value_Type := Get_Value_Type (Formalism (PN_Generated)); begin - case F.Ival is + case F.IVal is when 0 => -- CPN Pattern - PN_Process_Thread_Pattern (Aadl_Instance, - PN_Thread, - PN_Generated, - PN_Cpn_Init_Place'Access, - PN_Cpn_Get_New_Place'Access, - PN_Cpn_Init_Transition'Access, - PN_Cpn_Get_New_Transition'Access, - PN_Cpn_Init_Arc'Access, - PN_Cpn_Get_New_Arc'Access); + PN_Process_Thread_Pattern + (Aadl_Instance, + PN_Thread, + PN_Generated, + PN_CPN_Init_Place'Access, + PN_CPN_Get_New_Place'Access, + PN_CPN_Init_Transition'Access, + PN_CPN_Get_New_Transition'Access, + PN_CPN_Init_Arc'Access, + PN_CPN_Get_New_Arc'Access); when 1 => -- TPN Pattern - PN_Process_Thread_Pattern (Aadl_Instance, - PN_Thread, - PN_Generated, - PN_Tpn_Init_Place'Access, - PN_Tpn_Get_New_Place'Access, - PN_Tpn_Init_Transition'Access, - PN_Tpn_Get_New_Transition'Access, - PN_Tpn_Init_Arc'Access, - PN_Tpn_Get_New_Arc'Access); + PN_Process_Thread_Pattern + (Aadl_Instance, + PN_Thread, + PN_Generated, + PN_TPN_Init_Place'Access, + PN_TPN_Get_New_Place'Access, + PN_TPN_Init_Transition'Access, + PN_TPN_Get_New_Transition'Access, + PN_TPN_Init_Arc'Access, + PN_TPN_Get_New_Arc'Access); when others => null; end case; end; -- create the standard thread pattern - OPU.Append_Node_To_List (PN_Thread, - PN_Subcomponents (PN_Box (PN_Generated))); + OPU.Append_Node_To_List + (PN_Thread, + Pn_Subcomponents (Pn_Box (PN_Generated))); return Success; end Process_Thread_Instance; @@ -1629,9 +1697,9 @@ package body Ocarina.Backends.PN.Components is ------------------------------------- procedure PN_Process_Thread_Pattern - (Aadl_Instance : Types.Node_Id; - PN_Thread : Types.Node_Id; - PN_Generated : Types.Node_Id; + (Aadl_Instance : Types.Node_Id; + PN_Thread : Types.Node_Id; + PN_Generated : Types.Node_Id; PN_P_Init_Proc : PN_Init_Node; PN_P_New_Proc : PN_New_Node; PN_T_Init_Proc : PN_Init_Node; @@ -1649,107 +1717,111 @@ package body Ocarina.Backends.PN.Components is use AIN; use OPND; - V_Formalism : constant Value_Type - := Get_Value_Type (Formalism (PN_Generated)); + V_Formalism : constant Value_Type := + Get_Value_Type (Formalism (PN_Generated)); begin - if Get_Thread_Implementation_Kind (Aadl_Instance) - = Thread_Unknown then + if Get_Thread_Implementation_Kind (Aadl_Instance) = Thread_Unknown then - Display_Error ("Petri Net backend : " - & "Thread Implementation Unknown", True); + Display_Error + ("Petri Net backend : " & "Thread Implementation Unknown", + True); end if; -- build skeleton pattern - PN_Thread_Skeleton (Aadl_Instance, - PN_Thread, - PN_Generated, - PN_P_Init_Proc, - PN_P_New_Proc, - PN_T_Init_Proc, - PN_T_New_Proc, - PN_A_Init_Proc, - PN_A_New_Proc); + PN_Thread_Skeleton + (Aadl_Instance, + PN_Thread, + PN_Generated, + PN_P_Init_Proc, + PN_P_New_Proc, + PN_T_Init_Proc, + PN_T_New_Proc, + PN_A_Init_Proc, + PN_A_New_Proc); ------------------------- -- build compute pattern - if Get_Thread_Implementation_Kind (Aadl_Instance) - = Thread_With_Call_Sequence then + if Get_Thread_Implementation_Kind (Aadl_Instance) = + Thread_With_Call_Sequence + then -- browse call sequences and store them declare - Cs : List_Id; + Cs : List_Id; PN_Cs : Node_Id := No_Node; begin -- build pn node for call sequence PN_Cs := PN_Get_New_Call_Seq_Pattern; - PN_Init_Call_Seq_Pattern (PN_Cs, - Aadl_Instance); + PN_Init_Call_Seq_Pattern (PN_Cs, Aadl_Instance); if not AINU.Is_Empty (AIN.Calls (Aadl_Instance)) then -- get calls sequences for the instance thread Cs := AIN.Calls (Aadl_Instance); declare - Call_Iter : Node_Id := AIN.First_Node (Cs); - Spg_call : Node_Id; + Call_Iter : Node_Id := AIN.First_Node (Cs); + Spg_call : Node_Id; PN_Spg_Call : Node_Id := No_Node; begin while Present (Call_Iter) loop if not AINU.Is_Empty - (AIN.Subprogram_Calls (Call_Iter)) then + (AIN.Subprogram_Calls (Call_Iter)) + then -- get first subprogram call of the sequence - Spg_Call := AIN.First_Node - (AIN.Subprogram_Calls (Call_Iter)); + Spg_call := + AIN.First_Node (AIN.Subprogram_Calls (Call_Iter)); - if Present (Spg_Call) then + if Present (Spg_call) then -- build Pn node for spg PN_Spg_Call := PN_Get_New_Spg_Pattern; - PN_Init_Spg_Pattern (PN_Spg_Call, - Aadl_Instance); + PN_Init_Spg_Pattern (PN_Spg_Call, Aadl_Instance); -- Parent_Sequence (Spg_Call)); end if; - while Present (Spg_Call) loop + while Present (Spg_call) loop declare -- get corresponding subprogram aadl instance - Spg : constant Node_Id - := AIN.Corresponding_Instance (Spg_Call); + Spg : constant Node_Id := + AIN.Corresponding_Instance (Spg_call); begin -- check if subprogram instance has features if not AINU.Is_Empty (AIN.Features (Spg)) then declare - Spg_Feat : Node_Id - := AIN.First_Node (AIN.Features (Spg)); + Spg_Feat : Node_Id := + AIN.First_Node (AIN.Features (Spg)); begin while Present (Spg_Feat) loop - if AIN.Kind (Spg_Feat) - = AIN.K_Parameter_Instance + if AIN.Kind (Spg_Feat) = + AIN.K_Parameter_Instance and then AIN.Is_Out (Spg_Feat) then -- subprogram instance -- has out parameter - if AINU.Length (AIN.Destinations - (Spg_Feat)) = 0 then + if AINU.Length + (AIN.Destinations (Spg_Feat)) = + 0 + then Display_Located_Error (AIN.Loc (Spg_Feat), - "This OUT parameter " - & "is not connected to" - & " any destination", + "This OUT parameter " & + "is not connected to" & + " any destination", Fatal => True); elsif AINU.Length - (AIN.Destinations (Spg_Feat)) > 1 + (AIN.Destinations (Spg_Feat)) > + 1 then Display_Located_Error (AIN.Loc (Spg_Feat), - "This OUT parameter " - & "has too many destination", + "This OUT parameter " & + "has too many destination", Fatal => True); end if; @@ -1772,8 +1844,8 @@ package body Ocarina.Backends.PN.Components is PN_A_Init_Proc, PN_A_New_Proc); - elsif AIN.Kind (Spg_Feat) - = AIN.K_Parameter_Instance + elsif AIN.Kind (Spg_Feat) = + AIN.K_Parameter_Instance and then AIN.Is_In (Spg_Feat) then -- subprogram instance has @@ -1783,21 +1855,23 @@ package body Ocarina.Backends.PN.Components is -- has in parameter if AINU.Length - (AIN.Sources - (Spg_Feat)) = 0 then + (AIN.Sources (Spg_Feat)) = + 0 + then Display_Located_Error - (AIN.Loc (Spg_Feat), - "This IN parameter " - & "is not connected to" - & " any source", - Fatal => True); + (AIN.Loc (Spg_Feat), + "This IN parameter " & + "is not connected to" & + " any source", + Fatal => True); elsif AINU.Length - (AIN.Sources - (Spg_Feat)) > 1 then + (AIN.Sources (Spg_Feat)) > + 1 + then Display_Located_Error (AIN.Loc (Spg_Feat), - "This IN parameter " - & "has too many sources", + "This IN parameter " & + "has too many sources", Fatal => True); end if; @@ -1830,173 +1904,169 @@ package body Ocarina.Backends.PN.Components is -- transition end declare - P_PN_Spg_Comp : Node_Id; - T1_PN_Spg_Beg : Node_Id; - T2_PN_Spg_End : Node_Id; - P_W1, P_W2 : Node_Id; + P_PN_Spg_Comp : Node_Id; + T1_PN_Spg_Beg : Node_Id; + T2_PN_Spg_End : Node_Id; + P_W1, P_W2 : Node_Id; Preemp1, Preemp2 : Node_Id; - A_PN_Spg_Call : Node_Id; + A_PN_Spg_Call : Node_Id; begin - T1_PN_Spg_Beg := - PN_T_New_Proc.all; + T1_PN_Spg_Beg := PN_T_New_Proc.all; PN_T_Init_Proc (T1_PN_Spg_Beg, Aadl_Instance, - Get_String_Name - ("_Begin"), + Get_String_Name ("_Begin"), PN_Generated, 0); Append_Node_To_List (T1_PN_Spg_Beg, - Public_Interfaces - (PN_Spg_Call)); + Public_Interfaces (PN_Spg_Call)); - T2_PN_Spg_End := - PN_T_New_Proc.all; + T2_PN_Spg_End := PN_T_New_Proc.all; PN_T_Init_Proc (T2_PN_Spg_End, Aadl_Instance, - Get_String_Name - ("_End"), + Get_String_Name ("_End"), PN_Generated, 0); Append_Node_To_List (T2_PN_Spg_End, - Public_Interfaces - (PN_Spg_Call)); + Public_Interfaces (PN_Spg_Call)); -- Preemp1 := PN_T_New_Proc.all; PN_T_Init_Proc