-- $Date: 2004/01/25 09:17:19 $
-- $Revision: 1.1 $
-- $Author: jcrocholl $

with Readers; use Readers;
with Token_Readers; use Token_Readers;

-- Light-weight line input file readers.
package Line_Readers is

   -- Light-weight line input file reader.
   type Line_Reader is
     new Token_Reader with null record;

   -- Type for instance variables.
   type Line_Reader_Access is access Line_Reader;

   -------------------------------------------
   -- Internal initialization and finalization
   -------------------------------------------

   -- These don't need to be called directly because the functions
   -- Current_Input, Open and Close will do it for you.

   -- Initialize a newly created reader instance.
   procedure Initialize_Line_Reader
     (This : access Line_Reader'Class);

   -- Initialize a newly created reader instance with a file to read.
   procedure Initialize_Line_Reader
     (This     : access Line_Reader'Class;
      Filename : in String); -- Open this file for reading.

   -- Close the input file.
   procedure Finalize_Line_Reader
     (This : access Line_Reader'Class); -- Object instance.

   -------------------
   -- Creating readers
   -------------------

   -- Create an Line reader for current input (stdin).
   function Current_Input
     return Line_Reader_Access-- The newly created Line reader instance.

   -- Create an Line reader for file input.
   function Open
     (Filename : in String)     -- Open this file.
     return Line_Reader_Access-- The newly created Line reader instance.

   -- Close an Line reader's input file.
   procedure Close
     (This : in out Line_Reader_Access); -- Close this Line reader.

   ----------------
   -- Reading lines
   ----------------

   -- Skip over the rest of the line. Return false if end of file was
   -- found.
   function Next_Line
     (This : access Line_Reader'Class)
     return Boolean-- End of file?

   -- Return the current line, from cursor to the line break, which is
   -- not included.
   function Rest_Of_Line
     (This : access Line_Reader'Class)
     return String-- The rest of the current line.

end Line_Readers;