-- C940015.A
|
-- C940015.A
|
--
|
--
|
-- Grant of Unlimited Rights
|
-- Grant of Unlimited Rights
|
--
|
--
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- unlimited rights in the software and documentation contained herein.
|
-- unlimited rights in the software and documentation contained herein.
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- this public release, the Government intends to confer upon all
|
-- this public release, the Government intends to confer upon all
|
-- recipients unlimited rights equal to those held by the Government.
|
-- recipients unlimited rights equal to those held by the Government.
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- released technical data and computer software in whole or in part, in
|
-- released technical data and computer software in whole or in part, in
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- to do so.
|
-- to do so.
|
--
|
--
|
-- DISCLAIMER
|
-- DISCLAIMER
|
--
|
--
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
--*
|
--*
|
--
|
--
|
-- TEST OBJECTIVE:
|
-- TEST OBJECTIVE:
|
-- Check that the component_declarations of a protected_operation
|
-- Check that the component_declarations of a protected_operation
|
-- are elaborated in the proper order.
|
-- are elaborated in the proper order.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- A discriminated protected object is declared with some
|
-- A discriminated protected object is declared with some
|
-- components that depend upon the discriminant and some that
|
-- components that depend upon the discriminant and some that
|
-- do not depend upon the discriminant. All the components
|
-- do not depend upon the discriminant. All the components
|
-- are initialized with a function call. As a side-effect of
|
-- are initialized with a function call. As a side-effect of
|
-- the function call the parameter passed to the function is
|
-- the function call the parameter passed to the function is
|
-- recorded in an elaboration order array.
|
-- recorded in an elaboration order array.
|
-- Two objects of the protected type are declared. The
|
-- Two objects of the protected type are declared. The
|
-- elaboration order is recorded and checked against the
|
-- elaboration order is recorded and checked against the
|
-- expected order.
|
-- expected order.
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 09 Jan 96 SAIC Initial Version for 2.1
|
-- 09 Jan 96 SAIC Initial Version for 2.1
|
-- 09 Jul 96 SAIC Addressed reviewer comments.
|
-- 09 Jul 96 SAIC Addressed reviewer comments.
|
-- 13 Feb 97 PWB.CTA Removed doomed attempt to check per-object
|
-- 13 Feb 97 PWB.CTA Removed doomed attempt to check per-object
|
-- constraint elaborations.
|
-- constraint elaborations.
|
--!
|
--!
|
|
|
|
|
with Report;
|
with Report;
|
|
|
procedure C940015 is
|
procedure C940015 is
|
Verbose : constant Boolean := False;
|
Verbose : constant Boolean := False;
|
Do_Display : Boolean := Verbose;
|
Do_Display : Boolean := Verbose;
|
|
|
type Index is range 0..10;
|
type Index is range 0..10;
|
|
|
type List is array (1..10) of Integer;
|
type List is array (1..10) of Integer;
|
Last : Natural range 0 .. List'Last := 0;
|
Last : Natural range 0 .. List'Last := 0;
|
E_List : List := (others => 0);
|
E_List : List := (others => 0);
|
|
|
function Elaborate (Id : Integer) return Index is
|
function Elaborate (Id : Integer) return Index is
|
begin
|
begin
|
Last := Last + 1;
|
Last := Last + 1;
|
E_List (Last) := Id;
|
E_List (Last) := Id;
|
if Verbose then
|
if Verbose then
|
Report.Comment ("Elaborating" & Integer'Image (Id));
|
Report.Comment ("Elaborating" & Integer'Image (Id));
|
end if;
|
end if;
|
return Index(Id mod 10);
|
return Index(Id mod 10);
|
end Elaborate;
|
end Elaborate;
|
|
|
function Elaborate (Id, Per_Obj_Expr : Integer) return Index is
|
function Elaborate (Id, Per_Obj_Expr : Integer) return Index is
|
begin
|
begin
|
return Elaborate (Id);
|
return Elaborate (Id);
|
end Elaborate;
|
end Elaborate;
|
|
|
begin
|
begin
|
|
|
Report.Test ("C940015", "Check that the component_declarations of a" &
|
Report.Test ("C940015", "Check that the component_declarations of a" &
|
" protected object are elaborated in the" &
|
" protected object are elaborated in the" &
|
" proper order");
|
" proper order");
|
declare
|
declare
|
-- an unprotected queue type
|
-- an unprotected queue type
|
type Storage is array (Index range <>) of Integer;
|
type Storage is array (Index range <>) of Integer;
|
type Queue (Size, Flag : Index := 1) is
|
type Queue (Size, Flag : Index := 1) is
|
record
|
record
|
Head : Index := 1;
|
Head : Index := 1;
|
Tail : Index := 1;
|
Tail : Index := 1;
|
Count : Index := 0;
|
Count : Index := 0;
|
Buffer : Storage (1..Size);
|
Buffer : Storage (1..Size);
|
end record;
|
end record;
|
|
|
-- protected group of queues type
|
-- protected group of queues type
|
protected type Prot_Queues (Size : Index := Elaborate (104)) is
|
protected type Prot_Queues (Size : Index := Elaborate (104)) is
|
procedure Clear;
|
procedure Clear;
|
-- other needed procedures not provided at this time
|
-- other needed procedures not provided at this time
|
private
|
private
|
-- elaborate at type elaboration
|
-- elaborate at type elaboration
|
Fixed_Queue_1 : Queue (3,
|
Fixed_Queue_1 : Queue (3,
|
Elaborate (105));
|
Elaborate (105));
|
-- elaborate at type elaboration
|
-- elaborate at type elaboration
|
Fixed_Queue_2 : Queue (6,
|
Fixed_Queue_2 : Queue (6,
|
Elaborate (107));
|
Elaborate (107));
|
end Prot_Queues;
|
end Prot_Queues;
|
protected body Prot_Queues is
|
protected body Prot_Queues is
|
procedure Clear is
|
procedure Clear is
|
begin
|
begin
|
Fixed_Queue_1.Count := 0;
|
Fixed_Queue_1.Count := 0;
|
Fixed_Queue_1.Head := 1;
|
Fixed_Queue_1.Head := 1;
|
Fixed_Queue_1.Tail := 1;
|
Fixed_Queue_1.Tail := 1;
|
Fixed_Queue_2.Count := 0;
|
Fixed_Queue_2.Count := 0;
|
Fixed_Queue_2.Head := 1;
|
Fixed_Queue_2.Head := 1;
|
Fixed_Queue_2.Tail := 1;
|
Fixed_Queue_2.Tail := 1;
|
end Clear;
|
end Clear;
|
end Prot_Queues;
|
end Prot_Queues;
|
|
|
PO1 : Prot_Queues(9);
|
PO1 : Prot_Queues(9);
|
PO2 : Prot_Queues;
|
PO2 : Prot_Queues;
|
|
|
Expected_Elab_Order : List := (
|
Expected_Elab_Order : List := (
|
-- from the elaboration of the protected type Prot_Queues
|
-- from the elaboration of the protected type Prot_Queues
|
105, 107,
|
105, 107,
|
-- from the unconstrained object PO2
|
-- from the unconstrained object PO2
|
104,
|
104,
|
others => 0);
|
others => 0);
|
begin
|
begin
|
for I in List'Range loop
|
for I in List'Range loop
|
if E_List (I) /= Expected_Elab_Order (I) then
|
if E_List (I) /= Expected_Elab_Order (I) then
|
Report.Failed ("wrong elaboration order");
|
Report.Failed ("wrong elaboration order");
|
Do_Display := True;
|
Do_Display := True;
|
end if;
|
end if;
|
end loop;
|
end loop;
|
if Do_Display then
|
if Do_Display then
|
Report.Comment ("Expected Actual");
|
Report.Comment ("Expected Actual");
|
for I in List'Range loop
|
for I in List'Range loop
|
Report.Comment (
|
Report.Comment (
|
Integer'Image (Expected_Elab_Order(I)) &
|
Integer'Image (Expected_Elab_Order(I)) &
|
Integer'Image (E_List(I)));
|
Integer'Image (E_List(I)));
|
end loop;
|
end loop;
|
end if;
|
end if;
|
|
|
-- make use of the protected objects
|
-- make use of the protected objects
|
PO1.Clear;
|
PO1.Clear;
|
PO2.Clear;
|
PO2.Clear;
|
end;
|
end;
|
|
|
Report.Result;
|
Report.Result;
|
|
|
end C940015;
|
end C940015;
|
|
|