diff --git a/courses/fundamentals_of_ada/050_array_types/01-introduction.rst b/courses/fundamentals_of_ada/050_array_types/01-introduction.rst index 326c003ee..ed4608503 100644 --- a/courses/fundamentals_of_ada/050_array_types/01-introduction.rst +++ b/courses/fundamentals_of_ada/050_array_types/01-introduction.rst @@ -2,9 +2,38 @@ Introduction ============== --------------- -Introduction --------------- +------------------- +What Is an Array? +------------------- + +* Definition: collection of components of the same type, stored in contiguous memory, and indexed using a discrete range + +* Syntax (simplified): + +.. container:: latex_environment small + + :ada:`type is array (Index_Type) of Component_Type;` + +where + + * :dfn:`Index_Type` + + - Discrete range of values to be used to access the array components + + * :dfn:`Component_Type` + + - Type of values stored in the array + - All components are of this same type and size + +.. code:: Ada + + type Array_T is array (0 .. 3) of Interfaces.Integer_32; + +.. image:: array_diagram.svg + +--------------- +Arrays in Ada +--------------- * Traditional array concept supported to any dimension @@ -19,23 +48,6 @@ Introduction ... Workdays (Mon) := 8.5; -------------- -Terminology -------------- - -* :dfn:`Index type` - - - Specifies the values to be used to access the array components - -* :dfn:`Component type` - - - Specifies the type of values contained by objects of the array type - - All components are of this same type - -.. code:: Ada - - type Array_T is array (Index_T) of Component_T; - ------------------------------ Array Type Index Constraints ------------------------------ diff --git a/images/array_diagram.svg b/images/array_diagram.svg new file mode 100644 index 000000000..a1eaa94a3 --- /dev/null +++ b/images/array_diagram.svg @@ -0,0 +1,409 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 16 + 32 + 48 + 64 + + + + + + 0 + 1 + 2 + 3 + -123 + 456 + -78 + 90 + Index + Components + Address offset + + diff --git a/support_files/beamercolorthemeadacore.sty b/support_files/beamercolorthemeadacore.sty index 8a84c457d..46e1cda48 100644 --- a/support_files/beamercolorthemeadacore.sty +++ b/support_files/beamercolorthemeadacore.sty @@ -9,9 +9,9 @@ \mode -\definecolor{adacore1}{RGB}{18,40,76} %% lovelace blue -\definecolor{adacore2}{RGB}{224,124,0} %% orange -\definecolor{adacore3}{RGB}{185,198,215} %% light blue +\definecolor{adacore1}{RGB}{18,40,76} %% lovelace blue #12284c +\definecolor{adacore2}{RGB}{224,124,0} %% orange #e07c00 +\definecolor{adacore3}{RGB}{185,198,215} %% light blue #b9c6d7 \definecolor{lightyellow}{RGB}{240,230,160} \setbeamercolor*{palette primary}{fg=adacore1,bg=adacore3}