1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
9 -- Copyright (C) 1995-2010, AdaCore --
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. --
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. --
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/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- A simple preelaborable subset of Text_IO capabilities
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.
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.
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.
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
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
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.
63 procedure Put
(File
: File_Type
; C
: Character);
64 procedure Put
(C
: Character);
65 -- Output character to specified file, or to current output file
67 procedure Put
(File
: File_Type
; S
: String);
68 procedure Put
(S
: String);
69 -- Output string to specified file, or to current output file
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.
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
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.
85 type File_Type
is (Stdout
, Stderr
);
86 -- Stdout = Standard_Output, Stderr = Standard_Error
88 pragma Inline
(Standard_Error
);
89 pragma Inline
(Standard_Output
);