From ac2d76687e78e18e681a4bb35abcfac7cc93fba5 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:53:31 +0200 Subject: [PATCH 01/19] Editorial: fix typos/grammar in "Introduction to Ada" Co-Authored-By: Claude Sonnet 4.6 --- content/courses/intro-to-ada/chapters/arrays.rst | 2 +- content/courses/intro-to-ada/chapters/contracts.rst | 2 +- content/courses/intro-to-ada/chapters/exceptions.rst | 2 +- .../intro-to-ada/chapters/fixed_point_types.rst | 4 ++-- content/courses/intro-to-ada/chapters/generics.rst | 4 ++-- .../intro-to-ada/chapters/interfacing_with_c.rst | 2 +- .../intro-to-ada/chapters/modular_programming.rst | 2 +- .../courses/intro-to-ada/chapters/more_about_types.rst | 4 ++-- .../chapters/object_oriented_programming.rst | 10 +++++----- content/courses/intro-to-ada/chapters/records.rst | 2 +- .../chapters/standard_library_containers.rst | 2 +- .../chapters/standard_library_dates_times.rst | 2 +- .../chapters/standard_library_files_streams.rst | 2 +- .../intro-to-ada/chapters/standard_library_strings.rst | 4 ++-- content/courses/intro-to-ada/chapters/subprograms.rst | 4 ++-- content/courses/intro-to-ada/chapters/tasking.rst | 6 +++--- 16 files changed, 27 insertions(+), 27 deletions(-) diff --git a/content/courses/intro-to-ada/chapters/arrays.rst b/content/courses/intro-to-ada/chapters/arrays.rst index 4871815bc..c676f9a72 100644 --- a/content/courses/intro-to-ada/chapters/arrays.rst +++ b/content/courses/intro-to-ada/chapters/arrays.rst @@ -170,7 +170,7 @@ In the example above, we are: each. Being able to use enumeration values as indices is very helpful in creating -mappings such as shown above one, and is an often used feature in Ada. +mappings such as the one shown above, and is an often used feature in Ada. Indexing -------- diff --git a/content/courses/intro-to-ada/chapters/contracts.rst b/content/courses/intro-to-ada/chapters/contracts.rst index 50f9a764c..5c1b758b6 100644 --- a/content/courses/intro-to-ada/chapters/contracts.rst +++ b/content/courses/intro-to-ada/chapters/contracts.rst @@ -414,7 +414,7 @@ The dynamic predicate of the :ada:`Tests_Week` type is verified during the initialization of :ada:`Num_Tests`. If we have a non-conformant value there, the check will fail. However, as we can see in our example, individual assignments to elements of the array do not trigger a check. We -can't check for consistency at this point because the initialization of the +can't check for consistency at this point because the initialization of a complex data structure (such as arrays or records) may not be performed with a single assignment. However, as soon as the object is passed as an argument to a subprogram, the dynamic predicate is checked because the diff --git a/content/courses/intro-to-ada/chapters/exceptions.rst b/content/courses/intro-to-ada/chapters/exceptions.rst index abb8cd035..39822024d 100644 --- a/content/courses/intro-to-ada/chapters/exceptions.rst +++ b/content/courses/intro-to-ada/chapters/exceptions.rst @@ -91,7 +91,7 @@ exception handler to any statement block as follows: Put ("Cannot open input file : "); Put_Line (Exception_Message (E)); raise; - -- Reraise current occurence + -- Reraise current occurrence end; end Open_File; diff --git a/content/courses/intro-to-ada/chapters/fixed_point_types.rst b/content/courses/intro-to-ada/chapters/fixed_point_types.rst index 4b3ba555d..a6b6b5ec8 100644 --- a/content/courses/intro-to-ada/chapters/fixed_point_types.rst +++ b/content/courses/intro-to-ada/chapters/fixed_point_types.rst @@ -9,7 +9,7 @@ In this chapter, we discuss fixed-point types, which can be classified in two categories: :ref:`decimal fixed-point types ` and :ref:`ordinary (binary) fixed-point types `. -Afterward a brief overview of each category, we discuss some +After a brief overview of each category, we discuss some :ref:`differences between fixed-point and floating-point types `. @@ -318,7 +318,7 @@ type :ada:`Decimal` to the floating-point type :ada:`Float_32`: Both types in this example have roughly the same size and range. However, the result of the divide-by-two operation isn't the same: because of the exponent, -:ada:`F` has the expected value (0.005) after the operation. while the value of +:ada:`F` has the expected value (0.005) after the operation, while the value of :ada:`D` is zero. The reason is that the resulting value 0.005 cannot be represented by the decimal precision of the :ada:`Decimal` type. In the case of :ada:`F`, however, the value can be represented due to a simple change in the diff --git a/content/courses/intro-to-ada/chapters/generics.rst b/content/courses/intro-to-ada/chapters/generics.rst index eed7dc2ad..0d8d4c1e7 100644 --- a/content/courses/intro-to-ada/chapters/generics.rst +++ b/content/courses/intro-to-ada/chapters/generics.rst @@ -389,7 +389,7 @@ Just as a side note, we could also have written: Price_IO.Default_Aft := 2; Price_IO.Default_Exp := 0; -In this case, we're ajusting :ada:`Default_Aft`, too, to get two decimal digits +In this case, we're adjusting :ada:`Default_Aft`, too, to get two decimal digits after the point when calling :ada:`Put`. In addition to the generic :ada:`Float_IO` package, the following generic @@ -947,4 +947,4 @@ procedure (:ada:`Perform_Test`). Note that: of the :ada:`Color` type - For the formal :ada:`Test` procedure, we reference the - :ada:`Reverse_Array` procedure from the package. + :ada:`Reverse_It` procedure from the package. diff --git a/content/courses/intro-to-ada/chapters/interfacing_with_c.rst b/content/courses/intro-to-ada/chapters/interfacing_with_c.rst index 756780fd7..0613e3283 100644 --- a/content/courses/intro-to-ada/chapters/interfacing_with_c.rst +++ b/content/courses/intro-to-ada/chapters/interfacing_with_c.rst @@ -635,7 +635,7 @@ We can successfully bind our C code with Ada using the automatically-generated bindings, but they aren't ideal. Instead, we would prefer Ada bindings that match our (human) interpretation of the C header file. This requires manual analysis of the header file. The good news is -that we can use the automatic generated bindings as a starting point and +that we can use the automatically generated bindings as a starting point and adapt them to our needs. For example, we can: #. Define a :ada:`Test` type based on :ada:`System.Address` and use it in diff --git a/content/courses/intro-to-ada/chapters/modular_programming.rst b/content/courses/intro-to-ada/chapters/modular_programming.rst index d71558335..413ef9511 100644 --- a/content/courses/intro-to-ada/chapters/modular_programming.rst +++ b/content/courses/intro-to-ada/chapters/modular_programming.rst @@ -193,7 +193,7 @@ in the package body. Here we can see that the body of the :ada:`Increment_By` function has to be declared in the body. Coincidentally, introducing a body allows us to put the -:ada:`Last_Increment` variable in the body, and make them inaccessible to the +:ada:`Last_Increment` variable in the body, and make it inaccessible to the user of the :ada:`Operations` package, providing a first form of encapsulation. This works because entities declared in the body are *only* visible in the diff --git a/content/courses/intro-to-ada/chapters/more_about_types.rst b/content/courses/intro-to-ada/chapters/more_about_types.rst index f084034a5..e48ea16bb 100644 --- a/content/courses/intro-to-ada/chapters/more_about_types.rst +++ b/content/courses/intro-to-ada/chapters/more_about_types.rst @@ -42,10 +42,10 @@ convenient: - You can use the :ada:`others` choice to refer to every component that has not yet been specified, provided all those fields have the same type. -- You can use the range notation :ada:`..` to refer to specify a contiguous +- You can use the range notation :ada:`..` to specify a contiguous sequence of indices in an array. -However, note that as soon as you used a named association, all subsequent +However, note that as soon as you use a named association, all subsequent components likewise need to be specified with named associations. .. code:: ada compile_button project=Courses.Intro_To_Ada.More_About_Types.Points diff --git a/content/courses/intro-to-ada/chapters/object_oriented_programming.rst b/content/courses/intro-to-ada/chapters/object_oriented_programming.rst index 3fa4ef1a6..95008fc88 100644 --- a/content/courses/intro-to-ada/chapters/object_oriented_programming.rst +++ b/content/courses/intro-to-ada/chapters/object_oriented_programming.rst @@ -51,7 +51,7 @@ added: - Runtime polymorphism can be implemented using variant records. -However, this lists leaves out type extensions, if you don't consider +However, this list leaves out type extensions, if you don't consider variant records, and extensibility. The 1995 revision of Ada added a feature filling the gaps, which @@ -59,7 +59,7 @@ allowed people to program following the object-oriented paradigm in an easier fashion. This feature is called *tagged types*. .. note:: It's possible to program in Ada without ever creating tagged - types. If that's your prefered style of programming or you have + types. If that's your preferred style of programming or you have no specific use for tagged types, feel free to not use them, as is the case for many features of Ada. @@ -164,7 +164,7 @@ Tagged types ------------ The 1995 revision of the Ada language introduced tagged types to -fullfil the need for an unified solution that allows programming in an +fulfill the need for a unified solution that allows programming in an object-oriented style similar to the one described at the beginning of this chapter. @@ -407,7 +407,7 @@ above, you can also write the above program this way: If the dispatching parameter of a primitive is the first parameter, which is the case in our examples, you can call the primitive using -the dot notation. Any remaining parameter are passed normally: +the dot notation. Any remaining parameters are passed normally: .. code:: ada run_button project=Courses.Intro_To_Ada.Object_Oriented_Programming.Tagged_Types @@ -524,7 +524,7 @@ compilation errors would also occur for non-tagged types. Classwide access types ---------------------- -In this section, we'll discuss an useful pattern for object-oriented programming +In this section, we'll discuss a useful pattern for object-oriented programming in Ada: classwide access type. Let's start with an example where we declare a tagged type :ada:`T` and a derived type :ada:`T_New`: diff --git a/content/courses/intro-to-ada/chapters/records.rst b/content/courses/intro-to-ada/chapters/records.rst index 96f34e50a..024d1ca6c 100644 --- a/content/courses/intro-to-ada/chapters/records.rst +++ b/content/courses/intro-to-ada/chapters/records.rst @@ -163,7 +163,7 @@ variable declaration. For example: Some_Day : Date; Y : Integer renames Some_Day.Year; -Here, :ada:`Y` is an alias, so that every time we using :ada:`Y`, we are really +Here, :ada:`Y` is an alias, so that every time we use :ada:`Y`, we are really using the :ada:`Year` component of :ada:`Some_Day`. Let's look at a complete example: diff --git a/content/courses/intro-to-ada/chapters/standard_library_containers.rst b/content/courses/intro-to-ada/chapters/standard_library_containers.rst index 8a80c9adb..f2d45159a 100644 --- a/content/courses/intro-to-ada/chapters/standard_library_containers.rst +++ b/content/courses/intro-to-ada/chapters/standard_library_containers.rst @@ -1300,7 +1300,7 @@ previous section. In fact, since both kinds of maps share many operations, we didn't need to make extensive modifications when we changed our example to use ordered maps instead of hashed maps. The main difference is seen when we run the examples: the output of a hashed map is usually unordered, -but the output of a ordered map is always ordered, as implied by its name. +but the output of an ordered map is always ordered, as implied by its name. Complexity ~~~~~~~~~~ diff --git a/content/courses/intro-to-ada/chapters/standard_library_dates_times.rst b/content/courses/intro-to-ada/chapters/standard_library_dates_times.rst index 03c395277..6ba0e1925 100644 --- a/content/courses/intro-to-ada/chapters/standard_library_dates_times.rst +++ b/content/courses/intro-to-ada/chapters/standard_library_dates_times.rst @@ -202,7 +202,7 @@ Real-time In addition to :ada:`Ada.Calendar`, the standard library also supports time operations for real-time applications. These are included in the -:ada:`Ada.Real_Time` package. This package also include a :ada:`Time` type. +:ada:`Ada.Real_Time` package. This package also includes a :ada:`Time` type. However, in the :ada:`Ada.Real_Time` package, the :ada:`Time` type is used to represent an absolute clock and handle a time span. This contrasts with the :ada:`Ada.Calendar`, which uses the :ada:`Time` type to represent dates and diff --git a/content/courses/intro-to-ada/chapters/standard_library_files_streams.rst b/content/courses/intro-to-ada/chapters/standard_library_files_streams.rst index a3afeae2a..5f493b942 100644 --- a/content/courses/intro-to-ada/chapters/standard_library_files_streams.rst +++ b/content/courses/intro-to-ada/chapters/standard_library_files_streams.rst @@ -425,7 +425,7 @@ After the call to :ada:`Create`, we retrieve the corresponding use this stream to write information to the file via the :ada:`'Write` attribute of the :ada:`Float` type. After closing the file and reopening it for reading, we again retrieve the corresponding -:ada:`Stream_Access` element and processed to read information from the +:ada:`Stream_Access` element and proceed to read information from the file via the :ada:`'Read` attribute of the :ada:`Float` type. You can use streams to create and process files containing different data diff --git a/content/courses/intro-to-ada/chapters/standard_library_strings.rst b/content/courses/intro-to-ada/chapters/standard_library_strings.rst index 0742df396..a728537ee 100644 --- a/content/courses/intro-to-ada/chapters/standard_library_strings.rst +++ b/content/courses/intro-to-ada/chapters/standard_library_strings.rst @@ -4,7 +4,7 @@ Standard library: Strings .. include:: ../../../global.txt In previous chapters, we've seen source-code examples using the :ada:`String` -type, which is a fixed-length string type |mdash| essentialy, it's an array +type, which is a fixed-length string type |mdash| essentially, it's an array of characters. In many cases, this data type is good enough to deal with textual information. However, there are situations that require more advanced text processing. Ada offers alternative approaches for these cases: @@ -143,7 +143,7 @@ example, we retrieve all the words in the string. We do this using end loop; end Show_Find_Words; -We pass a set of characters to be used as delimitators to the procedure +We pass a set of characters to be used as delimiters to the procedure :ada:`Find_Token`. This set is a member of the :ada:`Character_Set` type from the :ada:`Ada.Strings.Maps` package. We call the :ada:`To_Set` function (from the same package) to initialize the set to :ada:`Whitespace` and then call diff --git a/content/courses/intro-to-ada/chapters/subprograms.rst b/content/courses/intro-to-ada/chapters/subprograms.rst index 58073444e..f72163e25 100644 --- a/content/courses/intro-to-ada/chapters/subprograms.rst +++ b/content/courses/intro-to-ada/chapters/subprograms.rst @@ -150,7 +150,7 @@ default or not. There are some rules: .. ?? to do with the use of positional versus named As a convention, people usually name parameters at the call site if the -function's corresponding parameters has a default value. However, it is also +function's corresponding parameters have a default value. However, it is also perfectly acceptable to name every parameter if it makes the code clearer. Nested subprograms @@ -457,7 +457,7 @@ acts like an uninitialized variable when the subprogram is invoked. Forward declaration of subprograms ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -As we saw earlier, a subprogram can be declared without being fully defined, +As we saw earlier, a subprogram can be declared without being fully defined. This is possible in general, and can be useful if you need subprograms to be mutually recursive, as in the example below: diff --git a/content/courses/intro-to-ada/chapters/tasking.rst b/content/courses/intro-to-ada/chapters/tasking.rst index 66e12b0fc..7fd2b7fa1 100644 --- a/content/courses/intro-to-ada/chapters/tasking.rst +++ b/content/courses/intro-to-ada/chapters/tasking.rst @@ -9,7 +9,7 @@ Ada. The following sections explain these concepts in more detail. Tasks ----- -A task can be thought as an application that runs *concurrently* with the +A task can be thought of as an application that runs *concurrently* with the main application. In other programming languages, a task might be called a :wikipedia:`thread `, and tasking might be called @@ -198,7 +198,7 @@ statement. For example: In this example, we're making the task :ada:`T` wait one second after each time it displays the "hello" message. In addition, the main task is waiting -1.5 seconds before displaying its own "hello" message +1.5 seconds before displaying its own "hello" message. Synchronization: rendezvous ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -327,7 +327,7 @@ example: end Show_Rendezvous_Loop; In this example, the task body implements an infinite loop that accepts -calls to the :ada:`Reset` and :ada:`Increment` entry. We make the following +calls to the :ada:`Reset` and :ada:`Increment` entries. We make the following observations: - The :ada:`accept E do ... end` block is used to increment a counter. From a14b96e4e300b4a5715d90f21a4f5bf5a124facc Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:52 +0200 Subject: [PATCH 02/19] Editorial: fix typos/grammar in "Introduction to Ada" labs Co-Authored-By: Claude Sonnet 4.6 --- content/labs/intro-to-ada/chapters/generics.rst | 2 +- content/labs/intro-to-ada/chapters/privacy.rst | 2 +- .../labs/intro-to-ada/chapters/standard_library_numerics.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/labs/intro-to-ada/chapters/generics.rst b/content/labs/intro-to-ada/chapters/generics.rst index 4dca72ca1..8168fe4b0 100644 --- a/content/labs/intro-to-ada/chapters/generics.rst +++ b/content/labs/intro-to-ada/chapters/generics.rst @@ -60,7 +60,7 @@ Display Array #. These are the formal parameters of the procedure: - #. a range type :ada:`T_Range` for the the array; + #. a range type :ada:`T_Range` for the array; #. a formal type :ada:`T_Element` for the elements of the array; diff --git a/content/labs/intro-to-ada/chapters/privacy.rst b/content/labs/intro-to-ada/chapters/privacy.rst index 07f189e16..293791dcc 100644 --- a/content/labs/intro-to-ada/chapters/privacy.rst +++ b/content/labs/intro-to-ada/chapters/privacy.rst @@ -247,7 +247,7 @@ Limited Strings #. The :ada:`Lim_String` type acts as a container for strings. - #. In the the private part, :ada:`Lim_String` is declared as an + #. In the private part, :ada:`Lim_String` is declared as an access type to a :ada:`String`. #. There are two versions of the :ada:`Init` function that initializes diff --git a/content/labs/intro-to-ada/chapters/standard_library_numerics.rst b/content/labs/intro-to-ada/chapters/standard_library_numerics.rst index 930cf3ba4..e79d1cf72 100644 --- a/content/labs/intro-to-ada/chapters/standard_library_numerics.rst +++ b/content/labs/intro-to-ada/chapters/standard_library_numerics.rst @@ -168,7 +168,7 @@ of values. **Remarks**: #. The :wikipedia:`root-mean-square ` - (RMS) value is an important information associated with sequences of + (RMS) value is important information associated with sequences of values. #. It's used, for example, as a measurement for signal processing. From 6d20336a0220924aebe2410e9852964b450a0868 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:53 +0200 Subject: [PATCH 03/19] Editorial: fix typos/grammar in "Advanced Ada" Co-Authored-By: Claude Sonnet 4.6 --- .../abstraction-oriented_prog/generics.rst | 18 +++---- .../abstraction-oriented_prog/oo_prog.rst | 4 +- .../strong_typing.rst | 12 ++--- .../parts/control_flow/exceptions.rst | 20 ++++---- .../parts/control_flow/expressions.rst | 14 +++--- .../parts/control_flow/statements.rst | 4 +- .../parts/control_flow/subprograms.rst | 20 ++++---- .../parts/data_types/aggregates.rst | 16 +++---- .../advanced-ada/parts/data_types/arrays.rst | 2 +- .../parts/data_types/numeric_attributes.rst | 14 +++--- .../parts/data_types/numerics.rst | 48 +++++++++---------- .../advanced-ada/parts/data_types/records.rst | 26 +++++----- .../data_types/shared_variable_control.rst | 6 +-- .../advanced-ada/parts/data_types/strings.rst | 8 ++-- .../advanced-ada/parts/data_types/types.rst | 28 +++++------ .../parts/data_types/types_representation.rst | 22 ++++----- .../interfacing_with_cpp.rst | 6 +-- .../parts/modular_prog/packages.rst | 6 +-- .../modular_prog/subprograms_modularity.rst | 2 +- .../resource_management/access_types.rst | 26 +++++----- .../anonymous_access_types.rst | 2 +- .../parts/resource_management/containers.rst | 4 +- .../resource_management/controlled_types.rst | 8 ++-- .../resource_management/limited_types.rst | 6 +-- 24 files changed, 161 insertions(+), 161 deletions(-) diff --git a/content/courses/advanced-ada/parts/abstraction-oriented_prog/generics.rst b/content/courses/advanced-ada/parts/abstraction-oriented_prog/generics.rst index fcec256c1..69ff798ed 100644 --- a/content/courses/advanced-ada/parts/abstraction-oriented_prog/generics.rst +++ b/content/courses/advanced-ada/parts/abstraction-oriented_prog/generics.rst @@ -428,7 +428,7 @@ parameter in the form: This will allow us to reuse definitions from the generic package. -This is the updated version of the our test application for the reversing +This is the updated version of our test application for the reversing algorithm: .. code:: ada run_button project=Courses.Advanced_Ada.Abstraction-Oriented_Prog.Generics.Formal_Packages.Simple_Generic_Array_Pkg @@ -529,7 +529,7 @@ instantiation: For the previous example, the definitions come from the declarations of the :ada:`Color_Pkg` package: -A complete parametrization, in constrast, contains the definition of all +A complete parametrization, in contrast, contains the definition of all types in the generic declaration. For example: .. code:: ada no_button project=Courses.Advanced_Ada.Abstraction-Oriented_Prog.Generics.Formal_Packages.Simple_Generic_Array_Pkg @@ -656,7 +656,7 @@ will therefore declare the following formal parameters: Note that :ada:`Image` and :ada:`Pkg_Test` are examples of formal subprograms, which have been discussed in the introductory course. Also, note that :ada:`S` is an example of a formal object, which we discuss in -later section. +a later section. This is a version of the test application that makes use of the generic :ada:`Perform_Test` procedure: @@ -759,7 +759,7 @@ related to the array that we're using for the test: - :ada:`S`: the string containing the array name - - the function :ada:`Image` that converts an elements of the array to a + - the function :ada:`Image` that converts an element of the array to a string We could abstract our implementation even further by moving these elements @@ -772,7 +772,7 @@ packages: Generic_Array_Bundle <= Generic_Array_Pkg This strategy demonstrates that, in Ada, it is really straightforward to -make use of generics in order to abstracts algorithms. +make use of generics in order to abstract algorithms. First, let us define the new :ada:`Generic_Array_Bundle` package, which references the :ada:`Generic_Array_Pkg` package and the two formal elements @@ -963,7 +963,7 @@ combination with other generic packages. Also, they don't define anything themselves. In this sense, signature packages don't have an associated package body. -Using signature packages is an useful approach to clean-up the declaration +Using signature packages is a useful approach to clean-up the declaration of generic packages or subprograms that contain many formal parameters. You may move these formal parameters into multiple signature packages, each one containing a group of formal parameters that belong together. @@ -1483,7 +1483,7 @@ This is just an example on how we could implement these :ada:`Set` and end My_Type_Pkg; -As expected, declaring and using variable of :ada:`My_Type` is +As expected, declaring and using a variable of :ada:`My_Type` is straightforward: .. code:: ada run_button project=Courses.Advanced_Ada.Abstraction-Oriented_Prog.Generics.Formal_Interfaces.Gen_Interface @@ -1947,7 +1947,7 @@ using a formal type and formal subprograms. Signature packages make it more explicit that the types and subprograms defined in the package represent an interface. This is an advantage over -the approach using formal subprograms directly. However, using signature +the approach using formal subprograms directly. However, using a signature package isn't as explicit as using the :ada:`interface` keyword. As mentioned before, signature packages aren't used in isolation, but in @@ -2485,7 +2485,7 @@ We create an instance of the :ada:`Gen_Float_Acc` by using the :ada:`My_Float` type declared in the :ada:`Float_Types` package. Because we used :ada:`<>` in the specification of :ada:`function "+"` (in the :ada:`Gen_Float_Acc` package), the compiler will automatically select -the addition operator that we've overriden in the :ada:`Float_Types` +the addition operator that we've overridden in the :ada:`Float_Types` package, so that we don't need to specify it in the package instantiation. The main reason for the formal subprogram in the specification of the diff --git a/content/courses/advanced-ada/parts/abstraction-oriented_prog/oo_prog.rst b/content/courses/advanced-ada/parts/abstraction-oriented_prog/oo_prog.rst index 7759a407d..0ff53f144 100644 --- a/content/courses/advanced-ada/parts/abstraction-oriented_prog/oo_prog.rst +++ b/content/courses/advanced-ada/parts/abstraction-oriented_prog/oo_prog.rst @@ -479,7 +479,7 @@ Calling inherited subprograms `Calling inherited subprograms in Ada `_. In object-oriented code, it is often the case that we need to call -inherited subprograms. Some programing languages make it very easy by +inherited subprograms. Some programming languages make it very easy by introducing a new keyword `super` (although this approach has its limits for languages that allow multiple inheritance of implementation). @@ -744,7 +744,7 @@ Now, if we want to add an extra :ada:`Parallelogram` class between of the :ada:`Parent` subtype in the :ada:`Rectangles` package, and no change is needed for the body. -This is not a new syntax nor a new idiom, but is worth considering it when +This is not a new syntax nor a new idiom, but is worth considering when one is developing a complex hierarchy of types, or at least a hierarchy that is likely to change regularly in the future. diff --git a/content/courses/advanced-ada/parts/abstraction-oriented_prog/strong_typing.rst b/content/courses/advanced-ada/parts/abstraction-oriented_prog/strong_typing.rst index d4127a722..a7b1ccdc1 100644 --- a/content/courses/advanced-ada/parts/abstraction-oriented_prog/strong_typing.rst +++ b/content/courses/advanced-ada/parts/abstraction-oriented_prog/strong_typing.rst @@ -400,7 +400,7 @@ Typical implementation ~~~~~~~~~~~~~~~~~~~~~~ Let's look at an application that declares a two-dimensional lookup table, -retrieves a value from it an displays this value. +retrieves a value from it and displays this value. .. code:: ada run_button project=Courses.Advanced_Ada.Abstraction-Oriented_Prog.Strong_Typing.Example_Table_Access.Table_Access_1 @@ -554,7 +554,7 @@ By using the mapping, we can select the correct chunks from the input testing purposes. Let's skip the discussion whether the design used in this application is -good or not and assume that all requirements listed above are set on stone +good or not and assume that all requirements listed above are set in stone and can't be changed. @@ -851,13 +851,13 @@ This is the updated specification of the :ada:`Test` child package: end Indirect_Ordering.Test; Note that we also declared a separate type for the array of ordered -chunks: :ada:`Ord_Chunks`. This is needed because the arrays uses a +chunks: :ada:`Ord_Chunks`. This is needed because the array uses a different index (:ada:`Ord_Chunk_Index`) and therefore can't be the same type as :ada:`Chunks`. For the same reason, we declared a separate type for the array of selected chunks: :ada:`Sel_Chunks`. As a side note, we're now able to include a :ada:`Dynamic_Predicate` to -:ada:`Ord_Chunks` that verifies that the index stored in the each chunk +:ada:`Ord_Chunks` that verifies that the index stored in each chunk matches the corresponding index of its position in the ordered array. We also had to add a new private package that includes a function that @@ -882,7 +882,7 @@ retrieves the range of an array of :ada:`Chunk` type |mdash| which are of end Indirect_Ordering.Cnvt; -This is needed for example in the :ada:`Get_Mapping` function, which has +This is needed, for example, in the :ada:`Get_Mapping` function, which has to deal with indices of these two types. Although this makes the code a little bit more verbose, it helps documenting the expected types in that function. @@ -1014,7 +1014,7 @@ to C1 : Chunk := C (S (I)); -The compiler will gives us an error, telling us that it expected the +The compiler will give us an error, telling us that it expected the :ada:`Chunk_Index` type, but found the :ada:`Ord_Chunk_Index` instead. By using Ada's strong typing, we're detecting issues at compile time instead of having to rely on extensive testing and debugging to detect diff --git a/content/courses/advanced-ada/parts/control_flow/exceptions.rst b/content/courses/advanced-ada/parts/control_flow/exceptions.rst index 5c87a45a9..321db38c0 100644 --- a/content/courses/advanced-ada/parts/control_flow/exceptions.rst +++ b/content/courses/advanced-ada/parts/control_flow/exceptions.rst @@ -63,13 +63,13 @@ details about these checks later on when we discuss A typical example is an :ref:`overflow check `. Consider a calculation using variables: if this calculation leads to a result that isn't representable with the underlying data types, we cannot possibly -store a value into a register or memory that can be considered correct |mdash| +store a value into a register or memory that can be considered correct |mdash| so we have to detect this situation. Unfortunately, because we're using variables, we obviously cannot verify the result of the calculation at compilation time, so we have to verify it at runtime. As we've mentioned before, Ada strives for detecting as many erroneous -conditions as possible, while other programming language would allow errors +conditions as possible, while other programming languages would allow errors such as overflow errors to remain undetected |mdash| which would likely lead the application to misbehave. Those checks raise an exception if an erroneous condition is detected, so the programmer has the means |mdash| and the @@ -247,7 +247,7 @@ could also display a message if the assertion is false: end Show_Pragma_Assert; Similarly, we can use the procedural form of :ada:`Assert`. For example, the -code above can implemented as follows: +code above can be implemented as follows: .. code:: ada run_button project=Courses.Advanced_Ada.Control_Flow.Exceptions.Asserts.Procedure_Assert :class: ada-run-expect-failure @@ -315,7 +315,7 @@ the :ada:`Assertion_Error` exception. The following table presents all policies that we can set: +----------------------------------+-------------------------------------------+ -| Policy | Descripton | +| Policy | Description | +==================================+===========================================+ | :ada:`Assert` | Check assertions | +----------------------------------+-------------------------------------------+ @@ -363,7 +363,7 @@ The following table presents all policies that we can set: - :ada:`Statement_Assertions` - :ada:`Subprogram_Variant` - Also, in addtion to :ada:`Check` and :ada:`Ignore`, GNAT allows you to set + Also, in addition to :ada:`Check` and :ada:`Ignore`, GNAT allows you to set a policy to :ada:`Disable` and :ada:`Suppressible`. You can read more about them in the @@ -1153,7 +1153,7 @@ allocating memory. Let's revisit an example that we On each allocation (:ada:`new UInt_7`), a storage check is performed. Because there isn't enough reserved storage space before the second allocation, the -checks fails and raises a :ada:`Storage_Error` exception. +check fails and raises a :ada:`Storage_Error` exception. @@ -1506,8 +1506,8 @@ we can simply use the :ada:`Read` and :ada:`Write` attributes. In this example, we store the exceptions raised in the application in the `exceptions_file.bin` file. In the exception part of procedures :ada:`Nested_1` and :ada:`Nested_2`, we call :ada:`Exception_Occurrence'Write` to store an -exception occurence in the file. In the :ada:`Read_Exceptions` block, we read -the exceptions from the the file by calling :ada:`Exception_Occurrence'Read`. +exception occurrence in the file. In the :ada:`Read_Exceptions` block, we read +the exceptions from the file by calling :ada:`Exception_Occurrence'Read`. Debugging exceptions in the GNAT toolchain @@ -1675,7 +1675,7 @@ generally easy to find out which one it is. Exception renaming ------------------ -We can rename exceptions by using the an exception renaming declaration in this +We can rename exceptions by using an exception renaming declaration in this form :ada:`Renamed_Exception : exception renames Existing_Exception;`. For example: @@ -2137,7 +2137,7 @@ exception.) Of course, in this specific example, suppressing the index check masks a severe issue. In contrast, an index check is performed in the :ada:`Value_Of` function -because of the :ada:`pragma Unsuppress`. As a result, the index checks fails in +because of the :ada:`pragma Unsuppress`. As a result, the index check fails in the call to this function, which raises a :ada:`Constraint_Error` exception. diff --git a/content/courses/advanced-ada/parts/control_flow/expressions.rst b/content/courses/advanced-ada/parts/control_flow/expressions.rst index 513b4cc17..3e6b93528 100644 --- a/content/courses/advanced-ada/parts/control_flow/expressions.rst +++ b/content/courses/advanced-ada/parts/control_flow/expressions.rst @@ -161,7 +161,7 @@ expressions. Very roughly said, this is how we can break up simple expressions: Later on in this chapter, we discuss :ref:`conditional expressions `, :ref:`quantified expressions ` and -:ref:`declare expressions ` in more details. +:ref:`declare expressions ` in more detail. In the relation :ada:`M2 in Off | A` from the code example, :ada:`Off | A` is a membership choice list, and :ada:`Off` and :ada:`A` are membership choices. @@ -241,7 +241,7 @@ just a single simple expression. (Note that simple expressions do not have to be "simple".) This simple expression consists of two terms: :ada:`2 ** 4` and :ada:`3 * C1 ** 8`. While the :ada:`2 ** 4` term is also a single factor, the :ada:`3 * C1 ** 8` term consists of two factors: :ada:`3` and :ada:`C1 ** 8`. -Both the :ada:`2 ** 4` and the :ada:`C1 ** 8` factors consists of two primaries +Both the :ada:`2 ** 4` and the :ada:`C1 ** 8` factors consist of two primaries each: - the :ada:`2 ** 4` factor has the primaries :ada:`2` and :ada:`4`, @@ -534,7 +534,7 @@ Quantified Expressions Quantified expressions are :ada:`for` expressions using a quantifier |mdash| which can be either :ada:`all` or :ada:`some` |mdash| and a predicate. This -kind of expressions let us formalize statements such as: +kind of expression lets us formalize statements such as: - "all values of array :ada:`A` must be zero" into :ada:`for all I in A'Range => A (I) = 0`, and @@ -553,8 +553,8 @@ two functions: - :ada:`Is_Zero`, which checks whether all components of an array :ada:`A` are zero, and -- :ada:`Has_Zero`, which checks whether array :ada:`A` has at least one - component of the array :ada:`A` is zero. +- :ada:`Has_Zero`, which checks whether at least one component of array + :ada:`A` is zero. This is the complete code: @@ -953,7 +953,7 @@ providing the reducer and its initial value: - the initial value is the value that we use before all other values of the list. -For example, if we use :ada:`+` as the operator and :ada:`0` an the initial +For example, if we use :ada:`+` as the operator and :ada:`0` as the initial value, we get the reduction expression: :ada:`0 + 2 + 3 + 4 = 9`. This can be implemented using an array: @@ -1018,7 +1018,7 @@ complete operation is: :ada:`1 * 2 * 3 * 4 = 24`.) Value sequences ~~~~~~~~~~~~~~~ -In addition to arrays, we can apply reduction expression to value sequences, +In addition to arrays, we can apply a reduction expression to value sequences, which consist of an iterated element association |mdash| for example, :ada:`[for I in 1 .. 3 => I + 1]`. We can simply *append* the reduction expression to a value sequence: diff --git a/content/courses/advanced-ada/parts/control_flow/statements.rst b/content/courses/advanced-ada/parts/control_flow/statements.rst index b589ff375..1890fa443 100644 --- a/content/courses/advanced-ada/parts/control_flow/statements.rst +++ b/content/courses/advanced-ada/parts/control_flow/statements.rst @@ -50,7 +50,7 @@ to apply it to. Let's see an example of labels with simple statements: Here, we're labeling each statement. For example, we use the :ada:`Show_Hello` label to identify the :ada:`Put_Line ("Hello World!");` statement. Note that we -can use multiple labels a single statement. In this code example, we use the +can use multiple labels for a single statement. In this code example, we use the :ada:`Show_Separator` and :ada:`Show_Block_Separator` labels for the same statement. @@ -399,7 +399,7 @@ Case statements and expressions As we know, the case statement has a choice expression (:ada:`case Choice_Expression is`), which is expected to be a discrete type. Also, this expression can be a function call or a type conversion, for example -|mdash| in additional to being a variable or a constant. +|mdash| in addition to being a variable or a constant. As we discussed :ref:`earlier on `, if we use parentheses, the contents between those diff --git a/content/courses/advanced-ada/parts/control_flow/subprograms.rst b/content/courses/advanced-ada/parts/control_flow/subprograms.rst index 45e58e2df..acc8eba45 100644 --- a/content/courses/advanced-ada/parts/control_flow/subprograms.rst +++ b/content/courses/advanced-ada/parts/control_flow/subprograms.rst @@ -191,7 +191,7 @@ The following table provides more details: Note that, for parameters of limited types, only those parameters whose type is *explicitly* limited are always passed by reference. We discuss this topic in -more details :ref:`in another chapter `. +more detail :ref:`in another chapter `. Let's see an example: @@ -391,7 +391,7 @@ error. Consider the following code example: end Show_By_Copy_By_Ref_Params; In the :ada:`Update_Value` procedure, because :ada:`Global_R` and :ada:`R` -have a type that is neither a by-pass nor a by-reference type, the language does +have a type that is neither a by-copy nor a by-reference type, the language does not specify whether the old or the new value would be read in the calls to :ada:`Put_Line`. In other words, the actual behavior is undefined. Also, this situation might raise the :ada:`Program_Error` exception. @@ -483,7 +483,7 @@ Parameter Associations When actual parameters are associated with formal parameters, some rules are checked. As a typical example, the type of each actual parameter must match the -type of the corresponding actual parameter. In this section, we see some details +type of the corresponding formal parameter. In this section, we see some details about how this association is made and some of the potential errors. .. admonition:: In the Ada Reference Manual @@ -543,7 +543,7 @@ default values. Let's see some examples: Add (A, Right => 2.0); end Show_Param_Association; -This code snippet has examples of positional and name parameter association. +This code snippet has examples of positional and named parameter association. Also, it has an example of mixed positional / named parameter association. In most cases, the actual :ada:`A` parameter is associated with the formal :ada:`Left` parameter, and the actual 2.0 parameter is associated with the @@ -720,7 +720,7 @@ For non-scalar types, not all operators are defined. For example, it wouldn't make sense to expect a compiler to include an addition operator for a record type with multiple components. Exceptions to this rule are the equality and inequality operators (:ada:`=` and :ada:`/=`), which are defined -for any type (be it scalar, record types, and array types). +for any type (be it scalar types, record types, or array types). For array types, the concatenation operator (:ada:`&`) is a primitive operator: @@ -1055,7 +1055,7 @@ is that, in the first version, the package specification contains the implementation of the :ada:`Is_Zero` function, while, in the second version, the implementation is in the body of the :ada:`Expr_Func` package. -An expression function can be, at same time, the specification and the +An expression function can be, at the same time, the specification and the implementation of a function. Therefore, in the first version of the :ada:`Expr_Func` package above, we don't have a separate implementation of the :ada:`Is_Zero` function because :ada:`(I = 0)` is the actual implementation of @@ -1657,7 +1657,7 @@ the :ada:`Logged_Failure`, so it never returns to the We could implement exception handling in the :ada:`Show_No_Return_Exception` procedure, so that the :ada:`Logged_Failure` exception could be handled there -after it's raised in :ada:`Log_And_Raise`. However, this wouldn't be +after it's raised in :ada:`Log_And_Raise`. However, this wouldn't be considered a *normal* return to the procedure because it wouldn't return to the point where it should (i.e. to the point where :ada:`Put_Line` is about to be called, right after the call to the :ada:`Log_And_Raise` procedure). @@ -1717,7 +1717,7 @@ the call in place of the call itself. In modern compilers, inlining depends on the optimization level selected by the user. For example, if we select the higher optimization level, the compiler -will perform automatic inlining agressively. +will perform automatic inlining aggressively. .. admonition:: In the GNAT toolchain @@ -1727,10 +1727,10 @@ will perform automatic inlining agressively. performance may be worse than the one we would achieve by compiling the same code with optimization level 2 (``-O2``). Therefore, the general recommendation is to not *just* select ``-O3`` for the optimized version of - an application, but instead compare it the optimized version built with + an application, but instead compare it to the optimized version built with ``-O2``. -It's important to highlight that the inlining we're referring above happens +It's important to highlight that the inlining we're referring to above happens automatically, so the decision about which subprogram is inlined depends entirely on the compiler. However, in some cases, it's better to reduce the optimization level and perform manual inlining instead of automatic inlining. diff --git a/content/courses/advanced-ada/parts/data_types/aggregates.rst b/content/courses/advanced-ada/parts/data_types/aggregates.rst index 052393342..7197615aa 100644 --- a/content/courses/advanced-ada/parts/data_types/aggregates.rst +++ b/content/courses/advanced-ada/parts/data_types/aggregates.rst @@ -311,7 +311,7 @@ components that have :ada:`<>` are not initialized: because the components of :ada:`Point_3D` don't have a default value. As no initialization is taking place for those components of the aggregate, the actual value that is assigned to the record is undefined. In other - words, the resulting behavior might dependent on the compiler's + words, the resulting behavior might depend on the compiler's implementation. When using GNAT, writing :ada:`(X => 42, Y => <>, Z => <>)` keeps the value @@ -638,7 +638,7 @@ Full coverage rules for Aggregates This section was originally written by Robert A. Duff and published as `Gem #1: Limited Types in Ada 2005 `_. -One interesting feature of Ada are the *full coverage rules* for +One interesting feature of Ada is the *full coverage rules* for aggregates. For example, suppose we have a record type: .. code:: ada no_button project=Courses.Advanced_Ada.Data_Types.Aggregates.Full_Coverage_Rules_Aggregates.Full_Coverage_Rules @@ -972,7 +972,7 @@ very similar way as we did with record aggregates. (See the comments in the code example for more details.) Note that, as for record aggregates, the :ada:`<>` makes use of the default -value (if it is available). We discuss this topic in more details +value (if it is available). We discuss this topic in more detail :ref:`later on `. :ada:`..` @@ -1829,7 +1829,7 @@ information from :ada:`P_1D`, while the remaining components |mdash| in this case, :ada:`Y` and :ada:`Z` |mdash| are just set to 0.6. Continuing with this example, in the next assignment to :ada:`P_3D`, we're -using information from :ada:`P_2` in the extension aggregate. This covers the +using information from :ada:`P_2D` in the extension aggregate. This covers the :ada:`Point_2D` part of the :ada:`P_3D` object |mdash| components :ada:`X` and :ada:`Y`, to be more specific. The :ada:`Point_3D` specific components of :ada:`P_3D` |mdash| component :ada:`Z` in this case |mdash| receive their @@ -1922,7 +1922,7 @@ Previously, we've discussed assign an object :ada:`Obj_From` of a tagged type to an object :ada:`Obj_To` of a descendent type. -We may want also to assign an object :ada:`Obj_From` of to an object +We may want to also assign an object :ada:`Obj_From` to an object :ada:`Obj_To` of the same type, but change some of the components in this assignment. To do this, we use delta aggregates. @@ -1980,7 +1980,7 @@ Let's reuse the :ada:`Points` package from a previous example: end Show_Points; Here, we assign :ada:`P1` to :ada:`P2`, but change the :ada:`X` component. -Also, we assign :ada:`P1` to :ada:`P3`, but change the :ada:`X` and :ada:`Y` +Also, we assign :ada:`P1` to :ada:`P3`, but change the :ada:`X` and :ada:`Y` components. We can use class-wide types with delta aggregates. Consider this example: @@ -2152,11 +2152,11 @@ We can use delta aggregates for arrays. Let's change the declaration of end Show_Points; The implementation of :ada:`Show_Points` in this example is very similar to the -version where use a record type. In this case, we: +version where we use a record type. In this case, we: - assign :ada:`P1` to :ada:`P2`, but change the first component, and -- we assign :ada:`P1` to :ada:`P3`, but change the first and second +- we assign :ada:`P1` to :ada:`P3`, but change the first and second components. Using slices diff --git a/content/courses/advanced-ada/parts/data_types/arrays.rst b/content/courses/advanced-ada/parts/data_types/arrays.rst index 2a7fc0070..3c457919e 100644 --- a/content/courses/advanced-ada/parts/data_types/arrays.rst +++ b/content/courses/advanced-ada/parts/data_types/arrays.rst @@ -12,7 +12,7 @@ Array constraints Array constraints are important in the declaration of an array because they define the total size of the array. In fact, arrays must always be constrained. In this section, we start our discussion with unconstrained array types, and -then continue with constrained arrays and arrays types. Finally, we discuss +then continue with constrained arrays and array types. Finally, we discuss the differences between unconstrained arrays and vectors. .. admonition:: In the Ada Reference Manual diff --git a/content/courses/advanced-ada/parts/data_types/numeric_attributes.rst b/content/courses/advanced-ada/parts/data_types/numeric_attributes.rst index 24f35d4fe..2e32b6ff6 100644 --- a/content/courses/advanced-ada/parts/data_types/numeric_attributes.rst +++ b/content/courses/advanced-ada/parts/data_types/numeric_attributes.rst @@ -349,7 +349,7 @@ bits for the floating-point mantissa of the :ada:`Float` type. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The :ada:`Machine_Emin` and :ada:`Machine_Emax` attributes return the minimum -and maximum value, respectively, of the machine exponent the floating-point +and maximum value, respectively, of the machine exponent of the floating-point type. Note that, in all cases, the returned value is a universal integer. For example: @@ -627,7 +627,7 @@ For example, on a typical PC with a machine radix of two, Round-up and round-down attributes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -:ada:`Floor` and :ada:`Ceiling` are attributes that returned the rounded-down +:ada:`Floor` and :ada:`Ceiling` are attributes that return the rounded-down or rounded-up value, respectively, of a floating-point value. For example: .. code:: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes.Floating_Point_Types.Floor_Ceiling @@ -649,7 +649,7 @@ Round-to-nearest attributes ^^^^^^^^^^^^^^^^^^^^^^^^^^^ In this section, we discuss three attributes used for rounding: -:ada:`Rounding`, :ada:`Unbiased_Rounding`, :ada:`Machine_Rounding` +:ada:`Rounding`, :ada:`Unbiased_Rounding`, :ada:`Machine_Rounding`. In all cases, the rounding attributes return the nearest integer value (as a floating-point value). For example, the rounded value for 4.8 is 5.0 because 5 is the closest integer value. @@ -733,7 +733,7 @@ point. For example, the truncation of 1.55 is 1.0 because the integer part of The :ada:`Remainder` attribute returns the remainder part of a division. For example, :ada:`Float'Remainder (1.25, 0.5) = 0.25`. Let's briefly discuss the -details of this operations. The result of the division 1.25 / 0.5 is 2.5. Here, +details of this operation. The result of the division 1.25 / 0.5 is 2.5. Here, 1.25 is the dividend and 0.5 is the divisor. The quotient and remainder of this division are 2 and 0.25, respectively. (Here, the quotient is an integer number, and the remainder is the floating-point part that remains.) @@ -1153,7 +1153,7 @@ This is the reason why we see 1.3008896 x 10\ :sup:`7` instead of 1.3008896 x 10\ :sup:`7`.) Depending on the model that is being used, the subtraction - :ada:`1.0E+15 - Float'Model (1.0E+15)` might gives us the same value as + :ada:`1.0E+15 - Float'Model (1.0E+15)` might give us the same value as :ada:`1.0E+15 - Float'Machine (1.0E+15)` or not. For example, the result is the same if the 32-bit IEEE floating-point model from the ISO/IEC 60559:2020 standard is being used. @@ -1375,7 +1375,7 @@ As we can see in the output of the code example, the :ada:`Delta` attribute returns the value we used for :ada:`delta` in the type definition of the :ada:`T3_D3`, :ada:`TD3`, :ada:`TQ31` and :ada:`TQ15` types. -The :ada:`TD3` type is an ordinary fixed-point type with the the same delta as +The :ada:`TD3` type is an ordinary fixed-point type with the same delta as the decimal :ada:`T3_D3` type. In this case, however, :ada:`TD3'Small` is not the same as the :ada:`TD3'Delta`. On a typical desktop PC, :ada:`TD3'Small` is 2\ :sup:`-10`, while the delta is 10\ :sup:`-3`. (Remember that, for ordinary @@ -1553,7 +1553,7 @@ In this example, we get the following values for the scales: - :ada:`TM3_D6'Scale = -3`, - :ada:`T3_D6'Scale = 3`, -- :ada:`T9_D12 = 9`. +- :ada:`T9_D12'Scale = 9`. As you can see, the value of :ada:`Scale` is directly related to the *delta* of the corresponding type declaration. diff --git a/content/courses/advanced-ada/parts/data_types/numerics.rst b/content/courses/advanced-ada/parts/data_types/numerics.rst index a0941b9d3..53707a211 100644 --- a/content/courses/advanced-ada/parts/data_types/numerics.rst +++ b/content/courses/advanced-ada/parts/data_types/numerics.rst @@ -470,7 +470,7 @@ the result is of universal real type: end Static_Expressions; In this example, the result of the static expression is of universal real type -because of we're using the named number :ada:`Pi`, which is of universal real +because we're using the named number :ada:`Pi`, which is of universal real type. Complexity of static expressions @@ -657,7 +657,7 @@ we use the :ada:`Long_Long_Float` type |mdash| as we see in the value of the Conversion of universal real and integer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Although a named number exists as an numeric representation form in Ada, the +Although a named number exists as a numeric representation form in Ada, the value it represents cannot be used directly at runtime |mdash| even if we *just* display the value of the constant at runtime, for example. In fact, a conversion to a non-universal type is required in order to use the named number @@ -957,7 +957,7 @@ In this example, the conversion from the fixed-point type :ada:`T3_D3` to the Similarly, the multiplication operation :ada:`Val_T6_D6 * 2.0` uses universal fixed types. Here, we're actually multiplying a variable of type :ada:`T6_D6` by two and assigning it to a variable of type :ada:`Val_T3_D6`. Although these -variable have different fixed-point types, no explicit conversion (e.g.: +variables have different fixed-point types, no explicit conversion (e.g.: :ada:`Val_T3_D6 := T3_D6 (Val_T6_D6 * 2.0);`) is required in this case because the result of the operation is of universal fixed type, so that it can be assigned to a variable of any fixed-point type. @@ -1086,7 +1086,7 @@ and the corresponding numeric root types. Ada also has the concept of base types, which *sounds* similar to the concept of the root type. However, the focus of each one is different: -while the the root type refers to the derivation tree of a type, the base +while the root type refers to the derivation tree of a type, the base type refers to the constraints of a type. In fact, the base type denotes the unconstrained underlying hardware @@ -2034,7 +2034,7 @@ section, we will revise and expand on those topics. Decimal precision ~~~~~~~~~~~~~~~~~ -The main defining characteristic of a floating-point types is its decimal +The main defining characteristic of a floating-point type is its decimal precision |mdash| and not its range, as for integer types. (You may, however, define :ref:`ranges for floating-point types `, @@ -3053,7 +3053,7 @@ floating-point types. circumvent limitations |mdash| such as the ones that originate from using integer types to emulate fixed-point operations. -As mentioned in the Introduction to Ada course course, fixed-point types +As mentioned in the Introduction to Ada course, fixed-point types are classified as either :ref:`decimal fixed-point types ` or ordinary (binary) types. @@ -3182,7 +3182,7 @@ rule that it must be smaller or equal to the *delta*. For example: & Ordinary_Fixed_Point'Size'Image); end Show_Fixed_Small_Delta; -In this example, the *delta* that we specifed for :ada:`Ordinary_Fixed_Point` +In this example, the *delta* that we specified for :ada:`Ordinary_Fixed_Point` is 0.2, while the compiler-selected *small* is 0.125 (2.0\ :sup:`-3`). .. admonition:: For further reading... @@ -3885,7 +3885,7 @@ of two not exceeding the *delta* value. Since 0.2 is not a power of two, we get 0.125 (= 2\ :sup:`-3`) as the *small* for the :ada:`Angle` type. In contrast, :ada:`Angle_Adj` explicitly sets :ada:`Small => D`, so that :ada:`Angle_Adj'Small` = :ada:`Angle_Adj'Delta` = 0.2. (We discuss this topic -in more details later on.) +in more detail later on.) .. todo:: @@ -4208,7 +4208,7 @@ an ordinary fixed-point type via :ada:`Fixed_Point (D)`. Show_Fixed_Point_Type_Info ("Fixed_Point "); end Show_Fixed_Point_Conversions; - By running this test application, we see that the the size of + By running this test application, we see that the size of :ada:`Decimal` is 31 bits, while size of :ada:`Fixed_Point` is 32 bits. Also, the *small* of :ada:`Decimal` is 1.0e-09 (10.0\ :sup:`-9`), while the *small* of :ada:`Fixed_Point` is a bit smaller: 4.65661287307739258e-10 @@ -4765,7 +4765,7 @@ objects of different decimal types: end Show_Mixing_Decimal_Types; In this example, the :ada:`A * B` expression makes use of universal fixed -types. If this wasn't the case, :ada:`B` would have to be first convert to the +types. If this wasn't the case, :ada:`B` would have to be first converted to the :ada:`Short_Decimal` type, and the result of the operation would be zero: .. code:: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics.Fixed_Point_Types.Universal_Fixed_Decimal @@ -4833,7 +4833,7 @@ types, and the :ada:`A / B` expression makes use of universal fixed types. .. admonition:: For further reading... - Note that we can use *explicit* type conversions, and the results is still + Note that we can use *explicit* type conversions, and the result is still the same: .. code:: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics.Fixed_Point_Types.Universal_Fixed_Decimal @@ -4899,7 +4899,7 @@ package: end Custom_Fixed_Point; -The :ada:`Show_Universal_Fixed` procedure show a couple of multiplications +The :ada:`Show_Universal_Fixed` procedure shows a couple of multiplications using universal fixed types: .. code:: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics.Fixed_Point_Types.Universal_Fixed @@ -5498,7 +5498,7 @@ In this example, we derive the :ada:`Smaller_Money` type from the :ada:`T2_D6` type and decrease the decimal precision from 6 to 2 digits. Because the *delta* of both types is the same, we see that the range of the :ada:`Smaller_Money` type (from -0.99 to 0.99) is smaller than the range of the -:ada:`T2_D6` type (from 9999.99 to 9999.99). +:ada:`T2_D6` type (from -9999.99 to 9999.99). As expected, the type conversion :ada:`Smaller_Money (D)` in this example |mdash| from :ada:`T2_D6` to the :ada:`Smaller_Money` type |mdash| raises a @@ -6182,7 +6182,7 @@ range at the same time. For example: end Show_Decimal_Subtype_Range; Now, :ada:`D6_RD3` and :ada:`D6_R5` are subtypes of the :ada:`D6` type, which -has a range between -999,999.0 to 999,999.0. For these subtypes, we use the +has a range between -999,999.0 and 999,999.0. For these subtypes, we use the same ranges as in the previous code example |mdash| i.e. the range of the :ada:`D6_RD3` type goes from -999.0 to 999.0, while the range of the :ada:`D6_R5` type goes from -5.0 to 5.0. @@ -6264,7 +6264,7 @@ example: In this example, we convert the value of :ada:`D6` |mdash| from the :ada:`T2_D6` to the :ada:`T2_D38` type |mdash| by writing :ada:`T2_D38 (D6)`. -This conversion is cannot is safe |mdash| i.e. it cannot raise an exception +This conversion is safe |mdash| i.e. it cannot raise an exception |mdash| because the range of the target type is wider. Of course, type conversions may fail when the ranges of two types don't @@ -6346,7 +6346,7 @@ values we can use for a scale :ada:`N` in the formula :ada:`delta 10.0 ** (-N)`. Because the formula uses a negative exponent (:ada:`-N`), this means that the minimum delta :ada:`Min_Delta` is calculated with the :ada:`Max_Scale`, while the :ada:`Max_Delta` is calculated with the -:ada:`Min_Scale`. In fact, this is declaration of those constants in the +:ada:`Min_Scale`. In fact, this is the declaration of those constants in the :ada:`Decimal` package: .. code-block:: ada @@ -6685,7 +6685,7 @@ range possible for that type, it is considered illegal: In this example, the range we declare for the :ada:`T0_D4` type (from -10,000 to 10,000) is outside the maximum range that the type allows -(from 9,999 to 9,999). +(from -9,999 to 9,999). Operations on decimal types @@ -6758,8 +6758,8 @@ Let's look at simple operations such as :ada:`1000 + 500.25` and A'Image); end Show_Mixing_Decimal_Types; -In this example, during to the :ada:`T0_D4 (B)` conversion, we get the value -500.0 instead of 500.25 to the delta of the :ada:`T0_D4` type. (This is of +In this example, due to the :ada:`T0_D4 (B)` conversion, we get the value +500.0 instead of 500.25, due to the delta of the :ada:`T0_D4` type. (This is of course the expected behavior for this type.) Therefore, the result of the operation is 500.0. @@ -7285,9 +7285,9 @@ types, too: In this case, the total price is 75.9696 and the price without sales tax is 63.84. Again, if we round the total price to get two digits after the dot, we -get 75.97 instead 75.96. +get 75.97 instead of 75.96. -A 0.01 error might be consider small, but the accumulation of such errors in +A 0.01 error might be considered small, but the accumulation of such errors in a complex financial application can be significant and, therefore, it might be considered undesirable. As we've seen in this example, we can use decimal fixed-point types to avoid such unwanted side effects. @@ -7635,7 +7635,7 @@ Validity ^^^^^^^^ The package specifications of big numbers include subtypes that *ensure* -that a actual value of a big number is valid: +that the actual value of a big number is valid: +------------------------------+---------------------------------------------+ | Type | Subtype for valid values | @@ -7762,7 +7762,7 @@ any signed or unsigned integer types: end Show_Arbitrary_Big_Integer_Conversion; -In this examples, we declare the :ada:`Long_Long_Integer_Conversions` and the +In this example, we declare the :ada:`Long_Long_Integer_Conversions` and the :ada:`Mod_32_Bit_Conversions` to be able to convert between big integers and the :ada:`Long_Long_Integer` and the :ada:`Mod_32_Bit` types, respectively. @@ -7898,7 +7898,7 @@ We can also convert between big reals and big integers (or standard integers): end Show_Big_Real_Big_Integer_Conversion; -Here, we use the :ada:`To_Real` and the :ada:`To_Big_Real` and functions for +Here, we use the :ada:`To_Real` and :ada:`To_Big_Real` functions for the conversions. diff --git a/content/courses/advanced-ada/parts/data_types/records.rst b/content/courses/advanced-ada/parts/data_types/records.rst index d2bc28f50..2b3ce2250 100644 --- a/content/courses/advanced-ada/parts/data_types/records.rst +++ b/content/courses/advanced-ada/parts/data_types/records.rst @@ -134,7 +134,7 @@ possible as well: A: 1 Therefore, we must write the default expression of each individual record -components in such a way that the resulting initialization value is always +component in such a way that the resulting initialization value is always correct, independently of the order that those expressions are evaluated. @@ -146,7 +146,7 @@ record component is only evaluated upon the creation of a default-initialized object of the record type." This means that the default expression is by itself not evaluated when we declare the record type, but when we create an object of this type. It follows from this rule that the default is only evaluated when -necessary, i.e,, when an explicit initial value is not specified in the object +necessary, i.e., when an explicit initial value is not specified in the object declaration. Let's see an example: @@ -294,7 +294,7 @@ Advanced Usages In addition to expressions such as subprogram calls, we can use :ref:`per-object expressions ` for the default value of a record component. (We discuss this topic later on -in more details.) +in more detail.) For example: @@ -1034,7 +1034,7 @@ read-only, so we cannot change it: end Show_Constant_Property; In this code example, the compilation fails because we cannot change the -:ada:`C` discriminant. In this sense, :ada:`C` is a basically a constant +:ada:`C` discriminant. In this sense, :ada:`C` is basically a constant component of the :ada:`R` object. @@ -1170,7 +1170,7 @@ discriminant to constraint a component of an In this example, :ada:`Null_Rec_A` and :ada:`Null_Rec_B` have the same size because the type is a null record. However, :ada:`Rec_Array_A` and :ada:`Rec_Array_B` have different sizes because we're setting the :ada:`L` -discriminant |mdash| which we use to constraint the :ada:`Arr` array component +discriminant |mdash| which we use to constrain the :ada:`Arr` array component of the :ada:`Rec_Array` type |mdash| to 10 and 20, respectively. @@ -1232,7 +1232,7 @@ In addition to that, we can also use a different kind of access types, namely :ref:`anonymous access-to-object subtypes `. This specific kind of discriminant is called :ref:`access discriminant `. We discuss -this topic in more details in another chapter. +this topic in more detail in another chapter. Let's see a code example: @@ -1536,7 +1536,7 @@ changes the discriminants of :ada:`M_2` from :ada:`(L => 1, M => 2)` to :ada:`(L => 7, M => 8)`. Note that assignments of mutable variables may not always work at runtime. For -example, if a discriminant of a mutable subtype is used to constraint a +example, if a discriminant of a mutable subtype is used to constrain a component of indefinite subtype, we might see the corresponding checks fail at runtime. For example: @@ -2133,7 +2133,7 @@ Discriminant constraints As we discussed before, when :ref:`declaring an object with a discriminant `, -we have to specify the values of the all discriminants |mdash| unless, of +we have to specify the values of all the discriminants |mdash| unless, of course, those discriminants have a :ref:`default value `. The values we specify for the discriminants are called discriminant constraints. @@ -2253,7 +2253,7 @@ constrained (by the :ada:`L => 5` discriminant constraint), while the :ada:`Unconstr` object is unconstrained. Note that, even though :ada:`Unconstr` is using the default value for :ada:`L` |mdash| which would correspond to the discriminant constraint :ada:`L => 1` |mdash| the object itself hasn't been -constraint at its declaration. +constrained at its declaration. Let's continue our discussion with a more complex example by reusing the :ada:`Unconstrained_Types` package that we declared in a @@ -2619,7 +2619,7 @@ Partial and full view ~~~~~~~~~~~~~~~~~~~~~ As we've just seen, if we declare a type with an unknown discriminant part, we -can only use it in the partial view. In the full view. we cannot use an unknown +can only use it in the partial view. In the full view, we cannot use an unknown discriminant part, but have to use either no discriminants or known discriminants. For example: @@ -2897,7 +2897,7 @@ compilation error: end Show_Object_Declaration; In addition, if we declare a subtype based on a type that allows range, index, -or discriminant constraints, but we don't constraint the subtype, this subtype +or discriminant constraints, but we don't constrain the subtype, this subtype is also considered an unconstrained subtype. For example: .. code:: ada compile_button project=Courses.Advanced_Ada.Data_Types.Records.Unknown_Discriminants.Other_Unconstrained_Subtypes @@ -3670,7 +3670,7 @@ Let's start with a simple record declaration: end Rec_Per_Object_Expressions; In this example, we see the :ada:`Stack` record type with a discriminant -:ada:`S`. In the declaration of the :ada:`Arr` component of the that type, +:ada:`S`. In the declaration of the :ada:`Arr` component of that type, :ada:`S` is a per-object expression, as it refers to the :ada:`S` discriminant. Also, :ada:`(1 .. S)` is a per-object constraint. @@ -3788,7 +3788,7 @@ record component: end Rec_Per_Object_Expressions; Here, we calculate the default value of :ada:`V` using the per-object -expression :ada:`D - 1`, and the default of value of :ada:`S` using the +expression :ada:`D - 1`, and the default value of :ada:`S` using the per-object :ada:`D'Size`. The default expression for a component of a discriminated record can be diff --git a/content/courses/advanced-ada/parts/data_types/shared_variable_control.rst b/content/courses/advanced-ada/parts/data_types/shared_variable_control.rst index 902edc221..670563393 100644 --- a/content/courses/advanced-ada/parts/data_types/shared_variable_control.rst +++ b/content/courses/advanced-ada/parts/data_types/shared_variable_control.rst @@ -452,7 +452,7 @@ words, these type declarations are equivalent: end Shared_Var_Types; -A simular rule applies to components of an array. When we use the +A similar rule applies to components of an array. When we use the :ada:`Atomic_Components`, the following aspects are implied: :ada:`Volatile`, :ada:`Volatile_Components` and :ada:`Independent_Components`. For example, these array declarations are equivalent: @@ -1284,7 +1284,7 @@ Atomic operations Ada offers four packages to handle atomic operations. Those packages are child packages of the :ada:`System.Atomic_Operations` package. We will discuss -each of those package individually in this section. +each of those packages individually in this section. .. admonition:: Relevant topics @@ -1608,7 +1608,7 @@ In this procedure, we also see two main the task *sleep* for a random amount of time (in the :ada:`Sleep_Range` range); and -- the block statement with the :ada:`Generate_Value` identified, where we +- the block statement with the :ada:`Generate_Value` identifier, where we generate a new value randomly and attempt to update the :ada:`Value` variable (of :ada:`Lazy_Value` type). diff --git a/content/courses/advanced-ada/parts/data_types/strings.rst b/content/courses/advanced-ada/parts/data_types/strings.rst index 694cc03fa..cbf3e4635 100644 --- a/content/courses/advanced-ada/parts/data_types/strings.rst +++ b/content/courses/advanced-ada/parts/data_types/strings.rst @@ -8,7 +8,7 @@ Strings Character and String Literals ----------------------------- -So far, we're already seen many examples of string literals |mdash| both in +So far, we've already seen many examples of string literals |mdash| both in the :ref:`Introduction to Ada ` course and in the present course. In this section, we define them once more and discuss a couple of details about them. @@ -148,7 +148,7 @@ This is made explicit by the declaration of :ada:`S2`. Here, by using the range Wide and Wide-Wide Strings -------------------------- -We've seen many source-code examples so far that includes strings. In most of +We've seen many source-code examples so far that include strings. In most of them, we were using the standard string type: :ada:`String`. This type is useful for the common use-case of displaying messages or dealing with information in plain English. Here, we define "plain English" as the use of the @@ -856,7 +856,7 @@ to worry about character sets, as UTF-8 is backwards compatible with ASCII. However, you might want to use Unicode symbols in your Ada source code to declare constants |mdash| as we did in the previous sections |mdash| and store -the source code in a UTF-8 coded file. In this case, you need be careful about +the source code in a UTF-8 coded file. In this case, you need to be careful about how this file is parsed by the compiler. Let's look at this source-code example: @@ -1063,7 +1063,7 @@ Parsing UTF-8 files for Wide-Wide-String processing A typical use-case is to parse a text file in UTF-8 format and use *wide-wide* strings to process the lines of that file. Before we look at the implementation -that does that, let's first write a procedure that generate a text file in +that does that, let's first write a procedure that generates a text file in UTF-8 format: .. code:: ada no_button project=Courses.Advanced_Ada.Data_Types.Strings.String_Encoding.UTF_8_File_Processing diff --git a/content/courses/advanced-ada/parts/data_types/types.rst b/content/courses/advanced-ada/parts/data_types/types.rst index 1a8a70fc6..552cdbbcf 100644 --- a/content/courses/advanced-ada/parts/data_types/types.rst +++ b/content/courses/advanced-ada/parts/data_types/types.rst @@ -86,7 +86,7 @@ symbols or reserved words specified in the Ada language: +------------------------------+----------------------------------------------+ | Unary adding operators | :ada:`+`, :ada:`-` | +------------------------------+----------------------------------------------+ -| multiplying opertors | :ada:`*`, :ada:`/`, :ada:`mod`, :ada:`rem` | +| multiplying operators | :ada:`*`, :ada:`/`, :ada:`mod`, :ada:`rem` | +------------------------------+----------------------------------------------+ | Highest precedence operators | :ada:`**`, :ada:`abs`, :ada:`not` | +------------------------------+----------------------------------------------+ @@ -326,11 +326,11 @@ that don't originate from object declarations: end loop; end Show_Objects; -As we can see in this code example a formal parameter of a subprogram or an +As we can see in this code example, a formal parameter of a subprogram or an entry is also an object |mdash| in addition, so are :ref:`value conversions `, the result returned by a function, the result of evaluating an :doc:`aggregate <./aggregates>`, loop -parameters, :doc:`arrays <./arrays>`, or the slices of arrays objects, or the +parameters, :doc:`arrays <./arrays>`, or the slices of array objects, or the components of composite objects. .. todo:: @@ -523,7 +523,7 @@ Let's see an example: Settings := (Started => True); end Show_Object_View; -In this example, both :ada:`Default_S` and :ada:`Dev` are constant objects. +In this example, both :ada:`Default` and :ada:`Dev` are constant objects. However, they have different views: while :ada:`Default_S` has a constant view because it doesn't have any parts with variable view, :ada:`Dev` has a variable view because it's a private type. Finally, as expected, :ada:`Settings` has a @@ -882,7 +882,7 @@ enumeration renaming, enumeration overloading and representation clauses. Enumerations as functions ~~~~~~~~~~~~~~~~~~~~~~~~~ -If you have used programming language such as C in the past, you're familiar +If you have used a programming language such as C in the past, you're familiar with the concept of enumerations being constants with integer values. In Ada, however, enumerations are not integers. In fact, they're actually parameterless functions! Let's consider this example: @@ -1019,7 +1019,7 @@ is just another name to refer to the actual enumeration (:ada:`Mon`). Put_Line (Day'Image (D1)); end Show_Renaming; - Note that the call to :ada:`Put_Line` still display ``Mon`` instead of + Note that the call to :ada:`Put_Line` still displays ``Mon`` instead of ``Monday``. Enumeration overloading @@ -1471,7 +1471,7 @@ Let's see some examples of indefinite types: In this example, both :ada:`Integer_Array` and :ada:`Simple_Record` are indefinite types. -As we've just mentioned, we cannot declare variable of indefinite types: +As we've just mentioned, we cannot declare variables of indefinite types: .. code:: ada compile_button project=Courses.Advanced_Ada.Data_Types.Types.Definite_Indefinite_Subtypes.Indefinite_Types :class: ada-expect-compile-error @@ -1778,7 +1778,7 @@ after the declaration of :ada:`Next`. Incomplete types are useful to declare :ref:`mutually dependent types `, as we'll -see later on. Also, we can also have formal incomplete types, as +see later on. We can also have formal incomplete types, as we'll discuss :ref:`later `. .. admonition:: In the Ada Reference Manual @@ -2986,7 +2986,7 @@ In this example, we have the :ada:`To_Integer` function that converts from the declare the :cpp:`T3` class before the :cpp:`T1` class, we could overload the :cpp:`=` operator, as you can see in the commented-out lines.) - In Ada, this kind of conversions isn't available. Instead, we have to + In Ada, this kind of conversion isn't available. Instead, we have to implement conversion functions such as the :ada:`To_Integer` function from the previous code example. This is the corresponding implementation: @@ -3646,11 +3646,11 @@ converts: - a value in the interval [0, 1) to :ada:`Off`, and - - a value equal or above 1.0 to :ada:`On`. + - a value equal to or above 1.0 to :ada:`On`. -Note that the string parameter of :ada:`To_Activation_State` function |mdash| +Note that the string parameter of the :ada:`To_Activation_State` function |mdash| which converts string literals |mdash| is of :ada:`Wide_Wide_String` type, and -not of :ada:`String` type, as it's the case for the other conversion functions. +not of :ada:`String` type, as is the case for the other conversion functions. In the :ada:`Activation_Examples` procedure, we show how we can initialize an object of :ada:`Activation_State` type with all kinds of literals (string, @@ -3725,7 +3725,7 @@ preconditions of the conversion function: S = "Unknown"; In this case, the precondition explicitly indicates which string literals are -allowed for the :ada:`To_Activation_State` type. +allowed for the :ada:`To_Activation_State` function. User-defined literals can also be used for more complex types, such as records. For example: @@ -3778,7 +3778,7 @@ string, its components are: Obviously, this example isn't particularly useful. However, the goal is to show that this approach is useful for more complex types where a string literal -(or a numeric literal) might simplify handling those types. Used-defined +(or a numeric literal) might simplify handling those types. User-defined literals let you design types in ways that, otherwise, would only be possible when using a preprocessor or a domain-specific language. diff --git a/content/courses/advanced-ada/parts/data_types/types_representation.rst b/content/courses/advanced-ada/parts/data_types/types_representation.rst index e081fe455..8c5760b5a 100644 --- a/content/courses/advanced-ada/parts/data_types/types_representation.rst +++ b/content/courses/advanced-ada/parts/data_types/types_representation.rst @@ -132,7 +132,7 @@ Ada offers multiple attributes to retrieve the size of a type or an object: For the first three attributes, the size is measured in bits. In the case of :ada:`Storage_Size`, the size is measured in storage elements. Note that the -size information depends your target architecture. We'll discuss some examples +size information depends on your target architecture. We'll discuss some examples to better understand the differences among those attributes. .. _Adv_Ada_Storage_Elements: @@ -781,7 +781,7 @@ share the same storage space or not. We can use the :ada:`Has_Same_Storage` and the :ada:`Overlaps_Storage` attributes to retrieve more information about how the storage space of two -objects related to each other: +objects is related to each other: - the :ada:`Has_Same_Storage` attribute indicates whether two objects have the exact same storage. @@ -890,7 +890,7 @@ In this code example, we implement two procedures: - :ada:`Show_Storage`, which shows storage information about two arrays by using the :ada:`Has_Same_Storage` and :ada:`Overlaps_Storage` attributes. -- :ada:`Process`, which are supposed to process an input array :ada:`X` and +- :ada:`Process`, which is supposed to process an input array :ada:`X` and store the processed data in the output array :ada:`Y`. - Note that the implementation of this procedure is actually just a @@ -984,7 +984,7 @@ the :ada:`Flags_1` array |mdash| has a size of 64 bits. Therefore, having a way to compact the representation |mdash| so that we can store multiple objects without wasting storage space |mdash| may help us -improving memory usage. This is actually possible by using the :ada:`Pack` +improve memory usage. This is actually possible by using the :ada:`Pack` aspect. For example, we could extend the previous example and declare a :ada:`Packed_Flags` type that makes use of this aspect: @@ -1046,7 +1046,7 @@ the one used for the :ada:`Flags_1` array above) to a packed representation this conversion may require writing custom code with manual bit-shifting and bit-masking to get the proper target representation. In Ada, however, we just need to indicate the actual type conversion, and the compiler takes care of -generating code containing bit-shifting and bit-masking to performs the type +generating code containing bit-shifting and bit-masking to perform the type conversion. Let's modify the previous example and introduce this type conversion: @@ -1837,7 +1837,7 @@ them happening behind your back. So if you write the explicit conversion, you get all the gobbledygook listed above, but you can be sure that this never happens unless you explicitly ask for it. -This also explains the restriction we mentioned in previous subsection from +This also explains the restriction we mentioned in the previous subsection from :arm22:`RM 13.1 <13-1>` (10): 10 For an untagged derived type, no type-related representation items are @@ -2297,7 +2297,7 @@ Also, we can assign to any of the components of a record that has the Display_State_Value (V); end Show_Unchecked_Union; -In the example above, we're use an aggregate in the assignments to :ada:`V`. By +In the example above, we're using an aggregate in the assignments to :ada:`V`. By doing so, we avoid that :ada:`Use_Enum` is set to the *wrong* component. For example: @@ -2325,7 +2325,7 @@ cannot directly assign to the :ada:`I` component because :ada:`Use_Enum` is set to :ada:`True`, so only the :ada:`S` is accessible. We can, however, read its value, as we do in the :ada:`Display_State_Value` procedure. -Be aware that, due to the fact the union is not checked, we might write invalid +Be aware that, due to the fact that the union is not checked, we might write invalid data to the record. In the example below, we initialize the :ada:`I` component with 3, which is a valid integer value, but results in an invalid value for the :ada:`S` component, as the value 3 cannot be mapped to the representation @@ -2460,7 +2460,7 @@ Here, we're assigning the address of the :ada:`I` object to the :ada:`A` address function System.Address_Image (A : System.Address) return String; - We can use this function to display the address in an user message, for + We can use this function to display the address in a user message, for example: .. code:: ada run_button project=Courses.Advanced_Ada.Data_Types.Type_Representation.Addresses.Show_Address_Attribute @@ -2574,7 +2574,7 @@ the :ada:`I` variable). the :ada:`System'To_Address` attribute denotes a function identical to :ada:`To_Address` (from the :ada:`System.Storage_Elements` package) except that it is a static attribute. (We talk about the - :ref:`To_Address function ` function later on.) + :ref:`To_Address function ` later on.) Note that we're using the :ada:`Atomic` aspect here, which we discuss :ref:`in another chapter `. @@ -2896,7 +2896,7 @@ used for storing names for this type. Let's see an example: end Show_Discard_Names; In this example, the compiler attempts to not store strings associated with -the :ada:`Months` type duration compilation. +the :ada:`Months` type during compilation. Note that the :ada:`Discard_Names` aspect is available for enumerations, exceptions, and tagged types. diff --git a/content/courses/advanced-ada/parts/interfacing_external/interfacing_with_cpp.rst b/content/courses/advanced-ada/parts/interfacing_external/interfacing_with_cpp.rst index ca847739e..e7a5b78ab 100644 --- a/content/courses/advanced-ada/parts/interfacing_external/interfacing_with_cpp.rst +++ b/content/courses/advanced-ada/parts/interfacing_external/interfacing_with_cpp.rst @@ -143,7 +143,7 @@ Also, in the declaration of :cpp:`my_func`, we need to include a reference to the original name using :ada:`External_Name`. If we leave this out, the linker won't be able to find the original implementation of :cpp:`my_func`, so it won't build the application. Note that the function name is not -:cpp:`my_func` anymore (as it was the case for the C version). Instead, it is +:cpp:`my_func` anymore (as was the case for the C version). Instead, it is now called :cpp:`_Z7my_funci`. This situation is caused by symbol mangling. In C, the symbol names in object files match the symbol name in the @@ -155,7 +155,7 @@ prominent example is the difference between the gcc and MSVC compilers. However, since GNAT is based on gcc, we can build applications using Ada and C++ code without issues |mdash| as long as we use the same compiler. -In order to retrieved the mangled symbol names, we can simply generate +In order to retrieve the mangled symbol names, we can simply generate bindings automatically by using :program:`g++` with the ``-fdump-ada-spec`` option: @@ -280,7 +280,7 @@ The Ada application can then use the bindings: Note that, in the Ada application, we cannot use the prefixed notation. This notation would be more similar to the corresponding syntax in C++. -This restriction is caused by the fact that the automatic generated +This restriction is caused by the fact that the automatically generated bindings don't use tagged types. However, if we adapt the declaration of :cpp:`Test` and replace it by :ada:`type Test is tagged limited record ...`, we'll be able to write :ada:`TA.my_func(1)` and :ada:`TA.get_cnt` in our diff --git a/content/courses/advanced-ada/parts/modular_prog/packages.rst b/content/courses/advanced-ada/parts/modular_prog/packages.rst index 3f5b26b80..777a3c3d6 100644 --- a/content/courses/advanced-ada/parts/modular_prog/packages.rst +++ b/content/courses/advanced-ada/parts/modular_prog/packages.rst @@ -187,7 +187,7 @@ In the :ref:`Introduction to Ada course `, we've seen that encapsulation plays an important role in modular programming. By using the private part of a package specification, we can disclose some -information, but, at the same time, prevent that this information gets +information, but, at the same time, prevent this information from being accessed where it shouldn't be used directly. Similarly, we've seen that we can use the private part of a package to distinguish between the :ref:`partial and full view ` of a data type. @@ -195,7 +195,7 @@ use the private part of a package to distinguish between the The main application of private packages is to create private child packages, whose purpose is to serve as internal implementation packages within a package hierarchy. By doing so, we can expose the internals to other public -child packages, but prevent that external clients can directly access them. +child packages, but prevent external clients from directly accessing them. As we'll see next, there are many rules that ensure that internal visibility is enforced for those private child packages. At the same time, the same rules @@ -1342,7 +1342,7 @@ Another use clause example ~~~~~~~~~~~~~~~~~~~~~~~~~~ Let's now consider a simple package called :ada:`Points`, which contains the -declaration of the :ada:`Point` type and two primitive: an :ada:`Init` function +declaration of the :ada:`Point` type and two primitives: an :ada:`Init` function and an addition operator. .. code:: ada compile_button project=Courses.Advanced_Ada.Modular_Prog.Packages.Use_Type_Clause.Use_Type_Clause diff --git a/content/courses/advanced-ada/parts/modular_prog/subprograms_modularity.rst b/content/courses/advanced-ada/parts/modular_prog/subprograms_modularity.rst index b84859cb8..93d683452 100644 --- a/content/courses/advanced-ada/parts/modular_prog/subprograms_modularity.rst +++ b/content/courses/advanced-ada/parts/modular_prog/subprograms_modularity.rst @@ -161,7 +161,7 @@ procedure :ada:`Test_Private_Data_Processing`. The fact that this procedure is private allows us to use the :ada:`Private_Data_Processing` package as if it was a non-private package. We then use the private :ada:`Test_Private_Data_Processing` procedure as our main application, so we can -run it to test application the private package. +run it to test the private package. Child subprograms of private packages diff --git a/content/courses/advanced-ada/parts/resource_management/access_types.rst b/content/courses/advanced-ada/parts/resource_management/access_types.rst index 170175318..1d79987d6 100644 --- a/content/courses/advanced-ada/parts/resource_management/access_types.rst +++ b/content/courses/advanced-ada/parts/resource_management/access_types.rst @@ -264,7 +264,7 @@ Pool-specific access types We've already discussed many aspects about pool-specific access types. In this section, we recapitulate some of those aspects, and discuss some new details -that haven't seen yet. +that we haven't seen yet. As we know, we cannot directly assign an object :ada:`Distance_Miles` of type :ada:`Miles` to an object :ada:`Distance_Meters` of type :ada:`Meters`, even if @@ -745,7 +745,7 @@ the :ada:`P` object and specify the constraints of the allocated string object However, the advantage of discriminants as access values isn't restricted to being able to use unconstrained types such as arrays: we could really - use any type as the designated subtype! In fact, we can generalized this + use any type as the designated subtype! In fact, we can generalize this to: .. code:: ada run_button project=Courses.Advanced_Ada.Resource_Management.Access_Types.Discriminants_As_Access_Values.Generic_Access @@ -1084,7 +1084,7 @@ replacing it with a new object that we allocate inside the As expected, contrary to the previous examples, we cannot implement this code by relying on parameter modes to replace the object. In fact, we have to -use access types for this kind of operations. +use access types for this kind of operation. Note that this implementation creates a memory leak. In a proper implementation, we should make sure to @@ -1225,7 +1225,7 @@ object won't be affected by the call to this subprogram. Note that this code actually compiles if we try to modify :ada:`N.all` in the :ada:`Show` procedure, but the post-condition fails at runtime when we do that. -(By uncommentating and building the code again, you'll see an exception being +(By uncommenting and building the code again, you'll see an exception being raised at runtime when trying to change the object.) In the postcondition above, we're using :ada:`'Old` to refer to the original @@ -1953,7 +1953,7 @@ number of coefficients, as we discuss as an example in this section. Uniform multidimensional arrays ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Consider an algorithm that processes data based on coefficients that depends on +Consider an algorithm that processes data based on coefficients that depend on a selected quality level: +------------------------+--------------+-----+-----+-----+-----+-----+ @@ -2325,7 +2325,7 @@ Note that these examples make use of these two features: 2. The retrieval of a reference to :ada:`I_Var` using the :ada:`Access` attribute. -In the next sections, we discuss these features in more details. +In the next sections, we discuss these features in more detail. .. admonition:: In the Ada Reference Manual @@ -2596,7 +2596,7 @@ to those components: end Show_Aliased_Components; In this example, we get access to the :ada:`I_Var_2` component of record -:ada:`R`. (Note that trying to access the :ada:`I_Var_1` component would gives us +:ada:`R`. (Note that trying to access the :ada:`I_Var_1` component would give us a compilation error, as this component is not aliased.) Similarly, we get access to the second component of array :ada:`Arr`. @@ -3167,7 +3167,7 @@ the compiler applies those rules to detect potential dangling references at compile time. When this detection isn't possible at compile time, the compiler introduces an :ref:`accessibility check `. If this check fails at runtime, it raises a :ada:`Program_Error` exception |mdash| -thereby preventing that a dangling reference gets used. +thereby preventing a dangling reference from being used. Let's see an example of how dangling references could occur: @@ -3243,7 +3243,7 @@ in terms of lifetime, and see which problems they are preventing in each case. :ada:`A1` has a longer lifetime than :ada:`I_Var_2`. After the :ada:`Inner_Block` finishes |mdash| when :ada:`I_Var_2` gets out of scope and its lifetime has ended |mdash|, :ada:`A1` would still be pointing to an - object that does not longer exist. + object that no longer exists. 2. In the :ada:`A2 := I_Var_2'Access` assignment, however, both :ada:`A2` and :ada:`I_Var_2` have the same lifetime. In that sense, the assignment may @@ -3371,7 +3371,7 @@ Therefore, we can assume that assigning the access to :ada:`I_Var` to :ada:`A` is safe. When we're sure that an access assignment cannot possibly generate dangling -references, we can the use :ada:`Unchecked_Access` attribute. For instance, we +references, we can use the :ada:`Unchecked_Access` attribute. For instance, we can use this attribute to circumvent the compilation error in the previous code example, since we know that the assignment is actually safe: @@ -3756,7 +3756,7 @@ program becomes erroneous, as we discuss in this section. Let's see an example: end Show_Unchecked_Deallocation; In this example, we allocate an object for :ada:`I_1` and make :ada:`I_2` point -to the same object. Then, we call :ada:`Free (I)`, which has the following +to the same object. Then, we call :ada:`Free (I_1)`, which has the following consequences: - The call to :ada:`Free (I_1)` will try to reclaim the storage for the @@ -5836,7 +5836,7 @@ In our discussion about accessibility rules, we've looked into the :ref:`accessibility rules ` that are based on those levels. The same accessibility rules apply to access-to-subprograms. :ref:`As we said previously `, -operations targeting objects at a *less-deep* level are illegal, as it's the +operations targeting objects at a *less-deep* level are illegal, as is the case for subprograms as well: .. code:: ada run_button project=Courses.Advanced_Ada.Resource_Management.Access_Types.Accessibility_Rules_Access_To_Subprograms.Access_To_Subprogram_Accessibility_Error_Less_Deep @@ -5929,7 +5929,7 @@ source code |mdash| for example, moving subprograms to a different level. Unchecked Access ~~~~~~~~~~~~~~~~ -Previously, we discussed about the +Previously, we discussed the :ref:`Unchecked_Access attribute `, which we can use to circumvent accessibility issues in specific cases for access-to-objects. We also said in that section that this attribute only exists for objects, not for diff --git a/content/courses/advanced-ada/parts/resource_management/anonymous_access_types.rst b/content/courses/advanced-ada/parts/resource_management/anonymous_access_types.rst index 12d56b1d9..5334a8935 100644 --- a/content/courses/advanced-ada/parts/resource_management/anonymous_access_types.rst +++ b/content/courses/advanced-ada/parts/resource_management/anonymous_access_types.rst @@ -1718,7 +1718,7 @@ when we call :ada:`Proc (Obj_Child)`, a compilation error occurs because the compiler expects type :ada:`T_Access` |mdash| there's no :ada:`Proc (N : T_Child_Access)` that could be used here. -If we replace :ada:`T_Access` in the :ada:`Proc` procedure with an an access +If we replace :ada:`T_Access` in the :ada:`Proc` procedure with an access parameter (:ada:`access T`), the subprogram becomes a primitive of :ada:`T`: .. code:: ada run_button project=Courses.Advanced_Ada.Resource_Management.Anonymous_Access_Types.Anonymous_Access_Parameters.Inherited_Primitives diff --git a/content/courses/advanced-ada/parts/resource_management/containers.rst b/content/courses/advanced-ada/parts/resource_management/containers.rst index 4c860b1a5..713ab4720 100644 --- a/content/courses/advanced-ada/parts/resource_management/containers.rst +++ b/content/courses/advanced-ada/parts/resource_management/containers.rst @@ -68,7 +68,7 @@ to specify a procedure that is called when adding an element to the container: - for indexed named container aggregates, the index of each component is explicitly indicated. - We discuss this topic later in more details. + We discuss this topic later in more detail. Some restrictions apply to the :ada:`Aggregate` aspect. For example: @@ -140,7 +140,7 @@ element. The :ada:`Empty` element allows us to specify the behavior for an empty container, i.e. the simplest version of a container without any components. -Let's assume we a container type :ada:`T` for which we specify an +Let's assume we have a container type :ada:`T` for which we specify an :ada:`Empty` function in the :ada:`Aggregate` aspect, and we declare an object :ada:`Obj : T`. In this case, the :ada:`Empty` function is called in one of two scenarios: diff --git a/content/courses/advanced-ada/parts/resource_management/controlled_types.rst b/content/courses/advanced-ada/parts/resource_management/controlled_types.rst index 193382ecf..9cb66dd78 100644 --- a/content/courses/advanced-ada/parts/resource_management/controlled_types.rst +++ b/content/courses/advanced-ada/parts/resource_management/controlled_types.rst @@ -697,7 +697,7 @@ In order to see this effect, let's start by implementing two controlled types: Now, let's use those controlled types as components of a type :ada:`T`. In addition, let's declare an integer component :ada:`I` with default -initialization. This is how the complete code looks like: +initialization. This is what the complete code looks like: .. code:: ada run_button project=Courses.Advanced_Ada.Resource_Management.Controlled_Types.Initialization.Controlled_Initialization @@ -2106,7 +2106,7 @@ Bounded errors of controlled types ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :ref:`Bounded errors ` are an important topic when -talking about exception and +talking about exceptions and controlled types. In general, if an exception is raised in the :ada:`Adjust` or :ada:`Finalize` procedure, this is considered a bounded error. If the bounded error is detected, the :ada:`Program_Error` exception is raised. @@ -2231,7 +2231,7 @@ procedure is called *explicitly*, the exception raised in that procedure is *not* considered a bounded error. In this case, the original exception is raised. -To show an example of such an explicit call, let's first move the overriden +To show an example of such an explicit call, let's first move the overridden procedures for type :ada:`T` (:ada:`Initialize`, :ada:`Adjust` and :ada:`Finalize`) out of the private part of the package :ada:`CT_Finalize_Exception`, so they are now visible to clients. This allows @@ -2749,7 +2749,7 @@ the location of the logfile (as the :ada:`Filename` parameter). Also, we can pass the logger to other subprograms and use it there. In this example, we pass the logger to the :ada:`Some_Processing` procedure and there, -we the call :ada:`Put_Line` using the logger object. +we call :ada:`Put_Line` using the logger object. Finally, as soon as the logger goes out of scope, the log is automatically closed via the call to :ada:`Finalize`. diff --git a/content/courses/advanced-ada/parts/resource_management/limited_types.rst b/content/courses/advanced-ada/parts/resource_management/limited_types.rst index eed17eb0e..7df8b680d 100644 --- a/content/courses/advanced-ada/parts/resource_management/limited_types.rst +++ b/content/courses/advanced-ada/parts/resource_management/limited_types.rst @@ -9,7 +9,7 @@ discuss limited types. We can think of limited types as an easy way to avoid inappropriate semantics. For example, a lock should not be copied |mdash| neither directly, via assignment, nor with pass-by-copy. Similarly, a *file*, which is really a file -descriptor, should not be copied. In this chapter, we'll see example of +descriptor, should not be copied. In this chapter, we'll see examples of unwanted side-effects that arise if we don't use limited types for these cases. @@ -293,7 +293,7 @@ The :ada:`Copy` procedure from this example copies the dereferenced values of :ada:`Simple_Rec`. Note that we could have also implemented a :ada:`Shallow_Copy` procedure to copy the actual access values (i.e. :ada:`To.V := From.V`). However, having this kind of procedure can be dangerous -in many case, so this design decision must be made carefully. In any case, +in many cases, so this design decision must be made carefully. In any case, using limited types ensures that only the assignment subprograms that are explicitly declared in the package specification are available. @@ -2321,7 +2321,7 @@ Some languages have a specific feature called *constructor*. In Ada, a end Show_Set_Decl; which might mean "default-initialize to the empty set" or might mean - "leave it uninitialized, and we'll initialize it in later". + "leave it uninitialized, and we'll initialize it later". Return objects -------------- From 9abe132542c42c21ad97e1dd247a81f03f5cee72 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:53 +0200 Subject: [PATCH 04/19] Editorial: fix typos/grammar in "Advanced SPARK" Co-Authored-By: Claude Sonnet 4.6 --- content/courses/advanced-spark/chapters/concurrency.rst | 2 +- .../courses/advanced-spark/chapters/subprogram_contracts.rst | 2 +- content/courses/advanced-spark/chapters/systems_programming.rst | 2 +- content/courses/advanced-spark/chapters/test_and_proof.rst | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/content/courses/advanced-spark/chapters/concurrency.rst b/content/courses/advanced-spark/chapters/concurrency.rst index d1caa874c..be836f263 100644 --- a/content/courses/advanced-spark/chapters/concurrency.rst +++ b/content/courses/advanced-spark/chapters/concurrency.rst @@ -146,7 +146,7 @@ Setup for using concurrency in SPARK - ... which are checked by GNAT partition-wide - - pragmas needed for verification even it not for compilation + - pragmas needed for verification even if not for compilation Tasks in Ravenscar diff --git a/content/courses/advanced-spark/chapters/subprogram_contracts.rst b/content/courses/advanced-spark/chapters/subprogram_contracts.rst index 55010f059..290561d8b 100644 --- a/content/courses/advanced-spark/chapters/subprogram_contracts.rst +++ b/content/courses/advanced-spark/chapters/subprogram_contracts.rst @@ -316,7 +316,7 @@ Universal and Existential Quantification - ``(∀ X . X ≥ A ⋀ X ≤ B → C)`` - - :ada:`(for some X in A .. B => C)` expresses the universally + - :ada:`(for some X in A .. B => C)` expresses the existentially quantified property - ``(∃ X . X ≥ A ⋀ X ≤ B ⋀ C)`` diff --git a/content/courses/advanced-spark/chapters/systems_programming.rst b/content/courses/advanced-spark/chapters/systems_programming.rst index 71c9d4dc5..0113a33e9 100644 --- a/content/courses/advanced-spark/chapters/systems_programming.rst +++ b/content/courses/advanced-spark/chapters/systems_programming.rst @@ -845,7 +845,7 @@ Example #8 This code is not correct. ``X`` has :ada:`Async_Writers = False`, hence is not considered as always initialized. As aspect :ada:`Initializes` specifies that ``State`` should be initialized after elaboration, this is -an error. Note that is allowed to bundle volatile and non-volatile +an error. Note that it is allowed to bundle volatile and non-volatile variables in an external abstract state. diff --git a/content/courses/advanced-spark/chapters/test_and_proof.rst b/content/courses/advanced-spark/chapters/test_and_proof.rst index 61660882c..ce0fde3f9 100644 --- a/content/courses/advanced-spark/chapters/test_and_proof.rst +++ b/content/courses/advanced-spark/chapters/test_and_proof.rst @@ -280,7 +280,7 @@ The same contracts are useful for test and for proof, so it’s useful to develop them for test initially. **Evaluation**: This approach is not correct. In fact, proof requires more -contracts that test, as each subprogram is analyzed separately. But these +contracts than test, as each subprogram is analyzed separately. But these are a superset of the contracts used for test. From 56465abc26028b82aa286722150d26c89b9908b3 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:53 +0200 Subject: [PATCH 05/19] Editorial: fix typos/grammar in "Ada for the C++/Java Developer" Co-Authored-By: Claude Sonnet 4.6 --- .../Ada_For_The_CPP_Java_Developer/chapters/02_Basics.rst | 2 +- .../chapters/05_Type_System.rst | 6 +++--- .../chapters/06_Functions_and_Procedures.rst | 2 +- .../Ada_For_The_CPP_Java_Developer/chapters/07_Packages.rst | 2 +- .../chapters/08_Classes_and_Object_Oriented_Programming.rst | 4 ++-- .../chapters/14_References.rst | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/02_Basics.rst b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/02_Basics.rst index 1172bbb3f..318f2920b 100644 --- a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/02_Basics.rst +++ b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/02_Basics.rst @@ -5,7 +5,7 @@ Basics Ada implements the vast majority of programming concepts that you're accustomed to in C++ and Java: classes, inheritance, templates (generics), etc. Its syntax might seem peculiar, though. It's not derived from the popular C style of notation with its ample use of brackets; rather, it uses a more expository syntax coming from Pascal. In many ways, Ada is a simpler language |mdash| its syntax favors making it easier to conceptualize and read program code, rather than making it faster to write in a cleverly condensed manner. For example, full words like :ada:`begin` and :ada:`end` are used in place of curly braces. Conditions are written using :ada:`if`, :ada:`then`, :ada:`elsif`, :ada:`else`, and :ada:`end if`. Ada's assignment operator does not double as an expression, smoothly eliminating any frustration that could be caused by :cpp:`=` being used where :cpp:`==` should be. -All languages provide one or more ways to express comments. In Ada, two consecutive hyphens :ada:`--` mark the start of a comment that continues to the end of the line. This is exactly the same as using :cpp:`//` for comments in C++ and Java. There is no equivalent of :cpp:`/* ... /*` block comments in Ada; use multiple :ada:`--` lines instead. +All languages provide one or more ways to express comments. In Ada, two consecutive hyphens :ada:`--` mark the start of a comment that continues to the end of the line. This is exactly the same as using :cpp:`//` for comments in C++ and Java. There is no equivalent of :cpp:`/* ... */` block comments in Ada; use multiple :ada:`--` lines instead. Ada compilers are stricter with type and range checking than most C++ and Java programmers are used to. Most beginning Ada programmers encounter a variety of warnings and error messages when coding more creatively, but this helps detect problems and vulnerabilities at compile time |mdash| early on in the development cycle. In addition, dynamic checks (such as array bounds checks) provide verification that could not be done at compile time. Dynamic checks are performed at run time, similar to what is done in Java. diff --git a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/05_Type_System.rst b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/05_Type_System.rst index d0a9717e8..d39efb792 100644 --- a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/05_Type_System.rst +++ b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/05_Type_System.rst @@ -178,7 +178,7 @@ Contracts can be associated with types and variables, to refine values and defin G1 := (G1 + G2)/2; -- Legal, run-time range check end Main; -In the above example, :ada:`Grade` is a new integer type associated with a range check. Range checks are dynamic and are meant to enforce the property that no object of the given type can have a value outside the specified range. In this example, the first assignment to :ada:`G1` is correct and will not raise a run-time exceprion. Assigning :ada:`N` to :ada:`G1` is illegal since :ada:`Grade` is a different type than :ada:`Integer`. Converting :ada:`N` to :ada:`Grade` makes the assignment legal, and a range check on the conversion confirms that the value is within :ada:`0 .. 100`. Assigning :ada:`G1+10` to :ada:`G2` is legal since :ada:`+` for :ada:`Grade` returns a :ada:`Grade` (note that the literal :ada:`10` is interpreted as a :ada:`Grade` value in this context), and again there is a range check. +In the above example, :ada:`Grade` is a new integer type associated with a range check. Range checks are dynamic and are meant to enforce the property that no object of the given type can have a value outside the specified range. In this example, the first assignment to :ada:`G1` is correct and will not raise a run-time exception. Assigning :ada:`N` to :ada:`G1` is illegal since :ada:`Grade` is a different type than :ada:`Integer`. Converting :ada:`N` to :ada:`Grade` makes the assignment legal, and a range check on the conversion confirms that the value is within :ada:`0 .. 100`. Assigning :ada:`G1+10` to :ada:`G2` is legal since :ada:`+` for :ada:`Grade` returns a :ada:`Grade` (note that the literal :ada:`10` is interpreted as a :ada:`Grade` value in this context), and again there is a range check. The final assignment illustrates an interesting but subtle point. The subexpression :ada:`G1 + G2` may be outside the range of :ada:`Grade`, but the final result will be in range. Nevertheless, depending on the representation chosen for :ada:`Grade`, the addition may overflow. If the compiler represents :ada:`Grade` values as signed 8-bit integers (i.e., machine numbers in the range :ada:`-128 .. 127`) then the sum :ada:`G1+G2` may exceed 127, resulting in an integer overflow. To prevent this, you can use explicit conversions and perform the computation in a sufficiently large integer type, for example: @@ -287,7 +287,7 @@ Other interesting examples are the :ada:`'First` and :ada:`'Last` attributes whi Arrays and Strings ~~~~~~~~~~~~~~~~~~~~~ -C++ arrays are pointers with offsets, but the same is not the case for Ada and Java. Arrays in the latter two languages are not interchangable with operations on pointers, and array types are considered first-class citizens. Arrays in Ada have dedicated semantics such as the availability of the array's boundaries at run-time. Therefore, unhandled array overflows are impossible unless checks are suppressed. Any discrete type can serve as an array index, and you can specify both the starting and ending bounds |mdash| the lower bound doesn't necessarily have to be 0. Most of the time, array types need to be explicitly declared prior to the declaration of an object of that array type. +C++ arrays are pointers with offsets, but the same is not the case for Ada and Java. Arrays in the latter two languages are not interchangeable with operations on pointers, and array types are considered first-class citizens. Arrays in Ada have dedicated semantics such as the availability of the array's boundaries at run-time. Therefore, unhandled array overflows are impossible unless checks are suppressed. Any discrete type can serve as an array index, and you can specify both the starting and ending bounds |mdash| the lower bound doesn't necessarily have to be 0. Most of the time, array types need to be explicitly declared prior to the declaration of an object of that array type. Here's an example of declaring an array of 26 characters, initializing the values from ``'a'`` to ``'z'``: @@ -334,7 +334,7 @@ In C++ and Java, only the size of the array is given during declaration. In Ada, As in C++, Ada :ada:`String`\s are arrays of :ada:`Character`\s. The C++ or Java :cpp:`String` class is the equivalent of the Ada type :ada:`Ada.Strings.Unbounded_String` which offers additional capabilities in exchange for some overhead. Ada strings, importantly, are not delimited with the special character :cpp:`\'\\0\'` like they are in C++. It is not necessary because Ada uses the array's bounds to determine where the string starts and stops. -Ada's predefined :ada:`String` type is very straighforward to use: +Ada's predefined :ada:`String` type is very straightforward to use: .. code-block:: ada diff --git a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/06_Functions_and_Procedures.rst b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/06_Functions_and_Procedures.rst index 7710ac5e9..3d376c33d 100644 --- a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/06_Functions_and_Procedures.rst +++ b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/06_Functions_and_Procedures.rst @@ -81,7 +81,7 @@ In Ada the programmer specifies how the parameter will be used and in general th } } -The first two declarations for :ada:`Proc` and :ada:`Func` are specifications of the subprograms which are being provided later. Although optional here, it's still considered good practice to separately define specifications and implementations in order to make it easier to read the program. In Ada and C++, a function that has not yet been seen cannot be used. Here, :ada:`Proc` can call :ada:`Func` because its specification has been declared. In Java, it's fine to have the declaration of the subprogram later . +The first two declarations for :ada:`Proc` and :ada:`Func` are specifications of the subprograms which are being provided later. Although optional here, it's still considered good practice to separately define specifications and implementations in order to make it easier to read the program. In Ada and C++, a function that has not yet been seen cannot be used. Here, :ada:`Proc` can call :ada:`Func` because its specification has been declared. In Java, it's fine to have the declaration of the subprogram later. Parameters in Ada subprogram declarations are separated with semicolons, because commas are reserved for listing multiple parameters of the same type. Parameter declaration syntax is the same as variable declaration syntax, including default values for parameters. If there are no parameters, the parentheses must be omitted entirely from both the declaration and invocation of the subprogram. diff --git a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/07_Packages.rst b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/07_Packages.rst index d20951183..2bec1435f 100644 --- a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/07_Packages.rst +++ b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/07_Packages.rst @@ -69,7 +69,7 @@ Here, :ada:`Root.Child` is a child package of :ada:`Root`. The public part of :a Using Entities from Packages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Entities declared in the visible part of a package specification can be made accessible using a :ada:`with` clause that references the package, which is similar to the C++ :cpp:`#include` directive. Visibility is implicit in Java: you can always access all classes located in your *CLASSPATH*. After a :ada:`with` clause, entities needs to be prefixed by the name of their package, like a C++ namespace or a Java package. This prefix can be omitted if a :ada:`use` clause is employed, similar to a C++ :cpp:`using namespace` or a Java :java:`import`. +Entities declared in the visible part of a package specification can be made accessible using a :ada:`with` clause that references the package, which is similar to the C++ :cpp:`#include` directive. Visibility is implicit in Java: you can always access all classes located in your *CLASSPATH*. After a :ada:`with` clause, entities need to be prefixed by the name of their package, like a C++ namespace or a Java package. This prefix can be omitted if a :ada:`use` clause is employed, similar to a C++ :cpp:`using namespace` or a Java :java:`import`. [Ada] diff --git a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/08_Classes_and_Object_Oriented_Programming.rst b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/08_Classes_and_Object_Oriented_Programming.rst index 4e25de47e..f43f9d806 100644 --- a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/08_Classes_and_Object_Oriented_Programming.rst +++ b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/08_Classes_and_Object_Oriented_Programming.rst @@ -239,7 +239,7 @@ This is called "redispatching." Be careful, because this is the most common mist Constructors and Destructors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Ada does not have constructors and destructors in quite the same way as C++ and Java, but there is analagous functionality in Ada in the form of default initialization and finalization. +Ada does not have constructors and destructors in quite the same way as C++ and Java, but there is analogous functionality in Ada in the form of default initialization and finalization. Default initialization may be specified for a record component and will occur if a variable of the record type is not assigned a value at initialization. For example: @@ -452,7 +452,7 @@ Invariants *This section is not part of the OOP material and should be moved to a different chapter* -Any private type in Ada may be associated with a :ada:`Type_Invariant` contract. An invariant is a property of a type that must always be true after the return from of any of its primitive subprograms. (The invariant might not be maintained during the execution of the primitive subprograms, but will be true after the return.) Let's take the following example: +Any private type in Ada may be associated with a :ada:`Type_Invariant` contract. An invariant is a property of a type that must always be true after the return from any of its primitive subprograms. (The invariant might not be maintained during the execution of the primitive subprograms, but will be true after the return.) Let's take the following example: .. code-block:: ada diff --git a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/14_References.rst b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/14_References.rst index 560d01853..4d73e6402 100644 --- a/content/courses/Ada_For_The_CPP_Java_Developer/chapters/14_References.rst +++ b/content/courses/Ada_For_The_CPP_Java_Developer/chapters/14_References.rst @@ -5,6 +5,6 @@ References .. include:: ../../../global.txt -The Ada Information Clearinghouse website http://www.adaic.org/learn/materials/, maintained by the Ada Resource Association, contains links to a variety of training materials (books, articles, etc.) that can help in learning Ada. The Development Center page http://www.adacore.com/knowledge on AdaCore's website also contains links to useful information including vides and tutorials on Ada. +The Ada Information Clearinghouse website http://www.adaic.org/learn/materials/, maintained by the Ada Resource Association, contains links to a variety of training materials (books, articles, etc.) that can help in learning Ada. The Development Center page http://www.adacore.com/knowledge on AdaCore's website also contains links to useful information including videos and tutorials on Ada. The most comprehensive textbook is John Barnes' *Programming in Ada 2012*, which is oriented towards professional software developers. From 9aad61f8276c43812d1d6d73d2a2132269e157e7 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:54 +0200 Subject: [PATCH 06/19] Editorial: fix typos/grammar in "Ada for the Embedded C Developer" Co-Authored-By: Claude Sonnet 4.6 --- .../chapters/02_Perspective.rst | 20 +++++++++---------- .../chapters/04_Embedded.rst | 2 +- .../chapters/05_SPARK.rst | 6 +++--- .../chapters/06_Translation.rst | 16 +++++++-------- .../chapters/07_Reusability.rst | 14 ++++++------- .../chapters/08_Performance.rst | 16 +++++++-------- .../chapters/09_Business.rst | 10 +++++----- .../chapters/10_Conclusion.rst | 8 ++++---- .../chapters/Appendix_A_OOP.rst | 2 +- 9 files changed, 47 insertions(+), 47 deletions(-) diff --git a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/02_Perspective.rst b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/02_Perspective.rst index 54953ecf8..fc4994270 100644 --- a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/02_Perspective.rst +++ b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/02_Perspective.rst @@ -74,7 +74,7 @@ the project's GPR project file or as a command-line switch to target, the user interface stays the same, providing portability for the application. -Run-time libraries consists of: +Run-time libraries consist of: #. Files that are dependent on the target board. @@ -82,7 +82,7 @@ Run-time libraries consists of: hardware. - They are known as a Board Support Package |mdash| commonly referred to by - their abbrevation *BSP*. + their abbreviation *BSP*. #. Code that is target-independent. @@ -671,7 +671,7 @@ Let's look at the equivalent Ada code: end if; end Main; -The above code will not compile. This is because Ada does no allow assignment +The above code will not compile. This is because Ada does not allow assignment as an expression. .. admonition:: The "use" clause @@ -1044,14 +1044,14 @@ reverse order? .. admonition:: Tick Image Strangely enough, Ada people call the single apostrophe symbol, :ada:`'`, - "tick". This "tick" says the we are accessing an attribute of the variable. + "tick". This "tick" says that we are accessing an attribute of the variable. When we do :ada:`'Img` on a variable of a numerical type, we are going to return the string version of that numerical type. So in the for loop above, :ada:`I'Img`, or "I tick image" will return the string representation of the numerical value stored in I. We have to do this because Put_Line is expecting a string as an input parameter. - We'll discuss attributes in more details + We'll discuss attributes in more detail :ref:`later in this chapter `. In the above example, we are traversing over the range in reverse order. In @@ -1307,8 +1307,8 @@ Are the three programs above equivalent? It may seem like Ada is just adding extra complexity by forcing you to make the conversion from :ada:`Integer` to :ada:`Float` explicit. In fact, it significantly changes the behavior of the computation. While the Ada code performs a floating point operation 1.0 / 10.0 -and stores 0.1 in :ada:`Result`, the C version instead store 0.0 in -:c:`result`. This is because the C version perform an integer operation between +and stores 0.1 in :ada:`Result`, the C version instead stores 0.0 in +:c:`result`. This is because the C version performs an integer operation between two integer variables: 1 / 10 is 0. The result of the integer division is then converted to a :c:`float` and stored. Errors of this sort can be very hard to locate in complex pieces of code, and @@ -1870,7 +1870,7 @@ value into a :ada:`String` and vice-versa. For example: function Integer'Image(Arg : Integer'Base) return String; Certain attributes are provided only for certain kinds of types. For example, -the :ada:`'Val` and :ada:`'Pos` attributes for an enumeration type associates a +the :ada:`'Val` and :ada:`'Pos` attributes for an enumeration type associate a discrete value with its position among its peers. One circuitous way of moving to the next character of the ASCII table is: @@ -2326,8 +2326,8 @@ As a foreword to the topic of pointers, it's important to keep in mind the fact that most situations that would require a pointer in C do not in Ada. In the vast majority of cases, indirect memory management can be hidden from the developer and thus saves from many potential errors. However, there are -situation that do require the use of pointers, or said differently that require -to make memory indirection explicit. This section will present Ada access +situations that do require the use of pointers, or said differently that require +making memory indirection explicit. This section will present Ada access types, the equivalent of C pointers. A further section will provide more details as to how situations that require pointers in C can be done without access types in Ada. diff --git a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/04_Embedded.rst b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/04_Embedded.rst index 87122acaa..cc00aca4d 100644 --- a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/04_Embedded.rst +++ b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/04_Embedded.rst @@ -611,7 +611,7 @@ Let's look at a simple example of a volatile variable in C: In this example, :c:`val` has the modifier :c:`volatile`, which indicates that the compiler must handle :c:`val` as a volatile object. Therefore, each read and write access in the loop is performed by accessing the value of :c:`val` in -then memory. +the memory. This is the corresponding implementation in Ada: diff --git a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/05_SPARK.rst b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/05_SPARK.rst index c5a80f9de..9fbf260c9 100644 --- a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/05_SPARK.rst +++ b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/05_SPARK.rst @@ -29,7 +29,7 @@ response when exceptions are "raised" by those statements. These exceptions could be raised directly within the statements, or indirectly via calls to other procedures and functions. -For example, the frame below is a procedure including three exceptions +For example, the frame below is a procedure including three exception handlers: .. code:: ada no_button project=Courses.Ada_For_Embedded_C_Dev.SPARK.Exceptions @@ -1060,7 +1060,7 @@ the user-defined assertions correctly and sufficiently describe and constrain the implementation of the corresponding routines. Although we are not proving whole program correctness, as you will have -seen |mdash| and done |mdash| we can prove properties than make our +seen |mdash| and done |mdash| we can prove properties that make our software far more robust and bug-free than is possible otherwise. But in addition, consider what proving the unit-level requirements for your procedures and functions would do for the cost of unit testing and @@ -1072,7 +1072,7 @@ amenable to expression as boolean conditions (for example, a mouse driver). In other cases the source code is beyond the capabilities of the analyzers that actually do the mathematical proof. In these cases the combination of proof and actual test is appropriate, and still less -expensive that testing alone. +expensive than testing alone. There is, of course, much more to be said about what can be done with SPARK and :program:`gnatprove`. Those topics are reserved for the diff --git a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/06_Translation.rst b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/06_Translation.rst index 3f84427c9..de2e82d6c 100644 --- a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/06_Translation.rst +++ b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/06_Translation.rst @@ -387,7 +387,7 @@ Naming and prefixes Because of the absence of namespaces, any global name in C tends to be very long. And because of the absence of overloading, they can even encode type -names in their type. +names in their name. In Ada, the package is a namespace |mdash| two entities declared in two different packages are clearly identified and can always be specifically @@ -493,7 +493,7 @@ Dynamically allocated arrays can be directly allocated on the stack: null; end Main; -It's even possible to create a such an array within a structure, provided that +It's even possible to create such an array within a structure, provided that the size of the array is known when instantiating this object, using a type discriminant: @@ -557,7 +557,7 @@ particular, it differentiates between arrays and scalars. For example: procedure P (A : in out Integer; B : in out Arr); end Array_Types; -Most of the time, access to registers end up in some specific structures +Most of the time, accesses to registers end up in some specific structures being mapped onto a specific location in memory. In Ada, this can be achieved through an :ada:`Address` clause associated to a variable, for example: @@ -623,7 +623,7 @@ boolean flags. In C, this would be done through masks, e.g.: return 0; } -In Ada, the above can be represented through a Boolean array of enumerate +In Ada, the above can be represented through a Boolean array of enumeration values: [Ada] @@ -690,7 +690,7 @@ The benefit of using Ada structure instead of bitwise operations is threefold: - Individual fields are named - The compiler can run consistency checks (for example, check that the value - indeed fit in the expected size). + indeed fits in the expected size). Note that, in cases where bitwise operators are needed, Ada provides modular types with :ada:`and`, :ada:`or` and :ada:`xor` operators. Further shift @@ -740,7 +740,7 @@ object of any type to declare a bit-field for this object. We've discussed the :ada:`Size` attribute :ref:`earlier in this course `. The :ada:`Address` attribute indicates the address in memory of that object. -For example, assuming we've declare a variable :ada:`V`, we can declare an +For example, assuming we've declared a variable :ada:`V`, we can declare an actual bit-field object by referring to the :ada:`Address` attribute of :ada:`V` and using it in the declaration of the bit-field, as shown here: @@ -901,7 +901,7 @@ In C, we would rely on bit-shifting and masking to set that specific bit: default value of :ada:`null`. As we've just seen, when declaring objects for types with associated - default values, automatic initialization will happen. This can also happens + default values, automatic initialization will happen. This can also happen when creating an overlay with the :ada:`Address` aspect. The default value is then used to overwrite the content at the memory location indicated by the address. However, in most situations, this isn't the behavior we @@ -1013,7 +1013,7 @@ In C, we would rely on bit-shifting and masking to set that specific bit: - when we use the :ada:`Default_Component_Value` aspect for array types, or - - when we set use the :ada:`Initialize_Scalars` pragma for a package. + - when we use the :ada:`Initialize_Scalars` pragma for a package. Again, using the :ada:`Import` aspect when declaring the overlay eliminates this side-effect. diff --git a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/07_Reusability.rst b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/07_Reusability.rst index 0a6a40b8a..2c6206fd0 100644 --- a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/07_Reusability.rst +++ b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/07_Reusability.rst @@ -18,7 +18,7 @@ software in order to ensure its reusability. In C, variability is usually achieved through macros and function pointers, the former being tied to static variability (variability in different -builds) the latter to dynamic variability (variability within the same build +builds), the latter to dynamic variability (variability within the same build decided at run-time). Ada offers many alternatives for both techniques, which aim at structuring @@ -31,7 +31,7 @@ languages such as C++ and Java |mdash|, you might also be interested in knowing that OOP is supported by Ada and can be used to implement variability. This should, however, be used with care, as OOP brings its own set of problems, such as loss of efficiency |mdash| dispatching calls can't be inlined and require -one level of indirection |mdash| or loss of analyzability |mdash| the target +one level of indirection |mdash| or loss of analyzability |mdash| the target of a dispatching call isn't known at run time. As a rule of thumb, OOP should be considered only for cases of dynamic variability, where several versions of the same object need to exist concurrently in the same application. @@ -44,7 +44,7 @@ Handling variability & reusability statically Genericity ~~~~~~~~~~ -One usage of C macros involves the creation of functions that works regardless +One usage of C macros involves the creation of functions that work regardless of the type they're being called upon. For example, a swap macro may look like: [C] @@ -128,7 +128,7 @@ In many respects, an Ada generic is a way to provide a safe specification and implementation of such macros, through both the validation of the generic itself and its usage. -Subprograms aren't the only entities that can me made generic. As a matter of +Subprograms aren't the only entities that can be made generic. As a matter of fact, it's much more common to render an entire package generic. In this case the instantiation creates a new version of all the entities present in the generic, including global variables. For example: @@ -1460,7 +1460,7 @@ declaration (:ada:`V2`, in this case). Overriding subprograms ^^^^^^^^^^^^^^^^^^^^^^ -Previously, we've seen that subprograms can be overriden. For example, if we +Previously, we've seen that subprograms can be overridden. For example, if we had implemented a :ada:`Reset` and a :ada:`Display` procedure for the :ada:`Rec` type that we declared above, these procedures would be available for an :ada:`Ext_Rec` type derived from :ada:`Rec`. Also, we could override these @@ -1691,7 +1691,7 @@ Dispatching calls are only possible for a type class |mdash| for example, the :ada:`Tagged_Rec'Class`. When the type of an object is known at compile time, the calls won't dispatch at runtime. For example, the call to the :ada:`Reset` procedure of the :ada:`X_Ext_Tagged_Rec` object -(:ada:`X_Ext_Tagged_Rec.Reset`) will always take the overriden +(:ada:`X_Ext_Tagged_Rec.Reset`) will always take the overridden :ada:`Reset` procedure of the :ada:`Ext_Tagged_Rec` type. Similarly, if we perform a view conversion by writing :ada:`Tagged_Rec (A_Ext_Tagged_Rec).Display`, we're instructing the compiler to @@ -2221,7 +2221,7 @@ This is the corresponding implementation in Ada: end Show_Subprogram_Selection; The structure of the code above is very similar to the one used in the C code. -Again, we have two version of :ada:`Show_Msg`: :ada:`Show_Msg_V1` and +Again, we have two versions of :ada:`Show_Msg`: :ada:`Show_Msg_V1` and :ada:`Show_Msg_V2`. We set :ada:`Current_Show_Msg` according to the value of :ada:`Selection`. Here, we use :ada:`'Access` to get access to the corresponding procedure. If no version of :ada:`Show_Msg` is available, we set diff --git a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/08_Performance.rst b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/08_Performance.rst index 27f08f870..11de0d108 100644 --- a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/08_Performance.rst +++ b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/08_Performance.rst @@ -16,7 +16,7 @@ implement imperative semantics, in particular with regards to memory management or control flow. They should be equivalent on average. When comparing the performance of C and Ada code, differences might be -observed. This usually comes from the fact that, while the two piece *appear* +observed. This usually comes from the fact that, while the two pieces *appear* semantically equivalent, they happen to be actually quite different; C code semantics do not implicitly apply the same run-time checks that Ada does. This section will present common ways for improving Ada code performance. @@ -165,7 +165,7 @@ array. This is achieved by an index check. Another example of runtime check is the verification of valid ranges. For example, when adding two integer numbers, we would like to ensure that the result is still in the valid range |mdash| that the value is neither too large -nor too small. This is achieved by an range check. Likewise, arithmetic operations +nor too small. This is achieved by a range check. Likewise, arithmetic operations shouldn't overflow or underflow. This is achieved by an overflow check. Although runtime checks are very useful and should be used as much as possible, @@ -383,9 +383,9 @@ types: F : Some_Field := Call_To_Some_Function; end record; -However, the consequences of the above is that any declaration of a instance of +However, the consequences of the above are that any declaration of an instance of this type without an explicit value for :ada:`F` will issue a call to -:ada:`Call_To_Some_Function`. More subtle issue may arise with elaboration. For +:ada:`Call_To_Some_Function`. More subtle issues may arise with elaboration. For example, it's possible to write: .. code:: ada compile_button project=Courses.Ada_For_Embedded_C_Dev.Performance.Dynamic_Array @@ -416,7 +416,7 @@ and :ada:`A_End` at startup so as to align a series of arrays dynamically. The consequence, however, is that these values will not be known statically, so any code that needs to access to boundaries of the array will need to read data from memory. While it's perfectly fine most of the time, there may be -situations where performances are so critical that static values for array +situations where performance is so critical that static values for array boundaries must be enforced. Here's a last case which may also be surprising: @@ -438,8 +438,8 @@ In the code above, :ada:`R` contains two arrays, :ada:`F1` and :ada:`F2`, respectively constrained by the discriminant :ada:`D1` and :ada:`D2`. The consequence is, however, that to access :ada:`F2`, the run-time needs to know how large :ada:`F1` is, which is dynamically constrained when creating an -instance. Therefore, accessing to :ada:`F2` requires a computation involving -:ada:`D1` which is slower than, let's say, two pointers in an C array that +instance. Therefore, accessing :ada:`F2` requires a computation involving +:ada:`D1` which is slower than, let's say, two pointers in a C array that would point to two different arrays. Generally speaking, when values are used in data structures, it's useful to @@ -561,7 +561,7 @@ used to pass the values do not appear in the source code. Display (D1); end Update_Record; -In the calls to :ada:`Update` and :ada:`Display`, :ada:`D1` is always be passed +In the calls to :ada:`Update` and :ada:`Display`, :ada:`D1` is always passed by reference. Because no extra copy takes place, we get a performance that is equivalent to the C version. If we had used arrays in the example above, :ada:`D1` would have been passed by reference as well: diff --git a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/09_Business.rst b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/09_Business.rst index 95f95e1c6..1c7270669 100644 --- a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/09_Business.rst +++ b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/09_Business.rst @@ -78,7 +78,7 @@ That being said, the point of this argument is not to say that it's not possible to write very safe and secure software with languages different than Ada. With the right expertise, the right processes and the right tools, it's done every day. The point is that Ada overall reduces the level of processes, -expertise and tools necessary and will allow to reach the same target at a +expertise and tools necessary and will allow reaching the same target at a lower cost. Who is using Ada today? @@ -88,7 +88,7 @@ Ada was initially born as a DoD project, and thus got its initial customer base in aerospace and defence (A&D). At the time these lines are written and from the perspective of AdaCore, A&D is still the largest consumer of Ada today and covers about 70% of the market. This creates a consistent and long lasting set -of established users as these project last often for decades, using the same +of established users as these projects last often for decades, using the same codebase migrating from platform to platform. More recently however, there has been an emerging interest for Ada in new @@ -131,10 +131,10 @@ should AdaCore disappear or switch focus, Ada users would not be prevented from carrying on using its software (there is no lock) and a third party could take over maintenance. This is not a theoretical case, this has been done in the past either by companies looking at supporting their own version of GNAT, -vendors occupying a specific niche that was left uncovered , or hobbyists +vendors occupying a specific niche that was left uncovered, or hobbyists developing their own builds. -With that in mind, it's clear that the "sole source" provider issue is a +With that in mind, it's clear that the "sole source" provider issue is circumstantial |mdash| nothing is preventing other vendors from emerging if the conditions are met. @@ -145,7 +145,7 @@ A language by itself is of little use for the development of safety-critical software. Instead, a complete toolset is needed to accompany the development process, in particular tools for edition, testing, static analysis, etc. -AdaCore provides a number of these tools either in through its core or add-on +AdaCore provides a number of these tools either through its core or add-on package. These include (as of 2019): - An IDE (GNAT Studio) diff --git a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/10_Conclusion.rst b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/10_Conclusion.rst index 8ebec018b..a71e2dc48 100644 --- a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/10_Conclusion.rst +++ b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/10_Conclusion.rst @@ -31,9 +31,9 @@ mismatches, we'll get a compilation error. Because the compiler prevents mixing variables of different types without explicit type conversion, we can't accidentally end up in a situation where we assume something will happen implicitly when, in fact, our assumption is incorrect. In this sense, Ada's -type system encourages programmers to think about data at a high level of +type system encourages programmers to think about data at a high level of abstraction. Ada supports overlays and unchecked conversions as a way of -converting between unrelated data type, which are typically used for +converting between unrelated data types, which are typically used for interfacing with low-level elements such as registers. In Ada, arrays aren't interchangeable with operations on pointers like in C. @@ -79,7 +79,7 @@ running on top of an operating system such as Linux. On more constrained systems, such as bare metal or some real-time operating systems, a subset of the Ada tasking capabilities |mdash| known as the Ravenscar and Jorvik profiles |mdash| is available. Though restricted, this subset also has nice properties, -in particular the absence of deadlock,the absence of priority inversion, +in particular the absence of deadlock, the absence of priority inversion, schedulability and very small footprint. On bare metal systems, this also essentially means that Ada comes with its own real-time kernel. The advantage of using the full Ada tasking model or the restricted profiles is to enhance @@ -175,7 +175,7 @@ can deploy the final executable with checks disabled. In many situations, the migration of C code to Ada is justified by an increase in terms of integrity expectations, in which case it's expected that -development costs will raise. However, Ada is a more expressive, powerful +development costs will rise. However, Ada is a more expressive, powerful language, designed to reduce errors earlier in the life-cycle, thus reducing costs. Therefore, Ada makes it possible to write very safe and secure software at a lower cost than languages such as C. diff --git a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/Appendix_A_OOP.rst b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/Appendix_A_OOP.rst index f49748cfb..ffbaf0e58 100644 --- a/content/courses/Ada_For_The_Embedded_C_Developer/chapters/Appendix_A_OOP.rst +++ b/content/courses/Ada_For_The_Embedded_C_Developer/chapters/Appendix_A_OOP.rst @@ -1322,7 +1322,7 @@ The :ada:`Limited_Controlled` type includes the following operations: where it was created. In this case, we must override those procedures, so we can use them for dynamic -memory allocation. This is a simplified view of the update implementation: +memory allocation. This is a simplified view of the updated implementation: .. code-block:: ada From 6801506bf24a4753f33cd6c0ea1eb8af1ff01753 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:54 +0200 Subject: [PATCH 07/19] Editorial: fix typos/grammar in "Introduction to GNAT Toolchain" Co-Authored-By: Claude Sonnet 4.6 --- .../courses/GNAT_Toolchain_Intro/chapters/gnat_studio.rst | 2 +- .../chapters/gnat_toolchain_basics.rst | 8 ++++---- .../courses/GNAT_Toolchain_Intro/chapters/gnat_tools.rst | 2 +- .../courses/GNAT_Toolchain_Intro/chapters/gprbuild.rst | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/content/courses/GNAT_Toolchain_Intro/chapters/gnat_studio.rst b/content/courses/GNAT_Toolchain_Intro/chapters/gnat_studio.rst index 7be1b85eb..ce02fd75e 100644 --- a/content/courses/GNAT_Toolchain_Intro/chapters/gnat_studio.rst +++ b/content/courses/GNAT_Toolchain_Intro/chapters/gnat_studio.rst @@ -156,7 +156,7 @@ the debugger. To do this, you can click on ``Debug`` |srarr| Formal verification ------------------- -In order to see how SPARK can detect issues, let's creating a simple +In order to see how SPARK can detect issues, let's create a simple application that accumulates values in a variable :ada:`A`: .. code-block:: ada diff --git a/content/courses/GNAT_Toolchain_Intro/chapters/gnat_toolchain_basics.rst b/content/courses/GNAT_Toolchain_Intro/chapters/gnat_toolchain_basics.rst index c76e30da6..8203a6076 100644 --- a/content/courses/GNAT_Toolchain_Intro/chapters/gnat_toolchain_basics.rst +++ b/content/courses/GNAT_Toolchain_Intro/chapters/gnat_toolchain_basics.rst @@ -19,7 +19,7 @@ example: gprbuild -P project.gpr You can find the binary built with the command above in the *obj* -directory. You can the run it in the same way as you would do with any +directory. You can then run it in the same way as you would do with any other executable on your platform. For example: .. code-block:: sh @@ -34,7 +34,7 @@ aren't in the directory tree: gprbuild -p -P project.gpr -Ada source-code are stored in *.ads* and *.adb* files. To view the +Ada source-code is stored in *.ads* and *.adb* files. To view the content of these files, you can use :program:`GNAT Studio`. To open :program:`GNAT Studio`, double-click on the *.gpr* project file or invoke :program:`GNAT Studio` on the command line: @@ -79,8 +79,8 @@ warnings. Warnings are useless if you don't do anything about them. If you give your team member some code that causes warnings, how are they supposed to know whether they represent real problems? If you don't address -each warning, people will soon starting ignoring warnings and there'll -be lots of things that generates warnings scattered all over your +each warning, people will soon start ignoring warnings and there'll +be lots of things that generate warnings scattered all over your code. To avoid this, you may want to use the ``-gnatwae`` switch to both turn on (almost) all warnings and to treat warnings as errors. This forces you to get a clean (no warnings or errors) diff --git a/content/courses/GNAT_Toolchain_Intro/chapters/gnat_tools.rst b/content/courses/GNAT_Toolchain_Intro/chapters/gnat_tools.rst index b0d4b8417..2522b7e52 100644 --- a/content/courses/GNAT_Toolchain_Intro/chapters/gnat_tools.rst +++ b/content/courses/GNAT_Toolchain_Intro/chapters/gnat_tools.rst @@ -5,7 +5,7 @@ GNAT Tools .. include:: ../../../global.txt -In chapter we present a brief overview of some of the tools included +In this chapter we present a brief overview of some of the tools included in the GNAT toolchain. For further details on how to use these tools, please refer to the diff --git a/content/courses/GNAT_Toolchain_Intro/chapters/gprbuild.rst b/content/courses/GNAT_Toolchain_Intro/chapters/gprbuild.rst index d6ad901df..9c75cc878 100644 --- a/content/courses/GNAT_Toolchain_Intro/chapters/gprbuild.rst +++ b/content/courses/GNAT_Toolchain_Intro/chapters/gprbuild.rst @@ -45,7 +45,7 @@ Basic structure The main element of a project file is a project declaration, which contains definitions for the current project. A project file may also include other project files in order to compose a complex build. One of -the simplest form of a project file is the following: +the simplest forms of a project file is the following: .. code-block:: none @@ -59,7 +59,7 @@ the simplest form of a project file is the following: In this example, we declare a project named ``Default``. The ``for Main use`` expression indicates that the ``main.adb`` file is used as the entry point (main source-code file) of the project. The main file -doesn't necessary need to be called ``main.adb``; we could use any source-code +doesn't necessarily need to be called ``main.adb``; we could use any source-code implementing a main application, or even have a list of multiple main files. The ``for Source_Dirs use`` expression indicates that the ``src`` directory contains the source-file for the application (including the main @@ -68,7 +68,7 @@ file). Customization ~~~~~~~~~~~~~ -GPRbuild support scenario variables, which allow you to control the way +GPRbuild supports scenario variables, which allow you to control the way binaries are built. For example, you may want to distinguish between debug and optimized versions of your binary. In principle, you could pass command-line options to :program:`gprbuild` that turn debugging on and From 7bdde0674afe35dc5bbab9558d13ebf9fb00a81b Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:54 +0200 Subject: [PATCH 08/19] Editorial: fix typos/grammar in "Guidelines for Safe and Secure Ada/SPARK" Co-Authored-By: Claude Sonnet 4.6 --- ...on03_avoid_shared_variables_for_inter-task_communication.rst | 2 +- .../chapters/guidelines/definitions.rst | 2 +- .../chapters/introduction.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/guidelines/concurrency/con03_avoid_shared_variables_for_inter-task_communication.rst b/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/guidelines/concurrency/con03_avoid_shared_variables_for_inter-task_communication.rst index 9ddc0484e..1126c957f 100644 --- a/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/guidelines/concurrency/con03_avoid_shared_variables_for_inter-task_communication.rst +++ b/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/guidelines/concurrency/con03_avoid_shared_variables_for_inter-task_communication.rst @@ -77,5 +77,5 @@ interact with a memory-mapped device, among other similar usages. Notes +++++++ -In additon to GNATcheck, SPARK and CodePeer can also detect conflicting access +In addition to GNATcheck, SPARK and CodePeer can also detect conflicting access to unprotected variables. diff --git a/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/guidelines/definitions.rst b/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/guidelines/definitions.rst index 527a853d4..e1d04ff3c 100644 --- a/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/guidelines/definitions.rst +++ b/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/guidelines/definitions.rst @@ -44,7 +44,7 @@ Level Remediation ------------- -**Remediation** indicates the the level of difficulty to modify/update +**Remediation** indicates the level of difficulty to modify/update code that does not follow this particular rule. High diff --git a/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/introduction.rst b/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/introduction.rst index 55000d2c2..37724cbf4 100644 --- a/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/introduction.rst +++ b/content/courses/Guidelines_for_Safe_and_Secure_Ada_SPARK/chapters/introduction.rst @@ -67,7 +67,7 @@ will be collected in the GNATcheck report that can be used as evidence of the level of adherence to the coding standard. In addition, GNATcheck provides a mechanism to deal with accepted exemptions. Note that, when the verification method indicates a GNATcheck rule could be used, the rule will note whether -it is part of the atandard GNATcheck rule set, or has been provided as-is +it is part of the standard GNATcheck rule set, or has been provided as-is within the document repository, located `here. `_ From 9c3d86fd844b63495efc2549f5f6024f3acea3a0 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:55 +0200 Subject: [PATCH 09/19] Editorial: fix typos/grammar in "SPARK for the MISRA-C Developer" Co-Authored-By: Claude Sonnet 4.6 --- .../SPARK_for_the_MISRA_C_Developer/chapters/01_preface.rst | 2 +- .../chapters/02_program_consistency.rst | 2 +- .../chapters/03_syntactic_guarantees.rst | 2 +- .../chapters/04_strong_typing.rst | 2 +- .../chapters/06_side_effects.rst | 2 +- .../chapters/07_undefined_behavior.rst | 2 +- .../chapters/08_unreachable_and_dead_code.rst | 4 ++-- .../chapters/10_references.rst | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/01_preface.rst b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/01_preface.rst index 962833573..b68ea41e9 100644 --- a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/01_preface.rst +++ b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/01_preface.rst @@ -15,7 +15,7 @@ very large margin. The popularity of the C programming language, as well as its many traps and pitfalls, have led to the huge success of MISRA C -in domains where C is used for high-integrity sofware. This success has driven +in domains where C is used for high-integrity software. This success has driven tool vendors to propose many competing implementations of :wikipedia:`MISRA C ` checkers. Tools compete in particular on the coverage of MISRA C guidelines that they help enforce, as it is diff --git a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/02_program_consistency.rst b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/02_program_consistency.rst index ee2769007..5ab70bfa2 100644 --- a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/02_program_consistency.rst +++ b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/02_program_consistency.rst @@ -23,7 +23,7 @@ consistency. Taming Text-Based Inclusion *************************** -The text-based inclusion of files is one of the dated idiosyncracies of the C +The text-based inclusion of files is one of the dated idiosyncrasies of the C programming language that was inherited by C++ and that is known to cause quality problems, especially during maintenance. Although multiple inclusion of a file in the same translation unit can be used to emulate template diff --git a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/03_syntactic_guarantees.rst b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/03_syntactic_guarantees.rst index c231c3c1a..4d27b2d82 100644 --- a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/03_syntactic_guarantees.rst +++ b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/03_syntactic_guarantees.rst @@ -138,7 +138,7 @@ should not be modified"`. No such rule is needed in SPARK, since function parameters are only inputs so cannot be modified, and procedure parameters have a *mode* defining whether -they can be modified or not. Only parameters of mode :ada:`out` or ada:`in out` +they can be modified or not. Only parameters of mode :ada:`out` or :ada:`in out` can be modified |mdash| and these are prohibited from functions in SPARK |mdash| and their modification is visible at the calling site. For example, assigning to a parameter of mode :ada:`in` (the default parameter mode if diff --git a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/04_strong_typing.rst b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/04_strong_typing.rst index e4d887c22..bfd32627a 100644 --- a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/04_strong_typing.rst +++ b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/04_strong_typing.rst @@ -830,7 +830,7 @@ and returns its relative position as an integer, starting at :ada:`0`. For example, :ada:`Animal'Pos(Bee)` is :ada:`1`, and :ada:`Boolean'Pos(False)` is :ada:`0`. In the other direction, :ada:`T'Val(n)`, where :ada:`n` is an integer, returns the enumeration value in type :ada:`T` at relative position ``n``. -If ``n`` is negative or greater then :ada:`T'Pos(T'Last)` then a run-time +If ``n`` is negative or greater than :ada:`T'Pos(T'Last)` then a run-time exception is raised. Hence, the following is valid SPARK (and Ada) code; :ada:`Character` is defined as diff --git a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/06_side_effects.rst b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/06_side_effects.rst index 06e0d8fcc..bc417c722 100644 --- a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/06_side_effects.rst +++ b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/06_side_effects.rst @@ -113,7 +113,7 @@ In SPARK, expressions cannot have side effects; only statements can. In particular, there are no increment/decrement operators, and no assignment operator. There is instead an assignment statement, whose syntax using :ada:`:=` clearly distinguishes it from equality (using :ada:`=`). And in any event an -expression is not allowed as a statement and this a construct such as +expression is not allowed as a statement and thus a construct such as :ada:`X = Y;` would be illegal. Here is how a variable :ada:`X` can be assigned, incremented and decremented: diff --git a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/07_undefined_behavior.rst b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/07_undefined_behavior.rst index 3ee662792..c6c4ebe02 100644 --- a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/07_undefined_behavior.rst +++ b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/07_undefined_behavior.rst @@ -38,7 +38,7 @@ exhibit two types of undefined behaviors that can occur in Ada: predefined exception is raised or execution continues using the invalid representation. -- `erroneous execution`: when when the program enters a state not defined +- `erroneous execution`: when the program enters a state not defined by the language semantics, but the consequences are not bounded by the Ada Reference Manual. This is the closest to an undefined behavior in C. For example, concurrently writing through different tasks to the same diff --git a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/08_unreachable_and_dead_code.rst b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/08_unreachable_and_dead_code.rst index c16dbb73e..26d8811c5 100644 --- a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/08_unreachable_and_dead_code.rst +++ b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/08_unreachable_and_dead_code.rst @@ -32,7 +32,7 @@ executed is not necessarily unreachable (it could simply reflect gaps in the tes suite). Note that `statement coverage`, rather than the more comprehensive *decision coverage* or *modified condition / decision coverage* (MC/DC) as defined in the DO-178C standard for airborne software, is sufficient to detect -potential unreachable statements, corresponding to code that is not covered +potentially unreachable statements, corresponding to code that is not covered during the testing campaign. The presence of dead code is much harder to detect, both statically and @@ -91,7 +91,7 @@ detect complex cases, but it goes well beyond what other analyses do in general. The only code in the body of :ada:`Much_Ado_About_Little` that affects the result of the procedure's execution is the :ada:`if Z > Y...` statement, since this statement sets :ada:`Success` to either True or False regardless of what the -previous statements did. I.e., the statements preceding this :ada:`if` are +previous statements did. I.e., the statements preceding this :ada:`if` are dead code in the MISRA C sense. Since both branches of the :ada:`if Z > Y...` statement return from the procedure, the subsequent :ada:`if Success...` statement is unreachable. GNATprove detects and issues warnings about both diff --git a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/10_references.rst b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/10_references.rst index 0313b5cdd..114e5ee44 100644 --- a/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/10_references.rst +++ b/content/courses/SPARK_for_the_MISRA_C_Developer/chapters/10_references.rst @@ -18,7 +18,7 @@ The following documents are freely available: - `MISRA Compliance 2016: Achieving compliance with MISRA coding guidelines`, 2016, which explains the rationale and process for compliance, including a - thorough discussions of acceptable deviations + thorough discussion of acceptable deviations - `MISRA C:2012 - Amendment 1: Additional security guidelines for MISRA C:2012`, 2016, which contains 14 additional guidelines focusing on From 974b27957406de214cc727c961f53ea036bbc494 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:55 +0200 Subject: [PATCH 10/19] Editorial: fix typos/grammar in "Ada in Practice" Co-Authored-By: Claude Sonnet 4.6 --- .../ada-in-practice/chapters/abstract_data_machines.rst | 4 ++-- .../ada-in-practice/chapters/abstract_data_types.rst | 2 +- .../chapters/component_access_to_rec_objs.rst | 8 ++++---- .../constructor_functions_for_abstract_data_types.rst | 6 +++--- .../chapters/controlling_obj_initialization_creation.rst | 2 +- .../chapters/essential_idioms_for_packages.rst | 4 ++-- .../chapters/idioms_for_protected_objects.rst | 4 ++-- .../ada-in-practice/chapters/inheritance_idioms.rst | 8 ++++---- .../ada-in-practice/chapters/interrupt_handling.rst | 2 +- content/courses/ada-in-practice/chapters/raii.rst | 4 ++-- ...ng_object_code_from_generic_package_instantiations.rst | 2 +- .../ada-in-practice/chapters/silent_task_termination.rst | 2 +- content/courses/ada-in-practice/chapters/type_punning.rst | 6 +++--- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/content/courses/ada-in-practice/chapters/abstract_data_machines.rst b/content/courses/ada-in-practice/chapters/abstract_data_machines.rst index b50581dc2..4323172db 100644 --- a/content/courses/ada-in-practice/chapters/abstract_data_machines.rst +++ b/content/courses/ada-in-practice/chapters/abstract_data_machines.rst @@ -24,7 +24,7 @@ requirement? The Abstract Data Type (ADT) :ref:`Abstract Data Type ` idiom is the primary abstraction definition facility in Ada. Given an ADT that provides the required -facility you could simply declare a single object of the type. But how +facility, you could simply declare a single object of the type. But how could you ensure that some other client, perhaps in the future, doesn't declare another object of the type, either accidentally or maliciously? @@ -277,7 +277,7 @@ rotary switch's current value. However, on this target the memory at that address is read-only, and rightly so because the only way to change the value is to physically rotate the switch. Writing to that address has no effect whatsoever. -Although doing so is a logical error no indication is provided by the +Although doing so is a logical error, no indication is provided by the hardware, which is potentially confusing to developers. It certainly looks like a variable, after all. Declaring it as a constant wouldn't suffice because the user could rotate the switch during diff --git a/content/courses/ada-in-practice/chapters/abstract_data_types.rst b/content/courses/ada-in-practice/chapters/abstract_data_types.rst index 5044dab16..801fe9c66 100644 --- a/content/courses/ada-in-practice/chapters/abstract_data_types.rst +++ b/content/courses/ada-in-practice/chapters/abstract_data_types.rst @@ -160,7 +160,7 @@ compile-time visibility to the private type's representation necessary to implement the required behavior. Clients can create their own operations by calling the type's primitive -operations, but client's can't compile any operation that manipulates the +operations, but clients can't compile any operation that manipulates the internal representation. Consider the following revision to the package :ada:`Integer_Stacks`, now as diff --git a/content/courses/ada-in-practice/chapters/component_access_to_rec_objs.rst b/content/courses/ada-in-practice/chapters/component_access_to_rec_objs.rst index b95fcd1d0..dcb5fb699 100644 --- a/content/courses/ada-in-practice/chapters/component_access_to_rec_objs.rst +++ b/content/courses/ada-in-practice/chapters/component_access_to_rec_objs.rst @@ -55,7 +55,7 @@ types |mdash| the record object and the protected object. Let's say that a client declares an object :ada:`Obj` of type :ada:`R`. There is only one reference direction defined, from the record denoted by :ada:`Obj` to the component protected object denoted by :ada:`Obj.Y`. This idiom, however, -requires a reference in the opposite direction, from :ada:`Oby.Y` to +requires a reference in the opposite direction, from :ada:`Obj.Y` to :ada:`Obj`. This may seem like an unrealistic situation, but it is not. An IO device type @@ -219,7 +219,7 @@ must be limited in both views if it is limited in either view. For the idiom implementation to be legal, the type's completion in the private part must not merely be limited, but actually *immutably limited*, meaning that it is always truly limited. There are various ways to make that happen (see -:aarm22:`AARM22 7.5 (8.1/3) <7-5>` ) but the easiest way to is to include the +:aarm22:`AARM22 7.5 (8.1/3) <7-5>` ) but the easiest way is to include the reserved word :ada:`limited` in the type definition within the full view, as we did above. That is known as making the type *explicitly limited*. It turns out having a task or protected component also makes it immutably limited, so @@ -401,7 +401,7 @@ visible extension components are the discriminants :ada:`Transceiver`, :ada:`IRQ`, and :ada:`IRQ_Priority`. :ada:`Transceiver` will designate the :ada:`USART` to drive (discussed in a moment). :ada:`IRQ` is the :ada:`Interrupt_ID` indicating the interrupt that the associated :ada:`USART` -raises. :ada:`IRQ_Priority` is the priority for that interrupt. (*IRQ* in a +raises. :ada:`IRQ_Priority` is the priority for that interrupt. (*IRQ* is a common abbreviation for *Interrupt ReQuest*.) These two interrupt-oriented discriminants are used within the PO declaration to configure it for interrupt handling. @@ -535,7 +535,7 @@ Pros The implementation is directly expressed, requiring only an access discriminant and the current instance semantics of :ada:`type_name'Access`. -Although the real-word example is complex |mdash| multiple discriminants are +Although the real-world example is complex |mdash| multiple discriminants are involved, and a type extension |mdash| the implementation itself requires little text. Interrupt handling is relatively complex in any language. diff --git a/content/courses/ada-in-practice/chapters/constructor_functions_for_abstract_data_types.rst b/content/courses/ada-in-practice/chapters/constructor_functions_for_abstract_data_types.rst index 515be9f6f..31e375e45 100644 --- a/content/courses/ada-in-practice/chapters/constructor_functions_for_abstract_data_types.rst +++ b/content/courses/ada-in-practice/chapters/constructor_functions_for_abstract_data_types.rst @@ -95,7 +95,7 @@ contrary to the expectation for constructors. Therefore, Ada has rules specific to primitive constructor functions that have the effect of preventing their inheritance. -The explanation and illustration for these rules first requires explanation of +The explanation and illustration for these rules first require explanation of the word *abstract*. We mentioned above that the package enclosing the type will be designed with the :ref:`Abstract Data Type ` idiom. In that idiom @@ -296,14 +296,14 @@ hence more packages and files (assuming one unit per file, which is desirable in itself, even if not required by the language). Some developers might argue for having fewer files, presumably containing larger -units. In the author's experience larger units make comprehension, and therefore +units. In the author's experience, larger units make comprehension, and therefore correctness, unjustifiably difficult if smaller units are possible. Some units are unavoidably large and complicated but often we can achieve relative simplicity. For those developers, however, the constructor package could be declared instead as a nested package located within the package defining the tagged type. Doing so would achieve the same effect as using a child package because the contained -functions would not be primitive. Therefore, they would not inherited. +functions would not be primitive. Therefore, they would not be inherited. This alternative would reduce the number of files back to the minimum. However, the defining package would be relatively more complicated because of this nested diff --git a/content/courses/ada-in-practice/chapters/controlling_obj_initialization_creation.rst b/content/courses/ada-in-practice/chapters/controlling_obj_initialization_creation.rst index 8ad868ad6..9dac2ac80 100644 --- a/content/courses/ada-in-practice/chapters/controlling_obj_initialization_creation.rst +++ b/content/courses/ada-in-practice/chapters/controlling_obj_initialization_creation.rst @@ -597,7 +597,7 @@ For example, the following is a partial definition of a :ada:`Stack` ADT. It is only a partial definition primarily because :ada:`Pop` is not provided, but other operations would be included as well. Moreover, a fully realistic version would be a generic package. We have used a subtype named :ada:`Element` as a -substitute for the generic formal type what would have had that name. Note that +substitute for the generic formal type that would have had that name. Note that there is a :ada:`Default_Initial_Condition` aspect specifying that any object of type :ada:`Stack` is initially empty as a result of default initialization. The *argument* to the function call is the corresponding type name, diff --git a/content/courses/ada-in-practice/chapters/essential_idioms_for_packages.rst b/content/courses/ada-in-practice/chapters/essential_idioms_for_packages.rst index ac675cb90..dcf9239e9 100644 --- a/content/courses/ada-in-practice/chapters/essential_idioms_for_packages.rst +++ b/content/courses/ada-in-practice/chapters/essential_idioms_for_packages.rst @@ -45,7 +45,7 @@ These idioms pre-date later package facilities, such as private packages and hierarchical packages. We describe idioms for those kinds of packages separately. -Two of the simpler idioms are described here. The other two, that are more +Two of the simpler idioms are described here. The other two, which are more commonly used, are described in two separate, dedicated entries within this document. @@ -109,7 +109,7 @@ When a library package contains variable declarations, these variables comprise global data. In this sense, *global* means potential visibility to multiple clients. Global data should be avoided by default, because the effects of changes are potentially pervasive, throughout the entire set of clients that -have visibility to it. In effect the developer must understand everything +have visibility to it. In effect, the developer must understand everything before changing anything. The introduction of new bugs is a common result. But if, for some compelling reason, the design really called for global data, this idiom provides the way to declare it. Note also that global *constants* diff --git a/content/courses/ada-in-practice/chapters/idioms_for_protected_objects.rst b/content/courses/ada-in-practice/chapters/idioms_for_protected_objects.rst index 8e737a55a..1c8b60194 100644 --- a/content/courses/ada-in-practice/chapters/idioms_for_protected_objects.rst +++ b/content/courses/ada-in-practice/chapters/idioms_for_protected_objects.rst @@ -766,7 +766,7 @@ would have events named :ada:`Hatch_Open`, :ada:`Hatch_Closed`, :ada:`Umbilical_Detached`, and so on. Client tasks can suspend, waiting for an arbitrary event to be signaled, and -other tasks can signal the occurrence of events, using a *event manager* that +other tasks can signal the occurrence of events, using an *event manager* that the two sets of tasks reference. Here's the declaration of the manager type: @@ -1457,7 +1457,7 @@ events to test the :ada:`Event_Management` instance. end loop; end Demo_Events; -When executed, each task iteratively prints a message indicated that it is +When executed, each task iteratively prints a message indicating that it is responding to one of the awaited events. One of the tasks waits for one of two specified events, and the other two tasks wait for a single event each. The main procedure signals events at random. The demo runs forever so you'll have diff --git a/content/courses/ada-in-practice/chapters/inheritance_idioms.rst b/content/courses/ada-in-practice/chapters/inheritance_idioms.rst index df970774d..272d23ae6 100644 --- a/content/courses/ada-in-practice/chapters/inheritance_idioms.rst +++ b/content/courses/ada-in-practice/chapters/inheritance_idioms.rst @@ -8,7 +8,7 @@ Using Building Blocks to Express Inheritance Idioms Motivation ---------- -Betrand Meyer's magisterial book on OOP :footcite:p:`1997:meyer` +Bertrand Meyer's magisterial book on OOP :footcite:p:`1997:meyer` includes a taxonomy of inheritance idioms. Two especially well-known entries in that taxonomy are :wikipedia:`Subtype Inheritance ` and @@ -187,12 +187,12 @@ There are two implementations presented, one for each of the two inheritance idioms under discussion. First, we will specify our building block choices, then show the two idiom expressions in separate subsections. -- We use tagged types for the sake of providing full OOP capabilities. That is +- We use tagged types for the sake of providing full OOP capabilities. That is the most common choice when inheritance is involved. The static form of inheritance has cases in which it is useful, but those cases are very narrow in applicability. -- We assume that the parent type and the child type are both private +- We assume that the parent type and the child type are both private types, i.e., abstract data types, because that is the best practice. See the :ref:`Abstract Data Type idiom ` for justification and details. @@ -213,7 +213,7 @@ To avoid unnecessary code duplication, we use the same parent type, declared as a simple tagged private type, in the examples for the two idiom implementations. The parent type could itself be derived from some other tagged type, but that changes nothing -conceptually significant. We declare parent type in package :ada:`P` as +conceptually significant. We declare the parent type in package :ada:`P` as follows: .. code-block:: ada diff --git a/content/courses/ada-in-practice/chapters/interrupt_handling.rst b/content/courses/ada-in-practice/chapters/interrupt_handling.rst index 8af0e85b3..948034661 100644 --- a/content/courses/ada-in-practice/chapters/interrupt_handling.rst +++ b/content/courses/ada-in-practice/chapters/interrupt_handling.rst @@ -561,7 +561,7 @@ idiom. In that implementation, however, only single characters were sent and received, whereas messages will consist of one or more characters. Although there are differences, we assume that you are familiar enough with that idiom's approach that we don't need to go into all the details of the serial I/O, the -USART, or the interrupt handler within a PO. We'll focus instead of the +USART, or the interrupt handler within a PO. We'll focus instead on the differences due to this idiom. In this version we want to notify a task when an entire message has been sent diff --git a/content/courses/ada-in-practice/chapters/raii.rst b/content/courses/ada-in-practice/chapters/raii.rst index aef43e292..dfa550338 100644 --- a/content/courses/ada-in-practice/chapters/raii.rst +++ b/content/courses/ada-in-practice/chapters/raii.rst @@ -96,7 +96,7 @@ expensive to debug. In response to the new requirements, we could declare a protected object within the package body and move the declaration of :ada:`State` into that PO. In addition, we would declare two protected procedures corresponding to -:ada:`Operation_1` and :ada:`Operations_2`. The two new protected procedure +:ada:`Operation_1` and :ada:`Operation_2`. The two new protected procedure bodies would do what the original procedures did, including accessing and updating :ada:`State`. The original procedures |mdash| still presented to clients |mdash| would now call these new protected procedures: @@ -170,7 +170,7 @@ same PO could access the enclosed variables while the first caller is blocked, thus breaking the mutually exclusive access guarantee. Calling an I/O operation is not all that strange here, and those are not the -only potentially blocking operation defined by the language. +only potentially blocking operations defined by the language. Note that moving the calls to :ada:`Put_Line` out of the PO procedure bodies, back to the regular procedure bodies that call those PO procedures, would solve diff --git a/content/courses/ada-in-practice/chapters/reducing_object_code_from_generic_package_instantiations.rst b/content/courses/ada-in-practice/chapters/reducing_object_code_from_generic_package_instantiations.rst index 4d70f069a..4806fa555 100644 --- a/content/courses/ada-in-practice/chapters/reducing_object_code_from_generic_package_instantiations.rst +++ b/content/courses/ada-in-practice/chapters/reducing_object_code_from_generic_package_instantiations.rst @@ -142,7 +142,7 @@ Cons What would otherwise be an implementation detail hidden from clients can now become visible to them because a (public) library unit can be named in -with_clause by any other unit. As a result, this approach should not be used in +a with_clause by any other unit. As a result, this approach should not be used in all cases, not even as a default design approach. Restricting the visibility of the instance may be more important than the amount of object code it contributes. Hiding implementation artifacts allows more freedom to change the diff --git a/content/courses/ada-in-practice/chapters/silent_task_termination.rst b/content/courses/ada-in-practice/chapters/silent_task_termination.rst index 871c116ed..a2563b433 100644 --- a/content/courses/ada-in-practice/chapters/silent_task_termination.rst +++ b/content/courses/ada-in-practice/chapters/silent_task_termination.rst @@ -296,7 +296,7 @@ frames and dynamic call chains is irrelevant. That's where the caveat comes into play. Specifically, if there's insufficient storage remaining for execution to -continue, how how do we know there's enough storage remaining to execute the +continue, how do we know there's enough storage remaining to execute the exception handler? For that matter, how do we even know there's enough storage available for the run-time library to find the handler in the first place? Absent a storage analysis, we can't know with certainty. diff --git a/content/courses/ada-in-practice/chapters/type_punning.rst b/content/courses/ada-in-practice/chapters/type_punning.rst index 4cadcd9b2..a08413de8 100644 --- a/content/courses/ada-in-practice/chapters/type_punning.rst +++ b/content/courses/ada-in-practice/chapters/type_punning.rst @@ -170,7 +170,7 @@ bits, including individual bit access, using the two object names. The compiler will ensure that every reference via :ada:`X` is compatible with the integer view, and every reference via :ada:`Y` is compatible with the array view. -In the above example, we've ignored the endianess issue. If you wanted to change the +In the above example, we've ignored the endianness issue. If you wanted to change the sign bit, for example, or display the bits in the "correct" order, you'd need to handle that detail. @@ -193,7 +193,7 @@ alternative type are made applicable to the object. Expressing this approach in Ada requires unchecked conversion because, in Ada, address values are semantically distinct from pointer values (*access values*). An access value might be represented by an address value, but because -architectures vary, that implementation in not guaranteed. Therefore, the +architectures vary, that implementation is not guaranteed. Therefore, the language does not define checked conversions between addresses and access values. We need the escape hatch. @@ -335,7 +335,7 @@ appropriate approach. For that matter we could use type punning but have the record type be the designated type returned from the address conversion, rather than a single axis value. Then we'd just convert :ada:`Buffer'Address` and not need to specify -array indexes as all. This would be the same as converting the array to the record +array indexes at all. This would be the same as converting the array to the record type, but with a level of indirection added. For the network packet example, we want to apply record type views to arbitrary From e433524de8310ec57499795b6861195ecf297e14 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:55 +0200 Subject: [PATCH 11/19] Editorial: fix typos/grammar in "Introduction to SPARK" Co-Authored-By: Claude Sonnet 4.6 --- .../courses/intro-to-spark/chapters/01_Overview.rst | 4 ++-- .../intro-to-spark/chapters/02_Flow_Analysis.rst | 10 +++++----- .../intro-to-spark/chapters/04_State_Abstraction.rst | 4 ++-- .../chapters/05_Proof_Of_Functional_Correctness.rst | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/content/courses/intro-to-spark/chapters/01_Overview.rst b/content/courses/intro-to-spark/chapters/01_Overview.rst index 8f5054584..05f4838af 100644 --- a/content/courses/intro-to-spark/chapters/01_Overview.rst +++ b/content/courses/intro-to-spark/chapters/01_Overview.rst @@ -207,7 +207,7 @@ Ada compiler: Dummy := F - F; -- ?? end Show_Illegal_SPARK_Code; -The SPARK languages enforces the lack of side-effects in expressions by +The SPARK language enforces the lack of side-effects in expressions by forbidding side-effects in functions, which include modifications to either parameters or global variables. As a consequence, SPARK forbids functions with :ada:`out` or :ada:`in out` parameters in addition to functions @@ -417,7 +417,7 @@ A general rule in SPARK is that once :ada:`SPARK_Mode` has been set to `Off`, it can never be switched `On` again in the same part of a package or subprogram. This prevents setting :ada:`SPARK_Mode` to `On` for local units of a unit with :ada:`SPARK_Mode` `Off` and switching back to :ada:`SPARK_Mode` -`On` for a part of a given unit where it was set fo `Off` in a previous +`On` for a part of a given unit where it was set to `Off` in a previous part. .. note:: diff --git a/content/courses/intro-to-spark/chapters/02_Flow_Analysis.rst b/content/courses/intro-to-spark/chapters/02_Flow_Analysis.rst index 36e6eb99e..facaec6b4 100644 --- a/content/courses/intro-to-spark/chapters/02_Flow_Analysis.rst +++ b/content/courses/intro-to-spark/chapters/02_Flow_Analysis.rst @@ -357,13 +357,13 @@ subprogram is a function, we list its result as an output, using the Often, the final value of a variable depends on its own initial value. You can specify this in a concise way using the :ada:`+` character, as we did in the specification of :ada:`Set_X_To_X_Plus_Y` above. If there's more than -one variable on the left of the arrow, a :ada:`+` means each variables +one variable on the left of the arrow, a :ada:`+` means each variable depends on itself, not that they all depend on each other. You can write the corresponding dependency with (:ada:`=> +`) or without (:ada:`=>+`) whitespace. If you have a program where an input isn't used to compute the final value -of any output, you express that by writting :ada:`null` on the left of the +of any output, you express that by writing :ada:`null` on the left of the dependency relation, as we did for the :ada:`Do_Nothing` subprogram above. You can only write one such dependency relation, which lists all unused inputs of the subprogram, and it must be written last. Such an annotation @@ -729,7 +729,7 @@ Flow analysis doesn't emit any messages in this case, meaning it can verify that :ada:`Result` can't be read in SPARK code while uninitialized. But why is that, since :ada:`Result` is still not initialized when :ada:`E` is not in :ada:`A`? This is because the exception, :ada:`Not_Found`, can never be caught within -SPARK code (SPAK doesn't allow exception handlers). However, the GNATprove +SPARK code (SPARK doesn't allow exception handlers). However, the GNATprove tool also tries to ensure the absence of runtime errors in SPARK code, so tries to prove that :ada:`Not_Found` is never raised. When it can't do that here, it produces a different message. @@ -865,7 +865,7 @@ actually can't be read before being written, but flow analysis isn't able to verify its initialization by using just flow information. The call to :ada:`Test_Index` is automatically inlined by GNATprove, which -leads to another messages above. If GNATprove couldn't inline the call to +leads to another message above. If GNATprove couldn't inline the call to :ada:`Test_Index`, for example if it was defined in another unit, the same messages would be issued on the call to :ada:`Test_Index`. @@ -876,7 +876,7 @@ Example #5 In the following example, we model permutations as arrays where the element at index :ada:`I` is the position of the :ada:`I`'th element in the permutation. The procedure :ada:`Init` initializes a permutation to the -identity, where the :ada:`I`'th elements is at the :ada:`I`'th +identity, where the :ada:`I`'th element is at the :ada:`I`'th position. :ada:`Cyclic_Permutation` calls :ada:`Init` and then swaps elements to construct a cyclic permutation. diff --git a/content/courses/intro-to-spark/chapters/04_State_Abstraction.rst b/content/courses/intro-to-spark/chapters/04_State_Abstraction.rst index 8c80ed5c7..e3dbebe63 100644 --- a/content/courses/intro-to-spark/chapters/04_State_Abstraction.rst +++ b/content/courses/intro-to-spark/chapters/04_State_Abstraction.rst @@ -93,7 +93,7 @@ shown below, this means the loop must terminate. Callers can also assume that the implementation of :ada:`Increase` won't cause any runtime errors when called in the loop. On the other hand, nothing in -the specification guarantees that the assertion show above is correct: it +the specification guarantees that the assertion shown above is correct: it may fail if :ada:`Increase`'s implementation is changed. If you follow this basic principle, abstraction can bring you significant @@ -624,7 +624,7 @@ subprogram's body, provides stronger guarantees to internal callers of a subprogram. If you provide one, the refined postcondition must imply the subprogram's postcondition. This is checked by GNATprove, which reports a failing postcondition if the refined postcondition is too weak, even if -it's actually implied by the subprogram's body. SPARK doesn't peform a +it's actually implied by the subprogram's body. SPARK doesn't perform a similar verification for normal preconditions. For example, we can refine the postconditions in the bodies of :ada:`Pop` and diff --git a/content/courses/intro-to-spark/chapters/05_Proof_Of_Functional_Correctness.rst b/content/courses/intro-to-spark/chapters/05_Proof_Of_Functional_Correctness.rst index 8ce0b1e41..d6641c704 100644 --- a/content/courses/intro-to-spark/chapters/05_Proof_Of_Functional_Correctness.rst +++ b/content/courses/intro-to-spark/chapters/05_Proof_Of_Functional_Correctness.rst @@ -807,7 +807,7 @@ For example, consider the function :ada:`Find` which iterates over the array At the end of each loop iteration, GNATprove knows that the value stored at index :ada:`I` in :ada:`A` must not be :ada:`E`. (If it were, the loop wouldn't -have reached the end of the interation.) This proves the second assertion. But +have reached the end of the iteration.) This proves the second assertion. But it's unable to aggregate this information over multiple loop iterations to deduce that it's true for all the indexes smaller than :ada:`I`, so it can't prove the first assertion. From d59c9187c54b8b258f06267fb942dd81c1fafc0b Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:56 +0200 Subject: [PATCH 12/19] Editorial: fix typos/grammar in "Introduction to Embedded Systems Programming" Co-Authored-By: Claude Sonnet 4.6 --- .../general_purpose_code_generators.rst | 6 +++--- .../chapters/handling_interrupts.rst | 12 +++++------ .../chapters/interacting_with_devices.rst | 4 ++-- .../chapters/low_level_programming.rst | 21 +++++++++---------- .../chapters/multi_language_development.rst | 12 +++++------ 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/content/courses/intro-to-embedded-sys-prog/chapters/general_purpose_code_generators.rst b/content/courses/intro-to-embedded-sys-prog/chapters/general_purpose_code_generators.rst index 1914b8aa5..a30b70b7b 100644 --- a/content/courses/intro-to-embedded-sys-prog/chapters/general_purpose_code_generators.rst +++ b/content/courses/intro-to-embedded-sys-prog/chapters/general_purpose_code_generators.rst @@ -280,7 +280,7 @@ produce. Anything else |mdash| the internal effects |mdash| could be removed by the optimizer. For example, suppose you have a program that writes a value to some -variable and also writes the string literal "42" to a file. That's is +variable and also writes the string literal "42" to a file. That's absolutely all that the program contains. .. code-block:: ada @@ -382,7 +382,7 @@ and stores. If we wrote this in Ada it would look like this: Temp := Port.LCKR; end Lock; -:ada:`Temp` is marked volatile for the sake of getting exactly the load +:ada:`Temp` is marked volatile for the sake of getting exactly the loads and stores that we express in the source code, corresponding to the hardware locking protocol. It's true that :ada:`Port` is a memory-mapped object, so it too would be volatile, but we also need :ada:`Temp` to be @@ -490,7 +490,7 @@ definition. We simply use the bit-level operations to set and clear the individual bits. But we cannot set the bits |mdash| the lock bit and the bit for the I/O pin to freeze |mdash| one at a time because the locking protocol requires all the bits to be written at the same time, and only -the entire 32-bit load and stores are atomic. Likewise, if instead of a +the entire 32-bit loads and stores are atomic. Likewise, if instead of a scalar we used a record type or an array type to represent the bits in the lock register, we could not write individual record or array components one at a time, for the same reason we could not write diff --git a/content/courses/intro-to-embedded-sys-prog/chapters/handling_interrupts.rst b/content/courses/intro-to-embedded-sys-prog/chapters/handling_interrupts.rst index b6f01fdbd..27d5bf62b 100644 --- a/content/courses/intro-to-embedded-sys-prog/chapters/handling_interrupts.rst +++ b/content/courses/intro-to-embedded-sys-prog/chapters/handling_interrupts.rst @@ -146,7 +146,7 @@ closely adheres to the conceptual model described above. If you have experience with interrupt handling, you will recognize them in the Ada model. One very important point to make about the Ada facilities is that they are highly portable, so they don't require extensive changes when -moving to an new target computer. Part of that portability is due to the +moving to a new target computer. Part of that portability is due to the language-defined model. Before we go into the Ada facility details, there's a final point. @@ -390,7 +390,7 @@ occurrence is not delivered again. Furthermore, the standard model requires the underlying software to block further occurrences while the handler executes, and only allow -preemption by higher-priory interrupt occurrences (if any). The +preemption by higher-priority interrupt occurrences (if any). The application handlers are not responsible for these semantics either. As you will see, the choice of program unit used for expressing handlers makes this all very convenient for the developer. @@ -561,7 +561,7 @@ the Systems Programming Annex requires the handler to be invoked again later, subject to the PO semantics described above. The default treatment for a given interrupt depends on the RTL implementation. -The default may be to jump immediately to system-defined handler that +The default may be to jump immediately to a system-defined handler that merely loops forever, thereby "hanging" the system and preventing any further execution of the application. On a bare-board target that would be a very common approach. Alternatively the default could be to ignore @@ -604,7 +604,7 @@ application or restart application execution. However, typically you will not use these procedures or functions to manage interrupts. In part that's because the architecture is usually static, i.e., the handlers are set up once and then never changed. In -that case you won't need to query whether a given exception is reserved +that case you won't need to query whether a given interrupt is reserved at run-time, or to check whether a handler is attached. You'd know that already, as part of the system architecture choices. For the same reasons, another mechanism for attaching handlers is more commonly used, @@ -912,7 +912,7 @@ as the aspect and subtype. Here is an example: In the above we set the interrupt priority to 245, presumably a value conformant with this specific target. You should be familiar with this -pragma too, because there is some much existing code using it. New code +pragma too, because there is so much existing code using it. New code should use the aspect, ideally. If we don't specify the priority for some protected object containing an @@ -1091,7 +1091,7 @@ characteristic. The :ada:`IRQ` and :ada:`IRQ_Priority` discriminants specify the handler values for that specific device and stream. These discriminant values are then used in the :ada:`Interrupt_Priority` pragma and the :ada:`Attach_Handler` aspect in the private part. ("IRQ" -is a command handler name across programming languages, and is an +is a common handler name across programming languages, and is an abbreviation for "interrupt request.") Here then are the declarations for two instances of the interrupt diff --git a/content/courses/intro-to-embedded-sys-prog/chapters/interacting_with_devices.rst b/content/courses/intro-to-embedded-sys-prog/chapters/interacting_with_devices.rst index 1d0b58533..5cae4f7c7 100644 --- a/content/courses/intro-to-embedded-sys-prog/chapters/interacting_with_devices.rst +++ b/content/courses/intro-to-embedded-sys-prog/chapters/interacting_with_devices.rst @@ -429,7 +429,7 @@ as the index. The resulting Ada procedure body is extremely simple: In the Ada version, :ada:`AFR` is a component within the :ada:`GPIO_Port` record type, much like in the C code's struct. However, Ada allows us to declare a much more descriptive set of types, and it is -these types that allows the developer to off-load the work to the compiler. +these types that allow the developer to off-load the work to the compiler. First, in Ada we can declare a 4-bit numeric type: @@ -884,7 +884,7 @@ incoming address in :ada:`Location` to a pointer designating the access value to get the designated :ada:`Word` value. Hence :ada:`X` refers to that two-byte value in memory. -We could almost certainly achieve the same affect by replacing the call to +We could almost certainly achieve the same effect by replacing the call to the function in :ada:`To_Pointer` with a call to an instance of :ada:`Ada.Unchecked_Conversion`. The conversion would still be between an access type and a value of type :ada:`System.Address`, but the access type diff --git a/content/courses/intro-to-embedded-sys-prog/chapters/low_level_programming.rst b/content/courses/intro-to-embedded-sys-prog/chapters/low_level_programming.rst index 5fae5e55a..865538850 100644 --- a/content/courses/intro-to-embedded-sys-prog/chapters/low_level_programming.rst +++ b/content/courses/intro-to-embedded-sys-prog/chapters/low_level_programming.rst @@ -630,7 +630,7 @@ To make that work, the compiler takes the most stringent alignment of all the record type's components and uses that for the alignment of the overall record type. That way, any address that satisfies the record object's alignment will satisfy the components' alignment requirements. -The alignment is component :ada:`X`, of subtype :ada:`S`, is 4. The other +The alignment of component :ada:`X`, of subtype :ada:`S`, is 4. The other components have an alignment of 1, therefore :ada:`R'Alignment` is 4. An aligned address plus 12 will also be an aligned address. @@ -1227,9 +1227,9 @@ best approach is to specify the layout explicitly. For example, perhaps you are passing data to code written in C. In that case, you need the component order in memory to match the order given in the corresponding C struct declaration. That order in memory is not necessarily guaranteed from the -order in the Ada source code. The Ada compiler is allowed to chose the -representation unless you specify it, and it might chose a different layout -from the one given. (Ordinarily, letting the compiler chose the layout is the +order in the Ada source code. The Ada compiler is allowed to choose the +representation unless you specify it, and it might choose a different layout +from the one given. (Ordinarily, letting the compiler choose the layout is the most desirable approach, but in this case we have an external layout requirement.) @@ -1267,7 +1267,7 @@ the components: :class: dark-mode-invert-image As a result, :ada:`R'Size` will be 80 bits (10 bytes), but those last two bytes -will be will be allocated to objects, for an :ada:`Object_Size` of 96 bits (12 +will be allocated to objects, for an :ada:`Object_Size` of 96 bits (12 bytes). We'll change that with an explicit layout specification. Having declared the record type, the second step consists of defining @@ -1579,8 +1579,7 @@ hand, if your code is specifically for a single ISA, e.g. Arm, even if different boards and hardware vendors are involved, there's no need to be independent of the endian-ness. It will always be the same in that case. (Those are "famous last words" though.) For an overview of the -GNAT facility, an attribute named attribute :ada:`Scalar_Storage_Order` -see +GNAT facility |mdash| an attribute named :ada:`Scalar_Storage_Order` |mdash| see https://www.adacore.com/papers/lady-ada-mediates-peace-treaty-in-endianness-war. Although specifying record type layouts and alignments are perhaps the @@ -1703,7 +1702,7 @@ more (it might round up to some advantageous block size, for example). If the implementation cannot satisfy the request, :ada:`Storage_Error` is raised. -It should be clear that that the two alternatives are mutually +It should be clear that the two alternatives are mutually exclusive. Therefore the compiler will not allow you to specify both. Each alternative has advantages. If your only concern is the total @@ -1734,7 +1733,7 @@ storage from it. Specifying a size of 0 tells the implementation not to waste that storage. Before we end this section, there is a GNAT compiler switch you should -know about. Th ``-gnatR?`` switch instructs the compiler to list the +know about. The ``-gnatR?`` switch instructs the compiler to list the representation details for the types, objects and subprograms in the compiled file(s). Both implementation-defined and user-defined representation details are presented. The '?' is just a placeholder and @@ -2147,7 +2146,7 @@ by one: type Toggle_Switch is (Off, On); for Toggle_Switch use (Off => 0, On => 4); -If we covert an unsigned integer (of the right size) to a :ada:`Toggle_Switch` +If we convert an unsigned integer (of the right size) to a :ada:`Toggle_Switch` value, what would it mean if the :ada:`Source` value was neither 0 nor 4? We've said that the instantiations are likely allowed, hence callable @@ -2169,7 +2168,7 @@ When the requirements for meaningful instantiations are not respected and the :ada:`Target` type is a scalar type, the result returned from the call is implementation defined and is potentially an invalid representation. For example, type :ada:`Toggle_Switch` is an enumeration type, hence it is a scalar -type. Therefore, if we covert an unsigned integer (of the right size) to +type. Therefore, if we convert an unsigned integer (of the right size) to a :ada:`Toggle_Switch` value, and the :ada:`Source` value is neither 0 nor 4, the resulting value is an invalid representation. That's the same as an object of type :ada:`Toggle_Switch` that is never assigned a value. The random diff --git a/content/courses/intro-to-embedded-sys-prog/chapters/multi_language_development.rst b/content/courses/intro-to-embedded-sys-prog/chapters/multi_language_development.rst index 03a03a105..8d1a74668 100644 --- a/content/courses/intro-to-embedded-sys-prog/chapters/multi_language_development.rst +++ b/content/courses/intro-to-embedded-sys-prog/chapters/multi_language_development.rst @@ -146,7 +146,7 @@ imported Fortran subprograms because the formal parameter will also be of type :ada:`Matrix`. The imported Fortran routine will then see the parameter in memory as it expects to see it. So although you wouldn't need to import or export a type itself, you might very well import or export an object of the -type, or pass it as a argument. +type, or pass it as an argument. When :ada:`Convention` is applied to subprograms, a natural mistake is to think that we are specifying the programming language used to implement the @@ -204,7 +204,7 @@ convention for Ada. Convention :ada:`Ada` simply means the calling convention applied by the Ada compiler we happen to be using. (We'll talk about :ada:`Intrinsic` shortly.) -So far, so good. But how to we get from those other language names to +So far, so good. But how do we get from those other language names to corresponding calling conventions? There is no standard calling convention for, say, C, any more than there is a standard calling convention for Ada. @@ -618,7 +618,7 @@ not used extensively in embedded systems. We will provide some information about the Fortran support but will not dwell on it. Even though we do not consider C to be appropriate for large development -projects, neither technically not economically, it has its place in small, +projects, neither technically nor economically, it has its place in small, low-criticality embedded systems. Ada developers can profit from existing device drivers and mature libraries coded in C, for example. Hence interfacing to it is important. @@ -756,7 +756,7 @@ compiler could do it silently. As a result, you should specify the record layout explicitly using a record representation clause, matching the layout of the C struct in question. Then there will be no question of the layouts matching. Once your record types get more complicated, for example with -discriminants or tagged record extensions, things get tricky. Your best bet it +discriminants or tagged record extensions, things get tricky. Your best bet is to stick with the simple cases when interfacing to C. Some types that you might think would correspond do not, at least not @@ -913,7 +913,7 @@ components, not the bounds, even for Ada unconstrained array types. Now for the other direction: passing an array from C to Ada. Here the lack of bounds information on the C side really makes a difference. We can't just pass the array by itself because that would not include the bounds, unlike an Ada -call to an Ada routine. In this case the approach is the similar to the first +call to an Ada routine. In this case the approach is similar to the first alternative described above, in which we declare a very large array and then pass the bounds explicitly: @@ -1204,7 +1204,7 @@ With this package content, the expression in a code statement is of type Asm_Insn, short for "assembly instruction." Multiple overloaded functions named :ada:`Asm` return values of that type. -The :ada:`Template` parameter in a string containing one or more assembly +The :ada:`Template` parameter is a string containing one or more assembly language instructions. These instructions are specific to the target machine. The parameter :ada:`Outputs` provides mappings from registers to source-level entities that are updated by the assembly statement(s). :ada:`Inputs` provides From 76aee130e28967f9383f72018e7aa51a2d04ac57 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:56 +0200 Subject: [PATCH 13/19] Editorial: fix typos/grammar in "What's New in Ada 2022" Co-Authored-By: Claude Sonnet 4.6 --- .../courses/whats-new-in-ada-2022/chapters/delta_aggregates.rst | 2 +- .../courses/whats-new-in-ada-2022/chapters/image_attribute.rst | 2 +- .../chapters/importing_variadic_functions.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/courses/whats-new-in-ada-2022/chapters/delta_aggregates.rst b/content/courses/whats-new-in-ada-2022/chapters/delta_aggregates.rst index c73bd254c..6285aa477 100644 --- a/content/courses/whats-new-in-ada-2022/chapters/delta_aggregates.rst +++ b/content/courses/whats-new-in-ada-2022/chapters/delta_aggregates.rst @@ -14,7 +14,7 @@ Sometimes you need to create a copy of an object, but with a few modifications. Before Ada 2022, doing this involves a dummy object declaration or an aggregate with associations for each property. The dummy object approach doesn't work in contract aspects or when there are limited -components. On the other hand, re-listing properties in an large aggregate +components. On the other hand, re-listing properties in a large aggregate can be very tedious and error-prone. So, in Ada 2022, you can use a `delta aggregate` instead. diff --git a/content/courses/whats-new-in-ada-2022/chapters/image_attribute.rst b/content/courses/whats-new-in-ada-2022/chapters/image_attribute.rst index 98c08abbe..09cea9a91 100644 --- a/content/courses/whats-new-in-ada-2022/chapters/image_attribute.rst +++ b/content/courses/whats-new-in-ada-2022/chapters/image_attribute.rst @@ -7,7 +7,7 @@ Attribute :ada:`'Image` for any type is supported by - * GNAT Community Edition 2020 and latter + * GNAT Community Edition 2020 and later * GCC 11 :ada:`'Image` attribute for a value diff --git a/content/courses/whats-new-in-ada-2022/chapters/importing_variadic_functions.rst b/content/courses/whats-new-in-ada-2022/chapters/importing_variadic_functions.rst index 505da0368..029ef7081 100644 --- a/content/courses/whats-new-in-ada-2022/chapters/importing_variadic_functions.rst +++ b/content/courses/whats-new-in-ada-2022/chapters/importing_variadic_functions.rst @@ -96,7 +96,7 @@ And the following call won't crash on any supported platform: printf_int (Interfaces.C.To_C ("d=%d"), 5); -Without this convention, problems cause by this mismatch can be very hard +Without this convention, problems caused by this mismatch can be very hard to debug. So, this is a very useful extension to the Ada-to-C interfacing facility. From fef87149f0d939af9ecbd15a9b16381d036618e2 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:56 +0200 Subject: [PATCH 14/19] Editorial: fix typos/grammar in "Bug Free Coding" lab Co-Authored-By: Claude Sonnet 4.6 --- content/labs/bug-free-coding/chapters/stack.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/labs/bug-free-coding/chapters/stack.rst b/content/labs/bug-free-coding/chapters/stack.rst index 54e99f10d..48abc0157 100644 --- a/content/labs/bug-free-coding/chapters/stack.rst +++ b/content/labs/bug-free-coding/chapters/stack.rst @@ -32,7 +32,7 @@ A stack is like a pile of dishes... #. To get plates ( :ada:`data` ) out, you take the one off the top of the pile ( :ada:`pop` ). -#. Out stack has a maximum height ( :ada:`size` ) of 9 dishes +#. Our stack has a maximum height ( :ada:`size` ) of 9 dishes **Pushing items onto the stack** @@ -67,7 +67,7 @@ The list starts out empty. Each time we push a character onto the stack, **Popping items from the stack** Here's what should happen if we popped :ada:`2` characters off our stack & then -clear it. +cleared it. .. container:: img_row From 2d631e97b4b622fffaf81c31d00b57adaf2c46ff Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:57 +0200 Subject: [PATCH 15/19] Editorial: fix typos/grammar in "AdaCore Technologies for Airborne Software" Co-Authored-By: Claude Sonnet 4.6 --- .../chapters/analysis.rst | 26 +++++++++---------- .../chapters/introduction.rst | 4 +-- .../chapters/standards.rst | 4 +-- .../chapters/summary.rst | 2 +- .../chapters/tools.rst | 10 +++---- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/content/booklets/adacore-technologies-for-airborne-software/chapters/analysis.rst b/content/booklets/adacore-technologies-for-airborne-software/chapters/analysis.rst index 9de909b44..4b18cedd0 100644 --- a/content/booklets/adacore-technologies-for-airborne-software/chapters/analysis.rst +++ b/content/booklets/adacore-technologies-for-airborne-software/chapters/analysis.rst @@ -162,7 +162,7 @@ maintainability, and to detect errors early in the software development process. This section will summarize several Ada features that help meet these goals. -.. index:: single: Ada language; Modulatization +.. index:: single: Ada language; Modularization .. index:: single: Ada language; Information hiding .. index:: single: Ada language; Packages .. index:: single: Ada language; Programming in the large @@ -410,7 +410,7 @@ object. To deallocate an allocated object, it is necessary to instantiate the generic procedure :ada:`Ada.Unchecked_Deallocation`; the result is the definition of procedure :ada:`Free`. The sample code allocates an initialized heap object and subsequently frees its -storage +storage. As another example, here's a C code fragment that performs pointer arithmetic: @@ -660,7 +660,7 @@ be specified informally by comments: They can also be captured more formally as `aspects` of the procedure specification (an aspect is a technical feature that specifies a -property of program entity) if the SPARK subset of Ada is used, as +property of a program entity) if the SPARK subset of Ada is used, as will be explained below. .. index:: single: Ada language; Interface / implementation separation @@ -911,7 +911,7 @@ correctly on both little-endian and big-endian hardware. with Bit_Order => System.Low_Order_First, Scalar_Storage_Order => System.Low_Order_First, - -- Scalar_Storage_Order is a GNAT-specifc aspect + -- Scalar_Storage_Order is a GNAT-specific aspect Size => 32, -- Bits Alignment => 4; -- Storage units @@ -1226,7 +1226,7 @@ possible activities: raise the :ada:`Assertion_Error` exception. After testing and related verification activities achieve sufficient assurance that no violations will occur, the checking code can be removed (either by - :ada:`pragma Asserion_Policy(Ignore)` or by compiling without + :ada:`pragma Assertion_Policy(Ignore)` or by compiling without |gnata|). * **Enabling dynamic checks during testing, and keeping them in the final executable object code**. In this case, the software @@ -1559,7 +1559,7 @@ Approach 1: Test cases are not specified in Ada specifications ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A traditional approach can be followed by GNATtest |mdash| that is to -say, tests cases are described outside of the Ada specification, but +say, test cases are described outside of the Ada specification, but linked to a particular function. When working this way, GNATtest will generate one test per subprogram; for example : @@ -1838,7 +1838,7 @@ implementation of one or several requirements, and a single test with all three conditions :ada:`True` will almost certainly fail to satisfy the requirement coverage criterion. Further, this single test is probably not sufficient to detect implementation errors: the purpose of testing -is to detect errors and to show that the software satisifes its +is to detect errors and to show that the software satisfies its requirements, not to achieve structural code coverage. Structural coverage analysis is mainly a test completeness activity. @@ -2541,7 +2541,7 @@ an exception would be raised.) The type :ada:`Jet` is not substitutable for the type :ada:`Aircraft` on invocations of :ada:`Open_Doors`. -The non-substitutabiity is reflected in the use of the specific aspect +The non-substitutability is reflected in the use of the specific aspect :ada:`Pre` rather than the class-wide aspect :ada:`Pre'Class`. In a type hierarchy rooted at type :ada:`T` where :ada:`Pre'Class` is specified at each level for a subprogram :ada:`Proc`, the effective @@ -2781,7 +2781,7 @@ than the precondition on :ada:`Open_Doors` for :ada:`Aircraft`. But * The postcondition for :ada:`Take_Off(Aircraft)` is strengthened by :ada:`Jet` -Whether it is easier to demonstrate local versus global suitability +Whether it is easier to demonstrate local versus global substitutability for a given class depends on the architecture and the ease of identification of actual dispatch destinations and substitutability. |do-332| allows the applicant to decide on whichever @@ -2840,7 +2840,7 @@ be made by dispatching from this call. All objectives that apply to control and data coupling now apply to type derivation coupling, in particular the coverage objectives. Whether or not testing with all possible derivations in the system is used (i.e., pessimistic testing) -depends of the strategy chosen for substitutability demonstration. +depends on the strategy chosen for substitutability demonstration. .. index:: single: DO-332/ED-217: Object-Oriented Technology and Related Techniques; Memory management issues @@ -3031,7 +3031,7 @@ several reasons: correspond to violations of preconditions, and such violations should not occur in verified code. * Since the normal control flow has been abandoned, the program may be - in an instable state (for example with aggregate data structures not + in an unstable state (for example with aggregate data structures not fully updated) and writing an appropriate handler can be difficult. |do-332| specifies that exception handling needs to be taken into @@ -3881,7 +3881,7 @@ check the contents of a flash zone: .. index:: DO-333/ED-216: Formal Methods -The Low-Level Requirments comprise a textual description and a set of +The Low-Level Requirements comprise a textual description and a set of formal properties. The textual description appears in |do-333| and is not repeated here. The formal properties of the :ada:`A1F2_TestZone` procedure are of three kinds: @@ -4062,7 +4062,7 @@ correctness of the overall system." and discrepancies explained * Table FM.A-6, Objective 3: Executable object code complies with low-level requirements -* Table FM.A-6, Objective 4: Executable object code is tobust with +* Table FM.A-6, Objective 4: Executable object code is robust with low-level requirements * Table FM.A-7, Objective FM 4: Coverage of low-level requirements is achieved diff --git a/content/booklets/adacore-technologies-for-airborne-software/chapters/introduction.rst b/content/booklets/adacore-technologies-for-airborne-software/chapters/introduction.rst index 22e48dde7..588a183ca 100644 --- a/content/booklets/adacore-technologies-for-airborne-software/chapters/introduction.rst +++ b/content/booklets/adacore-technologies-for-airborne-software/chapters/introduction.rst @@ -6,7 +6,7 @@ Introduction This document explains how to use AdaCore's technologies |mdash| the company's tools, run-time libraries, and associated services |mdash| in conjunction with the safety-related standards for airborne -software: |do-178c| and and its technology supplements and tool +software: |do-178c| and its technology supplements and tool qualification considerations. It describes how AdaCore's technologies fit into a project's software life cycle processes, and how they can satisfy various objectives of the standards. Many of the advantages @@ -100,7 +100,7 @@ objectives for one project (determined by the development standards, the input complexity, the target computer and system environment) but not necessarily on another project. The effort and amount of justification to gain approval may also differ from one auditor to -another, depending of their background. Whenever a new tool, method, +another, depending on their background. Whenever a new tool, method, or technique is introduced, it's important to open a discussion with AdaCore and the designated authority to confirm its acceptability. The level of detail in the process description provided in the project diff --git a/content/booklets/adacore-technologies-for-airborne-software/chapters/standards.rst b/content/booklets/adacore-technologies-for-airborne-software/chapters/standards.rst index 321559137..1cdd67065 100644 --- a/content/booklets/adacore-technologies-for-airborne-software/chapters/standards.rst +++ b/content/booklets/adacore-technologies-for-airborne-software/chapters/standards.rst @@ -125,7 +125,7 @@ but might fail to detect an error) to TQL-1 (the highest, applicable to software tools that can insert an error in software at level A). A tool is only qualified in the context of a specific project, for a -specific certification credit, expressed in term of objectives and +specific certification credit, expressed in terms of objectives and activities. Achieving qualification for a tool on a specific project does of course greatly increase the likelihood of being able to qualify the tool on another project. However, a different project may @@ -172,7 +172,7 @@ do not relate directly to the issues addressed in this supplement. Object-Oriented Technology and Related Techniques Supplement: DO-332/ED-217 ------------------------------------------------------------------------------ -Although |do-332| is often referred as the "object oriented +Although |do-332| is often referred to as the "object oriented supplement", the "related techniques" mentioned in the title are equally relevant and are addressed in detail. They may be used in conjunction with Object-Oriented Technology (OOT) but are not diff --git a/content/booklets/adacore-technologies-for-airborne-software/chapters/summary.rst b/content/booklets/adacore-technologies-for-airborne-software/chapters/summary.rst index ac79d8353..b3e2c50d5 100644 --- a/content/booklets/adacore-technologies-for-airborne-software/chapters/summary.rst +++ b/content/booklets/adacore-technologies-for-airborne-software/chapters/summary.rst @@ -99,7 +99,7 @@ solutions can reduce the effort in meeting some of these objectives. Objective, Summary, Activities, "Use case #1a", "Use case #1b (OOT)", "Use case #2" 1, "The activities of the software life cycle processes are defined", All, "This document describes possible methods and tools that may be used. When an AdaCore solution is adopted, it should be documented in the plans.", Same as #1a, Same as #1a 2, "The software life cycle(s), including the inter-relationships between the processes, their sequencing, and transition criteria, is defined.", All, "A variety of software life cycles may be defined (such as V cycle, Incremental, Iterative, and Agile). AdaCore solutions do not require any specific software life cycle.", Same as #1a, Same as #1a - 3, "Software life cycle environment is selected and defined", "4.4.1.a, 4.4.1.f, 4.4.2.b, 4.4.3.a, 4.4.3.b", "When an AdaCore solution is used, the plans should identify and escribe the associated tools. In particular, see :ref:`Airborn_SW_Sustained_Branches` and :ref:`Airborn_SW_Compiling_with_the_GNAT_Pro_compiler`", Same as #1a, Same as #1a + 3, "Software life cycle environment is selected and defined", "4.4.1.a, 4.4.1.f, 4.4.2.b, 4.4.3.a, 4.4.3.b", "When an AdaCore solution is used, the plans should identify and describe the associated tools. In particular, see :ref:`Airborn_SW_Sustained_Branches` and :ref:`Airborn_SW_Compiling_with_the_GNAT_Pro_compiler`", Same as #1a, Same as #1a 4, "Additional considerations are addressed", "4.2.j, 4.2.k", "The need for tool qualification is addressed throughout this document.", "Same as #1a", "Same as #1a" 5, "Software development standards are defined.", "4.2.b, 4.5.b, 4.5.c, 4.5.d", "This document describes possible languages, methods and tools that may be used during the design and coding processes. When any of them are used, design and code standards must be developed accordingly. A Code Standard can be defined through :ref:`Airborn_SW_GNATcheck`", "Same as #1a", "Same as #1a" 6, "Software plans comply with this document.", All, "This objective is satisfied through the review and analysis of the plans and standards.", "Same as #1a", "Same as #1a" diff --git a/content/booklets/adacore-technologies-for-airborne-software/chapters/tools.rst b/content/booklets/adacore-technologies-for-airborne-software/chapters/tools.rst index 4578a9bc0..6f163b9c5 100644 --- a/content/booklets/adacore-technologies-for-airborne-software/chapters/tools.rst +++ b/content/booklets/adacore-technologies-for-airborne-software/chapters/tools.rst @@ -117,7 +117,7 @@ contracts the developer can formalize the intended behavior of the application, and can verify this behavior by testing, static analysis or formal proof. -Here's a skeletal example that illustrates contact-based programming; +Here's a skeletal example that illustrates contract-based programming; a :ada:`Table` object is a fixed-length container for distinct :ada:`Float` values. @@ -278,7 +278,7 @@ memory safety; this is illustrated by a number of features, including: A run-time check guarantees that an array index is within the bounds of the array. This prevents buffer overflow vulnerabilities that - are common in C and C++. In many cases a a compiler optimization + are common in C and C++. In many cases a compiler optimization can detect statically that the index is within bounds and thus eliminate any run-time code for the check. @@ -290,7 +290,7 @@ memory safety; this is illustrated by a number of features, including: * Prevention of dangling references - A scope accessibility checks ensures that a pointer cannot reference + A scope accessibility check ensures that a pointer cannot reference an object on the stack after exit/return from the scope (block or subprogram) in which the object is declared. Such checks are generally static, with no run-time overhead. @@ -772,7 +772,7 @@ standard as a set of rules, for example a subset of permitted language features. It verifies a program's conformance with the resulting rules and thereby facilitates demonstration of a system's compliance with Table A-5, Objective 4 of |do-178c| ("Source Code conforms to -standards"). GNATcheck providess: +standards"). GNATcheck provides: * An integrated `Ada Restrictions` mechanism for banning specific features from an application. This can be used to restrict features @@ -799,7 +799,7 @@ standards"). GNATcheck providess: AdaCore's :index:`GNATformat` tool, which formats Ada source code according to the `GNAT coding style `_, can help avoid -having code that violates GNATcheck rules +having code that violates GNATcheck rules. GNATcheck comes with a query language (called LKQL) that lets developers define their own checks for any in-house rules that need to From cca323159606eb378e8bce7e8611fb69695f95da Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:57 +0200 Subject: [PATCH 16/19] Editorial: fix typos/grammar in "AdaCore Technologies for Railway Software" Co-Authored-By: Claude Sonnet 4.6 --- .../chapters/cenelec.rst | 8 ++++---- .../chapters/introduction.rst | 2 +- .../chapters/technology.rst | 16 ++++++++-------- .../chapters/tools.rst | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/content/booklets/adacore-technologies-for-railway-software/chapters/cenelec.rst b/content/booklets/adacore-technologies-for-railway-software/chapters/cenelec.rst index 2d8b53fb5..e6db067b7 100644 --- a/content/booklets/adacore-technologies-for-railway-software/chapters/cenelec.rst +++ b/content/booklets/adacore-technologies-for-railway-software/chapters/cenelec.rst @@ -10,7 +10,7 @@ EN 50128 governs software used in railway control and protection applications, i.e., systems that ensure the safe and efficient movement of trains. Examples include: -* *Automatic Train Protection (ATP)*, which ensure automatic braking to avoid +* *Automatic Train Protection (ATP)*, which ensures automatic braking to avoid collisions or overspeed; * *Interlocking Systems*, which prevent conflicting train movements through @@ -22,10 +22,10 @@ Examples include: * *Level Crossing Protection*, which manages gates and warnings at road-rail intersections; and -* *Centralized Traffic Control (CTC)*, which oversee train routing and +* *Centralized Traffic Control (CTC)*, which oversees train routing and dispatch across large regions. -The goal of the standard is to provide confidence that that the software +The goal of the standard is to provide confidence that the software functions reliably and safely relative to its SIL. To this end it specifies requirements in areas including the following: @@ -168,7 +168,7 @@ Clause 7, *Generic software development*, has the following sub-clauses: * Component design (sub-clause 7.4); * Component implementation and testing (sub-clause 7.5); * Integration (sub-clause 7.6); and -* Overall Software Testing / Final Validation (sub-class 7.7). +* Overall Software Testing / Final Validation (sub-clause 7.7). .. index:: single: EN 50128; Clause 8 (Development of application data or algorithms) diff --git a/content/booklets/adacore-technologies-for-railway-software/chapters/introduction.rst b/content/booklets/adacore-technologies-for-railway-software/chapters/introduction.rst index 138540956..4dc97f6fd 100644 --- a/content/booklets/adacore-technologies-for-railway-software/chapters/introduction.rst +++ b/content/booklets/adacore-technologies-for-railway-software/chapters/introduction.rst @@ -239,7 +239,7 @@ The following technologies will be presented: - GNAT Studio |mdash| a robust, flexible, and extensible IDE - VS Code support |mdash| extensions for Ada and SPARK - - GNATbench |mdash| an Ada-knowlegeable Eclipse plug-in + - GNATbench |mdash| an Ada-knowledgeable Eclipse plug-in - GNATdashboard |mdash| a metric integration and management platform .. _Railway_SW_fig2: diff --git a/content/booklets/adacore-technologies-for-railway-software/chapters/technology.rst b/content/booklets/adacore-technologies-for-railway-software/chapters/technology.rst index abed8c2b0..7cb4547a3 100644 --- a/content/booklets/adacore-technologies-for-railway-software/chapters/technology.rst +++ b/content/booklets/adacore-technologies-for-railway-software/chapters/technology.rst @@ -69,7 +69,7 @@ Boundary Value Analysis (D.4) ----------------------------- The objective of this technique is to verify and test the behavior of a -subprogram at the limits and boundaries values of its parameters. +subprogram at the limits and boundary values of its parameters. AdaCore's technologies can provide complementary assurance on the quality of this analysis and potentially decrease the number of tests that need to be performed. @@ -522,7 +522,7 @@ with their associated expected output, verifying the following criteria: These criteria can be verified either dynamically, by verifying at test time that all inputs exercised fall into one and only one partition, -or formally by SPARK, proving that the partition are indeed complete +or formally by SPARK, proving that the partitions are indeed complete and disjoint. .. index:: Contract_Cases aspect @@ -641,7 +641,7 @@ It's also possible to create an *abstract* state, implemented by a set of variables. Generally speaking, although these notations and verifications are quite useful on the lower levels of the architecture, they may not be that pertinent at higher levels. SPARK is flexible with regard to where -this should be checked or and where it should not. +this should be checked or where it should not. At the lower level of the design phases, some properties and requirements can be refined or specified in the form of boolean expressions. @@ -680,7 +680,7 @@ removed. Impact Analysis (D.32) ---------------------- -Identifying the effect of a change on entire software component requires +Identifying the effect of a change on an entire software component requires the combination of various techniques, including reviews, testing and static analysis. GNAT SAS has specific features to identify the impact of a change from the perspective of potential run-time errors. It can establish a baseline @@ -943,7 +943,7 @@ complex computations such as cyclomatic complexity or coupling. Custom metrics can be computed based on these first-level metrics. In particular, the GNATdashboard environment allows gathering all metrics -into a database that can then accessed through Python or SQL. +into a database that can then be accessed through Python or SQL. These metrics can be viewed through various interfaces. @@ -1119,7 +1119,7 @@ by the compiler. For example: type Miles is new Float: These are distinct types. -the compiler will not allow mixed operations, for example assigning a +The compiler will not allow mixed operations, for example assigning a :ada:`Kilometers` value to a :ada:`Miles` variable, or adding a :ada:`Kilometers` value and a :ada:`Miles` value, unless explicit conversions are used. @@ -1181,8 +1181,8 @@ Some features may, however, not be suitable for the highest SIL. To enforce the detection and rejection of specific features, the developer can specify a language subset; see :ref:`Railway_SW_Language_Subset`. -One of the advantage of the Ada language is that it is precisely defined -in a international document, ISO/IEC 8652. +One of the advantages of the Ada language is that it is precisely defined +in an international document, ISO/IEC 8652. This document specifies the required effect as well as any implementation-defined behavior for the core language, the standard Ada libraries (known as the "predefined environment"), and the specialized needs diff --git a/content/booklets/adacore-technologies-for-railway-software/chapters/tools.rst b/content/booklets/adacore-technologies-for-railway-software/chapters/tools.rst index 53334d32a..e9ea7c85f 100644 --- a/content/booklets/adacore-technologies-for-railway-software/chapters/tools.rst +++ b/content/booklets/adacore-technologies-for-railway-software/chapters/tools.rst @@ -123,7 +123,7 @@ generalized constraints (predicates). Through contracts the developer can formalize the intended behavior of the application, and can verify this behavior by testing, static analysis or formal proof. -Here's a skeletal example that illustrates contact-based programming; a +Here's a skeletal example that illustrates contract-based programming; a :ada:`Table` object is a fixed-length container for distinct :ada:`Float` values. @@ -294,7 +294,7 @@ memory safety; this is illustrated by a number of features, including: A run-time check guarantees that an array index is within the bounds of the array. This prevents buffer overflow vulnerabilities that are common in C and C++. - In many cases a a compiler optimization can detect statically that the + In many cases a compiler optimization can detect statically that the index is within bounds and thus eliminate any run-time code for the check. * *Prevention of null pointer dereferences* @@ -305,7 +305,7 @@ memory safety; this is illustrated by a number of features, including: * *Prevention of dangling references* - A scope accessibility checks ensures that a pointer cannot reference an + A scope accessibility check ensures that a pointer cannot reference an object on the stack after exit/return from the scope (block or subprogram) in which the object is declared. Such checks are generally static, with no run-time overhead. From 6ff1bb4f0cf3014b1bf3681a025439e156f90790 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:57 +0200 Subject: [PATCH 17/19] Editorial: fix typos/grammar in "AdaCore Technologies for Space Systems Software" Co-Authored-By: Claude Sonnet 4.6 --- .../chapters/compliance-e40c.rst | 6 +++--- .../chapters/introduction.rst | 2 +- .../chapters/programming.rst | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/content/booklets/adacore-technologies-for-space-systems-software/chapters/compliance-e40c.rst b/content/booklets/adacore-technologies-for-space-systems-software/chapters/compliance-e40c.rst index 7e1b370ee..4c50806a9 100644 --- a/content/booklets/adacore-technologies-for-space-systems-software/chapters/compliance-e40c.rst +++ b/content/booklets/adacore-technologies-for-space-systems-software/chapters/compliance-e40c.rst @@ -42,7 +42,7 @@ Transformation of software requirements into a software architecture {§5.4.3.1} behavior." {§5.4.3.1a} * The Ada and SPARK languages (and thus the GNAT Pro Ada and SPARK Pro - toolsuites directly support this requirement. Relevant + toolsuites) directly support this requirement. Relevant features include packages, child libraries, subunits, private types, tasking, and object-oriented programming (tagged types). The :index:`GNATstub` utility (included with GNAT Pro Ada) is useful here; @@ -226,8 +226,8 @@ Detailed design of real-time software {§5.5.2.5} pragma :ada:`Restrictions` produces a run-time check that detects attempts to perform allocations from a standard storage pool after elaboration (initialization). Depending on the program structure, - static analysis by the GNAT Static Analysis Suite's Defect and - vulnerability Analyzer may be able to determine that this check + static analysis by the GNAT Static Analysis Suite's Defects and + Vulnerability Analyzer may be able to determine that this check will never fail. Utilization of description techniques for the software behaviour {§5.5.2.6} diff --git a/content/booklets/adacore-technologies-for-space-systems-software/chapters/introduction.rst b/content/booklets/adacore-technologies-for-space-systems-software/chapters/introduction.rst index a3c1925eb..5f0b24954 100644 --- a/content/booklets/adacore-technologies-for-space-systems-software/chapters/introduction.rst +++ b/content/booklets/adacore-technologies-for-space-systems-software/chapters/introduction.rst @@ -29,7 +29,7 @@ national space organizations, and industrial partners. As stated in The resulting set of standards, available from the ECSS web portal :footcite:p:`Space_SW_ECSS_HomePage`, addresses space activities as a -whole and complement the relevant country-specific standards. +whole and complements the relevant country-specific standards. The ECSS standards specify requirements that must be satisfied (although project-specific tailoring is allowed) and fall into three categories: diff --git a/content/booklets/adacore-technologies-for-space-systems-software/chapters/programming.rst b/content/booklets/adacore-technologies-for-space-systems-software/chapters/programming.rst index b481e7465..f9d165bf8 100644 --- a/content/booklets/adacore-technologies-for-space-systems-software/chapters/programming.rst +++ b/content/booklets/adacore-technologies-for-space-systems-software/chapters/programming.rst @@ -323,7 +323,7 @@ varying-length array) for an arbitrary element type :ada:`T`, where each element of the data structure is of type :ada:`T`. For safety and efficiency, compile-time checks should enforce type safety both within the parameterized module, and at each use (*instantiation*). -Conceptually an +Conceptually, an instantiation can be regarded as an expansion of the parameterized module, with actual parameters replacing the formal parameters. However, the expansion is not at the lexical/syntactic level (source text) but rather at the semantic @@ -353,7 +353,7 @@ Object-Oriented Programming (OOP) (packages) corresponding to abstract data types or abstract objects. Full OOP support was not provided since, first, it seemed not to be required in the real-time domain that was Ada's primary target, and second, the -apparent need for automatic garbage collection in an Object Oriented language +apparent need for automatic garbage collection in an object-oriented language would have interfered with predictable and efficient performance. However, large real-time systems often have components such as graphical user From 12fd6a29be484c5ff6c180daa36272c6f7f90524 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 24 May 2026 17:55:58 +0200 Subject: [PATCH 18/19] Editorial: fix typos/grammar in site-level content pages Co-Authored-By: Claude Sonnet 4.6 --- content/about.rst | 6 +++--- content/index.rst | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/content/about.rst b/content/about.rst index 3c649855e..8be1d8223 100644 --- a/content/about.rst +++ b/content/about.rst @@ -7,15 +7,15 @@ About learn.adacore.com ========================== -Learn.adacore.com is an interactive learning platform designed to teach the Ada and SPARK programming languages. With courses featuring hands-on labs and easy to understand code snippets, you will have the opportunity to see, understand and experiment with the language capabilities. +Learn.adacore.com is an interactive learning platform designed to teach the Ada and SPARK programming languages. With courses featuring hands-on labs and easy-to-understand code snippets, you will have the opportunity to see, understand and experiment with the language capabilities. .. rubric:: About Ada/SPARK The Ada programming language was designed from its inception to be used in applications where safety and security are of the utmost importance. Its feature set and programming paradigms, by design, allow software developers to develop applications more effectively and efficiently. It encourages a “think first, code later” principle which produces more readable, reliable, and maintainable software. -The SPARK programming language is a formally verifiable subset of the Ada language which allows developers to mathematically prove program correctness through static means. This is accomplished by exploiting the strengths of the Ada syntax while eliminating the features of the language that introduce ambiguity and non-deterministic behavior. The language put together with a verification toolset and a design methodology ensures the development and deployment of low-defect software for high reliability applications. +The SPARK programming language is a formally verifiable subset of the Ada language which allows developers to mathematically prove program correctness through static means. This is accomplished by exploiting the strengths of the Ada syntax while eliminating the features of the language that introduce ambiguity and non-deterministic behavior. The language put together with a verification toolset and a design methodology ensures the development and deployment of low-defect software for high-reliability applications. .. rubric:: About AdaCore -Founded in 1994, AdaCore is the leading provider of commercial and open-source software solutions for Ada, a state-of-the-art programming language designed for large, long-lived applications where safety, security, and reliability are critical. AdaCore is committed to being an active member of the software development community providing the GNAT Ada compiler and SPARK formal methods technologies as open-source projects to the world to advocate their use in the future of safe and reliable computing. Visit the AdaCore `website `_ for more information. \ No newline at end of file +Founded in 1994, AdaCore is the leading provider of commercial and open-source software solutions for Ada, a state-of-the-art programming language designed for large, long-lived applications where safety, security, and reliability are critical. AdaCore is committed to being an active member of the software development community, providing the GNAT Ada compiler and SPARK formal methods technologies as open-source projects to the world to advocate their use in the future of safe and reliable computing. Visit the AdaCore `website `_ for more information. \ No newline at end of file diff --git a/content/index.rst b/content/index.rst index c5a157d3e..ecd6ca420 100644 --- a/content/index.rst +++ b/content/index.rst @@ -40,7 +40,7 @@ What is Ada and SPARK? ----------------------- - Ada is a state-of-the art programming language that development teams worldwide + Ada is a state-of-the-art programming language that development teams worldwide are using for critical software: from microkernels and small-footprint, real-time embedded systems to large-scale enterprise applications, and everything in between. From 45ac5d6ed4bac64ee55182c0bb14d41bf42a35a9 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Mon, 25 May 2026 01:07:14 +0200 Subject: [PATCH 19/19] Editorial: fix malformed table in "Advanced Ada" types chapter Restore correct column width and capitalisation on the "Multiplying operators" row, which had one extra trailing space that misaligned the right border. Co-Authored-By: Claude Sonnet 4.6 --- content/courses/advanced-ada/parts/data_types/types.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/courses/advanced-ada/parts/data_types/types.rst b/content/courses/advanced-ada/parts/data_types/types.rst index 552cdbbcf..2fbc75409 100644 --- a/content/courses/advanced-ada/parts/data_types/types.rst +++ b/content/courses/advanced-ada/parts/data_types/types.rst @@ -86,7 +86,7 @@ symbols or reserved words specified in the Ada language: +------------------------------+----------------------------------------------+ | Unary adding operators | :ada:`+`, :ada:`-` | +------------------------------+----------------------------------------------+ -| multiplying operators | :ada:`*`, :ada:`/`, :ada:`mod`, :ada:`rem` | +| Multiplying operators | :ada:`*`, :ada:`/`, :ada:`mod`, :ada:`rem` | +------------------------------+----------------------------------------------+ | Highest precedence operators | :ada:`**`, :ada:`abs`, :ada:`not` | +------------------------------+----------------------------------------------+