From 474bf41af4adf40f9639fc8d1bd3a81602482af5 Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Mon, 24 Feb 2025 16:12:09 -0500 Subject: [PATCH 1/6] Replace occorrences of "element" with "component" Except when used as part of Ada RT calls (No occurrences of "field" found) --- .../10_advanced_proof.rst | 42 +++++++++---------- .../14_state_abstraction.rst | 10 ++--- courses/spark_for_ada_programmers/6_proof.rst | 6 +-- .../7_specification_language.rst | 22 +++++----- .../labs/10_advanced_proof.lab.rst | 2 +- .../labs/6_proof.lab.rst | 2 +- .../13_autoactive_proof/answer1/sort.adb | 2 +- .../13_autoactive_proof/answer2/sort.adb | 2 +- .../string_fixed.adb | 2 +- .../string_fixed.ads | 2 +- .../labs/source/13_autoactive_proof/sort.adb | 2 +- .../string_fixed.adb | 2 +- .../string_fixed.ads | 2 +- 13 files changed, 49 insertions(+), 49 deletions(-) diff --git a/courses/spark_for_ada_programmers/10_advanced_proof.rst b/courses/spark_for_ada_programmers/10_advanced_proof.rst index cbb9fb6cf..c612979f9 100644 --- a/courses/spark_for_ada_programmers/10_advanced_proof.rst +++ b/courses/spark_for_ada_programmers/10_advanced_proof.rst @@ -459,12 +459,12 @@ Classical Loop Invariants * Known best loop invariants for some loops - Initialization loops - initialize the collection - - Mapping loops - map each element of the collection - - Validation loops - check each element of the collection - - Counting loops - count elements with a property - - Search loops - search element with a property - - Maximize loops - search element that maximizes a property - - Update loops - update each element of the collection + - Mapping loops - map each component of the collection + - Validation loops - check each component of the collection + - Counting loops - count components with a property + - Search loops - search component with a property + - Maximize loops - search component that maximizes a property + - Update loops - update each component of the collection | @@ -596,11 +596,11 @@ Bounded Formal Containers - Discriminant :ada:`Capacity` fixes maximum size -* Element type must have known size (:dfn:`definite` type) +* Component type must have known size (:dfn:`definite` type) * Container type itself is definite - - Bounded container can be element of another formal container + - Bounded container can be component of another formal container ----------------------------- Unbounded Formal Containers @@ -612,16 +612,16 @@ Unbounded Formal Containers * Use dynamic memory allocation - - For each element in the container + - For each component in the container - For growing the container * Use controlled types for dynamic memory reclamation -* Element type may have unknown size (:dfn:`indefinite` type) +* Component type may have unknown size (:dfn:`indefinite` type) * Container type itself is definite - - Unbounded container can be element of another formal container + - Unbounded container can be component of another formal container ------------------------------ Loops Over Formal Containers @@ -645,7 +645,7 @@ Loops Over Formal Containers V.Replace_Element (J, 0); end loop; -* Iteration over elements (no update!) +* Iteration over components (no update!) .. code:: ada @@ -670,13 +670,13 @@ Loop Invariants Over Formal Containers + Functional model of the container + Mapping from cursors to positions - + Sequence of elements/keys of the container + + Sequence of components/keys of the container | -* Iteration over elements +* Iteration over components - - Impossible to access previous elements + - Impossible to access previous components - Use iteration over positions instead ----------------------------------- @@ -696,16 +696,16 @@ Formal Model of Formal Containers - Given by function :ada:`Model` - Returns a different type - + A sequence of elements for formal lists - + A set of elements for formal sets - + A map from keys to elements for maps + + A sequence of components for formal lists + + A set of components for formal sets + + A map from keys to components for maps * Mapping from cursors to positions - Given by function :ada:`Positions` - Positions in the iteration sequence -* Sequence of elements/keys of the container +* Sequence of components/keys of the container - Corresponds to the iteration sequence - Given by different functions @@ -732,7 +732,7 @@ Difficulties with Loops Over Formal Containers * Container structure may be modified in the loop - - When inserting or deleting elements + - When inserting or deleting components - In general, need to know position of corresponding cursor + Relative to current cursor: e.g. previous/next cursor @@ -756,7 +756,7 @@ Functional Containers - No bounds on cardinality - No cursors for iteration - - No order of elements in sets and maps + - No order of components in sets and maps - Functional: cannot modify them, rather create a new one * They are easy to handle for proof diff --git a/courses/spark_for_ada_programmers/14_state_abstraction.rst b/courses/spark_for_ada_programmers/14_state_abstraction.rst index 1d835c062..6a57c8e4d 100644 --- a/courses/spark_for_ada_programmers/14_state_abstraction.rst +++ b/courses/spark_for_ada_programmers/14_state_abstraction.rst @@ -283,7 +283,7 @@ Constants with Variable Input Refined_State => (The_Stack => (Content, Top, Max)) is Max : constant Natural := External_Variable; - Content : Element_Array (1 .. Max); + Content : Component_Array (1 .. Max); Top : Natural; -- Max has variable input. It must appear as a -- constituent of The_Stack @@ -308,14 +308,14 @@ Data Dependencies package Stack with Abstract_State => (Top_State, Content_State) is - procedure Pop (E : out Element) with + procedure Pop (E : out Component) with Global => (Input => Content_State, In_Out => Top_State); package Stack with Abstract_State => The_Stack is - procedure Pop (E : out Element) with + procedure Pop (E : out Component) with Global => (In_Out => The_Stack); ------------------- @@ -329,14 +329,14 @@ Flow Dependencies package Stack with Abstract_State => (Top_State, Content_State) is - procedure Pop (E : out Element) with + procedure Pop (E : out Component) with Depends => (Top_State => Top_State, E => (Content_State, Top_State)); package Stack with Abstract_State => The_Stack is - procedure Pop (E : out Element) with + procedure Pop (E : out Component) with Depends => ((The_Stack, E) => The_Stack); ----------------------- diff --git a/courses/spark_for_ada_programmers/6_proof.rst b/courses/spark_for_ada_programmers/6_proof.rst index 6f92ff047..f4abfd921 100644 --- a/courses/spark_for_ada_programmers/6_proof.rst +++ b/courses/spark_for_ada_programmers/6_proof.rst @@ -219,8 +219,8 @@ Run-Time Errors Are Pervasive * ``I+J`` might overflow the base type of the index range's subtype * ``I+J`` might be outside the index range's subtype - * ``P/Q`` might overflow the base type of the element type - * ``P/Q`` might be outside the element subtype + * ``P/Q`` might overflow the base type of the component type + * ``P/Q`` might be outside the component subtype * ``Q`` might be zero ------------------------------- @@ -593,7 +593,7 @@ Cost/Benefit Analysis * Not all provable properties are worth proving! * Difficulty of proof (cost) not correlated with benefit -* e.g. proving that a sorting algorithm preserves the elements +* e.g. proving that a sorting algorithm preserves the components - Trivial by review if the only operation is :ada:`Swap` - May require many **annotations** for proof diff --git a/courses/spark_for_ada_programmers/7_specification_language.rst b/courses/spark_for_ada_programmers/7_specification_language.rst index e34923602..4e044bcfe 100644 --- a/courses/spark_for_ada_programmers/7_specification_language.rst +++ b/courses/spark_for_ada_programmers/7_specification_language.rst @@ -73,7 +73,7 @@ Simple Expressions Pre => T'Length > 0, Post => -- if T is of length 1 ... -- else if T is of length 2 ... - -- else for all elements ... + -- else for all components ... -------------------- Richer Expressions @@ -86,8 +86,8 @@ Richer Expressions * Expressions over a **collection** (range or array or...) - - *universally quantified expression* for properties over **all** elements - - *existentially quantified expression* for properties over **one** element + - *universally quantified expression* for properties over **all** components + - *existentially quantified expression* for properties over **one** component * New forms of **aggregates** @@ -255,7 +255,7 @@ General Iteration Mechanism type Container is private with Iterable => (First => First, Next => Next, - Has_Element => Has_Element + Has_Element => Element Element => Element); * :dfn:`Iteration over positions` uses :ada:`for .. in` syntax @@ -263,10 +263,10 @@ General Iteration Mechanism - Uses cursor type with :ada:`First`, :ada:`Next` and :ada:`Has_Element` - Function :ada:`Element` is **not** required -* :dfn:`Iteration over elements` uses :ada:`for .. of` syntax +* :dfn:`Iteration over components` uses :ada:`for .. of` syntax - Based on the previous iteration - - Function :ada:`Element` retrieves the **element** for a given cursor + - Function :ada:`Element` retrieves the **component** for a given cursor ---------------------------------- Iteration Over Formal Containers @@ -286,14 +286,14 @@ Iteration Over Formal Containers * Iteration over positions - - Access to **element** through function :ada:`Element` + - Access to **component** through function :ada:`Element` - For maps, access to **key** through function :ada:`Key` -* Iteration over elements +* Iteration over components - For maps, really an iteration over **keys** - - Use another function :ada:`Element` to get **element** + - Use another function :ada:`Element` to get **component** ------------------------------- Iteration Over Formal Vectors @@ -308,7 +308,7 @@ Iteration Over Formal Vectors V.Replace_Element (J, 0); end loop; pragma Assert - (for all J in V.First_Index .. V.Last_Index => V.Element (J) = 0); + (for all J in V.First_Index .. V.Last_Index => V.Component (J) = 0); * Iteration over positions @@ -319,7 +319,7 @@ Iteration Over Formal Vectors end loop; pragma Assert (for all J in V => V.Element (J) = 0); -* Iteration over elements (**no update**!) +* Iteration over components (**no update**!) .. code:: ada diff --git a/courses/spark_for_ada_programmers/labs/10_advanced_proof.lab.rst b/courses/spark_for_ada_programmers/labs/10_advanced_proof.lab.rst index cc061e2f4..30eca8739 100644 --- a/courses/spark_for_ada_programmers/labs/10_advanced_proof.lab.rst +++ b/courses/spark_for_ada_programmers/labs/10_advanced_proof.lab.rst @@ -78,4 +78,4 @@ Formal Container Loops - Add a loop invariant in :ada:`Init_List` + Hint: the position of cursor :ada:`Cu` in :ada:`L` is :ada:`Positions (L).Get (Cu)` - + Hint: the sequence of elements for :ada:`L` is :ada:`Model (L)` + + Hint: the sequence of components for :ada:`L` is :ada:`Model (L)` diff --git a/courses/spark_for_ada_programmers/labs/6_proof.lab.rst b/courses/spark_for_ada_programmers/labs/6_proof.lab.rst index 79351e9d1..8ddc7e123 100644 --- a/courses/spark_for_ada_programmers/labs/6_proof.lab.rst +++ b/courses/spark_for_ada_programmers/labs/6_proof.lab.rst @@ -67,7 +67,7 @@ Functional Specifications (2/2) (depending on the value of the discriminant) is 1. - Add similarly a postcondition to procedures :ada:`Init_The_Table` and - :ada:`Init_Table` stating that the value of the first and last elements + :ada:`Init_Table` stating that the value of the first and last components are 1 and 2. + Hint: you may have to strengthen the precondition of :ada:`Init_Table`. diff --git a/courses/spark_for_ada_programmers/labs/answers/13_autoactive_proof/answer1/sort.adb b/courses/spark_for_ada_programmers/labs/answers/13_autoactive_proof/answer1/sort.adb index 82c8c1b3a..9e0511c36 100644 --- a/courses/spark_for_ada_programmers/labs/answers/13_autoactive_proof/answer1/sort.adb +++ b/courses/spark_for_ada_programmers/labs/answers/13_autoactive_proof/answer1/sort.adb @@ -23,7 +23,7 @@ package body Sort is Permutation (Y) := Temp_Index; end Swap; - -- Finds the index of the smallest element in the slice Values (From .. To) + -- Finds the index of the smallest component in the slice Values (From .. To) function Index_Of_Minimum (Values : Nat_Array; From, To : Index) return Index with Pre => To in From .. Values'Last, diff --git a/courses/spark_for_ada_programmers/labs/answers/13_autoactive_proof/answer2/sort.adb b/courses/spark_for_ada_programmers/labs/answers/13_autoactive_proof/answer2/sort.adb index 695889ff3..ba083782b 100644 --- a/courses/spark_for_ada_programmers/labs/answers/13_autoactive_proof/answer2/sort.adb +++ b/courses/spark_for_ada_programmers/labs/answers/13_autoactive_proof/answer2/sort.adb @@ -45,7 +45,7 @@ package body Sort is Prove_Perm; end Swap; - -- Finds the index of the smallest element in the array + -- Finds the index of the smallest component in the array function Index_Of_Minimum (Values : Nat_Array; From, To : Index) return Index with Pre => To in From .. Values'Last, diff --git a/courses/spark_for_ada_programmers/labs/answers/990_spark_example_project/string_fixed.adb b/courses/spark_for_ada_programmers/labs/answers/990_spark_example_project/string_fixed.adb index ecb72dcaa..bf5600602 100644 --- a/courses/spark_for_ada_programmers/labs/answers/990_spark_example_project/string_fixed.adb +++ b/courses/spark_for_ada_programmers/labs/answers/990_spark_example_project/string_fixed.adb @@ -17,7 +17,7 @@ package body String_Fixed with SPARK_Mode is when Inside => Belongs'Result = Is_In (Element, Set), when Outside => Belongs'Result = not Is_In (Element, Set)); pragma Inline (Belongs); - -- Determines if the given element is in (Test = Inside) or not in + -- Determines if the given component is in (Test = Inside) or not in -- (Test = Outside) the given character set. ------------- diff --git a/courses/spark_for_ada_programmers/labs/answers/990_spark_example_project/string_fixed.ads b/courses/spark_for_ada_programmers/labs/answers/990_spark_example_project/string_fixed.ads index 9f6eee406..30e76360a 100644 --- a/courses/spark_for_ada_programmers/labs/answers/990_spark_example_project/string_fixed.ads +++ b/courses/spark_for_ada_programmers/labs/answers/990_spark_example_project/string_fixed.ads @@ -341,7 +341,7 @@ is Post => "*"'Result'Length = Left and then (for all E of "*"'Result => E = Right); -- This function replicates a character a specified number of times. It - -- returns a string whose length is Left and each of whose elements is + -- returns a string whose length is Left and each of whose components is -- Right. end String_Fixed; diff --git a/courses/spark_for_ada_programmers/labs/source/13_autoactive_proof/sort.adb b/courses/spark_for_ada_programmers/labs/source/13_autoactive_proof/sort.adb index 90bc99cd9..ea53214e7 100644 --- a/courses/spark_for_ada_programmers/labs/source/13_autoactive_proof/sort.adb +++ b/courses/spark_for_ada_programmers/labs/source/13_autoactive_proof/sort.adb @@ -10,7 +10,7 @@ package body Sort is Values (Y) := Temp; end Swap; - -- Finds the index of the smallest element in the slice Values (From .. To) + -- Finds the index of the smallest component in the slice Values (From .. To) function Index_Of_Minimum (Values : Nat_Array; From, To : Index) return Index is Min : Index := From; begin diff --git a/courses/spark_for_ada_programmers/labs/source/990_spark_example_project/string_fixed.adb b/courses/spark_for_ada_programmers/labs/source/990_spark_example_project/string_fixed.adb index 66ebf86e6..01c6d498b 100644 --- a/courses/spark_for_ada_programmers/labs/source/990_spark_example_project/string_fixed.adb +++ b/courses/spark_for_ada_programmers/labs/source/990_spark_example_project/string_fixed.adb @@ -13,7 +13,7 @@ package body String_Fixed with SPARK_Mode is Set : Maps.Character_Set; Test : Membership) return Boolean; pragma Inline (Belongs); - -- Determines if the given element is in (Test = Inside) or not in + -- Determines if the given component is in (Test = Inside) or not in -- (Test = Outside) the given character set. ------------- diff --git a/courses/spark_for_ada_programmers/labs/source/990_spark_example_project/string_fixed.ads b/courses/spark_for_ada_programmers/labs/source/990_spark_example_project/string_fixed.ads index 33d177573..65f639b60 100644 --- a/courses/spark_for_ada_programmers/labs/source/990_spark_example_project/string_fixed.ads +++ b/courses/spark_for_ada_programmers/labs/source/990_spark_example_project/string_fixed.ads @@ -137,7 +137,7 @@ package String_Fixed with SPARK_Mode is (Left : Natural; Right : Character) return String; -- This function replicates a character a specified number of times. It - -- returns a string whose length is Left and each of whose elements is + -- returns a string whose length is Left and each of whose components is -- Right. end String_Fixed; From d2ab24c169ceee858d1ad2e99261eea5774992b9 Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Mon, 24 Feb 2025 16:20:21 -0500 Subject: [PATCH 2/6] Change "field" and "element" to "component" Except where "Element" matches docuementation --- .../010_advanced_exception_analysis.lab.rst | 16 ++++----- .../labs/source/src/parser.adb | 34 +++++++++---------- .../020_building_with_gprbuild.rst | 2 +- courses/gnat_studio/010_gnat_studio.rst | 2 +- courses/gnatsas/labs/check_040_lkql.lab.rst | 6 ++-- courses/gnatsas/metric_010_overview.rst | 2 +- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/courses/advanced_exception_analysis/labs/010_advanced_exception_analysis.lab.rst b/courses/advanced_exception_analysis/labs/010_advanced_exception_analysis.lab.rst index 1a7f86e75..8feec221e 100644 --- a/courses/advanced_exception_analysis/labs/010_advanced_exception_analysis.lab.rst +++ b/courses/advanced_exception_analysis/labs/010_advanced_exception_analysis.lab.rst @@ -140,15 +140,15 @@ How Did We Get Here? - Solution loop declare Pieces : Strings_T := Split (Get_Line (File)); - Element : Element_T; + Component : Component_T; begin - Element.Line_Number := Integer (Line (File) - 1); - Element.Category := Convert (Pieces (1).all); - Element.Description := Pieces (2); - Element.Quantity := Convert (Pieces (3).all); - Element.Cost := Convert (Pieces (4).all); - Database_Count := Database_Count + 1; - Database (Database_Count) := Element; + Component.Line_Number := Integer (Line (File) - 1); + Component.Category := Convert (Pieces (1).all); + Component.Description := Pieces (2); + Component.Quantity := Convert (Pieces (3).all); + Component.Cost := Convert (Pieces (4).all); + Database_Count := Database_Count + 1; + Database (Database_Count) := Component; exception when The_Err : others => Put_Line ("Load failure: " & Exception_Name (The_Err)); diff --git a/courses/advanced_exception_analysis/labs/source/src/parser.adb b/courses/advanced_exception_analysis/labs/source/src/parser.adb index 33b2ec972..a9593c5be 100644 --- a/courses/advanced_exception_analysis/labs/source/src/parser.adb +++ b/courses/advanced_exception_analysis/labs/source/src/parser.adb @@ -5,7 +5,7 @@ with Strings; use Strings; package body Parser is - type Element_T is record + type Component_T is record Line_Number : Integer; Category : Category_T; Description : String_T; @@ -13,7 +13,7 @@ package body Parser is Cost : Cost_T; end record; - Database : array (1 .. 10) of Element_T; + Database : array (1 .. 10) of Component_T; Database_Count : Integer := 0; procedure Load (Filename : String) is @@ -23,29 +23,29 @@ package body Parser is while not End_Of_File (File) loop declare - Pieces : Strings_T := Split (Get_Line (File)); - Element : Element_T; + Pieces : Strings_T := Split (Get_Line (File)); + Component : Component_T; begin - Element.Line_Number := Integer (Line (File) - 1); - Element.Category := Convert (Pieces (1).all); - Element.Description := Pieces (2); - Element.Quantity := Convert (Pieces (3).all); - Element.Cost := Convert (Pieces (4).all); - Database_Count := Database_Count + 1; - Database (Database_Count) := Element; + Component.Line_Number := Integer (Line (File) - 1); + Component.Category := Convert (Pieces (1).all); + Component.Description := Pieces (2); + Component.Quantity := Convert (Pieces (3).all); + Component.Cost := Convert (Pieces (4).all); + Database_Count := Database_Count + 1; + Database (Database_Count) := Component; end; end loop; end Load; procedure Print is begin - for Element of Database (1 .. Database_Count) + for Component of Database (1 .. Database_Count) loop - Put (Element.Line_Number'Image & ": "); - Put (Element.Description.all & " ("); - Put (Convert (Element.Category) & ") "); - Put (Convert (Element.Quantity) & " at $"); - Put_Line (Convert (Element.Cost)); + Put (Component.Line_Number'Image & ": "); + Put (Component.Description.all & " ("); + Put (Convert (Component.Category) & ") "); + Put (Convert (Component.Quantity) & " at $"); + Put_Line (Convert (Component.Cost)); end loop; end Print; diff --git a/courses/gnat_project_facility/020_building_with_gprbuild.rst b/courses/gnat_project_facility/020_building_with_gprbuild.rst index b14a83a9a..b1f06bbd3 100644 --- a/courses/gnat_project_facility/020_building_with_gprbuild.rst +++ b/courses/gnat_project_facility/020_building_with_gprbuild.rst @@ -71,7 +71,7 @@ Command Line GPRbuild Command Line ----------------------- -* Made up of three elements +* Made up of three components * Main project file (required) * Switches (optional) diff --git a/courses/gnat_studio/010_gnat_studio.rst b/courses/gnat_studio/010_gnat_studio.rst index e066c67f4..9527efebe 100644 --- a/courses/gnat_studio/010_gnat_studio.rst +++ b/courses/gnat_studio/010_gnat_studio.rst @@ -391,7 +391,7 @@ Data Window + Name of the expression or variable - + Components / elements can be expanded + + Components / components can be expanded + Value + Type (Ada type definition) diff --git a/courses/gnatsas/labs/check_040_lkql.lab.rst b/courses/gnatsas/labs/check_040_lkql.lab.rst index 495fcca3b..7a30494a0 100644 --- a/courses/gnatsas/labs/check_040_lkql.lab.rst +++ b/courses/gnatsas/labs/check_040_lkql.lab.rst @@ -159,7 +159,7 @@ Step 3 - Implement First Criteria 1. Implement the first criteria: **No use of any arithmetic or bitwise operator on the type**. - a. Need to fetch all operators - use global :lkql:`select` with :lkql:`BinOp` and :lkql:`UnOp` node kind patterns. (Field :lkql:`f_op` contains the kind of the operator.) + a. Need to fetch all operators - use global :lkql:`select` with :lkql:`BinOp` and :lkql:`UnOp` node kind patterns. (Component :lkql:`f_op` contains the kind of the operator.) .. code:: lkql @@ -247,9 +247,9 @@ Step 6 - Improve Types Filter 1. Update the :lkql:`types` function to also return types used as source type in conversions - * LAL field **f_suffix** + * LAL component **f_suffix** - * Returns **ParamAssocList** with a single element - source expression + * Returns **ParamAssocList** with a single component - source expression * Use on type conversion nodes to get source of conversions .. code:: lkql diff --git a/courses/gnatsas/metric_010_overview.rst b/courses/gnatsas/metric_010_overview.rst index c23449fd8..ab8f7d85d 100644 --- a/courses/gnatsas/metric_010_overview.rst +++ b/courses/gnatsas/metric_010_overview.rst @@ -879,7 +879,7 @@ Coupling Metrics Code Example function Add (A, B : Record_T) return Record_T; private type Record_T is tagged record - Field1, Field2 : Integer; + Component1, Component2 : Integer; end record; end Coupling_Metrics_Dependency; From 4d9fad710456a601112781d47f39bc57f9fb48a4 Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Mon, 24 Feb 2025 16:24:36 -0500 Subject: [PATCH 3/6] Remaining occurrences of field/element converted to component --- marketing/ada_4_hours/060_record_types.rst | 4 ++-- marketing/ada_4_hours/180_polymorphism.rst | 2 +- marketing/ada_4_hours/280_low_level_programming.rst | 2 +- marketing/ada_8_hours/060_record_types.rst | 4 ++-- marketing/ada_8_hours/095_library_units.rst | 4 ++-- marketing/ada_8_hours/180_polymorphism.rst | 2 +- marketing/ada_8_hours/adv_280_low_level_programming.rst | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/marketing/ada_4_hours/060_record_types.rst b/marketing/ada_4_hours/060_record_types.rst index f17573143..c4dfaf947 100644 --- a/marketing/ada_4_hours/060_record_types.rst +++ b/marketing/ada_4_hours/060_record_types.rst @@ -55,8 +55,8 @@ Syntax and Examples .. code:: Ada type Record1_T is record - Field1 : integer; - Field2 : boolean; + Component1 : integer; + Component2 : boolean; end record; * Records can be **discriminated** as well diff --git a/marketing/ada_4_hours/180_polymorphism.rst b/marketing/ada_4_hours/180_polymorphism.rst index dd179b7c3..e5395be18 100644 --- a/marketing/ada_4_hours/180_polymorphism.rst +++ b/marketing/ada_4_hours/180_polymorphism.rst @@ -56,7 +56,7 @@ Classes * Objects of type :ada:`T'Class` have at least the properties of T - - Fields of `T` + - Components of `T` - Primitives of `T` ---------------- diff --git a/marketing/ada_4_hours/280_low_level_programming.rst b/marketing/ada_4_hours/280_low_level_programming.rst index 6de07126f..c1e7cea11 100644 --- a/marketing/ada_4_hours/280_low_level_programming.rst +++ b/marketing/ada_4_hours/280_low_level_programming.rst @@ -138,7 +138,7 @@ Record Representation Clauses - Driver mapped on the address space, communication protocol... - * Fields represented as + * Components represented as .. code:: Ada diff --git a/marketing/ada_8_hours/060_record_types.rst b/marketing/ada_8_hours/060_record_types.rst index 6340ecb0c..edea77677 100644 --- a/marketing/ada_8_hours/060_record_types.rst +++ b/marketing/ada_8_hours/060_record_types.rst @@ -55,8 +55,8 @@ Syntax and Examples .. code:: Ada type Record1_T is record - Field1 : integer; - Field2 : boolean; + Component1 : integer; + Component2 : boolean; end record; * Records can be **discriminated** as well diff --git a/marketing/ada_8_hours/095_library_units.rst b/marketing/ada_8_hours/095_library_units.rst index e695bd55f..a318f57ae 100644 --- a/marketing/ada_8_hours/095_library_units.rst +++ b/marketing/ada_8_hours/095_library_units.rst @@ -168,7 +168,7 @@ What To Import with A; package B is type Something is record - Field : A.Something; + Component : A.Something; end record; end B; @@ -176,5 +176,5 @@ What To Import procedure Foo is X : B.Something; begin - X.Field := ... + X.Component := ... diff --git a/marketing/ada_8_hours/180_polymorphism.rst b/marketing/ada_8_hours/180_polymorphism.rst index f4da2d8d0..9b444e072 100644 --- a/marketing/ada_8_hours/180_polymorphism.rst +++ b/marketing/ada_8_hours/180_polymorphism.rst @@ -56,7 +56,7 @@ Classes * Objects of type :ada:`T'Class` have at least the properties of T - - Fields of `T` + - Components of `T` - Primitives of `T` ----------------- diff --git a/marketing/ada_8_hours/adv_280_low_level_programming.rst b/marketing/ada_8_hours/adv_280_low_level_programming.rst index 2014fcc77..f73d293c0 100644 --- a/marketing/ada_8_hours/adv_280_low_level_programming.rst +++ b/marketing/ada_8_hours/adv_280_low_level_programming.rst @@ -181,7 +181,7 @@ Record Representation Clauses - Driver mapped on the address space, communication protocol... - * Fields represented as + * Components represented as .. code:: Ada From 2249ab2a531cccc59682ea804e404f6eed6ec037 Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Thu, 13 Mar 2025 10:09:06 -0400 Subject: [PATCH 4/6] Change "field" to "component" in other courses --- .../labs/source/struct/values-operations.adb | 2 +- courses/gnat_studio/labs/source/struct/values.adb | 4 ++-- .../utils/src/values-operations.adb | 2 +- .../cover_030_advanced_topics/utils/src/values.adb | 4 ++-- .../coupling_metrics_dependency.adb | 10 +++++----- .../coupling_metrics_dependency.ads | 2 +- .../labs/sas_060_tutorial/struct/values-operations.adb | 2 +- .../gnatsas/labs/sas_060_tutorial/struct/values.adb | 4 ++-- .../010_static_analysis_via_compiler.rst | 8 ++++---- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/courses/gnat_studio/labs/source/struct/values-operations.adb b/courses/gnat_studio/labs/source/struct/values-operations.adb index 652dd3870..6fe82f086 100644 --- a/courses/gnat_studio/labs/source/struct/values-operations.adb +++ b/courses/gnat_studio/labs/source/struct/values-operations.adb @@ -52,7 +52,7 @@ package body Values.Operations is Result := V1.E - V2.E; end case; - -- Create an integer Value by setting the field "E" of the record + -- Create an integer Value by setting the component "E" of the record -- to Result. Stack.Push (new Value_Info'(E => Result)); diff --git a/courses/gnat_studio/labs/source/struct/values.adb b/courses/gnat_studio/labs/source/struct/values.adb index 82fb84d0c..e0bdf632a 100644 --- a/courses/gnat_studio/labs/source/struct/values.adb +++ b/courses/gnat_studio/labs/source/struct/values.adb @@ -30,8 +30,8 @@ package body Values is end if; return new Value_Info'(E => Int_Val); - -- Allocate a new Value_Info (which is a record with one field) - -- on the heap and initialize its only field "E" to be "Int_Val". + -- Allocate a new Value_Info (which is a record with one component) + -- on the heap and initialize its only component "E" to be "Int_Val". -- NOTE: the ' in Value_Info'(...) must be there. end Read; diff --git a/courses/gnatdas/labs/cover_030_advanced_topics/utils/src/values-operations.adb b/courses/gnatdas/labs/cover_030_advanced_topics/utils/src/values-operations.adb index 59de0a912..8713cf188 100644 --- a/courses/gnatdas/labs/cover_030_advanced_topics/utils/src/values-operations.adb +++ b/courses/gnatdas/labs/cover_030_advanced_topics/utils/src/values-operations.adb @@ -54,7 +54,7 @@ package body Values.Operations is Result := V1.E - V2.E; end case; - -- Create an integer Value by setting the field "E" of the record + -- Create an integer Value by setting the component "E" of the record -- to Result. Stack.Push (new Value_Info'(E => Result)); diff --git a/courses/gnatdas/labs/cover_030_advanced_topics/utils/src/values.adb b/courses/gnatdas/labs/cover_030_advanced_topics/utils/src/values.adb index 14698fb47..eaadfffa9 100644 --- a/courses/gnatdas/labs/cover_030_advanced_topics/utils/src/values.adb +++ b/courses/gnatdas/labs/cover_030_advanced_topics/utils/src/values.adb @@ -32,8 +32,8 @@ package body Values is end if; return new Value_Info'(E => Int_Val); - -- Allocate a new Value_Info (which is a record with one field) - -- on the heap and initialize its only field "E" to be "Int_Val". + -- Allocate a new Value_Info (which is a record with one component) + -- on the heap and initialize its only component "E" to be "Int_Val". -- NOTE: the ' in Value_Info'(...) must be there. end Read; diff --git a/courses/gnatsas/labs/metric_010_overview/coupling_metrics_dependency.adb b/courses/gnatsas/labs/metric_010_overview/coupling_metrics_dependency.adb index a2434e8de..72d39e764 100644 --- a/courses/gnatsas/labs/metric_010_overview/coupling_metrics_dependency.adb +++ b/courses/gnatsas/labs/metric_010_overview/coupling_metrics_dependency.adb @@ -3,15 +3,15 @@ package body Coupling_Metrics_Dependency is function Set (A, B : Integer) return Record_T is - ((Field1 => A, - Field2 => B)); + ((Component1 => A, + Component2 => B)); function Get (A : Record_T) - return Integer is (A.Field1 * A.Field2); + return Integer is (A.Component1 * A.Component2); function Add (A, B : Record_T) return Record_T is - ((Field1 => A.Field1 + B.Field1, - Field2 => A.Field2 + B.Field2)); + ((Component1 => A.Component1 + B.Component1, + Component2 => A.Component2 + B.Component2)); end Coupling_Metrics_Dependency; diff --git a/courses/gnatsas/labs/metric_010_overview/coupling_metrics_dependency.ads b/courses/gnatsas/labs/metric_010_overview/coupling_metrics_dependency.ads index 474a4af65..f2c0a7c01 100644 --- a/courses/gnatsas/labs/metric_010_overview/coupling_metrics_dependency.ads +++ b/courses/gnatsas/labs/metric_010_overview/coupling_metrics_dependency.ads @@ -13,7 +13,7 @@ package Coupling_Metrics_Dependency is private type Record_T is tagged record - Field1, Field2 : Integer; + Component1, Component2 : Integer; end record; end Coupling_Metrics_Dependency; diff --git a/courses/gnatsas/labs/sas_060_tutorial/struct/values-operations.adb b/courses/gnatsas/labs/sas_060_tutorial/struct/values-operations.adb index 652dd3870..6fe82f086 100644 --- a/courses/gnatsas/labs/sas_060_tutorial/struct/values-operations.adb +++ b/courses/gnatsas/labs/sas_060_tutorial/struct/values-operations.adb @@ -52,7 +52,7 @@ package body Values.Operations is Result := V1.E - V2.E; end case; - -- Create an integer Value by setting the field "E" of the record + -- Create an integer Value by setting the component "E" of the record -- to Result. Stack.Push (new Value_Info'(E => Result)); diff --git a/courses/gnatsas/labs/sas_060_tutorial/struct/values.adb b/courses/gnatsas/labs/sas_060_tutorial/struct/values.adb index 82fb84d0c..e0bdf632a 100644 --- a/courses/gnatsas/labs/sas_060_tutorial/struct/values.adb +++ b/courses/gnatsas/labs/sas_060_tutorial/struct/values.adb @@ -30,8 +30,8 @@ package body Values is end if; return new Value_Info'(E => Int_Val); - -- Allocate a new Value_Info (which is a record with one field) - -- on the heap and initialize its only field "E" to be "Int_Val". + -- Allocate a new Value_Info (which is a record with one component) + -- on the heap and initialize its only component "E" to be "Int_Val". -- NOTE: the ' in Value_Info'(...) must be there. end Read; 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 2707a6b8a..6b214d811 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 @@ -756,7 +756,7 @@ Sound Engineering Example type Tagged_T is tagged null record; procedure Primitive (R : in Tagged_T); type Child_T is new Tagged_T with record - Field : Natural; + Component : Natural; end record; procedure Primitive (R : in Child_T); end Example; @@ -770,7 +770,7 @@ Sound Engineering Example begin Lup : while (Count > 0) and (Count < 100) loop - Count := Count + R.Field; + Count := Count + R.Component; exit when Count = 50; end loop Lup; end Primitive; @@ -1129,10 +1129,10 @@ GNAT Initialization Restrictions pragma Restrictions (No_Default_Initialization); procedure Demo is type Record_T is record - Field : Integer := 42; + Component : Integer := 42; end record; Bad : Record_T; - Good : Record_T := (Field => 42); + Good : Record_T := (Component => 42); .. container:: latex_environment tiny From f772510d962d954c48cfd48f7b2d88a74854a90e Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Thu, 13 Mar 2025 10:36:59 -0400 Subject: [PATCH 5/6] Update missed "element" text to "component" --- .../030_basic_types/06-character_types.rst | 6 ++--- .../050_array_types/05-operations.rst | 2 +- .../06-looping_over_objects.rst | 6 ++--- .../050_array_types/07-aggregates.rst | 4 ++-- .../02-variant_records.rst | 2 +- ...3-discriminant_record_array_size_idiom.rst | 4 ++-- .../05-quantified_expressions.rst | 10 ++++----- .../135_visibility/05-lab.rst | 6 ++--- .../03-generic_data_in_depth.rst | 8 +++---- .../04-generic_formal_data_in_depth.rst | 6 ++--- .../04-complex_data_types.rst | 4 ++-- .../02-preconditions_and_postconditions.rst | 4 ++-- .../03-special_attributes.rst | 2 +- .../890_ada_text_io/01-introduction.rst | 2 +- .../901_ada_2022_specific.rst | 4 ++-- .../labs/050_array_types.lab.rst | 4 ++-- .../labs/110_private_types.lab.rst | 4 ++-- .../labs/135_visibility.lab.rst | 6 ++--- .../labs/160_genericity.lab.rst | 4 ++-- .../labs/answers/110_private_types.txt | 20 ++++++++--------- .../labs/answers/160_genericity.txt | 22 +++++++++---------- .../labs/prompts/110_private_types/flags.adb | 16 +++++++------- .../labs/prompts/110_private_types/flags.ads | 10 ++++----- .../labs/prompts/135_visibility/main.adb | 4 ++-- .../labs/prompts/160_genericity/data_type.ads | 2 +- .../prompts/160_genericity/generic_list.adb | 8 +++---- .../prompts/160_genericity/generic_list.ads | 10 ++++----- .../labs/prompts/160_genericity/main.adb | 10 ++++----- 28 files changed, 95 insertions(+), 95 deletions(-) diff --git a/courses/fundamentals_of_ada/030_basic_types/06-character_types.rst b/courses/fundamentals_of_ada/030_basic_types/06-character_types.rst index c9a648de9..85482cd64 100644 --- a/courses/fundamentals_of_ada/030_basic_types/06-character_types.rst +++ b/courses/fundamentals_of_ada/030_basic_types/06-character_types.rst @@ -9,19 +9,19 @@ Language-Defined Character Types * :ada:`Character` - 8-bit Latin-1 - - Base element of :ada:`String` + - Base component of :ada:`String` - Uses attributes :ada:`'Image` / :ada:`'Value` * :ada:`Wide_Character` - 16-bit Unicode - - Base element of :ada:`Wide_Strings` + - Base component of :ada:`Wide_Strings` - Uses attributes :ada:`'Wide_Image` / :ada:`'Wide_Value` * :ada:`Wide_Wide_Character` - 32-bit Unicode - - Base element of :ada:`Wide_Wide_Strings` + - Base component of :ada:`Wide_Wide_Strings` - Uses attributes :ada:`'Wide_Wide_Image` / :ada:`'Wide_Wide_Value` ----------------------------- diff --git a/courses/fundamentals_of_ada/050_array_types/05-operations.rst b/courses/fundamentals_of_ada/050_array_types/05-operations.rst index 65011c3b1..18d9cc7e8 100644 --- a/courses/fundamentals_of_ada/050_array_types/05-operations.rst +++ b/courses/fundamentals_of_ada/050_array_types/05-operations.rst @@ -172,7 +172,7 @@ Which statement(s) is (are) legal? Explanations A. All objects are just Boolean values - B. An element of :ada:`A` is the same type as :ada:`B` + B. A component of :ada:`A` is the same type as :ada:`B` C. Slice must be of outermost array D. Slicing allowed on single-dimension arrays diff --git a/courses/fundamentals_of_ada/050_array_types/06-looping_over_objects.rst b/courses/fundamentals_of_ada/050_array_types/06-looping_over_objects.rst index 329f51d53..33c4e8371 100644 --- a/courses/fundamentals_of_ada/050_array_types/06-looping_over_objects.rst +++ b/courses/fundamentals_of_ada/050_array_types/06-looping_over_objects.rst @@ -7,7 +7,7 @@ Note on Default Initialization for Array Types ------------------------------------------------ * In Ada, objects are not initialized by default -* To initialize an array, you can initialize each element +* To initialize an array, you can initialize each component * But if the array type is used in multiple places, it would be better to initialize at the type level * No matter how many dimensions, there is only one component type @@ -51,7 +51,7 @@ Two High-Level For-Loop Kinds Array/Container For-Loops --------------------------- -* Work in terms of elements within an object +* Work in terms of components within an object * Syntax hides indexing/iterator controls .. code:: Ada @@ -60,7 +60,7 @@ Array/Container For-Loops ... end loop; -* Starts with "first" element unless you reverse it +* Starts with "first" component unless you reverse it * Loop parameter name is a constant if iterating over a constant, a variable otherwise .. diff --git a/courses/fundamentals_of_ada/050_array_types/07-aggregates.rst b/courses/fundamentals_of_ada/050_array_types/07-aggregates.rst index 6486ef7e1..3cb891775 100644 --- a/courses/fundamentals_of_ada/050_array_types/07-aggregates.rst +++ b/courses/fundamentals_of_ada/050_array_types/07-aggregates.rst @@ -269,7 +269,7 @@ Aggregates in Ada 2022 Illegal : Array_T := (); Ada2022 : Array_T := []; - * Single element array + * Single component array .. code:: Ada @@ -308,7 +308,7 @@ Iterated Component Association Object2 := [for Item of Object => Item * 2]; - * :ada:`Object2` will have each element doubled + * :ada:`Object2` will have each component doubled ------------------------------- More Information on Iterators diff --git a/courses/fundamentals_of_ada/065_discriminated_records/02-variant_records.rst b/courses/fundamentals_of_ada/065_discriminated_records/02-variant_records.rst index 95e7ad8f3..b59bd1a13 100644 --- a/courses/fundamentals_of_ada/065_discriminated_records/02-variant_records.rst +++ b/courses/fundamentals_of_ada/065_discriminated_records/02-variant_records.rst @@ -116,7 +116,7 @@ Mutable Variant Record * An object can be created without a constraint (:ada:`Pat`) * Or we can create in immutable object where the discriminant cannot change (:ada:`Sam`) - * And we can create an array whose element is mutable + * And we can create an array whose component is mutable -------------------------------- Mutable Variant Record Example diff --git a/courses/fundamentals_of_ada/065_discriminated_records/03-discriminant_record_array_size_idiom.rst b/courses/fundamentals_of_ada/065_discriminated_records/03-discriminant_record_array_size_idiom.rst index 2f48b1e05..adfbff907 100644 --- a/courses/fundamentals_of_ada/065_discriminated_records/03-discriminant_record_array_size_idiom.rst +++ b/courses/fundamentals_of_ada/065_discriminated_records/03-discriminant_record_array_size_idiom.rst @@ -19,12 +19,12 @@ Vectors of Varying Lengths + Need two pieces of data * Array contents - * Location of last valid element + * Location of last valid component * For common usage, we want this to be a type (probably a record) + Maximum size array for contents - + Index for last valid element + + Index for last valid component --------------------------------- Simple Vector of Varying Length diff --git a/courses/fundamentals_of_ada/080_expressions/05-quantified_expressions.rst b/courses/fundamentals_of_ada/080_expressions/05-quantified_expressions.rst index 8ed287c33..88cb0509d 100644 --- a/courses/fundamentals_of_ada/080_expressions/05-quantified_expressions.rst +++ b/courses/fundamentals_of_ada/080_expressions/05-quantified_expressions.rst @@ -354,8 +354,8 @@ Quiz type Array2_T is array (1 .. 3) of Array1_T; A : Array2_T; -The above describes an array A whose elements are arrays of three elements. -Which expression would one use to determine if at least one of A's elements are sorted? +The above describes an array A whose components are arrays of three components. +Which expression would one use to determine if at least one of A's components are sorted? A. | ``(for some El of A => (for some Idx in 2 .. 3 =>`` | ``El (Idx) >= El (Idx - 1)));`` @@ -368,8 +368,8 @@ D. | ``(for all El of A => (for some Idx in 2 .. 3 =>`` .. container:: animate - A. Will be :ada:`True` if any element has two consecutive increasing values - B. Will be :ada:`True` if every element is sorted + A. Will be :ada:`True` if any component has two consecutive increasing values + B. Will be :ada:`True` if every component is sorted C. Correct - D. Will be :ada:`True` if every element has two consecutive increasing values + D. Will be :ada:`True` if every component has two consecutive increasing values diff --git a/courses/fundamentals_of_ada/135_visibility/05-lab.rst b/courses/fundamentals_of_ada/135_visibility/05-lab.rst index ffae43cb1..2bc691b5e 100644 --- a/courses/fundamentals_of_ada/135_visibility/05-lab.rst +++ b/courses/fundamentals_of_ada/135_visibility/05-lab.rst @@ -12,13 +12,13 @@ Visibility Lab + :ada:`Number_of_Sides` - indicates how many sides in the shape + :ada:`Side_T` - numeric value for length - + :ada:`Shape_T` - array of :ada:`Side_T` elements whose length is :ada:`Number_of_Sides` + + :ada:`Shape_T` - array of :ada:`Side_T` components whose length is :ada:`Number_of_Sides` - Create a main program that will + Create an object of each :ada:`Shape_T` - + Set the values for each element in :ada:`Shape_T` - + Add all the elements in each object and print the total + + Set the values for each component in :ada:`Shape_T` + + Add all the components in each object and print the total * Hints diff --git a/courses/fundamentals_of_ada/160_genericity/03-generic_data_in_depth.rst b/courses/fundamentals_of_ada/160_genericity/03-generic_data_in_depth.rst index e0d7c76b6..7952f11b6 100644 --- a/courses/fundamentals_of_ada/160_genericity/03-generic_data_in_depth.rst +++ b/courses/fundamentals_of_ada/160_genericity/03-generic_data_in_depth.rst @@ -105,15 +105,15 @@ Generic Parameters Can Be Combined type Acc is access all T; type Index is (<>); type Arr is array (Index range <>) of Acc; - function Element (Source : Arr; - Position : Index) - return T; + function Component (Source : Arr; + Position : Index) + return T; type String_Ptr is access all String; type String_Array is array (Integer range <>) of String_Ptr; - function String_Element is new Element + function String_Component is new Component (T => String, Acc => String_Ptr, Index => Integer, diff --git a/courses/fundamentals_of_ada/160_genericity/04-generic_formal_data_in_depth.rst b/courses/fundamentals_of_ada/160_genericity/04-generic_formal_data_in_depth.rst index e69667a35..aaaca48f7 100644 --- a/courses/fundamentals_of_ada/160_genericity/04-generic_formal_data_in_depth.rst +++ b/courses/fundamentals_of_ada/160_genericity/04-generic_formal_data_in_depth.rst @@ -27,9 +27,9 @@ Generic Constants/Variables As Parameters .. code:: Ada generic - type Element_T is private; + type Component_T is private; Array_Size : Positive; - High_Watermark : in out Element_T; + High_Watermark : in out Component_T; package Repository is * Generic instance @@ -40,7 +40,7 @@ Generic Constants/Variables As Parameters Max : Float; procedure My_Repository is new Repository - (Element_T => Float, + (Component_T => Float, Array_size => 10, High_Watermark => Max); diff --git a/courses/fundamentals_of_ada/230_interfacing_with_c/04-complex_data_types.rst b/courses/fundamentals_of_ada/230_interfacing_with_c/04-complex_data_types.rst index b67d049ae..6b1650b94 100644 --- a/courses/fundamentals_of_ada/230_interfacing_with_c/04-complex_data_types.rst +++ b/courses/fundamentals_of_ada/230_interfacing_with_c/04-complex_data_types.rst @@ -66,11 +66,11 @@ Arrays Interfacing Arrays From Ada to C ---------------------- -* An Ada array is a composite data structure containing 2 elements: Bounds and Elements +* An Ada array is a composite data structure containing 2 parts: Bounds and Components - **Fat pointers** -* When arrays can be sent from Ada to C, C will only receive an access to the elements of the array +* When arrays can be sent from Ada to C, C will only receive an access to the components of the array * Ada View .. code:: Ada diff --git a/courses/fundamentals_of_ada/270_introduction_to_contracts/02-preconditions_and_postconditions.rst b/courses/fundamentals_of_ada/270_introduction_to_contracts/02-preconditions_and_postconditions.rst index 31f5c1507..7ab7dbbdf 100644 --- a/courses/fundamentals_of_ada/270_introduction_to_contracts/02-preconditions_and_postconditions.rst +++ b/courses/fundamentals_of_ada/270_introduction_to_contracts/02-preconditions_and_postconditions.rst @@ -205,9 +205,9 @@ Quiz .. code:: Ada type Index_T is range 1 .. 100; - -- Database initialized such that value for element at I = I + -- Database initialized such that value for component at I = I Database : array (Index_T) of Integer; - -- Set the value for element Index to Value and + -- Set the value for component Index to Value and -- then increment Index by 1 function Set_And_Move (Value : Integer; Index : in out Index_T) diff --git a/courses/fundamentals_of_ada/273_subprogram_contracts/03-special_attributes.rst b/courses/fundamentals_of_ada/273_subprogram_contracts/03-special_attributes.rst index 19f790bf1..80d75c120 100644 --- a/courses/fundamentals_of_ada/273_subprogram_contracts/03-special_attributes.rst +++ b/courses/fundamentals_of_ada/273_subprogram_contracts/03-special_attributes.rst @@ -110,7 +110,7 @@ Quiz .. code:: Ada Database : String (1 .. 10) := "ABCDEFGHIJ"; - -- Set the value for the element at position Index in + -- Set the value for the component at position Index in -- array Database to Value and then increment Index by 1 function Set_And_Move (Value : Character; Index : in out Index_T) diff --git a/courses/fundamentals_of_ada/890_ada_text_io/01-introduction.rst b/courses/fundamentals_of_ada/890_ada_text_io/01-introduction.rst index ff120aa6a..44509c5c9 100644 --- a/courses/fundamentals_of_ada/890_ada_text_io/01-introduction.rst +++ b/courses/fundamentals_of_ada/890_ada_text_io/01-introduction.rst @@ -16,7 +16,7 @@ Ada.Text_IO - `Ada.Sequential_IO` and `Ada.Direct_IO` - * Operations on binary files for elements of a given type + * Operations on binary files for components of a given type - `Ada.Storage_IO` diff --git a/courses/fundamentals_of_ada/901_ada_2022_specific.rst b/courses/fundamentals_of_ada/901_ada_2022_specific.rst index 43034149a..9330e8d98 100644 --- a/courses/fundamentals_of_ada/901_ada_2022_specific.rst +++ b/courses/fundamentals_of_ada/901_ada_2022_specific.rst @@ -273,8 +273,8 @@ Container Aggregates * Args are - :ada:`Empty` init function (or else default) - - :ada:`Add_Named` named aggregate element - - :ada:`Add_Unnamed` positional aggregate element + - :ada:`Add_Named` named aggregate component + - :ada:`Add_Unnamed` positional aggregate component * You **cannot** mix named and unnamed diff --git a/courses/fundamentals_of_ada/labs/050_array_types.lab.rst b/courses/fundamentals_of_ada/labs/050_array_types.lab.rst index 2d5331680..fef2ca700 100644 --- a/courses/fundamentals_of_ada/labs/050_array_types.lab.rst +++ b/courses/fundamentals_of_ada/labs/050_array_types.lab.rst @@ -8,14 +8,14 @@ Array Lab * Requirements - - Create an array type whose index is days of the week and each element is a number + - Create an array type whose index is days of the week and each component is a number - Create two objects of the array type, one of which is constant - Perform the following operations + Copy the constant object to the non-constant object + Print the contents of the non-constant object + Use an array aggregate to initialize the non-constant object - + For each element of the array, print the array index and the value + + For each component of the array, print the array index and the value + Move part ("source") of the non-constant object to another part ("destination"), and then clear the source location + Print the contents of the non-constant object diff --git a/courses/fundamentals_of_ada/labs/110_private_types.lab.rst b/courses/fundamentals_of_ada/labs/110_private_types.lab.rst index 9dbef5895..cf3a64973 100644 --- a/courses/fundamentals_of_ada/labs/110_private_types.lab.rst +++ b/courses/fundamentals_of_ada/labs/110_private_types.lab.rst @@ -11,7 +11,7 @@ Private Types Lab - Implement a program to create a map such that + Map key is a description of a flag - + Map element content is the set of colors in the flag + + Map component content is the set of colors in the flag - Operations on the map should include: Add, Remove, Modify, Get, Exists, Image - Main program should print out the entire map before exiting @@ -24,7 +24,7 @@ Private Types Lab - Should implement a **set** ADT (to keep track of the colors) - + This **set** will be the description of the map element + + This **set** will be the description of the map component - Each ADT should be its own package - At a minimum, the **map** and **set** type should be `private` diff --git a/courses/fundamentals_of_ada/labs/135_visibility.lab.rst b/courses/fundamentals_of_ada/labs/135_visibility.lab.rst index 597000e4a..8643d5a23 100644 --- a/courses/fundamentals_of_ada/labs/135_visibility.lab.rst +++ b/courses/fundamentals_of_ada/labs/135_visibility.lab.rst @@ -12,13 +12,13 @@ Visibility Lab + :ada:`Number_of_Sides` - indicates how many sides in the shape + :ada:`Side_T` - numeric value for length - + :ada:`Shape_T` - array of :ada:`Side_T` elements whose length is :ada:`Number_of_Sides` + + :ada:`Shape_T` - array of :ada:`Side_T` components whose length is :ada:`Number_of_Sides` - Create a main program that will + Create an object of each :ada:`Shape_T` - + Set the values for each element in :ada:`Shape_T` - + Add all the elements in each object and print the total + + Set the values for each component in :ada:`Shape_T` + + Add all the components in each object and print the total * Hints diff --git a/courses/fundamentals_of_ada/labs/160_genericity.lab.rst b/courses/fundamentals_of_ada/labs/160_genericity.lab.rst index e419b34b0..5cda9a303 100644 --- a/courses/fundamentals_of_ada/labs/160_genericity.lab.rst +++ b/courses/fundamentals_of_ada/labs/160_genericity.lab.rst @@ -21,8 +21,8 @@ Genericity Lab * Hints - - Sort routine will need to know how to compare elements - - Print routine will need to know how to print one element + - Sort routine will need to know how to compare components + - Print routine will need to know how to print one component ------------------------------------------ Genericity Lab Solution - Generic (Spec) diff --git a/courses/fundamentals_of_ada/labs/answers/110_private_types.txt b/courses/fundamentals_of_ada/labs/answers/110_private_types.txt index 1be83b8e4..01c0d42b9 100644 --- a/courses/fundamentals_of_ada/labs/answers/110_private_types.txt +++ b/courses/fundamentals_of_ada/labs/answers/110_private_types.txt @@ -51,7 +51,7 @@ end Colors; with Colors; package Flags is type Key_T is (USA, England, France, Italy); - type Map_Element_T is private; + type Map_Component_T is private; type Map_T is private; procedure Add (Map : in out Map_T; @@ -67,15 +67,15 @@ package Flags is Success : out Boolean); function Exists (Map : Map_T; Key : Key_T) return Boolean; - function Get (Map : Map_T; Key : Key_T) return Map_Element_T; - function Image (Item : Map_Element_T) return String; + function Get (Map : Map_T; Key : Key_T) return Map_Component_T; + function Image (Item : Map_Component_T) return String; function Image (Flag : Map_T) return String; private - type Map_Element_T is record + type Map_Component_T is record Key : Key_T := Key_T'First; Description : Colors.Color_Set_T := Colors.Empty_Set; end record; - type Map_Array_T is array (1 .. 100) of Map_Element_T; + type Map_Array_T is array (1 .. 100) of Map_Component_T; type Map_T is record Values : Map_Array_T; Length : Natural := 0; @@ -107,7 +107,7 @@ package body Flags is Success := False; if Index not in Map.Values'Range then declare - New_Item : constant Map_Element_T := + New_Item : constant Map_Component_T := (Key => Key, Description => Description); begin @@ -152,9 +152,9 @@ package body Flags is function Get (Map : Map_T; Key : Key_T) - return Map_Element_T is + return Map_Component_T is Index : constant Integer := Find (Map, Key); - Ret_Val : Map_Element_T; + Ret_Val : Map_Component_T; begin if Index in Map.Values'Range then Ret_Val := Map.Values (Index); @@ -162,7 +162,7 @@ package body Flags is return Ret_Val; end Get; - function Image (Item : Map_Element_T) return String is + function Image (Item : Map_Component_T) return String is (Item.Key'Image & " => " & Colors.Image (Item.Description)); function Image (Flag : Map_T) return String is @@ -171,7 +171,7 @@ package body Flags is begin for I in 1 .. Flag.Length loop declare - Item : constant Map_Element_T := Flag.Values (I); + Item : constant Map_Component_T := Flag.Values (I); Str : constant String := Image (Item); begin Ret_Val (Next .. Next + Str'Length) := Image (Item) & ASCII.LF; diff --git a/courses/fundamentals_of_ada/labs/answers/160_genericity.txt b/courses/fundamentals_of_ada/labs/answers/160_genericity.txt index 53ee1bb83..b71a28765 100644 --- a/courses/fundamentals_of_ada/labs/answers/160_genericity.txt +++ b/courses/fundamentals_of_ada/labs/answers/160_genericity.txt @@ -12,30 +12,30 @@ package Data_Type is else L.Integer_Component > R.Integer_Component); function Image - (Element : Record_T) + (Component : Record_T) return String is - (Element.Character_Component & " =>" & Integer'Image (Element.Integer_Component)); + (Component.Character_Component & " =>" & Integer'Image (Component.Integer_Component)); end Data_Type; --Generic_List_Spec generic - type Element_T is private; + type Component_T is private; Max_Size : Natural; - with function ">" (L, R : Element_T) return Boolean is <>; - with function Image (Element : Element_T) return String; + with function ">" (L, R : Component_T) return Boolean is <>; + with function Image (Component : Component_T) return String; package Generic_List is type List_T is private; procedure Add (This : in out List_T; - Item : in Element_T); + Item : in Component_T); procedure Sort (This : in out List_T); procedure Print (List : List_T); private subtype Index_T is Natural range 0 .. Max_Size; - type List_Array_T is array (1 .. Index_T'Last) of Element_T; + type List_Array_T is array (1 .. Index_T'Last) of Component_T; type List_T is record Values : List_Array_T; @@ -49,14 +49,14 @@ with Ada.Text_io; use Ada.Text_IO; package body Generic_List is procedure Add (This : in out List_T; - Item : in Element_T) is + Item : in Component_T) is begin This.Length := This.Length + 1; This.Values (This.Length) := Item; end Add; procedure Sort (This : in out List_T) is - Temp : Element_T; + Temp : Component_T; begin for I in 1 .. This.Length loop for J in 1 .. This.Length - I loop @@ -83,13 +83,13 @@ end Generic_List; with Data_Type; with Generic_List; procedure Main is - package List is new Generic_List (Element_T => Data_Type.Record_T, + package List is new Generic_List (Component_T => Data_Type.Record_T, Max_Size => 20, ">" => Data_Type.">", Image => Data_Type.Image); My_List : List.List_T; - Element : Data_Type.Record_T; + Component : Data_Type.Record_T; begin List.Add (My_List, (Integer_Component => 111, diff --git a/courses/fundamentals_of_ada/labs/prompts/110_private_types/flags.adb b/courses/fundamentals_of_ada/labs/prompts/110_private_types/flags.adb index 0b67b39f6..edfaa7977 100644 --- a/courses/fundamentals_of_ada/labs/prompts/110_private_types/flags.adb +++ b/courses/fundamentals_of_ada/labs/prompts/110_private_types/flags.adb @@ -8,7 +8,7 @@ package body Flags is begin Success := False; -- If the key is not already in the map then - -- Create a map element and add it to the map + -- Create a map component and add it to the map end Add; procedure Remove @@ -17,7 +17,7 @@ package body Flags is Success : out Boolean) is begin Success := False; - -- Remove the element specified by the key from the map + -- Remove the component specified by the key from the map end Remove; procedure Modify @@ -27,7 +27,7 @@ package body Flags is Success : out Boolean) is begin Success := False; - -- Update the element at the key location with the new data + -- Update the component at the key location with the new data end Modify; function Exists @@ -42,18 +42,18 @@ package body Flags is function Get (Map : Map_T; Key : Key_T) - return Map_Element_T is - Ret_Val : Map_Element_T; + return Map_Component_T is + Ret_Val : Map_Component_T; begin - -- Return the map element specified by key + -- Return the map component specified by key return Ret_Val; end Get; function Image - (Item : Map_Element_T) + (Item : Map_Component_T) return String is begin - -- return a string representation of the element + -- return a string representation of the component return ""; end Image; diff --git a/courses/fundamentals_of_ada/labs/prompts/110_private_types/flags.ads b/courses/fundamentals_of_ada/labs/prompts/110_private_types/flags.ads index 6e2522715..491892a47 100644 --- a/courses/fundamentals_of_ada/labs/prompts/110_private_types/flags.ads +++ b/courses/fundamentals_of_ada/labs/prompts/110_private_types/flags.ads @@ -1,8 +1,8 @@ with Colors; package Flags is - -- For a map, we need a key and an element type + -- For a map, we need a key and a component type type Key_T is new Integer; -- implement something smarter! - type Map_Element_T is private; + type Map_Component_T is private; type Map_T is private; procedure Add @@ -27,15 +27,15 @@ package Flags is function Get (Map : Map_T; Key : Key_T) - return Map_Element_T; + return Map_Component_T; function Image - (Item : Map_Element_T) + (Item : Map_Component_T) return String; function Image (Flag : Map_T) return String; private -- Implement these types - type Map_Element_T is null record; + type Map_Component_T is null record; type Map_T is null record; end Flags; diff --git a/courses/fundamentals_of_ada/labs/prompts/135_visibility/main.adb b/courses/fundamentals_of_ada/labs/prompts/135_visibility/main.adb index 6b14e6783..4b9f5fe01 100644 --- a/courses/fundamentals_of_ada/labs/prompts/135_visibility/main.adb +++ b/courses/fundamentals_of_ada/labs/prompts/135_visibility/main.adb @@ -13,11 +13,11 @@ procedure Main is begin null; - -- for each element in Quad + -- for each component in Quad -- add Side to Total -- Print total - -- for each element in Triangle + -- for each component in Triangle -- add Side to Total -- Print total diff --git a/courses/fundamentals_of_ada/labs/prompts/160_genericity/data_type.ads b/courses/fundamentals_of_ada/labs/prompts/160_genericity/data_type.ads index b05835d41..9a692f256 100644 --- a/courses/fundamentals_of_ada/labs/prompts/160_genericity/data_type.ads +++ b/courses/fundamentals_of_ada/labs/prompts/160_genericity/data_type.ads @@ -6,7 +6,7 @@ package Data_Type is return Boolean is (True); -- Update to Return True when L < R function Image - (Element : Record_T) + (Component : Record_T) return String is (""); -- Update to return string representation of Record_T; diff --git a/courses/fundamentals_of_ada/labs/prompts/160_genericity/generic_list.adb b/courses/fundamentals_of_ada/labs/prompts/160_genericity/generic_list.adb index 7520940ab..57a35fb6e 100644 --- a/courses/fundamentals_of_ada/labs/prompts/160_genericity/generic_list.adb +++ b/courses/fundamentals_of_ada/labs/prompts/160_genericity/generic_list.adb @@ -2,14 +2,14 @@ package body Generic_List is procedure Add (This : in out List_T; - Item : in Element_T) is + Item : in Component_T) is begin null; end Add; procedure Sort (This : in out List_T) is - Temp : Element_T; - -- Set length to number of elements in list + Temp : Component_T; + -- Set length to number of components in list Length : constant Integer := 0; begin for I in 1 .. Length @@ -25,7 +25,7 @@ package body Generic_List is procedure Print (List : List_T) is begin - null; -- Print each element in list + null; -- Print each component in list end Print; end Generic_List; diff --git a/courses/fundamentals_of_ada/labs/prompts/160_genericity/generic_list.ads b/courses/fundamentals_of_ada/labs/prompts/160_genericity/generic_list.ads index 9b8566ba1..fc61a4f8e 100644 --- a/courses/fundamentals_of_ada/labs/prompts/160_genericity/generic_list.ads +++ b/courses/fundamentals_of_ada/labs/prompts/160_genericity/generic_list.ads @@ -1,21 +1,21 @@ generic - type Element_T is private; + type Component_T is private; -- Add other parameters for: -- Maximum size of list - -- Compare to elements - -- Convert element to string + -- Compare to components + -- Convert component to string package Generic_List is type List_T is private; procedure Add (This : in out List_T; - Item : in Element_T); + Item : in Component_T); procedure Sort (This : in out List_T); procedure Print (List : List_T); private - -- Update List_T to be a collection of Element_T + -- Update List_T to be a collection of Component_T type List_T is null record; end Generic_List; diff --git a/courses/fundamentals_of_ada/labs/prompts/160_genericity/main.adb b/courses/fundamentals_of_ada/labs/prompts/160_genericity/main.adb index 4b306bd71..712dabdc5 100644 --- a/courses/fundamentals_of_ada/labs/prompts/160_genericity/main.adb +++ b/courses/fundamentals_of_ada/labs/prompts/160_genericity/main.adb @@ -1,17 +1,17 @@ with Data_Type; with Generic_List; procedure Main is - package List is new Generic_List (Element_T => Data_Type.Record_T); + package List is new Generic_List (Component_T => Data_Type.Record_T); -- Need to add formal parameters as necessary My_List : List.List_T; - Element : Data_Type.Record_T; + Component : Data_Type.Record_T; begin -- Add some items to the list - List.Add (My_List, Element); - List.Add (My_List, Element); - List.Add (My_List, Element); + List.Add (My_List, Component); + List.Add (My_List, Component); + List.Add (My_List, Component); List.Sort (My_List); List.Print (My_List); From cddd73c9642c05538405a6bb3f0bac447d066625 Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Thu, 27 Mar 2025 12:50:57 -0400 Subject: [PATCH 6/6] Fix typo --- .../fundamentals_of_ada/240_tasking/22-task_safe_interfaces.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/courses/fundamentals_of_ada/240_tasking/22-task_safe_interfaces.rst b/courses/fundamentals_of_ada/240_tasking/22-task_safe_interfaces.rst index 6af1d2586..2bfbbeabf 100644 --- a/courses/fundamentals_of_ada/240_tasking/22-task_safe_interfaces.rst +++ b/courses/fundamentals_of_ada/240_tasking/22-task_safe_interfaces.rst @@ -92,7 +92,7 @@ Standard Library Queues Implementations * Priority implementations - :ada:`Unbounded_Priority_Queues` - - :ada:`Bounded_Priotiry_Queues` + - :ada:`Bounded_Priority_Queues` - As :ada:`protected` types - Elements provide :ada:`Get_Priority`