| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT RUN-TIME COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- A D A . T E X T _ I O . M O D U L A R _ I O -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 1993-2025, Free Software Foundation, Inc. -- |
| 10 |
-- -- |
| 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 -- |
| 13 |
-- apply solely to the contents of the part following the private keyword. -- |
| 14 |
-- -- |
| 15 |
-- GNAT is free software; you can redistribute it and/or modify it under -- |
| 16 |
-- terms of the GNU General Public License as published by the Free Soft- -- |
| 17 |
-- ware Foundation; either version 3, or (at your option) any later ver- -- |
| 18 |
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
| 19 |
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
| 20 |
-- or FITNESS FOR A PARTICULAR PURPOSE. -- |
| 21 |
-- -- |
| 22 |
-- As a special exception under Section 7 of GPL version 3, you are granted -- |
| 23 |
-- additional permissions described in the GCC Runtime Library Exception, -- |
| 24 |
-- version 3.1, as published by the Free Software Foundation. -- |
| 25 |
-- -- |
| 26 |
-- You should have received a copy of the GNU General Public License and -- |
| 27 |
-- a copy of the GCC Runtime Library Exception along with this program; -- |
| 28 |
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- |
| 29 |
-- <http://www.gnu.org/licenses/>. -- |
| 30 |
-- -- |
| 31 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 32 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 33 |
-- -- |
| 34 |
------------------------------------------------------------------------------ |
| 35 |
|
| 36 |
-- In Ada 95, the package Ada.Text_IO.Modular_IO is a subpackage of Text_IO. |
| 37 |
-- This is for compatibility with Ada 83. In GNAT we make it a child package |
| 38 |
-- to avoid loading the necessary code if Modular_IO is not instantiated. |
| 39 |
-- See routine Rtsfind.Check_Text_IO_Special_Unit for a description of how |
| 40 |
-- we patch up the difference in semantics so that it is invisible to the |
| 41 |
-- Ada programmer. |
| 42 |
|
| 43 |
private generic |
| 44 |
type Num is mod <>; |
| 45 |
|
| 46 |
package Ada.Text_IO.Modular_IO with |
| 47 |
Always_Terminates |
| 48 |
is |
| 49 |
|
| 50 |
Default_Width : Field := Num'Width; |
| 51 |
Default_Base : Number_Base := 10; |
| 52 |
|
| 53 |
procedure Get |
| 54 |
(File : File_Type; |
| 55 |
Item : out Num; |
| 56 |
Width : Field := 0) |
| 57 |
with |
| 58 |
Pre => Is_Open (File) and then Mode (File) = In_File, |
| 59 |
Global => (In_Out => File_System), |
| 60 |
Exceptional_Cases => (Data_Error | End_Error => Standard.True); |
| 61 |
|
| 62 |
procedure Get |
| 63 |
(Item : out Num; |
| 64 |
Width : Field := 0) |
| 65 |
with |
| 66 |
Post => |
| 67 |
Line_Length'Old = Line_Length |
| 68 |
and Page_Length'Old = Page_Length, |
| 69 |
Global => (In_Out => File_System), |
| 70 |
Exceptional_Cases => (Data_Error | End_Error => Standard.True); |
| 71 |
|
| 72 |
procedure Put |
| 73 |
(File : File_Type; |
| 74 |
Item : Num; |
| 75 |
Width : Field := Default_Width; |
| 76 |
Base : Number_Base := Default_Base) |
| 77 |
with |
| 78 |
Pre => Is_Open (File) and then Mode (File) /= In_File, |
| 79 |
Post => |
| 80 |
Line_Length (File)'Old = Line_Length (File) |
| 81 |
and Page_Length (File)'Old = Page_Length (File), |
| 82 |
Global => (In_Out => File_System), |
| 83 |
Exceptional_Cases => (Layout_Error => Line_Length (File) /= 0); |
| 84 |
|
| 85 |
procedure Put |
| 86 |
(Item : Num; |
| 87 |
Width : Field := Default_Width; |
| 88 |
Base : Number_Base := Default_Base) |
| 89 |
with |
| 90 |
Post => |
| 91 |
Line_Length'Old = Line_Length |
| 92 |
and Page_Length'Old = Page_Length, |
| 93 |
Global => (In_Out => File_System), |
| 94 |
Exceptional_Cases => (Layout_Error => Line_Length /= 0); |
| 95 |
|
| 96 |
procedure Get |
| 97 |
(From : String; |
| 98 |
Item : out Num; |
| 99 |
Last : out Positive) |
| 100 |
with |
| 101 |
Global => null, |
| 102 |
Exceptional_Cases => (Data_Error => Standard.True); |
| 103 |
|
| 104 |
procedure Put |
| 105 |
(To : out String; |
| 106 |
Item : Num; |
| 107 |
Base : Number_Base := Default_Base) |
| 108 |
with |
| 109 |
Global => null, |
| 110 |
Exceptional_Cases => (Layout_Error => Standard.True); |
| 111 |
|
| 112 |
private |
| 113 |
pragma Inline (Get); |
| 114 |
pragma Inline (Put); |
| 115 |
|
| 116 |
end Ada.Text_IO.Modular_IO; |