aboutsummaryrefslogtreecommitdiff
path: root/src/kompsos-collector.ads
diff options
context:
space:
mode:
Diffstat (limited to 'src/kompsos-collector.ads')
-rw-r--r--src/kompsos-collector.ads78
1 files changed, 53 insertions, 25 deletions
diff --git a/src/kompsos-collector.ads b/src/kompsos-collector.ads
index d352fa3..c1ea8bc 100644
--- a/src/kompsos-collector.ads
+++ b/src/kompsos-collector.ads
@@ -8,7 +8,6 @@
private with
- Ada.Containers.Ordered_Maps,
Ada.Containers.Vectors,
Ada.Finalization;
@@ -48,46 +47,34 @@ private
- type Eval_Kind is
- (Unify_Data,
- Disjunct_Data,
- Conjunct_Data,
- Recurse_Data);
-
- type Eval_Data (Kind : Eval_Kind := Unify_Data) is record
+ type Eval_Data (Kind : Node_Kind := Unify_Node) is record
case Kind is
- when Unify_Data =>
+ when Unify_Node =>
Uni_Offset : Long_Natural := 0;
- when Disjunct_Data =>
+ when Disjunct_Node =>
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 =>
+ when Conjunct_Node =>
Con_From : Long_Positive := 1;
Con_Base : State_Access := null;
Con_Part : Goal_Access := null;
Con_Next : Long_Positive := 1;
Con_Gone : Boolean := False;
- when Recurse_Data =>
+ when Recurse_Node =>
Rec_Next : Long_Positive := 1;
Rec_Gone : Boolean := False;
Rec_Cache : Boolean := True;
end case;
end record;
- package Eval_Maps is new Ada.Containers.Ordered_Maps
- (Key_Type => Graph_Component_Access,
- Element_Type => Eval_Data);
-
-
- subtype Short_Positive is Short_Integer range 1 .. Short_Integer'Last;
type Cached_State is record
- Used : Short_Positive;
- Data : State_Access;
+ Used : Positive := 1;
+ Data : State_Access := null;
end record;
package State_Vectors is new Ada.Containers.Vectors
@@ -95,13 +82,54 @@ private
Element_Type => Cached_State);
type Cache_Entry is record
- Keep : Boolean;
- Data : State_Vectors.Vector;
+ Keep : Boolean := False;
+ Data : State_Vectors.Vector := State_Vectors.Empty_Vector;
+ end record;
+
+ type Cache_Entry_Access is access Cache_Entry;
+
+
+
+ type Book_Node;
+
+ type Book_Node_Access is access Book_Node;
+
+ type Book_Node is record
+ Data : Eval_Data;
+ Cache : Cache_Entry_Access := null;
+ Next1 : Book_Node_Access := null;
+ Next2 : Book_Node_Access := null;
+ end record;
+
+
+
+ type Loose_Book is record
+ Used : Positive := 1;
+ Ptr : Graph_Component_Access := null;
+ Book : Book_Node_Access := null;
end record;
- package Cache_Maps is new Ada.Containers.Ordered_Maps
- (Key_Type => Graph_Component_Access,
- Element_Type => Cache_Entry);
+ package Loose_Book_Vectors is new Ada.Containers.Vectors
+ (Index_Type => Long_Positive,
+ Element_Type => Loose_Book);
+
+ package Book_Node_Vectors is new Ada.Containers.Vectors
+ (Index_Type => Long_Positive,
+ Element_Type => Book_Node_Access);
+
+
+
+ procedure Reset
+ (Ptr : in Graph_Component_Access;
+ Book : in out Book_Node_Access);
+
+ function Get_Next
+ (Ptr : in Constant_Graph_Access;
+ Book : in out Book_Node_Access;
+ Base : in State;
+ Index : in Long_Positive;
+ Result : out State)
+ return Boolean;