-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsilo.adb
58 lines (43 loc) · 1.57 KB
/
silo.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
with Ada.Containers.Doubly_Linked_Lists;
package body Silo is
use Ada.Containers;
package Label_Container is new Doubly_Linked_Lists (Label_Data);
type Label_List is new Label_Container.List with null record;
theStack : Label_List;
procedure Push (Data : Label_Data) is
begin
Append (theStack, Data);
end Push;
-- -----------------------------------------------------------------
function Pull return Label_Data is
Data : Label_Data;
begin
if Is_Empty (theStack) then
raise Empty_Stack;
end if;
Data := First_Element (theStack);
Delete_First (theStack);
return Data;
end Pull;
-- -----------------------------------------------------------------
function Set_Data (Label_String : Unbounded_String;
Label_Position : GL.Types.Singles.Vector2)
return Label_Data is
begin
return (Label_String, Label_Position);
end Set_Data;
-- -----------------------------------------------------------------
procedure Get_Data (Label_String : out Unbounded_String;
Label_Position : out GL.Types.Singles.Vector2) is
theData : Label_Data := Pull;
begin
Label_String:= theData.Label_String;
Label_Position := theData.Label_Position;
end Get_Data;
-- -----------------------------------------------------------------
function Size return Integer is
begin
return Integer (Length (theStack));
end Size;
-- -----------------------------------------------------------------
end Silo;