Standard -- see section The Package Standard. Ada -- see section The Package Ada. Asynchronous_Task_Control -- see section Asynchronous Task Control. Calendar -- see section Delay Statements, Duration, and Time. Characters -- see section The Package Characters. Handling -- see section The Package Characters.Handling. Latin_1 -- see section The Package Characters.Latin_1. Command_Line -- see section The Package Command_Line. Decimal -- see section The Package Decimal. Direct_IO -- see section The Generic Package Direct_IO. Dynamic_Priorities -- see section Dynamic Priorities. Exceptions -- see section The Package Exceptions. Finalization -- see section User-Defined Assignment and Finalization. Interrupts -- see section The Package Interrupts. Names -- see section The Package Interrupts. IO_Exceptions -- see section Exceptions in Input-Output. Numerics -- see section The Numerics Packages. Complex_Elementary_Functions -- see section Complex Elementary Functions. Complex_Types -- see section Complex Types. Discrete_Random -- see section Random Number Generation. Elementary_Functions -- see section Elementary Functions. Float_Random -- see section Random Number Generation. Generic_Complex_Elementary_Functions -- see section Complex Elementary Functions. Generic_Complex_Types -- see section Complex Types. Generic_Elementary_Functions -- see section Elementary Functions. Real_Time -- see section Monotonic Time. Sequential_IO -- see section The Generic Package Sequential_IO. Storage_IO -- see section The Generic Package Storage_IO. Streams -- see section The Package Streams. Stream_IO -- see section The Package Streams.Stream_IO. Strings -- see section The Package Strings. Bounded -- see section Bounded-Length String Handling. Fixed -- see section Fixed-Length String Handling. Maps -- see section The Package Strings.Maps. Constants -- see section String-Handling Sets and Mappings. Unbounded -- see section Unbounded-Length String Handling. Wide_Bounded -- see section Wide_String Handling. Wide_Fixed -- see section Wide_String Handling. Wide_Maps -- see section Wide_String Handling. Wide_Constants -- see section Wide_String Handling. Wide_Unbounded -- see section Wide_String Handling. Standard (...continued) Ada (...continued) Synchronous_Task_Control -- see section Synchronous Task Control. Tags -- see section Tagged Types and Type Extensions. Task_Attributes -- see section The Package Task_Attributes. Task_Identification -- see section The Package Task_Identification. Text_IO -- see section The Package Text_IO. Complex_IO -- see section Complex Input-Output. Editing -- see section The Package Text_IO.Editing. Text_Streams -- see section The Package Text_IO.Text_Streams. Unchecked_Conversion -- see section Unchecked Type Conversions. Unchecked_Deallocation -- see section Unchecked Storage Deallocation. Wide_Text_IO -- see section Wide Text Input-Output. Complex_IO -- see section Complex Input-Output. Editing -- see section The Package Wide_Text_IO.Editing. Text_Streams -- see section The Package Wide_Text_IO.Text_Streams. Interfaces -- see section The Package Interfaces. C -- see section Interfacing with C. Pointers -- see section The Generic Package Interfaces.C.Pointers. Strings -- see section The Package Interfaces.C.Strings. COBOL -- see section Interfacing with COBOL. Fortran -- see section Interfacing with Fortran. System -- see section The Package System. Address_To_Access_Conversions -- see section The Package System.Address_To_Access_Conversions. Machine_Code -- see section Machine Code Insertions. RPC -- see section Partition Communication Subsystem. Storage_Elements -- see section The Package System.Storage_Elements. Storage_Pools -- see section Storage Management.Implementation Requirements
package Standard is pragma Pure(Standard);
type Boolean is (False, True);
-- The predefined relational operators -- for this type are as follows:
-- function "=" (Left, Right : Boolean) return Boolean; -- function "/=" (Left, Right : Boolean) return Boolean; -- function "<" (Left, Right : Boolean) return Boolean; -- function "<=" (Left, Right : Boolean) return Boolean; -- function ">" (Left, Right : Boolean) return Boolean; -- function ">=" (Left, Right : Boolean) return Boolean;
-- The predefined logical operators and the predefined -- logical negation operator are as follows:
-- function "and" (Left, Right : Boolean) return Boolean; -- function "or" (Left, Right : Boolean) return Boolean; -- function "xor" (Left, Right : Boolean) return Boolean;
-- function "not" (Right : Boolean) return Boolean;
-- The integer type root_integer is predefined. -- The corresponding universal type is universal_integer.
type Integer is range implementation-defined;
subtype Natural is Integer range 0 .. Integer'Last; subtype Positive is Integer range 1 .. Integer'Last;
-- The predefined operators for type Integer are as follows:
-- function "=" (Left, Right : Integer'Base) return Boolean; -- function "/=" (Left, Right : Integer'Base) return Boolean; -- function "<" (Left, Right : Integer'Base) return Boolean; -- function "<=" (Left, Right : Integer'Base) return Boolean; -- function ">" (Left, Right : Integer'Base) return Boolean; -- function ">=" (Left, Right : Integer'Base) return Boolean;
-- function "+" (Right : Integer'Base) return Integer'Base; -- function "-" (Right : Integer'Base) return Integer'Base; -- function "abs" (Right : Integer'Base) return Integer'Base;
-- function "+" (Left, Right : Integer'Base) -- return Integer'Base; -- function "-" (Left, Right : Integer'Base) -- return Integer'Base; -- function "*" (Left, Right : Integer'Base) -- return Integer'Base; -- function "/" (Left, Right : Integer'Base) -- return Integer'Base; -- function "rem" (Left, Right : Integer'Base) -- return Integer'Base; -- function "mod" (Left, Right : Integer'Base) -- return Integer'Base;
-- function "**" (Left : Integer'Base; Right : Natural) return Integer'Base;
-- The specification of each operator for the type -- root_integer, or for any additional predefined integer -- type, is obtained by replacing Integer by the name of the type -- in the specification of the corresponding operator of the type -- Integer. The right operand of the exponentiation operator -- remains as subtype Natural.
-- The floating point type root_real is predefined. -- The corresponding universal type is universal_real.
type Float is digits implementation-defined;
-- The predefined operators for this type are as follows:
-- function "=" (Left, Right : Float) return Boolean; -- function "/=" (Left, Right : Float) return Boolean; -- function "<" (Left, Right : Float) return Boolean; -- function "<=" (Left, Right : Float) return Boolean; -- function ">" (Left, Right : Float) return Boolean; -- function ">=" (Left, Right : Float) return Boolean;
-- function "+" (Right : Float) return Float; -- function "-" (Right : Float) return Float; -- function "abs" (Right : Float) return Float;
-- function "+" (Left, Right : Float) return Float; -- function "-" (Left, Right : Float) return Float; -- function "*" (Left, Right : Float) return Float; -- function "/" (Left, Right : Float) return Float;
-- function "**" (Left : Float; Right : Integer'Base) return Float;
-- The specification of each operator for the type root_real, -- or for any additional predefined floating point type, is -- obtained by replacing Float by the name of the type in the -- specification of the corresponding operator of the type Float.
-- In addition, the following operators are predefined for -- the root numeric types:
function "*" (Left : root_integer; Right : root_real) return root_real;
function "*" (Left : root_real; Right : root_integer) return root_real;
function "/" (Left : root_real; Right : root_integer) return root_real;
-- The type universal_fixed is predefined. -- The only multiplying operators defined between -- fixed point types are
function "*" (Left : universal_fixed; Right : universal_fixed) return universal_fixed;
function "/" (Left : universal_fixed; Right : universal_fixed) return universal_fixed; -- The declaration of type Character is based on the standard -- ISO 8859-1 character set.
-- There are no character literals corresponding to the -- positions for control characters. They are indicated in -- italics in this definition. See section Character Types. type Character is (nul, soh, stx, etx, eot, enq, ack, bel, bs, ht, lf, vt, ff, cr, so, si, dle, dc1, dc2, dc3, dc4, nak, syn, etb, can, em, sub, esc, fs, gs, rs, us, ' ', '!', '"', '#', '$', '%', '&', ''', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', del, reserved_128, reserved_129, bph, nbh, reserved_132, nel, ssa, esa, hts, htj, vts, pld, plu, ri, ss2, ss3, dcs, pu1, pu2, sts, cch, mw, spa, epa, sos, reserved_153, sci, csi, st, osc, pm, apc, ... );
-- The predefined operators for the type Character are the -- same as for any enumeration type. -- The declaration of type Wide_Character is based on the -- standard ISO 10646 BMP character set. The first 256 positions -- have the same contents as type Character. See section Character Types. type Wide_Character is (nul, soh ... FFFE, FFFF); package ASCII is ... end ASCII; --Obsolescent; See section ASCII. -- Predefined string types:
type String is array(Positive range <>) of Character; pragma Pack(String);
-- The predefined operators for this type are as follows:
-- function "=" (Left, Right: String) return Boolean; -- function "/=" (Left, Right: String) return Boolean; -- function "<" (Left, Right: String) return Boolean; -- function "<=" (Left, Right: String) return Boolean; -- function ">" (Left, Right: String) return Boolean; -- function ">=" (Left, Right: String) return Boolean;
-- function "&" (Left: String; Right: String) -- return String; -- function "&" (Left: Character; Right: String) -- return String; -- function "&" (Left: String; Right: Character) -- return String; -- function "&" (Left: Character; Right: Character) -- return String;
type Wide_String is array(Positive range <>) of Wide_Character; pragma Pack(Wide_String);
-- The predefined operators for this type correspond to those -- for String
type Duration is delta implementation-defined range implementation-defined;
-- The predefined operators for the type Duration are the -- same as for any fixed point type.
-- The predefined exceptions:
Constraint_Error: exception; Program_Error : exception; Storage_Error : exception; Tasking_Error : exception;
end Standard;
Static Semantics
package Ada is pragma Pure(Ada); end Ada;
Static Semantics
package Ada.Characters is pragma Pure(Characters); end Ada.Characters;
Static Semantics
package Ada.Characters.Handling is pragma Preelaborate(Handling);
-- Character classification functions
function Is_Control (Item : in Character) return Boolean; function Is_Graphic (Item : in Character) return Boolean; function Is_Letter (Item : in Character) return Boolean; function Is_Lower (Item : in Character) return Boolean; function Is_Upper (Item : in Character) return Boolean; function Is_Basic (Item : in Character) return Boolean; function Is_Digit (Item : in Character) return Boolean; function Is_Decimal_Digit (Item : in Character) return Boolean renames Is_Digit; function Is_Hexadecimal_Digit (Item : in Character) return Boolean; function Is_Alphanumeric (Item : in Character) return Boolean; function Is_Special (Item : in Character) return Boolean;
-- Conversion functions for Character and String
function To_Lower (Item : in Character) return Character; function To_Upper (Item : in Character) return Character; function To_Basic (Item : in Character) return Character;
function To_Lower (Item : in String) return String; function To_Upper (Item : in String) return String; function To_Basic (Item : in String) return String;
-- Classifications of and conversions -- between Character and ISO 646
subtype ISO_646 is Character range Character'Val(0) .. Character'Val(127);
function Is_ISO_646 (Item : in Character) return Boolean; function Is_ISO_646 (Item : in String) return Boolean;
function To_ISO_646 (Item : in Character; Substitute : in ISO_646 := ' ') return ISO_646;
function To_ISO_646 (Item : in String; Substitute : in ISO_646 := ' ') return String;
-- Classifications of and conversions -- between Wide_Character and Character.
function Is_Character (Item : in Wide_Character) return Boolean; function Is_String (Item : in Wide_String) return Boolean;
function To_Character (Item : in Wide_Character; Substitute : in Character := ' ') return Character;
function To_String (Item : in Wide_String; Substitute : in Character := ' ') return String;
function To_Wide_Character (Item : in Character) return Wide_Character;
function To_Wide_String (Item : in String) return Wide_String;
end Ada.Characters.Handling;
True if Item is a control character. A control character is a character whose position is in one of the ranges 0..31 or 127..159.
True if Item is a graphic character. A graphic character is a character whose position is in one of the ranges 32..126 or 160..255.
True if Item is a letter. A letter is a character that is in one of the ranges 'A'..'Z' or 'a'..'z', or whose position is in one of the ranges 192..214, 216..246, or 248..255.
True if Item is a lower-case letter. A lower-case letter is a character that is in the range 'a'..'z', or whose position is in one of the ranges 223..246 or 248..255.
True if Item is an upper-case letter. An upper-case letter is a character that is in the range 'A'..'Z' or whose position is in one of the ranges 192..214 or 216.. 222.
True if Item is a basic letter. A basic letter is a character that is in one of the ranges 'A'..'Z' and 'a'..'z', or that is one of the following: an upper- or lower-case AE diphthong, an upper- or lower-case Icelandic eth, an upper- or lower-case Icelandic thorn, or a sharp-s.
True if Item is a decimal digit. A decimal digit is a character in the range '0'..'9'.
A renaming of Is_Digit.
True if Item is a hexadecimal digit. A hexadecimal digit is a character that is either a decimal digit or that is in one of the ranges 'A' .. 'F' or 'a' .. 'f'.
True if Item is an alphanumeric character. An alphanumeric character is a character that is either a letter or a decimal digit.
True if Item is a special graphic character. A special graphic character is a graphic character that is not alphanumeric.
Returns the corresponding lower-case value for Item if Is_Upper(Item), and returns Item otherwise.
Returns the corresponding upper-case value for Item if Is_Lower(Item) and Item has an upper-case form, and returns Item otherwise. The lower case letters sharp-s and y-diaeresis do not have upper case forms.
Returns the letter corresponding to Item but with no diacritical mark, if Item is a letter but not a basic letter; returns Item otherwise.
The function whose formal parameter, Item, is of type Character returns True if Item is in the subtype ISO_646.
The function whose formal parameter, Item, is of type String returns True if Is_ISO_646(Item(I)) is True for each I in Item'Range.
The function whose first formal parameter, Item, is of type Character returns Item if Is_ISO_646(Item), and returns the Substitute ISO_646 character otherwise.
The function whose first formal parameter, Item, is of type String returns the String whose Range is 1..Item'Length and each of whose elements is given by To_ISO_646 of the corresponding element in Item.
Returns True if Wide_Character'Pos(Item) <= Character'Pos(Character'Last).
Returns True if Is_Character(Item(I)) is True for each I in Item'Range.
Returns the Character corresponding to Item if Is_Character(Item), and returns the Substitute Character otherwise.
Returns the String whose range is 1..Item'Length and each of whose elements is given by To_Character of the corresponding element in Item.
Returns the Wide_Character X such that Character'Pos(Item) = Wide_Character'Pos(X).
Returns the Wide_String whose range is 1..Item'Length and each of whose elements is given by To_Wide_Character of the corresponding element in Item.Implementation Advice
package Ada.Characters.Latin_1 is pragma Pure(Latin_1);
-- Control characters:
NUL : constant Character := Character'Val(0); SOH : constant Character := Character'Val(1); STX : constant Character := Character'Val(2); ETX : constant Character := Character'Val(3); EOT : constant Character := Character'Val(4); ENQ : constant Character := Character'Val(5); ACK : constant Character := Character'Val(6); BEL : constant Character := Character'Val(7); BS : constant Character := Character'Val(8); HT : constant Character := Character'Val(9); LF : constant Character := Character'Val(10); VT : constant Character := Character'Val(11); FF : constant Character := Character'Val(12); CR : constant Character := Character'Val(13); SO : constant Character := Character'Val(14); SI : constant Character := Character'Val(15);
DLE : constant Character := Character'Val(16); DC1 : constant Character := Character'Val(17); DC2 : constant Character := Character'Val(18); DC3 : constant Character := Character'Val(19); DC4 : constant Character := Character'Val(20); NAK : constant Character := Character'Val(21); SYN : constant Character := Character'Val(22); ETB : constant Character := Character'Val(23); CAN : constant Character := Character'Val(24); EM : constant Character := Character'Val(25); SUB : constant Character := Character'Val(26); ESC : constant Character := Character'Val(27); FS : constant Character := Character'Val(28); GS : constant Character := Character'Val(29); RS : constant Character := Character'Val(30); US : constant Character := Character'Val(31);
-- ISO 646 graphic characters:
Space : constant Character := ' '; -- Character'Val(32) Exclamation : constant Character := '!'; -- Character'Val(33) Quotation : constant Character := '"'; -- Character'Val(34) Number_Sign : constant Character := '#'; -- Character'Val(35) Dollar_Sign : constant Character := '$'; -- Character'Val(36) Percent_Sign : constant Character := '%'; -- Character'Val(37) Ampersand : constant Character := '&'; -- Character'Val(38) Apostrophe : constant Character := '''; -- Character'Val(39) Left_Parenthesis : constant Character := '('; -- Character'Val(40) Right_Parenthesis : constant Character := ')'; -- Character'Val(41) Asterisk : constant Character := '*'; -- Character'Val(42) Plus_Sign : constant Character := '+'; -- Character'Val(43) Comma : constant Character := ','; -- Character'Val(44) Hyphen : constant Character := '-'; -- Character'Val(45) Minus_Sign : Character renames Hyphen; Full_Stop : constant Character := '.'; -- Character'Val(46) Solidus : constant Character := '/'; -- Character'Val(47)
-- Decimal digits '0' though '9' are at positions 48 through 57
Colon : constant Character := ':'; -- Character'Val(58) Semicolon : constant Character := ';'; -- Character'Val(59) Less_Than_Sign : constant Character := '<'; -- Character'Val(60) Equals_Sign : constant Character := '='; -- Character'Val(61) Greater_Than_Sign : constant Character := '>'; -- Character'Val(62) Question : constant Character := '?'; -- Character'Val(63) Commercial_At : constant Character := ''; -- Character'Val(64)
-- Letters 'A' through 'Z' are at positions 65 through 90
Left_Square_Bracket : constant Character := '['; -- Character'Val(91) Reverse_Solidus : constant Character := '\'; -- Character'Val(92) Right_Square_Bracket : constant Character := ']'; -- Character'Val(93) Circumflex : constant Character := '^'; -- Character'Val(94) Low_Line : constant Character := '_'; -- Character'Val(95)
Grave : constant Character := '`'; -- Character'Val(96) LC_A : constant Character := 'a'; -- Character'Val(97) LC_B : constant Character := 'b'; -- Character'Val(98) LC_C : constant Character := 'c'; -- Character'Val(99) LC_D : constant Character := 'd'; -- Character'Val(100) LC_E : constant Character := 'e'; -- Character'Val(101) LC_F : constant Character := 'f'; -- Character'Val(102) LC_G : constant Character := 'g'; -- Character'Val(103) LC_H : constant Character := 'h'; -- Character'Val(104) LC_I : constant Character := 'i'; -- Character'Val(105) LC_J : constant Character := 'j'; -- Character'Val(106) LC_K : constant Character := 'k'; -- Character'Val(107) LC_L : constant Character := 'l'; -- Character'Val(108) LC_M : constant Character := 'm'; -- Character'Val(109) LC_N : constant Character := 'n'; -- Character'Val(110) LC_O : constant Character := 'o'; -- Character'Val(111)
LC_P : constant Character := 'p'; -- Character'Val(112) LC_Q : constant Character := 'q'; -- Character'Val(113) LC_R : constant Character := 'r'; -- Character'Val(114) LC_S : constant Character := 's'; -- Character'Val(115) LC_T : constant Character := 't'; -- Character'Val(116) LC_U : constant Character := 'u'; -- Character'Val(117) LC_V : constant Character := 'v'; -- Character'Val(118) LC_W : constant Character := 'w'; -- Character'Val(119) LC_X : constant Character := 'x'; -- Character'Val(120) LC_Y : constant Character := 'y'; -- Character'Val(121) LC_Z : constant Character := 'z'; -- Character'Val(122) Left_Curly_Bracket : constant Character := '{'; -- Character'Val(123) Vertical_Line : constant Character := '|'; -- Character'Val(124) Right_Curly_Bracket : constant Character := '}'; -- Character'Val(125) Tilde : constant Character := '~'; -- Character'Val(126) DEL : constant Character := Character'Val(127);
-- ISO 6429 control characters:
IS4 : Character renames FS; IS3 : Character renames GS; IS2 : Character renames RS; IS1 : Character renames US;
Reserved_128 : constant Character := Character'Val(128); Reserved_129 : constant Character := Character'Val(129); BPH : constant Character := Character'Val(130); NBH : constant Character := Character'Val(131); Reserved_132 : constant Character := Character'Val(132); NEL : constant Character := Character'Val(133); SSA : constant Character := Character'Val(134); ESA : constant Character := Character'Val(135); HTS : constant Character := Character'Val(136); HTJ : constant Character := Character'Val(137); VTS : constant Character := Character'Val(138); PLD : constant Character := Character'Val(139); PLU : constant Character := Character'Val(140); RI : constant Character := Character'Val(141); SS2 : constant Character := Character'Val(142); SS3 : constant Character := Character'Val(143);
DCS : constant Character := Character'Val(144); PU1 : constant Character := Character'Val(145); PU2 : constant Character := Character'Val(146); STS : constant Character := Character'Val(147); CCH : constant Character := Character'Val(148); MW : constant Character := Character'Val(149); SPA : constant Character := Character'Val(150); EPA : constant Character := Character'Val(151);
SOS : constant Character := Character'Val(152); Reserved_153 : constant Character := Character'Val(153); SCI : constant Character := Character'Val(154); CSI : constant Character := Character'Val(155); ST : constant Character := Character'Val(156); OSC : constant Character := Character'Val(157); PM : constant Character := Character'Val(158); APC : constant Character := Character'Val(159);
-- Other graphic characters:
-- Character positions 160 (16#A0#) .. 175 (16#AF#): No_Break_Space : constant Character := ' '; -- Character'Val(160) NBSP : Character renames No_Break_Space; Inverted_Exclamation : constant Character := Character'Val(161); Cent_Sign : constant Character := Character'Val(162); Pound_Sign : constant Character := Character'Val(163); Currency_Sign : constant Character := Character'Val(164); Yen_Sign : constant Character := Character'Val(165); Broken_Bar : constant Character := Character'Val(166); Section_Sign : constant Character := Character'Val(167); Diaeresis : constant Character := Character'Val(168); Copyright_Sign : constant Character := Character'Val(169); Feminine_Ordinal_Indicator : constant Character := Character'Val(170); Left_Angle_Quotation : constant Character := Character'Val(171); Not_Sign : constant Character := Character'Val(172); Soft_Hyphen : constant Character := Character'Val(173); Registered_Trade_Mark_Sign : constant Character := Character'Val(174); Macron : constant Character := Character'Val(175);
-- Character positions 176 (16#B0#) .. 191 (16#BF#): Degree_Sign : constant Character := Character'Val(176); Ring_Above : Character renames Degree_Sign; Plus_Minus_Sign : constant Character := Character'Val(177); Superscript_Two : constant Character := Character'Val(178); Superscript_Three : constant Character := Character'Val(179); Acute : constant Character := Character'Val(180); Micro_Sign : constant Character := Character'Val(181); Pilcrow_Sign : constant Character := Character'Val(182); Paragraph_Sign : Character renames Pilcrow_Sign; Middle_Dot : constant Character := Character'Val(183); Cedilla : constant Character := Character'Val(184); Superscript_One : constant Character := Character'Val(185); Masculine_Ordinal_Indicator : constant Character := Character'Val(186); Right_Angle_Quotation : constant Character := Character'Val(187); Fraction_One_Quarter : constant Character := Character'Val(188); Fraction_One_Half : constant Character := Character'Val(189); Fraction_Three_Quarters : constant Character := Character'Val(190); Inverted_Question : constant Character := Character'Val(191);
-- Character positions 192 (16#C0#) .. 207 (16#CF#): UC_A_Grave : constant Character := Character'Val(192); UC_A_Acute : constant Character := Character'Val(193); UC_A_Circumflex : constant Character := Character'Val(194); UC_A_Tilde : constant Character := Character'Val(195); UC_A_Diaeresis : constant Character := Character'Val(196); UC_A_Ring : constant Character := Character'Val(197); UC_AE_Diphthong : constant Character := Character'Val(198); UC_C_Cedilla : constant Character := Character'Val(199); UC_E_Grave : constant Character := Character'Val(200); UC_E_Acute : constant Character := Character'Val(201); UC_E_Circumflex : constant Character := Character'Val(202); UC_E_Diaeresis : constant Character := Character'Val(203); UC_I_Grave : constant Character := Character'Val(204); UC_I_Acute : constant Character := Character'Val(205); UC_I_Circumflex : constant Character := Character'Val(206); UC_I_Diaeresis : constant Character := Character'Val(207);
-- Character positions 208 (16#D0#) .. 223 (16#DF#): UC_Icelandic_Eth : constant Character := Character'Val(208); UC_N_Tilde : constant Character := Character'Val(209); UC_O_Grave : constant Character := Character'Val(210); UC_O_Acute : constant Character := Character'Val(211); UC_O_Circumflex : constant Character := Character'Val(212); UC_O_Tilde : constant Character := Character'Val(213); UC_O_Diaeresis : constant Character := Character'Val(214); Multiplication_Sign : constant Character := Character'Val(215); UC_O_Oblique_Stroke : constant Character := Character'Val(216); UC_U_Grave : constant Character := Character'Val(217); UC_U_Acute : constant Character := Character'Val(218); UC_U_Circumflex : constant Character := Character'Val(219); UC_U_Diaeresis : constant Character := Character'Val(220); UC_Y_Acute : constant Character := Character'Val(221); UC_Icelandic_Thorn : constant Character := Character'Val(222); LC_German_Sharp_S : constant Character := Character'Val(223);
-- Character positions 224 (16#E0#) .. 239 (16#EF#): LC_A_Grave : constant Character := Character'Val(224); LC_A_Acute : constant Character := Character'Val(225); LC_A_Circumflex : constant Character := Character'Val(226); LC_A_Tilde : constant Character := Character'Val(227); LC_A_Diaeresis : constant Character := Character'Val(228); LC_A_Ring : constant Character := Character'Val(229); LC_AE_Diphthong : constant Character := Character'Val(230); LC_C_Cedilla : constant Character := Character'Val(231); LC_E_Grave : constant Character := Character'Val(232); LC_E_Acute : constant Character := Character'Val(233); LC_E_Circumflex : constant Character := Character'Val(234); LC_E_Diaeresis : constant Character := Character'Val(235); LC_I_Grave : constant Character := Character'Val(236); LC_I_Acute : constant Character := Character'Val(237); LC_I_Circumflex : constant Character := Character'Val(238); LC_I_Diaeresis : constant Character := Character'Val(239);
-- Character positions 240 (16#F0#) .. 255 (16#FF#): LC_Icelandic_Eth : constant Character := Character'Val(240); LC_N_Tilde : constant Character := Character'Val(241); LC_O_Grave : constant Character := Character'Val(242); LC_O_Acute : constant Character := Character'Val(243); LC_O_Circumflex : constant Character := Character'Val(244); LC_O_Tilde : constant Character := Character'Val(245); LC_O_Diaeresis : constant Character := Character'Val(246); Division_Sign : constant Character := Character'Val(247); LC_O_Oblique_Stroke : constant Character := Character'Val(248); LC_U_Grave : constant Character := Character'Val(249); LC_U_Acute : constant Character := Character'Val(250); LC_U_Circumflex : constant Character := Character'Val(251); LC_U_Diaeresis : constant Character := Character'Val(252); LC_Y_Acute : constant Character := Character'Val(253); LC_Icelandic_Thorn : constant Character := Character'Val(254); LC_Y_Diaeresis : constant Character := Character'Val(255); end Ada.Characters.Latin_1;Implementation Permissions
package Ada.Strings is pragma Pure(Strings);
Space : constant Character := ' '; Wide_Space : constant Wide_Character := ' ';
Length_Error, Pattern_Error, Index_Error, Translation_Error : exception;
type Alignment is (Left, Right, Center); type Truncation is (Left, Right, Error); type Membership is (Inside, Outside); type Direction is (Forward, Backward); type Trim_End is (Left, Right, Both); end Ada.Strings;
package Ada.Strings.Maps is pragma Preelaborate(Maps);
-- Representation for a set of character values: type Character_Set is private;
Null_Set : constant Character_Set;
type Character_Range is record Low : Character; High : Character; end record; -- Represents Character range Low..High
type Character_Ranges is array (Positive range <>) of Character_Range;
function To_Set (Ranges : in Character_Ranges) return Character_Set;
function To_Set (Span : in Character_Range) return Character_Set;
function To_Ranges (Set : in Character_Set) return Character_Ranges;
function "=" (Left, Right : in Character_Set) return Boolean;
function "not" (Right : in Character_Set) return Character_Set; function "and" (Left, Right : in Character_Set) return Character_Set; function "or" (Left, Right : in Character_Set) return Character_Set; function "xor" (Left, Right : in Character_Set) return Character_Set; function "-" (Left, Right : in Character_Set) return Character_Set;
function Is_In (Element : in Character; Set : in Character_Set) return Boolean;
function Is_Subset (Elements : in Character_Set; Set : in Character_Set) return Boolean;
function "<=" (Left : in Character_Set; Right : in Character_Set) return Boolean renames Is_Subset;
-- Alternative representation for a set of character values: subtype Character_Sequence is String;
function To_Set (Sequence : in Character_Sequence) return Character_Set;
function To_Set (Singleton : in Character) return Character_Set;
function To_Sequence (Set : in Character_Set) return Character_Sequence;
-- Representation for a character to character mapping: type Character_Mapping is private;
function Value (Map : in Character_Mapping; Element : in Character) return Character;
Identity : constant Character_Mapping;
function To_Mapping (From, To : in Character_Sequence) return Character_Mapping;
function To_Domain (Map : in Character_Mapping) return Character_Sequence; function To_Range (Map : in Character_Mapping) return Character_Sequence;
type Character_Mapping_Function is access function (From : in Character) return Character;
private ... -- not specified by the language end Ada.Strings.Maps;
function To_Set (Ranges : in Character_Ranges) return Character_Set;
function To_Set (Span : in Character_Range) return Character_Set;
function To_Ranges (Set : in Character_Set) return Character_Ranges;
function "=" (Left, Right : in Character_Set) return Boolean;
function Is_In (Element : in Character; Set : in Character_Set); return Boolean;
function Is_Subset (Elements : in Character_Set; Set : in Character_Set) return Boolean;
subtype Character_Sequence is String;
function To_Set (Sequence : in Character_Sequence) return Character_Set; function To_Set (Singleton : in Character) return Character_Set;
function To_Sequence (Set : in Character_Set) return Character_Sequence;
type Character_Mapping is private;
function Value (Map : in Character_Mapping; Element : in Character) return Character;
Identity : constant Character_Mapping;
function To_Mapping (From, To : in Character_Sequence) return Character_Mapping;
function To_Domain (Map : in Character_Mapping) return Character_Sequence;
function To_Range (Map : in Character_Mapping) return Character_Sequence;
with Ada.Strings.Maps; package Ada.Strings.Fixed is pragma Preelaborate(Fixed);
-- "Copy" procedure for strings of possibly different lengths
procedure Move (Source : in String; Target : out String; Drop : in Truncation := Error; Justify : in Alignment := Left; Pad : in Character := Space);
-- Search subprograms
function Index (Source : in String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural;
function Index (Source : in String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping_Function) return Natural;
function Index (Source : in String; Set : in Maps.Character_Set; Test : in Membership := Inside; Going : in Direction := Forward) return Natural;
function Index_Non_Blank (Source : in String; Going : in Direction := Forward) return Natural;
function Count (Source : in String; Pattern : in String; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural;
function Count (Source : in String; Pattern : in String; Mapping : in Maps.Character_Mapping_Function) return Natural;
function Count (Source : in String; Set : in Maps.Character_Set) return Natural;
procedure Find_Token (Source : in String; Set : in Maps.Character_Set; Test : in Membership; First : out Positive; Last : out Natural);
-- String translation subprograms
function Translate (Source : in String; Mapping : in Maps.Character_Mapping) return String;
procedure Translate (Source : in out String; Mapping : in Maps.Character_Mapping);
function Translate (Source : in String; Mapping : in Maps.Character_Mapping_Function) return String;
procedure Translate (Source : in out String; Mapping : in Maps.Character_Mapping_Function);
-- String transformation subprograms
function Replace_Slice (Source : in String; Low : in Positive; High : in Natural; By : in String) return String;
procedure Replace_Slice (Source : in out String; Low : in Positive; High : in Natural; By : in String; Drop : in Truncation := Error; Justify : in Alignment := Left; Pad : in Character := Space);
function Insert (Source : in String; Before : in Positive; New_Item : in String) return String;
procedure Insert (Source : in out String; Before : in Positive; New_Item : in String; Drop : in Truncation := Error);
function Overwrite (Source : in String; Position : in Positive; New_Item : in String) return String;
procedure Overwrite (Source : in out String; Position : in Positive; New_Item : in String; Drop : in Truncation := Right);
function Delete (Source : in String; From : in Positive; Through : in Natural) return String;
procedure Delete (Source : in out String; From : in Positive; Through : in Natural; Justify : in Alignment := Left; Pad : in Character := Space);
-- String selector subprograms function Trim (Source : in String; Side : in Trim_End) return String;
procedure Trim (Source : in out String; Side : in Trim_End; Justify : in Alignment := Left; Pad : in Character := Space);
function Trim (Source : in String; Left : in Maps.Character_Set; Right : in Maps.Character_Set) return String;
procedure Trim (Source : in out String; Left : in Maps.Character_Set; Right : in Maps.Character_Set; Justify : in Alignment := Strings.Left; Pad : in Character := Space);
function Head (Source : in String; Count : in Natural; Pad : in Character := Space) return String;
procedure Head (Source : in out String; Count : in Natural; Justify : in Alignment := Left; Pad : in Character := Space);
function Tail (Source : in String; Count : in Natural; Pad : in Character := Space) return String;
procedure Tail (Source : in out String; Count : in Natural; Justify : in Alignment := Left; Pad : in Character := Space);
--String constructor functions
function "*" (Left : in Natural; Right : in Character) return String;
function "*" (Left : in Natural; Right : in String) return String;
end Ada.Strings.Fixed;
procedure Move (Source : in String; Target : out String; Drop : in Truncation := Error; Justify : in Alignment := Left; Pad : in Character := Space);
function Index (Source : in String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural; function Index (Source : in String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping_Function) return Natural;
function Index (Source : in String; Set : in Maps.Character_Set; Test : in Membership := Inside; Going : in Direction := Forward) return Natural;
function Index_Non_Blank (Source : in String; Going : in Direction := Forward) return Natural;
function Count (Source : in String; Pattern : in String; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural; function Count (Source : in String; Pattern : in String; Mapping : in Maps.Character_Mapping_Function) return Natural;
function Count (Source : in String; Set : in Maps.Character_Set) return Natural;
procedure Find_Token (Source : in String; Set : in Maps.Character_Set; Test : in Membership; First : out Positive; Last : out Natural);
function Translate (Source : in String; Mapping : in Maps.Character_Mapping) return String; function Translate (Source : in String; Mapping : in Maps.Character_Mapping_Function) return String;
procedure Translate (Source : in out String; Mapping : in Maps.Character_Mapping); procedure Translate (Source : in out String; Mapping : in Maps.Character_Mapping_Function);
function Replace_Slice (Source : in String; Low : in Positive; High : in Natural; By : in String) return String;
procedure Replace_Slice (Source : in out String; Low : in Positive; High : in Natural; By : in String; Drop : in Truncation := Error; Justify : in Alignment := Left; Pad : in Character := Space);
function Insert (Source : in String; Before : in Positive; New_Item : in String) return String;
procedure Insert (Source : in out String; Before : in Positive; New_Item : in String; Drop : in Truncation := Error);
function Overwrite (Source : in String; Position : in Positive; New_Item : in String) return String;
procedure Overwrite (Source : in out String; Position : in Positive; New_Item : in String; Drop : in Truncation := Right);
function Delete (Source : in String; From : in Positive; Through : in Natural) return String;
procedure Delete (Source : in out String; From : in Positive; Through : in Natural; Justify : in Alignment := Left; Pad : in Character := Space);
function Trim (Source : in String; Side : in Trim_End) return String;
procedure Trim (Source : in out String; Side : in Trim_End; Justify : in Alignment := Left; Pad : in Character := Space);
function Trim (Source : in String; Left : in Maps.Character_Set; Right : in Maps.Character_Set) return String;
procedure Trim (Source : in out String; Left : in Maps.Character_Set; Right : in Maps.Character_Set; Justify : in Alignment := Strings.Left; Pad : in Character := Space);
function Head (Source : in String; Count : in Natural; Pad : in Character := Space) return String;
procedure Head (Source : in out String; Count : in Natural; Justify : in Alignment := Left; Pad : in Character := Space);
function Tail (Source : in String; Count : in Natural; Pad : in Character := Space) return String;
procedure Tail (Source : in out String; Count : in Natural; Justify : in Alignment := Left; Pad : in Character := Space);
function "*" (Left : in Natural; Right : in Character) return String; function "*" (Left : in Natural; Right : in String) return String;
with Ada.Strings.Maps; package Ada.Strings.Bounded is pragma Preelaborate(Bounded);
generic Max : Positive; -- Maximum length of a Bounded_String package Generic_Bounded_Length is
Max_Length : constant Positive := Max;
type Bounded_String is private;
Null_Bounded_String : constant Bounded_String;
subtype Length_Range is Natural range 0 .. Max_Length;
function Length (Source : in Bounded_String) return Length_Range;
-- Conversion, Concatenation, and Selection functions
function To_Bounded_String (Source : in String; Drop : in Truncation := Error) return Bounded_String;
function To_String (Source : in Bounded_String) return String;
function Append (Left, Right : in Bounded_String; Drop : in Truncation := Error) return Bounded_String;
function Append (Left : in Bounded_String; Right : in String; Drop : in Truncation := Error) return Bounded_String;
function Append (Left : in String; Right : in Bounded_String; Drop : in Truncation := Error) return Bounded_String;
function Append (Left : in Bounded_String; Right : in Character; Drop : in Truncation := Error) return Bounded_String;
function Append (Left : in Character; Right : in Bounded_String; Drop : in Truncation := Error) return Bounded_String;
procedure Append (Source : in out Bounded_String; New_Item : in Bounded_String; Drop : in Truncation := Error);
procedure Append (Source : in out Bounded_String; New_Item : in String; Drop : in Truncation := Error);
procedure Append (Source : in out Bounded_String; New_Item : in Character; Drop : in Truncation := Error);
function "&" (Left, Right : in Bounded_String) return Bounded_String;
function "&" (Left : in Bounded_String; Right : in String) return Bounded_String;
function "&" (Left : in String; Right : in Bounded_String) return Bounded_String;
function "&" (Left : in Bounded_String; Right : in Character) return Bounded_String;
function "&" (Left : in Character; Right : in Bounded_String) return Bounded_String;
function Element (Source : in Bounded_String; Index : in Positive) return Character;
procedure Replace_Element (Source : in out Bounded_String; Index : in Positive; By : in Character);
function Slice (Source : in Bounded_String; Low : in Positive; High : in Natural) return String;
function "=" (Left, Right : in Bounded_String) return Boolean; function "=" (Left : in Bounded_String; Right : in String) return Boolean;
function "=" (Left : in String; Right : in Bounded_String) return Boolean;
function "<" (Left, Right : in Bounded_String) return Boolean;
function "<" (Left : in Bounded_String; Right : in String) return Boolean;
function "<" (Left : in String; Right : in Bounded_String) return Boolean;
function "<=" (Left, Right : in Bounded_String) return Boolean;
function "<=" (Left : in Bounded_String; Right : in String) return Boolean;
function "<=" (Left : in String; Right : in Bounded_String) return Boolean;
function ">" (Left, Right : in Bounded_String) return Boolean;
function ">" (Left : in Bounded_String; Right : in String) return Boolean;
function ">" (Left : in String; Right : in Bounded_String) return Boolean;
function ">=" (Left, Right : in Bounded_String) return Boolean;
function ">=" (Left : in Bounded_String; Right : in String) return Boolean;
function ">=" (Left : in String; Right : in Bounded_String) return Boolean;
-- Search functions
function Index (Source : in Bounded_String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural;
function Index (Source : in Bounded_String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping_Function) return Natural;
function Index (Source : in Bounded_String; Set : in Maps.Character_Set; Test : in Membership := Inside; Going : in Direction := Forward) return Natural;
function Index_Non_Blank (Source : in Bounded_String; Going : in Direction := Forward) return Natural;
function Count (Source : in Bounded_String; Pattern : in String; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural;
function Count (Source : in Bounded_String; Pattern : in String; Mapping : in Maps.Character_Mapping_Function) return Natural;
function Count (Source : in Bounded_String; Set : in Maps.Character_Set) return Natural;
procedure Find_Token (Source : in Bounded_String; Set : in Maps.Character_Set; Test : in Membership; First : out Positive; Last : out Natural);
-- String translation subprograms
function Translate (Source : in Bounded_String; Mapping : in Maps.Character_Mapping) return Bounded_String;
procedure Translate (Source : in out Bounded_String; Mapping : in Maps.Character_Mapping);
function Translate (Source : in Bounded_String; Mapping : in Maps.Character_Mapping_Function) return Bounded_String;
procedure Translate (Source : in out Bounded_String; Mapping : in Maps.Character_Mapping_Function);
-- String transformation subprograms
function Replace_Slice (Source : in Bounded_String; Low : in Positive; High : in Natural; By : in String; Drop : in Truncation := Error) return Bounded_String;
procedure Replace_Slice (Source : in out Bounded_String; Low : in Positive; High : in Natural; By : in String; Drop : in Truncation := Error);
function Insert (Source : in Bounded_String; Before : in Positive; New_Item : in String; Drop : in Truncation := Error) return Bounded_String;
procedure Insert (Source : in out Bounded_String; Before : in Positive; New_Item : in String; Drop : in Truncation := Error);
function Overwrite (Source : in Bounded_String; Position : in Positive; New_Item : in String; Drop : in Truncation := Error) return Bounded_String;
procedure Overwrite (Source : in out Bounded_String; Position : in Positive; New_Item : in String; Drop : in Truncation := Error);
function Delete (Source : in Bounded_String; From : in Positive; Through : in Natural) return Bounded_String;
procedure Delete (Source : in out Bounded_String; From : in Positive; Through : in Natural);
-- String selector subprograms
function Trim (Source : in Bounded_String; Side : in Trim_End) return Bounded_String; procedure Trim (Source : in out Bounded_String; Side : in Trim_End);
function Trim (Source : in Bounded_String; Left : in Maps.Character_Set; Right : in Maps.Character_Set) return Bounded_String;
procedure Trim (Source : in out Bounded_String; Left : in Maps.Character_Set; Right : in Maps.Character_Set);
function Head (Source : in Bounded_String; Count : in Natural; Pad : in Character := Space; Drop : in Truncation := Error) return Bounded_String;
procedure Head (Source : in out Bounded_String; Count : in Natural; Pad : in Character := Space; Drop : in Truncation := Error);
function Tail (Source : in Bounded_String; Count : in Natural; Pad : in Character := Space; Drop : in Truncation := Error) return Bounded_String;
procedure Tail (Source : in out Bounded_String; Count : in Natural; Pad : in Character := Space; Drop : in Truncation := Error);
-- String constructor subprograms
function "*" (Left : in Natural; Right : in Character) return Bounded_String;
function "*" (Left : in Natural; Right : in String) return Bounded_String;
function "*" (Left : in Natural; Right : in Bounded_String) return Bounded_String;
function Replicate (Count : in Natural; Item : in Character; Drop : in Truncation := Error) return Bounded_String;
function Replicate (Count : in Natural; Item : in String; Drop : in Truncation := Error) return Bounded_String;
function Replicate (Count : in Natural; Item : in Bounded_String; Drop : in Truncation := Error) return Bounded_String;
private ... -- not specified by the language end Generic_Bounded_Length;
end Ada.Strings.Bounded;
function Length (Source : in Bounded_String) return Length_Range;
function To_Bounded_String (Source : in String; Drop : in Truncation := Error) return Bounded_String;
function To_String (Source : in Bounded_String) return String;
function Element (Source : in Bounded_String; Index : in Positive) return Character;
procedure Replace_Element (Source : in out Bounded_String; Index : in Positive; By : in Character);
function Slice (Source : in Bounded_String; Low : in Positive; High : in Natural) return String;
with Ada.Strings.Maps; package Ada.Strings.Unbounded is pragma Preelaborate(Unbounded);
type Unbounded_String is private;
Null_Unbounded_String : constant Unbounded_String;
function Length (Source : in Unbounded_String) return Natural;
type String_Access is access all String; procedure Free (X : in out String_Access);
-- Conversion, Concatenation, and Selection functions
function To_Unbounded_String (Source : in String) return Unbounded_String;
function To_Unbounded_String (Length : in Natural) return Unbounded_String;
function To_String (Source : in Unbounded_String) return String;
procedure Append (Source : in out Unbounded_String; New_Item : in Unbounded_String);
procedure Append (Source : in out Unbounded_String; New_Item : in String);
procedure Append (Source : in out Unbounded_String; New_Item : in Character);
function "&" (Left, Right : in Unbounded_String) return Unbounded_String;
function "&" (Left : in Unbounded_String; Right : in String) return Unbounded_String;
function "&" (Left : in String; Right : in Unbounded_String) return Unbounded_String;
function "&" (Left : in Unbounded_String; Right : in Character) return Unbounded_String;
function "&" (Left : in Character; Right : in Unbounded_String) return Unbounded_String;
function Element (Source : in Unbounded_String; Index : in Positive) return Character;
procedure Replace_Element (Source : in out Unbounded_String; Index : in Positive; By : in Character);
function Slice (Source : in Unbounded_String; Low : in Positive; High : in Natural) return String;
function "=" (Left, Right : in Unbounded_String) return Boolean;
function "=" (Left : in Unbounded_String; Right : in String) return Boolean;
function "=" (Left : in String; Right : in Unbounded_String) return Boolean;
function "<" (Left, Right : in Unbounded_String) return Boolean;
function "<" (Left : in Unbounded_String; Right : in String) return Boolean;
function "<" (Left : in String; Right : in Unbounded_String) return Boolean;
function "<=" (Left, Right : in Unbounded_String) return Boolean;
function "<=" (Left : in Unbounded_String; Right : in String) return Boolean;
function "<=" (Left : in String; Right : in Unbounded_String) return Boolean;
function ">" (Left, Right : in Unbounded_String) return Boolean;
function ">" (Left : in Unbounded_String; Right : in String) return Boolean;
function ">" (Left : in String; Right : in Unbounded_String) return Boolean;
function ">=" (Left, Right : in Unbounded_String) return Boolean;
function ">=" (Left : in Unbounded_String; Right : in String) return Boolean;
function ">=" (Left : in String; Right : in Unbounded_String) return Boolean;
-- Search subprograms
function Index (Source : in Unbounded_String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural;
function Index (Source : in Unbounded_String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping_Function) return Natural;
function Index (Source : in Unbounded_String; Set : in Maps.Character_Set; Test : in Membership := Inside; Going : in Direction := Forward) return Natural;
function Index_Non_Blank (Source : in Unbounded_String; Going : in Direction := Forward) return Natural;
function Count (Source : in Unbounded_String; Pattern : in String; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural;
function Count (Source : in Unbounded_String; Pattern : in String; Mapping : in Maps.Character_Mapping_Function) return Natural;
function Count (Source : in Unbounded_String; Set : in Maps.Character_Set) return Natural;
procedure Find_Token (Source : in Unbounded_String; Set : in Maps.Character_Set; Test : in Membership; First : out Positive; Last : out Natural);
-- String translation subprograms
function Translate (Source : in Unbounded_String; Mapping : in Maps.Character_Mapping) return Unbounded_String;
procedure Translate (Source : in out Unbounded_String; Mapping : in Maps.Character_Mapping);
function Translate (Source : in Unbounded_String; Mapping : in Maps.Character_Mapping_Function) return Unbounded_String;
procedure Translate (Source : in out Unbounded_String; Mapping : in Maps.Character_Mapping_Function);
-- String transformation subprograms
function Replace_Slice (Source : in Unbounded_String; Low : in Positive; High : in Natural; By : in String) return Unbounded_String;
procedure Replace_Slice (Source : in out Unbounded_String; Low : in Positive; High : in Natural; By : in String);
function Insert (Source : in Unbounded_String; Before : in Positive; New_Item : in String) return Unbounded_String;
procedure Insert (Source : in out Unbounded_String; Before : in Positive; New_Item : in String);
function Overwrite (Source : in Unbounded_String; Position : in Positive; New_Item : in String) return Unbounded_String;
procedure Overwrite (Source : in out Unbounded_String; Position : in Positive; New_Item : in String);
function Delete (Source : in Unbounded_String; From : in Positive; Through : in Natural) return Unbounded_String;
procedure Delete (Source : in out Unbounded_String; From : in Positive; Through : in Natural);
function Trim (Source : in Unbounded_String; Side : in Trim_End) return Unbounded_String;
procedure Trim (Source : in out Unbounded_String; Side : in Trim_End);
function Trim (Source : in Unbounded_String; Left : in Maps.Character_Set; Right : in Maps.Character_Set) return Unbounded_String;
procedure Trim (Source : in out Unbounded_String; Left : in Maps.Character_Set; Right : in Maps.Character_Set);
function Head (Source : in Unbounded_String; Count : in Natural; Pad : in Character := Space) return Unbounded_String;
procedure Head (Source : in out Unbounded_String; Count : in Natural; Pad : in Character := Space);
function Tail (Source : in Unbounded_String; Count : in Natural; Pad : in Character := Space) return Unbounded_String;
procedure Tail (Source : in out Unbounded_String; Count : in Natural; Pad : in Character := Space);
function "*" (Left : in Natural; Right : in Character) return Unbounded_String;
function "*" (Left : in Natural; Right : in String) return Unbounded_String;
function "*" (Left : in Natural; Right : in Unbounded_String) return Unbounded_String;
private ... -- not specified by the language end Ada.Strings.Unbounded;
package Ada.Strings.Maps.Constants is pragma Preelaborate(Constants);
Control_Set : constant Character_Set; Graphic_Set : constant Character_Set; Letter_Set : constant Character_Set; Lower_Set : constant Character_Set; Upper_Set : constant Character_Set; Basic_Set : constant Character_Set; Decimal_Digit_Set : constant Character_Set; Hexadecimal_Digit_Set : constant Character_Set; Alphanumeric_Set : constant Character_Set; Special_Set : constant Character_Set; ISO_646_Set : constant Character_Set;
Lower_Case_Map : constant Character_Mapping; --Maps to lower case for letters, else identity Upper_Case_Map : constant Character_Mapping; --Maps to upper case for letters, else identity Basic_Map : constant Character_Mapping; --Maps to basic letter for letters, else identity
private ... -- not specified by the language end Ada.Strings.Maps.Constants;
package Ada.Strings.Wide_Maps is pragma Preelaborate(Wide_Maps);
-- Representation for a set of Wide_Character values: type Wide_Character_Set is private;
Null_Set : constant Wide_Character_Set;
type Wide_Character_Range is record Low : Wide_Character; High : Wide_Character; end record; -- Represents Wide_Character range Low..High
type Wide_Character_Ranges is array (Positive range <>) of Wide_Character_Range;
function To_Set (Ranges : in Wide_Character_Ranges) return Wide_Character_Set;
function To_Set (Span : in Wide_Character_Range) return Wide_Character_Set;
function To_Ranges (Set : in Wide_Character_Set) return Wide_Character_Ranges;
function "=" (Left, Right : in Wide_Character_Set) return Boolean;
function "not" (Right : in Wide_Character_Set) return Wide_Character_Set; function "and" (Left, Right : in Wide_Character_Set) return Wide_Character_Set; function "or" (Left, Right : in Wide_Character_Set) return Wide_Character_Set; function "xor" (Left, Right : in Wide_Character_Set) return Wide_Character_Set; function "-" (Left, Right : in Wide_Character_Set) return Wide_Character_Set;
function Is_In (Element : in Wide_Character; Set : in Wide_Character_Set) return Boolean;
function Is_Subset (Elements : in Wide_Character_Set; Set : in Wide_Character_Set) return Boolean;
function "<=" (Left : in Wide_Character_Set; Right : in Wide_Character_Set) return Boolean renames Is_Subset;
-- Alternative representation for a set of Wide_Character values: subtype Wide_Character_Sequence is Wide_String;
function To_Set (Sequence : in Wide_Character_Sequence) return Wide_Character_Set;
function To_Set (Singleton : in Wide_Character) return Wide_Character_Set;
function To_Sequence (Set : in Wide_Character_Set) return Wide_Character_Sequence;
-- Representation for a Wide_Character to Wide_Character mapping: type Wide_Character_Mapping is private;
function Value (Map : in Wide_Character_Mapping; Element : in Wide_Character) return Wide_Character;
Identity : constant Wide_Character_Mapping;
function To_Mapping (From, To : in Wide_Character_Sequence) return Wide_Character_Mapping;
function To_Domain (Map : in Wide_Character_Mapping) return Wide_Character_Sequence;
function To_Range (Map : in Wide_Character_Mapping) return Wide_Character_Sequence;
type Wide_Character_Mapping_Function is access function (From : in Wide_Character) return Wide_Character;
private ... -- not specified by the language end Ada.Strings.Wide_Maps;
Character_Set : constant Wide_Maps.Wide_Character_Set; -- Contains each Wide_Character value WC such that -- Characters.Is_Character(WC) is TrueNOTES
package Ada.Numerics is pragma Pure(Numerics); Argument_Error : exception; Pi : constant := 3.14159_26535_89793_23846_26433_83279_50288_41971_69399_37511; e : constant := 2.71828_18284_59045_23536_02874_71352_66249_77572_47093_69996; end Ada.Numerics;
generic type Float_Type is digits <>; package Ada.Numerics.Generic_Elementary_Functions is pragma Pure(Generic_Elementary_Functions);
function Sqrt (X : Float_Type'Base) return Float_Type'Base; function Log (X : Float_Type'Base) return Float_Type'Base; function Log (X, Base : Float_Type'Base) return Float_Type'Base; function Exp (X : Float_Type'Base) return Float_Type'Base; function "**" (Left, Right : Float_Type'Base) return Float_Type'Base;
function Sin (X : Float_Type'Base) return Float_Type'Base; function Sin (X, Cycle : Float_Type'Base) return Float_Type'Base; function Cos (X : Float_Type'Base) return Float_Type'Base; function Cos (X, Cycle : Float_Type'Base) return Float_Type'Base; function Tan (X : Float_Type'Base) return Float_Type'Base; function Tan (X, Cycle : Float_Type'Base) return Float_Type'Base; function Cot (X : Float_Type'Base) return Float_Type'Base; function Cot (X, Cycle : Float_Type'Base) return Float_Type'Base;
function Arcsin (X : Float_Type'Base) return Float_Type'Base; function Arcsin (X, Cycle : Float_Type'Base) return Float_Type'Base; function Arccos (X : Float_Type'Base) return Float_Type'Base; function Arccos (X, Cycle : Float_Type'Base) return Float_Type'Base; function Arctan (Y : Float_Type'Base; X : Float_Type'Base := 1.0) return Float_Type'Base; function Arctan (Y : Float_Type'Base; X : Float_Type'Base := 1.0; Cycle : Float_Type'Base) return Float_Type'Base; function Arccot (X : Float_Type'Base; Y : Float_Type'Base := 1.0) return Float_Type'Base; function Arccot (X : Float_Type'Base; Y : Float_Type'Base := 1.0; Cycle : Float_Type'Base) return Float_Type'Base;
function Sinh (X : Float_Type'Base) return Float_Type'Base; function Cosh (X : Float_Type'Base) return Float_Type'Base; function Tanh (X : Float_Type'Base) return Float_Type'Base; function Coth (X : Float_Type'Base) return Float_Type'Base; function Arcsinh (X : Float_Type'Base) return Float_Type'Base; function Arccosh (X : Float_Type'Base) return Float_Type'Base; function Arctanh (X : Float_Type'Base) return Float_Type'Base; function Arccoth (X : Float_Type'Base) return Float_Type'Base;
end Ada.Numerics.Generic_Elementary_Functions;
Implementation Permissions
package Ada.Numerics.Float_Random is
-- Basic facilities
type Generator is limited private;
subtype Uniformly_Distributed is Float range 0.0 .. 1.0; function Random (Gen : Generator) return Uniformly_Distributed;
procedure Reset (Gen : in Generator; Initiator : in Integer); procedure Reset (Gen : in Generator);
-- Advanced facilities
type State is private;
procedure Save (Gen : in Generator; To_State : out State); procedure Reset (Gen : in Generator; From_State : in State);
Max_Image_Width : constant := implementation-defined integer value;
function Image (Of_State : State) return String; function Value (Coded_State : String) return State;
private ... -- not specified by the language end Ada.Numerics.Float_Random;
generic type Result_Subtype is (<>); package Ada.Numerics.Discrete_Random is
-- Basic facilities
type Generator is limited private;
function Random (Gen : Generator) return Result_Subtype;
procedure Reset (Gen : in Generator; Initiator : in Integer); procedure Reset (Gen : in Generator);
-- Advanced facilities
type State is private;
procedure Save (Gen : in Generator; To_State : out State); procedure Reset (Gen : in Generator; From_State : in State);
Max_Image_Width : constant := implementation-defined integer value;
function Image (Of_State : State) return String; function Value (Coded_State : String) return State;
private ... -- not specified by the language end Ada.Numerics.Discrete_Random;
function Random (Gen : Generator) return Uniformly_Distributed; function Random (Gen : Generator) return Result_Subtype;
procedure Reset (Gen : in Generator; Initiator : in Integer); procedure Reset (Gen : in Generator);
procedure Save (Gen : in Generator; To_State : out State); procedure Reset (Gen : in Generator; From_State : in State);
function Image (Of_State : State) return String; function Value (Coded_State : String) return State;
Dynamic Semantics
Integer(Float(M) * Random(G)) mod M
-Log(Random(G) + Float'Model_Small))
with Ada.Numerics.Discrete_Random; procedure Dice_Game is subtype Die is Integer range 1 .. 6; subtype Dice is Integer range 2*Die'First .. 2*Die'Last; package Random_Die is new Ada.Numerics.Discrete_Random (Die); use Random_Die; G : Generator; D : Dice; begin Reset (G); -- Start the generator in a unique state in each run loop -- Roll a pair of dice; sum and process the results D := Random(G) + Random(G); ... end loop; end Dice_Game;
with Ada.Numerics.Discrete_Random; procedure Flip_A_Coin is type Coin is (Heads, Tails); package Random_Coin is new Ada.Numerics.Discrete_Random (Coin); use Random_Coin; G : Generator; begin Reset (G); -- Start the generator in a unique state in each run loop -- Toss a coin and process the result case Random(G) is when Heads => ... when Tails => ... end case; ... end loop; end Flip_A_Coin;
with Ada.Numerics.Float_Random; procedure Parallel_Simulation is use Ada.Numerics.Float_Random; task type Worker is entry Initialize_Generator (Initiator : in Integer); ... end Worker; W : array (1 .. 10) of Worker; task body Worker is G : Generator; Probability_Of_Event : Uniformly_Distributed; begin accept Initialize_Generator (Initiator : in Integer) do Reset (G, Initiator); end Initialize_Generator; loop ... Probability_Of_Event := Random(G); ... end loop; end Worker; begin -- Initialize the generators in the Worker tasks -- to different states for I in W'Range loop W(I).Initialize_Generator (I); end loop; ... -- Wait for the Worker tasks to terminate end Parallel_Simulation;NOTES
Static Semantics
Yields the radix of the hardware representation of the type T. The value of this attribute is of the type universal_integer.
+/-mantissa*T'Machine_Radix ** exponentwhere
Yields the largest value of p such that every value expressible in the canonical form (for the type T), having a p-digit mantissa and an exponent between T'Machine_Emin and T'Machine_Emax, is a machine number, see section Floating Point Types, of the type T. This attribute yields a value of the type universal_integer.
Yields the smallest (most negative) value of exponent such that every value expressible in the canonical form (for the type T), having a mantissa of T'Machine_Mantissa digits, is a machine number, see section Floating Point Types, of the type T. This attribute yields a value of the type universal_integer.
Yields the largest (most positive) value of exponent such that every value expressible in the canonical form (for the type T), having a mantissa of T'Machine_Mantissa digits, is a machine number See section Floating Point Types, of the type T. This attribute yields a value of the type universal_integer.
Yields the value True if every value expressible in the form +/-mantissa*T'Machine_Radix ** T'Machine_Emin where mantissa is a nonzero T'Machine_Mantissa-digit fraction in the number base T'Machine_Radix, the first digit of which is zero, is a machine number, see section Floating Point Types, of the type T; yields the value False otherwise. The value of this attribute is of the predefined type Boolean.
Yields the value True if rounding is performed on inexact results of every predefined operation that yields a result of the type T; yields the value False otherwise. The value of this attribute is of the predefined type Boolean.
Yields the value True if overflow and divide-by-zero are detected and reported by raising Constraint_Error for every predefined operation that yields a result of the type T; yields the value False otherwise. The value of this attribute is of the predefined type Boolean.
Yields the value True if the hardware representation for the type T has the capability of representing both positively and negatively signed zeros, these being generated and used by the predefined operations of the type T as specified in IEC 559:1989; yields the value False otherwise. The value of this attribute is of the predefined type Boolean.
S'Exponent denotes a function with the following specification:
function S'Exponent (X : T) return universal_integer
S'Fraction denotes a function with the following specification:
function S'Fraction (X : T) return T
S'Compose denotes a function with the following specification:
function S'Compose (Fraction : T; Exponent : universal_integer) return T
S'Scaling denotes a function with the following specification:
function S'Scaling (X : T; Adjustment : universal_integer) return T
S'Floor denotes a function with the following specification:
function S'Floor (X : T) return T
S'Ceiling denotes a function with the following specification:
function S'Ceiling (X : T) return T
S'Rounding denotes a function with the following specification:
function S'Rounding (X : T) return T
S'Unbiased_Rounding denotes a function with the following specification:
function S'Unbiased_Rounding (X : T) return T
S'Truncation denotes a function with the following specification:
function S'Truncation (X : T) return T
S'Remainder denotes a function with the following specification:
function S'Remainder (X, Y : T) return T
S'Adjacent denotes a function with the following specification:
function S'Adjacent (X, Towards : T) return T
S'Copy_Sign denotes a function with the following specification:
function S'Copy_Sign (Value, Sign : T) return T
S'Leading_Part denotes a function with the following specification:
function S'Leading_Part (X : T; Radix_Digits : universal_integer) return T
S'Machine denotes a function with the following specification:
function S'Machine (X : T) return T
If the Numerics Annex is not supported, this attribute yields an implementation defined value that is greater than or equal to Ceiling(d*log (10)/log (T'Machine_Radix))+1, where d is the requested decimal precision of T, and less than or equal to the value of T'Machine_Mantissa. See section Model-Oriented Attributes of Floating Point Types, for further requirements that apply to implementations supporting the Numerics Annex. The value of this attribute is of the type universal_integer.
If the Numerics Annex is not supported, this attribute yields an implementation defined value that is greater than or equal to the value of T'Machine_Emin. See section Model-Oriented Attributes of Floating Point Types, for further requirements that apply to implementations supporting the Numerics Annex. The value of this attribute is of the type universal_integer.
Yields the value T'Machine_Radix ** 1-T'Model_Mantissa. The value of this attribute is of the type universal_real.
Yields the value T'Machine_Radix ** T'Model_Emin-1. The value of this attribute is of the type universal_real.
S'Model denotes a function with the following specification:
function S'Model (X : T) return T
Yields the lower bound of the safe range, see section Floating Point Types, of the type T. If the Numerics Annex is not supported, the value of this attribute is implementation defined; See section Model-Oriented Attributes of Floating Point Types, for the definition that applies to implementations supporting the Numerics Annex. The value of this attribute is of the type universal_real.
Yields the upper bound of the safe range, see section Floating Point Types, of the type T. If the Numerics Annex is not supported, the value of this attribute is implementation defined; See section Model-Oriented Attributes of Floating Point Types, for the definition that applies to implementations supporting the Numerics Annex. The value of this attribute is of the type universal_real.
Static Semantics
Yields the radix of the hardware representation of the type T. The value of this attribute is of the type universal_integer.
Yields the value True if rounding is performed on inexact results of every predefined operation that yields a result of the type T; yields the value False otherwise. The value of this attribute is of the predefined type Boolean.
Yields the value True if overflow and divide-by-zero are detected and reported by raising Constraint_Error for every predefined operation that yields a result of the type T; yields the value False otherwise. The value of this attribute is of the predefined type Boolean.
Static Semantics
type File_Mode is (In_File, Inout_File, Out_File); -- for Direct_IO
type File_Mode is (In_File, Out_File, Append_File); -- for Sequential_IO, Text_IO, Wide_Text_IO, and Stream_IO
Static Semantics
Static Semantics
with Ada.IO_Exceptions; generic type Element_Type(<>) is private; package Ada.Sequential_IO is
type File_Type is limited private;
type File_Mode is (In_File, Out_File, Append_File);
-- File management
procedure Create(File : in out File_Type; Mode : in File_Mode := Out_File; Name : in String := ""; Form : in String := "");
procedure Open (File : in out File_Type; Mode : in File_Mode; Name : in String; Form : in String := "");
procedure Close (File : in out File_Type); procedure Delete(File : in out File_Type); procedure Reset (File : in out File_Type; Mode : in File_Mode); procedure Reset (File : in out File_Type);
function Mode (File : in File_Type) return File_Mode; function Name (File : in File_Type) return String; function Form (File : in File_Type) return String;
function Is_Open(File : in File_Type) return Boolean;
-- Input and output operations
procedure Read (File : in File_Type; Item : out Element_Type); procedure Write (File : in File_Type; Item : in Element_Type);
function End_Of_File(File : in File_Type) return Boolean;
-- Exceptions
Status_Error : exception renames IO_Exceptions.Status_Error; Mode_Error : exception renames IO_Exceptions.Mode_Error; Name_Error : exception renames IO_Exceptions.Name_Error; Use_Error : exception renames IO_Exceptions.Use_Error; Device_Error : exception renames IO_Exceptions.Device_Error; End_Error : exception renames IO_Exceptions.End_Error; Data_Error : exception renames IO_Exceptions.Data_Error;
private ... -- not specified by the language end Ada.Sequential_IO;
Static Semantics
procedure Create(File : in out File_Type; Mode : in File_Mode := default_mode; Name : in String := ""; Form : in String := "");
procedure Open(File : in out File_Type; Mode : in File_Mode; Name : in String; Form : in String := "");
procedure Close(File : in out File_Type);
procedure Delete(File : in out File_Type);
procedure Reset(File : in out File_Type; Mode : in File_Mode); procedure Reset(File : in out File_Type);
function Mode(File : in File_Type) return File_Mode;
function Name(File : in File_Type) return String;
function Form(File : in File_Type) return String;
function Is_Open(File : in File_Type) return Boolean;
Implementation Permissions
Static Semantics
procedure Read(File : in File_Type; Item : out Element_Type);
procedure Write(File : in File_Type; Item : in Element_Type);
function End_Of_File(File : in File_Type) return Boolean;
Static Semantics
with Ada.IO_Exceptions; generic type Element_Type is private; package Ada.Direct_IO is
type File_Type is limited private;
type File_Mode is (In_File, Inout_File, Out_File); type Count is range 0 .. implementation-defined; subtype Positive_Count is Count range 1 .. Count'Last;
-- File management
procedure Create(File : in out File_Type; Mode : in File_Mode := Inout_File; Name : in String := ""; Form : in String := "");
procedure Open (File : in out File_Type; Mode : in File_Mode; Name : in String; Form : in String := "");
procedure Close (File : in out File_Type); procedure Delete(File : in out File_Type); procedure Reset (File : in out File_Type; Mode : in File_Mode); procedure Reset (File : in out File_Type);
function Mode (File : in File_Type) return File_Mode; function Name (File : in File_Type) return String; function Form (File : in File_Type) return String;
function Is_Open(File : in File_Type) return Boolean;
-- Input and output operations
procedure Read (File : in File_Type; Item : out Element_Type; From : in Positive_Count); procedure Read (File : in File_Type; Item : out Element_Type);
procedure Write(File : in File_Type; Item : in Element_Type; To : in Positive_Count); procedure Write(File : in File_Type; Item : in Element_Type);
procedure Set_Index(File : in File_Type; To : in Positive_Count);
function Index(File : in File_Type) return Positive_Count; function Size (File : in File_Type) return Count;
function End_Of_File(File : in File_Type) return Boolean;
-- Exceptions
Status_Error : exception renames IO_Exceptions.Status_Error; Mode_Error : exception renames IO_Exceptions.Mode_Error; Name_Error : exception renames IO_Exceptions.Name_Error; Use_Error : exception renames IO_Exceptions.Use_Error; Device_Error : exception renames IO_Exceptions.Device_Error; End_Error : exception renames IO_Exceptions.End_Error; Data_Error : exception renames IO_Exceptions.Data_Error;
private ... -- not specified by the language end Ada.Direct_IO;
Static Semantics
procedure Read(File : in File_Type; Item : out Element_Type; From : in Positive_Count); procedure Read(File : in File_Type; Item : out Element_Type);
procedure Write(File : in File_Type; Item : in Element_Type; To : in Positive_Count); procedure Write(File : in File_Type; Item : in Element_Type);
procedure Set_Index(File : in File_Type; To : in Positive_Count);
function Index(File : in File_Type) return Positive_Count;
function Size(File : in File_Type) return Count;
function End_Of_File(File : in File_Type) return Boolean;
with Ada.IO_Exceptions; with System.Storage_Elements; generic type Element_Type is private; package Ada.Storage_IO is pragma Preelaborate(Storage_IO);
Buffer_Size : constant System.Storage_Elements.Storage_Count := implementation-defined; subtype Buffer_Type is System.Storage_Elements.Storage_Array (1..Buffer_Size);
-- Input and output operations
procedure Read (Buffer : in Buffer_Type; Item : out Element_Type);
procedure Write(Buffer : out Buffer_Type; Item : in Element_Type);
-- Exceptions
Data_Error : exception renames IO_Exceptions.Data_Error; end Ada.Storage_IO;
Static Semantics
type Count is range 0 .. implementation-defined; subtype Positive_Count is Count range 1 .. Count'Last;
Static Semantics
with Ada.IO_Exceptions; package Ada.Text_IO is
type File_Type is limited private;
type File_Mode is (In_File, Out_File, Append_File);
type Count is range 0 .. implementation-defined; subtype Positive_Count is Count range 1 .. Count'Last; Unbounded : constant Count := 0; -- line and page length
subtype Field is Integer range 0 .. implementation-defined; subtype Number_Base is Integer range 2 .. 16;
type Type_Set is (Lower_Case, Upper_Case);
-- File Management
procedure Create (File : in out File_Type; Mode : in File_Mode := Out_File; Name : in String := ""; Form : in String := "");
procedure Open (File : in out File_Type; Mode : in File_Mode; Name : in String; Form : in String := "");
procedure Close (File : in out File_Type); procedure Delete (File : in out File_Type); procedure Reset (File : in out File_Type; Mode : in File_Mode); procedure Reset (File : in out File_Type);
function Mode (File : in File_Type) return File_Mode; function Name (File : in File_Type) return String; function Form (File : in File_Type) return String;
function Is_Open(File : in File_Type) return Boolean;
-- Control of default input and output files
procedure Set_Input (File : in File_Type); procedure Set_Output(File : in File_Type); procedure Set_Error (File : in File_Type);
function Standard_Input return File_Type; function Standard_Output return File_Type; function Standard_Error return File_Type;
function Current_Input return File_Type; function Current_Output return File_Type; function Current_Error return File_Type;
type File_Access is access constant File_Type;
function Standard_Input return File_Access; function Standard_Output return File_Access; function Standard_Error return File_Access;
function Current_Input return File_Access; function Current_Output return File_Access; function Current_Error return File_Access;
--Buffer control procedure Flush (File : in out File_Type); procedure Flush;
-- Specification of line and page lengths
procedure Set_Line_Length(File : in File_Type; To : in Count); procedure Set_Line_Length(To : in Count);
procedure Set_Page_Length(File : in File_Type; To : in Count); procedure Set_Page_Length(To : in Count);
function Line_Length(File : in File_Type) return Count; function Line_Length return Count;
function Page_Length(File : in File_Type) return Count; function Page_Length return Count;
-- Column, Line, and Page Control
procedure New_Line (File : in File_Type; Spacing : in Positive_Count := 1); procedure New_Line (Spacing : in Positive_Count := 1);
procedure Skip_Line (File : in File_Type; Spacing : in Positive_Count := 1); procedure Skip_Line (Spacing : in Positive_Count := 1);
function End_Of_Line(File : in File_Type) return Boolean; function End_Of_Line return Boolean;
procedure New_Page (File : in File_Type); procedure New_Page;
procedure Skip_Page (File : in File_Type); procedure Skip_Page;
function End_Of_Page(File : in File_Type) return Boolean; function End_Of_Page return Boolean;
function End_Of_File(File : in File_Type) return Boolean; function End_Of_File return Boolean;
procedure Set_Col (File : in File_Type; To : in Positive_Count); procedure Set_Col (To : in Positive_Count);
procedure Set_Line(File : in File_Type; To : in Positive_Count); procedure Set_Line(To : in Positive_Count);
function Col (File : in File_Type) return Positive_Count; function Col return Positive_Count;
function Line(File : in File_Type) return Positive_Count; function Line return Positive_Count;
function Page(File : in File_Type) return Positive_Count; function Page return Positive_Count;
-- Character Input-Output
procedure Get(File : in File_Type; Item : out Character); procedure Get(Item : out Character);
procedure Put(File : in File_Type; Item : in Character); procedure Put(Item : in Character);
procedure Look_Ahead (File : in File_Type; Item : out Character; End_Of_Line : out Boolean); procedure Look_Ahead (Item : out Character; End_Of_Line : out Boolean);
procedure Get_Immediate(File : in File_Type; Item : out Character); procedure Get_Immediate(Item : out Character);
procedure Get_Immediate(File : in File_Type; Item : out Character; Available : out Boolean); procedure Get_Immediate(Item : out Character; Available : out Boolean);
-- String Input-Output
procedure Get(File : in File_Type; Item : out String); procedure Get(Item : out String);
procedure Put(File : in File_Type; Item : in String); procedure Put(Item : in String);
procedure Get_Line(File : in File_Type; Item : out String; Last : out Natural); procedure Get_Line(Item : out String; Last : out Natural);
procedure Put_Line(File : in File_Type; Item : in String); procedure Put_Line(Item : in String);
-- Generic packages for Input-Output of Integer Types
generic type Num is range <>; package Integer_IO is
Default_Width : Field := Num'Width; Default_Base : Number_Base := 10;
procedure Get(File : in File_Type; Item : out Num; Width : in Field := 0); procedure Get(Item : out Num; Width : in Field := 0);
procedure Put(File : in File_Type; Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base); procedure Put(Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base); procedure Get(From : in String; Item : out Num; Last : out Positive); procedure Put(To : out String; Item : in Num; Base : in Number_Base := Default_Base);
end Integer_IO;
generic type Num is mod <>; package Modular_IO is
Default_Width : Field := Num'Width; Default_Base : Number_Base := 10;
procedure Get(File : in File_Type; Item : out Num; Width : in Field := 0); procedure Get(Item : out Num; Width : in Field := 0);
procedure Put(File : in File_Type; Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base); procedure Put(Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base); procedure Get(From : in String; Item : out Num; Last : out Positive); procedure Put(To : out String; Item : in Num; Base : in Number_Base := Default_Base);
end Modular_IO;
-- Generic packages for Input-Output of Real Types
generic type Num is digits <>; package Float_IO is
Default_Fore : Field := 2; Default_Aft : Field := Num'Digits-1; Default_Exp : Field := 3;
procedure Get(File : in File_Type; Item : out Num; Width : in Field := 0); procedure Get(Item : out Num; Width : in Field := 0);
procedure Put(File : in File_Type; Item : in Num; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp); procedure Put(Item : in Num; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp);
procedure Get(From : in String; Item : out Num; Last : out Positive); procedure Put(To : out String; Item : in Num; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp); end Float_IO;
generic type Num is delta <>; package Fixed_IO is
Default_Fore : Field := Num'Fore; Default_Aft : Field := Num'Aft; Default_Exp : Field := 0;
procedure Get(File : in File_Type; Item : out Num; Width : in Field := 0); procedure Get(Item : out Num; Width : in Field := 0);
procedure Put(File : in File_Type; Item : in Num; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp); procedure Put(Item : in Num; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp);
procedure Get(From : in String; Item : out Num; Last : out Positive); procedure Put(To : out String; Item : in Num; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp); end Fixed_IO;
generic type Num is delta <> digits <>; package Decimal_IO is
Default_Fore : Field := Num'Fore; Default_Aft : Field := Num'Aft; Default_Exp : Field := 0;
procedure Get(File : in File_Type; Item : out Num; Width : in Field := 0); procedure Get(Item : out Num; Width : in Field := 0);
procedure Put(File : in File_Type; Item : in Num; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp); procedure Put(Item : in Num; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp);
procedure Get(From : in String; Item : out Num; Last : out Positive); procedure Put(To : out String; Item : in Num; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp); end Decimal_IO;
-- Generic package for Input-Output of Enumeration Types
generic type Enum is (<>); package Enumeration_IO is
Default_Width : Field := 0; Default_Setting : Type_Set := Upper_Case;
procedure Get(File : in File_Type; Item : out Enum); procedure Get(Item : out Enum);
procedure Put(File : in File_Type; Item : in Enum; Width : in Field := Default_Width; Set : in Type_Set := Default_Setting); procedure Put(Item : in Enum; Width : in Field := Default_Width; Set : in Type_Set := Default_Setting);
procedure Get(From : in String; Item : out Enum; Last : out Positive); procedure Put(To : out String; Item : in Enum; Set : in Type_Set := Default_Setting); end Enumeration_IO;
-- Exceptions
Status_Error : exception renames IO_Exceptions.Status_Error; Mode_Error : exception renames IO_Exceptions.Mode_Error; Name_Error : exception renames IO_Exceptions.Name_Error; Use_Error : exception renames IO_Exceptions.Use_Error; Device_Error : exception renames IO_Exceptions.Device_Error; End_Error : exception renames IO_Exceptions.End_Error; Data_Error : exception renames IO_Exceptions.Data_Error; Layout_Error : exception renames IO_Exceptions.Layout_Error; private ... -- not specified by the language end Ada.Text_IO;
Static Semantics
Static Semantics
procedure Set_Input(File : in File_Type);
procedure Set_Output(File : in File_Type); procedure Set_Error (File : in File_Type);
function Standard_Input return File_Type; function Standard_Input return File_Access;
function Standard_Output return File_Type; function Standard_Output return File_Access;
function Standard_Error return File_Type; function Standard_Error return File_Access;
function Current_Input return File_Type; function Current_Input return File_Access;
function Current_Output return File_Type; function Current_Output return File_Access;
function Current_Error return File_Type; function Current_Error return File_Access;
procedure Flush (File : in out File_Type); procedure Flush;
Erroneous Execution
Static Semantics
procedure Set_Line_Length(File : in File_Type; To : in Count); procedure Set_Line_Length(To : in Count);
procedure Set_Page_Length(File : in File_Type; To : in Count); procedure Set_Page_Length(To : in Count);
function Line_Length(File : in File_Type) return Count; function Line_Length return Count;
function Page_Length(File : in File_Type) return Count; function Page_Length return Count;
Static Semantics
procedure New_Line(File : in File_Type; Spacing : in Positive_Count := 1); procedure New_Line(Spacing : in Positive_Count := 1);
procedure Skip_Line(File : in File_Type; Spacing : in Positive_Count := 1); procedure Skip_Line(Spacing : in Positive_Count := 1);
function End_Of_Line(File : in File_Type) return Boolean; function End_Of_Line return Boolean;
procedure New_Page(File : in File_Type); procedure New_Page;
procedure Skip_Page(File : in File_Type); procedure Skip_Page;
function End_Of_Page(File : in File_Type) return Boolean; function End_Of_Page return Boolean;
function End_Of_File(File : in File_Type) return Boolean; function End_Of_File return Boolean;
procedure Set_Col(File : in File_Type; To : in Positive_Count); procedure Set_Col(To : in Positive_Count);
procedure Set_Line(File : in File_Type; To : in Positive_Count); procedure Set_Line(To : in Positive_Count);
function Col(File : in File_Type) return Positive_Count; function Col return Positive_Count;
function Line(File : in File_Type) return Positive_Count; function Line return Positive_Count;
function Page(File : in File_Type) return Positive_Count; function Page return Positive_Count;
Static Semantics
N : Integer; ... Get(N);
-- Characters at input Sequence input Value of N -- bb-12535b -12535 -12535 -- bb12_535e1b 12_535e1 125350 -- bb12_535e; 12_535e (none) Data_Error raised
Put(Item => -23, Width => 2); -- "-23"
Static Semantics
procedure Get(File : in File_Type; Item : out Character); procedure Get(Item : out Character);
procedure Put(File : in File_Type; Item : in Character); procedure Put(Item : in Character);
procedure Look_Ahead (File : in File_Type; Item : out Character; End_Of_Line : out Boolean); procedure Look_Ahead (Item : out Character; End_Of_Line : out Boolean);
procedure Get_Immediate(File : in File_Type; Item : out Character); procedure Get_Immediate(Item : out Character);
procedure Get_Immediate(File : in File_Type; Item : out Character; Available : out Boolean); procedure Get_Immediate(Item : out Character; Available : out Boolean);
procedure Get(File : in File_Type; Item : out String); procedure Get(Item : out String);
procedure Put(File : in File_Type; Item : in String); procedure Put(Item : in String);
procedure Get_Line(File : in File_Type; Item : out String; Last : out Natural); procedure Get_Line(Item : out String; Last : out Natural);
procedure Put_Line(File : in File_Type; Item : in String); procedure Put_Line(Item : in String);
Implementation Advice
Static Semantics
subtype Number_Base is Integer range 2 .. 16;
Default_Width : Field := Num'Width; Default_Base : Number_Base := 10;
procedure Get(File : in File_Type; Item : out Num; Width : in Field := 0); procedure Get(Item : out Num; Width : in Field := 0);
procedure Put(File : in File_Type; Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base); procedure Put(Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base);
procedure Get(From : in String; Item : out Num; Last : out Positive);
procedure Put(To : out String; Item : in Num; Base : in Number_Base := Default_Base);
with Ada.Text_IO; package Ada.Integer_Text_IO is new Ada.Text_IO.Integer_IO(Integer);
package Int_IO is new Integer_IO(Small_Int); use Int_IO; -- default format used at instantiation, -- Default_Width = 4, Default_Base = 10
Put(126); -- "b126" Put(-126, 7); -- "bbb-126" Put(126, Width => 13, Base => 2); -- "bbb2#1111110#"
Static Semantics
Fore . Aft
Fore . Aft E Exp
Default_Fore : Field := 2; Default_Aft : Field := Num'Digits-1; Default_Exp : Field := 3;
Default_Fore : Field := Num'Fore; Default_Aft : Field := Num'Aft; Default_Exp : Field := 0;
procedure Get(File : in File_Type; Item : out Num; Width : in Field := 0); procedure Get(Item : out Num; Width : in Field := 0);
procedure Put(File : in File_Type; Item : in Num; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp); procedure Put(Item : in Num; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp);
procedure Get(From : in String; Item : out Num; Last : out Positive);
procedure Put(To : out String; Item : in Num; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp);
with Ada.Text_IO; package Ada.Float_Text_IO is new Ada.Text_IO.Float_IO(Float);
package Real_IO is new Float_IO(Real); use Real_IO; -- default format used at instantiation, Default_Exp = 3
X : Real := -123.4567; -- digits 8 (see section Floating Point Types)
Put(X); -- default format "-1.2345670E+02" Put(X, Fore => 5, Aft => 3, Exp => 2); -- "bbb-1.235E+2" Put(X, 5, 3, 0); -- "b-123.457"
Static Semantics
type Type_Set is (Lower_Case, Upper_Case);
Default_Width : Field := 0; Default_Setting : Type_Set := Upper_Case;
procedure Get(File : in File_Type; Item : out Enum); procedure Get(Item : out Enum);
procedure Put(File : in File_Type; Item : in Enum; Width : in Field := Default_Width; Set : in Type_Set := Default_Setting); procedure Put(Item : in Enum; Width : in Field := Default_Width; Set : in Type_Set := Default_Setting);
procedure Get(From : in String; Item : out Enum; Last : out Positive);
procedure Put(To : out String; Item : in Enum; Set : in Type_Set := Default_Setting);
Ada.Text_IO.Put('A'); -- outputs the character A
package Char_IO is new Ada.Text_IO.Enumeration_IO(Character); Char_IO.Put('A'); -- outputs the character 'A', between apostrophes
with Ada.IO_Exceptions; package Ada.Streams.Stream_IO is
type Stream_Access is access all Root_Stream_Type'Class;
type File_Type is limited private;
type File_Mode is (In_File, Out_File, Append_File);
type Count is range 0 .. implementation-defined; subtype Positive_Count is Count range 1 .. Count'Last; -- Index into file, in stream elements.
procedure Create (File : in out File_Type; Mode : in File_Mode := Out_File; Name : in String := ""; Form : in String := "");
procedure Open (File : in out File_Type; Mode : in File_Mode; Name : in String; Form : in String := "");
procedure Close (File : in out File_Type); procedure Delete (File : in out File_Type); procedure Reset (File : in out File_Type; Mode : in File_Mode); procedure Reset (File : in out File_Type);
function Mode (File : in File_Type) return File_Mode; function Name (File : in File_Type) return String; function Form (File : in File_Type) return String;
function Is_Open (File : in File_Type) return Boolean; function End_Of_File (File : in File_Type) return Boolean;
function Stream (File : in File_Type) return Stream_Access; -- Return stream access for use with T'Input and T'Output
-- Read array of stream elements from file procedure Read (File : in File_Type; Item : out Stream_Element_Array; Last : out Stream_Element_Offset; From : in Positive_Count);
procedure Read (File : in File_Type; Item : out Stream_Element_Array; Last : out Stream_Element_Offset);
-- Write array of stream elements into file procedure Write (File : in File_Type; Item : in Stream_Element_Array; To : in Positive_Count);
procedure Write (File : in File_Type; Item : in Stream_Element_Array);
-- Operations on position within file
procedure Set_Index(File : in File_Type; To : in Positive_Count);
function Index(File : in File_Type) return Positive_Count; function Size (File : in File_Type) return Count;
procedure Set_Mode(File : in out File_Type; Mode : in File_Mode);
procedure Flush(File : in out File_Type);
-- exceptions Status_Error : exception renames IO_Exceptions.Status_Error; Mode_Error : exception renames IO_Exceptions.Mode_Error; Name_Error : exception renames IO_Exceptions.Name_Error; Use_Error : exception renames IO_Exceptions.Use_Error; Device_Error : exception renames IO_Exceptions.Device_Error; End_Error : exception renames IO_Exceptions.End_Error; Data_Error : exception renames IO_Exceptions.Data_Error;
private ... -- not specified by the language end Ada.Streams.Stream_IO;
with Ada.Streams; package Ada.Text_IO.Text_Streams is type Stream_Access is access all Streams.Root_Stream_Type'Class;
function Stream (File : in File_Type) return Stream_Access; end Ada.Text_IO.Text_Streams;
with Ada.Streams; package Ada.Wide_Text_IO.Text_Streams is type Stream_Access is access all Streams.Root_Stream_Type'Class;
function Stream (File : in File_Type) return Stream_Access; end Ada.Wide_Text_IO.Text_Streams;
package Ada.IO_Exceptions is pragma Pure(IO_Exceptions);
Status_Error : exception; Mode_Error : exception; Name_Error : exception; Use_Error : exception; Device_Error : exception; End_Error : exception; Data_Error : exception; Layout_Error : exception;
end Ada.IO_Exceptions;
Dynamic Semantics
package Ada.Command_Line is pragma Preelaborate(Command_Line);
function Argument_Count return Natural;
function Argument (Number : in Positive) return String;
function Command_Name return String;
type Exit_Status is implementation-defined integer type;
Success : constant Exit_Status; Failure : constant Exit_Status;
procedure Set_Exit_Status (Code : in Exit_Status);
private ... -- not specified by the language end Ada.Command_Line;
function Argument_Count return Natural;
function Argument (Number : in Positive) return String;
function Command_Name return String;
procedure Set_Exit_Status (Code : in Exit_Status);
Implementation Permissions
Go to the first, previous, next, last section, table of contents.