diff options
Diffstat (limited to 'src/kompsos.ads')
| -rw-r--r-- | src/kompsos.ads | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/kompsos.ads b/src/kompsos.ads index 0f2c0e6..0483fa1 100644 --- a/src/kompsos.ads +++ b/src/kompsos.ads @@ -14,7 +14,8 @@ private with Ada.Containers.Indefinite_Holders, Ada.Containers.Ordered_Maps, - Ada.Containers.Vectors; + Ada.Containers.Vectors, + Ada.Finalization; generic @@ -485,14 +486,15 @@ private - type Term_Root is abstract tagged null record; + type Term_Component; - package Term_Holders is new Ada.Containers.Indefinite_Holders (Term_Root'Class); + type Term_Component_Access is access Term_Component; - type Term_Component (Kind : Term_Kind) is new Term_Root with record + subtype Non_Null_Term_Kind is Term_Kind range Atom_Term .. Pair_Term; + + type Term_Component (Kind : Non_Null_Term_Kind) is limited record + Counter : Natural; case Kind is - when Null_Term => - null; when Atom_Term => Value : Element_Type; when Var_Term => @@ -502,10 +504,19 @@ private end case; end record; - type Term is tagged record - Actual : Term_Holders.Holder; + type Term is new Ada.Finalization.Controlled with record + Actual : Term_Component_Access := null; end record; + overriding procedure Initialize + (This : in out Term); + + overriding procedure Adjust + (This : in out Term); + + overriding procedure Finalize + (This : in out Term); + function T (Item : in Variable) return Term'Class; @@ -515,8 +526,7 @@ private return Variable with Pre => This.Kind = Var_Term; - Empty_Term : constant Term := - (Actual => Term_Holders.To_Holder (Term_Component'(Kind => Null_Term))); + Empty_Term : constant Term := (Ada.Finalization.Controlled with Actual => null); package Term_Array_Holders is new Ada.Containers.Indefinite_Holders (Term_Array); |
