Author(s): Raphaƫl Amiard, Gustavo A. Hoffmann
Publisher: AdaCore
Year: 2022
Language: English
Pages: 249
Introduction
History
Ada today
Philosophy
SPARK
Imperative language
Hello world
Imperative language - If/Then/Else
Imperative language - Loops
For loops
Bare loops
While loops
Imperative language - Case statement
Imperative language - Declarative regions
Imperative language - conditional expressions
If expressions
Case expressions
Subprograms
Subprograms
Subprogram calls
Nested subprograms
Function calls
Parameter modes
Subprogram calls
In parameters
In out parameters
Out parameters
Forward declaration of subprograms
Renaming
Modular programming
Packages
Using a package
Package body
Child packages
Child of a child package
Multiple children
Visibility
Renaming
Strongly typed language
What is a type?
Integers
Operational semantics
Unsigned types
Enumerations
Floating-point types
Basic properties
Precision of floating-point types
Range of floating-point types
Strong typing
Derived types
Subtypes
Subtypes as type aliases
Records
Record type declaration
Aggregates
Component selection
Renaming
Arrays
Array type declaration
Indexing
Simpler array declarations
Range attribute
Unconstrained arrays
Predefined array type: String
Restrictions
Returning unconstrained arrays
Declaring arrays (2)
Array slices
Renaming
More about types
Aggregates: A primer
Overloading and qualified expressions
Access types (pointers)
Allocation (by type)
Dereferencing
Other features
Mutually recursive types
More about records
Dynamically sized record types
Records with discriminant
Variant records
Fixed-point types
Decimal fixed-point types
Fixed-point types
Character types
Privacy
Basic encapsulation
Abstract data types
Limited types
Child packages & privacy
Generics
Introduction
Formal type declaration
Formal object declaration
Generic body definition
Generic instantiation
Generic packages
Formal subprograms
Example: I/O instances
Example: ADTs
Example: Swap
Example: Reversing
Example: Test application
Exceptions
Exception declaration
Raising an exception
Handling an exception
Predefined exceptions
Tasking
Tasks
Simple task
Simple synchronization
Delay
Synchronization: rendez-vous
Select loop
Cycling tasks
Protected objects
Simple object
Entries
Task and protected types
Task types
Protected types
Design by contracts
Pre- and postconditions
Predicates
Type invariants
Interfacing with C
Multi-language project
Type convention
Foreign subprograms
Calling C subprograms in Ada
Calling Ada subprograms in C
Foreign variables
Using C global variables in Ada
Using Ada variables in C
Generating bindings
Adapting bindings
Object-oriented programming
Derived types
Tagged types
Classwide types
Dispatching operations
Dot notation
Private & Limited
Classwide access types
Standard library: Containers
Vectors
Instantiation
Initialization
Appending and prepending elements
Accessing first and last elements
Iterating
Finding and changing elements
Inserting elements
Removing elements
Other Operations
Sets
Initialization and iteration
Operations on elements
Other Operations
Indefinite maps
Hashed maps
Ordered maps
Complexity
Standard library: Dates & Times
Date and time handling
Delaying using date
Real-time
Benchmarking
Standard library: Strings
String operations
Limitation of fixed-length strings
Bounded strings
Unbounded strings
Standard library: Files and streams
Text I/O
Sequential I/O
Direct I/O
Stream I/O
Standard library: Numerics
Elementary Functions
Random Number Generation
Complex Types
Vector and Matrix Manipulation
Appendices
Appendix A: Generic Formal Types
Indefinite version
Appendix B: Containers