Mercurial > hg > CbC > CbC_gcc
comparison gcc/ada/libgnat/a-textio.ads @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
4 -- -- | 4 -- -- |
5 -- A D A . T E X T _ I O -- | 5 -- A D A . T E X T _ I O -- |
6 -- -- | 6 -- -- |
7 -- S p e c -- | 7 -- S p e c -- |
8 -- -- | 8 -- -- |
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. -- | 9 -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- |
10 -- -- | 10 -- -- |
11 -- This specification is derived from the Ada Reference Manual for use with -- | 11 -- This specification is derived from the Ada Reference Manual for use with -- |
12 -- GNAT. The copyright notice above, and the license provisions that follow -- | 12 -- GNAT. The copyright notice above, and the license provisions that follow -- |
13 -- apply solely to the contents of the part following the private keyword. -- | 13 -- apply solely to the contents of the part following the private keyword. -- |
14 -- -- | 14 -- -- |
31 -- GNAT was originally developed by the GNAT team at New York University. -- | 31 -- GNAT was originally developed by the GNAT team at New York University. -- |
32 -- Extensive contributions were provided by Ada Core Technologies Inc. -- | 32 -- Extensive contributions were provided by Ada Core Technologies Inc. -- |
33 -- -- | 33 -- -- |
34 ------------------------------------------------------------------------------ | 34 ------------------------------------------------------------------------------ |
35 | 35 |
36 -- Preconditions in this unit are meant for analysis only, not for run-time | |
37 -- checking, so that the expected exceptions are raised. This is enforced by | |
38 -- setting the corresponding assertion policy to Ignore. These preconditions | |
39 -- are partial and protect against Status_Error, Mode_Error, and Layout_Error, | |
40 -- but not against other types of errors. | |
41 | |
42 pragma Assertion_Policy (Pre => Ignore); | |
43 | |
36 -- Note: the generic subpackages of Text_IO (Integer_IO, Float_IO, Fixed_IO, | 44 -- Note: the generic subpackages of Text_IO (Integer_IO, Float_IO, Fixed_IO, |
37 -- Modular_IO, Decimal_IO and Enumeration_IO) appear as private children in | 45 -- Modular_IO, Decimal_IO and Enumeration_IO) appear as private children in |
38 -- GNAT. These children are with'ed automatically if they are referenced, so | 46 -- GNAT. These children are with'ed automatically if they are referenced, so |
39 -- this rearrangement is invisible to user programs, but has the advantage | 47 -- this rearrangement is invisible to user programs, but has the advantage |
40 -- that only the needed parts of Text_IO are processed and loaded. | 48 -- that only the needed parts of Text_IO are processed and loaded. |
44 | 52 |
45 with System; | 53 with System; |
46 with System.File_Control_Block; | 54 with System.File_Control_Block; |
47 with System.WCh_Con; | 55 with System.WCh_Con; |
48 | 56 |
49 package Ada.Text_IO is | 57 package Ada.Text_IO with |
58 Abstract_State => (File_System), | |
59 Initializes => (File_System), | |
60 Initial_Condition => Line_Length = 0 and Page_Length = 0 | |
61 is | |
50 pragma Elaborate_Body; | 62 pragma Elaborate_Body; |
51 | 63 |
52 type File_Type is limited private with Default_Initial_Condition; | 64 type File_Type is limited private with |
65 Default_Initial_Condition => (not Is_Open (File_Type)); | |
53 type File_Mode is (In_File, Out_File, Append_File); | 66 type File_Mode is (In_File, Out_File, Append_File); |
54 | 67 |
55 -- The following representation clause allows the use of unchecked | 68 -- The following representation clause allows the use of unchecked |
56 -- conversion for rapid translation between the File_Mode type | 69 -- conversion for rapid translation between the File_Mode type |
57 -- used in this package and System.File_IO. | 70 -- used in this package and System.File_IO. |
85 | 98 |
86 procedure Create | 99 procedure Create |
87 (File : in out File_Type; | 100 (File : in out File_Type; |
88 Mode : File_Mode := Out_File; | 101 Mode : File_Mode := Out_File; |
89 Name : String := ""; | 102 Name : String := ""; |
90 Form : String := ""); | 103 Form : String := "") |
104 with | |
105 Pre => not Is_Open (File), | |
106 Post => | |
107 Is_Open (File) | |
108 and then Ada.Text_IO.Mode (File) = Mode | |
109 and then (if Mode /= In_File | |
110 then (Line_Length (File) = 0 | |
111 and then Page_Length (File) = 0)), | |
112 Global => (In_Out => File_System); | |
91 | 113 |
92 procedure Open | 114 procedure Open |
93 (File : in out File_Type; | 115 (File : in out File_Type; |
94 Mode : File_Mode; | 116 Mode : File_Mode; |
95 Name : String; | 117 Name : String; |
96 Form : String := ""); | 118 Form : String := "") |
97 | 119 with |
98 procedure Close (File : in out File_Type); | 120 Pre => not Is_Open (File), |
99 procedure Delete (File : in out File_Type); | 121 Post => |
100 procedure Reset (File : in out File_Type; Mode : File_Mode); | 122 Is_Open (File) |
101 procedure Reset (File : in out File_Type); | 123 and then Ada.Text_IO.Mode (File) = Mode |
102 | 124 and then (if Mode /= In_File |
103 function Mode (File : File_Type) return File_Mode; | 125 then (Line_Length (File) = 0 |
104 function Name (File : File_Type) return String; | 126 and then Page_Length (File) = 0)), |
105 function Form (File : File_Type) return String; | 127 Global => (In_Out => File_System); |
106 | 128 |
107 function Is_Open (File : File_Type) return Boolean; | 129 procedure Close (File : in out File_Type) with |
130 Pre => Is_Open (File), | |
131 Post => not Is_Open (File), | |
132 Global => (In_Out => File_System); | |
133 procedure Delete (File : in out File_Type) with | |
134 Pre => Is_Open (File), | |
135 Post => not Is_Open (File), | |
136 Global => (In_Out => File_System); | |
137 procedure Reset (File : in out File_Type; Mode : File_Mode) with | |
138 Pre => Is_Open (File), | |
139 Post => | |
140 Is_Open (File) | |
141 and then Ada.Text_IO.Mode (File) = Mode | |
142 and then (if Mode /= In_File | |
143 then (Line_Length (File) = 0 | |
144 and then Page_Length (File) = 0)), | |
145 Global => (In_Out => File_System); | |
146 procedure Reset (File : in out File_Type) with | |
147 Pre => Is_Open (File), | |
148 Post => | |
149 Is_Open (File) | |
150 and Mode (File)'Old = Mode (File) | |
151 and (if Mode (File) /= In_File | |
152 then (Line_Length (File) = 0 | |
153 and then Page_Length (File) = 0)), | |
154 Global => (In_Out => File_System); | |
155 | |
156 function Mode (File : File_Type) return File_Mode with | |
157 Pre => Is_Open (File), | |
158 Global => null; | |
159 function Name (File : File_Type) return String with | |
160 Pre => Is_Open (File), | |
161 Global => null; | |
162 function Form (File : File_Type) return String with | |
163 Pre => Is_Open (File), | |
164 Global => null; | |
165 | |
166 function Is_Open (File : File_Type) return Boolean with | |
167 Global => null; | |
108 | 168 |
109 ------------------------------------------------------ | 169 ------------------------------------------------------ |
110 -- Control of default input, output and error files -- | 170 -- Control of default input, output and error files -- |
111 ------------------------------------------------------ | 171 ------------------------------------------------------ |
112 | 172 |
113 procedure Set_Input (File : File_Type); | 173 procedure Set_Input (File : File_Type) with SPARK_Mode => Off; |
114 procedure Set_Output (File : File_Type); | 174 procedure Set_Output (File : File_Type) with SPARK_Mode => Off; |
115 procedure Set_Error (File : File_Type); | 175 procedure Set_Error (File : File_Type) with SPARK_Mode => Off; |
116 | 176 |
117 function Standard_Input return File_Type; | 177 function Standard_Input return File_Type with SPARK_Mode => Off; |
118 function Standard_Output return File_Type; | 178 function Standard_Output return File_Type with SPARK_Mode => Off; |
119 function Standard_Error return File_Type; | 179 function Standard_Error return File_Type with SPARK_Mode => Off; |
120 | 180 |
121 function Current_Input return File_Type; | 181 function Current_Input return File_Type with SPARK_Mode => Off; |
122 function Current_Output return File_Type; | 182 function Current_Output return File_Type with SPARK_Mode => Off; |
123 function Current_Error return File_Type; | 183 function Current_Error return File_Type with SPARK_Mode => Off; |
124 | 184 |
125 type File_Access is access constant File_Type; | 185 type File_Access is access constant File_Type; |
126 | 186 |
127 function Standard_Input return File_Access; | 187 function Standard_Input return File_Access with SPARK_Mode => Off; |
128 function Standard_Output return File_Access; | 188 function Standard_Output return File_Access with SPARK_Mode => Off; |
129 function Standard_Error return File_Access; | 189 function Standard_Error return File_Access with SPARK_Mode => Off; |
130 | 190 |
131 function Current_Input return File_Access; | 191 function Current_Input return File_Access with SPARK_Mode => Off; |
132 function Current_Output return File_Access; | 192 function Current_Output return File_Access with SPARK_Mode => Off; |
133 function Current_Error return File_Access; | 193 function Current_Error return File_Access with SPARK_Mode => Off; |
134 | 194 |
135 -------------------- | 195 -------------------- |
136 -- Buffer control -- | 196 -- Buffer control -- |
137 -------------------- | 197 -------------------- |
138 | 198 |
139 -- Note: The parameter file is IN OUT in the RM, but this is clearly | 199 -- Note: The parameter file is IN OUT in the RM, but this is clearly |
140 -- an oversight, and was intended to be IN, see AI95-00057. | 200 -- an oversight, and was intended to be IN, see AI95-00057. |
141 | 201 |
142 procedure Flush (File : File_Type); | 202 procedure Flush (File : File_Type) with |
143 procedure Flush; | 203 Pre => Is_Open (File) and then Mode (File) /= In_File, |
204 Post => | |
205 Line_Length (File)'Old = Line_Length (File) | |
206 and Page_Length (File)'Old = Page_Length (File), | |
207 Global => (In_Out => File_System); | |
208 procedure Flush with | |
209 Post => | |
210 Line_Length'Old = Line_Length | |
211 and Page_Length'Old = Page_Length, | |
212 Global => (In_Out => File_System); | |
144 | 213 |
145 -------------------------------------------- | 214 -------------------------------------------- |
146 -- Specification of line and page lengths -- | 215 -- Specification of line and page lengths -- |
147 -------------------------------------------- | 216 -------------------------------------------- |
148 | 217 |
149 procedure Set_Line_Length (File : File_Type; To : Count); | 218 procedure Set_Line_Length (File : File_Type; To : Count) with |
150 procedure Set_Line_Length (To : Count); | 219 Pre => Is_Open (File) and then Mode (File) /= In_File, |
151 | 220 Post => |
152 procedure Set_Page_Length (File : File_Type; To : Count); | 221 Line_Length (File) = To |
153 procedure Set_Page_Length (To : Count); | 222 and Page_Length (File)'Old = Page_Length (File), |
154 | 223 Global => (In_Out => File_System); |
155 function Line_Length (File : File_Type) return Count; | 224 procedure Set_Line_Length (To : Count) with |
156 function Line_Length return Count; | 225 Post => |
157 | 226 Line_Length = To |
158 function Page_Length (File : File_Type) return Count; | 227 and Page_Length'Old = Page_Length, |
159 function Page_Length return Count; | 228 Global => (In_Out => File_System); |
229 | |
230 procedure Set_Page_Length (File : File_Type; To : Count) with | |
231 Pre => Is_Open (File) and then Mode (File) /= In_File, | |
232 Post => | |
233 Page_Length (File) = To | |
234 and Line_Length (File)'Old = Line_Length (File), | |
235 Global => (In_Out => File_System); | |
236 procedure Set_Page_Length (To : Count) with | |
237 Post => | |
238 Page_Length = To | |
239 and Line_Length'Old = Line_Length, | |
240 Global => (In_Out => File_System); | |
241 | |
242 function Line_Length (File : File_Type) return Count with | |
243 Pre => Is_Open (File) and then Mode (File) /= In_File, | |
244 Global => (Input => File_System); | |
245 function Line_Length return Count with | |
246 Global => (Input => File_System); | |
247 | |
248 function Page_Length (File : File_Type) return Count with | |
249 Pre => Is_Open (File) and then Mode (File) /= In_File, | |
250 Global => (Input => File_System); | |
251 function Page_Length return Count with | |
252 Global => (Input => File_System); | |
160 | 253 |
161 ------------------------------------ | 254 ------------------------------------ |
162 -- Column, Line, and Page Control -- | 255 -- Column, Line, and Page Control -- |
163 ------------------------------------ | 256 ------------------------------------ |
164 | 257 |
165 procedure New_Line (File : File_Type; Spacing : Positive_Count := 1); | 258 procedure New_Line (File : File_Type; Spacing : Positive_Count := 1) with |
166 procedure New_Line (Spacing : Positive_Count := 1); | 259 Pre => Is_Open (File) and then Mode (File) /= In_File, |
167 | 260 Post => |
168 procedure Skip_Line (File : File_Type; Spacing : Positive_Count := 1); | 261 Line_Length (File)'Old = Line_Length (File) |
169 procedure Skip_Line (Spacing : Positive_Count := 1); | 262 and Page_Length (File)'Old = Page_Length (File), |
170 | 263 Global => (In_Out => File_System); |
171 function End_Of_Line (File : File_Type) return Boolean; | 264 procedure New_Line (Spacing : Positive_Count := 1) with |
172 function End_Of_Line return Boolean; | 265 Post => |
173 | 266 Line_Length'Old = Line_Length |
174 procedure New_Page (File : File_Type); | 267 and Page_Length'Old = Page_Length, |
175 procedure New_Page; | 268 Global => (In_Out => File_System); |
176 | 269 |
177 procedure Skip_Page (File : File_Type); | 270 procedure Skip_Line (File : File_Type; Spacing : Positive_Count := 1) with |
178 procedure Skip_Page; | 271 Pre => Is_Open (File) and then Mode (File) = In_File, |
179 | 272 Global => (In_Out => File_System); |
180 function End_Of_Page (File : File_Type) return Boolean; | 273 procedure Skip_Line (Spacing : Positive_Count := 1) with |
181 function End_Of_Page return Boolean; | 274 Post => |
182 | 275 Line_Length'Old = Line_Length |
183 function End_Of_File (File : File_Type) return Boolean; | 276 and Page_Length'Old = Page_Length, |
184 function End_Of_File return Boolean; | 277 Global => (In_Out => File_System); |
185 | 278 |
186 procedure Set_Col (File : File_Type; To : Positive_Count); | 279 function End_Of_Line (File : File_Type) return Boolean with |
187 procedure Set_Col (To : Positive_Count); | 280 Pre => Is_Open (File) and then Mode (File) = In_File, |
188 | 281 Global => (Input => File_System); |
189 procedure Set_Line (File : File_Type; To : Positive_Count); | 282 function End_Of_Line return Boolean with |
190 procedure Set_Line (To : Positive_Count); | 283 Global => (Input => File_System); |
191 | 284 |
192 function Col (File : File_Type) return Positive_Count; | 285 procedure New_Page (File : File_Type) with |
193 function Col return Positive_Count; | 286 Pre => Is_Open (File) and then Mode (File) /= In_File, |
194 | 287 Post => |
195 function Line (File : File_Type) return Positive_Count; | 288 Line_Length (File)'Old = Line_Length (File) |
196 function Line return Positive_Count; | 289 and Page_Length (File)'Old = Page_Length (File), |
197 | 290 Global => (In_Out => File_System); |
198 function Page (File : File_Type) return Positive_Count; | 291 procedure New_Page with |
199 function Page return Positive_Count; | 292 Post => |
293 Line_Length'Old = Line_Length | |
294 and Page_Length'Old = Page_Length, | |
295 Global => (In_Out => File_System); | |
296 | |
297 procedure Skip_Page (File : File_Type) with | |
298 Pre => Is_Open (File) and then Mode (File) = In_File, | |
299 Global => (In_Out => File_System); | |
300 procedure Skip_Page with | |
301 Post => | |
302 Line_Length'Old = Line_Length | |
303 and Page_Length'Old = Page_Length, | |
304 Global => (In_Out => File_System); | |
305 | |
306 function End_Of_Page (File : File_Type) return Boolean with | |
307 Pre => Is_Open (File) and then Mode (File) = In_File, | |
308 Global => (Input => File_System); | |
309 function End_Of_Page return Boolean with | |
310 Global => (Input => File_System); | |
311 | |
312 function End_Of_File (File : File_Type) return Boolean with | |
313 Pre => Is_Open (File) and then Mode (File) = In_File, | |
314 Global => (Input => File_System); | |
315 function End_Of_File return Boolean with | |
316 Global => (Input => File_System); | |
317 | |
318 procedure Set_Col (File : File_Type; To : Positive_Count) with | |
319 Pre => | |
320 Is_Open (File) | |
321 and then (if Mode (File) /= In_File | |
322 then (Line_Length (File) = 0 | |
323 or else To <= Line_Length (File))), | |
324 Contract_Cases => | |
325 (Mode (File) /= In_File => | |
326 Line_Length (File)'Old = Line_Length (File) | |
327 and Page_Length (File)'Old = Page_Length (File), | |
328 others => True), | |
329 Global => (In_Out => File_System); | |
330 procedure Set_Col (To : Positive_Count) with | |
331 Pre => Line_Length = 0 or To <= Line_Length, | |
332 Post => | |
333 Line_Length'Old = Line_Length | |
334 and Page_Length'Old = Page_Length, | |
335 Global => (In_Out => File_System); | |
336 | |
337 procedure Set_Line (File : File_Type; To : Positive_Count) with | |
338 Pre => | |
339 Is_Open (File) | |
340 and then (if Mode (File) /= In_File | |
341 then (Page_Length (File) = 0 | |
342 or else To <= Page_Length (File))), | |
343 Contract_Cases => | |
344 (Mode (File) /= In_File => | |
345 Line_Length (File)'Old = Line_Length (File) | |
346 and Page_Length (File)'Old = Page_Length (File), | |
347 others => True), | |
348 Global => (In_Out => File_System); | |
349 procedure Set_Line (To : Positive_Count) with | |
350 Pre => Page_Length = 0 or To <= Page_Length, | |
351 Post => | |
352 Line_Length'Old = Line_Length | |
353 and Page_Length'Old = Page_Length, | |
354 Global => (In_Out => File_System); | |
355 | |
356 function Col (File : File_Type) return Positive_Count with | |
357 Pre => Is_Open (File), | |
358 Global => (Input => File_System); | |
359 function Col return Positive_Count with | |
360 Global => (Input => File_System); | |
361 | |
362 function Line (File : File_Type) return Positive_Count with | |
363 Pre => Is_Open (File), | |
364 Global => (Input => File_System); | |
365 function Line return Positive_Count with | |
366 Global => (Input => File_System); | |
367 | |
368 function Page (File : File_Type) return Positive_Count with | |
369 Pre => Is_Open (File), | |
370 Global => (Input => File_System); | |
371 function Page return Positive_Count with | |
372 Global => (Input => File_System); | |
200 | 373 |
201 ---------------------------- | 374 ---------------------------- |
202 -- Character Input-Output -- | 375 -- Character Input-Output -- |
203 ---------------------------- | 376 ---------------------------- |
204 | 377 |
205 procedure Get (File : File_Type; Item : out Character); | 378 procedure Get (File : File_Type; Item : out Character) with |
206 procedure Get (Item : out Character); | 379 Pre => Is_Open (File) and then Mode (File) = In_File, |
207 procedure Put (File : File_Type; Item : Character); | 380 Global => (In_Out => File_System); |
208 procedure Put (Item : Character); | 381 procedure Get (Item : out Character) with |
382 Post => | |
383 Line_Length'Old = Line_Length | |
384 and Page_Length'Old = Page_Length, | |
385 Global => (In_Out => File_System); | |
386 procedure Put (File : File_Type; Item : Character) with | |
387 Pre => Is_Open (File) and then Mode (File) /= In_File, | |
388 Post => | |
389 Line_Length (File)'Old = Line_Length (File) | |
390 and Page_Length (File)'Old = Page_Length (File), | |
391 Global => (In_Out => File_System); | |
392 procedure Put (Item : Character) with | |
393 Post => | |
394 Line_Length'Old = Line_Length | |
395 and Page_Length'Old = Page_Length, | |
396 Global => (In_Out => File_System); | |
209 | 397 |
210 procedure Look_Ahead | 398 procedure Look_Ahead |
211 (File : File_Type; | 399 (File : File_Type; |
212 Item : out Character; | 400 Item : out Character; |
213 End_Of_Line : out Boolean); | 401 End_Of_Line : out Boolean) |
402 with | |
403 Pre => Is_Open (File) and then Mode (File) = In_File, | |
404 Global => (Input => File_System); | |
214 | 405 |
215 procedure Look_Ahead | 406 procedure Look_Ahead |
216 (Item : out Character; | 407 (Item : out Character; |
217 End_Of_Line : out Boolean); | 408 End_Of_Line : out Boolean) |
409 with | |
410 Post => | |
411 Line_Length'Old = Line_Length | |
412 and Page_Length'Old = Page_Length, | |
413 Global => (Input => File_System); | |
218 | 414 |
219 procedure Get_Immediate | 415 procedure Get_Immediate |
220 (File : File_Type; | 416 (File : File_Type; |
221 Item : out Character); | 417 Item : out Character) |
418 with | |
419 Pre => Is_Open (File) and then Mode (File) = In_File, | |
420 Global => (In_Out => File_System); | |
222 | 421 |
223 procedure Get_Immediate | 422 procedure Get_Immediate |
224 (Item : out Character); | 423 (Item : out Character) |
424 with | |
425 Post => | |
426 Line_Length'Old = Line_Length | |
427 and Page_Length'Old = Page_Length, | |
428 Global => (In_Out => File_System); | |
225 | 429 |
226 procedure Get_Immediate | 430 procedure Get_Immediate |
227 (File : File_Type; | 431 (File : File_Type; |
228 Item : out Character; | 432 Item : out Character; |
229 Available : out Boolean); | 433 Available : out Boolean) |
434 with | |
435 Pre => Is_Open (File) and then Mode (File) = In_File, | |
436 Global => (In_Out => File_System); | |
230 | 437 |
231 procedure Get_Immediate | 438 procedure Get_Immediate |
232 (Item : out Character; | 439 (Item : out Character; |
233 Available : out Boolean); | 440 Available : out Boolean) |
441 with | |
442 Post => | |
443 Line_Length'Old = Line_Length | |
444 and Page_Length'Old = Page_Length, | |
445 Global => (In_Out => File_System); | |
234 | 446 |
235 ------------------------- | 447 ------------------------- |
236 -- String Input-Output -- | 448 -- String Input-Output -- |
237 ------------------------- | 449 ------------------------- |
238 | 450 |
239 procedure Get (File : File_Type; Item : out String); | 451 procedure Get (File : File_Type; Item : out String) with |
240 procedure Get (Item : out String); | 452 Pre => Is_Open (File) and then Mode (File) = In_File, |
241 procedure Put (File : File_Type; Item : String); | 453 Global => (In_Out => File_System); |
242 procedure Put (Item : String); | 454 procedure Get (Item : out String) with |
455 Post => | |
456 Line_Length'Old = Line_Length | |
457 and Page_Length'Old = Page_Length, | |
458 Global => (In_Out => File_System); | |
459 procedure Put (File : File_Type; Item : String) with | |
460 Pre => Is_Open (File) and then Mode (File) /= In_File, | |
461 Post => | |
462 Line_Length (File)'Old = Line_Length (File) | |
463 and Page_Length (File)'Old = Page_Length (File), | |
464 Global => (In_Out => File_System); | |
465 procedure Put (Item : String) with | |
466 Post => | |
467 Line_Length'Old = Line_Length | |
468 and Page_Length'Old = Page_Length, | |
469 Global => (In_Out => File_System); | |
243 | 470 |
244 procedure Get_Line | 471 procedure Get_Line |
245 (File : File_Type; | 472 (File : File_Type; |
246 Item : out String; | 473 Item : out String; |
247 Last : out Natural); | 474 Last : out Natural) |
475 with | |
476 Pre => Is_Open (File) and then Mode (File) = In_File, | |
477 Post => (if Item'Length > 0 then Last in Item'First - 1 .. Item'Last | |
478 else Last = Item'First - 1), | |
479 Global => (In_Out => File_System); | |
248 | 480 |
249 procedure Get_Line | 481 procedure Get_Line |
250 (Item : out String; | 482 (Item : out String; |
251 Last : out Natural); | 483 Last : out Natural) |
252 | 484 with |
253 function Get_Line (File : File_Type) return String; | 485 Post => |
486 Line_Length'Old = Line_Length | |
487 and Page_Length'Old = Page_Length | |
488 and (if Item'Length > 0 then Last in Item'First - 1 .. Item'Last | |
489 else Last = Item'First - 1), | |
490 Global => (In_Out => File_System); | |
491 | |
492 function Get_Line (File : File_Type) return String with SPARK_Mode => Off; | |
254 pragma Ada_05 (Get_Line); | 493 pragma Ada_05 (Get_Line); |
255 | 494 |
256 function Get_Line return String; | 495 function Get_Line return String with SPARK_Mode => Off; |
257 pragma Ada_05 (Get_Line); | 496 pragma Ada_05 (Get_Line); |
258 | 497 |
259 procedure Put_Line | 498 procedure Put_Line |
260 (File : File_Type; | 499 (File : File_Type; |
261 Item : String); | 500 Item : String) |
501 with | |
502 Pre => Is_Open (File) and then Mode (File) /= In_File, | |
503 Post => | |
504 Line_Length (File)'Old = Line_Length (File) | |
505 and Page_Length (File)'Old = Page_Length (File), | |
506 Global => (In_Out => File_System); | |
262 | 507 |
263 procedure Put_Line | 508 procedure Put_Line |
264 (Item : String); | 509 (Item : String) |
510 with | |
511 Post => | |
512 Line_Length'Old = Line_Length | |
513 and Page_Length'Old = Page_Length, | |
514 Global => (In_Out => File_System); | |
265 | 515 |
266 --------------------------------------- | 516 --------------------------------------- |
267 -- Generic packages for Input-Output -- | 517 -- Generic packages for Input-Output -- |
268 --------------------------------------- | 518 --------------------------------------- |
269 | 519 |
445 | 695 |
446 Standard_In_AFCB : aliased Text_AFCB; | 696 Standard_In_AFCB : aliased Text_AFCB; |
447 Standard_Out_AFCB : aliased Text_AFCB; | 697 Standard_Out_AFCB : aliased Text_AFCB; |
448 Standard_Err_AFCB : aliased Text_AFCB; | 698 Standard_Err_AFCB : aliased Text_AFCB; |
449 | 699 |
450 Standard_In : aliased File_Type := Standard_In_AFCB'Access; | 700 Standard_In : aliased File_Type := Standard_In_AFCB'Access with |
451 Standard_Out : aliased File_Type := Standard_Out_AFCB'Access; | 701 Part_Of => File_System; |
452 Standard_Err : aliased File_Type := Standard_Err_AFCB'Access; | 702 Standard_Out : aliased File_Type := Standard_Out_AFCB'Access with |
703 Part_Of => File_System; | |
704 Standard_Err : aliased File_Type := Standard_Err_AFCB'Access with | |
705 Part_Of => File_System; | |
453 -- Standard files | 706 -- Standard files |
454 | 707 |
455 Current_In : aliased File_Type := Standard_In; | 708 Current_In : aliased File_Type := Standard_In with |
456 Current_Out : aliased File_Type := Standard_Out; | 709 Part_Of => File_System; |
457 Current_Err : aliased File_Type := Standard_Err; | 710 Current_Out : aliased File_Type := Standard_Out with |
711 Part_Of => File_System; | |
712 Current_Err : aliased File_Type := Standard_Err with | |
713 Part_Of => File_System; | |
458 -- Current files | 714 -- Current files |
459 | 715 |
460 function EOF_Char return Integer; | 716 function EOF_Char return Integer; |
461 -- Returns the system-specific character indicating the end of a text file. | 717 -- Returns the system-specific character indicating the end of a text file. |
462 -- This is exported for use by child packages such as Enumeration_Aux to | 718 -- This is exported for use by child packages such as Enumeration_Aux to |