1------------------------------------------------------------------------------ 2-- -- 3-- GNAT RUN-TIME COMPONENTS -- 4-- -- 5-- G N A T . I O -- 6-- -- 7-- S p e c -- 8-- -- 9-- Copyright (C) 1995-2010, AdaCore -- 10-- -- 11-- GNAT is free software; you can redistribute it and/or modify it under -- 12-- terms of the GNU General Public License as published by the Free Soft- -- 13-- ware Foundation; either version 3, or (at your option) any later ver- -- 14-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 15-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 16-- or FITNESS FOR A PARTICULAR PURPOSE. -- 17-- -- 18-- As a special exception under Section 7 of GPL version 3, you are granted -- 19-- additional permissions described in the GCC Runtime Library Exception, -- 20-- version 3.1, as published by the Free Software Foundation. -- 21-- -- 22-- You should have received a copy of the GNU General Public License and -- 23-- a copy of the GCC Runtime Library Exception along with this program; -- 24-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 25-- <http://www.gnu.org/licenses/>. -- 26-- -- 27-- GNAT was originally developed by the GNAT team at New York University. -- 28-- Extensive contributions were provided by Ada Core Technologies Inc. -- 29-- -- 30------------------------------------------------------------------------------ 31 32-- A simple preelaborable subset of Text_IO capabilities 33 34-- A simple text I/O package that can be used for simple I/O functions in 35-- user programs as required. This package is also preelaborated, unlike 36-- Text_IO, and can thus be with'ed by preelaborated library units. 37 38-- Note that Data_Error is not raised by these subprograms for bad data. 39-- If such checks are needed then the regular Text_IO package must be used. 40 41package GNAT.IO is 42 pragma Preelaborate; 43 44 type File_Type is limited private; 45 -- Specifies file to be used (the only possibilities are Standard_Output 46 -- and Standard_Error). There is no Create or Open facility that would 47 -- allow more general use of file names. 48 49 function Standard_Output return File_Type; 50 function Standard_Error return File_Type; 51 -- These functions are the only way to get File_Type values 52 53 procedure Get (X : out Integer); 54 procedure Get (C : out Character); 55 procedure Get_Line (Item : out String; Last : out Natural); 56 -- These routines always read from Standard_Input 57 58 procedure Put (File : File_Type; X : Integer); 59 procedure Put (X : Integer); 60 -- Output integer to specified file, or to current output file, same 61 -- output as if Ada.Text_IO.Integer_IO had been instantiated for Integer. 62 63 procedure Put (File : File_Type; C : Character); 64 procedure Put (C : Character); 65 -- Output character to specified file, or to current output file 66 67 procedure Put (File : File_Type; S : String); 68 procedure Put (S : String); 69 -- Output string to specified file, or to current output file 70 71 procedure Put_Line (File : File_Type; S : String); 72 procedure Put_Line (S : String); 73 -- Output string followed by new line to specified file, or to 74 -- current output file. 75 76 procedure New_Line (File : File_Type; Spacing : Positive := 1); 77 procedure New_Line (Spacing : Positive := 1); 78 -- Output new line character to specified file, or to current output file 79 80 procedure Set_Output (File : File_Type); 81 -- Set current output file, default is Standard_Output if no call to 82 -- Set_Output is made. 83 84private 85 type File_Type is (Stdout, Stderr); 86 -- Stdout = Standard_Output, Stderr = Standard_Error 87 88 pragma Inline (Standard_Error); 89 pragma Inline (Standard_Output); 90 91end GNAT.IO; 92