OSDN Git Service

* 41intnam.ads, 42intnam.ads, 4aintnam.ads, 4cintnam.ads,
[pf3gnuchains/gcc-fork.git] / gcc / ada / output.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                               O U T P U T                                --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                            $Revision$
10 --                                                                          --
11 --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
12 --                                                                          --
13 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
14 -- terms of the  GNU General Public License as published  by the Free Soft- --
15 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
16 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
19 -- for  more details.  You should have  received  a copy of the GNU General --
20 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
21 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
22 -- MA 02111-1307, USA.                                                      --
23 --                                                                          --
24 -- As a special exception,  if other files  instantiate  generics from this --
25 -- unit, or you link  this unit with other files  to produce an executable, --
26 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
27 -- covered  by the  GNU  General  Public  License.  This exception does not --
28 -- however invalidate  any other reasons why  the executable file  might be --
29 -- covered by the  GNU Public License.                                      --
30 --                                                                          --
31 -- GNAT was originally developed  by the GNAT team at  New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
33 --                                                                          --
34 ------------------------------------------------------------------------------
35
36 --  This package contains low level output routines used by the compiler
37 --  for writing error messages and informational output. It is also used
38 --  by the debug source file output routines (see Sprintf.Print_Eol).
39
40 with Types; use Types;
41
42 package Output is
43 pragma Elaborate_Body (Output);
44
45    type Output_Proc is access procedure (S : String);
46    --  This type is used for the Set_Special_Output procedure. If this
47    --  procedure is called, then instead of lines being written to
48    --  standard error or standard output, a call is made to the given
49    --  procedure for each line, passing the line with an end of line
50    --  character (which is a single ASCII.LF character, even in systems
51    --  which normally use CR/LF or some other sequence for line end).
52
53    -----------------
54    -- Subprograms --
55    -----------------
56
57    procedure Set_Special_Output (P : Output_Proc);
58    --  Sets subsequent output to call procedure P. If P is null, then
59    --  the call cancels the effect of a previous call, reverting the
60    --  output to standard error or standard output depending on the
61    --  mode at the time of previous call. Any exception generated by
62    --  by calls to P is simply propagated to the caller of the routine
63    --  causing the write operation.
64
65    procedure Cancel_Special_Output;
66    --  Cancels the effect of a call to Set_Special_Output, if any.
67    --  The output is then directed to standard error or standard output
68    --  depending on the last call to Set_Standard_Error or Set_Standard_Output.
69    --  It is never an error to call Cancel_Special_Output. It has the same
70    --  effect as calling Set_Special_Output (null).
71
72    procedure Set_Standard_Error;
73    --  Sets subsequent output to appear on the standard error file (whatever
74    --  that might mean for the host operating system, if anything) when
75    --  no special output is in effect. When a special output is in effect,
76    --  the output will appear on standard error only after special output
77    --  has been cancelled.
78
79    procedure Set_Standard_Output;
80    --  Sets subsequent output to appear on the standard output file (whatever
81    --  that might mean for the host operating system, if anything) when
82    --  no special output is in effect. When a special output is in effect,
83    --  the output will appear on standard output only after special output
84    --  has been cancelled. Output to standard output is the default mode
85    --  before any call to either of the Set procedures.
86
87    procedure Write_Char (C : Character);
88    --  Write one character to the standard output file. Note that the
89    --  character should not be LF or CR (use Write_Eol for end of line)
90
91    procedure Write_Eol;
92    --  Write an end of line (whatever is required by the system in use,
93    --  e.g. CR/LF for DOS, or LF for Unix) to the standard output file.
94    --  This routine also empties the line buffer, actually writing it
95    --  to the file. Note that Write_Eol is the only routine that causes
96    --  any actual output to be written.
97
98    procedure Write_Int (Val : Int);
99    --  Write an integer value with no leading blanks or zeroes. Negative
100    --  values are preceded by a minus sign).
101
102    procedure Write_Str (S : String);
103    --  Write a string of characters to the standard output file. Note that
104    --  end of line is handled separately using WRITE_EOL, so the string
105    --  should not contain either of the characters LF or CR, but it may
106    --  contain horizontal tab characters.
107
108    procedure Write_Line (S : String);
109    --  Equivalent to Write_Str (S) followed by Write_Eol;
110
111    function Column return Nat;
112    pragma Inline (Column);
113    --  Returns the number of the column about to be written (e.g. a value
114    --  of 1 means the current line is empty).
115
116    --------------------------
117    -- Debugging Procedures --
118    --------------------------
119
120    --  The following procedures are intended only for debugging purposes,
121    --  for temporary insertion into the text in environments where a debugger
122    --  is not available. They all have non-standard very short lower case
123    --  names, precisely to make sure that they are only used for debugging!
124
125    procedure w (C : Character);
126    --  Dump quote, character quote, followed by line return
127
128    procedure w (S : String);
129    --  Dump string followed by line return
130
131    procedure w (V : Int);
132    --  Dump integer followed by line return
133
134    procedure w (B : Boolean);
135    --  Dump Boolean followed by line return
136
137    procedure w (L : String; C : Character);
138    --  Dump contents of string followed by blank, quote, character, quote
139
140    procedure w (L : String; S : String);
141    --  Dump two strings separated by blanks, followed by line return
142
143    procedure w (L : String; V : Int);
144    --  Dump contents of string followed by blank, integer, line return
145
146    procedure w (L : String; B : Boolean);
147    --  Dump contents of string followed by blank, Boolean, line return
148
149 end Output;