Skip to content

Commit 9b5c727

Browse files
Merge remote-tracking branch 'origin/master' into slides/131-replace-field_and_element_in_other_courses
2 parents f772510 + 745c53a commit 9b5c727

File tree

77 files changed

+1492
-684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1492
-684
lines changed

.github/workflows/main.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ name: CI
22

33
# Controls when the action will run. Triggers the workflow on push or pull request
44
# events but only for the master branch
5-
on:
6-
push:
7-
branches: [ master ]
8-
pull_request:
9-
branches: ['**']
5+
on: push
106

117
jobs:
128
List-Courses:

contrib/example_extract.py

-78
This file was deleted.

contrib/review_run_slides

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def main():
210210
branch = get_current_git_branch()
211211

212212
if branch != "master":
213-
VALID_BRANCH_PREFIX = ("build/", "slides/", "training/", "experimental/")
213+
VALID_BRANCH_PREFIX = ("mr/", "build/", "slides/", "training/", "experimental/")
214214
if not any(branch.startswith(prefix) for prefix in VALID_BRANCH_PREFIX):
215215
print(
216216
f"branch name must start with one of {VALID_BRANCH_PREFIX}",

courses/fundamentals_of_ada/020_declarations/01-introduction.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ Declarations
3636
- et cetera
3737

3838
* In a :dfn:`declarative part`
39+
3940
* Example: :ada:`N : Type := Value;`
4041

4142
- ``N`` is usually an :dfn:`identifier`
4243

43-
* Declaration **must precede** use
4444
* **Some** implicit declarations
4545

4646
- **Standard** types and operations
4747
- **Implementation**-defined
4848

49+
.. warning:: Declaration **must precede** use

courses/fundamentals_of_ada/020_declarations/02-identifiers_and_comments.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ Identifiers
3131
A_
3232
_space_person
3333
34+
.. warning:: Reserved words are **forbidden**
35+
3436
* Character set **Unicode** 4.0
3537
* Case **not significant**
3638

3739
- `SpacePerson` |equivalent| `SPACEPERSON`
3840
- ...but **different** from `Space_Person`
3941

40-
* Reserved words are **forbidden**
41-
4242
----------------
4343
Reserved Words
4444
----------------

courses/fundamentals_of_ada/020_declarations/03-literals.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ Decimal Numeric Literals
3434
numeral [.numeral] E [+numeral|-numeral]
3535
numeral ::= digit {['_'] digit}
3636
37-
* Underscore is not significant
37+
.. tip:: Underscore is **not** significant and helpful for grouping
38+
3839
* **E** (exponent) must always be integer
3940
* Examples
4041

courses/fundamentals_of_ada/020_declarations/05-universal_types.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ Numeric Literals Are Universally Typed
3434

3535
* Compiler handles typing
3636

37-
- No bugs with precision
37+
.. note:: No bugs with precision
3838

39-
.. code:: Ada
39+
.. code:: Ada
4040
41-
X : Unsigned_Long := 0;
42-
Y : Unsigned_Short := 0;
41+
X : Unsigned_Long := 0;
42+
Y : Unsigned_Short := 0;
4343
4444
----------------------------------------
4545
Literals Must Match "Class" of Context

courses/fundamentals_of_ada/020_declarations/06-named_numbers.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ Named Number Benefit
5151
* Evaluation at **compile time**
5252

5353
- As if **used directly** in the code
54-
- **Perfect** accuracy
5554

56-
.. code:: Ada
55+
.. tip:: Useful due to their **perfect** accuracy
5756

58-
Named_Number : constant := 1.0 / 3.0;
59-
Typed_Constant : constant Float := 1.0 / 3.0;
57+
.. code:: Ada
58+
59+
Named_Number : constant := 1.0 / 3.0;
60+
Typed_Constant : constant Float := 1.0 / 3.0;
6061
6162
.. container:: latex_environment footnotesize
6263

courses/fundamentals_of_ada/020_declarations/07-scope_and_visibility.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ Scope and "Lifetime"
6161
----------------------
6262

6363
* Object in scope |rightarrow| exists
64-
* No *scoping* keywords
6564

66-
- C's :c:`static`, :c:`auto` etc...
65+
.. note:: No *scoping* keywords (C's :c:`static`, :c:`auto` etc...)
6766

6867
.. image:: block_scope_example.jpeg
6968
:height: 50%
@@ -101,9 +100,11 @@ Overcoming Hiding
101100

102101
- Needs named scope
103102

104-
* Homographs are a *code smell*
103+
.. warning::
105104

106-
- May need **refactoring**...
105+
* Homographs are a *code smell*
106+
107+
- May need **refactoring**...
107108

108109
.. code:: Ada
109110

courses/fundamentals_of_ada/030_basic_types/01-introduction.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Strong Typing
1515

1616
- **Check** of values and operations
1717
- Easy for a computer
18-
- Developer can focus on **earlier** phase: requirement
18+
19+
.. tip:: Developer can focus on **earlier** phase: requirement
1920

2021
----------------------------------------
2122
Strongly-Typed Vs Weakly-Typed Languages
@@ -198,7 +199,8 @@ Type Model Run-Time Costs
198199
* **Same performance** for identical programs
199200

200201
- Run-time type checks can be disabled
201-
- Compile-time check is *free*
202+
203+
.. note:: Compile-time check is *free*
202204

203205
.. container:: columns
204206

courses/fundamentals_of_ada/030_basic_types/02-discrete_numeric_types.rst

+9-6
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ Predefined Signed Integer Types
5151
- Guaranteed ranges: :ada:`Short_Integer` ``<=`` :ada:`Integer` ``<=`` :ada:`Long_Integer`
5252
- Ranges are all **implementation-defined**
5353

54-
* Portability not guaranteed
54+
.. warning::
5555

56-
- But may be difficult to avoid
56+
Portability not guaranteed
57+
58+
* But usage may be difficult to avoid
5759

5860
---------------------------------
5961
Operators for Signed Integer Type
@@ -67,12 +69,13 @@ Operators for Signed Integer Type
6769
:multiplying operator: :ada:`* | / | mod | rem`
6870
:highest precedence operator: :ada:`** | abs`
6971

70-
* *Note*: for exponentiation :ada:`**`
72+
.. note::
7173

72-
- Result will be a signed integer
73-
- So power **must** be :ada:`Integer` ``>= 0``
74+
Exponentiation (:ada:`**`) result will be a signed integer
7475

75-
* Division by zero |rightarrow| :ada:`Constraint_Error`
76+
- So power **must** be :ada:`Integer` ``>= 0``
77+
78+
.. warning:: Division by zero |rightarrow| :ada:`Constraint_Error`
7679

7780
------------------------
7881
Signed Integer Overflows

courses/fundamentals_of_ada/030_basic_types/02-discrete_numeric_types_with_mod.rst

+10-7
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ Predefined Signed Integer Types
5151
- Guaranteed ranges: :ada:`Short_Integer` ``<=`` :ada:`Integer` ``<=`` :ada:`Long_Integer`
5252
- Ranges are all **implementation-defined**
5353

54-
* Portability not guaranteed
54+
.. warning::
5555

56-
- But may be difficult to avoid
56+
Portability not guaranteed
57+
58+
- But usage may be difficult to avoid
5759

5860
---------------------------------
5961
Operators for Signed Integer Type
@@ -67,12 +69,13 @@ Operators for Signed Integer Type
6769
:multiplying operator: :ada:`* | / | mod | rem`
6870
:highest precedence operator: :ada:`** | abs`
6971

70-
* *Note*: for exponentiation :ada:`**`
72+
.. note::
73+
74+
Exponentiation (:ada:`**`) result will be a signed integer
7175

72-
- Result will be a signed integer
73-
- So power **must** be :ada:`Integer` ``>= 0``
76+
- So power **must** be :ada:`Integer` ``>= 0``
7477

75-
* Division by zero |rightarrow| :ada:`Constraint_Error`
78+
.. warning:: Division by zero |rightarrow| :ada:`Constraint_Error`
7679

7780
------------------------
7881
Signed Integer Overflows
@@ -119,7 +122,7 @@ Modular Types
119122
* **Unsigned** values
120123
* Adds operations and attributes
121124

122-
* Typically **bit-wise** manipulation
125+
.. note:: Typically **bit-wise** manipulation
123126

124127
* Syntax
125128

courses/fundamentals_of_ada/030_basic_types/07-real_types.rst

+11-6
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ Predefined Floating Point Types
7777
- :ada:`Long_Float` ``>= 11`` digits
7878

7979
* General-purpose
80-
* Best to **avoid** predefined types
8180

82-
- Loss of **portability**
83-
- Easy to avoid
81+
.. tip::
82+
83+
It is best, and easy, to **avoid** predefined types
84+
85+
- To keep **portability**
8486

8587
-------------------------------
8688
Floating Point Type Operators
@@ -94,9 +96,11 @@ Floating Point Type Operators
9496
:multiplying operator: :ada:`* | /`
9597
:highest precedence operator: :ada:`** | abs`
9698

97-
* *Note* on floating-point exponentiation ``**``
99+
.. note::
98100

99-
- Power must be :ada:`Integer`
101+
Exponentiation (:ada:`**`) result will be real
102+
103+
- So power must be :ada:`Integer`
100104

101105
+ Not possible to ask for root
102106
+ :ada:`X**0.5` |rightarrow| :ada:`sqrt (x)`
@@ -140,7 +144,8 @@ Numeric Types Conversion
140144
* Special rule: can always convert between numeric types
141145

142146
- Explicitly
143-
- :ada:`Float` |rightarrow| :ada:`Integer` causes **rounding**
147+
148+
.. warning:: :ada:`Float` |rightarrow| :ada:`Integer` causes **rounding**
144149

145150
.. code:: Ada
146151

courses/fundamentals_of_ada/030_basic_types/10-subtypes.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Subtype
1616
1717
- :ada:`Type_Name` is an existing :ada:`type` or :ada:`subtype`
1818

19-
* If no constraint |rightarrow| type alias
19+
.. note:: If no constraint |rightarrow| type alias
2020

2121
-----------------
2222
Subtype Example

courses/fundamentals_of_ada/030_basic_types/11-subtypes_full_picture.rst

+29
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,35 @@ Attributes Reflect the Underlying Type
181181
Shade : Color range Red .. Blue := Brown; -- run-time error
182182
Hue : Rainbow := Rainbow'Succ (Blue); -- run-time error
183183
184+
---------------
185+
Valid attribute
186+
---------------
187+
188+
* :ada:`The_Type'Valid` is a :ada:`Boolean`
189+
* :ada:`True` |rightarrow| the current representation for the given scalar is valid
190+
191+
.. code:: Ada
192+
193+
procedure Main is
194+
subtype Small_T is Integer range 1 .. 3;
195+
Big : aliased Integer := 0;
196+
Small : Small_T with Address => Big'Address;
197+
begin
198+
for V in 0 .. 5 loop
199+
Big := V;
200+
Put_Line (Big'Image & " => " & Boolean'Image (Small'Valid));
201+
end loop;
202+
end Main;
203+
204+
.. code::
205+
206+
0 => FALSE
207+
1 => TRUE
208+
2 => TRUE
209+
3 => TRUE
210+
4 => FALSE
211+
5 => FALSE
212+
184213
------------------------
185214
Idiom: Extended Ranges
186215
------------------------

courses/fundamentals_of_ada/050_array_types/02-constrained_array_types.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ Quiz
6363

6464
Explanations
6565

66-
A. Legal - elements are :ada:`Boolean`
66+
A. Legal - components are :ada:`Boolean`
6767
B. Legal - object types match
68-
C. Legal - elements are :ada:`Boolean`
69-
D. Although the sizes are the same and the elements are the same, the type is different
68+
C. Legal - components are :ada:`Boolean`
69+
D. Although the sizes are the same and the components are the same, the type is different
7070

0 commit comments

Comments
 (0)