-- Programmed by Jedidiah Barber -- Licensed under the Sunset License v1.0 -- See license.txt for further details private with Ada.Containers.Vectors, Ada.Finalization; generic Relation : in Goal; Within : in State; 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 Goal_Access is access all Goal; type Constant_Goal_Access is access constant Goal; type Graph_Access is access all Goal_Graph; type Constant_Graph_Access is access constant Goal_Graph; type Eval_Data (Kind : Node_Kind := Unify_Node) is record case Kind is when Unify_Node => Uni_Offset : Long_Natural := 0; 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_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_Node => Rec_Next : Long_Positive := 1; Rec_Gone : Boolean := False; Rec_Cache : Boolean := True; end case; end record; type Cached_State is record Used : Positive := 1; Data : State_Access := null; end record; package State_Vectors is new Ada.Containers.Vectors (Index_Type => Long_Positive, Element_Type => Cached_State); type Cache_Entry is record 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 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; type Collector_Final_Controller is new Ada.Finalization.Limited_Controlled with null record; overriding procedure Finalize (This : in out Collector_Final_Controller); Cleanup : Collector_Final_Controller; end Kompsos.Collector;