home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gnat-2.06-src.tgz / tar.out / fsf / gnat / ada / a-sequio.ads < prev    next >
Text File  |  1996-09-28  |  4KB  |  107 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --                    A D A . S E Q U E N T I A L _ I O                     --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.8 $                              --
  10. --                                                                          --
  11. -- This specification is adapted from the Ada Reference Manual for use with --
  12. -- GNAT.  In accordance with the copyright of that document, you can freely --
  13. -- copy and modify this specification,  provided that if you redistribute a --
  14. -- modified version,  any changes that you have made are clearly indicated. --
  15. --                                                                          --
  16. ------------------------------------------------------------------------------
  17.  
  18.  
  19. with Ada.IO_Exceptions;
  20. with System.Sequential_IO;
  21.  
  22. generic
  23.    type Element_Type (<>) is private;
  24.  
  25. package Ada.Sequential_IO is
  26.  
  27.    type File_Type is limited private;
  28.  
  29.    type File_Mode is (In_File, Out_File, Append_File);
  30.  
  31.    ---------------------
  32.    -- File management --
  33.    ---------------------
  34.  
  35.    procedure Create
  36.      (File : in out File_Type;
  37.       Mode : in File_Mode := Out_File;
  38.       Name : in String := "";
  39.       Form : in String := "");
  40.  
  41.    procedure Open
  42.      (File : in out File_Type;
  43.       Mode : in File_Mode;
  44.       Name : in String;
  45.       Form : in String := "");
  46.  
  47.    procedure Close  (File : in out File_Type);
  48.    procedure Delete (File : in out File_Type);
  49.    procedure Reset  (File : in out File_Type; Mode : in File_Mode);
  50.    procedure Reset  (File : in out File_Type);
  51.  
  52.    function Mode    (File : in File_Type) return File_Mode;
  53.    function Name    (File : in File_Type) return String;
  54.    function Form    (File : in File_Type) return String;
  55.  
  56.    function Is_Open (File : in File_Type) return Boolean;
  57.  
  58.    ---------------------------------
  59.    -- Input and output operations --
  60.    ---------------------------------
  61.  
  62.    procedure Read  (File : in File_Type; Item : out Element_Type);
  63.    procedure Write (File : in File_Type; Item : in Element_Type);
  64.  
  65.    function End_Of_File (File : in File_Type) return Boolean;
  66.  
  67.    ----------------
  68.    -- Exceptions --
  69.    ----------------
  70.  
  71.    Status_Error : exception renames IO_Exceptions.Status_Error;
  72.    Mode_Error   : exception renames IO_Exceptions.Mode_Error;
  73.    Name_Error   : exception renames IO_Exceptions.Name_Error;
  74.    Use_Error    : exception renames IO_Exceptions.Use_Error;
  75.    Device_Error : exception renames IO_Exceptions.Device_Error;
  76.    End_Error    : exception renames IO_Exceptions.End_Error;
  77.    Data_Error   : exception renames IO_Exceptions.Data_Error;
  78.  
  79. private
  80.    type File_Type is new System.Sequential_IO.File_Type;
  81.  
  82.    --  The following representation clause allows the use of unchecked
  83.    --  conversion for rapid translation between the File_Mode type
  84.    --  used in this package and System.File_IO.
  85.  
  86.    for File_Mode use
  87.      (In_File     => 0,  -- System.FIle_IO.File_Mode'Pos (In_File)
  88.       Out_File    => 2,  -- System.File_IO.File_Mode'Pos (Out_File)
  89.       Append_File => 3); -- System.File_IO.File_Mode'Pos (Append_File)
  90.  
  91.    --  All subprograms are inlined
  92.  
  93.    pragma Inline (Close);
  94.    pragma Inline (Create);
  95.    pragma Inline (Delete);
  96.    pragma Inline (End_Of_File);
  97.    pragma Inline (Form);
  98.    pragma Inline (Is_Open);
  99.    pragma Inline (Mode);
  100.    pragma Inline (Name);
  101.    pragma Inline (Open);
  102.    pragma Inline (Read);
  103.    pragma Inline (Reset);
  104.    pragma Inline (Write);
  105.  
  106. end Ada.Sequential_IO;
  107.