annotate gcc/ada/libgnat/a-ztgeau.ads @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- A D A . W I D E _ W I D E _ T E X T _ I O . G E N E R I C _ A U X --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This package contains a set of auxiliary routines used by Wide_Wide_Text_IO
kono
parents:
diff changeset
33 -- generic children, including for reading and writing numeric strings.
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 -- Note: although this is the Wide version of the package, the interface here
kono
parents:
diff changeset
36 -- is still in terms of Character and String rather than Wide_Wide_Character
kono
parents:
diff changeset
37 -- and Wide_Wide_String, since all numeric strings are composed entirely of
kono
parents:
diff changeset
38 -- characters in the range of type Standard.Character, and the basic
kono
parents:
diff changeset
39 -- conversion routines work with Character rather than Wide_Wide_Character.
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 package Ada.Wide_Wide_Text_IO.Generic_Aux is
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 -- Note: for all the Load routines, File indicates the file to be read,
kono
parents:
diff changeset
44 -- Buf is the string into which data is stored, Ptr is the index of the
kono
parents:
diff changeset
45 -- last character stored so far, and is updated if additional characters
kono
parents:
diff changeset
46 -- are stored. Data_Error is raised if the input overflows Buf. The only
kono
parents:
diff changeset
47 -- Load routines that do a file status check are Load_Skip and Load_Width
kono
parents:
diff changeset
48 -- so one of these two routines must be called first.
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 procedure Check_End_Of_Field
kono
parents:
diff changeset
51 (Buf : String;
kono
parents:
diff changeset
52 Stop : Integer;
kono
parents:
diff changeset
53 Ptr : Integer;
kono
parents:
diff changeset
54 Width : Field);
kono
parents:
diff changeset
55 -- This routine is used after doing a get operations on a numeric value.
kono
parents:
diff changeset
56 -- Buf is the string being scanned, and Stop is the last character of
kono
parents:
diff changeset
57 -- the field being scanned. Ptr is as set by the call to the scan routine
kono
parents:
diff changeset
58 -- that scanned out the numeric value, i.e. it points one past the last
kono
parents:
diff changeset
59 -- character scanned, and Width is the width parameter from the Get call.
kono
parents:
diff changeset
60 --
kono
parents:
diff changeset
61 -- There are two cases, if Width is non-zero, then a check is made that
kono
parents:
diff changeset
62 -- the remainder of the field is all blanks. If Width is zero, then it
kono
parents:
diff changeset
63 -- means that the scan routine scanned out only part of the field. We
kono
parents:
diff changeset
64 -- have already scanned out the field that the ACVC tests seem to expect
kono
parents:
diff changeset
65 -- us to read (even if it does not follow the syntax of the type being
kono
parents:
diff changeset
66 -- scanned, e.g. allowing negative exponents in integers, and underscores
kono
parents:
diff changeset
67 -- at the end of the string), so we just raise Data_Error.
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 procedure Check_On_One_Line (File : File_Type; Length : Integer);
kono
parents:
diff changeset
70 -- Check to see if item of length Integer characters can fit on
kono
parents:
diff changeset
71 -- current line. Call New_Line if not, first checking that the
kono
parents:
diff changeset
72 -- line length can accommodate Length characters, raise Layout_Error
kono
parents:
diff changeset
73 -- if item is too large for a single line.
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 function Is_Blank (C : Character) return Boolean;
kono
parents:
diff changeset
76 -- Determines if C is a blank (space or tab)
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 procedure Load_Width
kono
parents:
diff changeset
79 (File : File_Type;
kono
parents:
diff changeset
80 Width : Field;
kono
parents:
diff changeset
81 Buf : out String;
kono
parents:
diff changeset
82 Ptr : in out Integer);
kono
parents:
diff changeset
83 -- Loads exactly Width characters, unless a line mark is encountered first
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 procedure Load_Skip (File : File_Type);
kono
parents:
diff changeset
86 -- Skips leading blanks and line and page marks, if the end of file is
kono
parents:
diff changeset
87 -- read without finding a non-blank character, then End_Error is raised.
kono
parents:
diff changeset
88 -- Note: a blank is defined as a space or horizontal tab (RM A.10.6(5)).
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 procedure Load
kono
parents:
diff changeset
91 (File : File_Type;
kono
parents:
diff changeset
92 Buf : out String;
kono
parents:
diff changeset
93 Ptr : in out Integer;
kono
parents:
diff changeset
94 Char : Character;
kono
parents:
diff changeset
95 Loaded : out Boolean);
kono
parents:
diff changeset
96 -- If next character is Char, loads it, otherwise no characters are loaded
kono
parents:
diff changeset
97 -- Loaded is set to indicate whether or not the character was found.
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 procedure Load
kono
parents:
diff changeset
100 (File : File_Type;
kono
parents:
diff changeset
101 Buf : out String;
kono
parents:
diff changeset
102 Ptr : in out Integer;
kono
parents:
diff changeset
103 Char : Character);
kono
parents:
diff changeset
104 -- Same as above, but no indication if character is loaded
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 procedure Load
kono
parents:
diff changeset
107 (File : File_Type;
kono
parents:
diff changeset
108 Buf : out String;
kono
parents:
diff changeset
109 Ptr : in out Integer;
kono
parents:
diff changeset
110 Char1 : Character;
kono
parents:
diff changeset
111 Char2 : Character;
kono
parents:
diff changeset
112 Loaded : out Boolean);
kono
parents:
diff changeset
113 -- If next character is Char1 or Char2, loads it, otherwise no characters
kono
parents:
diff changeset
114 -- are loaded. Loaded is set to indicate whether or not one of the two
kono
parents:
diff changeset
115 -- characters was found.
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 procedure Load
kono
parents:
diff changeset
118 (File : File_Type;
kono
parents:
diff changeset
119 Buf : out String;
kono
parents:
diff changeset
120 Ptr : in out Integer;
kono
parents:
diff changeset
121 Char1 : Character;
kono
parents:
diff changeset
122 Char2 : Character);
kono
parents:
diff changeset
123 -- Same as above, but no indication if character is loaded
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 procedure Load_Digits
kono
parents:
diff changeset
126 (File : File_Type;
kono
parents:
diff changeset
127 Buf : out String;
kono
parents:
diff changeset
128 Ptr : in out Integer;
kono
parents:
diff changeset
129 Loaded : out Boolean);
kono
parents:
diff changeset
130 -- Loads a sequence of zero or more decimal digits. Loaded is set if
kono
parents:
diff changeset
131 -- at least one digit is loaded.
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 procedure Load_Digits
kono
parents:
diff changeset
134 (File : File_Type;
kono
parents:
diff changeset
135 Buf : out String;
kono
parents:
diff changeset
136 Ptr : in out Integer);
kono
parents:
diff changeset
137 -- Same as above, but no indication if character is loaded
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 procedure Load_Extended_Digits
kono
parents:
diff changeset
140 (File : File_Type;
kono
parents:
diff changeset
141 Buf : out String;
kono
parents:
diff changeset
142 Ptr : in out Integer;
kono
parents:
diff changeset
143 Loaded : out Boolean);
kono
parents:
diff changeset
144 -- Like Load_Digits, but also allows extended digits a-f and A-F
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 procedure Load_Extended_Digits
kono
parents:
diff changeset
147 (File : File_Type;
kono
parents:
diff changeset
148 Buf : out String;
kono
parents:
diff changeset
149 Ptr : in out Integer);
kono
parents:
diff changeset
150 -- Same as above, but no indication if character is loaded
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 procedure Put_Item (File : File_Type; Str : String);
kono
parents:
diff changeset
153 -- This routine is like Wide_Wide_Text_IO.Put, except that it checks for
kono
parents:
diff changeset
154 -- overflow of bounded lines, as described in (RM A.10.6(8)). It is used
kono
parents:
diff changeset
155 -- for all output of numeric values and of enumeration values. Note that
kono
parents:
diff changeset
156 -- the buffer is of type String. Put_Item deals with converting this to
kono
parents:
diff changeset
157 -- Wide_Wide_Characters as required.
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159 procedure Store_Char
kono
parents:
diff changeset
160 (File : File_Type;
kono
parents:
diff changeset
161 ch : Integer;
kono
parents:
diff changeset
162 Buf : out String;
kono
parents:
diff changeset
163 Ptr : in out Integer);
kono
parents:
diff changeset
164 -- Store a single character in buffer, checking for overflow and
kono
parents:
diff changeset
165 -- adjusting the column number in the file to reflect the fact
kono
parents:
diff changeset
166 -- that a character has been acquired from the input stream.
kono
parents:
diff changeset
167 -- The pos value of the character to store is in ch on entry.
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 procedure String_Skip (Str : String; Ptr : out Integer);
kono
parents:
diff changeset
170 -- Used in the Get from string procedures to skip leading blanks in the
kono
parents:
diff changeset
171 -- string. Ptr is set to the index of the first non-blank. If the string
kono
parents:
diff changeset
172 -- is all blanks, then the excption End_Error is raised, Note that blank
kono
parents:
diff changeset
173 -- is defined as a space or horizontal tab (RM A.10.6(5)).
kono
parents:
diff changeset
174
kono
parents:
diff changeset
175 procedure Ungetc (ch : Integer; File : File_Type);
kono
parents:
diff changeset
176 -- Pushes back character into stream, using ungetc. The caller has
kono
parents:
diff changeset
177 -- checked that the file is in read status. Device_Error is raised
kono
parents:
diff changeset
178 -- if the character cannot be pushed back. An attempt to push back
kono
parents:
diff changeset
179 -- an end of file (EOF) is ignored.
kono
parents:
diff changeset
180
kono
parents:
diff changeset
181 private
kono
parents:
diff changeset
182 pragma Inline (Is_Blank);
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 end Ada.Wide_Wide_Text_IO.Generic_Aux;