Add hppa-openbsd target
[official-gcc.git] / gcc / ada / a-tigeau.ads
bloba669d3b60e6f2d087db9132de44f6aaedcff6131
1 -----------------------------------------------------------------------------
2 -- --
3 -- GNAT RUNTIME COMPONENTS --
4 -- --
5 -- A D A . T E X T _ I O . G E N E R I C _ A U X --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
11 -- --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
22 -- --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
29 -- --
30 -- GNAT was originally developed by the GNAT team at New York University. --
31 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
32 -- --
33 ------------------------------------------------------------------------------
35 -- This package contains a set of auxiliary routines used by the Text_IO
36 -- generic children, including for reading and writing numeric strings.
38 private package Ada.Text_IO.Generic_Aux is
40 -- Note: for all the Load routines, File indicates the file to be read,
41 -- Buf is the string into which data is stored, Ptr is the index of the
42 -- last character stored so far, and is updated if additional characters
43 -- are stored. Data_Error is raised if the input overflows Buf. The only
44 -- Load routines that do a file status check are Load_Skip and Load_Width
45 -- so one of these two routines must be called first.
47 procedure Check_End_Of_Field
48 (Buf : String;
49 Stop : Integer;
50 Ptr : Integer;
51 Width : Field);
52 -- This routine is used after doing a get operations on a numeric value.
53 -- Buf is the string being scanned, and Stop is the last character of
54 -- the field being scanned. Ptr is as set by the call to the scan routine
55 -- that scanned out the numeric value, i.e. it points one past the last
56 -- character scanned, and Width is the width parameter from the Get call.
58 -- There are two cases, if Width is non-zero, then a check is made that
59 -- the remainder of the field is all blanks. If Width is zero, then it
60 -- means that the scan routine scanned out only part of the field. We
61 -- have already scanned out the field that the ACVC tests seem to expect
62 -- us to read (even if it does not follow the syntax of the type being
63 -- scanned, e.g. allowing negative exponents in integers, and underscores
64 -- at the end of the string), so we just raise Data_Error.
66 procedure Check_On_One_Line (File : File_Type; Length : Integer);
67 -- Check to see if item of length Integer characters can fit on
68 -- current line. Call New_Line if not, first checking that the
69 -- line length can accommodate Length characters, raise Layout_Error
70 -- if item is too large for a single line.
72 function Getc (File : File_Type) return Integer;
73 -- Gets next character from file, which has already been checked for
74 -- being in read status, and returns the character read if no error
75 -- occurs. The result is EOF if the end of file was read. Note that
76 -- the Col value is not bumped, so it is the caller's responsibility
77 -- to bump it if necessary.
79 function Is_Blank (C : Character) return Boolean;
80 -- Determines if C is a blank (space or tab)
82 procedure Load_Width
83 (File : File_Type;
84 Width : in Field;
85 Buf : out String;
86 Ptr : in out Integer);
87 -- Loads exactly Width characters, unless a line mark is encountered first
89 procedure Load_Skip (File : File_Type);
90 -- Skips leading blanks and line and page marks, if the end of file is
91 -- read without finding a non-blank character, then End_Error is raised.
92 -- Note: a blank is defined as a space or horizontal tab (RM A.10.6(5)).
94 procedure Load
95 (File : File_Type;
96 Buf : out String;
97 Ptr : in out Integer;
98 Char : Character;
99 Loaded : out Boolean);
100 -- If next character is Char, loads it, otherwise no characters are loaded
101 -- Loaded is set to indicate whether or not the character was found.
103 procedure Load
104 (File : File_Type;
105 Buf : out String;
106 Ptr : in out Integer;
107 Char : Character);
108 -- Same as above, but no indication if character is loaded
110 procedure Load
111 (File : File_Type;
112 Buf : out String;
113 Ptr : in out Integer;
114 Char1 : Character;
115 Char2 : Character;
116 Loaded : out Boolean);
117 -- If next character is Char1 or Char2, loads it, otherwise no characters
118 -- are loaded. Loaded is set to indicate whether or not one of the two
119 -- characters was found.
121 procedure Load
122 (File : File_Type;
123 Buf : out String;
124 Ptr : in out Integer;
125 Char1 : Character;
126 Char2 : Character);
127 -- Same as above, but no indication if character is loaded
129 procedure Load_Digits
130 (File : File_Type;
131 Buf : out String;
132 Ptr : in out Integer;
133 Loaded : out Boolean);
134 -- Loads a sequence of zero or more decimal digits. Loaded is set if
135 -- at least one digit is loaded.
137 procedure Load_Digits
138 (File : File_Type;
139 Buf : out String;
140 Ptr : in out Integer);
141 -- Same as above, but no indication if character is loaded
143 procedure Load_Extended_Digits
144 (File : File_Type;
145 Buf : out String;
146 Ptr : in out Integer;
147 Loaded : out Boolean);
148 -- Like Load_Digits, but also allows extended digits a-f and A-F
150 procedure Load_Extended_Digits
151 (File : File_Type;
152 Buf : out String;
153 Ptr : in out Integer);
154 -- Same as above, but no indication if character is loaded
156 function Nextc (File : File_Type) return Integer;
157 -- Like Getc, but includes a call to Ungetc, so that the file
158 -- pointer is not moved by the call.
160 procedure Put_Item (File : File_Type; Str : String);
161 -- This routine is like Text_IO.Put, except that it checks for overflow
162 -- of bounded lines, as described in (RM A.10.6(8)). It is used for
163 -- all output of numeric values and of enumeration values.
165 procedure Store_Char
166 (File : File_Type;
167 ch : Integer;
168 Buf : out String;
169 Ptr : in out Integer);
170 -- Store a single character in buffer, checking for overflow and
171 -- adjusting the column number in the file to reflect the fact
172 -- that a character has been acquired from the input stream.
174 procedure String_Skip (Str : String; Ptr : out Integer);
175 -- Used in the Get from string procedures to skip leading blanks in the
176 -- string. Ptr is set to the index of the first non-blank. If the string
177 -- is all blanks, then the excption End_Error is raised, Note that blank
178 -- is defined as a space or horizontal tab (RM A.10.6(5)).
180 procedure Ungetc (ch : Integer; File : File_Type);
181 -- Pushes back character into stream, using ungetc. The caller has
182 -- checked that the file is in read status. Device_Error is raised
183 -- if the character cannot be pushed back. An attempt to push back
184 -- an end of file (EOF) is ignored.
186 private
187 pragma Inline (Is_Blank);
189 end Ada.Text_IO.Generic_Aux;