aboutsummaryrefslogtreecommitdiff
path: root/src/kompsos.ads
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2026-01-17 22:13:19 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2026-01-17 22:13:19 +1300
commitab0154499e1b0ad8c3f104bc8a1d8ea7f1fb4a5c (patch)
treee3ed8438d14e92c03b193693a6492db229f5e33d /src/kompsos.ads
parent52d24305fe9a5f47270b713708664d4968f75fed (diff)
Counter for next available Variable now held by each Goal instead of being global
Diffstat (limited to 'src/kompsos.ads')
-rw-r--r--src/kompsos.ads49
1 files changed, 28 insertions, 21 deletions
diff --git a/src/kompsos.ads b/src/kompsos.ads
index 32cfc24..9ab7994 100644
--- a/src/kompsos.ads
+++ b/src/kompsos.ads
@@ -475,14 +475,27 @@ private
- type Goal_Component;
+ type Graph_Component;
- type Goal_Component_Access is access Goal_Component;
+ type Graph_Component_Access is access Graph_Component;
function "<"
- (Left, Right : in Goal_Component_Access)
+ (Left, Right : in Graph_Component_Access)
return Boolean;
+ type Goal_Graph is new Ada.Finalization.Controlled with record
+ Actual : Graph_Component_Access := null;
+ end record;
+
+ overriding procedure Initialize
+ (This : in out Goal_Graph);
+
+ overriding procedure Adjust
+ (This : in out Goal_Graph);
+
+ overriding procedure Finalize
+ (This : in out Goal_Graph);
+
type Lazy_Kind is (Zero_Arg, One_Arg, Many_Arg);
type Lazy_Data (Kind : Lazy_Kind) is record
@@ -506,38 +519,32 @@ private
Conjunct_Node,
Recurse_Node);
- type Goal_Component (Kind : Node_Kind) is limited record
+ type Graph_Component (Kind : Node_Kind) is limited record
Counter : Natural;
case Kind is
when Unify_Node =>
- Uni_Goal : aliased Goal;
+ Uni_Goal : aliased Goal_Graph;
Uni_Term1 : Term;
Uni_Term2 : Term;
when Disjunct_Node =>
- Dis_Goal1 : aliased Goal;
- Dis_Goal2 : aliased Goal;
+ Dis_Goal1 : aliased Goal_Graph;
+ Dis_Goal2 : aliased Goal_Graph;
when Conjunct_Node =>
- Con_Goal : aliased Goal;
+ Con_Goal : aliased Goal_Graph;
Con_Data : Lazy_Holders.Holder;
when Recurse_Node =>
- Rec_Goal : aliased Goal;
+ Rec_Goal : aliased Goal_Graph;
end case;
end record;
- type Goal is new Ada.Finalization.Controlled with record
- Actual : Goal_Component_Access := null;
+ type Goal is tagged record
+ Graph : aliased Goal_Graph := (Ada.Finalization.Controlled with Actual => null);
+ Next_Var : Variable := Variable'First;
end record;
- overriding procedure Initialize
- (This : in out Goal);
-
- overriding procedure Adjust
- (This : in out Goal);
-
- overriding procedure Finalize
- (This : in out Goal);
-
- Empty_Goal : constant Goal := (Ada.Finalization.Controlled with Actual => null);
+ Empty_Goal : constant Goal :=
+ (Graph => (Ada.Finalization.Controlled with Actual => null),
+ Next_Var => Variable'First);
end Kompsos;