aboutsummaryrefslogtreecommitdiff
path: root/src/kompsos.ads
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2026-01-22 16:41:39 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2026-01-22 16:41:39 +1300
commit28d132c2823d7dfa21190bf746f9f39dd59a40d8 (patch)
treeb0d1e26b2fadffa43bca2300dc273d8991c77df4 /src/kompsos.ads
parent42e3c2fa30552a227e38f03b859f03ae51f9000d (diff)
States are now custom linked lists
Diffstat (limited to 'src/kompsos.ads')
-rw-r--r--src/kompsos.ads32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/kompsos.ads b/src/kompsos.ads
index 66ebfd5..d1e19be 100644
--- a/src/kompsos.ads
+++ b/src/kompsos.ads
@@ -9,7 +9,6 @@
private with
Ada.Containers.Indefinite_Holders,
- Ada.Containers.Vectors,
Ada.Finalization;
@@ -460,26 +459,41 @@ private
- type Binding is record
- Key : Variable;
- Elem : Term;
+ type State_Component is limited record
+ Counter : Natural;
+ Key : Variable;
+ Value : Term;
+ Next : aliased State;
end record;
- package Binding_Vectors is new Ada.Containers.Vectors
- (Index_Type => Long_Positive,
- Element_Type => Binding);
+ type State_Component_Access is access State_Component;
+
+ type State_Control is new Ada.Finalization.Controlled with record
+ Actual : State_Component_Access := null;
+ end record;
+
+ overriding procedure Initialize
+ (This : in out State_Control);
+
+ overriding procedure Adjust
+ (This : in out State_Control);
+
+ overriding procedure Finalize
+ (This : in out State_Control);
type State is record
- Actual : Binding_Vectors.Vector;
+ Ctrl : State_Control := (Ada.Finalization.Controlled with Actual => null);
end record;
+ type State_Access is access State;
+
function Lookup
(This : in State;
Key : in Variable;
Value : out Term'Class)
return Boolean;
- Empty_State : constant State := (Actual => Binding_Vectors.Empty_Vector);
+ Empty_State : constant State := (Ctrl => (Ada.Finalization.Controlled with Actual => null));