Index: src/natools-s_expressions-file_readers.adb ================================================================== --- src/natools-s_expressions-file_readers.adb +++ src/natools-s_expressions-file_readers.adb @@ -111,10 +111,23 @@ Stream_IO.Read (Object.File, Result, Last); pragma Assert (Last = Result'Last); return Result; end Read; + + function Read (Object : Atom_Reader) return Atom_Refs.Reference is + Length : constant Count := Object.Length; + Result : constant Atom_Refs.Reference + := Atom_Refs.Create (new Atom (1 .. Length)); + Last : Count; + begin + Stream_IO.Set_Index (Object.File, 1); + Stream_IO.Read (Object.File, Result.Update.Data.all, Last); + pragma Assert (Last = Length); + return Result; + end Read; + procedure Read (Object : in Atom_Reader; Data : out Atom; Length : out Count) is Index: src/natools-s_expressions-file_readers.ads ================================================================== --- src/natools-s_expressions-file_readers.ads +++ src/natools-s_expressions-file_readers.ads @@ -19,10 +19,11 @@ -- on disk (using Stream_IO) and expose their data as S-expressions or as -- -- atoms. -- ------------------------------------------------------------------------------ with Natools.S_Expressions.Atom_Buffers; +with Natools.S_Expressions.Atom_Refs; with Natools.S_Expressions.Lockable; private with Ada.Finalization; private with Ada.Streams.Stream_IO; private with Natools.S_Expressions.Parsers; @@ -55,10 +56,13 @@ -- Return the file length function Read (Object : Atom_Reader) return Atom; -- Read the whole file and return it as a single atom + function Read (Object : Atom_Reader) return Atom_Refs.Reference; + -- Read the whole file to memory and return a reference to the data + procedure Read (Object : in Atom_Reader; Data : out Atom; Length : out Count); -- Read the whole file and store it in Data, along with its Length.