1-- C64202A.ADA
2
3--                             Grant of Unlimited Rights
4--
5--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7--     unlimited rights in the software and documentation contained herein.
8--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making
9--     this public release, the Government intends to confer upon all
10--     recipients unlimited rights  equal to those held by the Government.
11--     These rights include rights to use, duplicate, release or disclose the
12--     released technical data and computer software in whole or in part, in
13--     any manner and for any purpose whatsoever, and to have or permit others
14--     to do so.
15--
16--                                    DISCLAIMER
17--
18--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23--     PARTICULAR PURPOSE OF SAID MATERIAL.
24--*
25-- CHECK THAT THE DEFAULT EXPRESSIONS OF FORMAL PARAMETERS ARE EVALUATED
26-- EACH TIME THEY ARE NEEDED.
27
28-- SPS 2/22/84
29
30WITH REPORT; USE REPORT;
31PROCEDURE C64202A IS
32BEGIN
33
34     TEST ("C64202A", "CHECK THAT THE DEFAULT EXPRESSION IS EVALUATED" &
35           " EACH TIME IT IS NEEDED");
36
37     DECLARE
38          X : INTEGER := 1;
39          FUNCTION F RETURN INTEGER IS
40          BEGIN
41               X := X + 1;
42               RETURN X;
43          END F;
44
45          PROCEDURE P (CALL : POSITIVE; X, Y : INTEGER := F) IS
46          BEGIN
47               IF CALL = 1 THEN
48                    IF X = Y OR Y /= 2 THEN
49                         FAILED ("DEFAULT NOT EVALUATED CORRECTLY - 1" &
50                                 " X =" & INTEGER'IMAGE(X) & " Y =" &
51                                 INTEGER'IMAGE(Y));
52                    END IF;
53               ELSIF CALL = 2 THEN
54                    IF X = Y OR
55                       NOT ((X = 3 AND Y = 4) OR (X = 4 AND Y = 3)) THEN
56                         FAILED ("DEFAULT NOT EVALUATED CORRECTLY - 2" &
57                                 " X =" & INTEGER'IMAGE(X) & " Y =" &
58                                 INTEGER'IMAGE(Y));
59                    END IF;
60               END IF;
61          END P;
62
63     BEGIN
64          COMMENT ("FIRST CALL");
65          P (1, 3);
66          COMMENT ("SECOND CALL");
67          P(2);
68     END;
69
70     RESULT;
71
72END C64202A;
73