-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathempire-lists.adb
37 lines (33 loc) · 965 Bytes
/
empire-lists.adb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package body Empire.Lists is
procedure Link
(Head : in out Piece_Info_P;
Obj : in Piece_Info_P;
List : in Link_Type_T)
is
begin
Obj.Links (List).Prev := null;
Obj.Links (List).Next := Head;
if Head /= null then
Head.Links (List).Prev := Obj;
end if;
Head := Obj;
end Link;
procedure Unlink
(Head : in out Piece_Info_P;
Obj : in Piece_Info_P;
List : in Link_Type_T)
is
begin
if Obj.Links (List).Next /= null then
Obj.Links (List).Next.Links (List).Prev := Obj.Links (List).Prev;
end if;
if Obj.Links (List).Prev /= null then
Obj.Links (List).Prev.Links (List).Next := Obj.Links (List).Next;
else
Head := Obj.Links (List).Next;
end if;
-- make it harder for errors to stay hidden
Obj.Links (List).Next := null;
Obj.Links (List).Prev := null;
end Unlink;
end Empire.Lists;