2015-03-04 Robert Dewar <dewar@adacore.com>
[official-gcc.git] / gcc / ada / a-chahan.ads
blobc34e5e2e450a8da426039a80dfee1fc3547629d5
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . C H A R A C T E R S . H A N D L I N G --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
21 -- --
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
23 -- additional permissions described in the GCC Runtime Library Exception, --
24 -- version 3.1, as published by the Free Software Foundation. --
25 -- --
26 -- You should have received a copy of the GNU General Public License and --
27 -- a copy of the GCC Runtime Library Exception along with this program; --
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
29 -- <http://www.gnu.org/licenses/>. --
30 -- --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
33 -- --
34 ------------------------------------------------------------------------------
36 package Ada.Characters.Handling is
37 pragma Pure;
38 -- In accordance with Ada 2005 AI-362
40 ----------------------------------------
41 -- Character Classification Functions --
42 ----------------------------------------
44 function Is_Control (Item : Character) return Boolean;
45 function Is_Graphic (Item : Character) return Boolean;
46 function Is_Letter (Item : Character) return Boolean;
47 function Is_Lower (Item : Character) return Boolean;
48 function Is_Upper (Item : Character) return Boolean;
49 function Is_Basic (Item : Character) return Boolean;
50 function Is_Digit (Item : Character) return Boolean;
51 function Is_Decimal_Digit (Item : Character) return Boolean
52 renames Is_Digit;
53 function Is_Hexadecimal_Digit (Item : Character) return Boolean;
54 function Is_Alphanumeric (Item : Character) return Boolean;
55 function Is_Special (Item : Character) return Boolean;
56 function Is_Line_Terminator (Item : Character) return Boolean;
57 function Is_Mark (Item : Character) return Boolean;
58 function Is_Other_Format (Item : Character) return Boolean;
59 function Is_Punctuation_Connector (Item : Character) return Boolean;
60 function Is_Space (Item : Character) return Boolean;
62 ---------------------------------------------------
63 -- Conversion Functions for Character and String --
64 ---------------------------------------------------
66 function To_Lower (Item : Character) return Character;
67 function To_Upper (Item : Character) return Character;
68 function To_Basic (Item : Character) return Character;
70 function To_Lower (Item : String) return String;
71 function To_Upper (Item : String) return String;
72 function To_Basic (Item : String) return String;
74 ----------------------------------------------------------------------
75 -- Classifications of and Conversions Between Character and ISO 646 --
76 ----------------------------------------------------------------------
78 subtype ISO_646 is
79 Character range Character'Val (0) .. Character'Val (127);
81 function Is_ISO_646 (Item : Character) return Boolean;
82 function Is_ISO_646 (Item : String) return Boolean;
84 function To_ISO_646
85 (Item : Character;
86 Substitute : ISO_646 := ' ') return ISO_646;
88 function To_ISO_646
89 (Item : String;
90 Substitute : ISO_646 := ' ') return String;
92 ------------------------------------------------------
93 -- Classifications of Wide_Character and Characters --
94 ------------------------------------------------------
96 -- Ada 2005 AI 395: these functions are moved to Ada.Characters.Conversions
97 -- and are considered obsolete in Ada.Characters.Handling. However we do
98 -- not complain about this obsolescence, since in practice it is necessary
99 -- to use these routines when creating code that is intended to run in
100 -- either Ada 95 or Ada 2005 mode.
102 -- We do however have to flag these if the pragma No_Obsolescent_Features
103 -- restriction is active (see Restrict.Check_Obsolescent_2005_Entity).
105 function Is_Character (Item : Wide_Character) return Boolean;
106 function Is_String (Item : Wide_String) return Boolean;
108 ------------------------------------------------------
109 -- Conversions between Wide_Character and Character --
110 ------------------------------------------------------
112 -- Ada 2005 AI 395: these functions are moved to Ada.Characters.Conversions
113 -- and are considered obsolete in Ada.Characters.Handling. However we do
114 -- not complain about this obsolescence, since in practice it is necessary
115 -- to use these routines when creating code that is intended to run in
116 -- either Ada 95 or Ada 2005 mode.
118 -- We do however have to flag these if the pragma No_Obsolescent_Features
119 -- restriction is active (see Restrict.Check_Obsolescent_2005_Entity).
121 function To_Character
122 (Item : Wide_Character;
123 Substitute : Character := ' ') return Character;
125 function To_String
126 (Item : Wide_String;
127 Substitute : Character := ' ') return String;
129 function To_Wide_Character
130 (Item : Character) return Wide_Character;
132 function To_Wide_String
133 (Item : String) return Wide_String;
135 private
136 pragma Inline (Is_Alphanumeric);
137 pragma Inline (Is_Basic);
138 pragma Inline (Is_Character);
139 pragma Inline (Is_Control);
140 pragma Inline (Is_Digit);
141 pragma Inline (Is_Graphic);
142 pragma Inline (Is_Hexadecimal_Digit);
143 pragma Inline (Is_ISO_646);
144 pragma Inline (Is_Letter);
145 pragma Inline (Is_Line_Terminator);
146 pragma Inline (Is_Lower);
147 pragma Inline (Is_Mark);
148 pragma Inline (Is_Other_Format);
149 pragma Inline (Is_Punctuation_Connector);
150 pragma Inline (Is_Space);
151 pragma Inline (Is_Special);
152 pragma Inline (Is_Upper);
153 pragma Inline (To_Basic);
154 pragma Inline (To_Character);
155 pragma Inline (To_Lower);
156 pragma Inline (To_Upper);
157 pragma Inline (To_Wide_Character);
159 end Ada.Characters.Handling;