Add calling of a subprograms (soubroutines) to the Ada test program.

This commit is contained in:
Ernie Pasveer
2023-05-08 20:44:46 -05:00
parent eddb4406e9
commit d13a5af72a
5 changed files with 61 additions and 1 deletions
+38
View File
@@ -2,6 +2,7 @@ with Text_IO; use Text_IO;
with System;
with System.Address_Image;
with System.Address_To_Access_Conversions;
with Increment_By;
procedure HelloAda is
@@ -23,6 +24,9 @@ procedure HelloAda is
My_Float_Array_Access : Float_Array_Access_T;
My_Float_Array_Obj_Ptr : Conversions.Object_Pointer;
-- some increment variables.
A, B, C : Integer;
begin
-- Fill My_Float_Array with data
for i in 0 .. 64 loop
@@ -36,5 +40,39 @@ begin
Put_Line(System.Address_Image(My_Float_Array_Address));
Put_Line(Float'Image(My_Float_Array(3)));
C := Increment_By;
-- ^ Parameterless call,
-- value of I is 0
-- and Incr is 1
Put_Line ("Using defaults for Increment_By is "
& Integer'Image (C));
A := 10;
B := 3;
C := Increment_By (A, B);
-- ^ Regular parameter passing
Put_Line ("Increment of "
& Integer'Image (A)
& " with "
& Integer'Image (B)
& " is "
& Integer'Image (C));
A := 20;
B := 5;
C := Increment_By (I => A,
Incr => B);
-- ^ Named parameter passing
Put_Line ("Increment of "
& Integer'Image (A)
& " with "
& Integer'Image (B)
& " is "
& Integer'Image (C));
end HelloAda;