blob: 4bca3b4de6f0fae80237d0d6503d81adef8d2387 (
plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
-- Programmed by Jedidiah Barber
-- Licensed under the Sunset License v1.0
-- See license.txt for further details
private with
Ada.Containers.Ordered_Maps,
Ada.Containers.Vectors,
Ada.Finalization;
generic
Source : in World;
package Kompsos.Collector is
State_Not_Found_Error : exception;
function Has_Next
return Boolean;
function Next
return State;
function Next
(Default : in State)
return State;
procedure Reset;
private
type World_Access is access all World;
type Constant_World_Access is access constant World;
function "<"
(Left, Right : in World_Component_Access)
return Boolean;
type Eval_Kind is
(Unify_Data,
Disjunct_Data,
Conjunct_Data,
Recurse_Data);
type Eval_Data (Kind : Eval_Kind := Unify_Data) is record
case Kind is
when Unify_Data =>
Uni_Offset : Long_Natural := 0;
when Disjunct_Data =>
Dis_Flag : Boolean := True;
Dis_Next1 : Long_Positive := 1;
Dis_Next2 : Long_Positive := 1;
Dis_Gone1 : Boolean := False;
Dis_Gone2 : Boolean := False;
when Conjunct_Data =>
Con_Part : World_Access := null;
Con_From : Long_Positive := 1;
Con_Next : Long_Positive := 1;
Con_Gone : Boolean := False;
when Recurse_Data =>
Rec_Next : Long_Positive := 1;
Rec_Gone : Boolean := False;
end case;
end record;
package Eval_Maps is new Ada.Containers.Ordered_Maps
(Key_Type => World_Component_Access,
Element_Type => Eval_Data);
type Managed_Map is new Ada.Finalization.Controlled with record
Actual : Eval_Maps.Map;
end record;
overriding procedure Finalize
(This : in out Managed_Map);
package Cache_Maps is new Ada.Containers.Ordered_Maps
(Key_Type => World_Component_Access,
Element_Type => State_Vectors.Vector,
"=" => State_Vectors."=");
end Kompsos.Collector;
|