Index: src/natools-s_expressions-generic_caches.adb ================================================================== --- src/natools-s_expressions-generic_caches.adb +++ src/natools-s_expressions-generic_caches.adb @@ -179,10 +179,23 @@ end Dup_Tree; begin return Reference'(Exp => Trees.Create (Dup_Tree'Access)); end Duplicate; + + function Move (Source : in out S_Expressions.Descriptor'Class) + return Reference + is + Result : Reference; + begin + Printers.Transfer + (Source => Source, + Target => Result, + Check_Level => True); + return Result; + end Move; + ----------------------- -- Printer Interface -- ----------------------- Index: src/natools-s_expressions-generic_caches.ads ================================================================== --- src/natools-s_expressions-generic_caches.ads +++ src/natools-s_expressions-generic_caches.ads @@ -53,10 +53,14 @@ overriding procedure Close_List (Output : in out Reference); function Duplicate (Cache : Reference) return Reference; -- Create a new copy of the S-expression held in Cache and return it + function Move (Source : in out S_Expressions.Descriptor'Class) + return Reference; + -- Build a new cache by (destructively) reading Original + type Cursor is new Lockable.Descriptor and Replayable.Descriptor with private; pragma Preelaborable_Initialization (Cursor); @@ -84,10 +88,15 @@ overriding function Duplicate (Object : Cursor) return Cursor; function First (Cache : Reference'Class) return Cursor; -- Create a new Cursor pointing at the beginning of Cache + + function Move (Source : in out S_Expressions.Descriptor'Class) return Cursor + is (Move (Source).First); + -- Return a cursor holding a copy of Original (which is + -- destructively read) private type Atom_Access is access Atom; for Atom_Access'Storage_Pool use Atom_Pool;