DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ T ┃
Length: 111731 (0x1b473) Types: TextFile Names: »TIO_HELP«
└─⟦5f3412b64⟧ Bits:30000745 8mm tape, Rational 1000, ENVIRONMENT 12_6_5 TOOLS └─ ⟦91c658230⟧ »DATA« └─⟦f6fec0485⟧ └─⟦this⟧ └─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3 └─ ⟦fc9b38f02⟧ »DATA« └─⟦f95d63c89⟧ └─⟦this⟧
@node !Io.Io This package provides a superset of the capabilities required for Text_Io in the Ada Language Reference Manual, Chapter 14. In addition to the nested generic packages that deal with I/O for arbitrary discrete or real types, package Io provides virtually preinstantiated operations for the Standard.Integer, Standard.Float, and Standard.Boolean types. The fundamental abstraction provided by package Io is the File_Type type. Objects of this type denote file handles that can be mapped to external files. Each file is read or written sequentially, as a sequence of characters grouped into lines and a sequence of lines grouped into pages. Conversion operations are provided to convert Text_Io file handles to Io file handles and vice versa (as well as Device_Independent_Io files). At the beginning of program execution, the default input and output files are the standard input file and standard output file. These files are open, have the In_File and Out_File modes, respectively, and are associated with two implementation-defined external files. These files are implicitly closed at the end of each job. Package Io also introduces the notion of the standard error file, which follows the same semantics as the standard output file, except that it maps to the Message window by default. From a logical point of view, a text file is a sequence of pages, a page is a sequence of lines, and a line is a sequence of characters. The characters of a line are numbered, starting from 1; the number of a character is called its column number. For a line terminator, a column number is also defined; it is one more than the number of characters in the line. The lines of a page, and the pages of a file, are similarly numbered. The current column number is the column number of the next character or line terminator to be transferred. The current line number is the number of the current line. The current page number is the number of the current page. These numbers are values of the Positive_Count subtype of the Count subtype (by convention, the value 0 of the Count subtype is used to indicate special conditions). For an output file, a maximum line length and a maximum page length can be specified. If a value to be output cannot fit on the current line, for a specified maximum line length, then a new line is automatically started before the value is output. Further, if this new line cannot fit on the current page, for a specified maximum page length, then a new page is automatically started before the value is output. Functions are provided to determine the maximum line length and the maximum page length. When a file is opened with the Out_File mode, both values are 0; by convention, this means that the line lengths and page lengths are unbounded. (Consequently, output consists of a single line if the subprograms for explicit control of line and page structure are not used.) The Unbounded constant is provided for this purpose. Package Io provides a stack mechanism for managing current I/O files. This is the same mechanism that is accessible with the operations in package Log (SJM). It can be used, for example, in managing output or log files and the like when nested calls to output or logging procedures need to be coordinated. This mechanism allows all I/O to be performed on the current input, output, and error files. It provides push operations (the Set_Input, Set_Output, and Set_Error procedures) that push files on the stack and make them the current input, output, and error files. Pop and reset operations are also provided. Pop removes a file from the stack. Reset is equivalent to performing a close operation and then a pop of the top element of the stack. Any files on the stack when a job terminates are automatically closed. The package also provides a generic iterator, the Wildcard_Iterator procedure, that can be used to perform a generic operation on a set of files matching a wildcard. @node !Io.Io."=" function "=" (L, R : Count) return Boolean renames Text_Io."="; function "=" (L, R : File_Mode) return Boolean renames Text_Io."="; function "=" (L, R : Type_Set) return Boolean renames Text_Io."="; Gives visibility to the Text_Io equality operators. @node !Io.Io."<" function "<" (L, R : Count) return Boolean renames Text_Io."<"; Gives visibility to the Text_Io comparison operator. @node !Io.Io.">" function ">" (L, R : Count) return Boolean renames Text_Io.">"; Gives visibility to the Text_Io comparison operator. @node !Io.Io.Append procedure Append (File : in out File_Type; Name : String; Form : String := ""); procedure Append (File : in out File_Type; Object : Directory.Version; Form : String := ""); Opens the specified file for writing at the end of the file. This procedure associates the specified file with an existing file having the specified name and form; if a file does not exist, it creates one. The current mode of the file is set to Out_File. Output starting after an Append procedure will begin on a new line but on the same page as the previous end of the file. The specified file is left open. After the file is opened, the page and line lengths are unbounded, and the current line and current page numbers are set to the current size of the file. @node !Io.Io.Close procedure Close (File : in out File_Type); Severs the association between the file handle and its associated file. If the file has the current Out_File mode, it has the effect of calling the New_Page procedure. If the current page is already terminated, the procedure outputs a file terminator. @node !Io.Io.Col function Col (File : File_Type) return Positive_Count; function Col return Positive_Count; Returns the current column number. If a File parameter is omitted, the default file is the current output file. @node !Io.Io.Convert function Convert (File: File_Type) return Text_Io.File_Type; function Convert (File: Text_Io.File_Type) return File_Type; Converts a file handle of Io.File_Type to Text_Io.File_Type and vice versa. When one type is converted to another, all file attributes are maintained. @node !Io.Io.Convert function Convert (File: File_Type) return Device_Independent_Io.File_Type; function Convert (File: Device_Independent_Io.File_Type) return File_Type; Converts a file handle of Io.File_Type to !Io.Device_Independent_Io.File_Type and vice versa to allow ac- cess to device-specific options when the file is opened. @node !Io.Io.Convert procedure Convert (From : Device_Independent_Io.File_Type; To : in out Text_Io.File_Type); Converts a file handle of !Io.Device_Independent_Io.File_Type to Text_Io.File_Type. This procedure can be used, for example, to save file handles in variables of Text_Io.File_Type type, which are limited private. @node !Io.Io.Count subtype Count is Text_Io.Count; Specifies the range of possible values of the line and page count and the line and page length. @node !Io.Io.Create procedure Create (File : in out File_Type; Mode : File_Mode := Out_File; Name : String := ""; Form : String := ""); Establishes a new file with the specified name and associates this file with the specified file handle. The specified file is left open. @node !Io.Io.Current_Error function Current_Error return File_Type; function Current_Error return Text_Io.File_Type; Returns the handle to the current default error file. @node !Io.Io.Current_Input function Current_Input return File_Type; Returns the handle to the current default input file. @node !Io.Io.Current_Output function Current_Output return File_Type; Returns the handle to the current default output file. @node !Io.Io.Delete procedure Delete (File : in out File_Type); Deletes the file associated with the specified file handle. The file handle is closed, and the file ceases to exist. @node !Io.Io.Echo procedure Echo (Item : Character); Writes a character to the current error file (by default, the Message window). If the line length of the specified output file is bounded (that is, does not have the conventional value of 0) and the current column number exceeds it, this procedure has the effect of calling the New_Line procedure with a spacing of 1 for the current error file. Then the procedure outputs the specified character to the file. @node !Io.Io.Echo procedure Echo (Item : String := ""); Writes a string to the current error file (by default, the Message window). This procedure determines the length of the specified string and attempts that number of echo operations for successive characters of the string. No operation is performed if the string is null. @node !Io.Io.Echo procedure Echo (Item : Integer; Width : Field := 0; Base : Number_Base := 10); Writes an integer value to the current error file (by default, the Message window). Values are output as decimal or based literals, without underline characters or exponents, and are preceded by a minus sign if negative. The format (which includes any leading spaces and a minus sign) can be specified by an optional field Width parameter. Values of widths of fields in output formats are of the nonnegative integer Field subtype. Values of bases are of the integer Number_Base subtype. This procedure outputs the value of the Item parameter as an integer literal, with no underlines, no exponent, and no leading zeros (but a single zero for the value 0), and with a preceding minus sign for a negative value. If the resulting sequence of characters to be output has fewer characters than specified in the Width parameter, leading spaces are output to make up the difference. The procedure uses the syntax for decimal literal if the Base parameter has the value 10; otherwise, it uses the syntax for based literal, with any letters in uppercase. @node !Io.Io.Echo procedure Echo (Item : Float; Fore : Field := 2; Aft : Field := 14; Exp : Field := 3); Writes a floating-point value to the current error file (by default, the Message window). Values are output as decimal literals without underline characters. The format of each value output consists of a Fore field, a decimal point, an Aft field, and (if a nonzero Exp parameter is supplied) the letter E and an Exp field. The two possible formats thus correspond to: Fore . Aft and: Fore . Aft E Exp with no spaces between these fields. The Fore field can include leading spaces and a minus sign for negative values. The Aft field includes only decimal digits (possibly with trailing zeros). The Exp field includes the sign (plus or minus) and the exponent (possibly with leading zeros). The Echo procedure outputs the value of the Item parameter as a decimal literal with the format defined by the Fore, Aft, and Exp parameters. If the value is negative, a minus sign is included in the integer part. If Exp has the value 0, then the integer part to be output has as many digits as needed to represent the integer part of the value of the Item parameter, overriding Fore if necessary, or it consists of the digit 0 if the value of Item has no integer part. If Exp has a value greater than 0, the integer part to be output has a single digit, which is nonzero except for the value 0.0 of the Item parameter. In both cases, however, if the integer part to be output has fewer than Fore characters, including any minus sign, leading spaces are output to make up the difference. The number of digits of the fractional part is specified by Aft, or it is 1 if Aft equals 0. The value is rounded; a value of exactly one-half in the last place can be rounded either up or down. If Exp has the value 0, there is no exponent part. If Exp has a value greater than 0, the exponent part to be output has as many digits as needed to represent the exponent part of the value of the Item parameter (for which a single-digit integer part is used), and it includes an initial sign (plus or minus). If the exponent part to be output has fewer than Exp characters, including the sign, leading zeros precede the digits to make up the difference. For the value 0.0 of the Item parameter, the exponent has the value 0. @node !Io.Io.Echo procedure Echo (Item : Boolean; Width : Field := 0); Writes the Boolean value to the current error file (by default, the Message window). Values are output using either uppercase or lowercase letters for identifiers. The format (which includes any trailing spaces) can be specified by an optional field Width parameter. The procedure outputs the value of the Item parameter as an enumeration literal. If the sequence of characters produced has fewer than the characters specified by the Width parameter, trailing spaces are output to make up the difference. @node !Io.Io.Echo_Line procedure Echo_Line (Item : String := ""); Writes a string to the current error file (by default, the Message window) and advances the line. This procedure calls the Put procedure for the specified string and then calls the New_Line procedure with a spacing of 1 on the current error file. @node !Io.Io.End_Of_File function End_Of_File (File : File_Type) return Boolean; function End_Of_File return Boolean; Returns true if a file terminator or the combination of a line, a page, and a file terminator is the next item to be read from the file; otherwise, the function returns false. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.End_Of_Line function End_Of_Line (File : File_Type) return Boolean; function End_Of_Line return Boolean; Returns true if a line terminator or a file terminator is the next item to be read from the file; otherwise, the function returns false. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.End_Of_Page function End_Of_Page (File : File_Type) return Boolean; function End_Of_Page return Boolean; Returns true if a file terminator or the combination of a line and a page terminator is the next item to be read from the file; otherwise, the function returns false. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Field subtype Field is Integer range 0 .. Integer'Last; Specifies the range of possible values for the number of character positions used in formatting strings that represent discrete or real values. @node !Io.Io.File_Mode subtype File_Mode is Text_Io.File_Mode; Specifies the mode of access for which a file is open. In_File mode denotes a file with read-only access; Out_File mode denotes a file with write-only access. @node !Io.Io.File_Type type File_Type is private; Defines a file handle type for files to be processed by operations in this package. @node !Io.Io.Flush procedure Flush (File : File_Type); Causes any characters currently in internal buffers and not yet in the file to be forced out to the file. The procedure can be used to force logging output from programs at key points out to files so that the intermediate contents of the log can be viewed by the Rational Editor. @node !Io.Io.Form function Form (File : File_Type) return String; Currently returns the null string ("") in all cases. When the Form parameter to the Create and Open procedures is supported in the future, this function will return the Form value provided in the call to the Create or the Open procedure. @node !Io.Io.Get procedure Get (File : File_Type; Item : out Character); procedure Get (Item : out Character); Reads a character from a file. After skipping any line and page terminators, this procedure reads the next character from the specified input file and returns the value of this character in the Item parameter. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Get procedure Get (File : File_Type; Item : out String); procedure Get (Item : out String); Reads a string from a file. This procedure determines the length of the specified string and attempts that number of get operations for successive characters of the string. No operation is performed if the string is null. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Get procedure Get (File : File_Type; Item : out String; Last : out Natural; End_Of_Line : out Boolean; End_Of_Page : out Boolean; End_Of_File : out Boolean); Reads part or all of a line from a file. This procedure determines the length of the specified string and attempts that number of get operations for successive characters of the string up to the end of the current line, not including terminators (no operation is performed if the string is null). The index of the last character read is returned in the Last parameter. If no characters are read, the Last parameter contains a value one less than Item'First. The procedure also returns an indication of whether or not various terminators are encountered. @node !Io.Io.Get procedure Get (File : File_Type; Item : out Integer; Width : Field := 0); procedure Get (Item : out Integer; Width : Field := 0); Reads an integer value from a file. If the value of the Width parameter is 0, the Get procedure skips any leading blanks, line terminators, or page terminators, reads a plus or a minus sign if present, and then reads according to the syntax of an integer literal (which may be a based literal). If a nonzero value of Width is supplied, then exactly Width characters or the characters (possibly none) up to a line terminator are input, whichever comes first; any skipped leading blanks are included in the count. The procedure returns, in the Item parameter, the value of the Integer type that corresponds to the sequence input. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Get procedure Get (File : File_Type; Item : out Float; Width : Field := 0); procedure Get (Item : out Float; Width : Field := 0); Reads a floating-point number from a file. If the value of the Width parameter is 0, the Get procedure skips any leading blanks, line terminators, or page terminators, reads a plus or a minus sign if present, and then reads according to the syntax of a real literal (which may be a based literal). If a nonzero value of Width is supplied, then exactly Width characters or the characters (possibly none) up to a line terminator are input, whichever comes first; any skipped leading blanks are included in the count. The procedure returns, in the Item parameter, the value of Float type that corresponds to the sequence input. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Get procedure Get (File : File_Type; Item : out Boolean); procedure Get (Item : out Boolean); Reads the Boolean value from a file. After skipping any leading blanks, line terminators, or page terminators, the Get procedure reads a Boolean literal in either lowercase or uppercase. The procedure returns, in the Item parameter, the value of the Boolean type that corresponds to the sequence input. If a File parameter is omitted, the current default file is read. @node !Io.Io.Get_Line function Get_Line (File : File_Type) return String; function Get_Line return String; Returns all remaining characters on the current line except for the line terminator. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Get_Line procedure Get_Line (File : File_Type; Item : out String; Last : out Natural); procedure Get_Line (Item : out String; Last : out Natural); Reads a string on a single line from a file, not including the line terminator. This procedure replaces successive characters of the specified string by successive characters read from the specified input file. Reading stops if the end of the line is encountered, in which case the Skip_Line procedure is called (in effect) with a spacing of 1; reading also stops if the end of the string is encountered. Characters not replaced are left undefined. If characters are read, the Last parameter contains the index value such that Item(Last) is the last character replaced (the index of the first character replaced is Item'First). If no characters are read, the Last parameter contains an index value that is one less than Item'First. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.In_File In_File : constant File_Mode := Text_Io.In_File; Defines a named constant for the In_File mode. @node !Io.Io.Is_Open function Is_Open (File : File_Type) return Boolean; Returns true if the file handle is open (that is, if it is associated with a file); otherwise, the function returns false. @node !Io.Io.Line function Line (File : File_Type) return Positive_Count; function Line return Positive_Count; Returns the current line number. If a File parameter is omitted, the default file is the current output file. @node !Io.Io.Line_Length function Line_Length (File : File_Type) return Count; function Line_Length return Count; Returns the maximum line length currently set for the specified output file; returns 0 if the line length is unbounded. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Lower_Case Lower_Case : constant Type_Set := Text_Io.Lower_Case; Defines a value indicating that enumeration literals are to be displayed in lowercase. @node !Io.Io.Mode function Mode (File : File_Type) return File_Mode; Returns the current mode of the specified file. @node !Io.Io.Name function Name (File : File_Type) return String; Returns the name of the file currently associated with the specified file handle. For temporary files, the function returns the unique name provided by the Rational Environment during the creation of the file. @node !Io.Io.New_Line procedure New_Line (File : File_Type; Spacing : Positive_Count := 1); procedure New_Line (Spacing : Positive_Count := 1); Adds the specified number of line terminators to the current file, forcing subsequent output to the following line. For a spacing of 1, the procedure outputs a line terminator, sets the current column number to 1, and then adds 1 to the current line number. If the current line number is already greater than or equal to the maximum page length for a bounded page length, a page terminator is output, the current page number is increased by 1, and the current line number is set to 1. For a spacing greater than 1, the above actions are performed the number of times specified by the Spacing parameter. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.New_Page procedure New_Page (File : File_Type); procedure New_Page; Outputs a page terminator. The procedure outputs a line terminator if the current line is not terminated or if the current page is empty (that is, if the current column and line numbers are both equal to 1). It then outputs a page terminator, which terminates the current page, adds 1 to the current page number, and sets the current column and line numbers to 1. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Number_Base subtype Number_Base is Integer range 2 .. 16; Specifies the range of possible values for the radix of numeric values to be written or read. @node !Io.Io.Open procedure Open (File : in out File_Type; Mode : File_Mode := Out_File; Name : String; Form : String := ""); procedure Open (File : in out File_Type; Mode : File_Mode; Object : Directory.Version; Form : String := ""); Associates the file handle with an existing file having the specified name or version and sets the mode of the file to the specified mode. After a file is opened with the Out_File mode, the page length and line length are unbounded. After a file is opened with the In_File or Out_File mode, the current column, current line, and current page numbers are set to 1. @node !Io.Io.Out_File Out_File : constant File_Mode := Text_Io.Out_File; Defines a named constant for the Out_File mode. @node !Io.Io.Page function Page (File : File_Type) return Positive_Count; function Page return Positive_Count; Returns the current page number. If a File parameter is omitted, the default file is the current output file. @node !Io.Io.Page_Length function Page_Length (File : File_Type) return Count; function Page_Length return Count; Returns the maximum page length currently set for the specified output file; returns 0 if the page length is unbounded. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Pop_Error procedure Pop_Error; Pops the current error file off the stack of error files. The procedure sets the current error file to be a file value previously saved by a Set_Error procedure. The current value of the error file is not closed and will not be closed automatically at the end of the job because it is no longer on the stack. @node !Io.Io.Pop_Input procedure Pop_Input; Pops the current input file off the stack of input files. The procedure sets the current input file to be a file value previously saved by a Set_Input procedure. The current value of the input file is not closed and will not be closed automatically at the end of the job because it is no longer on the stack. @node !Io.Io.Pop_Output procedure Pop_Output; Pops the current output file off the stack of output files. The procedure sets the current output file to be a file value previously saved by a Set_Output procedure. The current value of the output file is not closed and will not be closed automatically at the end of the job because it is no longer on the stack. @node !Io.Io.Positive_Count subtype Positive_Count is Count range 1 .. Count'Last; Specifies the range of possible values for the number of lines to be skipped or inserted. @node !Io.Io.Put procedure Put (File : File_Type; Item : Character); procedure Put (Item : Character); Writes a character to a file. If the line length of the specified output file is bounded (that is, does not have the conventional value 0) and the current column number exceeds it, the procedure has the effect of calling the New_Line procedure with a spacing of 1. Then the procedure outputs the specified character to the file. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Put procedure Put (File : File_Type; Item : String); procedure Put (Item : String); Writes a string to a file. Determines the length of the specified string and attempts that number of put operations for successive characters of the string. No operation is performed if the string is null. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Put procedure Put (File : File_Type; Item : Integer; Width : Field := 0; Base : Number_Base := 10); procedure Put (Item : Integer; Width : Field := 0; Base : Number_Base := 10); Writes an integer value to a file. Values are output as decimal or based literals, without underline characters or exponents, and are preceded by a minus sign if negative. The format (which includes any leading spaces and a minus sign) can be specified by an optional field Width parameter. Values of widths of fields in output formats are of the nonnegative integer Field subtype. Values of bases are of the integer Number_Base subtype. This procedure outputs the value of the Item parameter as an integer literal, with no underlines, no exponent, and no leading zeros (but a single zero for the value 0), and with a preceding minus sign for a negative value. If the resulting sequence of characters to be output has fewer characters than specified in the Width parameter, leading spaces are output to make up the difference. This procedure uses the syntax for decimal literal if the Base parameter has the value 10; otherwise, it uses the syntax for based literal, with any letters in uppercase. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Put procedure Put (File : File_Type; Item : Float; Fore : Field := 2; Aft : Field := 14; Exp : Field := 3); procedure Put (Item : Float; Fore : Field := 2; Aft : Field := 14; Exp : Field := 3); Writes a floating-point value to a file. Values are output as decimal literals without underline characters. The format of each value output consists of a Fore field, a decimal point, an Aft field, and (if a nonzero Exp parameter is supplied) the letter E and an Exp field. The two possible formats thus correspond to: Fore . Aft and: Fore . Aft E Exp with no spaces between these fields. The Fore field can include leading spaces and a minus sign for negative values. The Aft field includes only decimal digits (possibly with trailing zeros). The Exp field includes the sign (plus or minus) and the exponent (possibly with leading zeros). The Put procedure outputs the value of the Item parameter as a decimal literal with the format defined by the Fore, Aft, and Exp parameters. If the value is negative, a minus sign is included in the integer part. If Exp has the value 0, the integer part to be output has as many digits as needed to represent the integer part of the value of the Item parameter, overriding Fore if necessary, or it consists of the digit 0 if the value of Item has no integer part. If Exp has a value greater than 0, the integer part to be output has a single digit, which is nonzero except for the value 0.0 of the Item parameter. In both cases, however, if the integer part to be output has fewer than Fore characters, including any minus sign, leading spaces are output to make up the difference. The number of digits of the fractional part is specified by Aft, or it is 1 if Aft equals 0. The value is rounded; a value of exactly one-half in the last place can be rounded either up or down. If Exp has the value 0, there is no exponent part. If Exp has a value greater than 0, the exponent part to be output has as many digits as needed to represent the exponent part of the value of the Item parameter (for which a single-digit integer part is used), and it includes an initial sign (plus or minus). If the exponent part to be output has fewer than Exp characters, including the sign, leading zeros precede the digits to make up the difference. For the value 0.0 of the Item parameter, the exponent has the value 0. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Put procedure Put (File : File_Type; Item : Boolean; Width : Field := 0); procedure Put (Item : Boolean; Width : Field := 0); Writes the Boolean value to a file. Values are output using either uppercase or lowercase letters for identifiers. The format (which includes any trailing spaces) can be specified by an optional field Width parameter. The procedure outputs the value of the Item parameter as an enumeration literal. If the sequence of characters produced has fewer characters than specified by the Width parameter, trailing spaces are output to make up the difference. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Put_Line procedure Put_Line (File : File_Type; Item : String); procedure Put_Line (Item : String); Writes a string to a file and advances the line. This procedure calls the Put procedure for the specified string and then calls the New_Line procedure with a spacing of 1. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Reset procedure Reset (File : in out File_Type; Mode : File_Mode); procedure Reset (File : in out File_Type); Resets the specified file so that reading from or writing to its elements can be restarted from the beginning of the file. If a Mode parameter is supplied, the mode of the specified file handle is set to the specified mode. If the file has the current Out_File mode, this procedure terminates the current page and outputs a file terminator. @node !Io.Io.Reset_Error procedure Reset_Error; Closes the current error file and pops it off the stack of error files. The procedure sets the current error file to be a file value previously saved by a Set_Error procedure. The current value of the error file is closed. @node !Io.Io.Reset_Input procedure Reset_Input; Closes the current input file and pops it off the stack of input files. The procedure sets the current input file to be a file value previously saved by a Set_Input procedure. The current value of the input file is closed. @node !Io.Io.Reset_Output procedure Reset_Output; Closes the current output file and pops it off the stack of output files. The procedure sets the current output file to be a file value previously saved by a Set_Output procedure. The current value of the output file is closed. @node !Io.Io.Save procedure Save (File : File_Type); Causes the current contents of the file to be permanently saved after any characters currently in internal buffers and not yet in the file are forced out to the file using the Flush procedure. The procedure can be used to force logging output from programs at key points out to files so that the intermediate snapshots of the logs can be saved if the program terminates before the file is closed normally. @node !Io.Io.Set_Col procedure Set_Col (File : File_Type; To : Positive_Count); procedure Set_Col (To : Positive_Count); Sets the current column number of the specified file. If the file mode is Out_File: If the value specified by the To parameter is greater than the current column number, this procedure outputs spaces, adding 1 to the current column number after each space, until the current column number equals the specified value. If the value specified by To is equal to the current column number, there is no effect. If the value specified by To is less than the current column number, the procedure has the effect of calling the New_Line procedure (with a spacing of 1), and then it outputs (To - 1) spaces and sets the current column number to the specified value. If the file mode is In_File: The procedure reads (and discards) individual characters, line terminators, and page terminators until the next character to be read has a column number that equals the value specified by To; there is no effect if the current column number already equals this value. Each transfer of a character or terminator maintains the current column, line, and page numbers in the same way that a Get or a Get_Line procedure does. If a File parameter is omitted, the default file is the current output file. The column number, line number, and page number are allowed to exceed Count'Last (as a consequence of the input or output of sufficiently many characters, lines, or pages). @node !Io.Io.Set_Error procedure Set_Error (File : File_Type); procedure Set_Error (Name : String := ">>FILE NAME<<"); Sets the current default error file to the specified file handle or file and pushes the file onto the stack of error files. If a filename is specified, the file is opened with Out_File mode before it is set to be the default output file. A file is created if one does not exist. Any files on the stack when a job terminates are automatically closed. @node !Io.Io.Set_Input procedure Set_Input (File : File_Type); procedure Set_Input (Name : String := "<SELECTION>"); Sets the current default input file to the specified file handle or file and pushes the file onto the stack of input files. If a filename is specified, the file is opened with In_File mode before it is set to be the default input file. A file is created if one does not exist. Any files on the stack when a job terminates are automatically closed. @node !Io.Io.Set_Line procedure Set_Line (File : File_Type; To : Positive_Count); procedure Set_Line (To : Positive_Count); Sets the current line number of the file. If the file mode is Out_File: If the value specified by the To parameter is greater than the current line number, the procedure has the effect of repeatedly calling the New_Line procedure (with a spacing of 1) until the current line number equals the specified value. If the value specified by To is equal to the current line number, there is no effect. If the value specified by To is less than the current line number, the procedure has the effect of calling the New_Page procedure followed by a call to the New_Line procedure with a spacing equal to (To - 1). If the file mode is In_File: The procedure has the effect of repeatedly calling the Skip_Line procedure (with a spacing of 1) until the current line number equals the value specified by To; there is no effect if the current line number already equals this value. (Short pages will be skipped until a page is reached that has a line at the specified line position.) If a File parameter is omitted, the default file is the current output file. The column number, line number, and page number are allowed to exceed Count'Last (as a consequence of the input or output of sufficiently many characters, lines, or pages). @node !Io.Io.Set_Line_Length procedure Set_Line_Length (File : File_Type; To : Count); procedure Set_Line_Length (To : Count); Sets the maximum line length of the specified output file to the number of characters specified by the To parameter. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Set_Output procedure Set_Output (File : File_Type); procedure Set_Output (Name : String := ">>FILE NAME<<"); Sets the current default output file to the specified file handle or file and pushes the file onto the stack of output files. If a filename is specified, the file is opened with Out_File mode before it is set to be the default output file. A file is created if one does not exist. Any files on the stack when a job terminates are automatically closed. @node !Io.Io.Set_Page_Length procedure Set_Page_Length (File : File_Type; To : Count); procedure Set_Page_Length (To : Count); Sets the maximum page length of the specified output file to the number of lines specified by the To parameter. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Skip_Line procedure Skip_Line (File : File_Type; Spacing : Positive_Count := 1); procedure Skip_Line (Spacing : Positive_Count := 1); Ignores all remaining characters in the subsequent lines (specified by the Spacing parameter) and sets the current line to the following line. For a spacing of 1, this procedure reads and discards all characters until a line terminator has been read, and then sets the current column number to 1. If the line terminator is not immediately followed by a page terminator, the current line number is increased by 1. Otherwise, if the line terminator is immediately followed by a page terminator, the page terminator is skipped, the current page number is increased by 1, and the current line number is set to 1. For a spacing greater than 1, the above actions are performed the number of times specified by the Spacing parameter. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Skip_Page procedure Skip_Page (File : File_Type); procedure Skip_Page; Skips past all input until a page terminator is read. This procedure reads and discards all characters and line terminators until a page terminator has been read. It then adds 1 to the current page number and sets the current column and line numbers to 1. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Standard_Error function Standard_Error return File_Type; function Standard_Error return Text_Io.File_Type; Returns the handle to the standard error file (by default, the Message window). @node !Io.Io.Standard_Input function Standard_Input return File_Type; Returns the handle to the standard input file. @node !Io.Io.Standard_Output function Standard_Output return File_Type; Returns the handle to the standard output file. @node !Io.Io.Type_Set subtype Type_Set is Text_Io.Type_Set; Specifies the case in which enumeration literals are to be displayed. @node !Io.Io.Unbounded Unbounded : constant Count := Text_Io.Unbounded; Denotes an unbounded line and/or page length. @node !Io.Io.Upper_Case Upper_Case : constant Type_Set := Text_Io.Upper_Case; Defines a value indicating that enumeration literals are to be displayed in uppercase. This procedure calls a procedure once with an open file handle with mode In_File corresponding to each of the files matched by the wildcard or filename specified by the input parameter. It can be used to perform an operation repeatedly over a set of files. The procedure's formal parameter list is: generic with procedure Process (File : in out File_Type) is <>; with procedure Note_Error (Message : String) is Io.Put_Line; procedure Wildcard_Iterator (Names : String); The Process procedure is called for each file. The Note_Error procedure is used to report exceptions. @node !Io.Io.Note_Error with procedure Note_Error (Message : String) is Io.Put_Line; Reports errors and exceptions encountered in the processing of each file matched by the wildcard passed to the Wildcard_Iterator procedure. If no procedure is provided for this generic formal in an instantiation of the Wildcard_Iterator, the Put_Line procedure will be used. @node !Io.Io.Process with procedure Process (File : in out File_Type) is <>; Performs the processing on each file matched by the wildcard. This procedure will be called once for each file matched by the wildcard. The file will be opened with In_File mode before the Process procedure is called by the Wildcard_Iterator procedure. If no procedure is provided for this generic formal in an instantiation of the Wildcard_Iterator, a procedure (visible at the point of instantiation) with the name Process and a matching parameter profile will be used. Lack of either an explicit parameter or such a visible procedure is a semantic error. @node !Io.Io.Wildcard_Iterator procedure Wildcard_Iterator (Names : String); Resolves the wildcard or filename provided. For each file matched, the procedure performs the following processing in sequence: o Opens the file with In_File mode o Calls the Process procedure o Closes the file If errors are encountered, the Note_Error procedure is called and processing continues. @node !Io.Io.Enumeration_Io This package provides facilities for enumeration I/O. Values are output using either uppercase or lowercase letters for identifiers. This is specified by the Set parameter, which is of the enumeration Type_Set subtype. The format (which includes any trailing spaces) can be specified by an optional field Width parameter. @node !Io.Io.Enumeration_Io.Default_Setting Default_Setting : Type_Set := Upper_Case; Denotes the default type set of values to be output. @node !Io.Io.Enumeration_Io.Default_Width Default_Width : Field := 0; Denotes the default number of characters to be output. @node !Io.Io.Enumeration_Io.Enum type Enum is (<>); Denotes the enumeration type to be used in instantiating this package. @node !Io.Io.Enumeration_Io.Get procedure Get (File : File_Type; Item : out Enum); procedure Get (Item : out Enum); Reads an enumeration value from a file. After skipping any leading blanks, line terminators, or page terminators, the procedure reads an enumeration literal of Enum type in either lowercase or uppercase. If Enum is of Character type, the literal value must include the apostrophes. The procedure returns, in the Item parameter, the value of the Enum type that corresponds to the sequence input. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Enumeration_Io.Get procedure Get (From : String; Item : out Enum; Last : out Positive); Reads an enumeration value from a string. The procedure reads an enumeration value from the beginning of the specified string, following the same rule as the Get procedure that reads an enumeration value from a file but treating the end of the string as a file terminator. The procedure returns, in the Item parameter, the value of the Enum type that corresponds to the sequence input. It returns, in the Last parameter, the index value such that From(Last) is the last character read. @node !Io.Io.Enumeration_Io.Put procedure Put (File : File_Type; Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting); procedure Put (Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting); Writes an enumeration value to a file. The procedure outputs the value of the Item parameter as an enumeration literal (either an identifier or a character literal). The optional Set parameter indicates whether lowercase or uppercase letters are used for identifiers; it has no effect for character literals. If the sequence of characters produced has fewer than the number of characters specified by the Width parameter, trailing spaces are output to make up the difference. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Enumeration_Io.Put procedure Put (To : out String; Item : Enum; Set : Type_Set := Default_Setting); Writes an enumeration value to a string. The procedure outputs the value of the Item parameter to the specified string, following the same rule as for output to a file, using the length of the specified string as the value for the Width parameter. @node !Io.Io.Fixed_Io This package provides facilities for fixed-point I/O. Values are output as decimal literals without underline characters. The format of each value output consists of a Fore field, a decimal point, an Aft field, and (if a nonzero Exp parameter is supplied) the letter E and an Exp field. The two possible formats thus correspond to: Fore . Aft and: Fore . Aft E Exp with no spaces between these fields. The Fore field can include leading spaces and a minus sign for negative values. The Aft field includes only decimal digits (possibly with trailing zeros). The Exp field includes the sign (plus or minus) and the exponent (possibly with leading zeros). @node !Io.Io.Fixed_Io.Default_Aft Default_Aft : Field := Num'Aft; Denotes the default number of characters to be used after the decimal point in output procedures. @node !Io.Io.Fixed_Io.Default_Exp Default_Exp : Field := 0; Denotes the default number of exponent characters to be used in output procedures. @node !Io.Io.Fixed_Io.Default_Fore Default_Fore : Field := Num'Fore; Denotes the default number of characters to be used before the decimal point in output procedures. @node !Io.Io.Fixed_Io.Get procedure Get (File : File_Type; Item : out Num; Width : Field := 0); procedure Get (Item : out Num; Width : Field := 0); Reads a fixed-point value from a file. If the value of the Width parameter is 0, the procedure skips any leading blanks, line terminators, or page terminators, reads a plus or a minus sign if present, and then reads according to the syntax of a real literal (which may be a based literal). If a nonzero value of the Width parameter is supplied, then exactly Width characters are input, or the characters (possibly none) up to a line terminator are input, whichever comes first; any skipped leading blanks are included in the count. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Fixed_Io.Get procedure Get (From : String; Item : out Num; Last : out Positive); Reads a fixed-point value from a string. This procedure reads a real value from the beginning of the specified string, following the same rule as the Get procedure that reads a real value from a file but treating the end of the string as a file terminator. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. It returns, in the Last parameter, the index value such that From(Last) is the last character read. @node !Io.Io.Fixed_Io.Num type Num is delta <>; Denotes the fixed-point type for which the package is being instantiated. @node !Io.Io.Fixed_Io.Put procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); Writes a fixed-point value to a file. The Put procedure outputs the value of the Item parameter as a decimal literal with the format defined by the Fore, Aft, and Exp parameters. If the value is negative, a minus sign is included in the integer part. If Exp has the value 0, the integer part to be output has as many digits as needed to represent the integer part of the value of the Item parameter, overriding Fore if necessary, or it consists of the digit 0 if the value of Item has no integer part. If Exp has a value greater than 0, the integer part to be output has a single digit, which is nonzero except for the value 0.0 of the Item parameter. In both cases, however, if the integer part to be output has fewer than Fore characters, including any minus sign, leading spaces are output to make up the difference. The number of digits of the fractional part is specified by Aft, or it is 1 if Aft equals 0. The value is rounded; a value of exactly one-half in the last place can be rounded either up or down. If Exp has the value 0, there is no exponent part. If Exp has a value greater than 0, the exponent part to be output has as many digits as needed to represent the exponent part of the value of the Item parameter (for which a single-digit integer part is used) and includes an initial sign (plus or minus). If the exponent part to be output has fewer than Exp characters, including the sign, leading zeros precede the digits to make up the difference. For the value 0.0 of Item, the exponent has the value 0. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Fixed_Io.Put procedure Put (To : out String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp); Writes a fixed-point value to a string. This procedure outputs the value of the Item parameter to the specified string, following the same rule as for output to a file, using a value for the width of the Fore field such that the sequence of characters output exactly fills the string, including any leading spaces. For an item with a positive value, if output to a string exactly fills the string without leading spaces, then output of the corresponding negative value raises the Io_Exceptions.Layout_Error exception. @node !Io.Io.Float_Io This package provides facilities for floating-point I/O. Values are output as decimal literals without underline characters. The format of each value output consists of a Fore field, a decimal point, an Aft field, and (if a nonzero Exp parameter is supplied) the letter E and an Exp field. The two possible formats thus correspond to: Fore . Aft and: Fore . Aft E Exp with no spaces between these fields. The Fore field can include leading spaces and a minus sign for negative values. The Aft field includes only decimal digits (possibly with trailing zeros). The Exp field includes the sign (plus or minus) and the exponent (possibly with leading zeros). @node !Io.Io.Float_Io.Default_Aft Default_Aft : Field := Num'Digits - 1; Denotes the default width to be used after the decimal point in output procedures. @node !Io.Io.Float_Io.Default_Exp Default_Exp : Field := 3; Denotes the default exponent width to be used in output procedures. @node !Io.Io.Float_Io.Default_Fore Default_Fore : Field := 2; Denotes the default width to be used before the decimal point in output procedures. @node !Io.Io.Float_Io.Get procedure Get (File : File_Type; Item : out Num; Width : Field := 0); procedure Get (Item : out Num; Width : Field := 0); Reads a floating-point number from a file. If the value of the Width parameter is 0, the procedure skips any leading blanks, line terminators, or page terminators, reads a plus or a minus sign if present, and then reads according to the syntax of a real literal (which may be a based literal). If a nonzero value of the Width parameter is supplied, then exactly Width characters are input, or the characters (possibly none) up to a line terminator are input, whichever comes first; any skipped leading blanks are included in the count. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Float_Io.Get procedure Get (From : String; Item : out Num; Last : out Positive); Reads a floating-point value from a string. This procedure reads a real value from the beginning of the specified string, following the same rule as the Get procedure that reads a real value from a file but treating the end of the string as a file terminator. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. It returns, in the Last parameter, the index value such that From(Last) is the last character read. @node !Io.Io.Float_Io.Num type Num is digits <>; Defines the floating-point type of the items that form the elements in the I/O stream. @node !Io.Io.Float_Io.Put procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); Writes a floating-point value to a file. This procedure outputs the value of the Item parameter as a decimal literal with the format defined by the Fore, Aft, and Exp parameters. If the value is negative, a minus sign is included in the integer part. If Exp has the value 0, the integer part to be output has as many digits as needed to represent the integer part of the value of the Item parameter, overriding Fore if necessary, or it consists of the digit 0 if the value of Item has no integer part. If Exp has a value greater than 0, the integer part to be output has a single digit, which is nonzero except for the value 0.0 of the Item parameter. In both cases, however, if the integer part to be output has fewer than Fore characters, including any minus sign, leading spaces are output to make up the difference. The number of digits of the fractional part is specified by Aft, or it is 1 if Aft equals 0. The value is rounded; a value of exactly one-half in the last place can be rounded either up or down. If Exp has the value 0, there is no exponent part. If Exp has a value greater than 0, the exponent part to be output has as many digits as needed to represent the exponent part of the value of the Item parameter (for which a single-digit integer part is used) and includes an initial sign (plus or minus). If the exponent part to be output has fewer than Exp characters, including the sign, leading zeros precede the digits to make up the difference. For the value 0.0 of Item, the exponent has the value 0. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Float_Io.Put procedure Put (To : out String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp); Writes a floating-point value to a string. This procedure outputs the value of the Item parameter to the specified string, following the same rule as for output to a file, using a value for the width of the Fore field such that the sequence of characters output exactly fills the string, including any leading spaces. For an item with a positive value, if output to a string exactly fills the string without leading spaces, then output of the corresponding negative value raises the Io_Exceptions.Layout_Error exception. @node !Io.Io.Integer_Io This package provides facilities for integer I/O. Values are output as decimal or based literals, without underline characters or exponents, and preceded by a minus sign if negative. The format (which includes any leading spaces and a minus sign) can be specified by an optional field Width parameter. Values of widths of fields in output formats are of the nonnegative integer Field subtype. Values of bases are of the integer Number_Base subtype. @node !Io.Io.Integer_Io.Default_Base Default_Base : Number_Base := 10; Denotes the default radix base to be used in output procedures. @node !Io.Io.Integer_Io.Default_Width Default_Width : Field := Num'Width; Denotes the default width to be used in output procedures. @node !Io.Io.Integer_Io.Get procedure Get (File : File_Type; Item : out Num; Width : Field := 0); procedure Get (Item : out Num; Width : Field := 0); Reads an integer value from a file. If the value of the Width parameter is 0, the procedure skips any leading blanks, line terminators, or page terminators, reads a plus or a minus sign if present, and then reads according to the syntax of an integer literal (which may be a based literal). If a nonzero value of the Width parameter is supplied, then exactly Width characters are input, or the characters (possibly none) up to a line terminator are input, whichever comes first; any skipped leading blanks are included in the count. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Integer_Io.Get procedure Get (From : String; Item : out Num; Last : out Positive); Reads an integer value from a string. This procedure reads an integer value from the beginning of the specified string, following the same rules as the Get procedure that reads an integer value from a file but treating the end of the string as a file terminator. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. It returns, in the Last parameter, the index value such that From(Last) is the last character read. @node !Io.Io.Integer_Io.Num type Num is range <>; Defines the integer type of the items that form the elements in the I/O stream. @node !Io.Io.Integer_Io.Put procedure Put (File : File_Type; Item : Num; Width : Field := Default_Width; Base : Number_Base := Default_Base); procedure Put (Item : Num; Width : Field := Default_Width; Base : Number_Base := Default_Base); Writes an integer value to a file. This procedure outputs the value of the Item parameter as an integer literal, with no underlines, no exponent, and no leading zeros (but a single zero for the value 0), and with a preceding minus sign for a negative value. If the resulting sequence of characters to be output has fewer characters than specified by the Width parameter, leading spaces are output to make up the difference. The procedure uses the syntax for decimal literal if the Base parameter has the value 10 (either explicitly or through Default_Base); otherwise, it uses the syntax for based literal, with any letters in uppercase. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Io.Integer_Io.Put procedure Put (To : out String; Item : Num; Base : Number_Base := Default_Base); Writes an integer value to a string. This procedure outputs the value of the Item parameter to the specified string, following the same rule as for output to a file, using the length of the specified string as the value for the Width parameter. @node !Io.Io_Exceptions The exceptions in package Io_Exceptions can be raised by I/O operations. The general conditions under which these exceptions can be raised are described in this section. Specific circumstances under which they can be raised are provided for each operation exported by an I/O package. If more than one error condition exists, the corresponding exception that appears earliest in the package is the one that is raised. Every other I/O package renames one or more of the exceptions exported from this package. Rather than repeat the following descriptions in each of these packages, documentation of the renaming declarations is omitted in the subsequent sections. The Rational Environment provides additional information about exceptions raised by the I/O packages that describes why a given exception occurred. This information, typically displayed in parentheses after the exception name, is documented in the reference entry for each exception. @node !Io.Io_Exceptions.Data_Error Data_Error : exception; Defines an exception raised by the Read procedure if the element read cannot be interpreted as a value of the required type. This exception is also raised by a Get or Read procedure if an input sequence fails to satisfy the required syntax or if the value input does not belong to the range of the required type or subtype. This exception is also raised by the Read and Write procedures of package Polymorphic_Sequential_Io (DIO) if these operations are attempted on files containing unsafe types (that is, containing access or task types as any of their components). The additional information supplied by the Environment when this exception is raised has the following meaning: o Input_Syntax_Error: The input value has incorrect syntax. o Input_Value_Error: The input value is out of range. o Output_Type_Error: The output value is an unsafe type. o Output_Value_Error: An attempt has been made to write a value out of range. @node !Io.Io_Exceptions.Device_Error Device_Error : exception; Defines an exception raised if an I/O operation cannot be completed because of a malfunction of the underlying system. The additional information supplied by the Environment when this exception is raised has the following meaning: o Device_Data_Error: A hardware error such as a parity error has occurred. o Illegal_Reference_Error: An illegal reference has been attempted. o Illegal_Heap_Access_Error: An Illegal_Heap_Access exception was raised when the operation was attempted. o Page_Nonexistent_Error: A nonexistent page was referenced. o Write_To_Read_Only_Page_Error: A write to a read-only page was attempted. @node !Io.Io_Exceptions.End_Error End_Error : exception; Defines an exception raised by an attempt to skip (read past) the end of a file. @node !Io.Io_Exceptions.Layout_Error Layout_Error : exception; Defines an exception raised in TIO, packages Text_Io and Io, by a call to operations that violate the limits of Count and by an attempt to put too many characters to a string; also raised in package Window_Io (DIO) by an attempt to position the cursor outside the image boundary. The additional information supplied by the Environment when this exception is raised has the following meaning: o Column_Error: A column exceeds the line or page length. o Illegal_Position_Error: A position parameter is illegal. o Item_Length_Error: An item length is too big or small. @node !Io.Io_Exceptions.Mode_Error Mode_Error : exception; Defines an exception raised by specifying a file whose mode conflicts with the desired operation. For example, this exception is raised by a call to Set_Input or Get when a file of the Out_File mode is provided. The additional information supplied by the Environment when this exception is raised is: o Illegal_Operation_On_Infile o Illegal_Operation_On_Outfile @node !Io.Io_Exceptions.Name_Error Name_Error : exception; Defines an exception raised by a call to the Create or Open procedure if the string given for the Name parameter does not allow the identification of a legal unique file. The Name_Error exception is raised by the Create procedure under any of the following conditions: o The filename does not conform to the syntax of a name. o An object of the nonfile class with the same name as the filename already exists in the context in which the creation is attempted. o The context in which the creation is attempted cannot contain files. Files are allowed only in directories or worlds. The additional information supplied by the Environment when this exception is raised has the following meaning: o Ambiguous_Name_Error: A name does not identify a unique object. o Illformed_Name_Error: A name does not conform to the syntax for a legal Environment filename. o Nonexistent_Directory_Error: A library in the name does not exist. o Nonexistent_Object_Error: The specified object does not exist. o Nonexistent_Version_Error: The specified version of the object does not exist. @node !Io.Io_Exceptions.Status_Error Status_Error : exception; Defines an exception raised by an attempt to operate upon a file handle that is not open and by an attempt to open a file handle that is already open. The additional information supplied by the Environment when this exception is raised has the following meaning: o Already_Open_Error: The file handle is already open. o Not_Open_Error: The file handle is not open. @node !Io.Io_Exceptions.Use_Error Use_Error : exception; Defines an exception raised if an operation is attempted that is not possible for reasons that depend on the file and the executing job's access rights. This exception is raised by an attempt to create when there are objects of nonfile classes with similar names, by an attempt to open or reset with a mode that is not supported for the file, and by a call to the Open parameter for a terminal object if the terminal is already assigned to a job. This exception is raised by the Delete procedure, among other circumstances, when the corresponding file is an object that cannot be deleted. This exception is raised by the Create and Open procedures in packages Direct_Io and Sequential_Io (DIO) if they are attempted with instantiations on unsafe types (that is, types containing access or task types as any of their components). The additional information supplied by the Environment when this exception is raised has the following meaning: o Access_Error: There are insufficient access rights to perform the operation. o Capacity_Error: The output file is full. o Check_Out_Error: The object is not checked out using the configuration management and version control system. o Class_Error: There is an existing object of a different class. o Frozen_Error: An attempt is made to change a frozen object. o Line_Page_Length_Error: An improper value for line or page length is encountered. o Lock_Error: Another job has locked the object. o Reset_Error: The file cannot be reset or have its mode changed. o Unsupported_Error: The operation is not supported. @node !Io.Text_Io This package provides the capabilities for Text_Io as required by the Ada Language Reference Manual, Chapter 14. The fundamental abstraction provided by package Text_Io is the File_Type type. Objects of this type denote file handles that can be mapped to files. Each file is read or written sequentially, as a sequence of characters grouped into lines and a sequence of lines grouped into pages. At the beginning of program execution, the default input and output files are the standard input file and standard output file. These files are open, have the In_File and Out_File modes, respectively, and are associated with two implementation-defined files. These files are implicitly closed at the end of each job. From a logical point of view, a text file is a sequence of pages, a page is a sequence of lines, and a line is a sequence of characters. The characters of a line are numbered, starting from 1; the number of a character is called its column number. For a line terminator, a column number is also defined; it is one more than the number of characters in the line. The lines of a page and the pages of a file are similarly numbered. The current column number is the column number of the next character or line terminator to be transferred. The current line number is the number of the current line. The current page number is the number of the current page. These numbers are values of the Positive_Count subtype of the Count type (by convention, the value 0 of the Count type is used to indicate special conditions). type Count is range 0 .. 1_000_000_000 subtype Positive_Count is Count range 1 .. Count'Last; For an output file, a maximum line length and a maximum page length can be specified. If a value to be output cannot fit on the current line, for a specified maximum line length, a new line is automatically started before the value is output. Further, if this new line cannot fit on the current page, for a specified maximum page length, a new page is automatically started before the value is output. Functions are provided to determine the maximum line and page lengths. When a file is opened with the Out_File mode, both values are 0; by convention, this means that the line and page lengths are unbounded. (Consequently, output consists of a single line if the subprograms for explicit control of line and page structure are not used.) The Unbounded constant is provided for this purpose. @node !Io.Text_Io.Close procedure Close (File : in out File_Type); Severs the association between the specified file and its associated file. If the file has the current Out_File mode, it has the effect of calling the New_Page procedure, unless the current page is already terminated; then it outputs a file terminator. @node !Io.Text_Io.Col function Col (File : File_Type) return Positive_Count; function Col return Positive_Count; Returns the current column number. If a File parameter is omitted, the default file is the current output file. @node !Io.Text_Io.Count type Count is range 0 .. 1_000_000_000; Specifies the range of possible values of the line and page counts and the line and page lengths. @node !Io.Text_Io.Create procedure Create (File : in out File_Type; Mode : File_Mode := Out_File; Name : String := ""; Form : String := ""); Establishes a new file with the specified name and associates this file with the specified file. The specified file is left open. @node !Io.Text_Io.Current_Input function Current_Input return File_Type; Returns the handle to the current default input file. @node !Io.Text_Io.Current_Output function Current_Output return File_Type; Returns the handle to the current default output file. @node !Io.Text_Io.Delete procedure Delete (File : in out File_Type); Deletes the file associated with the specified file. The specified file is closed, and the file ceases to exist. @node !Io.Text_Io.End_Of_File function End_Of_File (File : File_Type) return Boolean; function End_Of_File return Boolean; Returns true if a file terminator or the combination of a line, a page, and a file terminator is the next item to be read from the file; otherwise, the function returns false. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.End_Of_Line function End_Of_Line (File : File_Type) return Boolean; function End_Of_Line return Boolean; Returns true if a line terminator or a file terminator is the next item to be read from the file; otherwise, the function returns false. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.End_Of_Page function End_Of_Page (File : File_Type) return Boolean; function End_Of_Page return Boolean; Returns true if a file terminator or the combination of a line terminator and a page terminator is the next item to be read from the file; otherwise, the function returns false. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Field subtype Field is Integer range 0 .. Integer'Last; Specifies the range of possible values for the number of character positions used in formatting strings that represent discrete or real values. @node !Io.Text_Io.File_Mode type File_Mode is (In_File, Out_File); Specifies the mode of access for which a file is open. In_File denotes a file with read-only access; Out_File denotes a file with write-only access. @node !Io.Text_Io.File_Type type File_Type is limited private; Defines a file handle type for files to be processed by operations in this package. @node !Io.Text_Io.Form function Form (File : File_Type) return String; Returns the null string ("") in all cases. When the Form parameter to the Create and Open procedures is supported in the future, this function will return the Form value provided in the call to the Create or the Open procedure. @node !Io.Text_Io.Get procedure Get (File : File_Type; Item : out Character); procedure Get (Item : out Character); Reads a character from a file. After skipping any line and page terminators, this procedure reads the next character from the specified input file and returns the value of this character in the Item parameter. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Get procedure Get (File : File_Type; Item : out String); procedure Get (Item : out String); Reads a string from a file. This procedure determines the length of the specified string and attempts that number of get operations for successive characters of the string. No operation is performed if the string is null. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Get_Line procedure Get_Line (File : File_Type; Item : out String; Last : out Natural); procedure Get_Line (Item : out String; Last : out Natural); Reads a string on a single line from a file, not including the line terminator. This procedure replaces successive characters of the string by successive characters read from the specified input file. Reading stops if the end of the line is encountered, in which case the Skip_Line procedure is called (in effect) with a spacing of 1; reading also stops if the end of the string is encountered. Characters not replaced are left undefined. If characters are read, the Last parameter contains the index value such that Item(Last) is the last character replaced (the index of the first character replaced is Item'First). If no characters are read, the Last parameter contains an index value that is one less than Item'First. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Is_Open function Is_Open (File : File_Type) return Boolean; Returns true if the file handle is open (that is, if it is associated with a file); otherwise, the function returns false. @node !Io.Text_Io.Line function Line (File : File_Type) return Positive_Count; function Line return Positive_Count; Returns the current line number. If a File parameter is omitted, the default file is the current output file. @node !Io.Text_Io.Line_Length function Line_Length (File : File_Type) return Count; function Line_Length return Count; Returns the maximum line length currently set for the specified output file; returns 0 if the line length is unbounded. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Mode function Mode (File : File_Type) return File_Mode; Returns the current mode of the specified file. @node !Io.Text_Io.Name function Name (File : File_Type) return String; Returns the name of the file currently associated with the specified file handle. For temporary files, this function returns the unique name provided by the Rational Environment during the creation of the file. @node !Io.Text_Io.New_Line procedure New_Line (File : File_Type; Spacing : Positive_Count := 1); procedure New_Line (Spacing : Positive_Count := 1); Outputs a line terminator. For a spacing of 1, this procedure outputs a line terminator, sets the current column number to 1, and adds 1 to the current line number. If the current line number is already greater than or equal to the maximum page length for a bounded page length, a page terminator is output, the current page number is increased by 1, and the current line number is set to 1. For a spacing greater than 1, the above actions are performed the number of times specified by the Spacing parameter. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.New_Page procedure New_Page (File : File_Type); procedure New_Page; Outputs a page terminator. This procedure outputs a line terminator if the current line is not terminated or if the current page is empty (that is, if the current column and line numbers are both equal to 1). It then outputs a page terminator, which terminates the current page, adds 1 to the current page number, and sets the current column and line numbers to 1. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Number_Base subtype Number_Base is Integer range 2 .. 16; Specifies the range of possible values for the radix of numeric values to be written or read. @node !Io.Text_Io.Open procedure Open (File : in out File_Type; Mode : File_Mode := Out_File; Name : String; Form : String := ""); Associates the specified file with an existing file having the specified name and sets the mode of the file to the specified mode. After a file is opened with the Out_File mode, the page and line lengths are unbounded. After a file is opened with the In_File or Out_File mode, the current column, current line, and current page numbers are set to 1. @node !Io.Text_Io.Page function Page (File : File_Type) return Positive_Count; function Page return Positive_Count; Returns the current page number. If a File parameter is omitted, the default file is the current output file. @node !Io.Text_Io.Page_Length function Page_Length (File : File_Type) return Count; function Page_Length return Count; Returns the maximum page length currently set for the specified output file; returns 0 if the page length is unbounded. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Positive_Count subtype Positive_Count is Count range 1 .. Count'Last; Specifies the range of possible values for the current line and page number. @node !Io.Text_Io.Put procedure Put (File : File_Type; Item : Character); procedure Put (Item : Character); Writes a character to a file. If the line length of the specified output file is bounded (that is, does not have the conventional value 0) and the current column number exceeds it, this procedure has the effect of calling the New_Line procedure with a spacing of 1. It then outputs the specified character to the file. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Put procedure Put (File : File_Type; Item : String); procedure Put (Item : String); Writes a string to a file. This procedure determines the length of the specified string and attempts that number of put operations for successive characters of the string. No operation is performed if the string is null. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Put_Line procedure Put_Line (File : File_Type; Item : String); procedure Put_Line (Item : String); Writes a string to a file and advances the line. This procedure calls the Put procedure for the specified string and then calls the New_Line procedure with a spacing of 1. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Reset procedure Reset (File : in out File_Type; Mode : File_Mode); procedure Reset (File : in out File_Type); Resets the specified file so that reading from or writing to its elements can be restarted from the beginning of the file. If a Mode parameter is supplied, the current mode of the specified file is set to the specified mode. If the file has the current Out_File mode, this procedure has the effect of calling the New_Page procedure, unless the current page is already terminated, and it then outputs a file terminator. If the new file mode is Out_File, the page and line lengths are unbounded. For all modes, the current column, line, and page numbers are set to 1. @node !Io.Text_Io.Set_Col procedure Set_Col (File : File_Type; To : Positive_Count); procedure Set_Col (To : Positive_Count); Sets the current column number of the specified file. If the file mode is Out_File: If the value specified by the To parameter is greater than the current column number, this procedure outputs spaces, adding 1 to the current column number after each space, until the current column number equals the specified value. If the value specified by To is equal to the current column number, there is no effect. If the value specified by To is less than the current column number, the procedure has the effect of calling the New_Line procedure (with a spacing of 1). It then outputs (To - 1) spaces and sets the current column number to the specified value. If the file mode is In_File: This procedure reads (and discards) individual characters, line terminators, and page terminators until the next character to be read has a column number that equals the value specified by To; there is no effect if the current column number already equals this value. Each transfer of a character or terminator maintains the current column, line, and page numbers in the same way that a Get or a Get_Line procedure does. If a File parameter is omitted, the default file is the current output file. The column, line, and page numbers are allowed to exceed Count'Last (as a consequence of the input or output of sufficiently many characters, lines, or pages). @node !Io.Text_Io.Set_Input procedure Set_Input (File : File_Type); Sets the current default input file to the specified file handle. @node !Io.Text_Io.Set_Line procedure Set_Line (File : File_Type; To : Positive_Count); procedure Set_Line (To : Positive_Count); Sets the current line number of the file. If the file mode is Out_File: If the value specified by the To parameter is greater than the current line number, this procedure has the effect of repeatedly calling the New_Line procedure (with a spacing of 1) until the current line number equals the specified value. If the value specified by To is equal to the current line number, there is no effect. If the value specified by To is less than the current line number, it has the effect of calling the New_Page procedure followed by a call to the New_Line procedure with a spacing equal to (To - 1). If the mode is In_File: This procedure has the effect of repeatedly calling the Skip_Line procedure (with a spacing of 1) until the current line number equals the value specified by To; there is no effect if the current line number already equals this value. (Short pages will be skipped until a page is reached that has a line at the specified line position.) If a File parameter is omitted, the default file is the current output file. The column, line, and page numbers are allowed to exceed Count'Last (as a consequence of the input or output of sufficiently many characters, lines, or pages). @node !Io.Text_Io.Set_Line_Length procedure Set_Line_Length (File : File_Type; To : Count); procedure Set_Line_Length (To : Count); Sets the maximum line length of the specified output file to the number of characters specified by the To parameter. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Set_Output procedure Set_Output (File : File_Type); Sets the current default output file to the specified file handle. @node !Io.Text_Io.Set_Page_Length procedure Set_Page_Length (File : File_Type; To : Count); procedure Set_Page_Length (To : Count); Sets the maximum page length of the specified output file to the number of lines specified by the To parameter. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Skip_Line procedure Skip_Line (File : File_Type; Spacing : Positive_Count := 1); procedure Skip_Line (Spacing : Positive_Count := 1); Skips all subsequent input until the next line terminator. For a spacing of 1, this procedure reads and discards all characters until a line terminator has been read, and then it sets the current column number to 1. If the line terminator is not immediately followed by a page terminator, the current line number is increased by 1. Otherwise, if the line terminator is immediately followed by a page terminator, the page terminator is skipped, the current page number is increased by 1, and the current line number is set to 1. For a spacing greater than 1, the above actions are performed the number of times specified by the Spacing parameter. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Skip_Page procedure Skip_Page (File : File_Type); procedure Skip_Page; Skips past all input until a page terminator is read. This procedure reads and discards all characters and line terminators until a page terminator has been read. Then it adds 1 to the current page number and sets the current column and line numbers to 1. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Standard_Input function Standard_Input return File_Type; Returns the handle to the standard input file. @node !Io.Text_Io.Standard_Output function Standard_Output return File_Type; Returns the handle to the standard output file. @node !Io.Text_Io.Type_Set type Type_Set is (Lower_Case, Upper_Case); Specifies the case in which enumeration literals are to be displayed. @node !Io.Text_Io.Unbounded Unbounded: constant Count := 0; Denotes an unbounded line and/or page length. @node !Io.Text_Io.Enumeration_Io This package provides facilities for enumeration I/O. Values are output using either uppercase or lowercase letters for identifiers. This is specified by the Set parameter, which is of the enumeration Type_Set type. The format (which includes any trailing spaces) can be specified by an optional field Width parameter. @node !Io.Text_Io.Enumeration_Io.Default_Setting Default_Setting : Type_Set := Upper_Case; Denotes the default type set of values to be output. @node !Io.Text_Io.Enumeration_Io.Default_Width Default_Width : Field := 0; Denotes the default number of characters to be output. @node !Io.Text_Io.Enumeration_Io.Enum type Enum is (<>); Denotes the enumeration type to be used in instantiating this package. @node !Io.Text_Io.Enumeration_Io.Get procedure Get (File : File_Type; Item : out Enum); procedure Get (Item : out Enum); Reads an enumeration value from a file. After skipping any leading blanks, line terminators, or page terminators, this procedure reads an enumeration literal of Enum type in either lowercase or uppercase. If Enum is of Character type, the literal value must include the apostrophes. The procedure returns, in the Item parameter, the value of the Enum type that corresponds to the sequence input. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Enumeration_Io.Get procedure Get (From : String; Item : out Enum; Last : out Positive); Reads an enumeration value from a string. This procedure reads an enumeration value from the beginning of the specified string, following the same rule as the Get procedure that reads an enumeration value from a file treating the end of the string as a file terminator. The procedure returns, in the Item parameter, the value of the Enum type that corresponds to the sequence input. It returns, in the Last parameter, the index value such that From(Last) is the last character read. @node !Io.Text_Io.Enumeration_Io.Put procedure Put (File : File_Type; Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting); procedure Put (Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting); Writes an enumeration value to a file. This procedure outputs the value of the Item parameter as an enumeration literal (either an identifier or a character literal). The optional Set parameter indicates whether lowercase or uppercase letters are used for identifiers; it has no effect for character literals. If the sequence of characters produced has fewer than Width characters, trailing spaces are output to make up the difference. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Enumeration_Io.Put procedure Put (To : out String; Item : Enum; Set : Type_Set := Default_Setting); Writes an enumeration value to a string. This procedure outputs the value of the Item parameter to the specified string, following the same rule as for output to a file, using the length of the specified string as the value for the Width parameter. @node !Io.Text_Io.Fixed_Io This package provides facilities for fixed-point I/O. Values are output as decimal literals without underline characters. The format of each value output consists of a Fore field, a decimal point, an Aft field, and (if a nonzero Exp parameter is supplied) the letter E and an Exp field. The two possible formats thus correspond to: Fore . Aft and: Fore . Aft E Exp with no spaces between these fields. The Fore field can include leading spaces and a minus sign for negative values. The Aft field includes only decimal digits (possibly with trailing zeros). The Exp field includes the sign (plus or minus) and the exponent (possibly with leading zeros). @node !Io.Text_Io.Fixed_Io.Default_Aft Default_Aft : Field := Num'Aft; Denotes the default number of characters to be used after the decimal point in output procedures. @node !Io.Text_Io.Fixed_Io.Default_Exp Default_Exp : Field := 0; Denotes the default number of exponent characters to be used in output procedures. @node !Io.Text_Io.Fixed_Io.Default_Fore Default_Fore : Field := Num'Fore; Denotes the default number of characters to be used after the decimal point in output procedures. @node !Io.Text_Io.Fixed_Io.Get procedure Get (File : File_Type; Item : out Num; Width : Field := 0); procedure Get (Item : out Num; Width : Field := 0); Reads a fixed-point value from a file. If the value of the Width parameter is 0, this procedure skips any leading blanks, line terminators, or page terminators, reads a plus or a minus sign if present, and then reads according to the syntax of a real literal (which may be a based literal). If a nonzero value of the Width parameter is supplied, then exactly Width characters are input, or the characters (possibly none) up to a line terminator are input, whichever comes first; any skipped leading blanks are included in the count. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Fixed_Io.Get procedure Get (From : String; Item : out Num; Last : out Positive); Reads a fixed-point value from a string. This procedure reads a real value from the beginning of the specified string, following the same rule as the Get procedure that reads a real value from a file but treating the end of the string as a file terminator. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. It returns, in the Last parameter, the index value such that From(Last) is the last character read. @node !Io.Text_Io.Fixed_Io.Num type Num is delta <>; Denotes the fixed-point type for which the package is being instantiated. @node !Io.Text_Io.Fixed_Io.Put procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); Writes a fixed-point value to a file. The Put procedure outputs the value of the Item parameter as a decimal literal with the format defined by the Fore, Aft, and Exp parameters. If the value is negative, a minus sign is included in the integer part. If Exp has the value 0, the integer part to be output has as many digits as needed to represent the integer part of the value of the Item parameter, overriding Fore if necessary, or it consists of the digit 0 if the value of Item has no integer part. If Exp has a value greater than 0, the integer part to be output has a single digit, which is nonzero except for the value 0.0 of the Item parameter. In both cases, however, if the integer part to be output has fewer than Fore characters, including any minus sign, leading spaces are output to make up the difference. The number of digits of the fractional part is specified by Aft, or it is 1 if Aft equals 0. The value is rounded; a value of exactly one-half in the last place can be rounded either up or down. If Exp has the value 0, there is no exponent part. If Exp has a value greater than 0, the exponent part to be output has as many digits as needed to represent the exponent part of the value of Item (for which a single-digit integer part is used), and it includes an initial sign (plus or minus). If the exponent part to be output has fewer than Exp characters, including the sign, leading zeros precede the digits to make up the difference. For the value 0.0 of Item, the exponent has the value 0. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Fixed_Io.Put procedure Put (To : out String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp); Writes a fixed-point value to a string. This procedure outputs the value of the Item parameter to the specified string, following the same rule as for output to a file, using a value for the width of the Fore field such that the sequence of characters output exactly fills the string, including any leading spaces. For an item with a positive value, if output to a string exactly fills the string without leading spaces, then output of the corresponding negative value raises the Io_Exceptions.Layout_Error exception. @node !Io.Text_Io.Float_Io This package provides facilities for floating-point I/O. Values are output as decimal literals without underline characters. The format of each value output consists of a Fore field, a decimal point, an Aft field, and (if a nonzero Exp parameter is supplied) the letter E and an Exp field. The two possible formats thus correspond to: Fore . Aft and: Fore . Aft E Exp with no spaces between these fields. The Fore field can include leading spaces and a minus sign for negative values. The Aft field includes only decimal digits (possibly with trailing zeros). The Exp field includes the sign (plus or minus) and the exponent (possibly with leading zeros). @node !Io.Text_Io.Float_Io.Default_Aft Default_Aft : Field := Num'Digits - 1; Denotes the default width to be used after the decimal point in output procedures. @node !Io.Text_Io.Float_Io.Default_Exp Default_Exp : Field := 3; Denotes the default exponent width to be used in output procedures. @node !Io.Text_Io.Float_Io.Default_Fore Default_Fore : Field := 2; Denotes the default width to be used before the decimal point in output procedures. @node !Io.Text_Io.Float_Io.Get procedure Get (File : File_Type; Item : out Num; Width : Field := 0); procedure Get (Item : out Num; Width : Field := 0); Reads a floating-point number from a file. If the value of the Width parameter is 0, this procedure skips any leading blanks, line terminators, or page terminators, reads a plus or a minus sign if present, and then reads according to the syntax of a real literal (which may be a based literal). If a nonzero value of the Width parameter is supplied, then exactly Width characters are input, or the characters (possibly none) up to a line terminator are input, whichever comes first; any skipped leading blanks are included in the count. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Float_Io.Get procedure Get (From : String; Item : out Num; Last : out Positive); Reads a floating-point value from a string. This procedure reads a real value from the beginning of the specified string, following the same rule as the Get procedure that reads a real value from a file but treating the end of the string as a file terminator. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. It returns, in the Last parameter, the index value such that From(Last) is the last character read. @node !Io.Text_Io.Float_Io.Num type Num is digits <>; Defines the floating-point type of the items that form the elements in the I/O stream. @node !Io.Text_Io.Float_Io.Put procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); Writes a floating-point value to a file. This procedure outputs the value of the Item parameter as a decimal literal with the format defined by the Fore, Aft, and Exp parameters. If the value is negative, a minus sign is included in the integer part. If Exp has the value 0, the integer part to be output has as many digits as needed to represent the integer part of the value of the Item parameter, overriding Fore if necessary, or it consists of the digit 0 if the value of Item has no integer part. If Exp has a value greater than 0, the integer part to be output has a single digit, which is nonzero except for the value 0.0 of the Item parameter. In both cases, however, if the integer part to be output has fewer than Fore characters, including any minus sign, leading spaces are output to make up the difference. The number of digits of the fractional part is specified by Aft, or it is 1 if Aft equals 0. The value is rounded; a value of exactly one-half in the last place can be rounded either up or down. If Exp has the value 0, there is no exponent part. If Exp has a value greater than 0, the exponent part to be output has as many digits as needed to represent the exponent part of the value of Item (for which a single-digit integer part is used), and it includes an initial sign (plus or minus). If the exponent part to be output has fewer than Exp characters, including the sign, leading zeros precede the digits to make up the difference. For the value 0.0 of Item, the exponent has the value 0. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Float_Io.Put procedure Put (To : out String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp); Writes a floating-point value to a string. This procedure outputs the value of the Item parameter to the specified string, following the same rule as for output to a file, using a value for the width of the Fore field such that the sequence of characters output exactly fills the string, including any leading spaces. For an item with a positive value, if output to a string, the parameter exactly fills the string without leading spaces, then output of the corresponding negative value raises the Io_Exceptions.Layout_Error exception. @node !Io.Text_Io.Integer_Io This package provides facilities for integer I/O. Values are output as decimal or based literals, without underline characters or exponents, and preceded by a minus sign if negative. The format (which includes any leading spaces and a minus sign) can be specified by an optional field Width parameter. Values of widths of fields in output formats are of the nonnegative integer Field subtype. Values of bases are of the integer Number_Base subtype. @node !Io.Text_Io.Integer_Io.Default_Base Default_Base : Number_Base := 10; Denotes the default radix base to be used in output procedures. @node !Io.Text_Io.Integer_Io.Default_Width Default_Width : Field := Num'Width; Denotes the default width to be used in output procedures. @node !Io.Text_Io.Integer_Io.Get procedure Get (File : File_Type; Item : out Num; Width : Field := 0); procedure Get (Item : out Num; Width : Field := 0); Reads an integer value from a file. If the value of the Width parameter is 0, this procedure skips any leading blanks, line terminators, or page terminators, reads a plus or a minus sign if present, and then reads according to the syntax of an integer literal (which may be a based literal). If a nonzero value of the Width parameter is supplied, then exactly Width characters are input, or the characters (possibly none) up to a line terminator are input, whichever comes first; any skipped leading blanks are included in the count. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Integer_Io.Get procedure Get (From : String; Item : out Num; Last : out Positive); Reads an integer value from a string. This procedure reads an integer value from the beginning of the specified string, following the same rules as the Get procedure that reads an integer value from a file but treating the end of the string as a file terminator. The procedure returns, in the Item parameter, the value of the Num type that corresponds to the sequence input. It returns, in the Last parameter, the index value such that From(Last) is the last character read. @node !Io.Text_Io.Integer_Io.Num type Num is range <>; Defines the integer type of the items that form the elements in the I/O stream. @node !Io.Text_Io.Integer_Io.Put procedure Put (File : File_Type; Item : Num; Width : Field := Default_Width; Base : Number_Base := Default_Base); procedure Put (Item : Num; Width : Field := Default_Width; Base : Number_Base := Default_Base); Writes an integer value to a file. This procedure outputs the value of the Item parameter as an integer literal, with no underlines, no exponent, and no leading zeros (but a single zero for the value 0), and with a preceding minus sign for a negative value. If the resulting sequence of characters to be output has fewer characters than specified by the Width parameter, leading spaces are output to make up the difference. The procedure uses the syntax for decimal literal if the Base parameter has the value 10 (either explicitly or through Default_Base); otherwise, it uses the syntax for based literal, with any letters in uppercase. If a File parameter is omitted, the current default file is understood to be specified. @node !Io.Text_Io.Integer_Io.Put procedure Put (To : out String; Item : Num; Base : Number_Base := Default_Base); Writes an integer value to a string. This procedure outputs the value of the Item parameter to the specified string, following the same rule as for output to a file, using the length of the specified string as the value for the Width parameter.