On this page
- File_Type
- File_Mode
- Count
- Positive_Count
- Unbounded
- Field
- Number_Base
- Type_Set
- Is_Open
- Mode
- Create
- Open
- Close
- Delete
- Reset
- Reset
- Name
- Form
- Standard_Input
- Standard_Output
- Standard_Error
- Current_Input
- Current_Output
- Current_Error
- Set_Input
- Set_Output
- Set_Error
- Flush
- Flush
- Set_Line_Length
- Set_Line_Length
- Set_Page_Length
- Set_Page_Length
- Line_Length
- Line_Length
- Page_Length
- Page_Length
- New_Line
- New_Line
- Skip_Line
- Skip_Line
- End_Of_Line
- End_Of_Line
- New_Page
- New_Page
- Skip_Page
- Skip_Page
- End_Of_Page
- End_Of_Page
- End_Of_File
- End_Of_File
- Line_Bound
- Page_Bound
- Is_Current
- Is_Current_Input
- Is_Current_Output
- With_Input
- With_Output
- With_Error
- With_Line_Length
- With_Page_Length
- With_Line_Length
- With_Page_Length
- Reset_Of
- Without
- Set_Col
- Set_Col
- Set_Line
- Set_Line
- Col
- Col
- Line
- Line
- Page
- Page
- Get
- Get
- Put
- Put
- Look_Ahead
- Look_Ahead
- Get
- Get
- Put
- Put
- Put_Line
- Put_Line
- Get_Line
- Get_Line
- Get_Line
- Get_Line
- Get_Immediate
- Get_Immediate
- Get_Immediate
- Get_Immediate
Generic package Ada.Text_IO.Wide_Generic
Verada predefined library: the shared implementation of Ada.Wide_Text_IO and Ada.Wide_Wide_Text_IO (Ada RM A.11), each an instance of this generic for its character and string types: all of Text_IO's operations, with characters and strings of Char and Text. A file holds its characters as UTF-8, one column each; bytes that are not UTF-8, and a character above Char'Last, are read as U+FFFD, the replacement character. The files are Text_IO's (its run time and its File_System state), and so are the current input, output and error, which the three units share, and which files are current says what Text_IO's Settings says (Is_Current here is Text_IO's of the file's Text_IO file). Numbers and enumeration values are read and written as Text_IO's generic packages read and write them.
generic
type Char is (<>);
type Text is array (Positive range <>) of Char;File_Type
type File_Type is limited private
with Default_Initial_Condition => not Is_Open (File_Type);(a file object is closed until Create or Open opens it)
File_Mode
type File_Mode is (In_File, Out_File, Append_File);Count
type Count is range 0 .. Natural'Last;Positive_Count
subtype Positive_Count is Count range 1 .. Count'Last;Unbounded
Unbounded : constant Count := 0;Field
subtype Field is Integer range 0 .. Integer'Last;Number_Base
subtype Number_Base is Integer range 2 .. 16;Type_Set
type Type_Set is (Lower_Case, Upper_Case);Status_Error : exception renames Ada.IO_Exceptions.Status_Error;Mode_Error : exception renames Ada.IO_Exceptions.Mode_Error;Name_Error : exception renames Ada.IO_Exceptions.Name_Error;Use_Error : exception renames Ada.IO_Exceptions.Use_Error;Device_Error : exception renames Ada.IO_Exceptions.Device_Error;End_Error : exception renames Ada.IO_Exceptions.End_Error;Data_Error : exception renames Ada.IO_Exceptions.Data_Error;Layout_Error : exception renames Ada.IO_Exceptions.Layout_Error;Is_Open
function Is_Open (File : File_Type) return Boolean
with Global => null;Mode
function Mode (File : File_Type) return File_Mode
with Pre => Is_Open (File), Global => null;Create
procedure Create (File : in out File_Type; Mode : File_Mode := Out_File; Name : String := ""; Form : String := "")
with Post => Settings = Settings'Old and then Is_Open (File) and then Wide_Generic.Mode (File) = Mode
and then Line_Bound (File) = 0 and then Page_Bound (File) = 0
and then not Is_Current (File),
Global => (In_Out => File_System),
Exceptional_Cases => (Status_Error => Is_Open (File)'Old,
Name_Error | Use_Error => Settings = Settings'Old and then not Is_Open (File));a new file (an empty Name: a temporary one, deleted when it is closed), open in Mode; or, when it cannot be made, Name_Error or Use_Error and the file still closed
Open
procedure Open (File : in out File_Type; Mode : File_Mode; Name : String; Form : String := "")
with Post => Settings = Settings'Old and then Is_Open (File) and then Wide_Generic.Mode (File) = Mode
and then Line_Bound (File) = 0 and then Page_Bound (File) = 0
and then not Is_Current (File),
Global => (In_Out => File_System),
Exceptional_Cases => (Status_Error => Is_Open (File)'Old,
Name_Error | Use_Error => Settings = Settings'Old and then not Is_Open (File));an existing file, open in Mode; or Name_Error (there is no such file) or Use_Error
Close
procedure Close (File : in out File_Type)
with Post => Settings = Without (Settings, File)'Old and then not Is_Open (File),
Global => (In_Out => File_System),
Exceptional_Cases => (Status_Error => not Is_Open (File)'Old);(an output file's last line is ended first; where it was current, the standard file is current again)
Delete
procedure Delete (File : in out File_Type)
with Post => Settings = Without (Settings, File)'Old and then not Is_Open (File),
Global => (In_Out => File_System),
Exceptional_Cases => (Status_Error => not Is_Open (File)'Old,
Use_Error => Settings = Without (Settings, File)'Old and then not Is_Open (File));the file closed and deleted; Use_Error when it cannot be deleted
Reset
procedure Reset (File : in out File_Type; Mode : File_Mode)
with Post => Settings = Reset_Of (Settings, File)'Old and Is_Current (File) = Is_Current (File)'Old
and (Is_Open (File) and then Wide_Generic.Mode (File) = Mode
and then Line_Bound (File) = 0 and then Page_Bound (File) = 0),
Global => (In_Out => File_System),
Exceptional_Cases => (Status_Error => not Is_Open (File)'Old,
Mode_Error => Is_Current (File)'Old and then Is_Open (File)
and then Mode /= Wide_Generic.Mode (File),
Use_Error => Settings = Without (Settings, File)'Old and then not Is_Open (File));the file again from its start, in Mode (its mode when none is given); Use_Error when it cannot be, the file then closed; Mode_Error when the file is a current default file and Mode is not its mode (RM A.10.2(4)), the file left as it was
Reset
procedure Reset (File : in out File_Type)
with Post => Settings = Reset_Of (Settings, File)'Old and Is_Current (File) = Is_Current (File)'Old
and (Mode (File)'Old = Mode (File) and then Is_Open (File)
and then Line_Bound (File) = 0 and then Page_Bound (File) = 0),
Global => (In_Out => File_System),
Exceptional_Cases => (Status_Error => not Is_Open (File)'Old,
Use_Error => Settings = Without (Settings, File)'Old and then not Is_Open (File));Name
function Name (File : File_Type) return String
with Pre => Is_Open (File), Global => File_System,
Post => Name'Result'Length < Verada.Storage.Length_Bound;the file's name (a temporary file's own), and its form: Verada takes none
Form
function Form (File : File_Type) return String
with Pre => Is_Open (File), Global => null,
Post => Form'Result'Length = 0;Standard_Input
function Standard_Input return File_Type
with Global => null,
Post => Is_Open (Standard_Input'Result) and then Mode (Standard_Input'Result) = In_File;Standard_Output
function Standard_Output return File_Type
with Global => null,
Post => Is_Open (Standard_Output'Result) and then Mode (Standard_Output'Result) = Out_File;Standard_Error
function Standard_Error return File_Type
with Global => null,
Post => Is_Open (Standard_Error'Result) and then Mode (Standard_Error'Result) = Out_File;Current_Input
function Current_Input return File_Type
with Global => File_System,
Post => Is_Open (Current_Input'Result) and then Mode (Current_Input'Result) = In_File;Current_Output
function Current_Output return File_Type
with Global => File_System,
Post => Is_Open (Current_Output'Result) and then Mode (Current_Output'Result) /= In_File;Current_Error
function Current_Error return File_Type
with Global => File_System,
Post => Is_Open (Current_Error'Result) and then Mode (Current_Error'Result) /= In_File;Set_Input
procedure Set_Input (File : File_Type)
with Global => (In_Out => File_System),
Post => Settings = With_Input (Settings'Old, File),
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File);Set_Output
procedure Set_Output (File : File_Type)
with Global => (In_Out => File_System),
Post => Settings = With_Output (Settings'Old, File),
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File);Set_Error
procedure Set_Error (File : File_Type)
with Global => (In_Out => File_System),
Post => Settings = With_Error (Settings'Old, File),
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File);Flush
procedure Flush (File : File_Type)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File);Flush
procedure Flush
with Global => (In_Out => File_System),
Post => Settings = Settings'Old;Set_Line_Length
procedure Set_Line_Length (File : File_Type; To : Count)
with Global => (In_Out => File_System),
Post => Settings = With_Line_Length (Settings, File, To)'Old
and Line_Bound (File) = To and Page_Bound (File) = Page_Bound (File)'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File);Set_Line_Length
procedure Set_Line_Length (To : Count)
with Global => (In_Out => File_System),
Post => Settings = With_Line_Length (Settings'Old, To)
and then Wide_Generic.Line_Length = To;Set_Page_Length
procedure Set_Page_Length (File : File_Type; To : Count)
with Global => (In_Out => File_System),
Post => Settings = With_Page_Length (Settings, File, To)'Old
and Page_Bound (File) = To and Line_Bound (File) = Line_Bound (File)'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File);Set_Page_Length
procedure Set_Page_Length (To : Count)
with Global => (In_Out => File_System),
Post => Settings = With_Page_Length (Settings'Old, To)
and then Wide_Generic.Page_Length = To;Line_Length
function Line_Length (File : File_Type) return Count
with Pre => Is_Open (File) and then Mode (File) /= In_File, Global => File_System,
Post => (if Is_Current_Output (File) then Line_Length'Result = Wide_Generic.Line_Length);(the current output's are the default forms')
Line_Length
function Line_Length return Count
with Global => File_System;Page_Length
function Page_Length (File : File_Type) return Count
with Pre => Is_Open (File) and then Mode (File) /= In_File, Global => File_System,
Post => (if Is_Current_Output (File) then Page_Length'Result = Wide_Generic.Page_Length);Page_Length
function Page_Length return Count
with Global => File_System;New_Line
procedure New_Line (File : File_Type; Spacing : Positive_Count := 1)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File);Spacing line terminators (and a page terminator after a page's last line)
New_Line
procedure New_Line (Spacing : Positive_Count := 1)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old;Skip_Line
procedure Skip_Line (File : File_Type; Spacing : Positive_Count := 1)
with Pre => Is_Open (File) and then Mode (File) = In_File,
Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (End_Error => Settings = Settings'Old and (End_Of_File (File)'Old or else Spacing > 1));past Spacing line terminators; End_Error when the file ends before the last (at its end on entry, or later when Spacing is above 1). (Its End_Error case names End_Of_File on entry, which needs the file open for input: so that is a precondition here, as for Skip_Page and the procedure Get_Line, rather than Status_Error and Mode_Error.)
Skip_Line
procedure Skip_Line (Spacing : Positive_Count := 1)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (End_Error => Settings = Settings'Old and (End_Of_File'Old or else Spacing > 1));End_Of_Line
function End_Of_Line (File : File_Type) return Boolean
with Pre => Is_Open (File) and then Mode (File) = In_File, Global => File_System,
Post => (if Is_Current_Input (File) then End_Of_Line'Result = Wide_Generic.End_Of_Line);End_Of_Line
function End_Of_Line return Boolean
with Global => File_System;New_Page
procedure New_Page (File : File_Type)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File);a page terminator (the current line ended first)
New_Page
procedure New_Page
with Global => (In_Out => File_System),
Post => Settings = Settings'Old;Skip_Page
procedure Skip_Page (File : File_Type)
with Pre => Is_Open (File) and then Mode (File) = In_File,
Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (End_Error => Settings = Settings'Old and End_Of_File (File)'Old);past the next page terminator (or to the end of the file); End_Error when the file is at its end on entry
Skip_Page
procedure Skip_Page
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (End_Error => Settings = Settings'Old and End_Of_File'Old);End_Of_Page
function End_Of_Page (File : File_Type) return Boolean
with Pre => Is_Open (File) and then Mode (File) = In_File, Global => File_System,
Post => (if Is_Current_Input (File) then End_Of_Page'Result = Wide_Generic.End_Of_Page);End_Of_Page
function End_Of_Page return Boolean
with Global => File_System;End_Of_File
function End_Of_File (File : File_Type) return Boolean
with Pre => Is_Open (File) and then Mode (File) = In_File, Global => File_System,
Post => (if Is_Current_Input (File) then End_Of_File'Result = Wide_Generic.End_Of_File);End_Of_File
function End_Of_File return Boolean
with Global => File_System;Line_Bound
function Line_Bound (File : File_Type) return Count
with Ghost, Global => File_System,
Post => Line_Bound'Result = (if Is_Open (File) and then Mode (File) /= In_File then Line_Length (File) else 0);(for contracts: the line length, or the page length, of a file open for output; 0, as for no bound, for a file that is not)
Page_Bound
function Page_Bound (File : File_Type) return Count
with Ghost, Global => File_System,
Post => Page_Bound'Result = (if Is_Open (File) and then Mode (File) /= In_File then Page_Length (File) else 0);Is_Current
function Is_Current (File : File_Type) return Boolean
with Ghost, Global => File_System;(for contracts: Text_IO's, of the file's Text_IO file: whether File is a current default file, or the current input or output, and the current files after Set_Input, Set_Output or Set_Error of File, or after File is closed)
Is_Current_Input
function Is_Current_Input (File : File_Type) return Boolean
with Ghost, Global => File_System;Is_Current_Output
function Is_Current_Output (File : File_Type) return Boolean
with Ghost, Global => File_System;With_Input
function With_Input (Files : File_Settings; File : File_Type) return File_Settings
with Ghost, Global => null;With_Output
function With_Output (Files : File_Settings; File : File_Type) return File_Settings
with Ghost, Global => null;With_Error
function With_Error (Files : File_Settings; File : File_Type) return File_Settings
with Ghost, Global => null;With_Line_Length
function With_Line_Length (Files : File_Settings; File : File_Type; To : Count) return File_Settings
with Ghost, Global => null;With_Page_Length
function With_Page_Length (Files : File_Settings; File : File_Type; To : Count) return File_Settings
with Ghost, Global => null;With_Line_Length
function With_Line_Length (Files : File_Settings; To : Count) return File_Settings
with Ghost, Global => null;(the current output's)
With_Page_Length
function With_Page_Length (Files : File_Settings; To : Count) return File_Settings
with Ghost, Global => null;Reset_Of
function Reset_Of (Files : File_Settings; File : File_Type) return File_Settings
with Ghost, Global => null;Without
function Without (Files : File_Settings; File : File_Type) return File_Settings
with Ghost, Global => null;Set_Col
procedure Set_Col (File : File_Type; To : Positive_Count)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Layout_Error => Settings = Settings'Old and (Line_Bound (File)'Old /= 0 and then To > Line_Bound (File)'Old),
End_Error => Settings = Settings'Old and then Is_Open (File) and then Mode (File) = In_File);output: spaces (after a new line, when past it) up to column To; Layout_Error when the line length is bounded and To is beyond it (never for column 1). Input: characters skipped up to column To; End_Error when the file ends first
Set_Col
procedure Set_Col (To : Positive_Count)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Layout_Error => Settings = Settings'Old and (Wide_Generic.Line_Length'Old /= 0 and then To > Wide_Generic.Line_Length'Old));Set_Line
procedure Set_Line (File : File_Type; To : Positive_Count)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Layout_Error => Settings = Settings'Old and (Page_Bound (File)'Old /= 0 and then To > Page_Bound (File)'Old),
End_Error => Settings = Settings'Old and then Is_Open (File) and then Mode (File) = In_File);output: new lines (after a new page, when past it) up to line To; Layout_Error when the page length is bounded and To is beyond it (never for line 1). Input: lines skipped up to line To; End_Error when the file ends first
Set_Line
procedure Set_Line (To : Positive_Count)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Layout_Error => Settings = Settings'Old and (Wide_Generic.Page_Length'Old /= 0 and then To > Wide_Generic.Page_Length'Old));Col
function Col (File : File_Type) return Positive_Count
with Pre => Is_Open (File), Global => File_System,
Post => (if Is_Current_Output (File) then Col'Result = Wide_Generic.Col);Col
function Col return Positive_Count
with Global => File_System;Line
function Line (File : File_Type) return Positive_Count
with Pre => Is_Open (File), Global => File_System,
Post => (if Is_Current_Output (File) then Line'Result = Wide_Generic.Line);Line
function Line return Positive_Count
with Global => File_System;Page
function Page (File : File_Type) return Positive_Count
with Pre => Is_Open (File), Global => File_System,
Post => (if Is_Current_Output (File) then Page'Result = Wide_Generic.Page);Page
function Page return Positive_Count
with Global => File_System;Get
procedure Get (File : File_Type; Item : out Char)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
End_Error => Settings = Settings'Old);the next character, line and page terminators skipped; End_Error at the file's end
Get
procedure Get (Item : out Char)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (End_Error => Settings = Settings'Old);Put
procedure Put (File : File_Type; Item : Char)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File);Put
procedure Put (Item : Char)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old;Look_Ahead
procedure Look_Ahead (File : File_Type; Item : out Char; End_Of_Line : out Boolean)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File);the next character, not taken, or End_Of_Line when the line has ended
Look_Ahead
procedure Look_Ahead (Item : out Char; End_Of_Line : out Boolean)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old;Get
procedure Get (File : File_Type; Item : out Text)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
End_Error => Settings = Settings'Old);Item'Length characters, as Get reads them
Get
procedure Get (Item : out Text)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (End_Error => Settings = Settings'Old);Put
procedure Put (File : File_Type; Item : Text)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File);Put
procedure Put (Item : Text)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old;Put_Line
procedure Put_Line (File : File_Type; Item : Text)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File);Put_Line
procedure Put_Line (Item : Text)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old;Get_Line
procedure Get_Line (File : File_Type; Item : out Text; Last : out Natural)
with Pre => Is_Open (File) and then Mode (File) = In_File and then Item'First > 0,
Post => Settings = Settings'Old
and then (if Item'Length > 0 then Last in Item'First - 1 .. Item'Last else Last = Item'First - 1),
Global => (In_Out => File_System),
Exceptional_Cases => (End_Error => Settings = Settings'Old and End_Of_File (File)'Old);a line's characters to Item from Item'First, and Last the index of the last one (Item'First - 1 for none); the line terminator is skipped when it is reached (not when Item is filled just before it). End_Error when no line is left to read (the file at its end on entry); an empty Item reads nothing
Get_Line
procedure Get_Line (Item : out Text; Last : out Natural)
with Pre => Item'First > 0,
Post => Settings = Settings'Old
and then (if Item'Length > 0 then Last in Item'First - 1 .. Item'Last else Last = Item'First - 1),
Global => (In_Out => File_System),
Exceptional_Cases => (End_Error => Settings = Settings'Old and End_Of_File'Old);Get_Line
function Get_Line return Text
with Side_Effects, Pre => not End_Of_File, Global => (In_Out => File_System),
Post => Settings = Settings'Old
and then Get_Line'Result'Length < Verada.Storage.Length_Bound;a line of any length: a function with side effects, since each call reads the next line, so it is called only as a declaration's or an assignment's value; a function propagates no exception, so a line must be left to read
Get_Line
function Get_Line (File : File_Type) return Text
with Side_Effects, Pre => Is_Open (File) and then Mode (File) = In_File and then not End_Of_File (File),
Global => (In_Out => File_System),
Post => Settings = Settings'Old
and then Get_Line'Result'Length < Verada.Storage.Length_Bound;Get_Immediate
procedure Get_Immediate (File : File_Type; Item : out Char)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
End_Error => Settings = Settings'Old);the next character, a control character (a line or page terminator's) too, at once (RM A.10.7); End_Error at the file's end
Get_Immediate
procedure Get_Immediate (Item : out Char)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (End_Error => Settings = Settings'Old);Get_Immediate
procedure Get_Immediate (File : File_Type; Item : out Char; Available : out Boolean)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
End_Error => Settings = Settings'Old);the same without waiting: Available is False when no character has arrived yet (a file's are always there; standard input's when it has been typed), Item then ' '
Get_Immediate
procedure Get_Immediate (Item : out Char; Available : out Boolean)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (End_Error => Settings = Settings'Old);generic
type Num is range <>;
package Integer_IO is
Default_Width : Field := Num'Width;
Default_Base : Number_Base := 10;
procedure Get (File : File_Type; Item : out Num; Width : Field := 0)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
Data_Error | End_Error => Settings = Settings'Old);
procedure Get (Item : out Num; Width : Field := 0)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Data_Error | End_Error => Settings = Settings'Old);
-- (for contracts: how many characters Put writes for Item, Width and Base)
function Put_Length (Item : Num; Width : Field; Base : Number_Base) return Count
with Ghost, Global => null,
Post => Put_Length'Result >= Count (Width) and then Put_Length'Result <= Count (Integer'Max (Width, 133));
procedure Put (File : File_Type; Item : Num; Width : Field := Default_Width; Base : Number_Base := Default_Base)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File,
Layout_Error => Settings = Settings'Old
and (Line_Bound (File)'Old /= 0
and then Put_Length (Item, Width, Base) > Line_Bound (File)'Old));
procedure Put (Item : Num; Width : Field := Default_Width; Base : Number_Base := Default_Base)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Layout_Error => Settings = Settings'Old
and (Count'(Line_Length)'Old /= 0
and then Put_Length (Item, Width, Base) > Count'(Line_Length)'Old));
procedure Get (From : Text; Item : out Num; Last : out Positive)
with Global => null,
Post => Last in From'Range,
Exceptional_Cases => (Data_Error | End_Error => True);
procedure Put (To : out Text; Item : Num; Base : Number_Base := Default_Base)
with Global => null,
Exceptional_Cases => (Layout_Error => True);
end Integer_IO;generic
type Num is mod <>;
package Modular_IO is
Default_Width : Field := Num'Width;
Default_Base : Number_Base := 10;
procedure Get (File : File_Type; Item : out Num; Width : Field := 0)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
Data_Error | End_Error => Settings = Settings'Old);
procedure Get (Item : out Num; Width : Field := 0)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Data_Error | End_Error => Settings = Settings'Old);
-- (for contracts: how many characters Put writes for Item, Width and Base)
function Put_Length (Item : Num; Width : Field; Base : Number_Base) return Count
with Ghost, Global => null,
Post => Put_Length'Result >= Count (Width) and then Put_Length'Result <= Count (Integer'Max (Width, 133));
procedure Put (File : File_Type; Item : Num; Width : Field := Default_Width; Base : Number_Base := Default_Base)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File,
Layout_Error => Settings = Settings'Old
and (Line_Bound (File)'Old /= 0
and then Put_Length (Item, Width, Base) > Line_Bound (File)'Old));
procedure Put (Item : Num; Width : Field := Default_Width; Base : Number_Base := Default_Base)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Layout_Error => Settings = Settings'Old
and (Count'(Line_Length)'Old /= 0
and then Put_Length (Item, Width, Base) > Count'(Line_Length)'Old));
procedure Get (From : Text; Item : out Num; Last : out Positive)
with Global => null,
Post => Last in From'Range,
Exceptional_Cases => (Data_Error | End_Error => True);
procedure Put (To : out Text; Item : Num; Base : Number_Base := Default_Base)
with Global => null,
Exceptional_Cases => (Layout_Error => True);
end Modular_IO;generic
type Num is digits <>;
package Float_IO is
Default_Fore : Field := 2;
Default_Aft : Field := Num'Digits - 1;
Default_Exp : Field := 3;
procedure Get (File : File_Type; Item : out Num; Width : Field := 0)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
Data_Error | End_Error => Settings = Settings'Old);
procedure Get (Item : out Num; Width : Field := 0)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Data_Error | End_Error => Settings = Settings'Old);
-- (for contracts: how many characters Put writes for Item, Fore, Aft and Exp)
function Put_Length (Item : Num; Fore, Aft, Exp : Field) return Count
with Ghost, Global => null;
procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File,
Layout_Error => Settings = Settings'Old
and (Line_Bound (File)'Old /= 0
and then Put_Length (Item, Fore, Aft, Exp) > Line_Bound (File)'Old));
procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Layout_Error => Settings = Settings'Old
and (Count'(Line_Length)'Old /= 0
and then Put_Length (Item, Fore, Aft, Exp) > Count'(Line_Length)'Old));
procedure Get (From : Text; Item : out Num; Last : out Positive)
with Global => null,
Post => Last in From'Range,
Exceptional_Cases => (Data_Error | End_Error => True);
procedure Put (To : out Text; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp)
with Global => null,
Exceptional_Cases => (Layout_Error => True);
end Float_IO;floating point: Put writes Fore characters before the point (the sign among them), Aft digits after it, and, when Exp is not 0, an exponent of Exp characters (its sign among them); the digits are the value's, correctly rounded
generic
type Num is delta <>;
package Fixed_IO is
Default_Fore : Field := Num'Fore;
Default_Aft : Field := Num'Aft;
Default_Exp : Field := 0;
procedure Get (File : File_Type; Item : out Num; Width : Field := 0)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
Data_Error | End_Error => Settings = Settings'Old);
procedure Get (Item : out Num; Width : Field := 0)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Data_Error | End_Error => Settings = Settings'Old);
-- (for contracts: how many characters Put writes for Item, Fore, Aft and Exp)
function Put_Length (Item : Num; Fore, Aft, Exp : Field) return Count
with Ghost, Global => null;
procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File,
Layout_Error => Settings = Settings'Old
and (Line_Bound (File)'Old /= 0
and then Put_Length (Item, Fore, Aft, Exp) > Line_Bound (File)'Old));
procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Layout_Error => Settings = Settings'Old
and (Count'(Line_Length)'Old /= 0
and then Put_Length (Item, Fore, Aft, Exp) > Count'(Line_Length)'Old));
procedure Get (From : Text; Item : out Num; Last : out Positive)
with Global => null,
Post => Last in From'Range,
Exceptional_Cases => (Data_Error | End_Error => True);
procedure Put (To : out Text; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp)
with Global => null,
Exceptional_Cases => (Layout_Error => True);
end Fixed_IO;fixed point: as floating point, the digits the value's exactly, rounded to the nearest (halves away from zero); a value read is truncated to a multiple of the small, as a conversion to the type is
generic
type Num is delta <> digits <>;
package Decimal_IO is
Default_Fore : Field := Num'Fore;
Default_Aft : Field := Num'Aft;
Default_Exp : Field := 0;
procedure Get (File : File_Type; Item : out Num; Width : Field := 0)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
Data_Error | End_Error => Settings = Settings'Old);
procedure Get (Item : out Num; Width : Field := 0)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Data_Error | End_Error => Settings = Settings'Old);
-- (for contracts: how many characters Put writes for Item, Fore, Aft and Exp)
function Put_Length (Item : Num; Fore, Aft, Exp : Field) return Count
with Ghost, Global => null;
procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File,
Layout_Error => Settings = Settings'Old
and (Line_Bound (File)'Old /= 0
and then Put_Length (Item, Fore, Aft, Exp) > Line_Bound (File)'Old));
procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Layout_Error => Settings = Settings'Old
and (Count'(Line_Length)'Old /= 0
and then Put_Length (Item, Fore, Aft, Exp) > Count'(Line_Length)'Old));
procedure Get (From : Text; Item : out Num; Last : out Positive)
with Global => null,
Post => Last in From'Range,
Exceptional_Cases => (Data_Error | End_Error => True);
procedure Put (To : out Text; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp)
with Global => null,
Exceptional_Cases => (Layout_Error => True);
end Decimal_IO;decimal fixed point: as fixed point
generic
type Enum is (<>);
package Enumeration_IO is
Default_Width : Field := 0;
Default_Setting : Type_Set := Upper_Case;
procedure Get (File : File_Type; Item : out Enum)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
Data_Error | End_Error => Settings = Settings'Old);
procedure Get (Item : out Enum)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Data_Error | End_Error => Settings = Settings'Old);
-- (for contracts: how many characters Put writes for Item and Width)
function Put_Length (Item : Enum; Width : Field) return Count
with Ghost, Global => null,
Post => Put_Length'Result >= Count (Width);
procedure Put (File : File_Type; Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Status_Error => not Is_Open (File),
Mode_Error => Is_Open (File) and then Mode (File) = In_File,
Layout_Error => Settings = Settings'Old
and (Line_Bound (File)'Old /= 0
and then Put_Length (Item, Width) > Line_Bound (File)'Old));
procedure Put (Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting)
with Global => (In_Out => File_System),
Post => Settings = Settings'Old,
Exceptional_Cases => (Layout_Error => Settings = Settings'Old
and (Count'(Line_Length)'Old /= 0
and then Put_Length (Item, Width) > Count'(Line_Length)'Old));
procedure Get (From : Text; Item : out Enum; Last : out Positive)
with Global => null,
Post => Last in From'Range,
Exceptional_Cases => (Data_Error | End_Error => True);
procedure Put (To : out Text; Item : Enum; Set : Type_Set := Default_Setting)
with Global => null,
Exceptional_Cases => (Layout_Error => True);
end Enumeration_IO;enumeration values: Put writes the literal in Set's case (a character literal as it is), left-justified in Width characters