From 28d132c2823d7dfa21190bf746f9f39dd59a40d8 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Thu, 22 Jan 2026 16:41:39 +1300 Subject: States are now custom linked lists --- src/kompsos.ads | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'src/kompsos.ads') 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)); -- cgit