with Byte_Defs;

pragma Private_Eyes_Only;
with Device_Independent_Io;
with Directory;

package File_Io is

    type Iterator is limited private;

    procedure Resolve (Iter : in out Iterator; Name : String);
    function Done (Iter : Iterator) return Boolean;
    function Value (Iter : Iterator) return String;
    procedure Next (Iter : in out Iterator);

    type File_Type is limited private;
    type File_Mode is (Read, Create, Overwrite, Append);
    type File_Kind is (Text, Binary);

    procedure Open (File : in out File_Type;
                    Name : String;
                    Mode : File_Mode := Read;
                    Kind : File_Kind := Text);

    procedure Close (File : in out File_Type);

    function Is_Open (File : File_Type) return Boolean;

    function Name (File : File_Type) return String;

    function To_Normal_Form (Name : String) return String;
    function To_Local_Form (Name : String) return String;
    -- The normal form of a name contains no pathname or attributes,
    -- and has the form "name.type".  The local form is defined by
    -- the local file system.

    procedure Write (File : in out File_Type; Data : Byte_Defs.Byte_String);

    procedure Read (File : in out File_Type;
                    Data : out Byte_Defs.Byte_String;
                    Count : out Natural);

    procedure Delete (File : in out File_Type);

private  
    type Iterator is new Directory.Naming.Iterator;
    type Buffer_Type is (Nil, Cr_No_Lf, Crlf, Eof);
    type File_Type is
        record
            Mode : File_Mode;
            Kind : File_Kind;
            Buffer : Buffer_Type;
            File : Device_Independent_Io.File_Type;
        end record;
end File_Io;