1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
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. --
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. --
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). --
34 ------------------------------------------------------------------------------
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).
40 with Types; use Types;
43 pragma Elaborate_Body (Output);
45 -------------------------
46 -- Line Buffer Control --
47 -------------------------
49 -- Note: the following buffer and column position are maintained by
50 -- the subprograms defined in this package, and are not normally
51 -- directly modified or accessed by a client. However, a client is
52 -- permitted to modify these values, using the knowledge that only
53 -- Write_Eol actually generates any output.
55 Buffer_Max : constant := 8192;
56 Buffer : String (1 .. Buffer_Max + 1);
57 -- Buffer used to build output line. We do line buffering because it
58 -- is needed for the support of the debug-generated-code option (-gnatD).
59 -- Historically it was first added because on VMS, line buffering is
60 -- needed with certain file formats. So in any case line buffering must
61 -- be retained for this purpose, even if other reasons disappear. Note
62 -- any attempt to write more output to a line than can fit in the buffer
63 -- will be silently ignored.
65 Column : Pos range 1 .. Buffer'Length + 1 := 1;
66 -- Column about to be written.
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).
76 procedure Set_Standard_Output;
77 -- Sets subsequent output to appear on the standard output file (whatever
78 -- that might mean for the host operating system, if anything). This is
79 -- the default mode before any call to either of the Set procedures.
81 procedure Write_Char (C : Character);
82 -- Write one character to the standard output file. Note that the
83 -- character should not be LF or CR (use Write_Eol for end of line)
86 -- Write an end of line (whatever is required by the system in use,
87 -- e.g. CR/LF for DOS, or LF for Unix) to the standard output file.
88 -- This routine also empties the line buffer, actually writing it
89 -- to the file. Note that Write_Eol is the only routine that causes
90 -- any actual output to be written.
92 procedure Write_Int (Val : Int);
93 -- Write an integer value with no leading blanks or zeroes. Negative
94 -- values are preceded by a minus sign).
96 procedure Write_Str (S : String);
97 -- Write a string of characters to the standard output file. Note that
98 -- end of line is handled separately using WRITE_EOL, so the string
99 -- should not contain either of the characters LF or CR, but it may
100 -- contain horizontal tab characters.
102 procedure Write_Line (S : String);
103 -- Equivalent to Write_Str (S) followed by Write_Eol;
105 --------------------------
106 -- Debugging Procedures --
107 --------------------------
109 -- The following procedures are intended only for debugging purposes,
110 -- for temporary insertion into the text in environments where a debugger
111 -- is not available. They all have non-standard very short lower case
112 -- names, precisely to make sure that they are only used for debugging!
114 procedure w (C : Character);
115 -- Dump quote, character quote, followed by line return
117 procedure w (S : String);
118 -- Dump string followed by line return
120 procedure w (V : Int);
121 -- Dump integer followed by line return
123 procedure w (B : Boolean);
124 -- Dump Boolean followed by line return
126 procedure w (L : String; C : Character);
127 -- Dump contents of string followed by blank, quote, character, quote
129 procedure w (L : String; S : String);
130 -- Dump two strings separated by blanks, followed by line return
132 procedure w (L : String; V : Int);
133 -- Dump contents of string followed by blank, integer, line return
135 procedure w (L : String; B : Boolean);
136 -- Dump contents of string followed by blank, Boolean, line return