mirror of
https://github.com/epasveer/seer.git
synced 2026-08-30 09:00:42 +08:00
Add calling of a subprograms (soubroutines) to the Ada test program.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user