OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [support/] [fc70b00.a] - Blame information for rev 294

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- FC70B00.A
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
--
26
-- FOUNDATION DESCRIPTION:
27
--      This foundation defines a generic list abstraction. List elements can
28
--      be of any (nonlimited) type. Lists are implemented as singly linked
29
--      lists. Access to list elements is sequential. For each list, pointers
30
--      are maintained to the first and last elements in the list, as well as
31
--      the next element to be accessed.
32
--
33
-- CHANGE HISTORY:
34
--      06 Dec 94   SAIC    ACVC 2.0
35
--
36
--!
37
 
38
generic                           -- List abstraction.
39
   type Element_Type is private;  -- List elems can be of any nonlimited type.
40
package FC70B00 is
41
 
42
   type List_Type is limited private;
43
 
44
   -- Return true if current element is last in the list.
45
   function End_Of_List (L : List_Type) return Boolean;
46
 
47
   -- Read current element value; do NOT advance "current" pointer.
48
   procedure View_Element (L : in List_Type; E : out Element_Type);
49
 
50
   -- Read from current element and advance "current" pointer.
51
   procedure Read_Element (L : in out List_Type; E : out Element_Type);
52
 
53
   -- Write to current element and advance "current" pointer.
54
   procedure Write_Element (L : in out List_Type; E : in Element_Type);
55
 
56
   -- Add element to end of list.
57
   procedure Add_Element (L : in out List_Type; E : in Element_Type);
58
 
59
   -- Set "current" pointer to first list element.
60
   procedure Reset (L : in out List_Type);
61
 
62
private
63
 
64
   type Node_Type;
65
   type Node_Pointer is access Node_Type;
66
 
67
   type Node_Type is record
68
      Item : Element_Type;
69
      Next : Node_Pointer;
70
   end record;
71
 
72
   type List_Type is record
73
      First   : Node_Pointer;
74
      Current : Node_Pointer;
75
      Last    : Node_Pointer;
76
   end record;
77
 
78
end FC70B00;
79
 
80
 
81
     --==================================================================--
82
 
83
 
84
package body FC70B00 is
85
 
86
   function End_Of_List (L : List_Type) return Boolean is
87
   begin
88
      return (L.Current = null);
89
   end End_Of_List;
90
 
91
 
92
   procedure View_Element (L : in List_Type; E : out Element_Type) is
93
   begin
94
      -- ... Error-checking code omitted for brevity.
95
      E := L.Current.Item;               -- Retrieve current element.
96
   end View_Element;
97
 
98
 
99
   procedure Read_Element (L : in out List_Type; E : out Element_Type) is
100
   begin
101
      -- ... Error-checking code omitted for brevity.
102
      E         := L.Current.Item;       -- Retrieve current element.
103
      L.Current := L.Current.Next;       -- Advance "current" pointer.
104
   end Read_Element;
105
 
106
 
107
   procedure Write_Element (L : in out List_Type; E : in Element_Type) is
108
   begin
109
      -- ... Error-checking code omitted for brevity.
110
      L.Current.Item := E;               -- Write to current element.
111
      L.Current      := L.Current.Next;  -- Advance "current" pointer.
112
   end Write_Element;
113
 
114
 
115
   procedure Add_Element (L : in out List_Type; E : in Element_Type) is
116
      New_Node : Node_Pointer := new Node_Type'(E, null);
117
   begin
118
      if L.First = null then             -- No elements in list, so add new
119
         L.First := New_Node;            -- element at beginning of list.
120
      else
121
         L.Last.Next := New_Node;        -- Add new element at end of list.
122
      end if;
123
      L.Last := New_Node;                -- Set last-in-list pointer.
124
   end Add_Element;
125
 
126
 
127
   procedure Reset (L : in out List_Type) is
128
   begin
129
      L.Current := L.First;              -- Set "current" pointer to first
130
   end Reset;                            -- list element.
131
 
132
 
133
end FC70B00;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.