From d6532371caba4bb92a3b04d0765b80dff1285092 Mon Sep 17 00:00:00 2001 From: Michael Frank Date: Fri, 31 Jan 2025 18:06:04 +0000 Subject: [PATCH 01/25] Resolve "Create SVG diagram to show Hierarchical Visibility in Program Structure module" --- .../04-hierarchical_library_units.rst | 32 +- images/hierarchical_visibility_1.svg | 196 +++++++++ images/hierarchical_visibility_2.svg | 364 ++++++++++++++++ images/hierarchical_visibility_3.svg | 403 ++++++++++++++++++ images/hierarchical_visibility_4.svg | 384 +++++++++++++++++ 5 files changed, 1373 insertions(+), 6 deletions(-) create mode 100644 images/hierarchical_visibility_1.svg create mode 100644 images/hierarchical_visibility_2.svg create mode 100644 images/hierarchical_visibility_3.svg create mode 100644 images/hierarchical_visibility_4.svg diff --git a/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst b/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst index ca2185085..6192b8758 100644 --- a/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst +++ b/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst @@ -26,10 +26,6 @@ Problem: Packages Are Not Enough Solution: Hierarchical Library Units -------------------------------------- -.. container:: columns - - .. container:: column - * Address extensibility issue - Can extend packages with visibility to parent private part @@ -40,9 +36,33 @@ Solution: Hierarchical Library Units - Extensions all have the same ancestor *root* name - .. container:: column +------------------------------- +Visibility Across a Hierarchy +------------------------------- + +.. container:: overlay 1 + + .. image:: hierarchical_visibility_1.svg + :width: 70% + :align: center + +.. container:: overlay 2 + + .. image:: hierarchical_visibility_2.svg + :width: 70% + :align: center + +.. container:: overlay 3 + + .. image:: hierarchical_visibility_3.svg + :width: 70% + :align: center + +.. container:: overlay 4 - .. image:: hierarchical_library_units.png + .. image:: hierarchical_visibility_4.svg + :width: 70% + :align: center -------------------------- Programming by Extension diff --git a/images/hierarchical_visibility_1.svg b/images/hierarchical_visibility_1.svg new file mode 100644 index 000000000..212a2c5f1 --- /dev/null +++ b/images/hierarchical_visibility_1.svg @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + Our_Unit + + Visible Part + + Private Part + + + + Body + In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. + + + diff --git a/images/hierarchical_visibility_2.svg b/images/hierarchical_visibility_2.svg new file mode 100644 index 000000000..66e2da740 --- /dev/null +++ b/images/hierarchical_visibility_2.svg @@ -0,0 +1,364 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Another package can see our visible part (dependingon where the "with" is), but nothing else. + + Our_Unit + + Visible Part + + Private Part + + + + Body + + Other_Unit + + Visible Part + + Private Part + + + + Body + + In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. + + + diff --git a/images/hierarchical_visibility_3.svg b/images/hierarchical_visibility_3.svg new file mode 100644 index 000000000..1e65ea640 --- /dev/null +++ b/images/hierarchical_visibility_3.svg @@ -0,0 +1,403 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Our child's visible part can see our visible part,and its private part (and body) can see our private part + + Our_Unit + + Visible Part + + Private Part + + + + Body + + Other_Unit + + Visible Part + + Private Part + + + + Body + + + + + In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. + + + diff --git a/images/hierarchical_visibility_4.svg b/images/hierarchical_visibility_4.svg new file mode 100644 index 000000000..25fca01e7 --- /dev/null +++ b/images/hierarchical_visibility_4.svg @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Our private child can see our private partand visible part from anywhere + + Our_Unit + + Visible Part + + Private Part + + + + Body + + Other_Unit + + Visible Part + + Private Part + + + + Body + + + + + + In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. + + + From 83f2f7dbc86eb326b466a82e69d8839f34598044 Mon Sep 17 00:00:00 2001 From: Michael Frank Date: Mon, 3 Feb 2025 21:02:35 +0000 Subject: [PATCH 02/25] Resolve "Add "rust" role to material prefix" --- .../010_advanced_exception_analysis.rst | 3 +++ courses/fundamentals_of_ada/005_introduction.rst | 3 +++ courses/fundamentals_of_ada/010_overview.rst | 3 +++ courses/fundamentals_of_ada/020_declarations.rst | 3 +++ courses/fundamentals_of_ada/030_basic_types-extras.rst | 3 +++ courses/fundamentals_of_ada/030_basic_types-in_depth.rst | 3 +++ courses/fundamentals_of_ada/030_basic_types.rst | 3 +++ courses/fundamentals_of_ada/040_statements.rst | 3 +++ courses/fundamentals_of_ada/050_array_types.rst | 3 +++ courses/fundamentals_of_ada/060_record_types.rst | 3 +++ courses/fundamentals_of_ada/065_discriminated_records.rst | 3 +++ courses/fundamentals_of_ada/070_subprograms.rst | 3 +++ courses/fundamentals_of_ada/075_type_derivation.rst | 3 +++ .../fundamentals_of_ada/080_expressions-with_quantified.rst | 3 +++ courses/fundamentals_of_ada/080_expressions.rst | 3 +++ courses/fundamentals_of_ada/090_overloading-with_equality.rst | 3 +++ courses/fundamentals_of_ada/090_overloading.rst | 3 +++ courses/fundamentals_of_ada/100_packages.rst | 3 +++ courses/fundamentals_of_ada/110_private_types.rst | 3 +++ courses/fundamentals_of_ada/120_limited_types.rst | 3 +++ courses/fundamentals_of_ada/130_program_structure.rst | 3 +++ courses/fundamentals_of_ada/135_visibility.rst | 3 +++ courses/fundamentals_of_ada/140_access_types-in_depth.rst | 3 +++ courses/fundamentals_of_ada/140_access_types.rst | 3 +++ courses/fundamentals_of_ada/160_genericity-intro.rst | 3 +++ courses/fundamentals_of_ada/160_genericity.rst | 3 +++ courses/fundamentals_of_ada/170_tagged_derivation-intro.rst | 3 +++ courses/fundamentals_of_ada/170_tagged_derivation.rst | 3 +++ courses/fundamentals_of_ada/175_multiple_inheritance.rst | 3 +++ courses/fundamentals_of_ada/180_polymorphism.rst | 3 +++ courses/fundamentals_of_ada/190_exceptions-in_depth.rst | 3 +++ courses/fundamentals_of_ada/190_exceptions.rst | 3 +++ courses/fundamentals_of_ada/230_interfacing_with_c.rst | 3 +++ courses/fundamentals_of_ada/240_tasking.rst | 3 +++ courses/fundamentals_of_ada/240_tasking_in_depth.rst | 3 +++ courses/fundamentals_of_ada/240_tasking_light.rst | 3 +++ courses/fundamentals_of_ada/240_tasking_light_in_depth.rst | 3 +++ .../245_ravenscar_tasking-with_tasking_overview.rst | 3 +++ courses/fundamentals_of_ada/245_ravenscar_tasking.rst | 3 +++ courses/fundamentals_of_ada/260_controlled_types.rst | 3 +++ courses/fundamentals_of_ada/270_introduction_to_contracts.rst | 3 +++ courses/fundamentals_of_ada/273_subprogram_contracts.rst | 3 +++ courses/fundamentals_of_ada/276_type_contracts.rst | 3 +++ courses/fundamentals_of_ada/280_low_level_programming.rst | 3 +++ courses/fundamentals_of_ada/290_advanced_data_hiding.rst | 3 +++ courses/fundamentals_of_ada/890_ada_text_io.rst | 3 +++ courses/fundamentals_of_ada/891_ada_characters.rst | 3 +++ courses/fundamentals_of_ada/892_ada_strings.rst | 3 +++ courses/fundamentals_of_ada/893_ada_numerics.rst | 3 +++ courses/fundamentals_of_ada/894_ada_containers.rst | 3 +++ courses/fundamentals_of_ada/901_ada_2022_specific.rst | 3 +++ courses/fundamentals_of_ada/902_future_capabilities.rst | 3 +++ courses/fundamentals_of_ada/920_reference_material.rst | 3 +++ courses/gnat_project_facility/010_overview.rst | 3 +++ courses/gnat_project_facility/020_building_with_gprbuild.rst | 3 +++ courses/gnat_project_facility/030_project_properties.rst | 3 +++ .../gnat_project_facility/040_structuring_your_application.rst | 3 +++ courses/gnat_project_facility/050_advanced_capabilities.rst | 3 +++ courses/gnat_project_facility/060_summary.rst | 3 +++ courses/gnatdas/010_overview.rst | 3 +++ courses/gnatdas/cover_010_overview.rst | 3 +++ courses/gnatdas/cover_020_basic_workflow.rst | 3 +++ courses/gnatdas/cover_030_advanced_topics.rst | 3 +++ courses/gnatdas/cover_040_gnatstudio.rst | 3 +++ courses/gnatdas/test_010_overview.rst | 3 +++ courses/gnatdas/test_020_usage.rst | 3 +++ courses/gnatdas/test_030_controlling_gnattest.rst | 3 +++ courses/gnatdas/test_040_advanced_testing.rst | 3 +++ courses/gnatsas/010_course_overview.rst | 3 +++ courses/gnatsas/check_010_overview.rst | 3 +++ courses/gnatsas/check_020_getting_started.rst | 3 +++ courses/gnatsas/check_030_predefined_rules.rst | 3 +++ courses/gnatsas/check_040_lkql.rst | 3 +++ courses/gnatsas/metric_010_overview.rst | 3 +++ courses/gnatsas/sas_010_introduction.rst | 3 +++ courses/gnatsas/sas_020_overview.rst | 3 +++ courses/gnatsas/sas_030_analysis.rst | 3 +++ courses/gnatsas/sas_040_viewing_results.rst | 3 +++ courses/gnatsas/sas_050_reviewing_messages.rst | 3 +++ courses/gnatsas/sas_060_tutorial.rst | 3 +++ courses/rust_essentials/010_rust_essentials.rst | 3 +++ courses/spark_for_ada_programmers/10_advanced_proof.rst | 3 +++ .../spark_for_ada_programmers/11_advanced_flow_analysis.rst | 3 +++ courses/spark_for_ada_programmers/12_pointer_programs.rst | 3 +++ courses/spark_for_ada_programmers/13_autoactive_proof.rst | 3 +++ courses/spark_for_ada_programmers/14_state_abstraction.rst | 3 +++ courses/spark_for_ada_programmers/15_spark_boundary.rst | 3 +++ courses/spark_for_ada_programmers/1_course_overview.rst | 3 +++ .../spark_for_ada_programmers/2_formal_methods_and_spark.rst | 3 +++ courses/spark_for_ada_programmers/3_spark_language.rst | 3 +++ courses/spark_for_ada_programmers/4_spark_tools.rst | 3 +++ courses/spark_for_ada_programmers/5_flow_analysis.rst | 3 +++ courses/spark_for_ada_programmers/6_proof.rst | 3 +++ courses/spark_for_ada_programmers/7_specification_language.rst | 3 +++ courses/spark_for_ada_programmers/8_subprogram_contracts.rst | 3 +++ .../spark_for_ada_programmers/990_spark_example_project.rst | 3 +++ courses/spark_for_ada_programmers/9_type_contracts.rst | 3 +++ .../010_static_analysis_via_compiler.rst | 3 +++ support_files/prelude.rst | 3 +++ 99 files changed, 297 insertions(+) diff --git a/courses/advanced_exception_analysis/010_advanced_exception_analysis.rst b/courses/advanced_exception_analysis/010_advanced_exception_analysis.rst index 9e322ed91..3f1110947 100644 --- a/courses/advanced_exception_analysis/010_advanced_exception_analysis.rst +++ b/courses/advanced_exception_analysis/010_advanced_exception_analysis.rst @@ -15,6 +15,9 @@ Advanced Exception Analysis .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/005_introduction.rst b/courses/fundamentals_of_ada/005_introduction.rst index a651ec316..361aa1c22 100644 --- a/courses/fundamentals_of_ada/005_introduction.rst +++ b/courses/fundamentals_of_ada/005_introduction.rst @@ -15,6 +15,9 @@ Introduction .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/010_overview.rst b/courses/fundamentals_of_ada/010_overview.rst index 6d0d16484..3f9a281e0 100644 --- a/courses/fundamentals_of_ada/010_overview.rst +++ b/courses/fundamentals_of_ada/010_overview.rst @@ -15,6 +15,9 @@ Overview .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/020_declarations.rst b/courses/fundamentals_of_ada/020_declarations.rst index c7634caec..4e5904e1b 100644 --- a/courses/fundamentals_of_ada/020_declarations.rst +++ b/courses/fundamentals_of_ada/020_declarations.rst @@ -15,6 +15,9 @@ Declarations .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/030_basic_types-extras.rst b/courses/fundamentals_of_ada/030_basic_types-extras.rst index 9859c5b99..10ce21a95 100644 --- a/courses/fundamentals_of_ada/030_basic_types-extras.rst +++ b/courses/fundamentals_of_ada/030_basic_types-extras.rst @@ -15,6 +15,9 @@ Basic Types .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/030_basic_types-in_depth.rst b/courses/fundamentals_of_ada/030_basic_types-in_depth.rst index e6a6f3464..3ca6d8a38 100644 --- a/courses/fundamentals_of_ada/030_basic_types-in_depth.rst +++ b/courses/fundamentals_of_ada/030_basic_types-in_depth.rst @@ -15,6 +15,9 @@ Basic Types .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/030_basic_types.rst b/courses/fundamentals_of_ada/030_basic_types.rst index 8345f2f8a..e86f23f97 100644 --- a/courses/fundamentals_of_ada/030_basic_types.rst +++ b/courses/fundamentals_of_ada/030_basic_types.rst @@ -15,6 +15,9 @@ Basic Types .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/040_statements.rst b/courses/fundamentals_of_ada/040_statements.rst index cef3fc4db..c717af490 100644 --- a/courses/fundamentals_of_ada/040_statements.rst +++ b/courses/fundamentals_of_ada/040_statements.rst @@ -15,6 +15,9 @@ Statements .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/050_array_types.rst b/courses/fundamentals_of_ada/050_array_types.rst index 3149cf687..85eefe516 100644 --- a/courses/fundamentals_of_ada/050_array_types.rst +++ b/courses/fundamentals_of_ada/050_array_types.rst @@ -15,6 +15,9 @@ Array Types .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/060_record_types.rst b/courses/fundamentals_of_ada/060_record_types.rst index 064023c4c..a0d38502c 100644 --- a/courses/fundamentals_of_ada/060_record_types.rst +++ b/courses/fundamentals_of_ada/060_record_types.rst @@ -15,6 +15,9 @@ Record Types .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/065_discriminated_records.rst b/courses/fundamentals_of_ada/065_discriminated_records.rst index a74ae182e..ba093f97b 100644 --- a/courses/fundamentals_of_ada/065_discriminated_records.rst +++ b/courses/fundamentals_of_ada/065_discriminated_records.rst @@ -15,6 +15,9 @@ Discriminated Records .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/070_subprograms.rst b/courses/fundamentals_of_ada/070_subprograms.rst index 76f729c3a..ba4a21da4 100644 --- a/courses/fundamentals_of_ada/070_subprograms.rst +++ b/courses/fundamentals_of_ada/070_subprograms.rst @@ -15,6 +15,9 @@ Subprograms .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/075_type_derivation.rst b/courses/fundamentals_of_ada/075_type_derivation.rst index bb08dbf58..8986d9df7 100644 --- a/courses/fundamentals_of_ada/075_type_derivation.rst +++ b/courses/fundamentals_of_ada/075_type_derivation.rst @@ -15,6 +15,9 @@ Type Derivation .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/080_expressions-with_quantified.rst b/courses/fundamentals_of_ada/080_expressions-with_quantified.rst index 57db31053..7fc71c7d2 100644 --- a/courses/fundamentals_of_ada/080_expressions-with_quantified.rst +++ b/courses/fundamentals_of_ada/080_expressions-with_quantified.rst @@ -15,6 +15,9 @@ Expressions .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/080_expressions.rst b/courses/fundamentals_of_ada/080_expressions.rst index 09657d1c1..6392ec597 100644 --- a/courses/fundamentals_of_ada/080_expressions.rst +++ b/courses/fundamentals_of_ada/080_expressions.rst @@ -15,6 +15,9 @@ Expressions .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/090_overloading-with_equality.rst b/courses/fundamentals_of_ada/090_overloading-with_equality.rst index 2d200ed66..b4683022a 100644 --- a/courses/fundamentals_of_ada/090_overloading-with_equality.rst +++ b/courses/fundamentals_of_ada/090_overloading-with_equality.rst @@ -15,6 +15,9 @@ Overloading .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/090_overloading.rst b/courses/fundamentals_of_ada/090_overloading.rst index 276631483..c9fe30fdf 100644 --- a/courses/fundamentals_of_ada/090_overloading.rst +++ b/courses/fundamentals_of_ada/090_overloading.rst @@ -15,6 +15,9 @@ Overloading .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/100_packages.rst b/courses/fundamentals_of_ada/100_packages.rst index 0cb79017c..cafbc77e8 100644 --- a/courses/fundamentals_of_ada/100_packages.rst +++ b/courses/fundamentals_of_ada/100_packages.rst @@ -15,6 +15,9 @@ Packages .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/110_private_types.rst b/courses/fundamentals_of_ada/110_private_types.rst index 0dbebe49e..5c3a56a78 100644 --- a/courses/fundamentals_of_ada/110_private_types.rst +++ b/courses/fundamentals_of_ada/110_private_types.rst @@ -15,6 +15,9 @@ Private Types .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/120_limited_types.rst b/courses/fundamentals_of_ada/120_limited_types.rst index 90ebb0c7c..367c10afb 100644 --- a/courses/fundamentals_of_ada/120_limited_types.rst +++ b/courses/fundamentals_of_ada/120_limited_types.rst @@ -15,6 +15,9 @@ Limited Types .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/130_program_structure.rst b/courses/fundamentals_of_ada/130_program_structure.rst index 07d02d65e..7bcf276ae 100644 --- a/courses/fundamentals_of_ada/130_program_structure.rst +++ b/courses/fundamentals_of_ada/130_program_structure.rst @@ -15,6 +15,9 @@ Program Structure .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/135_visibility.rst b/courses/fundamentals_of_ada/135_visibility.rst index 104b32f78..62b50f375 100644 --- a/courses/fundamentals_of_ada/135_visibility.rst +++ b/courses/fundamentals_of_ada/135_visibility.rst @@ -15,6 +15,9 @@ Visibility .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/140_access_types-in_depth.rst b/courses/fundamentals_of_ada/140_access_types-in_depth.rst index a5b8042fa..87b5de62b 100644 --- a/courses/fundamentals_of_ada/140_access_types-in_depth.rst +++ b/courses/fundamentals_of_ada/140_access_types-in_depth.rst @@ -15,6 +15,9 @@ Access Types In Depth .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/140_access_types.rst b/courses/fundamentals_of_ada/140_access_types.rst index b7b314953..bf88d7922 100644 --- a/courses/fundamentals_of_ada/140_access_types.rst +++ b/courses/fundamentals_of_ada/140_access_types.rst @@ -15,6 +15,9 @@ Access Types .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/160_genericity-intro.rst b/courses/fundamentals_of_ada/160_genericity-intro.rst index 33f89e91c..c1a11ada3 100644 --- a/courses/fundamentals_of_ada/160_genericity-intro.rst +++ b/courses/fundamentals_of_ada/160_genericity-intro.rst @@ -15,6 +15,9 @@ Genericity .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/160_genericity.rst b/courses/fundamentals_of_ada/160_genericity.rst index 407f4a2f2..e3242e178 100644 --- a/courses/fundamentals_of_ada/160_genericity.rst +++ b/courses/fundamentals_of_ada/160_genericity.rst @@ -15,6 +15,9 @@ Genericity .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/170_tagged_derivation-intro.rst b/courses/fundamentals_of_ada/170_tagged_derivation-intro.rst index 8e334a127..647a5f355 100644 --- a/courses/fundamentals_of_ada/170_tagged_derivation-intro.rst +++ b/courses/fundamentals_of_ada/170_tagged_derivation-intro.rst @@ -15,6 +15,9 @@ Tagged Derivation .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/170_tagged_derivation.rst b/courses/fundamentals_of_ada/170_tagged_derivation.rst index cd19f2053..7aafdd731 100644 --- a/courses/fundamentals_of_ada/170_tagged_derivation.rst +++ b/courses/fundamentals_of_ada/170_tagged_derivation.rst @@ -15,6 +15,9 @@ Tagged Derivation .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/175_multiple_inheritance.rst b/courses/fundamentals_of_ada/175_multiple_inheritance.rst index 60b70a15b..dc08e7778 100644 --- a/courses/fundamentals_of_ada/175_multiple_inheritance.rst +++ b/courses/fundamentals_of_ada/175_multiple_inheritance.rst @@ -15,6 +15,9 @@ Multiple Inheritance .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/180_polymorphism.rst b/courses/fundamentals_of_ada/180_polymorphism.rst index a353ec641..bedbf5a43 100644 --- a/courses/fundamentals_of_ada/180_polymorphism.rst +++ b/courses/fundamentals_of_ada/180_polymorphism.rst @@ -15,6 +15,9 @@ Polymorphism .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/190_exceptions-in_depth.rst b/courses/fundamentals_of_ada/190_exceptions-in_depth.rst index b24a5b89c..b93235e6e 100644 --- a/courses/fundamentals_of_ada/190_exceptions-in_depth.rst +++ b/courses/fundamentals_of_ada/190_exceptions-in_depth.rst @@ -15,6 +15,9 @@ Exceptions In-Depth .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/190_exceptions.rst b/courses/fundamentals_of_ada/190_exceptions.rst index b0c7fe408..b328c6148 100644 --- a/courses/fundamentals_of_ada/190_exceptions.rst +++ b/courses/fundamentals_of_ada/190_exceptions.rst @@ -15,6 +15,9 @@ Exceptions .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/230_interfacing_with_c.rst b/courses/fundamentals_of_ada/230_interfacing_with_c.rst index 692d617ea..0e98c5f77 100644 --- a/courses/fundamentals_of_ada/230_interfacing_with_c.rst +++ b/courses/fundamentals_of_ada/230_interfacing_with_c.rst @@ -15,6 +15,9 @@ Interfacing with C .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/240_tasking.rst b/courses/fundamentals_of_ada/240_tasking.rst index 1f575f703..fc005b425 100644 --- a/courses/fundamentals_of_ada/240_tasking.rst +++ b/courses/fundamentals_of_ada/240_tasking.rst @@ -15,6 +15,9 @@ Tasking .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/240_tasking_in_depth.rst b/courses/fundamentals_of_ada/240_tasking_in_depth.rst index 82b091859..52dd3c42d 100644 --- a/courses/fundamentals_of_ada/240_tasking_in_depth.rst +++ b/courses/fundamentals_of_ada/240_tasking_in_depth.rst @@ -15,6 +15,9 @@ Tasking .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/240_tasking_light.rst b/courses/fundamentals_of_ada/240_tasking_light.rst index 326eb2e92..b3dd578e4 100644 --- a/courses/fundamentals_of_ada/240_tasking_light.rst +++ b/courses/fundamentals_of_ada/240_tasking_light.rst @@ -15,6 +15,9 @@ Tasking .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/240_tasking_light_in_depth.rst b/courses/fundamentals_of_ada/240_tasking_light_in_depth.rst index c9f7fbaea..35b4be10b 100644 --- a/courses/fundamentals_of_ada/240_tasking_light_in_depth.rst +++ b/courses/fundamentals_of_ada/240_tasking_light_in_depth.rst @@ -15,6 +15,9 @@ Tasking .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/245_ravenscar_tasking-with_tasking_overview.rst b/courses/fundamentals_of_ada/245_ravenscar_tasking-with_tasking_overview.rst index 8799903f8..597098a96 100644 --- a/courses/fundamentals_of_ada/245_ravenscar_tasking-with_tasking_overview.rst +++ b/courses/fundamentals_of_ada/245_ravenscar_tasking-with_tasking_overview.rst @@ -15,6 +15,9 @@ Ravenscar Tasking .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/245_ravenscar_tasking.rst b/courses/fundamentals_of_ada/245_ravenscar_tasking.rst index 1172f48ca..0160ef0e4 100644 --- a/courses/fundamentals_of_ada/245_ravenscar_tasking.rst +++ b/courses/fundamentals_of_ada/245_ravenscar_tasking.rst @@ -15,6 +15,9 @@ Ravenscar Tasking .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/260_controlled_types.rst b/courses/fundamentals_of_ada/260_controlled_types.rst index e65b49b63..b1c4d4598 100644 --- a/courses/fundamentals_of_ada/260_controlled_types.rst +++ b/courses/fundamentals_of_ada/260_controlled_types.rst @@ -15,6 +15,9 @@ Controlled Types .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/270_introduction_to_contracts.rst b/courses/fundamentals_of_ada/270_introduction_to_contracts.rst index eb25aecd9..8e24ecefd 100644 --- a/courses/fundamentals_of_ada/270_introduction_to_contracts.rst +++ b/courses/fundamentals_of_ada/270_introduction_to_contracts.rst @@ -15,6 +15,9 @@ Ada Contracts .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/273_subprogram_contracts.rst b/courses/fundamentals_of_ada/273_subprogram_contracts.rst index b3ab6be06..4f6c99268 100644 --- a/courses/fundamentals_of_ada/273_subprogram_contracts.rst +++ b/courses/fundamentals_of_ada/273_subprogram_contracts.rst @@ -15,6 +15,9 @@ Subprogram Contracts .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/276_type_contracts.rst b/courses/fundamentals_of_ada/276_type_contracts.rst index 59caa9b67..fc416556a 100644 --- a/courses/fundamentals_of_ada/276_type_contracts.rst +++ b/courses/fundamentals_of_ada/276_type_contracts.rst @@ -15,6 +15,9 @@ Type Contracts .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/280_low_level_programming.rst b/courses/fundamentals_of_ada/280_low_level_programming.rst index 1a73ea9eb..0b288c6ca 100644 --- a/courses/fundamentals_of_ada/280_low_level_programming.rst +++ b/courses/fundamentals_of_ada/280_low_level_programming.rst @@ -15,6 +15,9 @@ Low Level Programming .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/290_advanced_data_hiding.rst b/courses/fundamentals_of_ada/290_advanced_data_hiding.rst index cc7e4fb23..b7cba3957 100644 --- a/courses/fundamentals_of_ada/290_advanced_data_hiding.rst +++ b/courses/fundamentals_of_ada/290_advanced_data_hiding.rst @@ -15,6 +15,9 @@ Advanced Privacy .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/890_ada_text_io.rst b/courses/fundamentals_of_ada/890_ada_text_io.rst index 5162a616f..7ab11caae 100644 --- a/courses/fundamentals_of_ada/890_ada_text_io.rst +++ b/courses/fundamentals_of_ada/890_ada_text_io.rst @@ -15,6 +15,9 @@ Ada.Text_IO .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/891_ada_characters.rst b/courses/fundamentals_of_ada/891_ada_characters.rst index c97bb1186..edaf9c16e 100644 --- a/courses/fundamentals_of_ada/891_ada_characters.rst +++ b/courses/fundamentals_of_ada/891_ada_characters.rst @@ -15,6 +15,9 @@ Ada.Characters .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/892_ada_strings.rst b/courses/fundamentals_of_ada/892_ada_strings.rst index 36b0969f4..d546e158b 100644 --- a/courses/fundamentals_of_ada/892_ada_strings.rst +++ b/courses/fundamentals_of_ada/892_ada_strings.rst @@ -15,6 +15,9 @@ Ada.Strings .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/893_ada_numerics.rst b/courses/fundamentals_of_ada/893_ada_numerics.rst index fc33e04c0..f9276c043 100644 --- a/courses/fundamentals_of_ada/893_ada_numerics.rst +++ b/courses/fundamentals_of_ada/893_ada_numerics.rst @@ -15,6 +15,9 @@ Ada.Numerics .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/894_ada_containers.rst b/courses/fundamentals_of_ada/894_ada_containers.rst index e50ed9b6e..373cc5b59 100644 --- a/courses/fundamentals_of_ada/894_ada_containers.rst +++ b/courses/fundamentals_of_ada/894_ada_containers.rst @@ -15,6 +15,9 @@ Containers .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/901_ada_2022_specific.rst b/courses/fundamentals_of_ada/901_ada_2022_specific.rst index d6f4d7d3a..43034149a 100644 --- a/courses/fundamentals_of_ada/901_ada_2022_specific.rst +++ b/courses/fundamentals_of_ada/901_ada_2022_specific.rst @@ -15,6 +15,9 @@ Ada 2022 .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/902_future_capabilities.rst b/courses/fundamentals_of_ada/902_future_capabilities.rst index f2b3e3866..3e3af577b 100644 --- a/courses/fundamentals_of_ada/902_future_capabilities.rst +++ b/courses/fundamentals_of_ada/902_future_capabilities.rst @@ -15,6 +15,9 @@ Future Ada Capabilities .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/fundamentals_of_ada/920_reference_material.rst b/courses/fundamentals_of_ada/920_reference_material.rst index 98975f3e1..28e92ab7a 100644 --- a/courses/fundamentals_of_ada/920_reference_material.rst +++ b/courses/fundamentals_of_ada/920_reference_material.rst @@ -15,6 +15,9 @@ Annex - Reference Materials .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnat_project_facility/010_overview.rst b/courses/gnat_project_facility/010_overview.rst index 9d12871af..6bc97c83e 100644 --- a/courses/gnat_project_facility/010_overview.rst +++ b/courses/gnat_project_facility/010_overview.rst @@ -15,6 +15,9 @@ Overview .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnat_project_facility/020_building_with_gprbuild.rst b/courses/gnat_project_facility/020_building_with_gprbuild.rst index 90f1948b0..b14a83a9a 100644 --- a/courses/gnat_project_facility/020_building_with_gprbuild.rst +++ b/courses/gnat_project_facility/020_building_with_gprbuild.rst @@ -15,6 +15,9 @@ Building with GPRbuild .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnat_project_facility/030_project_properties.rst b/courses/gnat_project_facility/030_project_properties.rst index 50cfe63ad..631db768f 100644 --- a/courses/gnat_project_facility/030_project_properties.rst +++ b/courses/gnat_project_facility/030_project_properties.rst @@ -15,6 +15,9 @@ Project Properties .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnat_project_facility/040_structuring_your_application.rst b/courses/gnat_project_facility/040_structuring_your_application.rst index f89bbff7d..72323b8a4 100644 --- a/courses/gnat_project_facility/040_structuring_your_application.rst +++ b/courses/gnat_project_facility/040_structuring_your_application.rst @@ -15,6 +15,9 @@ Structuring Your Application .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnat_project_facility/050_advanced_capabilities.rst b/courses/gnat_project_facility/050_advanced_capabilities.rst index 7a7b88df7..f201afe0b 100644 --- a/courses/gnat_project_facility/050_advanced_capabilities.rst +++ b/courses/gnat_project_facility/050_advanced_capabilities.rst @@ -15,6 +15,9 @@ Advanced Capabilities .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnat_project_facility/060_summary.rst b/courses/gnat_project_facility/060_summary.rst index 7227d29ad..b3554a618 100644 --- a/courses/gnat_project_facility/060_summary.rst +++ b/courses/gnat_project_facility/060_summary.rst @@ -15,6 +15,9 @@ Summary .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatdas/010_overview.rst b/courses/gnatdas/010_overview.rst index d8a37b249..3ecde11f1 100644 --- a/courses/gnatdas/010_overview.rst +++ b/courses/gnatdas/010_overview.rst @@ -15,6 +15,9 @@ Overview .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatdas/cover_010_overview.rst b/courses/gnatdas/cover_010_overview.rst index e61e41cd2..5af2e3b07 100644 --- a/courses/gnatdas/cover_010_overview.rst +++ b/courses/gnatdas/cover_010_overview.rst @@ -15,6 +15,9 @@ GNATcoverage .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatdas/cover_020_basic_workflow.rst b/courses/gnatdas/cover_020_basic_workflow.rst index 803974455..1011d5521 100644 --- a/courses/gnatdas/cover_020_basic_workflow.rst +++ b/courses/gnatdas/cover_020_basic_workflow.rst @@ -15,6 +15,9 @@ Basic Workflow .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatdas/cover_030_advanced_topics.rst b/courses/gnatdas/cover_030_advanced_topics.rst index 82b618dfa..b990796fe 100644 --- a/courses/gnatdas/cover_030_advanced_topics.rst +++ b/courses/gnatdas/cover_030_advanced_topics.rst @@ -15,6 +15,9 @@ Advanced GNATcoverage Capabilities .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatdas/cover_040_gnatstudio.rst b/courses/gnatdas/cover_040_gnatstudio.rst index b675cbcd4..b70f0f56e 100644 --- a/courses/gnatdas/cover_040_gnatstudio.rst +++ b/courses/gnatdas/cover_040_gnatstudio.rst @@ -15,6 +15,9 @@ GNATcoverage From GNAT Studio .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatdas/test_010_overview.rst b/courses/gnatdas/test_010_overview.rst index 05d1c07ca..2853c6d66 100644 --- a/courses/gnatdas/test_010_overview.rst +++ b/courses/gnatdas/test_010_overview.rst @@ -15,6 +15,9 @@ GNATtest .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatdas/test_020_usage.rst b/courses/gnatdas/test_020_usage.rst index 573a96128..689c9b43d 100644 --- a/courses/gnatdas/test_020_usage.rst +++ b/courses/gnatdas/test_020_usage.rst @@ -15,6 +15,9 @@ Usage .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatdas/test_030_controlling_gnattest.rst b/courses/gnatdas/test_030_controlling_gnattest.rst index f786c39c4..2c7206507 100644 --- a/courses/gnatdas/test_030_controlling_gnattest.rst +++ b/courses/gnatdas/test_030_controlling_gnattest.rst @@ -15,6 +15,9 @@ Controlling GNATtest .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatdas/test_040_advanced_testing.rst b/courses/gnatdas/test_040_advanced_testing.rst index 800812caa..862e42fd8 100644 --- a/courses/gnatdas/test_040_advanced_testing.rst +++ b/courses/gnatdas/test_040_advanced_testing.rst @@ -15,6 +15,9 @@ Advanced Testing Techniques .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/010_course_overview.rst b/courses/gnatsas/010_course_overview.rst index 7cd488e6e..cb5b28493 100644 --- a/courses/gnatsas/010_course_overview.rst +++ b/courses/gnatsas/010_course_overview.rst @@ -15,6 +15,9 @@ Overview .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/check_010_overview.rst b/courses/gnatsas/check_010_overview.rst index e7eab82d6..948660390 100644 --- a/courses/gnatsas/check_010_overview.rst +++ b/courses/gnatsas/check_010_overview.rst @@ -15,6 +15,9 @@ .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/check_020_getting_started.rst b/courses/gnatsas/check_020_getting_started.rst index 385bfd506..e6ecb2ad1 100644 --- a/courses/gnatsas/check_020_getting_started.rst +++ b/courses/gnatsas/check_020_getting_started.rst @@ -15,6 +15,9 @@ Getting Started .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/check_030_predefined_rules.rst b/courses/gnatsas/check_030_predefined_rules.rst index a647b3d0b..7a01b46a9 100644 --- a/courses/gnatsas/check_030_predefined_rules.rst +++ b/courses/gnatsas/check_030_predefined_rules.rst @@ -15,6 +15,9 @@ Predefined Rules .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/check_040_lkql.rst b/courses/gnatsas/check_040_lkql.rst index d04db5cb5..c9da24d42 100644 --- a/courses/gnatsas/check_040_lkql.rst +++ b/courses/gnatsas/check_040_lkql.rst @@ -15,6 +15,9 @@ Writing Your Own Rules .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/metric_010_overview.rst b/courses/gnatsas/metric_010_overview.rst index 01a20b02a..c23449fd8 100644 --- a/courses/gnatsas/metric_010_overview.rst +++ b/courses/gnatsas/metric_010_overview.rst @@ -15,6 +15,9 @@ GNAT Metrics Tool .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/sas_010_introduction.rst b/courses/gnatsas/sas_010_introduction.rst index f00974458..7d0d38842 100644 --- a/courses/gnatsas/sas_010_introduction.rst +++ b/courses/gnatsas/sas_010_introduction.rst @@ -15,6 +15,9 @@ GNAT Static Analysis Suite (GNAT SAS) .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/sas_020_overview.rst b/courses/gnatsas/sas_020_overview.rst index f65a4abae..165f14388 100644 --- a/courses/gnatsas/sas_020_overview.rst +++ b/courses/gnatsas/sas_020_overview.rst @@ -15,6 +15,9 @@ GNAT SAS Overview .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/sas_030_analysis.rst b/courses/gnatsas/sas_030_analysis.rst index c50febd56..878e65b5e 100644 --- a/courses/gnatsas/sas_030_analysis.rst +++ b/courses/gnatsas/sas_030_analysis.rst @@ -15,6 +15,9 @@ Analyzing Code .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/sas_040_viewing_results.rst b/courses/gnatsas/sas_040_viewing_results.rst index 9b1722740..430b69266 100644 --- a/courses/gnatsas/sas_040_viewing_results.rst +++ b/courses/gnatsas/sas_040_viewing_results.rst @@ -15,6 +15,9 @@ Viewing Results .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/sas_050_reviewing_messages.rst b/courses/gnatsas/sas_050_reviewing_messages.rst index 21bd14c16..696bb51cb 100644 --- a/courses/gnatsas/sas_050_reviewing_messages.rst +++ b/courses/gnatsas/sas_050_reviewing_messages.rst @@ -15,6 +15,9 @@ Reviewing Results and Improving Code .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/gnatsas/sas_060_tutorial.rst b/courses/gnatsas/sas_060_tutorial.rst index 7640011f8..8b051fdab 100644 --- a/courses/gnatsas/sas_060_tutorial.rst +++ b/courses/gnatsas/sas_060_tutorial.rst @@ -15,6 +15,9 @@ GNAT SAS Tutorial - Step by Step .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/rust_essentials/010_rust_essentials.rst b/courses/rust_essentials/010_rust_essentials.rst index ca9b6b73e..7cfd0efab 100644 --- a/courses/rust_essentials/010_rust_essentials.rst +++ b/courses/rust_essentials/010_rust_essentials.rst @@ -15,6 +15,9 @@ Rust Essentials .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/10_advanced_proof.rst b/courses/spark_for_ada_programmers/10_advanced_proof.rst index 4479f110d..cbb9fb6cf 100644 --- a/courses/spark_for_ada_programmers/10_advanced_proof.rst +++ b/courses/spark_for_ada_programmers/10_advanced_proof.rst @@ -15,6 +15,9 @@ Advanced Proof .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/11_advanced_flow_analysis.rst b/courses/spark_for_ada_programmers/11_advanced_flow_analysis.rst index 93f0903fd..dd27368cd 100644 --- a/courses/spark_for_ada_programmers/11_advanced_flow_analysis.rst +++ b/courses/spark_for_ada_programmers/11_advanced_flow_analysis.rst @@ -15,6 +15,9 @@ Advanced Flow Analysis .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/12_pointer_programs.rst b/courses/spark_for_ada_programmers/12_pointer_programs.rst index c93bde2c1..407ca43d9 100644 --- a/courses/spark_for_ada_programmers/12_pointer_programs.rst +++ b/courses/spark_for_ada_programmers/12_pointer_programs.rst @@ -15,6 +15,9 @@ Pointer Programs .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/13_autoactive_proof.rst b/courses/spark_for_ada_programmers/13_autoactive_proof.rst index 2a3ff614d..936a0a7e6 100644 --- a/courses/spark_for_ada_programmers/13_autoactive_proof.rst +++ b/courses/spark_for_ada_programmers/13_autoactive_proof.rst @@ -15,6 +15,9 @@ Auto-Active Proof .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/14_state_abstraction.rst b/courses/spark_for_ada_programmers/14_state_abstraction.rst index 9e0f46af8..1d835c062 100644 --- a/courses/spark_for_ada_programmers/14_state_abstraction.rst +++ b/courses/spark_for_ada_programmers/14_state_abstraction.rst @@ -15,6 +15,9 @@ State Abstraction .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/15_spark_boundary.rst b/courses/spark_for_ada_programmers/15_spark_boundary.rst index 0c4fe8222..658c897fd 100644 --- a/courses/spark_for_ada_programmers/15_spark_boundary.rst +++ b/courses/spark_for_ada_programmers/15_spark_boundary.rst @@ -15,6 +15,9 @@ SPARK Boundary .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/1_course_overview.rst b/courses/spark_for_ada_programmers/1_course_overview.rst index 8fb285601..abbe2738f 100644 --- a/courses/spark_for_ada_programmers/1_course_overview.rst +++ b/courses/spark_for_ada_programmers/1_course_overview.rst @@ -15,6 +15,9 @@ Course Overview .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/2_formal_methods_and_spark.rst b/courses/spark_for_ada_programmers/2_formal_methods_and_spark.rst index 92382ec2c..b147cb2bd 100644 --- a/courses/spark_for_ada_programmers/2_formal_methods_and_spark.rst +++ b/courses/spark_for_ada_programmers/2_formal_methods_and_spark.rst @@ -15,6 +15,9 @@ Formal Methods and SPARK .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/3_spark_language.rst b/courses/spark_for_ada_programmers/3_spark_language.rst index e8ae03528..97a6f8ec1 100644 --- a/courses/spark_for_ada_programmers/3_spark_language.rst +++ b/courses/spark_for_ada_programmers/3_spark_language.rst @@ -15,6 +15,9 @@ SPARK Language .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/4_spark_tools.rst b/courses/spark_for_ada_programmers/4_spark_tools.rst index d66a92fed..79a6c6802 100644 --- a/courses/spark_for_ada_programmers/4_spark_tools.rst +++ b/courses/spark_for_ada_programmers/4_spark_tools.rst @@ -15,6 +15,9 @@ SPARK Tools .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/5_flow_analysis.rst b/courses/spark_for_ada_programmers/5_flow_analysis.rst index 95afd0db4..1e4b7b4a3 100644 --- a/courses/spark_for_ada_programmers/5_flow_analysis.rst +++ b/courses/spark_for_ada_programmers/5_flow_analysis.rst @@ -15,6 +15,9 @@ Flow Analysis .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/6_proof.rst b/courses/spark_for_ada_programmers/6_proof.rst index 13f557233..6f92ff047 100644 --- a/courses/spark_for_ada_programmers/6_proof.rst +++ b/courses/spark_for_ada_programmers/6_proof.rst @@ -15,6 +15,9 @@ Proof .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/7_specification_language.rst b/courses/spark_for_ada_programmers/7_specification_language.rst index 096641c1e..e34923602 100644 --- a/courses/spark_for_ada_programmers/7_specification_language.rst +++ b/courses/spark_for_ada_programmers/7_specification_language.rst @@ -15,6 +15,9 @@ Specification Language .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/8_subprogram_contracts.rst b/courses/spark_for_ada_programmers/8_subprogram_contracts.rst index b35e5e0b9..2ba28cd9b 100644 --- a/courses/spark_for_ada_programmers/8_subprogram_contracts.rst +++ b/courses/spark_for_ada_programmers/8_subprogram_contracts.rst @@ -15,6 +15,9 @@ Subprogram Contracts .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/990_spark_example_project.rst b/courses/spark_for_ada_programmers/990_spark_example_project.rst index 06c436b1f..da52ebd5a 100644 --- a/courses/spark_for_ada_programmers/990_spark_example_project.rst +++ b/courses/spark_for_ada_programmers/990_spark_example_project.rst @@ -15,6 +15,9 @@ SPARK Example Project .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/spark_for_ada_programmers/9_type_contracts.rst b/courses/spark_for_ada_programmers/9_type_contracts.rst index fb7372c31..95e07c16b 100644 --- a/courses/spark_for_ada_programmers/9_type_contracts.rst +++ b/courses/spark_for_ada_programmers/9_type_contracts.rst @@ -15,6 +15,9 @@ Type Contracts .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/courses/static_analysis_via_compiler/010_static_analysis_via_compiler.rst b/courses/static_analysis_via_compiler/010_static_analysis_via_compiler.rst index bda581fdc..2707a6b8a 100644 --- a/courses/static_analysis_via_compiler/010_static_analysis_via_compiler.rst +++ b/courses/static_analysis_via_compiler/010_static_analysis_via_compiler.rst @@ -15,6 +15,9 @@ Static Analysis Via Compiler .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` diff --git a/support_files/prelude.rst b/support_files/prelude.rst index 17cc17a5c..eff1f1512 100644 --- a/support_files/prelude.rst +++ b/support_files/prelude.rst @@ -11,6 +11,9 @@ .. role:: cpp(code) :language: C++ +.. role:: rust(code) + :language: Rust + .. container:: PRELUDE SYMBOLS .. |rightarrow| replace:: :math:`\rightarrow` From b7b98da514c54ce793b20e5307cd579d4d3d527a Mon Sep 17 00:00:00 2001 From: Michael Frank Date: Tue, 4 Feb 2025 14:26:42 +0000 Subject: [PATCH 03/25] Resolve "Reorganization of some fringe modules" --- ..._in_depth.rst => 240_tasking-in_depth.rst} | 0 ...asking_light.rst => 240_tasking-light.rst} | 0 ...pth.rst => 240_tasking-light_in_depth.rst} | 0 .../260_controlled_types.rst | 249 +----- .../260_controlled_types/01-introduction.rst | 18 + .../02-ada_finalization.rst | 85 ++ .../260_controlled_types/03-example.rst | 123 +++ .../260_controlled_types/99-summary.rst | 14 + .../280_low_level_programming.rst | 785 +----------------- .../01-introduction.rst | 20 + .../02-data_representation.rst | 317 +++++++ .../03-address_clauses_and_overlays.rst | 164 ++++ .../280_low_level_programming/04-tricks.rst | 57 ++ .../07-supplementary_resource_inline_asm.rst | 204 +++++ .../280_low_level_programming/99-summary.rst | 12 + .../290_advanced_data_hiding.rst | 502 +---------- .../01-type_views.rst | 219 +++++ .../02-incomplete_types.rst | 81 ++ .../03-private_library_units.rst | 177 ++++ .../290_advanced_data_hiding/99-summary.rst | 19 + .../fundamentals_of_ada/890_ada_text_io.rst | 276 +----- .../890_ada_text_io/01-introduction.rst | 66 ++ .../890_ada_text_io/02-file_input_output.rst | 87 ++ .../890_ada_text_io/03-type_specific_io.rst | 82 ++ .../890_ada_text_io/04-exceptions.rst | 16 + .../890_ada_text_io/99-summary.rst | 15 + .../891_ada_characters.rst | 150 +--- .../891_ada_characters/01-introduction.rst | 13 + .../02-ada_characters_latin_1.rst | 48 ++ .../03-ada_characters_handling.rst | 65 ++ .../891_ada_characters/99-summary.rst | 15 + .../fundamentals_of_ada/892_ada_strings.rst | 253 +----- .../892_ada_strings/01-introduction.rst | 58 ++ .../892_ada_strings/02-string_operations.rst | 165 ++++ .../892_ada_strings/99-summary.rst | 22 + .../fundamentals_of_ada/893_ada_numerics.rst | 208 +---- .../893_ada_numerics/01-introduction.rst | 38 + .../02-standard_mathematical_functions.rst | 87 ++ .../893_ada_numerics/03-random_numbers.rst | 54 ++ .../893_ada_numerics/99-summary.rst | 20 + .../894_ada_containers.rst | 355 +------- .../894_ada_containers/01-introduction.rst | 24 + .../894_ada_containers/02-container_types.rst | 167 ++++ .../03-containers_operations.rst | 176 ++++ .../894_ada_containers/04-reference.rst | 39 + .../894_ada_containers/99-summary.rst | 20 + courses/fundamentals_of_ada/README.md | 64 +- courses/fundamentals_of_ada/advanced.txt | 2 +- .../labs/260_controlled_types.lab.rst | 4 + .../labs/280_low_level_programming.lab.rst | 4 + .../labs/290_advanced_data_hiding.lab.rst | 34 +- .../labs/890_ada_text_io.lab.rst | 4 + .../labs/891_ada_characters.lab.rst | 4 + .../labs/892_ada_strings.lab.rst | 8 +- .../labs/893_ada_numerics.lab.rst | 4 + .../labs/894_ada_containers.lab.rst | 4 + 56 files changed, 2901 insertions(+), 2796 deletions(-) rename courses/fundamentals_of_ada/{240_tasking_in_depth.rst => 240_tasking-in_depth.rst} (100%) rename courses/fundamentals_of_ada/{240_tasking_light.rst => 240_tasking-light.rst} (100%) rename courses/fundamentals_of_ada/{240_tasking_light_in_depth.rst => 240_tasking-light_in_depth.rst} (100%) create mode 100644 courses/fundamentals_of_ada/260_controlled_types/01-introduction.rst create mode 100644 courses/fundamentals_of_ada/260_controlled_types/02-ada_finalization.rst create mode 100644 courses/fundamentals_of_ada/260_controlled_types/03-example.rst create mode 100644 courses/fundamentals_of_ada/260_controlled_types/99-summary.rst create mode 100644 courses/fundamentals_of_ada/280_low_level_programming/01-introduction.rst create mode 100644 courses/fundamentals_of_ada/280_low_level_programming/02-data_representation.rst create mode 100644 courses/fundamentals_of_ada/280_low_level_programming/03-address_clauses_and_overlays.rst create mode 100644 courses/fundamentals_of_ada/280_low_level_programming/04-tricks.rst create mode 100644 courses/fundamentals_of_ada/280_low_level_programming/07-supplementary_resource_inline_asm.rst create mode 100644 courses/fundamentals_of_ada/280_low_level_programming/99-summary.rst create mode 100644 courses/fundamentals_of_ada/290_advanced_data_hiding/01-type_views.rst create mode 100644 courses/fundamentals_of_ada/290_advanced_data_hiding/02-incomplete_types.rst create mode 100644 courses/fundamentals_of_ada/290_advanced_data_hiding/03-private_library_units.rst create mode 100644 courses/fundamentals_of_ada/290_advanced_data_hiding/99-summary.rst create mode 100644 courses/fundamentals_of_ada/890_ada_text_io/01-introduction.rst create mode 100644 courses/fundamentals_of_ada/890_ada_text_io/02-file_input_output.rst create mode 100644 courses/fundamentals_of_ada/890_ada_text_io/03-type_specific_io.rst create mode 100644 courses/fundamentals_of_ada/890_ada_text_io/04-exceptions.rst create mode 100644 courses/fundamentals_of_ada/890_ada_text_io/99-summary.rst create mode 100644 courses/fundamentals_of_ada/891_ada_characters/01-introduction.rst create mode 100644 courses/fundamentals_of_ada/891_ada_characters/02-ada_characters_latin_1.rst create mode 100644 courses/fundamentals_of_ada/891_ada_characters/03-ada_characters_handling.rst create mode 100644 courses/fundamentals_of_ada/891_ada_characters/99-summary.rst create mode 100644 courses/fundamentals_of_ada/892_ada_strings/01-introduction.rst create mode 100644 courses/fundamentals_of_ada/892_ada_strings/02-string_operations.rst create mode 100644 courses/fundamentals_of_ada/892_ada_strings/99-summary.rst create mode 100644 courses/fundamentals_of_ada/893_ada_numerics/01-introduction.rst create mode 100644 courses/fundamentals_of_ada/893_ada_numerics/02-standard_mathematical_functions.rst create mode 100644 courses/fundamentals_of_ada/893_ada_numerics/03-random_numbers.rst create mode 100644 courses/fundamentals_of_ada/893_ada_numerics/99-summary.rst create mode 100644 courses/fundamentals_of_ada/894_ada_containers/01-introduction.rst create mode 100644 courses/fundamentals_of_ada/894_ada_containers/02-container_types.rst create mode 100644 courses/fundamentals_of_ada/894_ada_containers/03-containers_operations.rst create mode 100644 courses/fundamentals_of_ada/894_ada_containers/04-reference.rst create mode 100644 courses/fundamentals_of_ada/894_ada_containers/99-summary.rst diff --git a/courses/fundamentals_of_ada/240_tasking_in_depth.rst b/courses/fundamentals_of_ada/240_tasking-in_depth.rst similarity index 100% rename from courses/fundamentals_of_ada/240_tasking_in_depth.rst rename to courses/fundamentals_of_ada/240_tasking-in_depth.rst diff --git a/courses/fundamentals_of_ada/240_tasking_light.rst b/courses/fundamentals_of_ada/240_tasking-light.rst similarity index 100% rename from courses/fundamentals_of_ada/240_tasking_light.rst rename to courses/fundamentals_of_ada/240_tasking-light.rst diff --git a/courses/fundamentals_of_ada/240_tasking_light_in_depth.rst b/courses/fundamentals_of_ada/240_tasking-light_in_depth.rst similarity index 100% rename from courses/fundamentals_of_ada/240_tasking_light_in_depth.rst rename to courses/fundamentals_of_ada/240_tasking-light_in_depth.rst diff --git a/courses/fundamentals_of_ada/260_controlled_types.rst b/courses/fundamentals_of_ada/260_controlled_types.rst index b1c4d4598..8954d42ff 100644 --- a/courses/fundamentals_of_ada/260_controlled_types.rst +++ b/courses/fundamentals_of_ada/260_controlled_types.rst @@ -36,249 +36,8 @@ Controlled Types .. container:: PRELUDE END -============== -Introduction -============== - -------------------------- -Constructor / Destructor -------------------------- - -* Possible to specify behavior of object initialization, finalization, and assignment - - - Based on type definition - - Type must derive from `Controlled` or `Limited_Controlled` in package `Ada.Finalization` - -* This derived type is called a *controlled type* - - - User may override any or all subprograms in `Ada.Finalization` - - Default implementation is a null body - -================== -Ada.Finalization -================== - ---------------- -Package Spec ---------------- - -.. code:: Ada - - package Ada.Finalization is - - type Controlled is abstract tagged private; - procedure Initialize (Object : in out Controlled) - is null; - procedure Adjust (Object : in out Controlled) - is null; - procedure Finalize (Object : in out Controlled) - is null; - - type Limited_Controlled is abstract tagged limited private; - procedure Initialize (Object : in out Limited_Controlled) - is null; - procedure Finalize (Object : in out Limited_Controlled) - is null; - - private - -- implementation defined - end Ada.Finalization; - -------- -Uses -------- - -* Prevent "resource leak" - - - Logic centralized in service rather than distributed across clients - -* Examples: heap reclamation, "mutex" unlocking -* User-defined assignment - ----------------- -Initialization ----------------- - -* Subprogram `Initialize` invoked after object created - - - Either by object declaration or allocator - - Only if no explicit initialization expression - -* Often default initialization expressions on record components are sufficient - - - No need for an explicit call to `Initialize` - -* Similar to C++ constructor - ----------------- -Finalization ----------------- - -* Subprogram `Finalize` invoked just before object is destroyed - - - Leaving the scope of a declared object - - Unchecked deallocation of an allocated object - -* Similar to C++ destructor - ------------- -Assignment ------------- - -* Subprogram `Adjust` invoked as part of an assignment operation -* Assignment statement `Target := Source;` is basically: - - - `Finalize (Target)` - - Copy Source to Target - - `Adjust (Target)` - - *Actual rules are more complicated, e.g. to allow cases where Target and Source are the same object* - -* Typical situations where objects are access values - - - `Finalize` does unchecked deallocation or decrements a reference count - - The copy step copies the access value - - `Adjust` either clones a "deep copy" of the referenced object or increments a reference count - -========= -Example -========= - ----------------------------------- -Unbounded String Via Access Type ----------------------------------- - -* Type contains a pointer to a string type -* We want the provider to allocate and free memory "safely" - - - No sharing - - `Adjust` allocates referenced String - - `Finalize` frees the referenced String - - Assignment deallocates target string and assigns copy of source string to target string - ------------------------- -Unbounded String Usage ------------------------- - -.. code:: Ada - - with Unbounded_String_Pkg; use Unbounded_String_Pkg; - procedure Test is - U1 : Ustring_T; - begin - U1 := To_Ustring_T ("Hello"); - declare - U2 : Ustring_T; - begin - U2 := To_Ustring_T ("Goodbye"); - U1 := U2; -- Reclaims U1 memory - end; -- Reclaims U2 memory - end Test; -- Reclaims U1 memory - ------------------------------ -Unbounded String Definition ------------------------------ - -.. code:: Ada - - with Ada.Finalization; use Ada.Finalization; - package Unbounded_String_Pkg is - -- Implement unbounded strings - type Ustring_T is private; - function "=" (L, R : Ustring_T) return Boolean; - function To_Ustring_T (Item : String) return Ustring_T; - function To_String (Item : Ustring_T) return String; - function Length (Item : Ustring_T) return Natural; - function "&" (L, R : Ustring_T) return Ustring_T; - private - type String_Ref is access String; - type Ustring_T is new Controlled with record - Ref : String_Ref := new String (1 .. 0); - end record; - procedure Finalize (Object : in out Ustring_T); - procedure Adjust (Object : in out Ustring_T); - end Unbounded_String_Pkg; - ---------------------------------- -Unbounded String Implementation ---------------------------------- - -.. code:: Ada - - with Ada.Unchecked_Deallocation; - package body Unbounded_String_Pkg is - procedure Free_String is new Ada.Unchecked_Deallocation - (String, String_Ref); - - function "=" (L, R : Ustring_T) return Boolean is - (L.Ref.all = R.Ref.all); - - function To_Ustring_T (Item : String) return Ustring_T is - (Controlled with Ref => new String'(Item)); - - function To_String (Item : Ustring_T) return String is - (Item.Ref.all); - - function Length (Item : Ustring_T) return Natural is - (Item.Ref.all'Length); - - function "&" (L, R : Ustring_T) return Ustring_T is - (Controlled with Ref => new String'(L.Ref.all & R.Ref.all); - - procedure Finalize (Object : in out Ustring_T) is - begin - Free_String (Object.Ref); - end Finalize; - - procedure Adjust (Object : in out Ustring_T) is - begin - Object.Ref := new String'(Object.Ref.all); - end Adjust; - end Unbounded_String_Pkg; - ------------------- -Finalizable Aspect ------------------- - -* Uses the GNAT-specific :ada:`with Finalizable` aspect - -.. code:: Ada - - type Ctrl is record - Id : Natural := 0; - end record - with Finalizable => (Initialize => Initialize, - Adjust => Adjust, - Finalize => Finalize, - Relaxed_Finalization => True); - - procedure Adjust (Obj : in out Ctrl); - procedure Finalize (Obj : in out Ctrl); - procedure Initialize (Obj : in out Ctrl); - -* :ada:`Initialize`, :ada:`Adjust` same definition as previously -* :ada:`Finalize` has the :ada:`No_Raise` aspect: it cannot raise exceptions -* :ada:`Relaxed_Finalization` - - * Performance on-par with C++'s destructor - * No automatic finalization of **heap-allocated** objects - -======== -Lab -======== - +.. include:: 260_controlled_types/01-introduction.rst +.. include:: 260_controlled_types/02-ada_finalization.rst +.. include:: 260_controlled_types/03-example.rst .. include:: labs/260_controlled_types.lab.rst - -========= -Summary -========= - ---------- -Summary ---------- - -* Controlled types allow access to object construction, assignment, destruction -* `Ada.Finalization` can be expensive to use - - - Other mechanisms may be more efficient - - * But require more rigor in usage +.. include:: 260_controlled_types/99-summary.rst diff --git a/courses/fundamentals_of_ada/260_controlled_types/01-introduction.rst b/courses/fundamentals_of_ada/260_controlled_types/01-introduction.rst new file mode 100644 index 000000000..43e8ce2cc --- /dev/null +++ b/courses/fundamentals_of_ada/260_controlled_types/01-introduction.rst @@ -0,0 +1,18 @@ +============== +Introduction +============== + +------------------------- +Constructor / Destructor +------------------------- + +* Possible to specify behavior of object initialization, finalization, and assignment + + - Based on type definition + - Type must derive from `Controlled` or `Limited_Controlled` in package `Ada.Finalization` + +* This derived type is called a *controlled type* + + - User may override any or all subprograms in `Ada.Finalization` + - Default implementation is a null body + diff --git a/courses/fundamentals_of_ada/260_controlled_types/02-ada_finalization.rst b/courses/fundamentals_of_ada/260_controlled_types/02-ada_finalization.rst new file mode 100644 index 000000000..671b94173 --- /dev/null +++ b/courses/fundamentals_of_ada/260_controlled_types/02-ada_finalization.rst @@ -0,0 +1,85 @@ +================== +Ada.Finalization +================== + +--------------- +Package Spec +--------------- + +.. code:: Ada + + package Ada.Finalization is + + type Controlled is abstract tagged private; + procedure Initialize (Object : in out Controlled) + is null; + procedure Adjust (Object : in out Controlled) + is null; + procedure Finalize (Object : in out Controlled) + is null; + + type Limited_Controlled is abstract tagged limited private; + procedure Initialize (Object : in out Limited_Controlled) + is null; + procedure Finalize (Object : in out Limited_Controlled) + is null; + + private + -- implementation defined + end Ada.Finalization; + +------- +Uses +------- + +* Prevent "resource leak" + + - Logic centralized in service rather than distributed across clients + +* Examples: heap reclamation, "mutex" unlocking +* User-defined assignment + +---------------- +Initialization +---------------- + +* Subprogram `Initialize` invoked after object created + + - Either by object declaration or allocator + - Only if no explicit initialization expression + +* Often default initialization expressions on record components are sufficient + + - No need for an explicit call to `Initialize` + +* Similar to C++ constructor + +---------------- +Finalization +---------------- + +* Subprogram `Finalize` invoked just before object is destroyed + + - Leaving the scope of a declared object + - Unchecked deallocation of an allocated object + +* Similar to C++ destructor + +------------ +Assignment +------------ + +* Subprogram `Adjust` invoked as part of an assignment operation +* Assignment statement `Target := Source;` is basically: + + - `Finalize (Target)` + - Copy Source to Target + - `Adjust (Target)` + - *Actual rules are more complicated, e.g. to allow cases where Target and Source are the same object* + +* Typical situations where objects are access values + + - `Finalize` does unchecked deallocation or decrements a reference count + - The copy step copies the access value + - `Adjust` either clones a "deep copy" of the referenced object or increments a reference count + diff --git a/courses/fundamentals_of_ada/260_controlled_types/03-example.rst b/courses/fundamentals_of_ada/260_controlled_types/03-example.rst new file mode 100644 index 000000000..aab34d4ba --- /dev/null +++ b/courses/fundamentals_of_ada/260_controlled_types/03-example.rst @@ -0,0 +1,123 @@ +========= +Example +========= + +---------------------------------- +Unbounded String Via Access Type +---------------------------------- + +* Type contains a pointer to a string type +* We want the provider to allocate and free memory "safely" + + - No sharing + - `Adjust` allocates referenced String + - `Finalize` frees the referenced String + - Assignment deallocates target string and assigns copy of source string to target string + +------------------------ +Unbounded String Usage +------------------------ + +.. code:: Ada + + with Unbounded_String_Pkg; use Unbounded_String_Pkg; + procedure Test is + U1 : Ustring_T; + begin + U1 := To_Ustring_T ("Hello"); + declare + U2 : Ustring_T; + begin + U2 := To_Ustring_T ("Goodbye"); + U1 := U2; -- Reclaims U1 memory + end; -- Reclaims U2 memory + end Test; -- Reclaims U1 memory + +----------------------------- +Unbounded String Definition +----------------------------- + +.. code:: Ada + + with Ada.Finalization; use Ada.Finalization; + package Unbounded_String_Pkg is + -- Implement unbounded strings + type Ustring_T is private; + function "=" (L, R : Ustring_T) return Boolean; + function To_Ustring_T (Item : String) return Ustring_T; + function To_String (Item : Ustring_T) return String; + function Length (Item : Ustring_T) return Natural; + function "&" (L, R : Ustring_T) return Ustring_T; + private + type String_Ref is access String; + type Ustring_T is new Controlled with record + Ref : String_Ref := new String (1 .. 0); + end record; + procedure Finalize (Object : in out Ustring_T); + procedure Adjust (Object : in out Ustring_T); + end Unbounded_String_Pkg; + +--------------------------------- +Unbounded String Implementation +--------------------------------- + +.. code:: Ada + + with Ada.Unchecked_Deallocation; + package body Unbounded_String_Pkg is + procedure Free_String is new Ada.Unchecked_Deallocation + (String, String_Ref); + + function "=" (L, R : Ustring_T) return Boolean is + (L.Ref.all = R.Ref.all); + + function To_Ustring_T (Item : String) return Ustring_T is + (Controlled with Ref => new String'(Item)); + + function To_String (Item : Ustring_T) return String is + (Item.Ref.all); + + function Length (Item : Ustring_T) return Natural is + (Item.Ref.all'Length); + + function "&" (L, R : Ustring_T) return Ustring_T is + (Controlled with Ref => new String'(L.Ref.all & R.Ref.all); + + procedure Finalize (Object : in out Ustring_T) is + begin + Free_String (Object.Ref); + end Finalize; + + procedure Adjust (Object : in out Ustring_T) is + begin + Object.Ref := new String'(Object.Ref.all); + end Adjust; + end Unbounded_String_Pkg; + +------------------ +Finalizable Aspect +------------------ + +* Uses the GNAT-specific :ada:`with Finalizable` aspect + +.. code:: Ada + + type Ctrl is record + Id : Natural := 0; + end record + with Finalizable => (Initialize => Initialize, + Adjust => Adjust, + Finalize => Finalize, + Relaxed_Finalization => True); + + procedure Adjust (Obj : in out Ctrl); + procedure Finalize (Obj : in out Ctrl); + procedure Initialize (Obj : in out Ctrl); + +* :ada:`Initialize`, :ada:`Adjust` same definition as previously +* :ada:`Finalize` has the :ada:`No_Raise` aspect: it cannot raise exceptions +* :ada:`Relaxed_Finalization` + + * Performance on-par with C++'s destructor + * No automatic finalization of **heap-allocated** objects + diff --git a/courses/fundamentals_of_ada/260_controlled_types/99-summary.rst b/courses/fundamentals_of_ada/260_controlled_types/99-summary.rst new file mode 100644 index 000000000..0827dbb51 --- /dev/null +++ b/courses/fundamentals_of_ada/260_controlled_types/99-summary.rst @@ -0,0 +1,14 @@ +========= +Summary +========= + +--------- +Summary +--------- + +* Controlled types allow access to object construction, assignment, destruction +* `Ada.Finalization` can be expensive to use + + - Other mechanisms may be more efficient + + * But require more rigor in usage diff --git a/courses/fundamentals_of_ada/280_low_level_programming.rst b/courses/fundamentals_of_ada/280_low_level_programming.rst index 0b288c6ca..f260c69b5 100644 --- a/courses/fundamentals_of_ada/280_low_level_programming.rst +++ b/courses/fundamentals_of_ada/280_low_level_programming.rst @@ -36,783 +36,10 @@ Low Level Programming .. container:: PRELUDE END -============== -Introduction -============== - --------------- -Introduction --------------- - -* Sometimes you need to get your hands dirty -* Hardware Issues - - - Register or memory access - - Assembler code for speed or size issues - -* Interfacing with other software - - - Object sizes - - Endianness - - Data conversion - -===================== -Data Representation -===================== - -------------------------------------- -Data Representation Vs Requirements -------------------------------------- - -* Developer usually defines requirements on a type - - .. code:: Ada - - type My_Int is range 1 .. 10; - -* The compiler then generates a representation for this type that can accommodate requirements - - - In GNAT, can be consulted using ``-gnatR2`` switch - -.. code:: Ada - - -- with aspects - type Some_Integer_T is range 1 .. 10 - with Object_Size => 8, - Value_Size => 4, - Alignment => 1; - - -- with representation clauses - type Another_Integer_T is range 1 .. 10; - for Another_Integer_T'Object_Size use 8; - for Another_Integer_T'Value_Size use 4; - for Another_Integer_T'Alignment use 1; - -* These values can be explicitly set, the compiler will check their consistency -* They can be queried as attributes if needed - - .. code:: Ada - - X : Integer := My_Int'Alignment; - ---------------------- -Value_Size / Size ---------------------- - -* :ada:`Value_Size` (or :ada:`Size` in the Ada Reference Manual) is the minimal number of bits required to represent data - - - For example, :ada:`Boolean'Size = 1` - -* The compiler is allowed to use larger size to represent an actual object, but will check that the minimal size is enough - -.. code:: Ada - - -- with aspect - type Small_T is range 1 .. 4 - with Size => 3; - - -- with representation clause - type Another_Small_T is range 1 .. 4; - for Another_Small_T'Size use 3; - ------------------------------ -Object Size (GNAT-Specific) ------------------------------ - -* :ada:`Object_Size` represents the size of the object in memory -* It must be a multiple of :ada:`Alignment * Storage_Unit (8)`, and at least equal to :ada:`Size` - -.. code:: Ada - - -- with aspects - type Some_T is range 1 .. 4 - with Value_Size => 3, - Object_Size => 8; - - -- with representation clauses - type Another_T is range 1 .. 4; - for Another_T'Value_Size use 3; - for Another_T'Object_Size use 8; - -* Object size is the *default* size of an object, can be changed if specific representations are given - ------------ -Alignment ------------ - -* Number of bytes on which the type has to be aligned -* Some alignment may be more efficient than others in terms of speed (e.g. boundaries of words (4, 8)) -* Some alignment may be more efficient than others in terms of memory usage - -.. code:: Ada - - -- with aspects - type Aligned_T is range 1 .. 4 - with Size => 4, - Alignment => 8; - - -- with representation clauses - type Another_Aligned_T is range 1 .. 4; - for Another_Aligned_T'Size use 4; - for Another_Aligned_T'Alignment use 8; - --------------- -Record Types --------------- - -.. container:: columns - - .. container:: column - - * Ada doesn't force any particular memory layout - * Depending on optimization of constraints, layout can be optimized for speed, size, or not optimized - - .. code:: Ada - - type Enum is (E1, E2, E3); - type Rec is record - A : Integer; - B : Boolean; - C : Boolean; - D : Enum; - end record; - - .. container:: column - - .. image:: record_packing_examples.png - :width: 50% - -------------- -Pack Aspect -------------- - -* :ada:`Pack` aspect (or pragma) applies to composite types (record and array) -* Compiler optimizes data for size no matter performance impact -* Unpacked - - .. code:: Ada - - type Enum is (E1, E2, E3); - type Rec is record - A : Integer; - B : Boolean; - C : Boolean; - D : Enum; - end record; - type Ar is array (1 .. 1000) of Boolean; - -- Rec'Size is 56, Ar'Size is 8000 - -* Packed - - .. code:: Ada - - type Enum is (E1, E2, E3); - type Rec is record - A : Integer; - B : Boolean; - C : Boolean; - D : Enum; - end record with Pack; - type Ar is array (1 .. 1000) of Boolean; - pragma Pack (Ar); - -- Rec'Size is 36, Ar'Size is 1000 - -------------------------------- -Enum Representation Clauses -------------------------------- - -* Can specify representation for each value -* Representation must have increasing number - -.. code:: Ada - - type E is (A, B, C); - for E use (A => 2, B => 4, C => 8); - -* Can use :ada:`E'Enum_Rep (A) = 2` -* Can use :ada:`E'Enum_Val (2) = A` - -------------------------------- -Record Representation Clauses -------------------------------- - -.. container:: columns - - .. container:: column - - * Exact mapping between a record and its binary representation - * Optimization purposes, or hardware requirements - - - Driver mapped on the address space, communication protocol... - - * Fields represented as - - .. code:: Ada - - at range - .. - - - .. container:: column - - .. code:: Ada - - type Rec1 is record - A : Integer range 0 .. 4; - B : Boolean; - C : Integer; - D : Enum; - end record; - for Rec1 use record - A at 0 range 0 .. 2; - B at 0 range 3 .. 3; - C at 0 range 4 .. 35; - -- unused space here - D at 5 range 0 .. 2; - end record; - ------------------- -Unchecked Unions ------------------- - -* Allows replicating C's :c:`union` with **discriminated** records -* Discriminant is **not stored** -* No discriminant check -* Object must be **mutable** - -.. code:: Ada - - type R (Is_Float : Boolean := False) is record - case Is_Float is - when True => - F : Float; - when False => - I : Integer; - end case; - end record - with Unchecked_Union; - - O : R := (Is_Float => False, I => 1); - F : Float := R.F; -- no check! - ------------------------------- -Array Representation Clauses ------------------------------- - -* :ada:`Component_Size` for array's **component's** size - -.. code:: Ada - - -- with aspect - type Array_T is array (1 .. 1000) of Boolean - with Component_Size => 2; - - -- with representation clause - type Another_Array_T is array (1 .. 1000) of Boolean; - for Another_Array_T'Component_Size use 2; - --------------------------- -Endianness Specification --------------------------- - -* :ada:`Bit_Order` for a type's endianness -* :ada:`Scalar_Storage_Order` for composite types - - - Endianess of components' ordering - - GNAT-specific - - Must be consistent with :ada:`Bit_Order` - -* Compiler will peform needed bitwise transformations when performing operations - -.. code:: Ada - - -- with aspect - type Array_T is array (1 .. 1000) of Boolean with - Scalar_Storage_Order => System.Low_Order_First; - - -- with representation clauses - type Record_T is record - A : Integer; - B : Boolean; - end record; - for Record_T use record - A at 0 range 0 .. 31; - B at 0 range 32 .. 33; - end record; - for Record_T'Bit_Order use System.High_Order_First; - for Record_T'Scalar_Storage_Order use System.High_Order_First; - --------------------------- -Change of Representation --------------------------- - -* Explicit new type can be used to set representation -* Very useful to unpack data from file/hardware to speed up references - -.. code:: Ada - - type Rec_T is record - Field1 : Unsigned_8; - Field2 : Unsigned_16; - Field3 : Unsigned_8; - end record; - type Packed_Rec_T is new Rec_T; - for Packed_Rec_T use record - Field1 at 0 range 0 .. 7; - Field2 at 0 range 8 .. 23; - Field3 at 0 range 24 .. 31; - end record; - R : Rec_T; - P : Packed_Rec_T; - ... - R := Rec_T (P); - P := Packed_Rec_T (R); - -.. container:: speakernote - - Size of R is probably 48 (for 16-bit alignment) or 96 (for 32-bit alignment) - Size of P will always be 32 - -============================== -Address Clauses and Overlays -============================== - ---------- -Address ---------- - -* Ada distinguishes the notions of - - - A reference to an object - - An abstract notion of address (:ada:`System.Address`) - - The integer representation of an address - -* Safety is preserved by letting the developer manipulate the right level of abstraction -* Conversion between pointers, integers and addresses are possible -* The address of an object can be specified through the :ada:`Address` aspect - ------------------ -Address Clauses ------------------ - -* Ada allows specifying the address of an entity - - .. code:: Ada - - Use_Aspect : Unsigned_32 with - Address => 16#1234_ABCD#; - - Use_Rep_Clause : Unsigned_32; - for Use_Rep_Clause'Address use 16#5678_1234#; - -* Very useful to declare I/O registers - - - For that purpose, the object should be declared volatile: - - .. code:: Ada - - Use_Aspect : Unsigned_32 with - Volatile, - Address => 16#1234_ABCD#; - - Use_Rep_And_Pragma : Unsigned_32; - for Use_Rep_And_Pragma'Address use 16#5678_1234#; - pragma Volatile (Use_Rep_And_Pragma); - -* Useful to read a value anywhere - - .. code:: Ada - - function Get_Byte (Addr : Address) return Unsigned_8 is - V : Unsigned_8 with Address => Addr, Volatile; - begin - return V; - end; - - - In particular the address doesn't need to be constant - - But must match alignment - ----------------- -Address Values ----------------- - -* The type :ada:`Address` is declared in :ada:`System` - - - But this is a :ada:`private` type - - You cannot use a number - -* Ada standard way to set constant addresses: - - - Use :ada:`System.Storage_Elements` which allows arithmetic on address - - .. code:: Ada - - V : Unsigned_32 with - Address => - System.Storage_Elements.To_Address (16#120#); - -* GNAT specific attribute :ada:`'To_Address` - - - Handy but not portable - - .. code:: Ada - - V : Unsigned_32 with - Address => System'To_Address (16#120#); - ----------- -Volatile ----------- - -* The :ada:`Volatile` property can be set using an aspect or a pragma -* Ada also allows volatile types as well as objects - - .. code:: Ada - - type Volatile_U32 is mod 2**32 with Volatile; - type Volatile_U16 is mod 2**16; - pragma Volatile (Volatile_U16); - -* The exact sequence of reads and writes from the source code must appear in the generated code - - - No optimization of reads and writes - -* Volatile types are passed by-reference - ---------------------- -Ada Address Example ---------------------- - -.. code:: Ada - - type Bit_Array_T is array (Integer range <>) of Boolean - with Component_Size => 1; - - -- objects can be referenced elsewhere - Object : aliased Integer with Volatile; - Object2 : aliased Integer with Volatile; - - Object_A : System.Address := Object'Address; - Object_I : Integer_Address := To_Integer (Object_A); - - -- This overlays Bit_Array_Object onto Object in memory - Bit_Array_Object : aliased Bit_Array_T (1 .. Object'Size) - with Address => Object_A; - - Object2_Alias : aliased Integer - -- Trust me, I know what I'm doing, this is Object2 - with Address => To_Address (Object_I - 4); - --------------------- -Aliasing Detection --------------------- - -* :dfn:`Aliasing`: multiple objects are accessing the same address - - - Types can be different - - Two pointers pointing to the same address - - Two references onto the same address - - Two objects at the same address - -* :ada:`Var1'Has_Same_Storage (Var2)` checks if two objects occupy exactly the same space -* :ada:`Var'Overlaps_Storage (Var2)` checks if two object are partially or fully overlapping - ----------------------- -Unchecked Conversion ----------------------- - -* :ada:`Unchecked_Conversion` allows an unchecked *bitwise* conversion of data between two types -* Needs to be explicitly instantiated - - .. code:: Ada - - type Bitfield is array (1 .. Integer'Size) of Boolean; - function To_Bitfield is new - Ada.Unchecked_Conversion (Integer, Bitfield); - V : Integer; - V2 : Bitfield := To_Bitfield (V); - -* Avoid conversion if the sizes don't match - - - Not defined by the standard - - Many compilers will warn if the type sizes do not match - -======== -Tricks -======== - --------------------- -Package Interfaces --------------------- - -* Package :ada:`Interfaces` provide Integer and unsigned types for many sizes - - - :ada:`Integer_8`, :ada:`Integer_16`, :ada:`Integer_32`, :ada:`Integer_64` - - :ada:`Unsigned_8`, :ada:`Unsigned_16`, :ada:`Unsigned_32`, :ada:`Unsigned_64` - -* With shift/rotation functions for unsigned types - ------------------------------- -Fat/Thin Pointers for Arrays ------------------------------- - -* Unconstrained array access is a fat pointer - - .. code:: Ada - - type String_Acc is access String; - Msg : String_Acc; - -- array bounds stored outside array pointer - -* Use a size representation clause for a thin pointer - - .. code:: Ada - - type String_Acc is access String; - for String_Acc'Size use 32; - -- array bounds stored as part of array pointer - -------------- -Flat Arrays -------------- - -* A constrained array access is a thin pointer - - - No need to store bounds - - .. code:: Ada - - type Line_Acc is access String (1 .. 80); - -* You can use big flat array to index memory - - - See :ada:`GNAT.Table` - - Not portable - - .. code:: Ada - - type Char_array is array (natural) of Character; - type C_String_Acc is access Char_Array; - -======== -Lab -======== - +.. include:: 280_low_level_programming/01-introduction.rst +.. include:: 280_low_level_programming/02-data_representation.rst +.. include:: 280_low_level_programming/03-address_clauses_and_overlays.rst +.. include:: 280_low_level_programming/04-tricks.rst .. include:: labs/280_low_level_programming.lab.rst - -========= -Summary -========= - ---------- -Summary ---------- - -* Like C, Ada allows access to assembly-level programming -* Unlike C, Ada imposes some more restrictions to maintain some level of safety -* Ada also supplies language constructs and libraries to make low level programming easier - -================================== -Supplementary Resource: Inline ASM -================================== - ------------------------ -Calling Assembly Code ------------------------ - -* Calling assembly code is a vendor-specific extension -* GNAT allows passing assembly with :ada:`System.Machine_Code.ASM` - - - Handled by the linker directly - -* The developer is responsible for mapping variables on temporaries or registers -* See documentation - - - GNAT RM 13.1 Machine Code Insertion - - GCC UG 6.39 Assembler Instructions with C Expression Operands - ------------------- -Simple Statement ------------------- - -* Instruction without inputs/outputs - - .. code:: Ada - - Asm ("halt", Volatile => True); - - - You may specify :ada:`Volatile` to avoid compiler optimizations - - In general, keep it False unless it created issues - -* You can group several instructions - - .. code:: Ada - - Asm ("nop" & ASCII.LF & ASCII.HT - & "nop", Volatile => True); - Asm ("nop; nop", Volatile => True); - -* The compiler doesn't check the assembly, only the assembler will - - - Error message might be difficult to read - ----------- -Operands ----------- - -* It is often useful to have inputs or outputs... - - - :ada:`Asm_Input` and :ada:`Asm_Output` attributes on types - -.. image:: annotated_assembly_statement.png - :width: 85% - ------------------------------------------ -Mapping Inputs / Outputs on Temporaries ------------------------------------------ - -.. code:: Ada - - Asm (